blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
268
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
5
118
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
816 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
2.31k
677M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
151 values
src_encoding
stringclasses
33 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.3M
extension
stringclasses
119 values
content
stringlengths
3
10.3M
authors
listlengths
1
1
author_id
stringlengths
0
228
38523f0038f90739508fc836256e29a1a6702f03
bb34fff90c9e688155c3d530966b06f5a52f04c9
/mm-camera/mm-camera2/media-controller/modules/stats/q3a/af/af_algo_interface/af_alg_interface.h
b896029563fc483ea85f4c40aa21d6c6e1bc3003
[]
no_license
pkm774/vendor_qcom_proprietary
27f90ae736c031497a9a26d7ebb4cf0dde62063b
00578532a2e2e308ebcf26cf3b7c0c89b4f4cf02
refs/heads/master
2022-04-15T13:11:12.061157
2020-04-09T04:03:54
2020-04-09T04:03:54
null
0
0
null
null
null
null
UTF-8
C
false
false
9,975
h
/* af_alg_interface.h * * Copyright (c) 2015-2016 Qualcomm Technologies, Inc. * All Rights Reserved. * Confidential and Proprietary - Qualcomm Technologies, Inc. */ #ifndef __AF_ALG_INTF_H__ #define __AF_ALG_INTF_H__ #include "af_data_type.h" #include "chromatix_common.h" #include "af_alg_util_interface.h" /* ======================================================================= DEFINITIONS AND DECLARATIONS This section contains definitions for constants, macros, types, variables and other items needed by this interface. ========================================================================== */ /* ----------------------------------------------------------------------- ** Constant / Define Declarations ** ----------------------------------------------------------------------- */ /* Macro Definition */ #define AF_STABILITY_HIGH (100) #define AF_STABILITY_LOW (0) #define AF_STABILITY_NOT_AVAILABLE (-1) #define AF_CONFIDENCE_HIGH (100) #define AF_CONFIDENCE_MEDIUM (50) #define AF_CONFIDENCE_LOW (0) #define AF_CONFIDENCE_NOT_AVAILABLE (-1) #define AF_FOCUS_LEVEL_HIGH (100) #define AF_FOCUS_LEVEL_LOW (0) #define AF_FOCUS_LEVEL_NOT_AVAILABLE (-1) #define AF_PROGRESS_100_DONE (100) #define AF_PROGRESS_50_RUNNING (50) #define AF_PROGRESS_0_NONE (0) #define AF_PROGRESS_NOT_AVAILABLE (-1) /* ----------------------------------------------------------------------- ** Type Declarations ** ----------------------------------------------------------------------- */ /** _af_haf_monitor_data_t: * Output monitor data generated by process_monitor API * * @focus_level : Indication on how focus current scene is * @stability : Indication on how stable current scene is * @confidence : Confidence level on process_monitor API * @target_pos : estimated target position **/ typedef struct _af_haf_monitor_data_t { int focus_level; int stability; boolean is_trig_refocus; int confidence; int target_pos; } af_haf_monitor_data_t; /** _af_haf_focus_search_data_t: * Output search data generated by process_search API * * @progress : Progression indication on process_search API * @next_pos : Next target lens position to be moved to * @target_pos : estimated target position * @range_near : Fine search range near end * @range_far : Fine search range far end * @fine_step_size : Fine scan step size * @confidence : Confidence level on search result * @need_fine_scan_extension : Flag for enabling fine search extension **/ typedef struct _af_haf_focus_search_data_t { int progress; int next_pos; int target_pos; int range_near; int range_far; int fine_step_size; int confidence; int need_fine_scan_extension; int fallback_to_fconv_when_scene_change; } af_haf_focus_search_data_t; /** _af_haf_fallback_opt_t: * Fallback optimization Configuration/Data * * NOTE:Please Keep in mind that putting negative valid * indicates non valid parameter * * @is_opt_valid : flag to indicate validaty of Data * @search_dir : Search Direction for Optimization * @start_pos : Start lens position for Optimization * @search_range_near_pos : Near end position in search range * @search_range_far_pos : Far end position in search range **/ typedef struct _af_haf_fallback_opt_t { boolean is_opt_valid; int search_dir; int start_pos; int search_range_near_pos; int search_range_far_pos; int focus_converge_status; } af_haf_fallback_opt_t; /** af_haf_set_parameter_type: * List of AF parameters that can be used by other componenets to set. **/ typedef enum { AF_HAF_SET_PARAM_ROI, /* ROI information */ /* - in case of Touch/Face */ AF_HAF_SET_PARAM_UPDATE_AEC_INFO, /* Update aec info */ AF_HAF_SET_PARAM_UPDATE_GRAVITY_VECTOR, /* update gravity vector */ AF_HAF_SET_PARAM_DEPTH_SERVICE, /* Depth map input to AF algorithm*/ AF_HAF_SET_PARAM_STATS_TS_DATA, /* To send timestamp info to haf algo */ AF_HAF_SET_PARAM_CAF_INPUT, /* CAF Input from traditional CAF */ AF_HAF_SET_PARAM_IS_FIRST_RUN, /* HAF is first run flag */ AF_HAF_SET_PARAM_IS_SPOTLIGHT_DETECTED, /* Spotlight is detected flag */ AF_HAF_SET_PARAM_EXTENDED_TUNING, /* Tuning params that cannot fit chromatix Hdr*/ AF_HAF_SET_PARAM_ROLE_SWITCH, /* Allow HAF to be aware what role algorithm is in*/ AF_HAF_SET_PARAM_PEER_FOCUS_INFO, /* Informs about Peer Algorithms Focus Info*/ AF_HAF_SET_PARAM_LENS_INFO, /* Informs about Actuator Info*/ AF_HAF_SET_CUSTOM_PARAM, /* Custom HAF Param*/ AF_HAF_SET_PARAM_UPDATE_SENSOR_INFO, /* Update image sensor information */ AF_HAF_SET_PARAM_LED_RUNNING, /*Face PDAF for LED case*/ AF_HAF_SET_PARAM_MAX = 0xFF, /* TODO */ } af_haf_set_parameter_type; /** _af_haf_tune_params_t: * @af_haf_tune_params_t: Tuning parameters for haf **/ typedef struct _af_haf_tune_params_t { af_algo_tune_parms_adapter_t *p_tuning; af_haf_enable_type *enable; } af_haf_tune_params_t; /** _af_stats_ts_data_t: * @frame_id: frame id * @time_stamp: time stamp for the frame id **/ typedef struct _af_stats_ts_data_t { uint32_t frame_id; time_stamp_t time_stamp; } af_stats_ts_data_t; typedef struct _af_stats_caf_input_t { boolean is_caf_changed_sad; boolean is_caf_changed_gyro; boolean scene_chg_during_srch; boolean is_caf_changed; boolean is_caf_stable; } af_stats_caf_input_t; /** _af_haf_set_parameter: Used for setting AF parameters * @type: parameter type as listed by af_set_parameter_type * @current_frame_id: SOF id wrt to set param * @af_roi_info: contents hold AF ROI information * @aec_info: TODO * * Used for setting AF parameters **/ typedef struct _af_haf_set_parameter { af_haf_set_parameter_type type; unsigned int current_frame_id; union { af_input_from_aec_t aec_info; af_roi_info_t af_roi_info; af_input_from_gravity_vector_t gravity_info; af_input_from_img_sensor_t sensor_info; af_depth_service_output_t depth_service; af_stats_ts_data_t af_stats_ts; af_stats_caf_input_t caf_input; boolean is_haf_first_run; boolean is_spotlight_detected; af_core_tuning_params_t extended_tuning_info; af_core_focus_info af_peer_focus_info; af_lens_actuator_info_t af_lens_info; af_role_switch_params_t role_switch; boolean af_follow_mode; boolean af_led_assist; void *customData; } u; } af_haf_set_parameter_t; /* ----------------------------------------------------------------------- ** Forward Declarations ** ----------------------------------------------------------------------- */ typedef struct _af_alg_interface_t af_alg_interface_t; /* ----------------------------------------------------------------------- ** af_alg_interface API ** ----------------------------------------------------------------------- */ /** _af_alg_interface_t: * Hybrid AF framework API exposed by underlying AF algorithm * * @*set_parameters : API method to pass in algorithm configuration params * @*set_inputs : API method to pass in algorithm inputs * @*set_tuning : API method to pass in Chromatix tuning data explicitly * @*set_mode : API method to pass in mode inputs explicitly * @*set_camera_mode : API method to pass in Camera run mode inputs explicitly * @*set_roi : API method to pass in roi inputs explictly * @*set_range : API method to pass in range inputs explictly * @*set_sensitivity : API method to pass sensitivity values * @*get_debug_data : API method to get the debug data * @*process_monitor : API method to invoke algorithm monitor functionality * @*process_search : API method to invoke algorithm search functionality * @*get_fallback_optimization : API method to retrieve fallback optimization values * @*destroy : API method to invoke algorithm self deallocation **/ struct _af_alg_interface_t { boolean (*set_parameters)(af_alg_interface_t *p_alg, af_haf_set_parameter_t *param); boolean (*set_inputs)(af_alg_interface_t *p_alg, af_haf_set_parameter_t *param); boolean (*set_tuning)(af_alg_interface_t *p_alg, af_haf_tune_params_t *haf_tuning); boolean (*set_sensitivity)(af_alg_interface_t *p_alg, int sensitivity); void (*set_mode)(af_alg_interface_t *p_alg, af_mode_type mode); void (*set_camera_mode)(af_alg_interface_t *p_alg, af_run_mode_type run_mode); void (*set_roi)(af_alg_interface_t *p_alg, af_roi_info_t *roi); void (*set_range)(af_alg_interface_t *p_alg, int near, int far); void (*get_debug_data)(af_alg_interface_t *p_alg, void* debug_data, int haf_index); boolean (*get_fallback_optimization)(af_alg_interface_t *p_alg, af_haf_fallback_opt_t *p_fallback_opt); boolean (*process_monitor)(af_alg_interface_t *p_alg, af_haf_monitor_data_t *output, int cur_pos); boolean (*process_search)(af_alg_interface_t *p_alg, af_haf_focus_search_data_t *output, int cur_pos); void (*destroy)(af_alg_interface_t *p_alg); boolean (*rebase_reference)(af_alg_interface_t *p_alg); }; #endif
[ "priyabratofficial1717@gmail.com" ]
priyabratofficial1717@gmail.com
f13021a57bbffebce62fee1b74aab43940fa5e08
2a8bef3a3a92a3110c78349754dc6abc17010d38
/c_tests/sum.c
a51c0fafc390e1e86561743cb19934fbf081fb82
[]
no_license
GITBSB/c_exercises
bc119e9cc7415f185ee1e6143f2c545dd3c7f1d5
9a79d7098544aa777126a0d03504dedc879f4215
refs/heads/master
2021-01-12T12:13:09.338852
2016-10-30T18:31:12
2016-10-30T18:31:12
72,367,362
0
0
null
null
null
null
UTF-8
C
false
false
474
c
#include <stdio.h> #include <ctype.h> int main() { int sum = 0; int n; printf("Zahlen eingeben"); while (1) { int i = scanf("%d", &n); if(i == EOF) { fprintf(stderr, "eingabefehler\n"); break; } else if (i == 0) { char c; fprintf(stderr, "Eingabe keine Zahl\n"); while ((c =getchar()) != EOF && !isspace(c)) { putc(c, stderr); } putc('\n', stderr); continue; } sum += n; } printf("Summe: %d\n", sum); return 0; }
[ "conquiztadoracc@web.de" ]
conquiztadoracc@web.de
96acb6a083e263b6530e4eb14b7ec6dc2d4dcb0d
747a8bd3bf7f39da79b2d3fdf6da59a995eb5712
/p1_globals.c
78e651e9ccea872b0c1fb333585980fcb99f5afb
[]
no_license
zincxenon/eecs381proj1
7c386a6f43c30fee687b4d580aff39f3f872c11c
ef4a47642d60828db287a788612b38824f1ab8f0
refs/heads/master
2021-01-16T01:07:54.010001
2015-01-30T22:35:48
2015-01-30T22:35:48
null
0
0
null
null
null
null
UTF-8
C
false
false
90
c
#include "p1_globals.h" int g_string_memory = 0; /* number of bytes used in C-strings */
[ "scottbommarito@gmail.com" ]
scottbommarito@gmail.com
4e6bc3759d6044aee2245fd625bafe2258babfc3
885bb82434e741bb169c3b5d21295c6b2890d1c7
/romfs.h
57cd89418f38f216dc5acb90fc50ad254b5db908
[ "MIT" ]
permissive
linersheng/embedded-ac-controller
63b49c2f1683209a4aa31f5d30824fdc45cc6c68
40ce730b92f9bdc19ed31152f5516da7e2c53d95
refs/heads/master
2021-01-15T08:32:29.343060
2012-02-10T00:11:37
2012-02-10T00:11:37
null
0
0
null
null
null
null
UTF-8
C
false
false
1,734
h
/* * Copyright (c) 2009 Braiden Kindt * * 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. * */ #pragma once #include <avr/pgmspace.h> #define ROMFS_DIRECTORY 0 #define ROMFS_IS_DIRECTORY(node) ((node).file_attr & _BV(ROMFS_DIRECTORY)) typedef struct romfs_node { uint8_t filename_len; uint8_t file_attr; uint16_t data_len; PGM_P filename; PGM_VOID_P data; } romfs_node_t; // the linker must export this symbol // which points to binary blob in .text. // the address is in program space, and // not directly readable. extern romfs_node_t romfs_text; void romfs_root(romfs_node_t *rootnode); uint8_t romfs_open(romfs_node_t *dirnode, romfs_node_t *result, char *fname);
[ "braiden@braiden.org" ]
braiden@braiden.org
59124876fc71512b4797d2bfa7534d8c46c4f760
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14651/function14651_schedule_25/function14651_schedule_25_wrapper.h
e1949bca053adee99f0dd20a513b2487e3cb03c7
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C
false
false
330
h
#ifndef HALIDE__generated_function14651_schedule_25_h #define HALIDE__generated_function14651_schedule_25_h #include <tiramisu/utils.h> #ifdef __cplusplus extern "C" { #endif int function14651_schedule_25(halide_buffer_t *buf00, halide_buffer_t *buf01, halide_buffer_t *buf0); #ifdef __cplusplus } // extern "C" #endif #endif
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
0652be063d7be0e9081eac3e91a318d19d30f3d2
65f9576021285bc1f9e52cc21e2d49547ba77376
/adsp_proc/core/services/diag/micro_diagbuffer/src/micro_diagbuffer.c
15fb5a3275b645a006180c0fbc86060d7a1b1397
[]
no_license
AVCHD/qcs605_root_qcom
183d7a16e2f9fddc9df94df9532cbce661fbf6eb
44af08aa9a60c6ca724c8d7abf04af54d4136ccb
refs/heads/main
2023-03-18T21:54:11.234776
2021-02-26T11:03:59
2021-02-26T11:03:59
null
0
0
null
null
null
null
UTF-8
C
false
false
26,842
c
/*============================================================================ micro_diagbuffer.c Public-facing/support micro diagbuffer front-end functions. Copyright (c) 2015-2017 Qualcomm Technologies Incorporated. All Rights Reserved. Qualcomm Confidential and Proprietary ============================================================================*/ /* $Header: //components/rel/core.qdsp6/2.1/services/diag/micro_diagbuffer/src/micro_diagbuffer.c#2 $ */ /*========================================================================== when who what, where, why -------- --- ---------------------------------------------------------- 06/20/17 rs Fixed micro_ULog_CreateLog function that doesn't handle already initialized logs 06/12/17 sp Add support for microULog debug capability and moved the island mode API's to a new file 06/08/17 gn Added support for diag services to uImage 06/10/16 as Fixed external references from Diag in island mode to enable whitelisting 02/18/16 as Added check for integer overflow in micro_ULogInternal_FreeSpaceForNewMsg 02/11/16 as Resolved integer overflow and definition of 'remainingSpace' 11/19/15 as Resolved error checking of log name 10/28/15 is Resolve issues with micro_log_submit_ext() and MICRO_MSG_*_EXT() APIs 08/16/15 vk as part of micro diagbuffer drain changes moved #defines to allow them to be visible in other .c files 06/12/15 is Add support to log Diag msgs, logs, and events ===========================================================================*/ #include "CoreVerify.h" #include "micro_diagbuffer.h" #include "event_defs.h" /* For event_id_enum_type */ #include "log.h" /* For log_code_type */ #include "qurt.h" /* For qurt_island_get_status */ #include "MemBarrier.h" #include "micro_diagbuffer_i.h" /** * Routines */ /** * Function prototypes for vTable entries */ micro_ULogResult micro_ULogInternal_STMWrite( micro_ULogHandle log, uint32 firstMsgSize, const char *firstMsgData, uint32 secondMsgSize, const char *secondMsgData ); /** * Vtables for common transports */ MICRO_ULOG_CORE_VTABLE CoreVtableSTM = { micro_ULogInternal_STMWrite, }; /** * <!-- micro_ULog_ConvertSize --> * * @brief Ulog message buffer sizes must be a power of 2 and atleast 64 bytes. */ static MICRO_ULOG_INLINE uint32 micro_ULogInternal_ConvertSize( uint32 size ) { uint32 output; if ( size < MICRO_ULOG_MIN_BUF_SIZE ) { size = MICRO_ULOG_MIN_BUF_SIZE; } /* Compute the nearest power of 2 < size */ output = 0; while ( size != 1 ) { size >>= 1; output++; } output = 1 << output; return output; } /** * <!-- micro_ULog_Init --> * * @brief Initialize micro_Ulog */ static void micro_ULog_Init( void ) { /* micro_ULog globals are initialized when the first log is created */ if ( micro_ulogContext.logHead == NULL ) { MICRO_ULOG_TARGET_LOCK_INIT( micro_ulogContext.gLock ); } } /** * <!-- micro_ULog_CreateLog --> * * @brief Creates a new lockless microUlog in the given memory buffer. * Users are required to use the MICRO_ULOG_MEM_NEEDED macro to compute the * size of memory buffer to pass in, based on desired message buffer size. * * @param hPtr : [OUT] Pass in the address of a micro_UlogHandle; will be set * to the newly created microUlog * @param logName : name of the log, must be < MICRO_ULOG_MAX_NAME_SIZE * @param mem : Pointer to the memory to create the microUlog in * @param finalMsgBufSize : [OUT] Returns the actual size of the microUlog's * message buffer * @param memSize : Size of memory pointed to by "mem" * * @return MICRO_ULOG_SUCCESS on success, MICRO_ULOG_ERR_BUFFER_TOO_SMALL if * the provided memory does not allow creation of a microUlog with a 64-byte * message buffer size, MICRO_ULOG_ERROR on other errors */ micro_ULogResult micro_ULog_CreateLog( micro_ULogHandle *hPtr, const char * logName, char * mem, uint32 *pFinalMsgBufSize, uint32 memSize ) { MICRO_ULOG_TYPE * log; uint32 namelen; uint32 realBufferSize; uint32 remainingSpace = 0; MICRO_ULOG_TYPE* tempLog; boolean presentFlag = FALSE; /* If in island mode, do not allow buffers to be created */ if ( qurt_island_get_status() == TRUE ) { return MICRO_ULOG_ERROR; } if ( !hPtr || !mem ) { return MICRO_ULOG_ERROR; } if ( memSize < MICRO_ULOG_PADCOUNT(sizeof(MICRO_ULOG_TYPE)) ) { return (MICRO_ULOG_ERROR); } remainingSpace = memSize - MICRO_ULOG_PADCOUNT(sizeof(MICRO_ULOG_TYPE)); /* Verify there is enough space for atleast a MICRO_ULOG_MIN_BUF_SIZE-byte sized msg buffer */ if ( remainingSpace < MICRO_ULOG_MIN_BUF_SIZE ) { return MICRO_ULOG_ERR_BUFFER_TOO_SMALL; } /* Validate the name of the log */ namelen = strnlen(logName, MICRO_ULOG_MAX_NAME_SIZE + 1); if ( namelen > MICRO_ULOG_MAX_NAME_SIZE || namelen == 0 ) { return MICRO_ULOG_ERR_INVALIDNAME; } micro_ULog_Init(); log = (MICRO_ULOG_TYPE *)mem; MICRO_ULOG_TARGET_LOCK_GET( micro_ulogContext.gLock ); /* Check to see if this log has already been added to the global list */ tempLog = micro_ulogContext.logHead; while((tempLog != NULL) && !presentFlag) { if(tempLog==log) presentFlag = TRUE; else tempLog = tempLog->next; } /* If presentFlag turns out to be TRUE, retuning an existing one */ if(presentFlag) { MICRO_ULOG_TARGET_LOCK_RELEASE( micro_ulogContext.gLock ); *hPtr = (micro_ULogHandle)mem; return (MICRO_ULOG_ERR_ALREADYCREATED); } /* Log does not exist, clear contents and initialize */ memset( (void *)log, 0, memSize ); /* Round down to the nearest power of two */ realBufferSize = micro_ULogInternal_ConvertSize( remainingSpace ); MICRO_ULOG_STRLCPY( log->name, logName, MICRO_ULOG_MAX_NAME_SIZE + 1 ); /* Link in the log into the list */ log->next = micro_ulogContext.logHead; micro_ulogContext.logHead = log; MICRO_ULOG_TARGET_LOCK_RELEASE( micro_ulogContext.gLock ); /* Initialize flags */ log->version = MICRO_ULOG_TYPE_LOG_HEADER_VERSION; log->transport = MICRO_ULOG_TRANSPORT_RAM; log->feature_flags1 = MICRO_ULOG_FF1_64_BIT_TS; /* Assign buffer */ log->buffer = mem + MICRO_ULOG_PADCOUNT( sizeof(MICRO_ULOG_TYPE) ); log->bufSize = realBufferSize; MICRO_ULOG_INIT_TIMESTAMP(); /* Enable the log */ log->logStatus |= (MICRO_ULOG_STATUS_DEFINED | MICRO_ULOG_STATUS_ENABLED); /* Assign the log we just created to the handle the caller passed in */ *hPtr = (micro_ULogHandle)log; /* If asked to return the finalMsgBufSize, do so */ if ( pFinalMsgBufSize ) { *pFinalMsgBufSize = realBufferSize; } return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULog_CreateLockableLog --> * * @brief Creates a new lockable microUlog in the given memory buffer. * Users are required to use the MICRO_ULOG_MEM_NEEDED macro to compute the * size of memory buffer to pass in, based on desired message buffer size. * * @param hPtr : [OUT] Pass in the address of a micro_UlogHandle; will be set * to the newly created microUlog * @param logName : name of the log, must be < MICRO_ULOG_MAX_NAME_SIZE * @param mem : Pointer to the memory to create the microUlog in * @param finalMsgBufSize : [OUT] Returns the actual size of the microUlog's * message buffer * @param memSize : Size of memory pointed to by "mem" * * @return MICRO_ULOG_SUCCESS on success, MICRO_ULOG_ERR_BUFFER_TOO_SMALL if * the provided memory does not allow creation of a microUlog with a 64-byte * message buffer size, MICRO_ULOG_ERROR on other errors */ micro_ULogResult micro_ULog_CreateLockableLog( micro_ULogHandle *hPtr, const char * logName, char * mem, uint32 *pFinalMsgBufSize, uint32 memSize ) { MICRO_ULOG_TYPE * log; micro_ULogResult ret; ret = micro_ULog_CreateLog( hPtr, logName, mem, pFinalMsgBufSize, memSize ); if ( ret != MICRO_ULOG_SUCCESS ) { return ret; } log = (MICRO_ULOG_TYPE *)(*hPtr); /* Create lock */ MICRO_ULOG_TARGET_LOCK_INIT( log->lock ); /* Tag the log as lockable */ log->feature_flags1 |= MICRO_ULOG_FF1_WLOCK; return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULog_ResetLog --> * * @brief Resets a log by moving the read and write pointers to the beginning * of the circular RAM buffer. */ static micro_ULogResult micro_ULog_ResetLog( micro_ULogHandle log ) { if ( !log ) { return MICRO_ULOG_ERROR; } MICRO_ULOG_LOCK_LOG( log ); /* Set all indices back to zero and clear flags */ log->write = 0; log->readWriter = 0; log->read = 0; log->readFlags = 0; /* Set a reset bit in usageData and increment resetCount to indicate that this happened */ log->usageData = MICRO_ULOG_ERR_RESET; ++log->resetCount; MICRO_ULOG_UNLOCK_LOG( log ); return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULogInternal_FreeSpaceForNewMsg --> * * @brief Returns MICRO_ULOG_SUCCESS if it is able to free space (by possibly * invalidating older messages) for an incoming message with the given size. */ #define MICRO_ULOG_MAX_FREE_ATTEMPTS \ (MICRO_ULOG_MAX_MSG_SIZE/MICRO_ULOG_MIN_MSG_SIZE) static micro_ULogResult micro_ULogInternal_FreeSpaceForNewMsg( MICRO_ULOG_TYPE *log, uint32 newMsgSize ) { uint32 oldMsgSize; uint32 bufferNeeded; uint32 freeAttempts = 0; uint32 bufsize_mask = MICRO_ULOG_BUFSIZE_MASK( log ); /* Impossible to make space if newMsgSize is bigger than the buffer size */ if ( newMsgSize > log->bufSize ) { log->usageData |= MICRO_ULOG_ERR_LARGEMSG; return MICRO_ULOG_ERROR; } /* Determine if there is enough free space for the new message. * If not, remove old messages until there is enough room. * * In order to add the message: * Current message data in buffer = write - readWriter * Current message data + new message <= Buffer size */ bufferNeeded = (log->write - log->readWriter) + newMsgSize; /* Loop until we create enough space for the new message */ while ( bufferNeeded > log->bufSize ) { /* Detect a a wrap condition. We're about to move the readWriter forward * to free up space. This will overwrite the oldest messages in the log. * 99% of the time SW on the device isn't reading the logs, so read is 0 * and read == readWriter == 0 indicates that we've wrapped for the first * time. We tag usageData with MICRO_ULOG_LOG_WRAPPED to indicate this. */ if ( log->read == log->readWriter ) { log->usageData |= MICRO_ULOG_LOG_WRAPPED; } /* Remove the oldest message to free memory for the new message */ oldMsgSize = ((*((uint32 *)&log->buffer[log->readWriter & bufsize_mask]) & MICRO_ULOG_LENGTH_MASK) >> MICRO_ULOG_LENGTH_SHIFT); if (oldMsgSize == 0) { return MICRO_ULOG_ERROR; } else { oldMsgSize = MICRO_ULOG_PADCOUNT( oldMsgSize ); log->readWriter += oldMsgSize; if ( bufferNeeded >= oldMsgSize ) { bufferNeeded -= oldMsgSize; } else { /* We have made enough room for the next msg, hence bytes needed in the buffer = 0 */ bufferNeeded = 0; } /* We've seen rare crash reports where this loop gets stuck because these * critical pointers get corrupted due to hardware memory corruption. * If the log is ever in an impossible state, reset it. */ if ( (log->write - log->readWriter) > log->bufSize ) { micro_ULog_ResetLog( log ); bufferNeeded = newMsgSize; } /* Making space for new logs relies on the integrity of previous logs. * In rare hardware memory corruption cases, this reliance can cause * problems with this loop. As failsafe, this loop cannot run more than * the times needed to free space for the largest possible message * (MICRO_ULOG_MAX_MSG_SIZE). There is no log message smaller than * MICRO_ULOG_MIN_MSG_SIZE, so any attempt to make space more than * MICRO_ULOG_MAX_MSG_SIZE/MICRO_ULOG_MIN_MSG_SIZE times will cause a * log reset. */ freeAttempts++; if ( freeAttempts > MICRO_ULOG_MAX_FREE_ATTEMPTS || oldMsgSize > MICRO_ULOG_MAX_MSG_SIZE || oldMsgSize < MICRO_ULOG_MIN_MSG_SIZE ) { micro_ULog_ResetLog( log ); bufferNeeded = newMsgSize; } } } return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULogInternal_PrepareForMessage --> * * @brief Prepares the log for the next message, removing old entries as * necessary. Fails if message is too big or if space cannot be cleared. */ static micro_ULogResult micro_ULogInternal_PrepareForMessage( MICRO_ULOG_TYPE *log, uint32 msgCount ) { uint32 newMsgSize = MICRO_ULOG_PADCOUNT( msgCount ); micro_ULogResult rval = MICRO_ULOG_SUCCESS; if (((log->logStatus & MICRO_ULOG_STATUS_ENABLED) != MICRO_ULOG_STATUS_ENABLED) || (newMsgSize > MICRO_ULOG_MAX_MSG_SIZE)) { return MICRO_ULOG_ERROR; } if (micro_ULogInternal_FreeSpaceForNewMsg( log, newMsgSize ) != MICRO_ULOG_SUCCESS) rval = MICRO_ULOG_ERROR; // The readWriter pointer must be correct in memory before we // write to the buffer so the reader does not incorrectly read // a message as it is being overwritten. // // The message length must also be set to zero before proceeding // to stop a read of a bogus message. CORE_MEM_BARRIER(); return rval; } /** * <!-- micro_ULogInternal_UsesFastWrite --> * * @brief Check to see if fast writes can be used, or whether Vtable * writes must be used. */ boolean micro_ULogInternal_UsesFastWrite( MICRO_ULOG_TYPE *log ) { return ( log->transportVTable == NULL ); } /** * <!-- micro_ULogInternal_FastFmtSizeTS --> * * @brief Routine to write the format, message size and timestamp into logs * that can use fast RAM writes (RAM as transport, no tees). */ micro_ULogResult micro_ULogInternal_FastFmtSizeTS( MICRO_ULOG_TYPE *log, uint32 size, uint32 msg_format, uint32 *pStartIdx ) { micro_ULogResult ret = MICRO_ULOG_SUCCESS; uint32 *wordPtr; uint64 timestamp; uint32 bufsize_mask = MICRO_ULOG_BUFSIZE_MASK( log ); MICRO_ULOG_LOCK_LOG( log ); ret = micro_ULogInternal_PrepareForMessage( log, size ); if ( ret != MICRO_ULOG_SUCCESS ) { MICRO_ULOG_UNLOCK_LOG( log ); return ret; } /* Save the start_idx for caller */ *pStartIdx = log->write; /* Len/format word */ wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = msg_format; /* len remains at 0 until the msg is written */ log->write += 4; timestamp = MICRO_ULOG_GETTIME64(); //write the lower 32 bits of the timestamp wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = (uint32)timestamp; log->write += 4; //write the upper 32 bits of the timestamp wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = (uint32)((uint64)timestamp >> 32); log->write += 4; /* Lock will be released in caller */ return ret; } /** * <!-- micro_ULog_RealTimeVprintf --> * * @brief Writes printf data to the specified log * Example: micro_ULog_RealTimePrintf(handle, 3, "test %d: %s", 1, "complete"); * * @param log : Handle to the micro_diagbuffer * @param dataCount : Number of word-sized parameters in the given va_list * @param formatStr : constant pointer to the string of the msg * @param ap : A variable list of arguments to the printf * * @return MICRO_ULOG_SUCCESS on success, MICRO_ULOG_ERROR on error */ micro_ULogResult micro_ULog_RealTimeVprintf( micro_ULogHandle log, uint32 dataCount, const char *formatStr, va_list ap ) { uint32 total_size; uint32 bufsize_mask; uint64 timestamp; uint32 *wordPtr; uint32 i; micro_ULogResult ret = MICRO_ULOG_SUCCESS; if ( !log || !(log->logStatus & MICRO_ULOG_STATUS_ENABLED) || dataCount > 10 ) { return MICRO_ULOG_ERROR; } bufsize_mask = MICRO_ULOG_BUFSIZE_MASK( log ); /* len/fmt + sizeof(formatStr) + TS + data */ total_size = 4 + sizeof(formatStr) + MICRO_ULOG_TIMESTAMP_SIZE + dataCount * 4; if ( micro_ULogInternal_UsesFastWrite( log ) ) { uint32 size_idx; ret = micro_ULogInternal_FastFmtSizeTS( log, total_size, MICRO_ULOG_SUBTYPE_REALTIME_PRINTF, &size_idx ); if ( ret == MICRO_ULOG_SUCCESS ) { /* Format string */ wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = (uint32)formatStr; log->write += 4; /* Arguments */ for ( i = 0; i < dataCount; i++ ) { wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = (uint32)va_arg( ap, uint32 ); log->write += 4; } /* Update the message length */ wordPtr = (uint32 *)&(log->buffer[size_idx & bufsize_mask]); *wordPtr |= ((total_size << MICRO_ULOG_LENGTH_SHIFT) & MICRO_ULOG_LENGTH_MASK); /* Release the lock, acquired within FastFmtSizeTS */ MICRO_ULOG_UNLOCK_LOG( log ); } else { return MICRO_ULOG_ERROR; } } else /* no fastwrite */ { uint32 dataArray[15]; uint32 *dataPtr = dataArray; /* Message metadata */ *dataPtr++ = MICRO_ULOG_SUBTYPE_REALTIME_PRINTF; timestamp = MICRO_ULOG_GETTIME64(); *dataPtr++ = (uint32)timestamp; *dataPtr++ = (uint32)(timestamp >> 32); /* Format string */ *dataPtr++ = (uint32)formatStr; /* Arguments */ for ( i = 0; i < dataCount; i++ ) { *dataPtr++ = va_arg( ap, uint32 ); } ret = log->transportVTable->write( log, total_size, (char *)dataArray, 0, NULL ); } return ret; } /** * <!-- micro_ULog_RealTimePrintf --> * * @brief Writes printf data to the specified log * Example: micro_ULog_RealTimePrintf(handle, 3, "test %d: %s", 1, "complete"); * * @param log : Handle to the micro_diagbuffer * @param dataCount : Number of word-sized parameters in the given printf * @param formatStr : constant pointer to the string of the msg * * @return MICRO_ULOG_SUCCESS on success, MICRO_ULOG_ERROR on error */ micro_ULogResult micro_ULog_RealTimePrintf( micro_ULogHandle log, uint32 dataCount, const char * formatStr, ... ) { va_list ap; micro_ULogResult ret; va_start( ap, formatStr ); ret = micro_ULog_RealTimeVprintf( log, dataCount, formatStr, ap ); va_end( ap ); return ret; } /** * <!-- micro_ULog_RealTimeData --> * * @brief Writes "dataCount" number of 32-bit words to the specified log */ #ifndef DEFEATURE_REALTIMEDATA micro_ULogResult micro_ULog_RealTimeData( micro_ULogHandle log, uint32 dataCount, ... ) { uint32 total_size; uint64 timestamp; va_list ap; uint32 i; uint32 * wordPtr; uint32 bufsize_mask; micro_ULogResult ret = MICRO_ULOG_SUCCESS; if ( !log || !(log->logStatus & MICRO_ULOG_STATUS_ENABLED) || dataCount > 10 || dataCount == 0 ) { return MICRO_ULOG_ERROR; } bufsize_mask = MICRO_ULOG_BUFSIZE_MASK( log ); /* len/fmt + TS + data */ total_size = 4 + MICRO_ULOG_TIMESTAMP_SIZE + dataCount * 4; if ( micro_ULogInternal_UsesFastWrite( log ) ) { uint32 size_idx; ret = micro_ULogInternal_FastFmtSizeTS( log, total_size, MICRO_ULOG_SUBTYPE_REALTIME_WORDDATA, &size_idx ); if ( ret == MICRO_ULOG_SUCCESS ) { va_start( ap, dataCount ); for ( i = 0; i < dataCount; i++ ) { wordPtr = (uint32 *)&(log->buffer[log->write & bufsize_mask]); *wordPtr = (uint32)va_arg( ap, uint32 ); log->write += 4; } va_end( ap ); /* Update the message length */ wordPtr = (uint32 *)&(log->buffer[size_idx & bufsize_mask]); *wordPtr |= ((total_size << MICRO_ULOG_LENGTH_SHIFT) & MICRO_ULOG_LENGTH_MASK); /* Release the lock, acquired within FastFmtSizeTS */ MICRO_ULOG_UNLOCK_LOG( log ); } } else { uint32 dataArray[15]; uint32 *dataPtr = dataArray; *dataPtr++ = MICRO_ULOG_SUBTYPE_REALTIME_WORDDATA; timestamp = MICRO_ULOG_GETTIME64(); *dataPtr++ = (uint32)timestamp; *dataPtr++ = (uint32)((uint64)timestamp >> 32); va_start( ap, dataCount ); for ( i = 0; i < dataCount; i++ ) { *dataPtr++ = va_arg( ap, uint32 ); } va_end( ap ); ret = log->transportVTable->write( log, total_size, (char *)dataArray, 0, NULL ); } return ret; } #endif /** * <!-- micro_ULog_Enable --> * * @brief Enable the log */ micro_ULogResult micro_ULog_Enable( micro_ULogHandle log ) { micro_ULogResult ret = MICRO_ULOG_SUCCESS; if ( !log ) { return MICRO_ULOG_ERROR; } if ( (log->logStatus & MICRO_ULOG_STATUS_DEFINED) == 0 || log->buffer == NULL ) { ret = MICRO_ULOG_ERR_INITINCOMPLETE; } else if ( log->logStatus & MICRO_ULOG_STATUS_ENABLED ) { ret = MICRO_ULOG_ERR_ALREADYENABLED; } else { log->logStatus |= MICRO_ULOG_STATUS_ENABLED; } return ret; } /** * <!-- micro_ULog_SetTransport --> * * @brief Sets the transport of the microUlog to the given handler */ micro_ULogResult micro_ULog_SetTransport( micro_ULogHandle log, MICRO_ULOG_CORE_VTABLE *transportVTable ) { if ( !log ) { return MICRO_ULOG_ERROR; } log->transportVTable = transportVTable; log->transport = MICRO_ULOG_TRANSPORT_ALT; return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULogInternal_STMWrite --> * * @brief The write routine for logs that use QDSS as transport */ micro_ULogResult micro_ULogInternal_STMWrite( micro_ULogHandle log, uint32 firstMsgSize, const char *firstMsgData, uint32 secondMsgSize, const char *secondMsgData ) { CORE_VERIFY( log->transport == MICRO_ULOG_TRANSPORT_STM ); MICRO_ULOG_QDSS_TS_WRITE( log, firstMsgData, firstMsgSize ); if ( secondMsgSize != 0 ) { MICRO_ULOG_QDSS_NO_TS_WRITE( log, secondMsgData, secondMsgSize ); } return MICRO_ULOG_SUCCESS; } /** * <!-- micro_ULog_SetTransportToSTM --> * * @brief Sets the transport of the microUlog to QDSS/STM */ micro_ULogResult micro_ULog_SetTransportToSTM( micro_ULogHandle log ) { micro_ULogResult ret = MICRO_ULOG_SUCCESS; if ( !log ) { return MICRO_ULOG_ERROR; } if ( log->transport != MICRO_ULOG_TRANSPORT_STM ) { if ( MICRO_ULOG_QDSS_ALLOC( &log->stmPort ) == MICRO_ULOG_QDSS_SUCCESS ) { log->transportVTable = &CoreVtableSTM; log->transport = MICRO_ULOG_TRANSPORT_STM; } else { ret = MICRO_ULOG_ERROR; } } return ret; } /** * <!-- micro_ULog_SetTransportToRAM --> * * @brief Sets the transport of the microUlog (back) to RAM */ micro_ULogResult micro_ULog_SetTransportToRAM( micro_ULogHandle log ) { if ( !log ) { return MICRO_ULOG_ERROR; } /* Deregister if the current transport was QDSS */ if ( log->transport == MICRO_ULOG_TRANSPORT_STM ) { MICRO_ULOG_QDSS_FREE( &log->stmPort ); } log->transportVTable = NULL; log->transport = MICRO_ULOG_TRANSPORT_RAM; return MICRO_ULOG_SUCCESS; } #ifdef FEATURE_FAST7 /** * <!-- micro_ULog_Fast7WordWrite --> * * @brief A special routines that writes 7 words to the specified log in a * format compatible with Raw Ulogs. This function works on a log that ONLY * contains Fast7 messages to optimize the way space is freed when the log * wraps. It CANNOT be mixed with other types of writes to the same log. * Doing so would corrupt messages in that log. * * NOTE: Routine assumes a LOCKLESS log */ micro_ULogResult micro_ULog_Fast7WordWrite( micro_ULogHandle log, uint32 message[7] ) { if ( !log ) { return MICRO_ULOG_ERROR; } if ( micro_ULogInternal_UsesFastWrite( log ) ) { uint32 *buffer = (uint32 *)log->buffer; uint32 bufSize = log->bufSize; uint32 bufSizeMask = MICRO_ULOG_BUFSIZE_MASK( log ); uint32 msgSize = 7 * sizeof(uint32); uint32 msgTotalSize = 4 + msgSize; /* len/fmt + data */ uint32 bufferNeeded = log->write - log->readWriter + msgTotalSize; uint32 size_idx; if ( bufferNeeded > bufSize ) { if ( log->read == log->readWriter ) { /* Mark up the log as wrapped */ log->usageData |= MICRO_ULOG_LOG_WRAPPED; } /* Advance the readWriter pointer forward by 1 message. Note how this is * a speed optimization from normal ULogs. Since all messages are 8 words * long, erasing the old message doesn't require reading the message and * advancing the readWriter by the old message size. We simply jump * readWriter forward 8 words. This is faster, but exactly why this * Fast7 API can't be used with other APIs in the same log. */ log->readWriter += msgTotalSize; } /* 'zero' size to an appropriate word index and increment write pointer */ size_idx = (log->write & bufSizeMask) >> 2; buffer[size_idx] = 0; log->write += 4; /* write message out to buffer (except for size) */ memcpy( &buffer[size_idx + 1], message, msgSize ); log->write += msgSize; /* finally, store size and format */ buffer[size_idx] = (msgTotalSize << 16) | MICRO_ULOG_SUBTYPE_RESERVED_FOR_RAW; } else { /* Log does not use fast RAM; use VTable writes instead */ uint32 logbuf[8]; /* The first word of the message has size and the msg format */ logbuf[0] = 0x20 << MICRO_ULOG_LENGTH_SHIFT | MICRO_ULOG_SUBTYPE_RESERVED_FOR_RAW; /* put the rest of the message in the buffer */ memcpy( logbuf + 1, message, 7 * sizeof(uint32) ); /* send the prepared log message */ log->transportVTable->write( log, 8 * sizeof(uint32), (char *)logbuf, 0, NULL ); } return MICRO_ULOG_SUCCESS; } #endif /* FEATURE_FAST7 */
[ "jagadeshkumar.s@pathpartnertech.com" ]
jagadeshkumar.s@pathpartnertech.com
d4fed66074a6364042e06d730131dd9964237c55
921e995310dfc101f4c2de928de8bb05321b7182
/srcs/helper4.c
8e0f4fffeca7190e79298eff65ca90aaa821ade3
[]
no_license
chimpansiets/ft_printf
358d337289c30eb7ba70ba4ac46c165eee0a5060
6ae84a5ceb208431336a2eca4e28843d564220f3
refs/heads/master
2021-07-13T00:45:49.062027
2020-06-29T11:43:07
2020-06-29T11:43:07
170,109,058
0
0
null
null
null
null
UTF-8
C
false
false
2,064
c
/* ************************************************************************** */ /* */ /* :::::::: */ /* helper4.c :+: :+: */ /* +:+ */ /* By: svoort <svoort@student.codam.nl> +#+ */ /* +#+ */ /* Created: 2019/03/10 17:59:13 by svoort #+# #+# */ /* Updated: 2019/03/10 19:14:17 by svoort ######## odam.nl */ /* */ /* ************************************************************************** */ #include "libft.h" void if_dot(char *s, int **i, va_list *ar2) { i[0][11] = 0; **i += 1; if (s[**i] == '*' && (flbax(s, ar2, *i))) i[0][11] = va_arg(*ar2, int); else if (s[**i] > 47 && s[**i] < 58) i[0][11] = ft_atoi(s + **i); else **i -= 1; while (s[**i] > 47 && s[**i] < 58 && s[**i + 1] > 47 && s[**i + 1] < 58) **i += 1; } void ft_qstr_help(char **res, int *i, int *j, char *s) { res[0] = (char *)malloc(sizeof(char) * i[11] + 1); if (!(*res)) return ; res[0][i[11]] = '\0'; while (*j < i[11]) { res[0][*j] = s[*j]; (*j)++; } } void ft_rotng_loop(int *a, int i, char **s, char **r) { *a = i; if (**s > 64 && **s < 91) while (**s - *a < 65) *a -= 26; else if (**s > 96 && **s < 123) while (**s - *a < 97) *a -= 26; else *a = 0; **r = **s - *a; (*r)++; (*s)++; } void ft_rotnb_loop(int *a, int i, char **s, char **r) { *a = i; if (**s > 64 && **s < 91) while ((int)**s + *a > 90) *a -= 26; else if ((int)**s > 96 && **s < 123) while ((int)**s + *a > 122) *a -= 26; else *a = 0; **r = **s + *a; (*r)++; (*s)++; } void ft_outun_loop(char **s, int *c, int *b) { s[0][*c] = s[0][*b]; (*c)++; (*b)++; }
[ "svoort@f0r4s22.codam.nl" ]
svoort@f0r4s22.codam.nl
857862ee5dcd0729782778111de74747dfcc1078
5e8a940eb2387aad99df6473c5f9e1a34e335b51
/p1/TreeNode.c
a17d8eacffd9229716e6cdd6b51414b4cf91a847
[]
no_license
tlmurphy/cs201
3e3348b15928f82295552fc392b9af6897ec31cf
9d7e93bfa483adecf02952ec30ea3c8a0dd56e0c
refs/heads/master
2021-03-19T16:44:15.474114
2016-06-02T16:23:25
2016-06-02T16:23:25
49,982,759
0
0
null
null
null
null
UTF-8
C
false
false
455
c
// Tree node holds the actual integers // and containers pointers to its parent, // left child, and right child #include <stdio.h> #include <stdlib.h> #include "TreeNode.h" TreeNode *newTreeNode(int value, TreeNode *parent) { TreeNode *tn = malloc(sizeof(TreeNode)); if (tn == 0) { fprintf(stderr, "NOT ENOUGH MEMORY...EXITING"); exit(-1); } tn->value = value; tn->parent = parent; tn->LC = NULL; tn->RC = NULL; return tn; }
[ "trevorlmurphy@ymail.com" ]
trevorlmurphy@ymail.com
48674a949170d70d715bf0bf1ee252e32fed7d70
e19fc586b6b3b3990cc7267bec6bf7d2f8d276a1
/ammmeat2.c
f86402f3964030f4bd1e533c3f6e50c276e4810b
[]
no_license
ssaraogi07/programs
525a40ae111948eaa77dc4152d81354bbc711208
86acc7f4bcd41d99b8c0fb9d5550b4b1a73594af
refs/heads/master
2016-09-03T06:51:28.781277
2014-10-20T11:39:18
2014-10-20T11:39:18
null
0
0
null
null
null
null
UTF-8
C
false
false
322
c
#include<stdio.h> int main() { long long int t,i,n,k,ans; scanf("%lld",&t); while(t--) { scanf("%lld %lld",&n,&k); if(k>(n/2+1)) { ans=-1; printf("%lld\n",ans); } else { ans=1; printf("1 "); for(i=1;i<k;i++) { ans=2*i; printf("%lld ",ans); } printf("\n"); } } return 0; }
[ "Sakshi Saraogi" ]
Sakshi Saraogi
d5919970179b7e876e8d1115a5be046f6a46ddc5
010145d88f62871af06de03f759a2d6a38ef73c0
/mux_2x1/isim/mux_8x1frm4x1_tb_isim_beh.exe.sim/work/m_00000000004134447467_2073120511.c
73654c8fc733c8db447213879b587167ec0106ef
[ "MIT" ]
permissive
Jayshil-Patel/Xilinx-Verilog
07e07e85b1a722fc391df607a4d28bd9710b05a1
4c33040746809a116da442f5d310c45c18a1b2a5
refs/heads/main
2023-05-15T04:00:20.887724
2021-06-10T07:53:06
2021-06-10T07:53:06
364,207,133
1
0
null
null
null
null
UTF-8
C
false
false
7,973
c
/**********************************************************************/ /* ____ ____ */ /* / /\/ / */ /* /___/ \ / */ /* \ \ \/ */ /* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */ /* / / All Right Reserved. */ /* /---/ /\ */ /* \ \ / \ */ /* \___\/\___\ */ /***********************************************************************/ /* This file is designed for use with ISim build 0x7708f090 */ #define XSI_HIDE_SYMBOL_SPEC true #include "xsi.h" #include <memory.h> #ifdef __GNUC__ #include <stdlib.h> #else #include <malloc.h> #define alloca _alloca #endif static const char *ng0 = "D:/softwares/14.7/ISE_DS/ISE/verilog/src/glbl.v"; static unsigned int ng1[] = {1U, 0U}; static unsigned int ng2[] = {0U, 0U}; static void NetDecl_16_0(char *t0) { char *t1; char *t2; char *t3; char *t4; char *t5; char *t6; char *t7; unsigned int t8; unsigned int t9; char *t10; unsigned int t11; unsigned int t12; char *t13; unsigned int t14; unsigned int t15; char *t16; LAB0: t1 = (t0 + 6960U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(16, ng0); t2 = (t0 + 1960U); t3 = *((char **)t2); t2 = (t0 + 8648); t4 = (t2 + 56U); t5 = *((char **)t4); t6 = (t5 + 56U); t7 = *((char **)t6); memset(t7, 0, 8); t8 = 1U; t9 = t8; t10 = (t3 + 4); t11 = *((unsigned int *)t3); t8 = (t8 & t11); t12 = *((unsigned int *)t10); t9 = (t9 & t12); t13 = (t7 + 4); t14 = *((unsigned int *)t7); *((unsigned int *)t7) = (t14 | t8); t15 = *((unsigned int *)t13); *((unsigned int *)t13) = (t15 | t9); xsi_driver_vfirst_trans(t2, 0, 0U); t16 = (t0 + 8520); *((int *)t16) = 1; LAB1: return; } static void Cont_48_1(char *t0) { char *t1; char *t2; char *t3; char *t4; char *t5; char *t6; char *t7; char *t8; char *t9; unsigned int t10; unsigned int t11; char *t12; unsigned int t13; unsigned int t14; char *t15; unsigned int t16; unsigned int t17; char *t18; LAB0: t1 = (t0 + 7208U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(48, ng0); t2 = (t0 + 3640); t3 = (t2 + 56U); t4 = *((char **)t3); t5 = (t0 + 8712); t6 = (t5 + 56U); t7 = *((char **)t6); t8 = (t7 + 56U); t9 = *((char **)t8); memset(t9, 0, 8); t10 = 1U; t11 = t10; t12 = (t4 + 4); t13 = *((unsigned int *)t4); t10 = (t10 & t13); t14 = *((unsigned int *)t12); t11 = (t11 & t14); t15 = (t9 + 4); t16 = *((unsigned int *)t9); *((unsigned int *)t9) = (t16 | t10); t17 = *((unsigned int *)t15); *((unsigned int *)t15) = (t17 | t11); xsi_driver_vfirst_trans(t5, 0, 0); t18 = (t0 + 8536); *((int *)t18) = 1; LAB1: return; } static void Cont_49_2(char *t0) { char *t1; char *t2; char *t3; char *t4; char *t5; char *t6; char *t7; char *t8; char *t9; unsigned int t10; unsigned int t11; char *t12; unsigned int t13; unsigned int t14; char *t15; unsigned int t16; unsigned int t17; char *t18; LAB0: t1 = (t0 + 7456U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(49, ng0); t2 = (t0 + 3800); t3 = (t2 + 56U); t4 = *((char **)t3); t5 = (t0 + 8776); t6 = (t5 + 56U); t7 = *((char **)t6); t8 = (t7 + 56U); t9 = *((char **)t8); memset(t9, 0, 8); t10 = 1U; t11 = t10; t12 = (t4 + 4); t13 = *((unsigned int *)t4); t10 = (t10 & t13); t14 = *((unsigned int *)t12); t11 = (t11 & t14); t15 = (t9 + 4); t16 = *((unsigned int *)t9); *((unsigned int *)t9) = (t16 | t10); t17 = *((unsigned int *)t15); *((unsigned int *)t15) = (t17 | t11); xsi_driver_vfirst_trans(t5, 0, 0); t18 = (t0 + 8552); *((int *)t18) = 1; LAB1: return; } static void Cont_50_3(char *t0) { char *t1; char *t2; char *t3; char *t4; char *t5; char *t6; char *t7; char *t8; char *t9; unsigned int t10; unsigned int t11; char *t12; unsigned int t13; unsigned int t14; char *t15; unsigned int t16; unsigned int t17; char *t18; LAB0: t1 = (t0 + 7704U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(50, ng0); t2 = (t0 + 3960); t3 = (t2 + 56U); t4 = *((char **)t3); t5 = (t0 + 8840); t6 = (t5 + 56U); t7 = *((char **)t6); t8 = (t7 + 56U); t9 = *((char **)t8); memset(t9, 0, 8); t10 = 1U; t11 = t10; t12 = (t4 + 4); t13 = *((unsigned int *)t4); t10 = (t10 & t13); t14 = *((unsigned int *)t12); t11 = (t11 & t14); t15 = (t9 + 4); t16 = *((unsigned int *)t9); *((unsigned int *)t9) = (t16 | t10); t17 = *((unsigned int *)t15); *((unsigned int *)t15) = (t17 | t11); xsi_driver_vfirst_trans(t5, 0, 0); t18 = (t0 + 8568); *((int *)t18) = 1; LAB1: return; } static void Initial_52_4(char *t0) { char *t1; char *t2; char *t3; char *t4; LAB0: t1 = (t0 + 7952U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(52, ng0); LAB4: xsi_set_current_line(53, ng0); t2 = ((char*)((ng1))); t3 = (t0 + 3640); xsi_vlogvar_assign_value(t3, t2, 0, 0, 1); xsi_set_current_line(54, ng0); t2 = ((char*)((ng1))); t3 = (t0 + 3960); xsi_vlogvar_assign_value(t3, t2, 0, 0, 1); xsi_set_current_line(55, ng0); t2 = (t0 + 7760); xsi_process_wait(t2, 100000LL); *((char **)t1) = &&LAB5; LAB1: return; LAB5: xsi_set_current_line(56, ng0); t3 = ((char*)((ng2))); t4 = (t0 + 3640); xsi_vlogvar_assign_value(t4, t3, 0, 0, 1); xsi_set_current_line(57, ng0); t2 = ((char*)((ng2))); t3 = (t0 + 3960); xsi_vlogvar_assign_value(t3, t2, 0, 0, 1); goto LAB1; } static void Initial_60_5(char *t0) { char *t1; char *t2; char *t3; char *t4; LAB0: t1 = (t0 + 8200U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(60, ng0); LAB4: xsi_set_current_line(61, ng0); t2 = ((char*)((ng1))); t3 = (t0 + 3800); xsi_vlogvar_assign_value(t3, t2, 0, 0, 1); xsi_set_current_line(62, ng0); t2 = (t0 + 8008); xsi_process_wait(t2, 0LL); *((char **)t1) = &&LAB5; LAB1: return; LAB5: xsi_set_current_line(63, ng0); t3 = ((char*)((ng2))); t4 = (t0 + 3800); xsi_vlogvar_assign_value(t4, t3, 0, 0, 1); goto LAB1; } extern void work_m_00000000004134447467_2073120511_init() { static char *pe[] = {(void *)NetDecl_16_0,(void *)Cont_48_1,(void *)Cont_49_2,(void *)Cont_50_3,(void *)Initial_52_4,(void *)Initial_60_5}; xsi_register_didat("work_m_00000000004134447467_2073120511", "isim/mux_8x1frm4x1_tb_isim_beh.exe.sim/work/m_00000000004134447467_2073120511.didat"); xsi_register_executes(pe); }
[ "jayshiljatin@gmail.com" ]
jayshiljatin@gmail.com
0dbe02c532b3ca52a1dfc550d677ab8689ad84ef
8bc49dd80356a9e007d2f359d39f39b6e4ada52b
/main.c
064f8267221271e08e70163315ebb37ce62163c2
[]
no_license
HarunaIppai/Comparison
0c8e8a19ee0d369e9f98bd60b75cbaf35307c964
56e62cc00656b1614b0c00a1be1ac2cbbaa92be7
refs/heads/main
2023-04-02T08:35:21.244020
2021-04-09T19:34:09
2021-04-09T19:34:09
null
0
0
null
null
null
null
UTF-8
C
false
false
9,161
c
/************************************************************************ Lab 9 Nios Software Dong Kai Wang, Fall 2017 Christine Chen, Fall 2013 For use with ECE 385 Experiment 9 University of Illinois ECE Department ************************************************************************/ #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <time.h> #include "aes.h" #include "system.h" // TODO: check c0 ~ 3 corresponds to correct position in i // (i = [c0, c1, c2, c3]) union word_32 { unsigned int i; struct { unsigned char c3; unsigned char c2; unsigned char c1; unsigned char c0; }chars; }; // Pointer to base address of AES module, make sure it matches Qsys volatile unsigned int* AES_PTR = AES_BASE; // Execution mode: 0 for testing, 1 for benchmarking int run_mode = 0; /** charToHex * Convert a single character to the 4-bit value it represents. * * Input: a character c (e.g. 'A') * Output: converted 4-bit value (e.g. 0xA) */ char charToHex(char c) { char hex = c; if (hex >= '0' && hex <= '9') hex -= '0'; else if (hex >= 'A' && hex <= 'F') { hex -= 'A'; hex += 10; } else if (hex >= 'a' && hex <= 'f') { hex -= 'a'; hex += 10; } return hex; } /** charsToHex * Convert two characters to byte value it represents. * Inputs must be 0-9, A-F, or a-f. * * Input: two characters c1 and c2 (e.g. 'A' and '7') * Output: converted byte value (e.g. 0xA7) */ char charsToHex(char c1, char c2) { char hex1 = charToHex(c1); char hex2 = charToHex(c2); return (hex1 << 4) + hex2; } // (4x 32-bit int array) <- (32x 8-bit char array (ASCII format)) void asciiToUint(unsigned char* input, unsigned int* output) { int i; for (i = 0; i < 4; i++) { int j; union word_32 word; for (j = 0; j < 4; j++) { int offset = (4 * i + j) * 2; char currChar = charsToHex(input[offset], input[offset + 1]); switch (j) { case 0: word.chars.c0 = currChar; break; case 1: word.chars.c1 = currChar; break; case 2: word.chars.c2 = currChar; break; default: word.chars.c3 = currChar; } } output[i] = word.i; } } // a, b 4x 32-bit int array // a <- a (bitwise XOR) b void aesXor(unsigned int* a, const unsigned int* b) { int i; for (i = 0; i < 4; i++) { a[i] = a[i] ^ b[i]; } } // perform subWord on inout (32-bit int) void subWord(unsigned int* inout) { union word_32 word; word.i = *inout; word.chars.c0 = aes_sbox[word.chars.c0]; word.chars.c1 = aes_sbox[word.chars.c1]; word.chars.c2 = aes_sbox[word.chars.c2]; word.chars.c3 = aes_sbox[word.chars.c3]; *inout = word.i; } // perform subBytes on inout (4x 32-bit int array) void subBytes(unsigned int* inout) { int i; for (i = 0; i < 4; i++) { subWord(inout + i); } } // perform shiftRows on inout (4x 32-bit int array) void shiftRows(unsigned int* inout) { int i; union word_32 word[4]; for (i = 0; i < 4; i++) { word[i].i = inout[i]; } char temp; // row 1 - cyclical left-shift 1 temp = word[0].chars.c1; word[0].chars.c1 = word[1].chars.c1; word[1].chars.c1 = word[2].chars.c1; word[2].chars.c1 = word[3].chars.c1; word[3].chars.c1 = temp; // row 2 - cyclical left-shift 2 temp = word[0].chars.c2; word[0].chars.c2 = word[2].chars.c2; word[2].chars.c2 = temp; temp = word[1].chars.c2; word[1].chars.c2 = word[3].chars.c2; word[3].chars.c2 = temp; // row 3 - cyclical left-shift 3 (same as right-shift 1) temp = word[0].chars.c3; word[0].chars.c3 = word[3].chars.c3; word[3].chars.c3 = word[2].chars.c3; word[2].chars.c3 = word[1].chars.c3; word[1].chars.c3 = temp; for (i = 0; i < 4; i++) { inout[i] = word[i].i; } } // perform mixColumns on inout (4x 32-bit int array) void mixColumns(unsigned int* inout) { int i; union word_32 newWord[4], oldWord[4]; for (i = 0; i < 4; i++) { oldWord[i].i = inout[i]; } for (i = 0; i < 4; i++) { // iterate through each col (word) newWord[i].chars.c0 = gf_mul[oldWord[i].chars.c0][0] ^ gf_mul[oldWord[i].chars.c1][1] ^ oldWord[i].chars.c2 ^ oldWord[i].chars.c3; newWord[i].chars.c1 = oldWord[i].chars.c0 ^ gf_mul[oldWord[i].chars.c1][0] ^ gf_mul[oldWord[i].chars.c2][1] ^ oldWord[i].chars.c3; newWord[i].chars.c2 = oldWord[i].chars.c0 ^ oldWord[i].chars.c1 ^ gf_mul[oldWord[i].chars.c2][0] ^ gf_mul[oldWord[i].chars.c3][1]; newWord[i].chars.c3 = gf_mul[oldWord[i].chars.c0][1] ^ oldWord[i].chars.c1 ^ oldWord[i].chars.c2 ^ gf_mul[oldWord[i].chars.c3][0]; } for (i = 0; i < 4; i++) { inout[i] = newWord[i].i; } } // perform keyExpansion on inout (4x 32-bit int array) // Idx is the Rcon idx (current iteration count) void keyExpansion(unsigned int* inout, int Idx) { int i; union word_32 oldWord[4], newWord[4]; for (i = 0; i < 4; i++) { oldWord[i].i = inout[i]; } for (i = 0; i < 4; i++) { if (i) { newWord[i].i = oldWord[i].i ^ newWord[i - 1].i; } else { newWord[i].i = oldWord[3].i; // rotWord unsigned char temp = newWord[i].chars.c0; newWord[i].chars.c0 = newWord[i].chars.c1; newWord[i].chars.c1 = newWord[i].chars.c2; newWord[i].chars.c2 = newWord[i].chars.c3; newWord[i].chars.c3 = temp; //printf("%08x\n", newWord[i].i); subWord(&(newWord[i].i)); newWord[i].i ^= Rcon[Idx]; newWord[i].i ^= oldWord[i].i; } } for (i = 0; i < 4; i++) { inout[i] = newWord[i].i; } } /** encrypt * Perform AES encryption in software. * * Input: msg_ascii - Pointer to 32x 8-bit char array that contains the input message in ASCII format * key_ascii - Pointer to 32x 8-bit char array that contains the input key in ASCII format * Output: msg_enc - Pointer to 4x 32-bit int array that contains the encrypted message * key - Pointer to 4x 32-bit int array that contains the input key */ void encrypt(unsigned char* msg_ascii, unsigned char* key_ascii, unsigned int* msg_enc, unsigned int* key) { // Implement this function int i; unsigned int aes_state[4], round_key[4]; asciiToUint(key_ascii, key); asciiToUint(msg_ascii, aes_state); // first add round key (cipher key itself) aesXor(aes_state, key); for (i = 0; i < 4; i++) { round_key[i] = key[i]; } // iteration starts for (i = 1; i < 10; i++) { subBytes(aes_state); shiftRows(aes_state); mixColumns(aes_state); // for (int j = 0; j < 4; j++) { // printf("%08x ", aes_state[j]); // } // printf("\n"); keyExpansion(round_key, i); aesXor(aes_state, round_key); } subBytes(aes_state); shiftRows(aes_state); keyExpansion(round_key, i); aesXor(aes_state, round_key); for (i = 0; i < 4; i++) { msg_enc[i] = aes_state[i]; } } /** decrypt * Perform AES decryption in hardware. * * Input: msg_enc - Pointer to 4x 32-bit int array that contains the encrypted message * key - Pointer to 4x 32-bit int array that contains the input key * Output: msg_dec - Pointer to 4x 32-bit int array that contains the decrypted message */ void decrypt(unsigned int* msg_enc, unsigned int* msg_dec, unsigned int* key) { // Implement this function for (int i = 0; i < 4; i++){ AES_PTR[i] = key[i]; } for (int i = 0; i < 4; i++){ AES_PTR[i+4] = msg_enc[i]; } AES_PTR[14] = 1; while(!AES_PTR[15]){} for (int i = 0; i < 4; i++){ msg_dec[i] = AES_PTR[i+8]; } AES_PTR[14] = 0; } /** main * Allows the user to enter the message, key, and select execution mode * */ int main() { // Input Message and Key as 32x 8-bit ASCII Characters ([33] is for NULL terminator) unsigned char msg_ascii[33]; unsigned char key_ascii[33]; // Key, Encrypted Message, and Decrypted Message in 4x 32-bit Format to facilitate Read/Write to Hardware unsigned int key[4]; unsigned int msg_enc[4]; unsigned int msg_dec[4]; printf("Select execution mode: 0 for testing, 1 for benchmarking: "); scanf("%d", &run_mode); if (run_mode == 0) { // Continuously Perform Encryption and Decryption while (1) { int i = 0; printf("\nEnter Message:\n"); scanf("%s", msg_ascii); printf("\n"); printf("\nEnter Key:\n"); scanf("%s", key_ascii); printf("\n"); encrypt(msg_ascii, key_ascii, msg_enc, key); printf("\nEncrpted message is: \n"); for (i = 0; i < 4; i++) { printf("%08x", msg_enc[i]); } printf("\n"); decrypt(msg_enc, msg_dec, key); printf("\nDecrypted message is: \n"); for (i = 0; i < 4; i++) { printf("%08x", msg_dec[i]); } printf("\n"); } } else { // Run the Benchmark int i = 0; int size_KB = 2; // Choose a random Plaintext and Key for (i = 0; i < 32; i++) { msg_ascii[i] = 'a'; key_ascii[i] = 'b'; } // Run Encryption clock_t begin = clock(); for (i = 0; i < size_KB * 64; i++) encrypt(msg_ascii, key_ascii, msg_enc, key); clock_t end = clock(); double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; double speed = size_KB / time_spent; printf("Software Encryption Speed: %f KB/s \n", speed); // Run Decryption begin = clock(); for (i = 0; i < size_KB * 64; i++) decrypt(msg_enc, msg_dec, key); end = clock(); time_spent = (double)(end - begin) / CLOCKS_PER_SEC; speed = size_KB / time_spent; printf("Hardware Encryption Speed: %f KB/s \n", speed); } return 0; }
[ "noreply@github.com" ]
HarunaIppai.noreply@github.com
77916099c1ad15219629dff6c5b954a5aa478d0d
88fad66b39788a71be7c9197b83e0d2de58ff93e
/src/configurable.c
42f70a178efe7be8be08690f33d13a512804a1bc
[]
no_license
zfogg/js-configure-demo
8e01ff7b29b25bc1c94cc4357b57a6e3efc7b7f6
dd263351afed3e30929c6d6a0c6ef0bd2b826108
refs/heads/master
2021-01-22T16:54:01.861315
2013-11-22T00:31:32
2013-11-22T00:31:32
16,250,125
1
0
null
null
null
null
UTF-8
C
false
false
1,760
c
#include <pebble.h> #include <pebble_fonts.h> static Window *window; static TextLayer *text_layer; static void select_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(text_layer, "Select"); } static void up_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(text_layer, "Up"); } static void down_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(text_layer, "Down"); } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); } static void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); text_layer = text_layer_create((GRect) { .origin = { 0, 72 }, .size = { bounds.size.w, 20 } }); text_layer_set_text(text_layer, "Press a button"); text_layer_set_text_alignment(text_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(text_layer)); } static void window_unload(Window *window) { text_layer_destroy(text_layer); } static void init(void) { window = window_create(); window_set_click_config_provider(window, click_config_provider); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, }); const bool animated = true; window_stack_push(window, animated); } static void deinit(void) { window_destroy(window); } int main(void) { init(); APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", window); app_event_loop(); deinit(); }
[ "cherie@getpebble.com" ]
cherie@getpebble.com
2ecb1faf869d7ae351062a8cc575cd710057e4b1
0934c21f4ec719c468a8bf79abd764861c811121
/src/common/PrivateCFG.C
ea3ea9de93dc1791206ade28df896207fe071542
[ "BSD-3-Clause" ]
permissive
gmarin13/MIAMI
c050c2362490aa85bd00d427f86c273b9eef97dd
2873f09e6918424685af6e7125a1dd5c6616d929
refs/heads/master
2021-01-10T19:37:09.220897
2014-06-19T16:54:19
2014-06-19T16:54:19
17,177,955
2
4
null
null
null
null
UTF-8
C
false
false
37,050
c
/* * This file is part of the MIAMI framework. For copyright information, see * the LICENSE file in the MIAMI root folder. */ /* * File: PrivateCFG.C * Author: Gabriel Marin, mgabi99@gmail.com * * Description: Base class for control flow graph support in MIAMI. */ #include <math.h> // standard headers #ifdef NO_STD_CHEADERS # include <stdlib.h> # include <string.h> # include <assert.h> # include <stdarg.h> #else # include <cstdlib> # include <cstring> # include <cassert> using namespace std; // For compatibility with non-std C headers #endif #include <iostream> #include <fstream> #include <iomanip> using std::ostream; using std::endl; using std::cout; using std::cerr; using std::setw; #include "PrivateCFG.h" #include "private_routine.h" #include "file_utilities.h" #include "instruction_decoding.h" #include "tarjans/MiamiRIFG.h" #define DEBUG_BBLs 0 #if DEBUG_BBLs static const char *debugName = "dl_iterate_phdr"; #endif using namespace MIAMI; //-------------------------------------------------------------------------------------------------------------------- bool MIAMI::draw_all(PrivateCFG::Edge* e) { return (true); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::PrivateCFG (PrivateRoutine* _r, const std::string& func_name) { in_routine = _r; routine_name = func_name; #if VERBOSE_DEBUG_SCHEDULER DEBUG_SCHED (1, fprintf (stderr, "In PrivateCFG constructor for routine %s\n", routine_name.c_str()); ) #endif topMarker = 0; nextNodeId = 0; nextEdgeId = 0; loopTree = 0; treeSize = 0; cfgFlags = 0; maximumGraphRank = 0; setup_node_container = false; } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::~PrivateCFG() { // fprintf (stderr, "PrivateCFG::DESTRUCTOR called\n"); // I have to delete all nodes and all edges EdgesIterator edit(*this); while ((bool)edit) { Edge *edge = edit; delete edge; ++ edit; } NodesIterator nit(*this); while ((bool)nit) { Node *node = nit; delete node; ++ nit; } node_set.clear(); edge_set.clear(); if (loopTree) free(loopTree); loopTree = 0; treeSize = 0; cfgFlags = 0; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::add (DGraph::Edge* e) { setCfgFlags(CFG_GRAPH_IS_MODIFIED); DGraph::add(e); } //-------------------------------------------------------------------------------------------------------------------- #define MAX_INCOMING_EDGES 32 void PrivateCFG::add (DGraph::Node* n) { setCfgFlags(CFG_GRAPH_IS_MODIFIED); DGraph::add(n); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::remove (DGraph::Edge* e) { setCfgFlags(CFG_GRAPH_IS_MODIFIED); DGraph::remove(e); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::remove (DGraph::Node* n) { setCfgFlags(CFG_GRAPH_IS_MODIFIED); DGraph::remove(n); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Edge* PrivateCFG::addEdge(PrivateCFG::Node* n1, PrivateCFG::Node* n2, EdgeType _type) { #if DEBUG_CFG_DISCOVERY LOG_CFG(3, if (n1->getStartAddress()>=0x399fc15095 && n1->getEndAddress()<=0x399fc150aa) fprintf(stderr, "AddEdge: from block [0x%" PRIxaddr ",0x%" PRIxaddr "] to target [0x%" PRIxaddr ",0x%" PRIxaddr "] of type=%d\n", n1->getStartAddress(), n1->getEndAddress(), n2->getStartAddress(), n2->getEndAddress(), _type); ) #endif Edge* edge = MakeEdge(static_cast<Node*>(n1), static_cast<Node*>(n2), _type); add(edge); return (edge); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Edge* PrivateCFG::addUniqueEdge(PrivateCFG::Node* n1, PrivateCFG::Node* n2, EdgeType _type) { OutgoingEdgesIterator oeit(n1); while ((bool)oeit) { if (oeit->sink()==n2 && oeit->getType()==_type) { return (oeit); } ++ oeit; } return (addEdge(n1, n2, _type)); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Edge* PrivateCFG::addProspectiveEdge(Node* n1, addrtype sink_addr, EdgeType _type) { // check for duplicates by looking at all prospective edges that want to // go to sink_addr. Then check that their source node and _type is the same std::pair <EdgeMap::iterator, EdgeMap::iterator> _edges = prospectiveEdges.equal_range(sink_addr); EdgeMap::iterator eit; // I should avoid adding duplicates, keep track of what edges I add for (eit=_edges.first ; eit!=_edges.second ; ) { Edge *e = eit->second; if (n1==e->source() && _type==e->type) // duplicate { // do not add it again, return what we have return (e); // edge already exists } ++eit; } Edge* e2 = addEdge(n1, static_cast<Node*>(cfg_exit), _type); e2->setProspectiveEdge(true); prospectiveEdges.insert(EdgeMap::value_type(sink_addr, e2)); return (e2); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Node* PrivateCFG::Node::SplitAt(addrtype split_addr, int *incEdges, NodeType _type) { // test that address is in bounds first if (split_addr<start_addr || split_addr>=end_addr) { fprintf(stderr, "ERROR: Request to split node [0x%" PRIxaddr ",0x%" PRIxaddr "] at outside address 0x%" PRIxaddr "\n", start_addr, end_addr, split_addr); return (NULL); } // create a new node from split point to end of current node Node *newn = _in_cfg->MakeNode(split_addr, end_addr, _type); *incEdges = _in_cfg->addNode(newn); end_addr = split_addr; // change each outgoing edge of the old node to start from // the newly created node OutgoingEdgesIterator oeit(this); while ((bool)oeit) { Edge* e = oeit; // increment iterator before we remove the edge ++oeit; // remove this edge from the list of outgoing edges of the source node outgoing_edges.remove(e); newn->outgoing_edges.push_back(e); e->ChangeSource(newn); } _in_cfg->addEdge(this, newn, MIAMI_FALLTHRU_EDGE); return (newn); } //-------------------------------------------------------------------------------------------------------------------- #define MAX_INCOMING_EDGES 32 /* Return how many prospective edges have been found for this node. * If we found prospective edges, we must have came from within the routine. * Otherwise, this node is likely a routine entry, so mark it as such. */ int PrivateCFG::addNode (Node* n) { setCfgFlags(CFG_GRAPH_IS_MODIFIED); DGraph::add(n); // when we add a node, check if we have any prospective incoming edges for it // this makes sense only if this is not a call-surrogate block int nedges = 0; #if DEBUG_BBLs string name = InRoutine()->Name(); #endif if (n->type!=MIAMI_CALL_SITE && !prospectiveEdges.empty()) { std::pair <EdgeMap::iterator, EdgeMap::iterator> _edges = prospectiveEdges.equal_range(n->start_addr); EdgeMap::iterator eit; // I should avoid adding duplicates, keep track of what edges I add Node* srcs[MAX_INCOMING_EDGES]; EdgeType etypes[MAX_INCOMING_EDGES]; for (eit=_edges.first ; eit!=_edges.second ; ) { EdgeMap::iterator tmp = eit; Edge *e = tmp->second; bool duplicate = false; for (int i=0 ; i<nedges ; ++i) if (srcs[i]==e->source() && etypes[i]==e->type) // duplicate { duplicate = true; remove(e); delete e; break; } if (!duplicate) { e->sink()->incoming_edges.remove(e); n->incoming_edges.push_back(e); e->ChangeSink(n); if (nedges<MAX_INCOMING_EDGES) { srcs[nedges] = e->source(); etypes[nedges++] = e->type; } e->setProspectiveEdge(false); #if DEBUG_BBLs if (name.compare(debugName)==0) { fprintf(stderr, " - addNode: in routine %s, adding block [0x%" PRIxaddr ",0x%" PRIxaddr "] found prospective edge from block [0x%" PRIxaddr ",0x%" PRIxaddr "] of type %d\n", name.c_str(), n->getStartAddress(), n->getEndAddress(), e->source()->getStartAddress(), e->source()->getEndAddress(), e->type); } #endif } ++eit; prospectiveEdges.erase(tmp); } } return (nedges); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Edge::Edge (PrivateCFG::Node* n1, PrivateCFG::Node* n2, EdgeType _type) : DGraph::Edge(n1, n2), type(_type) { assert (n1); PrivateCFG *gg = n1->inCfg(); if (gg) id = gg->getNextEdgeId(); else id = 0; flags = 0; _visited = 0; counter = 0; is_prospective = false; inner_loop_entry = false; _outermost_loop_head_exited = 0; _outermost_loop_head_entered = 0; _levels_exited = 0; _levels_entered = 0; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Edge::dump (ostream& os) { os << "{ " << id << " " << edgeTypeToString(type) << " " << " }"; os.flush(); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::dump (ostream& os) { os << "===== PrivateCFG dump =====" << endl << " Routine: " << routine_name << endl << "--------------------" << endl; // print the contents of all the nodes NodesIterator nodes_iter(*this); while ((bool)nodes_iter) { nodes_iter->longdump(this, os); os << endl; ++nodes_iter; } os << "====================" << endl; } //-------------------------------------------------------------------------------------------------------------------- /* this is not the best choice of names, because the graph can still * be modified. However, this method ensures the graph is in a good * state to perform analysis on it. I need a routine that * connects the entry and exit nodes to the rest of the graph. * computeTopNodes does this, but it is protected. This method will * call computeTopNodes only if the graph has been modified since * previous call. */ void PrivateCFG::FinalizeGraph() { if (HasAllFlags (CFG_GRAPH_IS_MODIFIED)) { computeTopNodes(); } } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::ComputeNodeRanks() { if (HasAllFlags (CFG_GRAPH_IS_MODIFIED)) { computeTopNodes(); } // from each top node perform a DFS on loop independent edges and // compute a level for each node OutgoingEdgesIterator teit(cfg_entry); // back edges are not marked, so I need to detect cyles as well // use two different markers // reserve a second value, mm-1 and mm will be used // compute also the maximum graph level unsigned int mm = new_marker(2); maximumGraphRank = 0; while ((bool)teit) { if (!teit->isLoopBackEdge()) { Node *nn = teit->sink(); recursiveNodeRanks(nn, 1, mm); } ++ teit; } cfg_exit->rank = maximumGraphRank+1; removeCfgFlags(CFG_GRAPH_IS_MODIFIED); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::recursiveNodeRanks(Node* node, int lev, unsigned int m) { // if this is first time I see this node, assign a level to it if (node->visited(m-1)) // I am in the process of processing this node { // hmm, this is a back edge. I can add the test in the loop iterating over // outgoing edges and mark the egde as a back edge as well assert(!"I should not be here"); return; } if (! node->visited(m) ) { node->rank = lev; } else // otherwise test if this is a deeper level { // if we find that the node is on a deeper level than we thought before // then continue recursively because its children might be on deeper // levels too. // Otherwise stop recursion at this node, because it cannot change // anything downstream. if (node->rank < lev) node->rank = lev; else return; } node->visit(m-1); // we continue only if lev is the deepest level found for this node, // therefore, I must go recursive with lev+1 int i = 0; OutgoingEdgesIterator oeit(node); while ((bool)oeit) { Edge *ee = oeit; if (!ee->isLoopBackEdge()) // && ee->sink()!=cfg_exit) { // test if we visited the sink node before. // It may happen if we did not compute Tarjan intervals and // we did not mark back edges yet. if (! ee->sink()->visited(m-1)) // it is a back edge { ++ i; recursiveNodeRanks (ee->sink(), lev+1, m); } } ++ oeit; } // maximum graph level can belong only to a leaf node; if I am here, // it means that this node's level is lev if (node!=cfg_exit && lev>maximumGraphRank) maximumGraphRank = lev; node->visit(m); } //-------------------------------------------------------------------------------------------------------------------- addrtype PrivateCFG::Node::RelocationOffset() const { if (_in_cfg) return (_in_cfg->InRoutine()->InLoadModule()->RelocationOffset()); else return (0); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Node* PrivateCFG::Edge::ChangeSource(PrivateCFG::Node *src) { Node *oldN = static_cast<Node*>(n1); n1 = src; return (oldN); } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Node* PrivateCFG::Edge::ChangeSink(PrivateCFG::Node *sink) { Node *oldN = static_cast<Node*>(n2); n2 = sink; return (oldN); } //-------------------------------------------------------------------------------------------------------------------- int PrivateCFG::computeTopNodes() { #if 0 bool keepTopNodes = false; // if we have the routine entry points, use those nodes as top nodes // do not recompute them based on the incoming edges if (HasSomeFlags(CFG_HAS_ENTRY_POINTS)) keepTopNodes = true; if (!keepTopNodes) { // delete the old top_nodes OutgoingEdgesIterator oeit(cfg_entry); while ((bool)oeit) { Edge* tempE = oeit; ++ oeit; remove (tempE); delete (tempE); } topNodes.clear(); } // delete the old bottom_nodes IncomingEdgesIterator ieit(cfg_exit); while ((bool)ieit) { Edge* tempE = ieit; ++ ieit; if (tempE->type!=MIAMI_RETURN_EDGE && tempE->type!=MIAMI_FALLTHRU_EDGE) { remove (tempE); delete (tempE); } } bottomNodes.clear(); #endif NodeList newTops, newBottoms; addrtype rstart = InRoutine()->Start(); // routine start address Node *firstNode = 0; // identify new top nodes and bottom nodes if the graph has changed // unsigned int m = new_marker (); NodesIterator nit(*this); while ((bool)nit) { Node *nn = nit; if (nn->isCodeNode()) { bool is_top = true, is_bottom = true; if (nn->getStartAddress() == rstart) firstNode = nn; IncomingEdgesIterator lieit(nn); while ((bool)lieit) { if (!lieit->isLoopBackEdge()) { is_top = false; break; } ++ lieit; } OutgoingEdgesIterator loeit(nn); while ((bool)loeit) { if (!loeit->isLoopBackEdge()) { is_bottom = false; break; } ++ loeit; } if (is_top) newTops.push_back(nn); if (is_bottom) newBottoms.push_back(nn); } ++ nit; } // if we have no top nodes, add the first node to the list if (newTops.empty() && firstNode) newTops.push_back(firstNode); // create edges from entry to top nodes and from bottom nodes to exit NodeList::iterator lit; for (lit=newTops.begin() ; lit!=newTops.end() ; ++lit) { // create also a special type edge addUniqueEdge(cfg_entry, *lit, MIAMI_CFG_EDGE); topNodes.push_back(*lit); } for (lit=newBottoms.begin() ; lit!=newBottoms.end() ; ++lit) { // create a special type edge addUniqueEdge(*lit, cfg_exit, MIAMI_CFG_EDGE); bottomNodes.push_back(*lit); } return (topNodes.size()); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Edge::PrintObject (ostream& os) const { os << "Edge " << id << " of type " << edgeTypeToString(type) << " with source {" << *(source()) << "} and sink {" << *(sink()) << "}."; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Node::PrintObject (ostream& os) const { os << "Node " << id << " of type " << nodeTypeToString(type) << "."; //endl; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::set_node_levels(RIFGNodeId node, TarjanIntervals *tarj, MiamiRIFG* mCfg, int level) { Node* b; int kid; b = static_cast<Node*>(mCfg->GetRIFGNode(node)); b->setLevel(tarj->GetLevel(node)); for (kid = tarj->TarjInners(node) ; kid != RIFG_NIL ; kid = tarj->TarjNext(kid)) { b = static_cast<Node*>(mCfg->GetRIFGNode(kid)); #if DEBUG_GRAPH_CONSTRUCTION DEBUG_GRAPH(3, if (tarj->getNodeType(kid) == TarjanIntervals::NODE_IRREDUCIBLE) { fprintf (stderr, "==> found an IRREDUCIBLE node, block 0x%p\n", (void*)(b->getStartAddress())); } ) #endif if (tarj->NodeIsLoopHeader(kid)) set_node_levels(kid, tarj, mCfg, level+1); else b->setLevel(tarj->GetLevel(kid)); } } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::build_loops_scope_tree(TarjanIntervals *tarj, MiamiRIFG* mCfg) { if (loopTree) free(loopTree); // I do not know how many loops I have in this routine. // I am going to make the array of a fixed size, and dyanmically increase // it as needed. Should I start with a function of the routine size, or // just a fixed constant? treeSize = NumNodes()/5; if (treeSize<2) treeSize = 2; loopTree = (unsigned int*)malloc(treeSize*sizeof(unsigned int)); for(unsigned int i=0 ; i<treeSize ; ++i) loopTree[i] = 0; RIFGNodeId root = mCfg->GetRootNode(); build_loops_scope_tree_recursively(root, tarj, 0); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::build_loops_scope_tree_recursively(RIFGNodeId node, TarjanIntervals *tarj, unsigned int parent) { int kid; unsigned int loopIndex = tarj->LoopIndex(node); if (loopIndex >= treeSize) // I need to grow my loop tree array { assert(loopIndex <= (unsigned int)NumNodes()); // I should have fewer loops than graph nodes unsigned int oldSize = treeSize; // double, or increase by another integer factor. while (treeSize<=loopIndex) treeSize += oldSize; loopTree = (unsigned int*)realloc(loopTree, treeSize * sizeof(unsigned int)); for (unsigned int i=oldSize ; i<treeSize ; ++i) loopTree[i] = 0; } loopTree[loopIndex] = parent; // Iterate over the nodes and recursively invoke the routine for // interval nodes for (kid = tarj->TarjInners(node) ; kid != RIFG_NIL ; kid = tarj->TarjNext(kid)) { if (tarj->NodeIsLoopHeader(kid)) { build_loops_scope_tree_recursively(kid, tarj, loopIndex); } } } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::draw_CFG(const char* prefix, addrtype offset, int parts) { char file_name[64]; char title_draw[64]; // I have to compute levels for nodes if (HasSomeFlags(CFG_GRAPH_IS_MODIFIED)) ComputeNodeRanks(); if (parts < 1) parts = 1; int numRanks = maximumGraphRank+2; // divide the range of ranks into close to equal ranges int partSize = (numRanks+parts-1) / parts; int min_rank = 0, p = 0; while (min_rank < numRanks) { int max_rank = min_rank + partSize; if (parts == 1) sprintf(title_draw, "%.40s_cfg", prefix); else sprintf(title_draw, "%.40s_p%02d_cfg", prefix, p); sprintf(file_name, "%s.dot", title_draw); int idx=0; // do not overwrite an existing file, create a new version while (fileExists(file_name)) sprintf(file_name, "%s_%d.dot", title_draw, ++idx); ofstream fout(file_name, ios::out); assert(fout && fout.good()); draw(fout, offset, title_draw, draw_all, false, min_rank, max_rank); fout.close(); assert(fout.good()); if (parts == 1) sprintf(title_draw, "%.40s_tarj", prefix); else sprintf(title_draw, "%.40s_p%02d_tarj", prefix, p); sprintf(file_name, "%s.dot", title_draw); idx=0; // do not overwrite an existing file, create a new version while (fileExists(file_name)) sprintf(file_name, "%s_%d.dot", title_draw, ++idx); ofstream fout2(file_name, ios::out); assert(fout2 && fout2.good()); draw(fout2, offset, title_draw, draw_all, true, min_rank, max_rank); fout2.close(); assert(fout2.good()); ++ p; min_rank = max_rank; } /* strstream dot_cmd; dot_cmd << "dot -Tps2 -o " << file_name_ps << " " << file_name << '\0'; system(dot_cmd.str()); delete dot_cmd.str(); */ } static const char* nodeLevelColor[] = { "blue", "red", "darkgreen", "magenta", "black", "yellow", "blue", "red", "darkgreen", "magenta", "black", "yellow", "blue", "red", "darkgreen", "magenta", "black", "yellow" }; void PrivateCFG::draw (ostream& os, addrtype offset, const char* name, EdgeFilterType f, bool level_col, int min_rank, int max_rank) { // I have to compute levels for nodes if (HasSomeFlags(CFG_GRAPH_IS_MODIFIED)) ComputeNodeRanks(); os << "digraph \"" << name << "\"{\n"; os << "size=\"7.5,10\";\n"; os << "center=\"true\";\n"; os << "ratio=\"expand\";\n"; //compress\";\n"; os << "ranksep=.3;\n"; // draw_legend(os); os << "node[color=black,fontcolor=black,shape=ellipse,font=Helvetica,fontsize=14,height=.3,penwidth=3];\n"; os << "edge[font=Helvetica,fontsize=14,dir=forward,penwidth=3];\n"; // os << "N0[fontsize=20,width=.5,height=.25,shape=plaintext," // << "label=\"" << name << "\"];\n"; NodesIterator nit(*this); while ((bool)nit) { Node *nn = nit; if (nn->isCodeNode() && ((nn->getRank()>=min_rank && nn->getRank()<max_rank) || min_rank==max_rank)) { nn->drawNode (os, offset, level_col); } ++ nit; } EdgesIterator egit(*this); while ((bool)egit) { Edge *ee = egit; int src_rank = ee->source()->getRank(), sink_rank = ee->sink()->getRank(); // if at least one of the edge's ends is in the correct range if ((min_rank<=src_rank && src_rank<max_rank) || (min_rank<=sink_rank && sink_rank<max_rank) || min_rank==max_rank ) ee->drawEdge(os, f, level_col); ++ egit; } os << "}\n"; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Node::drawNode(ostream& os, addrtype offset, bool level_col, int info) { os << "B" << id << "[level=" << _level << "," << "color=" << (level_col?nodeLevelColor[_level]:nodeTypeColor(type)) << "," << "label=\""; write_label(os, offset, info); os << "\",shape=ellipse];\n"; } void PrivateCFG::Node::write_label(ostream& os, addrtype offset, int info, bool html_escape) { // os << hex << address << dec << ":" os << "B" << id; if (info) os << "(" << info << ")"; if (type==MIAMI_CALL_SITE) os << " [0x" << hex << start_addr-offset << ": call 0x" << target << "]" << dec; else os << " [0x" << hex << start_addr-offset << ",0x" << end_addr-offset << "]" << dec; } void PrivateCFG::Edge::drawEdge(ostream& os, EdgeFilterType f, bool level_col) { if (source()->getRank()<sink()->getRank()) { os << "B" << source()->getId() << "->B" << sink()->getId() << "["; if (isCounterEdge()) os << "dir=both,arrowtail=box,"; } else { os << "B" << sink()->getId() << "->B" << source()->getId(); if (isCounterEdge()) os << "[dir=both,arrowhead=box,"; else os << "[dir=back,"; } write_label (os); write_style (os, f, level_col); os << "];\n"; } void PrivateCFG::Edge::write_label (ostream& os) { os << "label=\"E" << id; if (isCounterEdge()) os << "\\nM=" << counter; os << "\","; } void PrivateCFG::Edge::write_style (ostream& os, EdgeFilterType f, bool level_col) { os << "style="; if (f(this)) // edge was not pruned os << edgeTypeStyle(type); else os << "invis"; os << ",color=\""; if (isLoopBackEdge()) os << "yellow:"; os << (level_col?nodeLevelColor[min(sink()->_level,source()->_level)]:edgeTypeColor(type)); // if (isCounterEdge()) os << ":purple"; os << "\",fontcolor=" << edgeTypeColor(type); } void PrivateCFG::draw_legend (ostream& os) { // os << "digraph \"Scheduling Graph Legend\"{\n"; os << "subgraph legend{\n"; os << "node[width=.5,height=.25,shape=plaintext,style=\"setlinewidth(2)\",fontsize=14,font=Helvetica];\n"; os << "N0[fontcolor=black,fontsize=20,label=\"Legend\"];\n"; os << "N1[color=black,fontcolor=black,fontsize=16,label=\"Color Map for Edge Type\"];\n"; os << "N2[color=black,fontcolor=black,shape=ellipse,label=\"Basic Block\"];\n"; for (int i=0 ; i<MIAMI_NUM_EDGE_TYPES ; ++i) { os << "EN2_" << i << "[height=.1,width=.1,style=invis];\n"; } os << "N0->N1->N2->EN2_" << MIAMI_NUM_EDGE_TYPES/2 << "[style=invis];\n"; os << "edge[style=\"setlinewidth(2)\"];\n"; for (int i=0 ; i<MIAMI_NUM_EDGE_TYPES ; ++i) { os << "N2->EN2_" << i << "[style=" << Edge::edgeTypeStyle((EdgeType)i) << ",color=" << Edge::edgeTypeColor((EdgeType)i) << ",fontcolor=" << Edge::edgeTypeColor((EdgeType)i) << ",label=\"" << Edge::edgeTypeToString((EdgeType)i) << "\"];\n"; } os << "};\n"; // os << "}\n"; } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Node::longdump (PrivateCFG *currcfg, ostream& os) { // print the node ID os << "NodeId: " << getId() << ", start_addr=0x" << hex << start_addr << ", end_addr=0x" << end_addr << dec << ", type=" << type << endl; if (num_incoming() == 0) os << " <-- [TopNode]"; // print the source(s) SourceNodesIterator srcIt(this); if ((bool)srcIt) { os << " <-- (" << ((DGraph::Node*)srcIt)->getId(); ++srcIt; while ((bool)srcIt) { os << ", " << ((DGraph::Node*)srcIt)->getId(); ++srcIt; } os << ")"; }; os << endl; // print the sink(s) OutgoingEdgesIterator out_iter(this); if ((bool)out_iter) { DGraph::Edge* e = (DGraph::Edge*)out_iter; os << " --> (" << (e->sink())->getId(); os << " ["; e->dump(os); os << "]"; ++out_iter; while ((bool)out_iter) { e = (DGraph::Edge*)out_iter; os << ", " << (e->sink())->getId(); os << " ["; e->dump(os); os << "]"; ++out_iter; } os << ")" << endl; } } //-------------------------------------------------------------------------------------------------------------------- bool PrivateCFG::Node::isCodeNode() const { switch (type) { case MIAMI_CODE_BLOCK: case MIAMI_CALL_SITE: case MIAMI_REP_BLOCK: return true; case MIAMI_DATA_BLOCK: case MIAMI_CFG_BLOCK: return false; default: return false; } return (false); } const char* PrivateCFG::Node::nodeTypeToString(NodeType tt) { switch (tt) { case ANY_BLOCK_TYPE: return "AnyBlockType"; case MIAMI_CODE_BLOCK: return "CodeBlock"; case MIAMI_CALL_SITE: return "CallSite"; case MIAMI_REP_BLOCK: return "RepBlock"; case MIAMI_DATA_BLOCK: return "DataBlock"; case MIAMI_CFG_BLOCK: return "CfgBlock"; default: assert(! "Invalid node type."); } return (NULL); } //-------------------------------------------------------------------------------------------------------------------- const char* PrivateCFG::Node::nodeTypeColor(NodeType tt) { switch (tt) { case MIAMI_CODE_BLOCK: return "blue"; case MIAMI_CALL_SITE: return "yellow"; case MIAMI_REP_BLOCK: return "darkgreen"; default: return "black"; } return (NULL); } //-------------------------------------------------------------------------------------------------------------------- const char* PrivateCFG::Edge::edgeTypeToString(EdgeType tt) { switch (tt) { case ANY_EDGE_TYPE: return "AnyEdgeType"; case MIAMI_FALLTHRU_EDGE: return "FallThroughEdge"; case MIAMI_DIRECT_BRANCH_EDGE: return "DirectBranchEdge"; case MIAMI_INDIRECT_BRANCH_EDGE: return "IndirectBranchEdge"; case MIAMI_BYPASS_EDGE: return "BypassEdge"; case MIAMI_RETURN_EDGE: return "ReturnEdge"; case MIAMI_CFG_EDGE: return "CFGEdge"; default: assert(! "Invalid edge type."); } return (NULL); } //-------------------------------------------------------------------------------------------------------------------- const char* PrivateCFG::Edge::edgeTypeColor(EdgeType tt) { switch (tt) { case ANY_EDGE_TYPE: return "black"; case MIAMI_FALLTHRU_EDGE: return "blue"; case MIAMI_DIRECT_BRANCH_EDGE: return "deepskyblue"; case MIAMI_INDIRECT_BRANCH_EDGE: return "purple"; case MIAMI_BYPASS_EDGE: return "darkgreen"; case MIAMI_RETURN_EDGE: return "red"; case MIAMI_CFG_EDGE: return "black"; default: assert(! "Invalid edge type."); } return (NULL); } //-------------------------------------------------------------------------------------------------------------------- const char* PrivateCFG::Edge::edgeTypeStyle(EdgeType tt) { switch (tt) { case ANY_EDGE_TYPE: return "\"setlinewidth(3),dotted\""; break; case MIAMI_FALLTHRU_EDGE: case MIAMI_DIRECT_BRANCH_EDGE: case MIAMI_INDIRECT_BRANCH_EDGE: case MIAMI_BYPASS_EDGE: return "\"setlinewidth(3),solid\""; break; case MIAMI_RETURN_EDGE: case MIAMI_CFG_EDGE: return "\"setlinewidth(3),dashed\""; break; default: assert(! "Invalid edge type."); } return (NULL); } //-------------------------------------------------------------------------------------------------------------------- void PrivateCFG::Node::computeInstructionLengths() { // I need to iterate over all the instructions in this block // Because I do not know apriori the length of the instructions, // I will decode them one at a time, record their length, and // advance to the end of the decoded instruction. // Use the machine independent interface for getting instruction lengths ninsts = 0; std::list<int> instLen; // temporary storage for instruction lengths int ilen = 0; addrtype pc = start_addr; addrtype reloc = RelocationOffset(); std::list<int>::iterator lit; for ( ; pc<end_addr ; pc+=ilen) { if ((ilen=length_instruction_at_pc((void*)(pc+reloc), end_addr-pc))<1) break; instLen.push_back(ilen); ++ ninsts; } if (pc < end_addr) { // It is actually possible not to stop at exactly the block's end_address. // This case is possible when an instruction has a prefix, but there is // a path that jumps to the instruction itself, while another path falls through // the prefix. // Set an assert to catch if it happens in practice, but once verified, we can // remove the assert. // Found this case with a lock prefix. Changed condition from != to < fprintf(stderr, "Error: While iterating over instructions, did not stop at end of block [0x%lx,0x%lx], iterator pc=0x%lx, ninsts=%d\nInst lengths:", start_addr, end_addr, pc, ninsts); for (lit=instLen.begin() ; lit!=instLen.end() ; ++lit) fprintf(stderr, " %d", *lit); fprintf(stderr, "\n"); assert(!"bad instruction decoding"); } if (inst_len) delete[] inst_len; inst_len = new int32_t[ninsts]; int i=0; for (lit=instLen.begin() ; lit!=instLen.end() ; ++lit, ++i) { assert (i<ninsts); inst_len[i] = *lit; } } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::ForwardInstructionIterator::ForwardInstructionIterator(Node* n, addrtype from) { node = n; if (node->Size()>0 && node->inst_len==0) { node->computeInstructionLengths(); // the number of instructions and their lengths should be computed by now assert (node->ninsts>0 && node->inst_len!=0); } i = 0; pc = node->start_addr; if (from != (addrtype)-1) // find instruction at 'from' pc while(i<node->numInstructions() && pc<from) { pc += node->inst_len[i]; ++i; } } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::BackwardInstructionIterator::BackwardInstructionIterator(Node* n, addrtype from) { node = n; if (node->Size()>0 && node->inst_len==0) { node->computeInstructionLengths(); // the number of instructions and their lengths should be computed by now assert (node->ninsts>0 && node->inst_len!=0); } i = node->ninsts-1; pc = node->end_addr - node->inst_len[i]; if (from != (addrtype)-1) // find instruction at 'from' pc while(i>=0 && pc>from) { -- i; if (i>=0) pc -= node->inst_len[i]; } } //-------------------------------------------------------------------------------------------------------------------- PrivateCFG::Node* PrivateCFG::findNodeContainingAddress(addrtype pc) { if (!setup_node_container) { NodesIterator nit(*this); while ((bool)nit) { Node *node = nit; if (node->Size()>0) all_nodes.insert(AddrNodeMap::value_type(node->getEndAddress(), node)); ++ nit; } setup_node_container = true; } AddrNodeMap::iterator upit = all_nodes.upper_bound(pc); if (upit != all_nodes.end() && upit->second->getStartAddress()<=pc) return (upit->second); else return (0); } //--------------------------------------------------------------------------------------------------------------------
[ "mgabi99@gmail.com" ]
mgabi99@gmail.com
65e0348eb2821362bdc016bb80ea6ed97eaf57fd
71f61c67433ea86d5b53b08ab7ccf7a98d9389b8
/file system simulation/fs-sim.c
3647fb13b3eaa73099b86875d43ca531ac71d721
[]
no_license
19431/Unix-File-System
0448101ff0c7d4f0365d7644ae36f7f5a3e392f8
b29cf8492b28a4e53494fb93ac1fb2e65144767b
refs/heads/master
2020-05-18T15:05:21.800768
2017-03-22T16:42:55
2017-03-22T16:42:55
84,254,580
0
0
null
null
null
null
UTF-8
C
false
false
19,027
c
#include <stdio.h> #include "fs-sim.h" #include <string.h> #include <stdlib.h> #define ALL 2 #define SINGLE 1 static void *create(Directory *present_dir, const char *p,int type); static void delete_files(File *to_delete, int how_many); static void delete_subdirectory(Directory *dir_pyramid, int how_many); static int special_case(const char *arg); static char helper_type(Directory *present_directory, const char *name); static void helper_ls(Directory *present_directory); static void helper_print(Directory *dir, Fs_sim *files); /*function starts the filesystem by initializing root directory*/ void mkfs(Fs_sim *files){ if(files){ /*creates a directory and casts it from void pointer*/ files-> root_dir= (Directory *) create(NULL, "/", 1); /*every malloc operation is assumed to be successful*/ if (files-> root_dir) files-> curr_dir= files-> root_dir; } } /*function destroys file system by deleting everything in it All dynamically allocated memory in the heap will be freed*/ void rmfs(Fs_sim *files){ if (files){ if(files-> root_dir-> files){ delete_files(files-> root_dir-> files, ALL); } /*all existing subdirectories in current directory must be deleted*/ if (files-> root_dir){ /*remove contents of this directory branch*/ delete_subdirectory(files-> root_dir, ALL); } /*when the file system is empty, the root directory is freed*/ free(files-> root_dir-> dir_name); free(files-> root_dir); } } /*helper function to delete file(s) in a directory*/ static void delete_files(File *to_delete, int how_many){ /*delete only one file here*/ if (how_many == 1){ free(to_delete-> file_name); /*setting freed varaible to NULL in order to prevent double free*/ to_delete-> file_name= NULL; free(to_delete); to_delete= NULL; return; } /*delete all files here*/ else{ if (!to_delete){ /*base case*/ return; } else{ /*recursively frees every other file pointer in root directory*/ delete_files(to_delete-> next_file, ALL); free(to_delete-> file_name); free(to_delete); } } } /*helper function recursively removes subdirectories and their contents (which may also be be another subdirectory or files) until theres nothing left*/ static void delete_subdirectory(Directory *to_be_deleted, int how_many){ Directory *branch_holder= NULL; /*for rmfs, delete everything in a directory's sub directory*/ if (how_many > SINGLE){ while (to_be_deleted-> sub_dir){ /*if curr_dir has sub_dir */ if (to_be_deleted-> sub_dir-> sub_dir){ delete_subdirectory(to_be_deleted-> sub_dir, ALL); } /*remove branch at the base of dir_tree*/ else { branch_holder= to_be_deleted-> sub_dir; to_be_deleted-> sub_dir= to_be_deleted-> sub_dir-> next_dir; /*all files in this branch must be deleted*/ if (branch_holder-> files){ delete_files(branch_holder-> files, ALL); } free(branch_holder-> dir_name); free(branch_holder); } } } /*for rm, deletes single directory*/ if (how_many == SINGLE){ /*single tree member with child (subdirectories)*/ if (to_be_deleted){ delete_subdirectory(to_be_deleted-> sub_dir, SINGLE); delete_files(to_be_deleted-> files,ALL); free(to_be_deleted-> dir_name); free(to_be_deleted); } else{ return; } } } /*function removes an existing file or subdirectory with arg name*/ int rm(Fs_sim *files, const char arg[]){ File *file_pointer= NULL, *file_holder= NULL; Directory *dir_pointer= NULL, *dir_holder= NULL; int result= 1; if (files || arg){ if (!helper_type(files-> curr_dir, arg) || special_case(arg) || (strchr(arg, '/') && strcmp(arg, "/"))){ result= 0; return result; } /*pre-existing file will be deleted*/ if (helper_type(files-> curr_dir, arg) == 'f'){ file_pointer= files-> curr_dir-> files; /*file to be deleted is the head file*/ if (!strcmp(file_pointer-> file_name, arg)){ file_holder= file_pointer; /*head points to head-> next_file*/ files-> curr_dir-> files= file_pointer-> next_file; delete_files(file_holder, SINGLE); file_holder= NULL; return result; } else{ /*check other parts of the file list*/ while (file_pointer && file_pointer-> next_file){ /*next file after head file*/ if (!strcmp(file_pointer->next_file-> file_name, arg)){ file_holder= file_pointer-> next_file; /*head pointer's next file becomes to_be_deleted's next file*/ file_pointer-> next_file= file_pointer-> next_file-> next_file; /*delete just ONE file*/ delete_files(file_holder, SINGLE); file_holder= NULL; return result; } /*move along the list*/ file_pointer= file_pointer-> next_file; } } } /*pre-existing subdirectory and its contents will be deleted*/ if (helper_type(files-> curr_dir, arg) == 's'){ /*points to the head directory*/ dir_pointer= files-> curr_dir-> sub_dir; /*when directory to be deleted is the head directory*/ if (!strcmp(dir_pointer-> dir_name, arg)){ /*keep a pointer to the first directory safe*/ dir_holder= dir_pointer; /*head points to head-> next_dir*/ files-> curr_dir-> sub_dir= dir_pointer-> next_dir; /*directory with sub directories*/ if (dir_pointer-> sub_dir){ delete_subdirectory(dir_holder, ALL); } /*empty directory or directory with no files*/ if (!dir_pointer-> sub_dir){ delete_subdirectory(dir_holder, SINGLE); } return result; } else{ /*when the directory to be deleted is not in the first directory*/ while (dir_pointer && dir_pointer-> next_dir){ /*next directory after head directory*/ if (!strcmp(dir_pointer-> next_dir-> dir_name, arg)){ dir_holder= dir_pointer-> next_dir; /*head pointer's next directory becomes to_be_deleted's next_dir*/ dir_pointer-> next_dir= dir_pointer-> next_dir-> next_dir; /*recursively delete everything in this directory branch*/ if (dir_pointer-> sub_dir){ delete_subdirectory(dir_holder, ALL); } if (!dir_pointer-> sub_dir){ delete_subdirectory(dir_holder, SINGLE); } return result; } /*move along the list until u find the directory to be removed*/ dir_pointer= dir_pointer-> next_dir; } return result; } } } return result; } /*function creates a file if arg is not found in curr_dir*/ int touch (Fs_sim *files, const char arg[]){ /*flag variable to check for presence of special cases*/ int result= 1; File *curr_file= NULL, *file_holder= NULL; /*flag variable to exit loops after file insertion*/ int file_inserted= 0; /*if files is not null*/ if (!files){ result= 0; return result; } /*temporary file node to move pointer through entire list*/ curr_file= files-> curr_dir-> files; /*if arg contains '/' somewhere but also contains other characters*/ if (strchr(arg, '/') && strcmp(arg, "/")){ result= 0; } /*if arg is empty string*/ if (!strlen(arg)){ result= 0; } /*checks if arg is not found in curr_dir and arg is not a special case create a file named arg in curr_dir*/ if (helper_type(files-> curr_dir,arg) == '\0' && result && !special_case(arg)){ /*if curr_dir has no files at all, arg will be the only file in curr_dir */ if (!files-> curr_dir-> files){ /*creates a file and casts it from void pointer*/ files-> curr_dir-> files= (File *) create(files-> curr_dir, arg, 2); file_inserted= 1; } else{ /*curr_file moves through entire list until it reaches the end indicated by NULL*/ while (curr_file && !file_inserted){ /*if arg < curr_file's name insert new file in front of */ if (strcmp(arg,curr_file-> file_name) < 0){ file_holder= files-> curr_dir-> files; /*creates a file and casts it from void pointer*/ files-> curr_dir-> files= (File *) create(files-> curr_dir, arg, 2); files-> curr_dir-> files-> next_file= file_holder; file_inserted= 1; return result; } /*if curr_file has no next file*/ if (!curr_file-> next_file){ /*creates a file and casts it from void pointer*/ curr_file-> next_file= (File *) create(files-> curr_dir, arg, 2); file_inserted= 1; return result; } /*that means it has a next file*/ if (strcmp(arg, curr_file-> file_name) > 0 && strcmp(arg, curr_file-> next_file-> file_name) < 0){ file_holder= curr_file-> next_file; /*creates a file and casts it from void pointer*/ curr_file-> next_file= (File *) create(files-> curr_dir, arg, 2); curr_file-> next_file-> next_file= file_holder; file_inserted= 1; return result; } /*move curr_file pointer to next file*/ curr_file= curr_file-> next_file; } } } return result; } /*helper function to check for special cases*/ static int special_case(const char *arg){ /*if arg is a special case*/ if (!strcmp(arg,".") || !strcmp(arg,"/") || !strcmp(arg,"..") || !strcmp(arg,"")){ /*do nothing other indicate a special case*/ return 1; } return 0; } /*function creates a sub directory in present directory*/ int mkdir(Fs_sim *files, const char arg[]){ int result= 1; Directory *present_dir= NULL, *dir_holder= NULL; int file_inserted= 0; if (files && arg){ /*return 0 if arg is a special case*/ if (special_case(arg) || (strchr(arg, '/') && strcmp(arg, "/"))){ result= 0; return result; } /*for directories with no previous sub directories, make a new directory node and insert at the beginning*/ if (!files-> curr_dir-> sub_dir){ /*creates a directory and casts it from void pointer*/ files-> curr_dir-> sub_dir= (Directory *)create(files-> curr_dir, arg, 1); file_inserted= 1; } /*if arg is neither an existing file or subdirectory and arg is not special case, create a directory in curr_dir in sorted order*/ if (!helper_type(files-> curr_dir, arg) && !special_case(arg)){ present_dir= files-> curr_dir-> sub_dir; /*if we have not reached the end of the directory list*/ while (present_dir && !file_inserted){ /*if arg name comes before current directory's name insert here*/ if (strcmp(arg, present_dir-> dir_name) < 0){ dir_holder= files-> curr_dir-> sub_dir; /*creates a directory and casts it from void pointer*/ files-> curr_dir-> sub_dir= (Directory *) create(files-> curr_dir, arg, 1); files-> curr_dir->sub_dir-> next_dir= dir_holder; files-> curr_dir-> sub_dir-> parent_dir= files-> curr_dir; file_inserted= 1; return result; } /*if present directory is the last sub dir in current directory ,name comes after previous directory so insert after curr_dirr*/ if (!present_dir-> next_dir){ /*creates a directory and casts it from void pointer*/ present_dir-> next_dir= (Directory *) create(files-> curr_dir, arg, 1); file_inserted= 1; return result; } /*name must be in sorted order during insertion condition checks both prev and next directory*/ if (strcmp(arg, present_dir-> dir_name) > 0 && strcmp(arg, present_dir-> next_dir-> dir_name) < 0){ dir_holder= present_dir-> next_dir; /*creates a directory and casts it from void pointer*/ present_dir-> next_dir= (Directory *) create(files-> curr_dir, arg, 1); present_dir-> parent_dir= files-> curr_dir; present_dir-> next_dir-> next_dir= dir_holder; file_inserted= 1; return result; } present_dir= present_dir-> next_dir; } } } /*returns 1 in all other cases besides special case*/ return result; } /*function changes current directory of argument*/ int cd(Fs_sim *files, const char arg[]){ int result= 1; Directory *temp= NULL; /*make sure file not null*/ if (files && arg){ /*if arg not in curr_dir & arg not a special command*/ if ((!helper_type(files-> curr_dir, arg) && !special_case(arg))){ /*scenario represented by 0*/ result= 0; } /*if argument is a file*/ if (helper_type(files-> curr_dir, arg) == 'f'){ result= 0; /*cant really change the directory of a file*/ return result; } /*if arg contains "/" and something else, or arg found in curr_dir*/ if ((strchr(arg,'/') && strcmp(arg, "/"))){ result= 0; } /*if arg is "" or "/", change to root directory*/ if (!strcmp(arg,"/") || !strcmp(arg,"")){ files-> curr_dir= files-> root_dir; } /*if arg is ".." and curr_dir not root_dir, change curr_dir to root_dir*/ if(!strcmp(arg, "..") && files-> curr_dir != files-> root_dir){ files-> curr_dir= files-> curr_dir-> parent_dir; } /* "." command lets u stay at current directory */ if (!strcmp(arg,".")){ /*nothing needs to change, we are already in current directory*/ } /*if arg is name of an immdediate sub directory of curr_dir, get to it and make it the current directory*/ if (helper_type(files-> curr_dir, arg) == 's'){ temp= files-> curr_dir-> sub_dir; while (temp){ if (!strcmp(temp-> dir_name, arg) && temp){ files-> curr_dir= temp; } temp= temp-> next_dir; } } } else{ result= 0; } return result; } /*This function when called when called with no arguments displays files and sub directory in current directory, or in the directory of its argument*/ int ls(Fs_sim *files, const char arg[]){ int result= 1; int printed= 0; int special= 0; Directory *subdir_pointer= NULL; /*checks if parameters are null*/ if (files && arg){ /*if arg refers to the name of a file in current directory, print its name*/ if (helper_type(files-> curr_dir, arg) == 'f' ){ printed= 1; printf("%s\n", arg); } /*prints everything in current directory of files when arg is "." or ""*/ if (!strcmp(arg, ".") || !strcmp(arg,"")){ helper_ls(files-> curr_dir); special++; } /*if curr_dir doesnt contain any file or directory with name arg*/ if (!helper_type(files-> curr_dir, arg) && !special_case(arg)){ result= 0; return result; } /*prints everything in the parent directory of files when arg is ".." also checks to see that curr_dir has a parent*/ if (!strcmp(arg,"..") && (files-> curr_dir-> parent_dir)){ helper_ls(files-> curr_dir-> parent_dir); } /*prints everthing in the root dir if arg is "/"*/ if (!strcmp(arg,"/")){ helper_ls(files-> root_dir); } /*if arg refers to the name of a sub directory in current directory*/ if (helper_type(files-> curr_dir, arg) == 's' ){ subdir_pointer= files-> curr_dir-> sub_dir; /*move pointer all the day down the list till particular sub_dir is found*/ while (subdir_pointer && !printed){ if (!strcmp(subdir_pointer-> dir_name, arg)){ /*print content of sub directory*/ helper_ls(subdir_pointer); printed=1; } else{ subdir_pointer= subdir_pointer-> next_dir; } } } } /*if files is a null pointer return 0*/ else{ result= 0; } return result; } /*function prints path to present directory*/ void pwd(Fs_sim *files){ /*if its the root directory*/ if (!strcmp(files-> curr_dir-> dir_name, "/")){ /*base case is root directory*/ printf("/"); } /*if path is not the root directory*/ else{ /*call helper function*/ helper_print(files-> curr_dir, files); } printf("\n"); } /*helper method that recursively prints each directory's name*/ static void helper_print(Directory *dir, Fs_sim *files ){ /*stop recursive call if its the root directory*/ if (strcmp(dir-> dir_name, "/")){ helper_print(dir-> parent_dir, files); printf("/%s", dir-> dir_name); } } /*helper function to print files or (and) sub directories in a directory*/ static void helper_ls(Directory *present_directory){ File *file_pointer= present_directory-> files; Directory *dir_pointer= present_directory-> sub_dir; /*if current directory has no files or sub directories*/ if (!dir_pointer && !file_pointer){ return; } /*if current directory has files and sub directories*/ while (file_pointer && dir_pointer){ if ((strcmp(file_pointer-> file_name,dir_pointer-> dir_name)) < 0){ printf("%s\n", file_pointer-> file_name); file_pointer= file_pointer-> next_file; } /*since file and sub dir can't have the same name in same directory strcmp() cant be 0. therefore it can only be + or - */ else{ printf("%s/\n", dir_pointer-> dir_name); dir_pointer= dir_pointer-> next_dir; } } /*if current directory has just files only*/ if (file_pointer && !dir_pointer){ while (file_pointer){ printf("%s\n", file_pointer-> file_name); file_pointer= file_pointer-> next_file; } return; } /*if current directory has just sub directories*/ if (dir_pointer && !file_pointer){ while (dir_pointer){ printf("%s/\n", dir_pointer-> dir_name); dir_pointer= dir_pointer-> next_dir; } } } /*helper function to determine if name is a file or sub directory in the current directory. returns 's' for sub directory, 'f' for file and '\0' if that name is not found there */ static char helper_type(Directory *present_directory, const char *name){ char type= '\0'; Directory *dir= NULL; File *file= NULL; if (present_directory){ dir= present_directory-> sub_dir; file= present_directory-> files; while (dir){ if (!(strcmp(dir-> dir_name, name))){ type= 's'; } dir= dir-> next_dir; } while (file){ if (!(strcmp(file-> file_name, name))){ type= 'f'; } file= file-> next_file; } } return type; } /*helper method to create either file or directory as needed returns a void pointer to be casted by calling function*/ static void *create(Directory *present_dir, const char *p, int type){ void *made= NULL; /*creates a directory*/ if (type== 1){ Directory *new_directory= malloc(sizeof(Directory)); /*+1 for null character*/ new_directory-> dir_name= malloc(sizeof(char) * (strlen(p) + 1)); strcpy((new_directory-> dir_name), p); /*sets every other field to null*/ new_directory-> sub_dir= NULL; new_directory-> next_dir= NULL; new_directory-> parent_dir= present_dir; new_directory-> files= NULL; /*sets pointer to address of the new directory*/ made= new_directory; } /*creates a file*/ if (type== 2){ File *new_file= malloc(sizeof(File)); /*+1 for null character*/ new_file-> file_name= malloc(sizeof(char) * (strlen(p) + 1)); strcpy((new_file-> file_name), p); new_file-> next_file= NULL; /*sets pointer to address of the new file*/ made= new_file; } /*returns void pointer to be converted accoringly by caller*/ return made; }
[ "noreply@github.com" ]
19431.noreply@github.com
e4b8dbc622753ad7c9fc184f83c03b8fc3735210
4545588c8427debaf17f9dc71b0ace32f4fb5d67
/thirdparty/fatfs/unit_tests/sam4e16e_sam4e_ek/conf_uart_serial.h
0909bdc587337539499068ec7aecc781ba9d269b
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
eewiki/asf
02e06cec0465b28dd689dea801e6be6cbcd47eca
8d0f55bd089f2e68d2b53aa76adbb02c07cdb166
refs/heads/master
2021-01-16T18:20:22.690176
2015-03-09T05:42:50
2015-03-09T05:42:50
18,419,213
34
30
null
2014-12-25T05:13:20
2014-04-03T21:42:46
C
UTF-8
C
false
false
1,938
h
/** * \file * * \brief Serial UART service configuration. * * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * 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 Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ #ifndef CONF_UART_SERIAL_H #define CONF_UART_SERIAL_H /* Intentionally empty */ #endif/* CONF_UART_SERIAL_H_INCLUDED */
[ "buildmaster@atmel.com" ]
buildmaster@atmel.com
c92ca8b47c248653da55763477052e38b14e376a
a0ac0cb4113b731721c73dbca165f0f473e20435
/data/kernels/8874/11/includes.h
8a42ab3b2f833869f26f9d14028fc9945277772c
[]
no_license
NTNU-HPC-Lab/LS-CAT
93f2d5d24937c518a8a216e56e54961658fcaab8
83a50786eee2de633be477819c044d2c9a1ad076
refs/heads/master
2023-08-22T11:53:35.114641
2023-08-08T14:12:14
2023-08-08T14:12:14
380,981,826
0
2
null
null
null
null
UTF-8
C
false
false
24
h
#include "cudaUtility.h"
[ "jacobot@selbu.idi.ntnu.no" ]
jacobot@selbu.idi.ntnu.no
4d6cda4247d14876669259d37be4444d29c95cdb
d4c58ec9bf382d4d8b481ececd0cd2b9a28690d7
/Led.h
0d71f3dcdc2c3328ab8cc86fed2a6a85d04df926
[ "MIT" ]
permissive
jgabrielfreitas/remot-ino
931699bade9324e001be9cf29c291204f82da2f6
8d910fce533dbc9274179bf0fce9b4385b0711c9
refs/heads/master
2021-05-07T18:19:41.642180
2017-10-30T04:55:35
2017-10-30T04:55:35
108,788,001
0
0
null
null
null
null
UTF-8
C
false
false
447
h
// ***************** INCLUDES *********************** #include <Arduino.h> bool ON = true; bool OFF = false; bool status = OFF; void ledSetUp() { pinMode(LED_BUILTIN, OUTPUT); } void turnOn() { digitalWrite(LED_BUILTIN, HIGH); status = ON; } void turnOff() { digitalWrite(LED_BUILTIN, LOW); status = OFF; } bool isTurnedOn() { return status; } void changeStatus() { if (isTurnedOn() == ON) { turnOff(); } else { turnOn(); } }
[ "jgabrielafreitas@gmail.com" ]
jgabrielafreitas@gmail.com
7e0819edb8ff18cf9be9cb3700d5ea099eefa9fb
0f0fbd191f174c7386f1105148c3d55044339224
/InterchangeMaxWithMinInArray/DataSets/DataSetsImplementation.h
60c2e9ba6fbcc6ecec4123187962e3df599d5fbc
[ "MIT" ]
permissive
CiganOliviu/C-projects-tests
b23de03ddc21fa399d9c5342521edf7dce9d02c5
9c92aa496a2097d7d38ad9c3c6e05d7d2bc2e8c0
refs/heads/main
2023-02-09T06:57:07.709016
2021-01-03T17:22:13
2021-01-03T17:22:13
300,746,233
0
1
null
null
null
null
UTF-8
C
false
false
1,537
h
// // Created by cigan on 15.10.2020. // #ifndef INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H #define INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H #include "DataSetsDef.h" void DataSetOne(OneDimensionalArrayType * Array) { Array->Length = 5; Array->OneDimensionalArray[0] = 12; Array->OneDimensionalArray[1] = -12; Array->OneDimensionalArray[2] = 13; Array->OneDimensionalArray[3] = 234; Array->OneDimensionalArray[4] = -5; } void DataSetTwo(OneDimensionalArrayType * Array) { Array->Length = 7; Array->OneDimensionalArray[0] = 7; Array->OneDimensionalArray[1] = 1; Array->OneDimensionalArray[2] = 5; Array->OneDimensionalArray[3] = -4; Array->OneDimensionalArray[4] = 3; Array->OneDimensionalArray[5] = -2; Array->OneDimensionalArray[6] = -6; } void ExpectedSetOne(OneDimensionalArrayType * Array) { Array->Length = 5; Array->OneDimensionalArray[0] = 12; Array->OneDimensionalArray[1] = 234; Array->OneDimensionalArray[2] = 13; Array->OneDimensionalArray[3] = -12; Array->OneDimensionalArray[4] = -5; } void ExpectedSetTwo(OneDimensionalArrayType * Array) { Array->Length = 7; Array->OneDimensionalArray[0] = -6; Array->OneDimensionalArray[1] = 1; Array->OneDimensionalArray[2] = 5; Array->OneDimensionalArray[3] = -4; Array->OneDimensionalArray[4] = 3; Array->OneDimensionalArray[5] = -2; Array->OneDimensionalArray[6] = 7; } #endif //INTERCHANGEMAXWITHMININARRAY_DATASETSIMPLEMENTATION_H
[ "ciganoliviudavid@gmail.com" ]
ciganoliviudavid@gmail.com
159c26da67f06de1ae0984a945def3d15f001eea
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/arch/mips/lasat/extr_picvue_proc.c_pvc_scroll_proc_show.c
645275be5dc5367dad315e532428273f412c7c51
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
886
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct seq_file {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pvc_mutex ; int scroll_dir ; int scroll_interval ; int /*<<< orphan*/ seq_printf (struct seq_file*,char*,int) ; __attribute__((used)) static int pvc_scroll_proc_show(struct seq_file *m, void *v) { mutex_lock(&pvc_mutex); seq_printf(m, "%d\n", scroll_dir * scroll_interval); mutex_unlock(&pvc_mutex); return 0; }
[ "brenocfg@gmail.com" ]
brenocfg@gmail.com
f7a6f10fda043e6251ceebc6273c8ac4c03b7f22
15ea0adae9255e5f45043beeae9783758b095829
/Assignments/task_management/thread/task_state/test.c
c2a06b3b5641ed8d9a1a173ca51354545e302a2f
[]
no_license
yashvarur/begining
d13959fd9611029e54299219c281cf2be3169b3e
78dc2a3fc179dc5519244ba145d37cbaa74ebfd6
refs/heads/master
2021-01-19T22:43:49.148579
2017-04-20T12:03:16
2017-04-20T12:03:16
88,853,021
0
0
null
null
null
null
UTF-8
C
false
false
86
c
# include <stdio.h> int main() { printf("pid = %d\n",getpid()); getchar(); }
[ "yashvarur@outlook.com" ]
yashvarur@outlook.com
5e3885f1eb4fdd884a4296f0b0e3dffab243a338
c2c1602af2fa8a5929859b536d915a44c00c4cfe
/dylan2/range.c
ebe44fd3850cd5a4b5357b6d62ecaddfdfb1682b
[]
no_license
netbsduser/vub-dylan
1ce11b13ef2b48bb30f61bf375478badc1bb4503
8f0b3ff65546b66c2728870a932af3a6df7392f3
refs/heads/master
2021-05-28T17:21:42.383203
2015-02-04T16:57:26
2015-02-04T16:57:26
null
0
0
null
null
null
null
UTF-8
C
false
false
4,771
c
#include "range.h" #include "keyword.h" #include <string.h> /* +------------------------------------------------------------------ | FUNCTION : range::range | INPUT : - | OUTPUT : - | RETURN : een range | DATE : | | ABSTRACT : Constructor voor een range (een range is een set van | getallen ) | | CHANGES : +------------------------------------------------------------------ */ range::range() { id = "<range>"; from = 0.0 ; to = 0.0 ; above = 0.0 ; below = 0.0 ; size = 0 ; by = 1.0 ; Abstract = FALSE ; Sealed = FALSE; Instantiable = TRUE ; NbrSuperclasses = 1 ; Superclass = new (GC) DylanObject * [1] ; Superclass[0] = new sequence ; } /* +------------------------------------------------------------------ | FUNCTION : range::GetElement | INPUT : int : Ide element | OUTPUT : - | RETURN : een getal | DATE : | | ABSTRACT : Ophalen van het ide element. | | CHANGES : +------------------------------------------------------------------ */ DylanObject *range::GetElement( int i ) { local = i * by + from ; if ( below != 0.0 && local > below ) local = below ; if ( above != 0.0 && local < above ) local = above ; if (i > size && size != 0 ) local = 0.0 ; return new double_float( local ); } /* +------------------------------------------------------------------ | FUNCTION : Setter | INPUT : double : ignored | OUTPUT : - | RETURN : - | DATE : | | ABSTRACT : In een range kan men de waarden niet wijzigen. | | CHANGES : +------------------------------------------------------------------ */ void range::Setter( double x ) { printf( "error : not applicable\n" ) ; } /* +------------------------------------------------------------------ | FUNCTION : range::Instance | INPUT : | OUTPUT : | RETURN : | DATE : | | ABSTRACT : Maken van een instance van een range | | CHANGES : +------------------------------------------------------------------ */ DylanObject *range::Instance(DylanObject *X, List<DylanObject *> *InitList ) { static DylanObject *O ; if ( InitList != NULL ) { O = new range( NULL, InitList ) ; } else { O = new range ; } return O ; } /* +------------------------------------------------------------------ | FUNCTION : range::range | INPUT : int : een dummy | List<DylanObject *> : initialisatie keyworden | OUTPUT : - | RETURN : een range | DATE : | | ABSTRACT : creatie van een range met init keywords, deze keywords | zijn : | from, to, below, above, size, by | | CHANGES : +------------------------------------------------------------------ */ range::range( int *dummy, List<DylanObject *> *InitList ) { int i ; char str[255] ; id = "<range>"; from = 0 ; by = 1 ; above = 0 ; below = 0 ; size = 0 ; for( i = 1; i <= InitList->GetSize(); i++ ) { InitList->MoveTo(i) ; InitList->GetItem()->Getter(str) ; if ( strcmp( str, "from:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&from) ; } else if ( strcmp( str, "to:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&to) ; } else if ( strcmp( str, "above:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&above) ; } else if ( strcmp( str, "below:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&below) ; } else if ( strcmp( str, "by:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&by) ; } else if ( strcmp( str, "size:" ) == 0 ) { ((keyword *) InitList->GetItem())->GetValue(NULL)->Getter(&size) ; } else error( "Invalid keyword supplied to range !" ) ; } Abstract = FALSE ; Sealed = FALSE; Instantiable = TRUE ; Superclass = new DylanObject * [1] ; Superclass[0] = new sequence ; } /* +------------------------------------------------------------------ | FUNCTION : operator== | INPUT : een range | OUTPUT : - | RETURN : boolean | DATE : | | ABSTRACT : test of 2 ranges gelijk zijn (ttz identieke keywords | getallen ) | | CHANGES : +------------------------------------------------------------------ */ int range::operator==( const DylanObject *X ) { return( (this->from == ((range *) X)->from) && (this->by == ((range *) X)->by) && (this->above == ((range *) X)->above) && (this->below == ((range *) X)->below) && (this->size == ((range *) X)->size) ) ; }
[ "bruce.mitchener@gmail.com" ]
bruce.mitchener@gmail.com
ba047a0066647b1e5291e5a64648a540540016fc
88789d49a1c4211e974145015f513ff7ac89da97
/tdt/cvs/driver/stgfb/stmfb/linux/kernel/drivers/stm/coredisplay/hdmidev.c
ef67ca52b421df6672bb47c28d4c81eb85202d35
[]
no_license
yarko93/tdt-amiko
b4410371de57eb1de0d05e14fc8c0d42957320cb
ea55c0c9207faaef528a2eaea451577b62b5e57a
refs/heads/master
2021-01-10T01:13:07.300384
2013-05-05T08:50:53
2013-05-05T08:50:53
51,619,256
0
0
null
null
null
null
UTF-8
C
false
false
29,721
c
/*********************************************************************** * * File: linux/kernel/drivers/stm/coredisplay/hdmidev.c * Copyright (c) 2005,2007,2008 STMicroelectronics Limited. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * \***********************************************************************/ #include <linux/version.h> #include <linux/compiler.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/fb.h> #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/kthread.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/wait.h> #include <linux/gpio.h> #include <asm/uaccess.h> #include <asm/irq.h> #include <linux/semaphore.h> #include <stmdisplay.h> #include <linux/stm/stmcoredisplay.h> #include <linux/stm/stmcorehdmi.h> #include "stmhdmi.h" static char *hdmi0; module_param(hdmi0, charp, 0444); MODULE_PARM_DESC(hdmi0, "[enable|disable]"); extern int stmhdmi_manager(void *data); #ifdef __TDT__ static struct stm_hdmi *HACK_dev; #endif static int stmhdmi_open(struct inode *inode,struct file *filp) { struct stm_hdmi *dev = container_of(inode->i_cdev, struct stm_hdmi, cdev); filp->private_data = dev; return 0; } /* * Reading from the HDMI device returns the full raw EDID data read from * the downstream device. */ static ssize_t stmhdmi_read(struct file *filp, char __user *buf, size_t sz, loff_t *off) { struct stm_hdmi *dev = (struct stm_hdmi *)filp->private_data; ssize_t retval = 0; if(*off >= sizeof(dev->edid_info.raw)) return retval; if(*off + sz > sizeof(dev->edid_info.raw)) sz = sizeof(dev->edid_info.raw) - *off; if(mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; if(dev->edid_info.display_type != STM_DISPLAY_INVALID) { if(copy_to_user(buf, &dev->edid_info.raw[0][0] + *off, sz)) { retval = -EFAULT; } else { *off += sz; retval = sz; } } mutex_unlock(&dev->lock); return retval; } static inline int stmhdmi_convert_metadata_result_to_errno(stm_meta_data_result_t res) { switch(res) { case STM_METADATA_RES_OK: break; case STM_METADATA_RES_UNSUPPORTED_TYPE: return -EOPNOTSUPP; case STM_METADATA_RES_TIMESTAMP_IN_PAST: case STM_METADATA_RES_INVALID_DATA: return -EINVAL; case STM_METADATA_RES_QUEUE_BUSY: return -EBUSY; case STM_METADATA_RES_QUEUE_UNAVAILABLE: return -EAGAIN; } return 0; } static int stmhdmi_send_data_packet(struct stm_hdmi *dev, unsigned long arg) { stm_meta_data_result_t res; stm_meta_data_t *metadata; stm_hdmi_info_frame_t *iframe; struct stmhdmiio_data_packet packet; if (copy_from_user(&packet,(void*)arg,sizeof(packet))) return -EFAULT; if((metadata = kzalloc(sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t),GFP_KERNEL)) == 0) return -ENOMEM; metadata->size = sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t); metadata->release = (void(*)(struct stm_meta_data_s*))kfree; metadata->presentationTime = ((TIME64)packet.timestamp.tv_sec * USEC_PER_SEC) + (TIME64)packet.timestamp.tv_usec; switch(packet.type) { case HDMI_ACP_PACKET_TYPE: { /* * Don't allow the configuration of ACP packets unless the * connected TV has the supports AI flag set in its EDID. */ if((dev->edid_info.display_type != STM_DISPLAY_HDMI) || (dev->edid_info.hdmi_vsdb_flags & STM_HDMI_VSDB_SUPPORTS_AI) == 0) { DPRINTK("Not Sending ACP Datapacket, sink does not support AI\n"); kfree(metadata); return -EPERM; } DPRINTK("Sending ACP Datapacket\n"); metadata->type = STM_METADATA_TYPE_ACP_DATA; break; } case HDMI_VENDOR_INFOFRAME_TYPE: { DPRINTK("Sending vendor IFrame\n"); metadata->type = STM_METADATA_TYPE_VENDOR_IFRAME; break; } case HDMI_NTSC_INFOFRAME_TYPE: { DPRINTK("Sending NTSC IFrame\n"); metadata->type = STM_METADATA_TYPE_NTSC_IFRAME; break; } case HDMI_GAMUT_DATA_PACKET_TYPE: { DPRINTK("Sending Color Gamut Datapacket\n"); metadata->type = STM_METADATA_TYPE_COLOR_GAMUT_DATA; break; } default: { DPRINTK("Unsupported Datapacket\n"); kfree(metadata); return -EINVAL; } } iframe = (stm_hdmi_info_frame_t*)&metadata->data[0]; iframe->type = packet.type; iframe->version = packet.version; iframe->length = packet.length; /* * Note: we cannot use packet.length to size the memcpy as this is only * valid for real InfoFrames not arbitrary HDMI data island packets. */ memcpy(&iframe->data[0],&packet.data[0],28); if(stm_display_output_queue_metadata(dev->hdmi_output, metadata, &res)<0) { kfree(metadata); if(signal_pending(current)) return -ERESTARTSYS; else return -EIO; } return stmhdmi_convert_metadata_result_to_errno(res); } static int stmhdmi_set_isrc_data(struct stm_hdmi *dev, unsigned long arg) { stm_meta_data_result_t res; stm_meta_data_t *metadata; stm_hdmi_isrc_data_t *isrc; struct stmhdmiio_isrc_data isrcdata; if (copy_from_user(&isrcdata,(void*)arg,sizeof(isrcdata))) return -EFAULT; /* * Don't allow the configuration of ISRC packets unless the * connected TV has the supports AI flag set in its EDID. */ if((dev->edid_info.display_type != STM_DISPLAY_HDMI) || (dev->edid_info.hdmi_vsdb_flags & STM_HDMI_VSDB_SUPPORTS_AI) == 0) { DPRINTK("Not Sending ISRC Datapackets, sink does not support AI\n"); return -EPERM; } if((metadata = kzalloc(sizeof(stm_meta_data_t)+sizeof(stm_hdmi_isrc_data_t),GFP_KERNEL)) == 0) return -ENOMEM; metadata->size = sizeof(stm_meta_data_t)+sizeof(stm_hdmi_isrc_data_t); metadata->release = (void(*)(struct stm_meta_data_s*))kfree; metadata->type = STM_METADATA_TYPE_ISRC_DATA; metadata->presentationTime = ((TIME64)isrcdata.timestamp.tv_sec * USEC_PER_SEC) + (TIME64)isrcdata.timestamp.tv_usec; isrc = (stm_hdmi_isrc_data_t*)&metadata->data[0]; isrc->isrc1.type = HDMI_ISRC1_PACKET_TYPE; isrc->isrc2.type = HDMI_ISRC2_PACKET_TYPE; if(isrcdata.status != ISRC_STATUS_DISABLE) { int i; isrc->isrc1.version = (isrcdata.status & HDMI_ISRC1_STATUS_MASK) | HDMI_ISRC1_VALID; /* * Just copy the first 16 bytes of information to ISRC1 */ memcpy(isrc->isrc1.data,&isrcdata.upc_ean_isrc[0],16); /* * For the second 16 bytes we need to see if there is any non-zero data in * there. If not then the second ISRC packet will not be transmitted. */ for(i=16;i<32;i++) { if(isrcdata.upc_ean_isrc[i] != 0) { isrc->isrc1.version |= HDMI_ISRC1_CONTINUED; isrc->isrc2.data[i-16] = isrcdata.upc_ean_isrc[i]; } } } DPRINTK("Sending ISRC Datapackets\n"); if(stm_display_output_queue_metadata(dev->hdmi_output, metadata, &res)<0) { kfree(metadata); if(signal_pending(current)) return -ERESTARTSYS; else return -EIO; } return stmhdmi_convert_metadata_result_to_errno(res); } static void stmhdmi_flush_data_packet_queue(struct stm_hdmi *dev, unsigned long arg) { if(arg & STMHDMIIO_FLUSH_ACP_QUEUE) stm_display_output_flush_metadata(dev->hdmi_output,STM_METADATA_TYPE_ACP_DATA); if(arg & STMHDMIIO_FLUSH_ISRC_QUEUE) stm_display_output_flush_metadata(dev->hdmi_output,STM_METADATA_TYPE_ISRC_DATA); if(arg & STMHDMIIO_FLUSH_VENDOR_QUEUE) stm_display_output_flush_metadata(dev->hdmi_output,STM_METADATA_TYPE_VENDOR_IFRAME); if(arg & STMHDMIIO_FLUSH_GAMUT_QUEUE) stm_display_output_flush_metadata(dev->hdmi_output,STM_METADATA_TYPE_COLOR_GAMUT_DATA); if(arg & STMHDMIIO_FLUSH_NTSC_QUEUE) stm_display_output_flush_metadata(dev->hdmi_output,STM_METADATA_TYPE_NTSC_IFRAME); } static int stmhdmi_set_audio_iframe_data(struct stm_hdmi *dev, unsigned long arg) { stm_meta_data_result_t res; stm_meta_data_t *metadata; stm_hdmi_info_frame_t *iframe; struct stmhdmiio_audio audiocfg; if (copy_from_user(&audiocfg,(void*)arg,sizeof(audiocfg))) return -EFAULT; if((metadata = kzalloc(sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t),GFP_KERNEL)) == 0) return -ENOMEM; metadata->size = sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t); metadata->release = (void(*)(struct stm_meta_data_s*))kfree; metadata->type = STM_METADATA_TYPE_AUDIO_IFRAME; iframe = (stm_hdmi_info_frame_t*)&metadata->data[0]; iframe->type = HDMI_AUDIO_INFOFRAME_TYPE; iframe->version = HDMI_AUDIO_INFOFRAME_VERSION; iframe->length = HDMI_AUDIO_INFOFRAME_LENGTH; iframe->data[1] = (audiocfg.channel_count << HDMI_AUDIO_INFOFRAME_CHANNEL_COUNT_SHIFT) & HDMI_AUDIO_INFOFRAME_CHANNEL_COUNT_MASK; iframe->data[2] = (audiocfg.sample_frequency << HDMI_AUDIO_INFOFRAME_FREQ_SHIFT) & HDMI_AUDIO_INFOFRAME_FREQ_MASK; iframe->data[4] = audiocfg.speaker_mapping; iframe->data[5] = audiocfg.downmix_info & (HDMI_AUDIO_INFOFRAME_LEVELSHIFT_MASK| HDMI_AUDIO_INFOFRAME_DOWNMIX_INHIBIT); if(stm_display_output_queue_metadata(dev->hdmi_output, metadata, &res)<0) { kfree(metadata); if(signal_pending(current)) return -ERESTARTSYS; else return -EIO; } return stmhdmi_convert_metadata_result_to_errno(res); } static int stmhdmi_set_spd_data(struct stm_hdmi *dev, unsigned long arg) { struct stmhdmiio_spd spdinfo; unsigned long flags; if (copy_from_user(&spdinfo,(void*)arg,sizeof(spdinfo))) return -EFAULT; /* * We need to update these atomically as the buffer is being shared with * the low level driver's info frame transmission manager. In this case, * due to the very infrequent update of SPD information, it is OK to * do it this way. */ spin_lock_irqsave(&dev->spinlock, flags); memcpy(&dev->spd_frame->data[HDMI_SPD_INFOFRAME_VENDOR_START] , spdinfo.vendor_name , HDMI_SPD_INFOFRAME_VENDOR_LENGTH); memcpy(&dev->spd_frame->data[HDMI_SPD_INFOFRAME_PRODUCT_START], spdinfo.product_name, HDMI_SPD_INFOFRAME_PRODUCT_LENGTH); dev->spd_frame->data[HDMI_SPD_INFOFRAME_SPI_OFFSET] = spdinfo.identifier; spin_unlock_irqrestore(&dev->spinlock, flags); return 0; } #ifdef __TDT__ //HACK-> long stmhdmiio_set_audio_source(unsigned int arg) { unsigned long audio = STM_AV_SOURCE_MAIN_INPUT; unsigned long val; long retval=0; printk("%s - %p\n", __func__, HACK_dev); if(mutex_lock_interruptible(&HACK_dev->lock)) return -ERESTARTSYS; switch(arg) { case STMHDMIIO_AUDIO_SOURCE_2CH_I2S: audio |= STM_AV_SOURCE_2CH_I2S_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_SPDIF: audio |= STM_AV_SOURCE_SPDIF_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_8CH_I2S: audio |= STM_AV_SOURCE_8CH_I2S_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_NONE: break; default: retval = -EINVAL; goto exit; } if(stm_display_output_set_control(HACK_dev->hdmi_output, STM_CTRL_AV_SOURCE_SELECT, audio)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; goto exit; } if(stm_display_output_get_control(HACK_dev->hdmi_output, STM_CTRL_AV_SOURCE_SELECT, &val)<0) { if(signal_pending(current)) retval = -EINTR; else retval = -EIO; goto exit; } if(val != audio) retval = -EINVAL; exit: mutex_unlock(&HACK_dev->lock); return retval; } EXPORT_SYMBOL(stmhdmiio_set_audio_source); long stmhdmiio_get_audio_source(unsigned int * arg) { unsigned long audio; long retval=0; struct stm_hdmi *dev = HACK_dev; printk("%s - %p\n", __func__, dev); if(mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; if(stm_display_output_get_control(dev->hdmi_output, STM_CTRL_AV_SOURCE_SELECT, &audio)<0) { if(signal_pending(current)) retval = -EINTR; else retval = -EIO; goto exit; } if (audio & STM_AV_SOURCE_2CH_I2S_INPUT) *arg = STMHDMIIO_AUDIO_SOURCE_2CH_I2S; else if (audio & STM_AV_SOURCE_SPDIF_INPUT) *arg = STMHDMIIO_AUDIO_SOURCE_SPDIF; else if (audio & STM_AV_SOURCE_8CH_I2S_INPUT) *arg = STMHDMIIO_AUDIO_SOURCE_8CH_I2S; else *arg = STMHDMIIO_AUDIO_SOURCE_NONE; exit: mutex_unlock(&dev->lock); return retval; } EXPORT_SYMBOL(stmhdmiio_get_audio_source); long stmhdmiio_set_edid_handling(unsigned int arg) { long retval=0; struct stm_hdmi *dev = HACK_dev; printk("%s - %p\n", __func__, HACK_dev); if(mutex_lock_interruptible(&HACK_dev->lock)) return -ERESTARTSYS; dev->non_strict_edid_semantics = arg ; mutex_unlock(&HACK_dev->lock); return retval; } EXPORT_SYMBOL(stmhdmiio_set_edid_handling); long stmhdmiio_get_edid_handling(unsigned int * arg) { long retval=0; struct stm_hdmi *dev = HACK_dev; printk("%s - %p\n", __func__, dev); if(mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; *arg = dev->non_strict_edid_semantics; mutex_unlock(&dev->lock); return retval; } EXPORT_SYMBOL(stmhdmiio_get_edid_handling); long stmhdmiio_get_cec_address(unsigned int * arg) { long retval=0; struct stm_hdmi *dev = HACK_dev; printk("%s - %p\n", __func__, dev); if(mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; #if defined(SPARK) *arg = (1 << 12) + (0 << 8) + (0 << 4) + (0); #else *arg = (dev->edid_info.cec_address[0] << 12) + (dev->edid_info.cec_address[1] << 8) + (dev->edid_info.cec_address[2] << 4) + (dev->edid_info.cec_address[3]); #endif mutex_unlock(&dev->lock); return retval; } EXPORT_SYMBOL(stmhdmiio_get_cec_address); //HACK <- #endif static long stmhdmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct stm_hdmi *dev = (struct stm_hdmi *)filp->private_data; long retval=0; if(mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; switch(cmd) { case STMHDMIIO_SET_SPD_DATA: retval = stmhdmi_set_spd_data(dev, arg); break; case STMHDMIIO_SEND_DATA_PACKET: retval = stmhdmi_send_data_packet(dev, arg); break; case STMHDMIIO_SET_ISRC_DATA: retval = stmhdmi_set_isrc_data(dev, arg); break; case STMHDMIIO_FLUSH_DATA_PACKET_QUEUE: stmhdmi_flush_data_packet_queue(dev,arg); break; case STMHDMIIO_SET_AUDIO_DATA: retval = stmhdmi_set_audio_iframe_data(dev, arg); break; case STMHDMIIO_SET_AVMUTE: if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_AVMUTE, arg)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; } break; case STMHDMIIO_SET_AUDIO_SOURCE: { unsigned long audio = STM_AV_SOURCE_MAIN_INPUT; unsigned long val; switch(arg) { case STMHDMIIO_AUDIO_SOURCE_2CH_I2S: audio |= STM_AV_SOURCE_2CH_I2S_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_SPDIF: audio |= STM_AV_SOURCE_SPDIF_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_8CH_I2S: audio |= STM_AV_SOURCE_8CH_I2S_INPUT; break; case STMHDMIIO_AUDIO_SOURCE_NONE: break; default: retval = -EINVAL; goto exit; } if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_AV_SOURCE_SELECT, audio)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; goto exit; } if(stm_display_output_get_control(dev->hdmi_output, STM_CTRL_AV_SOURCE_SELECT, &val)<0) { if(signal_pending(current)) retval = -EINTR; else retval = -EIO; goto exit; } if(val != audio) retval = -EINVAL; break; } case STMHDMIIO_SET_AUDIO_TYPE: { unsigned long val; if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_HDMI_AUDIO_OUT_SELECT, arg)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; goto exit; } if(stm_display_output_get_control(dev->hdmi_output, STM_CTRL_HDMI_AUDIO_OUT_SELECT, &val)<0) { if(signal_pending(current)) retval = -EINTR; else retval = -EIO; goto exit; } if(val != arg) retval = -EINVAL; break; } case STMHDMIIO_SET_OVERSCAN_MODE: { if(arg > STMHDMIIO_SCAN_UNDERSCANNED) { retval = -EINVAL; goto exit; } if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_HDMI_OVERSCAN_MODE, arg)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; } break; } case STMHDMIIO_SET_CONTENT_TYPE: { ULONG val = 0; if(arg > STMHDMIIO_CE_CONTENT) { retval = -EINVAL; goto exit; } /* * Map the argument to infoframe bits IT|CN1|CN0 */ switch(arg) { case STMHDMIIO_CE_CONTENT: val = 0; break; default: val = arg | (1L<<2); break; } if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_HDMI_CONTENT_TYPE, val)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; } break; } case STMHDMIIO_SET_EDID_MODE_HANDLING: { unsigned long flags; if(arg > STMHDMIIO_EDID_NON_STRICT_MODE_HANDLING) { retval = -EINVAL; goto exit; } dev->non_strict_edid_semantics = arg; spin_lock_irqsave(&dev->spinlock, flags); if(dev->status != STM_DISPLAY_DISCONNECTED) { dev->status = STM_DISPLAY_NEEDS_RESTART; dev->status_changed = 1; wake_up (&dev->status_wait_queue); } spin_unlock_irqrestore(&dev->spinlock, flags); break; } case STMHDMIIO_SET_HOTPLUG_MODE: { if(arg > STMHDMIIO_HPD_STOP_IF_NECESSARY) { retval = -EINVAL; goto exit; } dev->hotplug_mode = arg; break; } case STMHDMIIO_SET_CEA_MODE_SELECTION: { if(arg > STMHDMIIO_CEA_MODE_FROM_EDID_ASPECT_RATIO) { retval = -EINVAL; goto exit; } switch(arg) { case STMHDMIIO_CEA_MODE_FROM_EDID_ASPECT_RATIO: dev->cea_mode_from_edid = 1; /* * In case the display is already running, change the mode to whatever * the EDID says. Note that if the EDID had bad data we default to * 16:9. */ arg = (dev->edid_info.tv_aspect == STM_WSS_4_3)?STMHDMIIO_CEA_MODE_4_3:STMHDMIIO_CEA_MODE_16_9; break; default: dev->cea_mode_from_edid = 0; break; } if(stm_display_output_set_control(dev->hdmi_output, STM_CTRL_HDMI_CEA_MODE_SELECT, arg)<0) { if(signal_pending(current)) retval = -ERESTARTSYS; else retval = -EIO; } break; } case STMHDMIIO_SET_SAFE_MODE_PROTOCOL: { unsigned long flags; if(dev->hdmi_safe_mode == arg) goto exit; dev->hdmi_safe_mode = arg; spin_lock_irqsave(&dev->spinlock, flags); if(dev->status != STM_DISPLAY_DISCONNECTED) { dev->status = STM_DISPLAY_NEEDS_RESTART; dev->status_changed = 1; wake_up (&dev->status_wait_queue); } spin_unlock_irqrestore(&dev->spinlock, flags); break; } default: retval = -ENOTTY; } exit: mutex_unlock(&dev->lock); return retval; } struct file_operations hdmi_fops = { .owner = THIS_MODULE, .open = stmhdmi_open, .read = stmhdmi_read, .unlocked_ioctl = stmhdmi_ioctl }; /******************************************************************************/ static void stmhdmi_vsync_cb(stm_vsync_context_handle_t context, stm_field_t field) { stm_display_status_t hdmi_status; struct stm_hdmi *hdmi_data = (struct stm_hdmi *)context; stm_display_output_get_status(hdmi_data->hdmi_output, &hdmi_status); if(hdmi_data->display_runtime->hotplug_poll_pio >= 0) { unsigned hotplugstate = gpio_get_value(hdmi_data->display_runtime->hotplug_poll_pio); #if defined(HL101) || defined(VIP1_V2) || defined(VIP2_V1) || defined(SPARK) || defined(SPARK7162) || defined(ADB_BOX) if(hdmi_status == STM_DISPLAY_DISCONNECTED) { /* * If the device has just been plugged in, flag that we now need to * start the output. */ if(hotplugstate == 0) { hdmi_status = STM_DISPLAY_NEEDS_RESTART; stm_display_output_set_status(hdmi_data->hdmi_output, hdmi_status); } } else { /* * We may either be waiting for the output to be started, or already * started, so only change the state if the device has now been * disconnected. */ if(hotplugstate != 0) { hdmi_status = STM_DISPLAY_DISCONNECTED; stm_display_output_set_status(hdmi_data->hdmi_output, hdmi_status); } } #else if(hdmi_status == STM_DISPLAY_DISCONNECTED) { /* * If the device has just been plugged in, flag that we now need to * start the output. */ if(hotplugstate != 0) { hdmi_status = STM_DISPLAY_NEEDS_RESTART; stm_display_output_set_status(hdmi_data->hdmi_output, hdmi_status); } } else { /* * We may either be waiting for the output to be started, or already * started, so only change the state if the device has now been * disconnected. */ if(hotplugstate == 0) { hdmi_status = STM_DISPLAY_DISCONNECTED; stm_display_output_set_status(hdmi_data->hdmi_output, hdmi_status); } } #endif } if(hdmi_status != hdmi_data->status) { hdmi_data->status = hdmi_status; hdmi_data->status_changed = 1; wake_up(&hdmi_data->status_wait_queue); } } /******************************************************************************/ int stmhdmi_destroy(struct stm_hdmi *hdmi) { if(!hdmi) return 0; /* * Terminate HDMI management thread */ hdmi->auth = 0; wake_up(&(hdmi->auth_wait_queue)); if(hdmi->thread != NULL) kthread_stop(hdmi->thread); hdmi->thread = NULL; stmcore_unregister_vsync_callback(hdmi->display_runtime, &hdmi->vsync_cb_info); if(hdmi->class_device) { device_unregister(hdmi->class_device); hdmi->class_device = NULL; } cdev_del(&hdmi->cdev); if(hdmi->irq != -1) free_irq(hdmi->irq, hdmi->hdmi_output); if(hdmi->hdmi_output) { stm_display_output_release(hdmi->hdmi_output); hdmi->hdmi_output = NULL; } if(hdmi->main_output) { stm_display_output_release(hdmi->main_output); hdmi->main_output = NULL; } /* * Do not release the device handle, it was a copy of the platform data * which will get released elsewhere. */ hdmi->device = NULL; kfree(hdmi->spd_metadata); kfree(hdmi); return 0; } static irqreturn_t stmhdmi_interrupt(int irq, void* data) { stm_display_output_t *o = (stm_display_output_t *)data; stm_display_output_handle_interrupts(o); return IRQ_HANDLED; } static int __init stmhdmi_create_spd_metadata(struct stm_hdmi *hdmi) { if((hdmi->spd_metadata = kzalloc(sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t),GFP_KERNEL))==0) { DPRINTK("Cannot allocate SPD metadata\n"); return -ENOMEM; } hdmi->spd_metadata->size = sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t); hdmi->spd_metadata->type = STM_METADATA_TYPE_SPD_IFRAME; hdmi->spd_frame = (stm_hdmi_info_frame_t*)&hdmi->spd_metadata->data[0]; hdmi->spd_frame->type = HDMI_SPD_INFOFRAME_TYPE; hdmi->spd_frame->version = HDMI_SPD_INFOFRAME_VERSION; hdmi->spd_frame->length = HDMI_SPD_INFOFRAME_LENGTH; strncpy(&hdmi->spd_frame->data[HDMI_SPD_INFOFRAME_VENDOR_START],"STM",HDMI_SPD_INFOFRAME_VENDOR_LENGTH); strncpy(&hdmi->spd_frame->data[HDMI_SPD_INFOFRAME_PRODUCT_START],"STLinux",HDMI_SPD_INFOFRAME_PRODUCT_LENGTH); hdmi->spd_frame->data[HDMI_SPD_INFOFRAME_SPI_OFFSET] = HDMI_SPD_INFOFRAME_SPI_PC; return 0; } static struct stm_hdmi * __init stmhdmi_create_hdmi_dev_struct(void) { struct stm_hdmi *hdmi; hdmi = kzalloc(sizeof(struct stm_hdmi), GFP_KERNEL); if(!hdmi) return NULL; mutex_init(&(hdmi->lock)); spin_lock_init(&(hdmi->spinlock)); init_waitqueue_head(&(hdmi->status_wait_queue)); init_waitqueue_head(&(hdmi->auth_wait_queue)); return hdmi; } static int __init stmhdmi_register_device(struct stm_hdmi *hdmi, int id, dev_t firstdevice, struct stmcore_display_pipeline_data *platform_data) { cdev_init(&(hdmi->cdev),&hdmi_fops); hdmi->cdev.owner = THIS_MODULE; kobject_set_name(&(hdmi->cdev.kobj),"hdmi%d.0",id); if(cdev_add(&(hdmi->cdev),MKDEV(MAJOR(firstdevice),id),1)) return -ENODEV; if(stmhdmi_init_class_device(hdmi, platform_data)) return -ENODEV; return 0; } int __init stmhdmi_create(int id, dev_t firstdevice, struct stmcore_display_pipeline_data *platform_data) { struct stm_hdmi *hdmi; struct i2c_adapter *i2c; char *paramstring; if(!platform_data) { printk(KERN_ERR "platform data pointer is NULL\n"); BUG(); return -EINVAL; } i2c = i2c_get_adapter(platform_data->hdmi_i2c_adapter_id); if(!i2c) { printk(KERN_ERR "HDMI i2c bus (%d) not available, check your kernel configuration and board setup\n",platform_data->hdmi_i2c_adapter_id); return -EINVAL; } platform_data->hdmi_data = NULL; if((hdmi = stmhdmi_create_hdmi_dev_struct()) == NULL) return -ENOMEM; DPRINTK("new hdmi structure = %p\n",hdmi); #ifdef __TDT__ //Dagobert HACK_dev = hdmi; #endif /* * Note that we reuse the device handle from the platform data. */ hdmi->device = platform_data->device; hdmi->irq = -1; hdmi->i2c_adapter = i2c; hdmi->video_type = STM_VIDEO_OUT_RGB; switch(id) { case 0: paramstring = hdmi0; break; default: paramstring = NULL; break; } if(paramstring) { if(paramstring[0] == 'd' || paramstring[0] == 'D') { printk(KERN_WARNING "hdmi%d.0 is initially disabled, use 'stfbset -e hdmi' to enable it\n",id); hdmi->disable = 1; } } /* * Set the default CEA selection behaviour to use the aspect ratio in the EDID */ hdmi->cea_mode_from_edid = 1; #ifdef __TDT__ hdmi->non_strict_edid_semantics = STMHDMIIO_EDID_NON_STRICT_MODE_HANDLING; #endif /* * Copy the display runtime pointer for the vsync callback handling. */ hdmi->display_runtime = platform_data->display_runtime; /* * Note that we are trusting the output identifiers are valid * and pointing to correct output types. */ hdmi->main_output = stm_display_get_output(hdmi->device, platform_data->main_output_id); hdmi->hdmi_output = stm_display_get_output(hdmi->device, platform_data->hdmi_output_id); if(hdmi->main_output == NULL || hdmi->hdmi_output == NULL) { DPRINTK("Cannot get display outputs main = %d, hdmi = %d\n",platform_data->main_output_id,platform_data->hdmi_output_id); stmhdmi_destroy(hdmi); return -ENODEV; } if(stm_display_output_get_capabilities(hdmi->hdmi_output, &hdmi->capabilities)<0) { DPRINTK("Cannot get hdmi output capabilities\n"); stmhdmi_destroy(hdmi); return -ENODEV; } if(!(hdmi->capabilities & STM_OUTPUT_CAPS_TMDS)) { printk(KERN_ERR "Provided HDMI output identifier doesn't support TMDS??\n"); stmhdmi_destroy(hdmi); return -ENODEV; } if(request_irq(platform_data->hdmi_irq, stmhdmi_interrupt, IRQF_DISABLED, "hdmi", hdmi->hdmi_output)) { printk(KERN_ERR "Cannot get HDMI irq = %d\n",platform_data->hdmi_irq); stmhdmi_destroy(hdmi); return -ENODEV; } hdmi->irq = platform_data->hdmi_irq; if(stmhdmi_create_spd_metadata(hdmi)) { stmhdmi_destroy(hdmi); return -ENOMEM; } /* * If we split the HDMI management into another module then we should change * the owner field in the callback info to THIS_MODULE. However this is * linked into the coredisplay module at the moment we do not want to have * another reference to ourselves. */ INIT_LIST_HEAD(&(hdmi->vsync_cb_info.node)); hdmi->vsync_cb_info.owner = NULL; hdmi->vsync_cb_info.context = hdmi; hdmi->vsync_cb_info.cb = stmhdmi_vsync_cb; if(stmcore_register_vsync_callback(hdmi->display_runtime, &hdmi->vsync_cb_info)<0) { printk(KERN_ERR "Cannot register hdmi vsync callback\n"); return -ENODEV; } hdmi->thread = kthread_run(stmhdmi_manager,hdmi,"hdmid/%d",id); if (hdmi->thread == NULL) { printk(KERN_ERR "Cannot start hdmi thread id = %d\n",id); stmhdmi_destroy(hdmi); return -ENOMEM; } platform_data->hdmi_data = hdmi; if(stmhdmi_register_device(hdmi, id, firstdevice, platform_data)) { stmhdmi_destroy(hdmi); return -ENODEV; } return 0; }
[ "schpuntik@freenet.de" ]
schpuntik@freenet.de
484b5c3caca5f38b2d9e8d0dc2bb1122e9f49ad3
eb266f888155c0fa59c923d7496e875c7259f1de
/include/lib/lib_cursor.h
b58e60c0944334295b30d5e03ddb765475a01e2b
[ "BSD-2-Clause" ]
permissive
werererer/japokwm
e7f46b210e7daf6a7d3a6bb8c61d912c40a2cb58
9cdc208ed70d4b58a805431992e4078171403edd
refs/heads/master
2023-05-25T18:46:40.826666
2023-01-15T22:26:59
2023-01-15T22:26:59
297,172,042
121
4
BSD-2-Clause
2023-01-15T22:27:00
2020-09-20T22:06:29
C
UTF-8
C
false
false
144
h
#ifndef LIB_CURSOR_H #define LIB_CURSOR_H #include <lua.h> #include <lauxlib.h> void lua_load_cursor(lua_State *L); #endif /* LIB_CURSOR_H */
[ "johann123j@gmail.com" ]
johann123j@gmail.com
48c3af8f2e74b97ea0b2c3940e4ea53080a24dcf
5c255f911786e984286b1f7a4e6091a68419d049
/code/2909f0ff-e06b-4cac-bcbf-60615225c74a.c
10da900443599557c968566c08f1a622f481a465
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
243
c
#include <stdio.h> int main() { int i=04; int j=134; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = l/j; l = j%j; l = l-j; k = k-k*i; printf("vulnerability"); printf("%d%d\n",k,l); return 0; }
[ "nharmon8@gmail.com" ]
nharmon8@gmail.com
1e2ce7bdc53a715aeb8864f82e8628cfec191d47
a3c1435f81aec000a21c7c6195d45ec20c102fc7
/CycloneTCP_SSL_Crypto_Open_1_8_6/cyclone_tcp/coap/coap_client_block.h
37fa5a36877a43739f83bfe21fd29882118fb86f
[]
no_license
koson/TI-modbus
bd75657550fb867dedaf4b8da0d38c58e2d06195
f7fd89deac773700714c8e9bf70943b37adf36af
refs/heads/master
2020-05-09T00:10:30.235887
2019-04-08T19:45:37
2019-04-08T19:45:37
null
0
0
null
null
null
null
UTF-8
C
false
false
1,768
h
/** * @file coap_client_block.h * @brief CoAP block-wise transfer * * @section License * * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved. * * This file is part of CycloneTCP Open. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * @author Oryx Embedded SARL (www.oryx-embedded.com) * @version 1.8.6 **/ #ifndef _COAP_CLIENT_BLOCK_H #define _COAP_CLIENT_BLOCK_H //Dependencies #include "core/net.h" #include "coap/coap_client.h" //C++ guard #ifdef __cplusplus extern "C" { #endif //CoAP client related functions error_t coapClientSetTxBlockSize(CoapClientRequest *request, uint_t blockSize); error_t coapClientSetRxBlockSize(CoapClientRequest *request, uint_t blockSize); error_t coapClientWriteBody(CoapClientRequest *request, const void *data, size_t length, size_t *written, bool_t last); error_t coapClientReadBody(CoapClientRequest *request, void *data, size_t size, size_t *received); CoapBlockSize coapClientGetMaxBlockSize(void); //C++ guard #ifdef __cplusplus } #endif #endif
[ "ora2@illinois.edu" ]
ora2@illinois.edu
7a9c0f36ee6c2a5069b5b72d787c6ad251add80e
4ecf22f4e73143a20e0719ba0268adf3eab8735d
/midterm1_solution/task1_fork.c
41566355b4d13e2ee76086f7aee1affb4a1d679a
[]
no_license
dinhlam2000/CPE357
5c66ea441816ac702727f9c870f65ff67d472a78
bc61f669eb3e6701a73e01e6672395e5b8ba153b
refs/heads/master
2020-12-20T14:48:42.035452
2020-04-03T22:49:18
2020-04-03T22:49:18
236,111,254
0
2
null
null
null
null
UTF-8
C
false
false
632
c
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <sys/mman.h> #include <string.h> #include <time.h> int main() { int f1,f2,f3,b; f1 = fork(); if (f1 == 0) { f2 = fork(); if (f2 == 0) { printf("A"); return 3; } else { wait(&b); printf("B"); } return 3; } else { wait(&b); f3 = fork(); if (f3 == 0) { printf("C"); return 3; } else{ wait(&b); printf("D"); } } }
[ "lamtran@Lams-MacBook-Pro.local" ]
lamtran@Lams-MacBook-Pro.local
df1267ec97e229a5ab8382b5d7ce84f8ed16ac06
93feca41b9002f41396be61fba8233a3626bd128
/c/getchar.c
8ecd260f0fca32403bc751255cb53fe387a27f48
[]
no_license
dongde/dongde
3b6abe2c6ec083e594a6fc854d60fa49486b0b73
08f2e2f96d0fb6a2f441de1b177a40203da2589a
refs/heads/master
2020-04-08T14:24:28.864367
2019-04-13T02:35:46
2019-04-13T02:35:46
159,435,687
1
0
null
null
null
null
UTF-8
C
false
false
220
c
#include <stdio.h> int main(){ int c; // c = getchar(); // // while(c != EOF){ // putchar(c); // c = getchar(); // } while((c = getchar()) !=EOF) putchar(c); return 0; }
[ "dongde@dongde.org" ]
dongde@dongde.org
0ba3dd959cbb6737162fc8d1155c8a122e962119
5f9b26a41102c38da28b8f757a5586f9bc7cf71a
/crates/zig_build_bin_windows_x86_64/zig-windows-x86_64-0.5.0+80ff549e2/lib/zig/libc/musl/src/complex/ccos.c
0d7511b4586405d5dbc5b5f9267420d9929cc8fb
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-musl-exception", "MIT" ]
permissive
jeremyBanks/zig_with_cargo
f8e65f14adf17ed8d477f0856257422c2158c63f
f8ee46b891bbcdca7ff20f5cad64aa94c5a1d2d1
refs/heads/master
2021-02-06T10:26:17.614138
2020-03-09T04:46:26
2020-03-09T04:46:26
243,905,553
4
1
null
null
null
null
UTF-8
C
false
false
146
c
#include "complex_impl.h" /* cos(z) = cosh(i z) */ double complex ccos(double complex z) { return ccosh(CMPLX(-cimag(z), creal(z))); }
[ "_@jeremy.ca" ]
_@jeremy.ca
cc56a2732361317e53726d69f21e369905d93310
6b486b9f286b030a21042ff612eedeeda64fd8f2
/textformatter/strmanage.h
a54f7c86b284ee874409124927b46818260f5a8f
[]
no_license
tkm1202/textformatter
2a397acf0f573d946cd532d4f23c2514c3985f83
e9ef227eeb5323961cc5445f3235099e6680b68f
refs/heads/master
2020-06-18T22:47:07.906024
2019-07-12T00:28:51
2019-07-12T00:28:51
196,481,186
0
0
null
null
null
null
UTF-8
C
false
false
123
h
#ifndef STRMANAGE_H_ #define STRMANAGE_H_ #include "enum.h" void Str_manage(char *, STRTYPE); int GET_strCount(); #endif
[ "takumi.k.1202@gmail.com" ]
takumi.k.1202@gmail.com
a8187c06f23b73b39c5c01b2a1cf95b5347aa708
e13bccceb4c2fefbf8000f9b34195ab434cf1656
/devel/include/roscpp/GetLoggersResponse.h
c3f6fe61b826f313fcae4eede4704917ace0cba7
[]
no_license
QuiN-cy/vacuum-en-band
ab59b718f289ad4e8a1f29e96724250b00bd894d
48c296199b4a6ade40e084c9980d53ba1611a344
refs/heads/master
2023-06-01T12:13:38.664849
2021-06-11T15:42:42
2021-06-11T15:42:42
376,071,197
0
0
null
null
null
null
UTF-8
C
false
false
77
h
/home/student/rosws/devel/.private/roscpp/include/roscpp/GetLoggersResponse.h
[ "quincy1234321@hotmail.nl" ]
quincy1234321@hotmail.nl
7b9ed4ac0491ff586822b9d883a46e7e80e4f776
1f5b1b1307f25a54466faf5be7f7af6fb20c7b76
/ft_strnew.c
7c90d2be40a85f065a88e3cfad06790fca487a9c
[]
no_license
jmayitez/libft_tqt
1dc9aea749f321a4c7bd254991c2ce39c91d0182
d321dcabcc96db792e2168c71f9146d1ab66f9f4
refs/heads/master
2020-08-20T21:47:51.298229
2019-10-18T17:01:30
2019-10-18T17:01:30
216,069,720
0
0
null
null
null
null
UTF-8
C
false
false
985
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bajouini <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/06 18:47:46 by bajouini #+# #+# */ /* Updated: 2018/11/06 18:47:46 by bajouini ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strnew(size_t size) { return ((char*)ft_memalloc(size + 1)); }
[ "noreply@github.com" ]
jmayitez.noreply@github.com
bb218c06b67d24466602495c0e6ad03e8453c598
8d753bb8f19b5b1f526b0688d3cb199b396ed843
/osp_sai_2.1.8/system/sdk/tsingma/ctccli/sdkcli/usw/ctc_usw_nexthop_cli.c
2639c865fc540a82c0a8dd461f860ffe1d1c633d
[]
no_license
bonald/vim_cfg
f166e5ff650db9fa40b564d05dc5103552184db8
2fee6115caec25fd040188dda0cb922bfca1a55f
refs/heads/master
2023-01-23T05:33:00.416311
2020-11-19T02:09:18
2020-11-19T02:09:18
null
0
0
null
null
null
null
UTF-8
C
false
false
31,446
c
/** @file ctc_nexthop_cli.c @date 2009-11-30 @version v2.0 The file apply clis of port module */ #include "ctc_api.h" #include "ctcs_api.h" #include "sal.h" #include "ctc_cli.h" #include "ctc_cli_common.h" #include "ctc_l2.h" #include "ctc_error.h" #include "ctc_debug.h" #include "ctc_nexthop_cli.h" enum cli_usw_nh_type_e { CLI_GOLDENGATE_NH_TYPE_NULL, CLI_GOLDENGATE_NH_TYPE_MCAST, CLI_GOLDENGATE_NH_TYPE_BRGUC, CLI_GOLDENGATE_NH_TYPE_IPUC, CLI_GOLDENGATE_NH_TYPE_MPLS, CLI_GOLDENGATE_NH_TYPE_ECMP, /*For IPUC, MPLS, etc*/ CLI_GOLDENGATE_NH_TYPE_DROP, CLI_GOLDENGATE_NH_TYPE_TOCPU, CLI_GOLDENGATE_NH_TYPE_UNROV, CLI_GOLDENGATE_NH_TYPE_ILOOP, CLI_GOLDENGATE_NH_TYPE_ELOOP, CLI_GOLDENGATE_NH_TYPE_RSPAN, CLI_GOLDENGATE_NH_TYPE_IP_TUNNEL, CLI_GOLDENGATE_NH_TYPE_TRILL, CLI_GOLDENGATE_NH_TYPE_MISC, CLI_GOLDENGATE_NH_TYPE_WLAN_TUNNEL, CLI_GOLDENGATE_NH_TYPE_MAX }; typedef enum cli_usw_nh_type_e cli_usw_nh_type_t; extern int32 sys_usw_nh_dump_all(uint8 lchip, cli_usw_nh_type_t nh_type, uint8 dump_type); extern int32 sys_usw_nh_display_current_global_sram_info(uint8 lchip); extern int32 sys_usw_nh_dump_mpls_tunnel(uint8 lchip, uint16 tunnel_id, bool detail); extern int32 sys_usw_nh_dump(uint8 lchip, uint32 nhid, bool detail); extern int32 sys_usw_nh_dump_mcast_group(uint8 lchip, uint32 group_id, bool detail); extern int32 sys_usw_nh_dump_arp(uint8 lchip, uint16 arp_id, bool detail); extern int32 sys_usw_nh_dump_resource_usage(uint8 lchip); CTC_CLI(ctc_cli_usw_nh_show_nexthop_by_nhid_type, ctc_cli_usw_nh_show_nexthop_by_nhid_type_cmd, "show nexthop (NHID | mcast group GROUP) (detail |)(lchip LCHIP|)", CTC_CLI_SHOW_STR, CTC_CLI_NH_M_STR, CTC_CLI_NH_ID_STR, "Mcast", "Mcast group", "Group id <1-Max>", "Display detail information", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { uint32 nhid; int32 ret = CLI_ERROR; bool detail = FALSE; uint8 index = 0; uint8 lchip = 0; index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("detail"); if (0xFF != index) { detail = TRUE; } index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("mcast"); if (0xFF != index) { uint32 group_id = 0; CTC_CLI_GET_UINT32("Group id", group_id, argv[index + 2]); ret = sys_usw_nh_dump_mcast_group(lchip, group_id, detail); } else { CTC_CLI_GET_UINT32("NexthopID", nhid, argv[0]); ret = sys_usw_nh_dump(lchip, nhid, detail); } if (ret) { ctc_cli_out("%% Dump nexthop fail\n"); } return ret; } CTC_CLI(ctc_cli_usw_nh_show_nexthop_all_by_type, ctc_cli_usw_nh_show_nexthop_all_by_type_cmd, "show nexthop all ((mcast|brguc|ipuc|ecmp|mpls|iloop|rspan|ip-tunnel|misc|trill|wlan-tunnel)|) (internal|external|)(lchip LCHIP|)", CTC_CLI_SHOW_STR, CTC_CLI_NH_M_STR, "All nexthop", "Multicast nexthop", "Bridge unicast nexthop", "Ipuc nexthop", "ECMP nexthop", "MPLS nexthop", "ILoop nexthop", "RSPAN nexthop", "Ip tunnel nexthop", "Misc nexthop", "Trill nexthop", "Wlan tunnel nexthop", "Internal nexthop", "External nexthop", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = 0; uint8 lchip = 0; uint8 index = 0; uint32 type = CLI_GOLDENGATE_NH_TYPE_MAX; uint8 dump_type = 0; index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; index = CTC_CLI_GET_ARGC_INDEX("mcast"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_MCAST; } index = CTC_CLI_GET_ARGC_INDEX("brguc"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_BRGUC; } index = CTC_CLI_GET_ARGC_INDEX("ipuc"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_IPUC; } index = CTC_CLI_GET_ARGC_INDEX("mpls"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_MPLS; } index = CTC_CLI_GET_ARGC_INDEX("ecmp"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_ECMP; } index = CTC_CLI_GET_ARGC_INDEX("iloop"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_ILOOP; } index = CTC_CLI_GET_ARGC_INDEX("rspan"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_RSPAN; } index = CTC_CLI_GET_ARGC_INDEX("ip-tunnel"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_IP_TUNNEL; } index = CTC_CLI_GET_ARGC_INDEX("trill"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_TRILL; } index = CTC_CLI_GET_ARGC_INDEX("misc"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_MISC; } index = CTC_CLI_GET_ARGC_INDEX("wlan-tunnel"); if (0xFF != index) { type = CLI_GOLDENGATE_NH_TYPE_WLAN_TUNNEL; } index = CTC_CLI_GET_ARGC_INDEX("internal"); if (0xFF != index) { dump_type = 1; } index = CTC_CLI_GET_ARGC_INDEX("external"); if (0xFF != index) { dump_type = 2; } ret = sys_usw_nh_dump_all(lchip, type, dump_type); if (ret) { ctc_cli_out("%% Dump nexthop fail\n"); } return ret; } extern int32 sys_usw_nh_set_ipmc_logic_replication(uint8 lchip, uint8 enable); extern int32 sys_usw_nh_set_pkt_nh_edit_mode(uint8 lchip, uint8 edit_mode); CTC_CLI(ctc_cli_usw_nh_cfg_global_param, ctc_cli_usw_nh_cfg_global_param_cmd, "nexthop (ipmc-logic-replication) value VALUE (lchip LCHIP|)", CTC_CLI_NH_M_STR, "IPMC-logic_replication", "Value", "The Value of paramer configuration", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = CLI_SUCCESS; uint8 lchip = 0; uint8 index = 0 ; uint8 value; index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; if (0 == sal_memcmp(argv[0], "ipmc-logic-replication", 4)) { CTC_CLI_GET_UINT8("Value", value, argv[1]); ret = sys_usw_nh_set_ipmc_logic_replication(lchip, value); if (ret < 0) { ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret)); return CLI_ERROR; } } return ret; } CTC_CLI(ctc_cli_usw_nh_dump_mpls_tunnel, ctc_cli_usw_nh_dump_mpls_tunnel_cmd, "show nexthop mpls-tunnel TUNNEL_ID (detail|)(lchip LCHIP|)", CTC_CLI_SHOW_STR, CTC_CLI_NH_M_STR, CTC_CLI_NH_MPLS_TUNNEL, CTC_CLI_NH_MPLS_TUNNEL_ID, "Display detail information", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = CLI_SUCCESS; uint8 lchip = 0; uint16 tunnel_id = 0; uint8 index = 0 ; bool detail = FALSE; CTC_CLI_GET_UINT16("Value", tunnel_id, argv[0]); index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("detail"); if (0xFF != index) { detail = TRUE; } index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; ret = sys_usw_nh_dump_mpls_tunnel(lchip, tunnel_id, detail); if (ret < 0) { ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret)); return CLI_ERROR; } return ret; } extern int32 sys_usw_nh_set_reflective_brg_en(uint8 lchip, uint8 enable); CTC_CLI(ctc_cli_usw_nh_set_reflective_bridge, ctc_cli_usw_nh_set_reflective_bridge_cmd, "nexthop mcast-reflective-bridge (enable|disable)(lchip LCHIP|)", CTC_CLI_NH_M_STR, "Mcast packet will support reflective bridge", "Enable", "Disable", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = CLI_SUCCESS; uint8 lchip = 0; uint8 index = 0 ; uint8 enable = FALSE; if (0 == sal_strncmp("enable", argv[0], sizeof("enable"))) { enable = TRUE; } index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; ret = sys_usw_nh_set_reflective_brg_en(lchip, enable); if (ret < 0) { ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret)); return CLI_ERROR; } return CLI_SUCCESS; } CTC_CLI(ctc_cli_usw_nh_show_resource_usage, ctc_cli_usw_nh_show_resource_usage_cmd, "show nexthop status (lchip LCHIP|)", CTC_CLI_SHOW_STR, CTC_CLI_NH_M_STR, "Nexthop's resource used status", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = CLI_SUCCESS; uint8 lchip = 0; uint8 index = 0 ; index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en?g_api_lchip:lchip; ret = sys_usw_nh_dump_resource_usage(lchip); if (ret < 0) { ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret)); return CLI_ERROR; } return CLI_SUCCESS; } CTC_CLI(ctc_cli_usw_nh_dump_arp_id, ctc_cli_usw_nh_dump_arp_id_cmd, "show nexthop arp-id ARP_ID (detail|) (lchip LCHIP|)", CTC_CLI_SHOW_STR, CTC_CLI_NH_M_STR, "ARP ID", "ARP ID Value", "Display detail information", CTC_CLI_LCHIP_ID_STR, CTC_CLI_LCHIP_ID_VALUE) { int32 ret = CLI_SUCCESS; uint16 arp_id = 0; uint8 index = 0 ; bool detail = FALSE; uint8 lchip = 0; CTC_CLI_GET_UINT16("Value", arp_id, argv[0]); index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("detail"); if (0xFF != index) { detail = TRUE; } index = CTC_CLI_GET_ARGC_INDEX("lchip"); if (0xFF != index) { CTC_CLI_GET_UINT8("lchip", lchip, argv[index + 1]); } lchip = g_ctcs_api_en? g_api_lchip : lchip; ret = sys_usw_nh_dump_arp(lchip, arp_id, detail); if (ret < 0) { ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret)); return CLI_ERROR; } return ret; } #define CTC_CLI_NH_WLAN_TUNNEL_TYPE "type ( tunnel-v4 ipsa A.B.C.D ipda A.B.C.D| tunnel-v6 ipsa X:X::X:X ipda X:X::X:X) l4-src-port L4SRCPORT l4-dest-port L4DESTPORT" #define CTC_CLI_NH_WLAN_TUNNEL_FLAG "{ radio-mac MAC | encrypt ID |roam-status (pop|poa)|multicast-en (bssid-bitmap VALUE|)|split-mac {dot11-sub-type VALUE | map-cos (cos-domain DOMAIN |)} | is-route-packet | mac-da MACDA |vlan-id VLANID| wds bssid-da BSSID| dscp DSCP dscp-select SEL_MODE (dscp-domain DOMAIN |)|"\ "ttl TTL (map-ttl|) | frag-en mtu-size MTU | flow-label-mode MODE (flow-label-value VALUE|) | logic-dest-port PORT | logic-port-check|"\ "stats-id STATSID | data-keepalive | untag |(copy-dont-frag|set-dont-frag)| ecn-select ECN_SEL | }" #define CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_STR CTC_CLI_NH_WLAN_TUNNEL_TYPE CTC_CLI_NH_WLAN_TUNNEL_FLAG #define CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_DESC \ "Tunnel type", \ "Tunnel over ipv4", \ "Ip sa", \ CTC_CLI_IPV4_FORMAT, \ "Ip da", \ CTC_CLI_IPV4_FORMAT, \ "Tunnel over ipv6", \ "Ip sa", \ CTC_CLI_IPV6_FORMAT, \ "Ip da", \ CTC_CLI_IPV6_FORMAT, \ "Layer4 src port", \ "Value <0-65535>", \ "Layer4 dest port", \ "Value <0-65535>", \ "Radio mac enable", \ "Radio mac value", \ "Encrypt enable", \ "Encrypt id ", \ "Roam status", \ "Pop role", \ "Poa role", \ "Multicast enbale", \ "Bssid bitmap for wtp replication", \ "Bssid bitmap value, max 16 bits", \ "Translate 802.3 to 802.11", \ "Dot11 sub type", \ "Dot11 sub type value: <0-15>", \ "Map cos", \ "Cos domain", \ "Domain ID", \ "Is route packet", \ "Inner mac da", \ "Inner mac da value", \ "Vlan id", \ "Vlan id value", \ "WDS enable", \ "Bssid mac da", \ "Vssid mac da value", \ CTC_CLI_NH_DSNH_TUNNEL_DSCP_DESC, \ CTC_CLI_NH_DSNH_TUNNEL_DSCP_VAL, \ "Dscp select mode", \ "Dscp select mode, refer to ctc_nh_dscp_select_mode_t", \ "Dscp domain", \ "Domain ID", \ "TTL", \ "TTL value: <0-0xFF>", \ "TTL mode, if set means new ttl will be (oldTTL - specified TTL) otherwise new ttl is specified TTL", \ "Frag enable", \ "Mtu size", \ "Mtu size value <0-0x3fff>", \ "IPv6 flow label mode (default is do not set flow label value)",\ "IPv6 flow label mode:0-Do not set flow label valu, 1-Use (user-define flow label + header hash)to outer header , 2- Use user-define flow label to outer header", \ "IPv6 flow label value (default is 0)", \ "IPv6 flow label value <0-0xFFFFF>", \ "Logic destination port assigned for this tunnel", \ "Logic port value : <1-0x3FFF>", \ "Logic port check", \ CTC_CLI_STATS_ID_DESC, \ CTC_CLI_STATS_ID_VAL, \ "Data keepalive packet", \ "Untag packet", \ "copy paload dont-frag to outer ip header", \ "set dont-frag in outer ip header", \ "Ecn select mode", \ "Ecn mode:0-use ecn 0, 1-user-define ECN, 2-Use ECN value from ECN map, 3-Copy packet ECN" STATIC int32 _ctc_nexthop_cli_parse_wlan_tunnel_nexthop(char** argv, uint16 argc, ctc_nh_wlan_tunnel_param_t* p_nhinfo) { uint8 tmp_argi; int ret = CLI_SUCCESS; mac_addr_t mac; ipv6_addr_t ipv6_address; /*tunnel v4 ip header info*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("tunnel-v4"); if (0xFF != tmp_argi) { /*IPSA IPDA*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("ipsa"); if (0xFF != tmp_argi) { CTC_CLI_GET_IPV4_ADDRESS("ipsa", p_nhinfo->ip_sa.ipv4, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("ipda"); if (0xFF != tmp_argi) { CTC_CLI_GET_IPV4_ADDRESS("ipda", p_nhinfo->ip_da.ipv4, argv[tmp_argi + 1]); } } tmp_argi = CTC_CLI_GET_ARGC_INDEX("tunnel-v6"); if (0xFF != tmp_argi) /*tunnel v6 ip header info*/ { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_IPV6); /*IPSA IPDA*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("ipsa"); if (0xFF != tmp_argi) { CTC_CLI_GET_IPV6_ADDRESS("ipsa", ipv6_address, argv[tmp_argi + 1]); /* adjust endian */ p_nhinfo->ip_sa.ipv6[0] = sal_htonl(ipv6_address[0]); p_nhinfo->ip_sa.ipv6[1] = sal_htonl(ipv6_address[1]); p_nhinfo->ip_sa.ipv6[2] = sal_htonl(ipv6_address[2]); p_nhinfo->ip_sa.ipv6[3] = sal_htonl(ipv6_address[3]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("ipda"); if (0xFF != tmp_argi) { CTC_CLI_GET_IPV6_ADDRESS("ipda", ipv6_address, argv[tmp_argi + 1]); /* adjust endian */ p_nhinfo->ip_da.ipv6[0] = sal_htonl(ipv6_address[0]); p_nhinfo->ip_da.ipv6[1] = sal_htonl(ipv6_address[1]); p_nhinfo->ip_da.ipv6[2] = sal_htonl(ipv6_address[2]); p_nhinfo->ip_da.ipv6[3] = sal_htonl(ipv6_address[3]); } } tmp_argi = CTC_CLI_GET_ARGC_INDEX("l4-src-port"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("l4 src port", p_nhinfo->l4_src_port, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("l4-dest-port"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("l4 dest port", p_nhinfo->l4_dst_port, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("radio-mac"); if (0xFF != tmp_argi) { CTC_CLI_GET_MAC_ADDRESS("radio mac", mac, argv[tmp_argi + 1]); sal_memcpy(p_nhinfo->radio_mac, mac, sizeof(mac_addr_t)); CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_RADIO_MAC_EN); } /*encrypt*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("encrypt"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_ENCRYPT_EN; CTC_CLI_GET_UINT8("encrypt id", p_nhinfo->encrypt_id, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("roam-status"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_POP_POA_ROAM; if (!sal_memcmp(argv[tmp_argi + 1], "pop", sizeof("pop"))) { p_nhinfo->is_pop = 1; } } tmp_argi = CTC_CLI_GET_ARGC_INDEX("multicast-en"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_MC_EN; tmp_argi = CTC_CLI_GET_ARGC_INDEX("bssid-bitmap"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("bssid bitmap", p_nhinfo->bssid_bitmap, argv[tmp_argi + 1]); } } /*split-mac*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("split-mac"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_SPLIT_MAC_EN; tmp_argi = CTC_CLI_GET_ARGC_INDEX("dot11-sub-type"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("dot11 sub type", p_nhinfo->dot11_sub_type, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("map-cos"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_MAP_COS; tmp_argi = CTC_CLI_GET_ARGC_INDEX("cos-domain"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("cos domain", p_nhinfo->cos_domain, argv[tmp_argi + 1]); } } } /*is-route-packet*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("is-route-packet"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_IS_ROUTE_PACKET; tmp_argi = CTC_CLI_GET_ARGC_INDEX("mac-da"); if (0xFF != tmp_argi) { CTC_CLI_GET_MAC_ADDRESS("mac da", mac, argv[tmp_argi + 1]); sal_memcpy(p_nhinfo->mac_da, mac, sizeof(mac_addr_t)); } } /*macda*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("mac-da"); if (0xFF != tmp_argi) { CTC_CLI_GET_MAC_ADDRESS("mac da", mac, argv[tmp_argi + 1]); sal_memcpy(p_nhinfo->mac_da, mac, sizeof(mac_addr_t)); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("vlan-id"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("vlan id", p_nhinfo->vlan_id, argv[tmp_argi + 1]); } /*wds*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("wds"); if (0xFF != tmp_argi) { p_nhinfo->flag |= CTC_NH_WLAN_TUNNEL_FLAG_WDS_EN; tmp_argi = CTC_CLI_GET_ARGC_INDEX("bssid-da"); if (0xFF != tmp_argi) { CTC_CLI_GET_MAC_ADDRESS("bssid mac da", mac, argv[tmp_argi + 1]); sal_memcpy(p_nhinfo->mac_da, mac, sizeof(mac_addr_t)); } } /*DSCP*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("dscp"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("dscp", p_nhinfo->dscp_or_tos, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("dscp-select"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("dscp-select", p_nhinfo->dscp_select, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("ecn-select"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("ecn-select", p_nhinfo->ecn_select, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("dscp-domain"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("dscp-domain", p_nhinfo->dscp_domain, argv[tmp_argi + 1]); } /*TTL*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("ttl"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("ttl", p_nhinfo->ttl, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("map-ttl"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_MAP_TTL); } /*MTU*/ tmp_argi = CTC_CLI_GET_ARGC_INDEX("frag-en"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_FRAGMENT_EN); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("mtu-size"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("mtu-size", p_nhinfo->mtu_size, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("flow-label-mode"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT8("flow label mode", p_nhinfo->flow_label_mode, argv[tmp_argi + 1]); tmp_argi = CTC_CLI_GET_ARGC_INDEX("flow-label-value"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT32("flow label value", p_nhinfo->flow_label, argv[tmp_argi + 1]); } else { p_nhinfo->flow_label = 0; } } else { p_nhinfo->flow_label_mode = CTC_NH_FLOW_LABEL_NONE; } tmp_argi = CTC_CLI_GET_ARGC_INDEX("logic-dest-port"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT16("logic dest port", p_nhinfo->logic_port, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("logic-port-check"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_LOGIC_PORT_CHECK); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("stats-id"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT32("stats id", p_nhinfo->stats_id, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("data-keepalive"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_KEEPALIVE); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("untag"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_UNTAG_EN); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("copy-dont-frag"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_COPY_DONT_FRAG); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("set-dont-frag"); if (0xFF != tmp_argi) { CTC_SET_FLAG(p_nhinfo->flag, CTC_NH_WLAN_TUNNEL_FLAG_DONT_FRAG); } return ret; } CTC_CLI(ctc_cli_add_wlan_tunnel, ctc_cli_add_wlan_tunnel_cmd, "nexthop add wlan-tunnel NHID (dsnh-offset OFFSET|) (unrov |fwd ("CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_STR "))", CTC_CLI_NH_M_STR, CTC_CLI_NH_ADD_STR, "Wlan Tunnel nexthop", CTC_CLI_NH_ID_STR, CTC_CLI_NH_DSNH_OFFSET_STR, CTC_CLI_NH_DSNH_OFFSET_VALUE_STR, "Unresolved nexthop", "Forward Nexthop", CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_DESC) { int32 ret = CLI_SUCCESS; uint32 nhid = 0, dsnh_offset = 0, tmp_argi = 0; ctc_nh_wlan_tunnel_param_t nh_param = {0}; CTC_CLI_GET_UINT32("Nexthop ID", nhid, argv[0]); tmp_argi = CTC_CLI_GET_ARGC_INDEX("dsnh-offset"); if (0xFF != tmp_argi) { CTC_CLI_GET_UINT32("DsNexthop Table offset", dsnh_offset, argv[tmp_argi + 1]); } tmp_argi = CTC_CLI_GET_ARGC_INDEX("unrov"); if (0xFF != tmp_argi) { /*CTC_SET_FLAG(nh_param.flag, CTC_IP_NH_FLAG_UNROV);*/ } tmp_argi = CTC_CLI_GET_ARGC_INDEX("fwd"); if (0xFF != tmp_argi) { if (_ctc_nexthop_cli_parse_wlan_tunnel_nexthop(&(argv[tmp_argi]), (argc - tmp_argi), &nh_param)) { return CLI_ERROR; } } nh_param.dsnh_offset = dsnh_offset; if(g_ctcs_api_en) { ret = ctcs_nh_add_wlan_tunnel(g_api_lchip, nhid, &nh_param); } else { ret = ctc_nh_add_wlan_tunnel(nhid, &nh_param); } if (ret < 0) { ctc_cli_out("%% %s \n", ctc_get_error_desc(ret)); return CLI_ERROR; } return CLI_SUCCESS; } CTC_CLI(ctc_cli_update_wlan_tunnel, ctc_cli_update_wlan_tunnel_cmd, "nexthop update wlan-tunnel NHID ( fwd-attr|unrov2fwd) ("CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_STR ")", CTC_CLI_NH_M_STR, CTC_CLI_NH_UPDATE_STR, "Wlan Tunnel nexthop", CTC_CLI_NH_ID_STR, "Update forward nexthop", "Unresolved nexthop to forward nexthop", CTC_CLI_NH_WLAN_TUNNEL_NH_PARAM_DESC) { int32 ret = CLI_SUCCESS; uint32 nhid; uint8 tmp_argi; ctc_nh_wlan_tunnel_param_t nhinfo; sal_memset(&nhinfo, 0, sizeof(ctc_nh_wlan_tunnel_param_t)); CTC_CLI_GET_UINT32("Nexthop ID", nhid, argv[0]); if (_ctc_nexthop_cli_parse_wlan_tunnel_nexthop(&(argv[1]), (argc - 1), &nhinfo)) { return CLI_ERROR; } tmp_argi = CTC_CLI_GET_ARGC_INDEX("unrov2fwd"); if (0xFF != tmp_argi) { nhinfo.upd_type = CTC_NH_UPD_UNRSV_TO_FWD; if (g_ctcs_api_en) { ret = ctcs_nh_update_wlan_tunnel(g_api_lchip, nhid, &nhinfo); } else { ret = ctc_nh_update_wlan_tunnel(nhid, &nhinfo); } } tmp_argi = CTC_CLI_GET_ARGC_INDEX("fwd-attr"); if (0xFF != tmp_argi) { nhinfo.upd_type = CTC_NH_UPD_FWD_ATTR; if (g_ctcs_api_en) { ret = ctcs_nh_update_wlan_tunnel(g_api_lchip, nhid, &nhinfo); } else { ret = ctc_nh_update_wlan_tunnel(nhid, &nhinfo); } } if (ret < 0) { ctc_cli_out("%% %s \n", ctc_get_error_desc(ret)); return CLI_ERROR; } return ret; } CTC_CLI(ctc_cli_update_wlan_tunnel_to_unrov, ctc_cli_update_wlan_tunnel_to_unrov_cmd, "nexthop update wlan-tunnel NHID fwd2unrov", CTC_CLI_NH_M_STR, CTC_CLI_NH_UPDATE_STR, "Wlan Tunnel nexthop", CTC_CLI_NH_ID_STR, "Forward nexthop to unresolved nexthop") { int32 ret = 0; uint32 nhid; ctc_nh_wlan_tunnel_param_t nhinfo; sal_memset(&nhinfo, 0, sizeof(ctc_nh_wlan_tunnel_param_t)); CTC_CLI_GET_UINT32("NexthopID", nhid, argv[0]); nhinfo.upd_type = CTC_NH_UPD_FWD_TO_UNRSV; if(g_ctcs_api_en) { ret = ctcs_nh_update_wlan_tunnel(g_api_lchip, nhid, &nhinfo); } else { ret = ctc_nh_update_wlan_tunnel(nhid, &nhinfo); } if (ret < 0) { ctc_cli_out("%% %s \n", ctc_get_error_desc(ret)); return CLI_ERROR; } return ret; } CTC_CLI(ctc_cli_remove_wlan_tunnel, ctc_cli_remove_wlan_tunnel_cmd, "nexthop remove wlan-tunnel NHID", CTC_CLI_NH_M_STR, CTC_CLI_NH_DEL_STR, "Wlan Tunnel nexthop", CTC_CLI_NH_ID_STR) { uint32 nhid; int32 ret; CTC_CLI_GET_UINT32("NexthopID", nhid, argv[0]); if(g_ctcs_api_en) { ret = ctcs_nh_remove_wlan_tunnel(g_api_lchip, nhid); } else { ret = ctc_nh_remove_wlan_tunnel(nhid); } if (ret < 0) { ctc_cli_out("%% %s \n", ctc_get_error_desc(ret)); return CLI_ERROR; } return ret; } int32 ctc_usw_nexthop_cli_init(void) { install_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_nexthop_by_nhid_type_cmd); install_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_nexthop_all_by_type_cmd); install_element(CTC_SDK_MODE, &ctc_cli_usw_nh_dump_mpls_tunnel_cmd); install_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_resource_usage_cmd); install_element(CTC_SDK_MODE, &ctc_cli_usw_nh_dump_arp_id_cmd); install_element(CTC_SDK_MODE, &ctc_cli_add_wlan_tunnel_cmd); install_element(CTC_SDK_MODE, &ctc_cli_update_wlan_tunnel_cmd); install_element(CTC_SDK_MODE, &ctc_cli_update_wlan_tunnel_to_unrov_cmd); install_element(CTC_SDK_MODE, &ctc_cli_remove_wlan_tunnel_cmd); /*GB CLIs*/ install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_nh_cfg_global_param_cmd); install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_nh_set_reflective_bridge_cmd); return CLI_SUCCESS; } int32 ctc_usw_nexthop_cli_deinit(void) { uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_nexthop_by_nhid_type_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_nexthop_all_by_type_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_nh_dump_mpls_tunnel_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_nh_show_resource_usage_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_nh_dump_arp_id_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_add_wlan_tunnel_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_update_wlan_tunnel_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_update_wlan_tunnel_to_unrov_cmd); uninstall_element(CTC_SDK_MODE, &ctc_cli_remove_wlan_tunnel_cmd); /*GB CLIs*/ uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_nh_cfg_global_param_cmd); uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_nh_set_reflective_bridge_cmd); return CLI_SUCCESS; }
[ "zhwwan@gmail.com" ]
zhwwan@gmail.com
dcf46ca16c74bc0494c1f9ebdc1319aceeef8ccc
4ea6a61aef7ddd8785d75513a8ea73576f103d1e
/benchmarks/real-verification/bind-8.2.1-src/lib/inet/nsap_addr.c
650254caad3268ea1c3d49abd6cbad8a3784e131
[ "LicenseRef-scancode-unknown-license-reference", "ISC" ]
permissive
probertool/Prober
287190a03b6d6a40ba77295ccef132226f800420
c75047af835ba7ddf60fb3f72f686ea4c56a08b5
refs/heads/master
2020-09-09T07:45:33.005153
2019-11-13T05:39:15
2019-11-13T05:39:15
221,385,993
0
0
null
null
null
null
UTF-8
C
false
false
2,379
c
/* * Copyright (c) 1996-1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAI! * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANT! * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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 TH! * SOFTWARE. */ #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = "$Id: nsap_addr.c,v 8.9 1999/01/08 19:23:49 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <ctype.h> #include <resolv.h> #include "port_after.h" static char xtob(int c) { return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); } u_int inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) { u_char c, nib; u_int len = 0; while ((c = *ascii++) != '\0' && len < (u_int)maxlen) { if (c == '.' || c == '+' || c == '/') continue; if (!isascii(c)) return (0); if (islower(c)) c = toupper(c); if (isxdigit(c)) { nib = xtob(c); c = *ascii++; if (c != '\0') { c = toupper(c); if (isxdigit(c)) { *binary++ = (nib << 4) | xtob(c); len++; } else return (0); } else return (0); } else return (0); } return (len); } char * inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) { int nib; int i; static char tmpbuf[255*3]; char *start; if (ascii) start = ascii; else { ascii = tmpbuf; start = tmpbuf; } if (binlen > 255) binlen = 255; for (i = 0; i < binlen; i++) { nib = *binary >> 4; *ascii++ = nib + (nib < 10 ? '0' : '7'); nib = *binary++ & 0x0f; *ascii++ = nib + (nib < 10 ? '0' : '7'); if (((i % 2) == 0 && (i + 1) < binlen)) *ascii++ = '.'; } *ascii = '\0'; return (start); }
[ "hongyuliu@salsa2.it.utsa.edu" ]
hongyuliu@salsa2.it.utsa.edu
d393dcc997417de301129eb399864f64edaaadb6
6923f79f1eaaba0ab28b25337ba6cb56be97d32d
/Machine_Learning_Mitchell/backprop.c
27474ea97dfc27934d2ef6cbb195b93691ffb7ac
[]
no_license
burakbayramli/books
9fe7ba0cabf06e113eb125d62fe16d4946f4a4f0
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
refs/heads/master
2023-08-17T05:31:08.885134
2023-08-14T10:05:37
2023-08-14T10:05:37
72,460,321
223
174
null
2022-10-24T12:15:06
2016-10-31T17:24:00
Jupyter Notebook
UTF-8
C
false
false
10,163
c
/* ****************************************************************** * HISTORY * 15-Oct-94 Jeff Shufelt (js), Carnegie Mellon University * Prepared for 15-681, Fall 1994. * ****************************************************************** */ #include <stdio.h> #include <backprop.h> #include <math.h> #define ABS(x) (((x) > 0.0) ? (x) : (-(x))) #define fastcopy(to,from,len)\ {\ register char *_to,*_from;\ register int _i,_l;\ _to = (char *)(to);\ _from = (char *)(from);\ _l = (len);\ for (_i = 0; _i < _l; _i++) *_to++ = *_from++;\ } /*** Return random number between 0.0 and 1.0 ***/ double drnd() { return ((double) random() / (double) BIGRND); } /*** Return random number between -1.0 and 1.0 ***/ double dpn1() { return ((drnd() * 2.0) - 1.0); } /*** The squashing function. Currently, it's a sigmoid. ***/ double squash(x) double x; { return (1.0 / (1.0 + exp(-x))); } /*** Allocate 1d array of doubles ***/ double *alloc_1d_dbl(n) int n; { double *new; new = (double *) malloc ((unsigned) (n * sizeof (double))); if (new == NULL) { printf("ALLOC_1D_DBL: Couldn't allocate array of doubles\n"); return (NULL); } return (new); } /*** Allocate 2d array of doubles ***/ double **alloc_2d_dbl(m, n) int m, n; { int i; double **new; new = (double **) malloc ((unsigned) (m * sizeof (double *))); if (new == NULL) { printf("ALLOC_2D_DBL: Couldn't allocate array of dbl ptrs\n"); return (NULL); } for (i = 0; i < m; i++) { new[i] = alloc_1d_dbl(n); } return (new); } bpnn_randomize_weights(w, m, n) double **w; int m, n; { int i, j; for (i = 0; i <= m; i++) { for (j = 0; j <= n; j++) { w[i][j] = dpn1(); } } } bpnn_zero_weights(w, m, n) double **w; int m, n; { int i, j; for (i = 0; i <= m; i++) { for (j = 0; j <= n; j++) { w[i][j] = 0.0; } } } void bpnn_initialize(seed) { printf("Random number generator seed: %d\n", seed); srandom(seed); } BPNN *bpnn_internal_create(n_in, n_hidden, n_out) int n_in, n_hidden, n_out; { BPNN *newnet; newnet = (BPNN *) malloc (sizeof (BPNN)); if (newnet == NULL) { printf("BPNN_CREATE: Couldn't allocate neural network\n"); return (NULL); } newnet->input_n = n_in; newnet->hidden_n = n_hidden; newnet->output_n = n_out; newnet->input_units = alloc_1d_dbl(n_in + 1); newnet->hidden_units = alloc_1d_dbl(n_hidden + 1); newnet->output_units = alloc_1d_dbl(n_out + 1); newnet->hidden_delta = alloc_1d_dbl(n_hidden + 1); newnet->output_delta = alloc_1d_dbl(n_out + 1); newnet->target = alloc_1d_dbl(n_out + 1); newnet->input_weights = alloc_2d_dbl(n_in + 1, n_hidden + 1); newnet->hidden_weights = alloc_2d_dbl(n_hidden + 1, n_out + 1); newnet->input_prev_weights = alloc_2d_dbl(n_in + 1, n_hidden + 1); newnet->hidden_prev_weights = alloc_2d_dbl(n_hidden + 1, n_out + 1); return (newnet); } void bpnn_free(net) BPNN *net; { int n1, n2, i; n1 = net->input_n; n2 = net->hidden_n; free((char *) net->input_units); free((char *) net->hidden_units); free((char *) net->output_units); free((char *) net->hidden_delta); free((char *) net->output_delta); free((char *) net->target); for (i = 0; i <= n1; i++) { free((char *) net->input_weights[i]); free((char *) net->input_prev_weights[i]); } free((char *) net->input_weights); free((char *) net->input_prev_weights); for (i = 0; i <= n2; i++) { free((char *) net->hidden_weights[i]); free((char *) net->hidden_prev_weights[i]); } free((char *) net->hidden_weights); free((char *) net->hidden_prev_weights); free((char *) net); } /*** Creates a new fully-connected network from scratch, with the given numbers of input, hidden, and output units. Threshold units are automatically included. All weights are randomly initialized. Space is also allocated for temporary storage (momentum weights, error computations, etc). ***/ BPNN *bpnn_create(n_in, n_hidden, n_out) int n_in, n_hidden, n_out; { BPNN *newnet; newnet = bpnn_internal_create(n_in, n_hidden, n_out); #ifdef INITZERO bpnn_zero_weights(newnet->input_weights, n_in, n_hidden); #else bpnn_randomize_weights(newnet->input_weights, n_in, n_hidden); #endif bpnn_randomize_weights(newnet->hidden_weights, n_hidden, n_out); bpnn_zero_weights(newnet->input_prev_weights, n_in, n_hidden); bpnn_zero_weights(newnet->hidden_prev_weights, n_hidden, n_out); return (newnet); } void bpnn_layerforward(l1, l2, conn, n1, n2) double *l1, *l2, **conn; int n1, n2; { double sum; int j, k; /*** Set up thresholding unit ***/ l1[0] = 1.0; /*** For each unit in second layer ***/ for (j = 1; j <= n2; j++) { /*** Compute weighted sum of its inputs ***/ sum = 0.0; for (k = 0; k <= n1; k++) { sum += conn[k][j] * l1[k]; } l2[j] = squash(sum); } } void bpnn_output_error(delta, target, output, nj, err) double *delta, *target, *output, *err; int nj; { int j; double o, t, errsum; errsum = 0.0; for (j = 1; j <= nj; j++) { o = output[j]; t = target[j]; delta[j] = o * (1.0 - o) * (t - o); errsum += ABS(delta[j]); } *err = errsum; } void bpnn_hidden_error(delta_h, nh, delta_o, no, who, hidden, err) double *delta_h, *delta_o, *hidden, **who, *err; int nh, no; { int j, k; double h, sum, errsum; errsum = 0.0; for (j = 1; j <= nh; j++) { h = hidden[j]; sum = 0.0; for (k = 1; k <= no; k++) { sum += delta_o[k] * who[j][k]; } delta_h[j] = h * (1.0 - h) * sum; errsum += ABS(delta_h[j]); } *err = errsum; } void bpnn_adjust_weights(delta, ndelta, ly, nly, w, oldw, eta, momentum) double *delta, *ly, **w, **oldw, eta, momentum; { double new_dw; int k, j; ly[0] = 1.0; for (j = 1; j <= ndelta; j++) { for (k = 0; k <= nly; k++) { new_dw = ((eta * delta[j] * ly[k]) + (momentum * oldw[k][j])); w[k][j] += new_dw; oldw[k][j] = new_dw; } } } void bpnn_feedforward(net) BPNN *net; { int in, hid, out; in = net->input_n; hid = net->hidden_n; out = net->output_n; /*** Feed forward input activations. ***/ bpnn_layerforward(net->input_units, net->hidden_units, net->input_weights, in, hid); bpnn_layerforward(net->hidden_units, net->output_units, net->hidden_weights, hid, out); } void bpnn_train(net, eta, momentum, eo, eh) BPNN *net; double eta, momentum, *eo, *eh; { int in, hid, out; double out_err, hid_err; in = net->input_n; hid = net->hidden_n; out = net->output_n; /*** Feed forward input activations. ***/ bpnn_layerforward(net->input_units, net->hidden_units, net->input_weights, in, hid); bpnn_layerforward(net->hidden_units, net->output_units, net->hidden_weights, hid, out); /*** Compute error on output and hidden units. ***/ bpnn_output_error(net->output_delta, net->target, net->output_units, out, &out_err); bpnn_hidden_error(net->hidden_delta, hid, net->output_delta, out, net->hidden_weights, net->hidden_units, &hid_err); *eo = out_err; *eh = hid_err; /*** Adjust input and hidden weights. ***/ bpnn_adjust_weights(net->output_delta, out, net->hidden_units, hid, net->hidden_weights, net->hidden_prev_weights, eta, momentum); bpnn_adjust_weights(net->hidden_delta, hid, net->input_units, in, net->input_weights, net->input_prev_weights, eta, momentum); } void bpnn_save(net, filename) BPNN *net; char *filename; { int fd, n1, n2, n3, i, j, memcnt; double dvalue, **w; char *mem; if ((fd = creat(filename, 0644)) == -1) { printf("BPNN_SAVE: Cannot create '%s'\n", filename); return; } n1 = net->input_n; n2 = net->hidden_n; n3 = net->output_n; printf("Saving %dx%dx%d network to '%s'\n", n1, n2, n3, filename); fflush(stdout); write(fd, (char *) &n1, sizeof(int)); write(fd, (char *) &n2, sizeof(int)); write(fd, (char *) &n3, sizeof(int)); memcnt = 0; w = net->input_weights; mem = (char *) malloc ((unsigned) ((n1+1) * (n2+1) * sizeof(double))); for (i = 0; i <= n1; i++) { for (j = 0; j <= n2; j++) { dvalue = w[i][j]; fastcopy(&mem[memcnt], &dvalue, sizeof(double)); memcnt += sizeof(double); } } write(fd, mem, (n1+1) * (n2+1) * sizeof(double)); free(mem); memcnt = 0; w = net->hidden_weights; mem = (char *) malloc ((unsigned) ((n2+1) * (n3+1) * sizeof(double))); for (i = 0; i <= n2; i++) { for (j = 0; j <= n3; j++) { dvalue = w[i][j]; fastcopy(&mem[memcnt], &dvalue, sizeof(double)); memcnt += sizeof(double); } } write(fd, mem, (n2+1) * (n3+1) * sizeof(double)); free(mem); close(fd); return; } BPNN *bpnn_read(filename) char *filename; { char *mem; BPNN *new; int fd, n1, n2, n3, i, j, memcnt; if ((fd = open(filename, 0, 0644)) == -1) { return (NULL); } printf("Reading '%s'\n", filename); fflush(stdout); read(fd, (char *) &n1, sizeof(int)); read(fd, (char *) &n2, sizeof(int)); read(fd, (char *) &n3, sizeof(int)); new = bpnn_internal_create(n1, n2, n3); printf("'%s' contains a %dx%dx%d network\n", filename, n1, n2, n3); printf("Reading input weights..."); fflush(stdout); memcnt = 0; mem = (char *) malloc ((unsigned) ((n1+1) * (n2+1) * sizeof(double))); read(fd, mem, (n1+1) * (n2+1) * sizeof(double)); for (i = 0; i <= n1; i++) { for (j = 0; j <= n2; j++) { fastcopy(&(new->input_weights[i][j]), &mem[memcnt], sizeof(double)); memcnt += sizeof(double); } } free(mem); printf("Done\nReading hidden weights..."); fflush(stdout); memcnt = 0; mem = (char *) malloc ((unsigned) ((n2+1) * (n3+1) * sizeof(double))); read(fd, mem, (n2+1) * (n3+1) * sizeof(double)); for (i = 0; i <= n2; i++) { for (j = 0; j <= n3; j++) { fastcopy(&(new->hidden_weights[i][j]), &mem[memcnt], sizeof(double)); memcnt += sizeof(double); } } free(mem); close(fd); printf("Done\n"); fflush(stdout); bpnn_zero_weights(new->input_prev_weights, n1, n2); bpnn_zero_weights(new->hidden_prev_weights, n2, n3); return (new); }
[ "bb@b.om" ]
bb@b.om
ef416ca38906f00ec4368ae2d5225eef849c3eaa
29cb7e03fb6f5abe5d1fa540d77776114addfd3f
/lab5/fs/fs.c
9f871a00fada867e7dde61d91bda53ddb8abcbb9
[]
no_license
sujanbolisetti/cse506
b092a11348ff83380f92a8eabcf32921d0028d63
835a52709e221a896d1994155fbfcd70cac787b4
refs/heads/master
2021-01-25T04:52:42.669247
2015-01-02T02:28:00
2015-01-02T02:28:00
28,700,643
0
0
null
null
null
null
UTF-8
C
false
false
5,846
c
#include <inc/string.h> #include "fs.h" // -------------------------------------------------------------- // Super block // -------------------------------------------------------------- // Validate the file system super-block. void check_super(void) { if (super->s_magic != FS_MAGIC) panic("bad file system magic number"); if (super->s_nblocks > DISKSIZE/BLKSIZE) panic("file system is too large"); cprintf("superblock is good\n"); } // -------------------------------------------------------------- // File system structures // -------------------------------------------------------------- // Initialize the file system void fs_init(void) { static_assert(sizeof(struct File) == 256); // Find a JOS disk. Use the second IDE disk (number 1) if available. if (ide_probe_disk1()) ide_set_disk(1); else ide_set_disk(0); bc_init(); // Set "super" to point to the super block. super = diskaddr(1); check_super(); } // Find the disk block number slot for the 'filebno'th block in file 'f'. // Set '*ppdiskbno' to point to that slot. // The slot will be one of the f->f_direct[] entries, // or an entry in the indirect block. // When 'alloc' is set, this function will allocate an indirect block // if necessary. // // Note, for the read-only file system (lab 5 without the challenge), // alloc will always be false. // // Returns: // 0 on success (but note that *ppdiskbno might equal 0). // -E_NOT_FOUND if the function needed to allocate an indirect block, but // alloc was 0. // -E_NO_DISK if there's no space on the disk for an indirect block. // -E_INVAL if filebno is out of range (it's >= NDIRECT + NINDIRECT). // // Analogy: This is like pgdir_walk for files. // Hint: Don't forget to clear any block you allocate. static int file_block_walk(struct File *f, uint32_t filebno, uint32_t **ppdiskbno, bool alloc) { // LAB 5: Your code here. if(filebno >= NDIRECT + NINDIRECT) { return -E_INVAL; } else if(filebno < NDIRECT) { *ppdiskbno= &f->f_direct[filebno]; return 0; } else { uint32_t *va = diskaddr(f->f_indirect); *ppdiskbno = &va[filebno-NDIRECT]; return 0; } return 0; } // Set *blk to the address in memory where the filebno'th // block of file 'f' would be mapped. // // Returns 0 on success, < 0 on error. Errors are: // -E_NO_DISK if a block needed to be allocated but the disk is full. // -E_INVAL if filebno is out of range. // int file_get_block(struct File *f, uint32_t filebno, char **blk) { // LAB 5: Your code here. uint32_t *ppdiskbno; int r; if(filebno >= NDIRECT + NINDIRECT) { return -E_INVAL; } if((r=file_block_walk(f,filebno,&ppdiskbno,false)<0)) { return -E_INVAL; } else { *blk = diskaddr(*ppdiskbno); } return 0; } // Try to find a file named "name" in dir. If so, set *file to it. // // Returns 0 and sets *file on success, < 0 on error. Errors are: // -E_NOT_FOUND if the file is not found static int dir_lookup(struct File *dir, const char *name, struct File **file) { int r; uint32_t i, j, nblock; char *blk; struct File *f; // Search dir for name. // We maintain the invariant that the size of a directory-file // is always a multiple of the file system's block size. assert((dir->f_size % BLKSIZE) == 0); nblock = dir->f_size / BLKSIZE; for (i = 0; i < nblock; i++) { if ((r = file_get_block(dir, i, &blk)) < 0) return r; f = (struct File*) blk; for (j = 0; j < BLKFILES; j++) if (strcmp(f[j].f_name, name) == 0) { *file = &f[j]; return 0; } } return -E_NOT_FOUND; } // Skip over slashes. static const char* skip_slash(const char *p) { while (*p == '/') p++; return p; } // Evaluate a path name, starting at the root. // On success, set *pf to the file we found // and set *pdir to the directory the file is in. // If we cannot find the file but find the directory // it should be in, set *pdir and copy the final path // element into lastelem. static int walk_path(const char *path, struct File **pdir, struct File **pf, char *lastelem) { const char *p; char name[MAXNAMELEN]; struct File *dir, *f; int r; // if (*path != '/') // return -E_BAD_PATH; path = skip_slash(path); f = &super->s_root; dir = 0; name[0] = 0; if (pdir) *pdir = 0; *pf = 0; while (*path != '\0') { dir = f; p = path; while (*path != '/' && *path != '\0') path++; if (path - p >= MAXNAMELEN) return -E_BAD_PATH; memmove(name, p, path - p); name[path - p] = '\0'; path = skip_slash(path); if (dir->f_type != FTYPE_DIR) return -E_NOT_FOUND; if ((r = dir_lookup(dir, name, &f)) < 0) { if (r == -E_NOT_FOUND && *path == '\0') { if (pdir) *pdir = dir; if (lastelem) strcpy(lastelem, name); *pf = 0; } return r; } } if (pdir) *pdir = dir; *pf = f; return 0; } // -------------------------------------------------------------- // File operations // -------------------------------------------------------------- // Open "path". On success set *pf to point at the file and return 0. // On error return < 0. int file_open(const char *path, struct File **pf) { return walk_path(path, 0, pf, 0); } // Read count bytes from f into buf, starting from seek position // offset. This meant to mimic the standard pread function. // Returns the number of bytes read, < 0 on error. ssize_t file_read(struct File *f, void *buf, size_t count, off_t offset) { int r, bn; off_t pos; char *blk; if (offset >= f->f_size) return 0; count = MIN(count, f->f_size - offset); for (pos = offset; pos < offset + count; ) { if ((r = file_get_block(f, pos / BLKSIZE, &blk)) < 0) return r; bn = MIN(BLKSIZE - pos % BLKSIZE, offset + count - pos); memmove(buf, blk + pos % BLKSIZE, bn); pos += bn; buf += bn; } return count; }
[ "sujsachin@gmail.com" ]
sujsachin@gmail.com
643a4df185dbc622a8e9456eb51a304a4b22330e
6315121458c3dfef83e7fa959aa47984efbe977d
/IRCode/IRCode.cydsn/common.h
a00c3c7eafabe214dac68b6361e5071e80a74daa
[]
no_license
jxjjhkls/whyBeautifullThing
e854b0d4af6273588472b2656a779325683f5b43
c29e8724bb0cdf26e4c355645fa6fe7f04816614
refs/heads/master
2020-07-23T15:49:54.980526
2016-09-04T05:33:44
2016-09-04T05:33:44
67,126,144
0
0
null
null
null
null
UTF-8
C
false
false
805
h
/******************************************************************************* * File Name: common.h * * Description: * Common BLE application header. * ******************************************************************************* * Copyright 2015, Cypress Semiconductor Corporation. All rights reserved. * You may use this file only in accordance with the license, terms, conditions, * disclaimers, and limitations in the end user license agreement accompanying * the software package with which this file was provided. *******************************************************************************/ /*************************************** * API Constants ***************************************/ #define LED_ON (0u) #define LED_OFF (1u) /* [] END OF FILE */
[ "zhouping6511388@163.com" ]
zhouping6511388@163.com
160f7ea4329070463f6308f53ec2b5513ccf438d
ef33cc0c5308d250101abc82fc9eae953de26a71
/queue.c
6d3be3017be3009ae653f66842dcd9129a155e0a
[]
no_license
Jttanner/ECEN390
27606744bbfdbadabf33db7ee587a189921cdc4d
fdc9d0383493ca238d137a2383e797660697ff15
refs/heads/master
2021-05-12T17:02:48.452352
2018-03-20T21:15:35
2018-03-20T21:15:35
117,034,937
0
0
null
null
null
null
UTF-8
C
false
false
31,117
c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "queue.h" #include <assert.h> // Allocates the memory to you queue (the data* pointer) and initializes all parts of the data structure. // Prints out an error message if malloc() fails and calls assert(false) to // print-out line-number information and die. // queue_t * newQueue; // queue_init(newQueue, 500, "a name") void queue_init(queue_t* q, queue_size_t size, const char* name){ q->underflowFlag = false; // True if queue_pop() is called on an empty queue. q-> overflowFlag = false; // True if queue_push() is called on a full queue. q->indexIn = 0; q->indexOut = 0; q->elementCount = 0; // Not required but may ease implementation. q->size = size+1; // Add one additional location for the empty location; size is data-array size, exactly. q->data = (queue_data_t *) malloc(q->size * sizeof(queue_data_t)); if (q->data == 0) { printf("Error!!!: queue_init() failed to allocate the required memory in queue_init()!!! (%ld).\n\r", size); printf("Check your heap and stack size and set them both to 2,000,000 bytes (2,000 kB).\n\r"); printf("View Video V11 on the ECEn 330 Youtube channel to see how to set heap and stack size.\n\r"); printf("Copy this link to your browser: https://www.youtube.com/watch?v=onO-XojGFMM&feature=youtu.be\n\r"); assert(false); } strncpy(q->name, name, QUEUE_MAX_NAME_SIZE); #ifdef QUEUE_PRINT_INFO_MESSAGES printf("initialized %s.\n\r", q->name); #endif } // Get the user-assigned name for the queue. const char* queue_name(queue_t* q){ return q->name; //return name of queue } // Returns the number of elements that the queue can hold when completely full. This number will be 1 less than the size of the array that holds the elements. queue_size_t queue_size(queue_t* q){ return q->size - 1; //returns actual size of queue which is -1 because of the one element needed for indexIn } // Returns true if the queue is full. bool queue_full(queue_t* q){ if (q->indexOut == 0 && q->indexIn == queue_size(q) || //when full without indexIn wrapping around q->indexOut == q->indexIn + 1){ //when "full" meaning indexOut is one above indexIn return true; } else{ return false; } } // Returns true if the queue is empty. bool queue_empty(queue_t* q){ if (q->indexIn == q->indexOut){ //if both indexes are equal then empty return true; } else{ return false; } } // If the queue is not full, pushes a new element into the queue and clears the underflowFlag. // IF the queue is full, set the overflowFlag, print an error message and DO NOT change the queue. void queue_push(queue_t* q, queue_data_t value){ if (queue_full(q)){ printf("OVERFLOW: CAN'T PUSH INTO FULL QUEUE\n"); //first check to see if queue full. If is then can't push and print error message q->overflowFlag = true; //sets an overflowFlag for error checking } else{ q->data[q->indexIn] = value; //pushes value into the next indexIn q->underflowFlag = false; //Always resets the underflowFlag if pushes without error if (q->indexIn < q->size - 1){ //If indexIn isn't at the top point to the next highest q->indexIn++; } else{ q->indexIn = 0; //else wrap around to 0 } } } // If the queue is not empty, remove and return the oldest element in the queue. // If the queue is empty, set the underflowFlag, print an error message, and DO NOT change the queue. queue_data_t queue_pop(queue_t* q){ if (queue_empty(q)){ printf("UNDERFLOW: CAN'T POP FROM EMPTY QUEUE\n"); //first check to see if queue empty. If is then can't pop and print error message q->underflowFlag = true; //sets an underflowFlag for error checking } else{ q->overflowFlag = false; //Always resets the overflowFlag if pushes without error queue_index_t index = q->indexOut; //create a variable to hold current index so we can return the correct data if (q->indexOut < q->size - 1){ //if indexOut less than size of array minus one (because index start at 0) then indexOut points to the next element q->indexOut++; } else{ q->indexOut = 0; //else wraps around to 0 } return (q->data[index]); //returns value popped off } } // If the queue is full, call queue_pop() and then call queue_push(). // If the queue is not full, just call queue_push(). void queue_overwritePush(queue_t* q, queue_data_t value){ if (queue_full(q)){ //if queue is full it needs to first pop then push queue_pop(q); //pop } queue_push(q, value); //push } bool queue_indexOutOfBounds(queue_t* q, queue_index_t index){ //helper function used in queue_readElementAt() function if (queue_empty(q)){ //if empty queue can't index stuff return true; }else if (q->indexIn > q->indexOut){ //if indexIn above indexOut if (index > q->indexIn - q->indexOut){ //if index greater than difference of In and Out then out of bounds return true; } else{ return false; } } else{ if (index > q->size - q->indexOut + q->indexIn){ //if index greater than size - Out + In then out of bounds return true; } else{ return false; } } } // Provides random-access read capability to the queue. // Low-valued indexes access older queue elements while higher-value indexes access newer elements // (according to the order that they were added). // Print a meaningful error message if an error condition is detected. queue_data_t queue_readElementAt(queue_t* q, queue_index_t index){ if(queue_indexOutOfBounds(q, index)){ //first check to see if index is out of bounds if so print error and return 0.0 printf("ERROR: INDEX OUT OF BOUNDS\n"); return QUEUE_RETURN_ERROR_VALUE; } if (q->indexIn > q->indexOut){ //normal case when indexIn above indexOut return q->data[index + q->indexOut]; //return data at index plus indexOut in case it's been popped a couple times } else{ if (index < q->size - q->indexOut){ //if index less than size - indexOut return q->data[index + q->indexOut]; //return data at index + indexOut } else{ return q->data[index - (q->size - q->indexOut)]; //return data at index - queue size - indexOut } } } // Returns a count of the elements currently contained in the queue. queue_size_t queue_elementCount(queue_t* q){ if(queue_empty(q)){ //if empty queue return 0 return 0; } else if (q->indexIn > q->indexOut){ //if indexIn greater than indexOut return q->indexIn - q->indexOut; //size equal to in - out } else{ return q->indexIn + (q->size - q->indexOut); //size equal to in + size - out } } // Returns true if an underflow has occurred (queue_pop() called on an empty queue). bool queue_underflow(queue_t* q){ return q->underflowFlag; //returns underflowFlag for error checking } // Returns true if an overflow has occurred (queue_push() called on a full queue). bool queue_overflow(queue_t* q){ return q->overflowFlag; //returns overflowFlag for error checking } // Frees the storage that you malloc'd before. void queue_garbageCollect(queue_t* q){ free(q->data); //frees storage that we allocated } // Prints the current contents of the queue. Handy for debugging. // This must print out the contents of the queue in the order of oldest element first to newest element last. // HINT: Just use queue_readElementAt() in a for-loop. Trivial to implement this way. void queue_print(queue_t* q){ uint32_t i; for(i = 0; i < queue_elementCount(q); ++i){ //steps through the queue and prints everything off printf("ELEMENT AT INDEX %ld: %lf\n\r", i, queue_readElementAt(q, i)); } } /******************************************************** ************* Test Code starts here. ******************** ****** invoke queue_runTest() to run test code. ********* ********************************************************/ // Used to check the status of the queue flags. // Returns true if the all of the queue status matches values of the arguments. // Returns false otherwise. // Prints informational messages if the queue status does not match the provided argument values. static bool queue_printQueueStatus(queue_t* q, bool overflowArg, bool underflowArg, bool fullArg, bool emptyArg) { bool result = true; bool flag; if ((flag=queue_overflow(q)) != overflowArg) { // Check the queue status against the flag. result = flag ? result: false; // Note failure. if (flag) // Print helpful informational messages. printf("* queue_overFlow(%s) returned true. Should have returned false.\n\r", q->name); else printf("* queue_overFlow(%s) returned false. Should have returned true.\n\r", q->name); } if ((flag=queue_underflow(q)) != underflowArg) { // Check the queue status against the flag. result = flag ? result: false; // Note failure. if (flag) // Print helpful informational messages. printf("* queue_underFlow(%s) returned true. Should have returned false.\n\r", q->name); else printf("* queue_underFlow(%s) returned false. Should have returned true.\n\r", q->name); } if ((flag=queue_full(q)) != fullArg) { // Check the queue status against the flag. result = flag ? result: false; // Note failure. if (flag) { // Print helpful informational messages. printf("* queue_full(%s) returned true. Should have returned false.\n\r", q->name); printf("* queue: %s contains %ld elements.\n\r", queue_name(q), queue_elementCount(q)); } else { printf("* queue_full(%s) returned false. Should have returned true.\n\r", q->name); printf("* queue: %s contains %ld elements.\n\r", queue_name(q), queue_elementCount(q)); } } if ((flag=queue_empty(q)) != emptyArg) { // Check the queue status against the flag. result = flag ? result: false; // Note failure. if (flag) { // Print helpful informational messages. printf("* queue_empty(%s) returned true. Should have returned false.\n\r", q->name); } else { printf("* queue_empty(%s) returned false. Should have returned true.\n\r", q->name); printf("* queue: %s contains %ld elements.\n\r", queue_name(q), queue_elementCount(q)); } } return result; } // Assumes testQ is filled with the contents from dataArray. // Repeatedly calls queue_pop until all of the queue contents have been removed. // Uses queue_pop() and queue_readElementAt(). // Reads the entire contents of the queue after each pop. static bool queue_emptyTest(queue_t* testQ, double* dataArray, queue_size_t arraySize) { bool tempResult = true; bool testResult = true; for (int32_t testDataIndex=arraySize-1; testDataIndex>=0; testDataIndex--) { // First, pop an element of the queue and check to see if the pop'd value is correct. double poppedValue = queue_pop(testQ); tempResult = true; if (poppedValue != dataArray[arraySize-(testDataIndex+1)]) { printf("* Error: queue_pop() returned %lf, should have returned %lf.\n\r", poppedValue, dataArray[arraySize-(testDataIndex+1)]); printf("* queue_pop invoked %ld times, testDataIndex: %ld\n\r", arraySize-(testDataIndex+1), testDataIndex); tempResult = false; printf("* queue_pop() failed. Recommend that you fix this problem before proceeding further.\n\r"); return false; } testResult = tempResult ? testResult : false; // Just a logical AND of testResult and tempResult. // Next, read all of the remaining elements in the queue to see if they are correct. // Because you are using queue_pop(), you must offset the indicies for the array, // moving forward after each pop. The indices used with queue_readElementAt() are not offset. tempResult = true; for (int32_t queueIndex=0; queueIndex<testDataIndex; queueIndex++) { double temp; if ((temp=queue_readElementAt(testQ, queueIndex)) != dataArray[arraySize-(testDataIndex)+queueIndex]) { printf("* Error: queue_readElementAt(%ld) read %lf, queue should contain %lf.\n\r", queueIndex, temp, dataArray[arraySize-(testDataIndex)+queueIndex]); printf("* Either queue_pop() or queue_readElementAt() contains a bug.\n\r"); printf("* Repair this bug before proceeding further.\n\r"); tempResult = false; } } testResult = tempResult ? testResult : false; // Just a logical AND of testResult and tempResult. // Pop a value and check to see if correct. } tempResult=queue_printQueueStatus(testQ, false, false, false, true); testResult = tempResult ? testResult : false; // Just a logical AND of testResult and tempResult. return testResult; } // Assumes an initialized queue. Fills the queue with the contents of dataArray using queue_push(). // Each time data is pushed, queue_readElementAt() is invoked to ensure the queue contains the // correct data. This test will pass if queue_push() and queue_readElementAt() work correctly. static bool queue_fillTest(queue_t* testQ, double* dataArray, queue_size_t arraySize) { bool testResult = true; // Keep track of the results of the test. uint32_t testDataIndex = 0; // Just an index. for (testDataIndex=0; testDataIndex<arraySize; testDataIndex++) { // Iterate across the dataArray. queue_push(testQ, dataArray[testDataIndex]); // Push a value onto the queue. double temp; // Keep track of the value ready by queue_readElementAt(). // Read all elements currently in queue and check to see that they match against the data contained in dataArray. if ((temp=queue_readElementAt(testQ, testDataIndex) != dataArray[testDataIndex])) { printf("* Error: queue_readElementAt() failed. push value %lf does not match read value %lf.\n\r", temp, dataArray[testDataIndex]); printf("* Bug is likely in queue_push() or queue_readElementAt().\n\r"); testResult = false; // Failed the test. break; // Stop iterating at this point. } } // Queue should be full at this point with no overflow or underflow, argument order:(overflow, underflow, full, empty). bool tempResult = true; // Keep track of the queue_printQueueStatus() test. if (testResult) { tempResult=queue_printQueueStatus(testQ, false, false, true, false); // See comment above for argument order. } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. return testResult; } // Builds a test queue and applies a series of pushes and pops. // The value returned by queue_pop() is checked for correctness. // queue_elementCount() is also checked frequently to ensure that // it returns the correct value. // To perform the test, a non-circular queue is implemented as // a simple array with a ncqPushIndexPtr and a ncqPopIndexPtr. The // queue code under test should exhibit the same behavior as the non-circular queue. // The non-circular queue is initialized to contain random values. // Values from the non-circular queue are from the ncqPushIndexPtr // and values to be popped from the queue under test are compared // to the ncqPopIndexPtr location. The test terminates upon detecting an // error or if no error has been detected and the entire contents of the // non-circular queue have been pushed into the test Q and then pop'd // from the test queue. #define PUSH_POP_Q_SIZE 100 // The size of the queue. #define NON_CIRC_Q_SIZE 1000 // Size of noncircularQ used to test the testQ. #define MAX_PUSH_POP_COUNT 20 // Maximum number of pushes or pops in one pass. #define PUSH_POP_Q_NAME "pushPopQ" // Name the queue. static bool queue_pushPopTest() { bool testResult = true; bool tempResult = true; // ncq: non-circular queue double* ncq = (double *) malloc(NON_CIRC_Q_SIZE * sizeof(double)); for (uint16_t i=0; i<NON_CIRC_Q_SIZE; i++) { // Fill up the non-circular queue with data. ncq[i] = (double) rand(); } // Emulate a simple non-circular queue for testing purposes. uint16_t ncqPopIndexPtr = 0; // The pop-pointer for the non-circular queue. uint16_t ncqPushIndexPtr = 0; // The push-pointer for the non-circular queue. queue_t testQ; // This is the test Q. queue_init(&testQ, PUSH_POP_Q_SIZE, PUSH_POP_Q_NAME); // Init the test Q. // Test queue_empty(). tempResult = queue_empty(&testQ); if (!tempResult) { printf("* Error: queue_empty(%s) should return true but returned false.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. // Run the loop below until you have used up all of the values in the nonCircularQ. // Each run of the loop will cause some number of pushes and pops to occur. // The loop runs until all values of the nonCircularQ have been pushed, and // all values in the push-pop Q are pop'd. do { // Make sure not to push too much into testQ, or to go beyond the bounds of the nonCircularQ. uint16_t spaceInTestQ = queue_size(&testQ) - queue_elementCount(&testQ); // Size left in testQ. uint16_t ncqUnusedValues = NON_CIRC_Q_SIZE - 1 - ncqPushIndexPtr; // Unused values in noncircularQ. uint16_t pushCount = rand() % MAX_PUSH_POP_COUNT; // Compute a base number of pops. // Potentially reduce push-count to available space in testQ pushCount = pushCount <= spaceInTestQ ? pushCount : spaceInTestQ; // Potentially reduce pushCount to remaining values in noncircularQ. pushCount = pushCount <= ncqUnusedValues ? pushCount : ncqUnusedValues; #ifdef QUEUE_PRINT_INFO_MESSAGES printf("push-count:%d\n\r", pushCount); #endif for (uint16_t i=0; i<pushCount; i++) { queue_push(&testQ, ncq[ncqPushIndexPtr++]); } // Number of elements in the simulated non-circular queue that // are currently stored in the testQ. uint16_t simQElementCount = ncqPushIndexPtr - ncqPopIndexPtr; if (queue_elementCount(&testQ) != simQElementCount) { printf("* Error: queue_elementCount(%s) returned %ld should be %d\n\r.", queue_name(&testQ), queue_elementCount(&testQ), simQElementCount); tempResult = false; break; // This needs to be fixed before proceeding further. } // Don't pop more than you have pushed. uint16_t popCount = rand() % MAX_PUSH_POP_COUNT; // set popCount to be no more that the current simQElementCount (don't overrun the non-circular queue). popCount = simQElementCount >= popCount ? popCount : simQElementCount; #ifdef QUEUE_PRINT_INFO_MESSAGES printf("pop-count:%d\n\r", popCount); #endif // Check each pop'd value for correctness. double temp; for (uint16_t i=0; i<popCount; i++) { // Iterate over the pop'd values. if ((temp=queue_pop(&testQ)) != ncq[ncqPopIndexPtr]) { // Should match the non-circular queue. printf("* Error: queue_pop(%s) returned %lf, should be %lf", queue_name(&testQ), temp, ncq[ncqPopIndexPtr]); tempResult = false; } ncqPopIndexPtr++; } // Keep going until all values contained in the non-circular queue are exhausted. } while((ncqPushIndexPtr != ncqPopIndexPtr) || (ncqPushIndexPtr != NON_CIRC_Q_SIZE-1)); testResult = tempResult ? testResult : false; return testResult; } // Checks to see that underflow and overflow work, and that error messages are printed. #define ERROR_CONDITION_Q_SIZE 10 #define ERROR_CONDITION_Q_NAME "errorQ" bool queue_testErrorConditions() { bool tempResult = true; // Local test results. bool testResult = true; // Overall test results. // A queue for testing. queue_t testQ; queue_init(&testQ, ERROR_CONDITION_Q_SIZE, ERROR_CONDITION_Q_NAME); // See that the empty function works correctly. tempResult = queue_empty(&testQ); if (!tempResult) { printf("* Error: queue_empty(%s) returned false, should be true.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // pop an element from the empty queue and check for underflow. printf("=== + User code should print a queue empty error message-> "); // Check for underflow by popping an empty queue. queue_pop(&testQ); tempResult = queue_underflow(&testQ); if (!tempResult) { printf("* Error: queue_underflow(%s) returned false, should be true.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Fill up the queue with one too many elements. printf("=== + User code should print a queue full error message-> "); for (uint16_t i=0; i<ERROR_CONDITION_Q_SIZE+1; i++) { queue_push(&testQ, 0.0); } // Check for overflow should be true. tempResult = queue_overflow(&testQ); if (!tempResult) { printf("* Error: queue_overflow(%s) returned false, should be true.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // underflow flag should have been cleared with the first push, should return false. tempResult = queue_underflow(&testQ); if (tempResult) { printf("* Error: queue_underflow(%s) returned true, should be false.\n\r", queue_name(&testQ)); } testResult = !tempResult ? testResult : false; // Check to see that the queue is full. tempResult = queue_full(&testQ); if (!tempResult) { printf("* Error: queue_full(%s) returned false, should be true.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Calling queue_pop() should clear the overflow flag. queue_pop(&testQ); tempResult = queue_overflow(&testQ); if (tempResult) { printf("** Error: queue_overflow(%s) returned true, should be false.\n\r", queue_name(&testQ)); } testResult = !tempResult ? testResult : false; // Check to see that the queue is no longer full after one pop. tempResult = queue_full(&testQ); if (tempResult) { printf("* Error: queue_full(%s) returned true, should be false.\n\r", queue_name(&testQ)); } testResult = !tempResult ? testResult : false; // underflow flag should also be false at this point. tempResult = queue_underflow(&testQ); if (tempResult) { printf("* Error: queue_underflow(%s) returned true, should be false.\n\r", queue_name(&testQ)); } testResult = !tempResult ? testResult : false; queue_garbageCollect(&testQ); return testResult; } // Checks to see that queue_overwritePush() works correctly. // Simple test: just overwritePushes one set of values, and then another. // Checks to see that contents are correct afterwards. #define OVERWRITE_PUSH_TEST_QUEUE_SIZE 100 // tested queue will be this big. #define OVERWRITE_PUSH_TEST_QUEUE_NAME "overwriteQ" // tested queue will be this big. bool queue_overwritePushTest() { bool testResult = true; // Keep track of overall test results. // Build a queue for testing. queue_t testQ; queue_init(&testQ, OVERWRITE_PUSH_TEST_QUEUE_SIZE, OVERWRITE_PUSH_TEST_QUEUE_NAME); // Allocate two arrays of test data. double* dataArray1 = (double *) malloc((OVERWRITE_PUSH_TEST_QUEUE_SIZE) * sizeof(double)); for (uint16_t i=0; i<OVERWRITE_PUSH_TEST_QUEUE_SIZE; i++) dataArray1[i] = (double) rand(); double* dataArray2 = (double *) malloc((OVERWRITE_PUSH_TEST_QUEUE_SIZE) * sizeof(double)); for (uint16_t i=0; i<OVERWRITE_PUSH_TEST_QUEUE_SIZE; i++) dataArray2[i] = (double) rand(); // Fill the queue with all data values. for (uint16_t i=0; i<OVERWRITE_PUSH_TEST_QUEUE_SIZE; i++) { queue_overwritePush(&testQ, dataArray1[i]); } for (uint16_t i=0; i<OVERWRITE_PUSH_TEST_QUEUE_SIZE; i++) { queue_overwritePush(&testQ, dataArray2[i]); } // All that should remain are values from dataArray2. for (uint16_t i=0; i<OVERWRITE_PUSH_TEST_QUEUE_SIZE; i++) { if (queue_readElementAt(&testQ, i) != dataArray2[i]) { // Are the correct values returned from the queue? printf("* Error: the values read from the queue: %s are incorrect after queue_overwritePush().\n\r", queue_name(&testQ)); testResult = false; break; } } // Garbage collect all of the allocated memory. queue_garbageCollect(&testQ); free(dataArray1); free(dataArray2); return testResult; } // Returns true if test passed, false otherwise. // This test will build a queue of random size between 10,000 and 20,000 elements, and: // 1. Create a same-sized array to contain random values to store in the queue. // 2. Fill the queue with the random values and from the array and then check for full. // 3. Test to see that queue_readElementAt() works correctly. // 3. Pop each of the values (checking to see that the correct values are pop'd and then check for empty. // 4. Test the queue by interspersing pushes and pops in the same queue. // 5. Refill the array with the previous random values. // 6. Use queue_overwritePush() to write over all of the elements of the array, checking the contents. #define QUEUE_TEST_MAX_QUEUE_SIZE 100 // Used for the fill/empty tests. #define QUEUE_TEST_MAX_LOOP_COUNT 10 // All tests will be invoked this many times. #define QUEUE_TEST_QUEUE_NAME "test_queue" bool queue_runTest() { bool testResult = true; // Be optimistic. // Overall test will be executed QUEUE_TEST_MAX_LOOP_COUNT times. for (uint32_t loopCount = 0; loopCount<QUEUE_TEST_MAX_LOOP_COUNT; loopCount++) { printf("=== Queue Test Iteration %ld ===\n\r", loopCount); // Compute the size of the data set randomly within given bounds. uint32_t arraySize = (rand() % (QUEUE_TEST_MAX_QUEUE_SIZE/2)) + (QUEUE_TEST_MAX_QUEUE_SIZE/2); printf("=== Commencing basic fill test (calling queue_push() until full) of queue of size: %ld. === \n\r", arraySize); // Allocate the array. double* dataArray = (queue_data_t *) malloc(sizeof(queue_data_t) * arraySize); for (uint32_t i=0; i<arraySize; i++) { dataArray[i] = (double) rand(); } queue_t testQ; // queue instance used for testing. queue_init(&testQ, arraySize, QUEUE_TEST_QUEUE_NAME); // Init the queue. testResult = queue_fillTest(&testQ, dataArray, arraySize) ? testResult : false; if (testResult) { printf("=== Queue: %s passed a basic fill test.\n\r", queue_name(&testQ)); } else { printf("=== Queue: %s failed a basic fill test.\n\r", queue_name(&testQ)); } if (queue_elementCount(&testQ) != arraySize) { printf("* Error: queue_elementCount(%s) is %ld, should be %ld\n\r", queue_name(&testQ), queue_elementCount(&testQ), arraySize); printf("* Error: queue_elementCount() likely has a bug.\n\r"); testResult = false; } // Run the queue-empty test. printf("=== Commencing basic empty test (calling queue_pop() until empty) === \n\r"); bool tempResult = queue_emptyTest(&testQ, dataArray, arraySize); if (tempResult) { printf("=== Queue: %s passed a basic empty test.\n\r", queue_name(&testQ)); } else { printf("=== Queue: %s failed a basic empty test.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. tempResult = true; if (queue_elementCount(&testQ) != 0) { printf("* Error: queue_elementCount(%s) is %ld, should be %d\n\r", queue_name(&testQ), queue_elementCount(&testQ), 0); printf("* Error: queue_elementCount() likely has a bug.\n\r"); tempResult = false; } // Run the push/pop test. printf("=== Commencing push/pop test.) === \n\r"); tempResult = queue_pushPopTest(); if (tempResult) { printf("=== Queue: %s passed a push/pop test.\n\r", queue_name(&testQ)); } else { printf("=== Queue: %s failed a push/pop test.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. printf("=== Commencing error-condition test (calling queue_pop() until empty) === \n\r"); tempResult = queue_testErrorConditions(); if (tempResult) { printf("=== Queue: %s passed error-condition test.\n\r", queue_name(&testQ)); } else { printf("=== Queue: %s failed error-condition test.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. printf("=== Commencing overwritePush test (calling queue_pop() until empty) === \n\r"); tempResult = queue_overwritePushTest(); if (tempResult) { printf("=== Queue: %s passed overwritePush test.\n\r", queue_name(&testQ)); } else { printf("=== Queue: %s failed overwritePush test.\n\r", queue_name(&testQ)); } testResult = tempResult ? testResult : false; // Logical AND of testResult and tempResult. if (testResult) { printf("=== All queue tests passed. ===\n\r\n\r"); } else { printf("=== Some queue tests failed. Look at informational messages.\n\r\n\r"); } // All done. Free up all allocated memory. queue_garbageCollect(&testQ); free(dataArray); } return testResult; }
[ "jttanner@LAPTOP-2CGGN413.localdomain" ]
jttanner@LAPTOP-2CGGN413.localdomain
b2e9e8651b4deea40f5fdcc934a5ab36f2883aca
353a990108802fe3157b01512370c8111d342d8e
/fib.h
b7a4071ef0deca74aae8ff472a9f80aff972b1ba
[]
no_license
IsraelBanez/Asgn-6
e46f33f04117bfed56b607e95cc3cd30250a2714
ff5bf6aee6de217c22af8481b2ff3dc7d9236b97
refs/heads/master
2023-02-26T16:01:21.681781
2020-08-10T23:35:51
2020-08-10T23:35:51
335,799,693
0
0
null
null
null
null
UTF-8
C
false
false
161
h
/* * Declares functions for computing Fibonacci numbers. * CSC 225, Assignment 6 * Given code, Winter '20 * NOTE: Do not alter this file. */ int fib(int);
[ "christopher@siu.sh" ]
christopher@siu.sh
ba60366f622e6cf92371a3f5c37e611414a4d864
1480d94691cc591e3d697ead710b86be19550fb7
/createJSON-1/SQLHelper.h
9565c976983f8018b38a78dc96351bbffc6d8625
[]
no_license
birdatdotty/websocketServer
ed5923b3422280773c92f292bbdc25a4345d5720
a48fb8944d562d7d0fc0bb8971e6de3ef77a5af2
refs/heads/master
2021-04-12T11:03:12.837880
2018-03-24T00:54:43
2018-03-24T00:54:43
126,552,758
0
0
null
null
null
null
UTF-8
C
false
false
842
h
#ifndef _SQLHELPER_H_ #define _SQLHELPER_H_ #define _CREATE_TABLE_FILES_ "CREATE TABLE FILES ( "\ "File CHAR(1000) NOT NULL UNIQUE,"\ "ID INTEGER PRIMARY KEY AUTOINCREMENT, "\ "CONSTRAINT name_unique UNIQUE (File) );" #define _CREATE_TABLE_DRIVERS_ "CREATE TABLE DRIVERS ( "\ "id_FIO INTEGER NOT NULL,"\ "id_FILE INTEGER NOT NULL,"\ "unique(id_FIO,id_FILE) );" #define _CREATE_TABLE_PEOPLE_ "CREATE TABLE PEOPLE ( "\ "FIO CHAR(250) NOT NULL,"\ "ID INTEGER PRIMARY KEY AUTOINCREMENT,"\ "CONSTRAINT name_unique UNIQUE (FIO) );" #endif
[ "bird@dotty.su" ]
bird@dotty.su
22771300c4785c30421c372333a8bbf68a656563
dea82f8fac6522ceebf5649f8ca56729229869c5
/PropertimeFit/src/ProjectedPDFs.C
fe10f92bdb72cc5990533eb94015ade431387d8c
[]
no_license
andres0sorio/LHCbWork
010f2cab0bf7808173c070515ac026938d5dcad8
bc83dc0179ec058d2fe6ce16d1a521747982db61
refs/heads/master
2021-01-17T16:09:39.867213
2016-08-12T15:25:51
2016-08-12T15:25:51
65,555,269
0
0
null
null
null
null
UTF-8
C
false
false
17,793
c
// $Id: ProjectedPDFs.C,v 1.6 2007/04/09 11:49:08 aosorio Exp $ // Include files // local #include "ProjectedPDFs.h" //----------------------------------------------------------------------------- // Implementation file for class : ProjectedPDFs // // 2006-12-09 : Andres Osorio //----------------------------------------------------------------------------- /* PDF describing the single observables Mathematica assisted the analytical integration Andres Osorio - 14 Aug 2006 / 19 Nov 2006 */ double properTimeLog( double *x, double *par) { double val = properTimePDF( x, par); return par[18]*val; } double properTimePDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double omega = par[8]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double norm = w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ); return ( 1.0/norm )*( w1*properTimeWpPDF(x,par) + w2*properTimeWmPDF(x,par) ); } double thetaPDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double omega = par[8]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double norm = w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ); return ( 1.0/norm )*( w1*thetaWpPDF(x,par) + w2*thetaWmPDF(x,par) ); } double psiPDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double omega = par[8]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double norm = w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ); return ( 1.0/norm )*( w1*psiWpPDF(x,par) + w2*psiWmPDF(x,par) ); } double phiPDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double omega = par[8]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double norm = w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ); return ( 1.0/norm )*( w1*phiWpPDF(x,par) + w2*phiWmPDF(x,par) ); } double CosthetaTrPDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double omega = par[8]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double tlow = par[16]; double thigh = par[17]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double costr = x[0]; double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double norm = 0.5*( w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ) ); double Wp = (2.0/3.0)*TMath::Pi()*( 3.0 *( A0A0 + ApAp ) + (2.0*(costr*costr)-1.0)*( A0A0 + ApAp ) + 2.0 * AtAt - 2.0 * (2.0*(costr*costr)-1.0)* AtAt ); double Wm = (2.0/3.0)*TMath::Pi()*( 3.0 *( B0B0 + BpBp ) + (2.0 *(costr*costr)-1.0)*( B0B0 + BpBp ) + 2.0 * BtBt - 2.0 *(2.0*(costr*costr)-1.0)* BtBt ); return ( 1.0/norm )*( w1*Wp + w2*Wm ); } double CospsiTrPDF( double *x, double *par) { int q = (int)par[15]; double epsilon[3]; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double omega = par[8]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double tlow = par[16]; double thigh = par[17]; epsilon[0] = omega; epsilon[1] = 0.5; epsilon[2] = (1.0 - omega); double w1 = epsilon[q+1]; double w2 = 1.0-w1; double costr = x[0]; double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double norm = 0.5*( w1*normfactorWpWL( par ) + w2*normfactorWmWL( par ) ); double Wp = (4.0/3.0)*TMath::Pi()*( 2.0*A0A0 + ApAp + 2.0*A0A0*(2.0*(costr*costr)-1.0) - ApAp*(2.0*(costr*costr)-1.0) + AtAt - AtAt*(2.0*(costr*costr)-1.0) ); double Wm = (4.0/3.0)*TMath::Pi()*( 2.0*B0B0 + BpBp + 2.0*B0B0*(2.0*(costr*costr)-1.0) - BpBp*(2.0*(costr*costr)-1.0) + BtBt - BtBt*(2.0*(costr*costr)-1.0) ); return ( 1.0/norm )*( w1*Wp + w2*Wm ); } double properTimeWpPDF(double *x, double *par) { double time = x[0]; if( time < 0 ) return 0.0; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Bs double A0A0 = A1(time, K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ApAp = A2(time, KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double AtAt = A3(time, KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double factor = 22.3402144255274173; //Integral of the pdf w.r.t. three angles ///////////////////////////////////////// //W+ double v1 = A0A0 + ApAp + AtAt; return factor * v1; } double properTimeWmPDF(double *x, double *par) { double time = x[0]; if( time < 0 ) return 0.0; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Bar (Bs) double B0B0 = B1(time, K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BpBp = B2(time, KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BtBt = B3(time, KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double factor = 22.3402144255274173; //Integral of the pdf w.r.t. three angles ///////////////////////////////////////// //W- double v2 = B0B0 + BpBp + BtBt; return factor * v2; } double thetaWpPDF(double *x, double *par) { double theta = x[0]; double fourothreepi = (4.0/3.0)*TMath::Pi(); double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Bs double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); ///////////////////////////////////////// //W+ double v1 = fourothreepi * sin(theta) * ( (ApAp + AtAt)*(3.0+cos(2.0*theta)) + 4.0*A0A0*sin(theta)*sin(theta) ); return v1; } double thetaWmPDF(double *x, double *par) { double theta = x[0]; double fourothreepi = (4.0/3.0)*TMath::Pi(); double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double xs = par[7]; double dms = xs; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Bs double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); ///////////////////////////////////////// //W- double v2 = fourothreepi * sin(theta) * ( (BpBp + BtBt)*(3.0+cos(2.0*theta)) + 4.0 * B0B0*sin(theta)*sin(theta) ); return v2; } double psiWpPDF(double *x, double *par) { double psi = x[0]; double sixteenothreepi = (16.0/3.0)*TMath::Pi(); // (16/3)*pi double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double xs = par[7]; double dms = xs; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Time depency integrated over //Bs double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); //W+ double v1 = sixteenothreepi * sin(psi)* ( 2.0*A0A0*cos(psi)*cos(psi) + (ApAp + AtAt)*sin(psi)*sin(psi)); return v1; } double psiWmPDF(double *x, double *par) { double psi = x[0]; double sixteenothreepi = (16.0/3.0)*TMath::Pi(); // (16/3)*pi double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double xs = par[7]; double dms = xs; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); //Bar (Bs) double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); //W- double v2 = sixteenothreepi * sin(psi)* ( 2.0*B0B0*cos(psi)*cos(psi) + (BpBp + BtBt)*sin(psi)*sin(psi)); return v2; } double phiWpPDF(double *x, double *par) { double phi = x[0]; double factor2 = 0.02083333333; // (1/48) double factor3 = 170.666666666; // 512/3.0; double factor4 = 85.333333333; // 256/3.0; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double KpKt = sqrt(KpKp)*sqrt(KtKt); //Time depency integrated over //Bs double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ImApAt = A5def(KpKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); //W+ double twophi = 2.0*phi; double sin2phi = TMath::Sin(twophi); double cos2phi = TMath::Cos(twophi); double v1 = factor2 * ( factor3 * ( A0A0 + ApAp + AtAt ) - factor4 * cos2phi * ( ApAp - AtAt ) + factor3 * sin2phi * ImApAt ); return v1; } double phiWmPDF(double *x, double *par) { double phi = x[0]; double factor2 = 0.02083333333; // (1/48) double factor3 = 170.666666666; // 512/3.0; double factor4 = 85.333333333; // 256/3.0; double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double KpKt = sqrt(KpKp)*sqrt(KtKt); //Bar (Bs) double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double ImBpBt = B5def(KpKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2); double twophi = 2.0*phi; double sin2phi = TMath::Sin(twophi); double cos2phi = TMath::Cos(twophi); //W- double v2 = factor2 * ( factor3 * ( B0B0 + BpBp + BtBt ) - factor4 * cos2phi * ( BpBp - BtBt ) + factor3 * sin2phi * ImBpBt ); return v2; } double normfactorWpWL(double *par) { double factor = (64.0/9.0)*TMath::Pi(); double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double tlow = par[16]; double thigh = par[17]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double A0A0 = A1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double ApAp = A2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double AtAt = A3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); return factor * (A0A0 + ApAp + AtAt); } double normfactorWmWL(double *par) { double factor = (64.0/9.0)*TMath::Pi(); double Gamma = par[0]; double DGrate = par[1]; double ft = par[2]; double fp = par[3]; double dp1 = par[4]; double dp2 = par[5]; double wphase = par[6]; double dms = par[7]; double tlow = par[16]; double thigh = par[17]; double G_H = GHeavy(Gamma,DGrate); double G_L = GLight(Gamma,DGrate); double tauH = (1.0 / G_H); double tauL = (1.0 / G_L); double tauBar = (1.0 / Gamma); double KtKt = Kt(ft,fp); double KpKp = Kp(ft,fp); double K0K0 = K0(ft,fp); double B0B0 = B1def(K0K0, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BpBp = B2def(KpKp, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); double BtBt = B3def(KtKt, tauL, tauH, tauBar, dms, wphase, dp1, dp2, tlow, thigh); return factor * (B0B0 + BpBp + BtBt); }
[ "osorio.af@gmail.com" ]
osorio.af@gmail.com
c3fd6e04e5554aac52c168e069a599b7bacd8222
79491a15a30a0d873e7b3c40b714070a37d6160b
/Codigos_em_C_1/Q17_c.c
41850048aac45867e3f17e9039a3971de217c616
[]
no_license
ArthurOlive/Codigos-em-C
d57fc0e96bdfc3bef86533cfee6499b5501b8f84
6d81a345a0afac134a5465896842cc490a423f02
refs/heads/master
2020-08-16T21:01:49.714274
2019-10-16T13:22:30
2019-10-16T13:22:30
215,552,713
0
0
null
null
null
null
ISO-8859-1
C
false
false
447
c
#include <stdio.h> #include <stdlib.h> //Questão 17_c int main(){ int a, b; printf("Digite o primeiro numero do intervalo: "); scanf("%d", &a); printf("Digite o segundo numero do intervalo: "); scanf("%d", &b); if (b > a && b != a){ for (; a <= b; a ++){ printf("%d ", a); } } else if (b != a){ for(; a >= b; a --){ printf("%d ", a); } } else { printf("%d", a); } printf("\n"); system("pause"); return 0; }
[ "arthuroliveira909.av@gmail.com" ]
arthuroliveira909.av@gmail.com
1fc19348a83173d2ba368e928d250280bf8129ec
979e60122a70a21110ef891ae62a2b2929af7415
/third_party/machinarium/sources/coroutine_cache.c
d155a3a4e3dbf9f80ac51860643120d0ce15e983
[ "BSD-3-Clause" ]
permissive
efimkin/odyssey
f07679e3b1bc08394c4ccd673986efbf341305e0
1bace0fedbe1636bc26e0c493e4418e73e0d0a8c
refs/heads/master
2020-12-21T16:22:47.680513
2020-02-14T07:15:29
2020-02-14T07:15:29
236,488,735
0
0
BSD-3-Clause
2020-01-27T12:45:38
2020-01-27T12:45:37
null
UTF-8
C
false
false
1,789
c
/* * machinarium. * * cooperative multitasking engine. */ #include <machinarium.h> #include <machinarium_private.h> void mm_coroutine_cache_init(mm_coroutine_cache_t *cache, int stack_size, int stack_size_guard, int limit) { mm_list_init(&cache->list); cache->count_free = 0; cache->count_total = 0; cache->stack_size = stack_size; cache->stack_size_guard = stack_size_guard; cache->limit = limit; } void mm_coroutine_cache_free(mm_coroutine_cache_t *cache) { mm_list_t *i, *n; mm_list_foreach_safe(&cache->list, i, n) { mm_coroutine_t *coroutine; coroutine = mm_container_of(i, mm_coroutine_t, link); mm_coroutine_free(coroutine); } } void mm_coroutine_cache_stat(mm_coroutine_cache_t *cache, uint64_t *count, uint64_t *count_free) { *count = cache->count_total - cache->count_free; *count_free = cache->count_free; } mm_coroutine_t* mm_coroutine_cache_pop(mm_coroutine_cache_t *cache) { mm_coroutine_t *coroutine; if (cache->count_free > 0) { mm_list_t *first = mm_list_pop(&cache->list); cache->count_free--; coroutine = mm_container_of(first, mm_coroutine_t, link); return coroutine; } cache->count_total++; coroutine = mm_coroutine_allocate(cache->stack_size, cache->stack_size_guard); if (coroutine == NULL) cache->count_total--; return coroutine; } void mm_coroutine_cache_push(mm_coroutine_cache_t *cache, mm_coroutine_t *coroutine) { assert(coroutine->state == MM_CFREE); if (cache->count_free >= cache->limit) { cache->count_total--; mm_coroutine_free(coroutine); return; } mm_list_init(&coroutine->link); mm_list_append(&cache->list, &coroutine->link); cache->count_free++; }
[ "pmwkaa@gmail.com" ]
pmwkaa@gmail.com
5aea769ca62fff8d98d4065743db0ee2e9bc6a87
7b55cacf46bf2fd6298315bccfa4b6f0375e3865
/src/sys/compat/linux/arch/amd64/linux_commons.c
0f67b6a3a0fb21055f0c90c611b101feb1e5c1e6
[ "MIT", "LicenseRef-scancode-bsd-3-clause-jtag", "BSD-2-Clause" ]
permissive
libos-nuse/frankenlibc
7f33a86f277ea13eeae573e0339b03c5e2a9ff58
b2e9db0084847aaa63fcddce2f5bf2e0e43669d5
refs/heads/lkl-musl
2021-01-21T23:30:07.179889
2018-06-21T07:46:36
2018-08-14T03:52:22
47,620,000
9
6
NOASSERTION
2019-02-21T14:53:00
2015-12-08T12:13:28
C
UTF-8
C
false
false
1,179
c
/* $NetBSD: linux_commons.c,v 1.11 2011/05/30 17:50:31 alnsn Exp $ */ /* * This file includes C files from the common * area to decrese the number of files to compile * in order to make building a kernel go faster. * * Option headers and headers which depend on * certain options being set need to be included * here. This ensures that a header file sees * the options it needs even if one of included * C files doesn't use it. */ #include <sys/cdefs.h> __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.11 2011/05/30 17:50:31 alnsn Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" #endif #include <sys/param.h> #include <sys/mount.h> #include <sys/signal.h> #include <sys/syscallargs.h> #include <compat/linux/common/linux_signal.h> #include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_ipc.h> #include <compat/linux/common/linux_sem.h> #include <compat/linux/linux_syscallargs.h> #include "../../common/linux_pipe.c" #include "../../common/linux_file64.c" #include "../../common/linux_misc_notalpha.c" #include "../../common/linux_sig_notalpha.c" #include "../../common/linux_futex.c" #include "../../common/linux_fadvise64.c"
[ "justin@specialbusservice.com" ]
justin@specialbusservice.com
104d96c58fff702e13ea8bd73026c9e565ddc41b
021a3ccdcb91d84629f1de7343981b572840b169
/src/mat/examples/tests/ex220.c
642edd8e206c97f553bb2751b841642582521b09
[ "BSD-2-Clause" ]
permissive
firedrakeproject/petsc
dcf7b32e83bdc88d37099904960d7a4c3c4a89e4
7afe75c1a0a66862f32d7a0f5c0c5ae5079c4c77
refs/heads/master
2023-08-31T22:16:45.175956
2019-08-06T14:24:54
2019-08-06T14:24:54
52,269,402
2
8
NOASSERTION
2023-04-11T09:20:08
2016-02-22T11:40:41
C
UTF-8
C
false
false
1,160
c
#include <petscmat.h> static char help[PETSC_MAX_PATH_LEN] = "Tests MatLoad() with MatCreateDense() for memory leak "; int main(int argc, char **argv) { PetscErrorCode ierr; PetscViewer viewer; Mat A; char filename[PETSC_MAX_PATH_LEN]; PetscBool flg; ierr = PetscInitialize(&argc, &argv, (char*)0, help);if (ierr) return ierr; ierr = PetscOptionsGetString(NULL, NULL, "-f", filename, sizeof(filename), &flg);CHKERRQ(ierr); if (!flg) SETERRQ(PETSC_COMM_WORLD, 1, "Must indicate a filename for input with the -f option"); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, filename, FILE_MODE_READ, &viewer);CHKERRQ(ierr); ierr = MatCreateDense(PETSC_COMM_WORLD, PETSC_DECIDE, PETSC_DECIDE, 36, 36, NULL, &A);CHKERRQ(ierr); ierr = MatLoad(A, viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); ierr = PetscFinalize(); return ierr; } /*TEST test: requires: double !complex !define(PETSC_USE_64BIT_INDICES) datafilespath args: -f ${DATAFILESPATH}/matrices/small TEST*/
[ "bsmith@mcs.anl.gov" ]
bsmith@mcs.anl.gov
2664ae35ae5856953958ae1c31f72790e708c145
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/content/public/common/common_param_traits_macros.h
f2eb0d2481e2d6d671b26d5cd14e38a0dff7b13c
[ "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
C
false
false
13,664
h
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Singly or Multiply-included shared traits file depending on circumstances. // This allows the use of IPC serialization macros in more than one IPC message // file. #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ #include "build/build_config.h" #include "content/public/common/console_message_level.h" #include "content/public/common/referrer.h" #include "content/public/common/security_style.h" #include "content/public/common/web_preferences.h" #include "content/public/common/webplugininfo.h" #include "ipc/ipc_message_macros.h" #include "net/base/network_change_notifier.h" #include "net/base/request_priority.h" #include "third_party/WebKit/public/platform/WebPoint.h" #include "third_party/WebKit/public/platform/WebRect.h" #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h" #include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h" #include "third_party/WebKit/public/web/WebWindowFeatures.h" #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_relative_bounds.h" #include "ui/accessibility/ax_tree_update.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" #include "ui/gfx/ipc/geometry/gfx_param_traits.h" #include "ui/gfx/ipc/gfx_param_traits.h" #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" #include "ui/gfx/transform.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT IPC_ENUM_TRAITS_VALIDATE(ui::PageTransition, ((value & ui::PageTransition::PAGE_TRANSITION_CORE_MASK) <= ui::PageTransition::PAGE_TRANSITION_LAST_CORE)) IPC_ENUM_TRAITS_MAX_VALUE(net::NetworkChangeNotifier::ConnectionType, net::NetworkChangeNotifier::CONNECTION_LAST) IPC_ENUM_TRAITS_MAX_VALUE(content::ConsoleMessageLevel, content::CONSOLE_MESSAGE_LEVEL_LAST) IPC_ENUM_TRAITS_MAX_VALUE(content::SecurityStyle, content::SECURITY_STYLE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(blink::WebFrameSerializerCacheControlPolicy, blink::WebFrameSerializerCacheControlPolicy::Last) IPC_ENUM_TRAITS_MAX_VALUE(blink::WebReferrerPolicy, blink::WebReferrerPolicyLast) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PermissionStatus, blink::mojom::PermissionStatus::LAST) IPC_ENUM_TRAITS_MAX_VALUE(content::EditingBehavior, content::EDITING_BEHAVIOR_LAST) IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition, WindowOpenDisposition::MAX_VALUE) IPC_ENUM_TRAITS_MAX_VALUE(net::RequestPriority, net::MAXIMUM_PRIORITY) IPC_ENUM_TRAITS_MAX_VALUE(content::V8CacheOptions, content::V8_CACHE_OPTIONS_LAST) #if defined(OS_ANDROID) IPC_ENUM_TRAITS_MAX_VALUE(content::ProgressBarCompletion, content::ProgressBarCompletion::LAST) #endif IPC_ENUM_TRAITS_MIN_MAX_VALUE(ui::PointerType, ui::POINTER_TYPE_FIRST, ui::POINTER_TYPE_LAST) IPC_ENUM_TRAITS_MIN_MAX_VALUE(ui::HoverType, ui::HOVER_TYPE_FIRST, ui::HOVER_TYPE_LAST) IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::ImageAnimationPolicy, content::IMAGE_ANIMATION_POLICY_ALLOWED, content::IMAGE_ANIMATION_POLICY_NO_ANIMATION) IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::ViewportStyle, content::ViewportStyle::DEFAULT, content::ViewportStyle::LAST) IPC_STRUCT_TRAITS_BEGIN(blink::WebPoint) IPC_STRUCT_TRAITS_MEMBER(x) IPC_STRUCT_TRAITS_MEMBER(y) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(blink::WebRect) IPC_STRUCT_TRAITS_MEMBER(x) IPC_STRUCT_TRAITS_MEMBER(y) IPC_STRUCT_TRAITS_MEMBER(width) IPC_STRUCT_TRAITS_MEMBER(height) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::Referrer) IPC_STRUCT_TRAITS_MEMBER(url) IPC_STRUCT_TRAITS_MEMBER(policy) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::WebPluginMimeType) IPC_STRUCT_TRAITS_MEMBER(mime_type) IPC_STRUCT_TRAITS_MEMBER(file_extensions) IPC_STRUCT_TRAITS_MEMBER(description) IPC_STRUCT_TRAITS_MEMBER(additional_param_names) IPC_STRUCT_TRAITS_MEMBER(additional_param_values) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::WebPluginInfo) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(path) IPC_STRUCT_TRAITS_MEMBER(version) IPC_STRUCT_TRAITS_MEMBER(desc) IPC_STRUCT_TRAITS_MEMBER(mime_types) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(pepper_permissions) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(standard_font_family_map) IPC_STRUCT_TRAITS_MEMBER(fixed_font_family_map) IPC_STRUCT_TRAITS_MEMBER(serif_font_family_map) IPC_STRUCT_TRAITS_MEMBER(sans_serif_font_family_map) IPC_STRUCT_TRAITS_MEMBER(cursive_font_family_map) IPC_STRUCT_TRAITS_MEMBER(fantasy_font_family_map) IPC_STRUCT_TRAITS_MEMBER(default_font_size) IPC_STRUCT_TRAITS_MEMBER(default_fixed_font_size) IPC_STRUCT_TRAITS_MEMBER(minimum_font_size) IPC_STRUCT_TRAITS_MEMBER(minimum_logical_font_size) IPC_STRUCT_TRAITS_MEMBER(default_encoding) IPC_STRUCT_TRAITS_MEMBER(context_menu_on_mouse_up) IPC_STRUCT_TRAITS_MEMBER(javascript_enabled) IPC_STRUCT_TRAITS_MEMBER(web_security_enabled) IPC_STRUCT_TRAITS_MEMBER(javascript_can_open_windows_automatically) IPC_STRUCT_TRAITS_MEMBER(loads_images_automatically) IPC_STRUCT_TRAITS_MEMBER(images_enabled) IPC_STRUCT_TRAITS_MEMBER(plugins_enabled) IPC_STRUCT_TRAITS_MEMBER(dom_paste_enabled) IPC_STRUCT_TRAITS_MEMBER(shrinks_standalone_images_to_fit) IPC_STRUCT_TRAITS_MEMBER(text_areas_are_resizable) IPC_STRUCT_TRAITS_MEMBER(allow_scripts_to_close_windows) IPC_STRUCT_TRAITS_MEMBER(remote_fonts_enabled) IPC_STRUCT_TRAITS_MEMBER(javascript_can_access_clipboard) IPC_STRUCT_TRAITS_MEMBER(xslt_enabled) IPC_STRUCT_TRAITS_MEMBER(xss_auditor_enabled) IPC_STRUCT_TRAITS_MEMBER(dns_prefetching_enabled) IPC_STRUCT_TRAITS_MEMBER(data_saver_enabled) IPC_STRUCT_TRAITS_MEMBER(local_storage_enabled) IPC_STRUCT_TRAITS_MEMBER(databases_enabled) IPC_STRUCT_TRAITS_MEMBER(application_cache_enabled) IPC_STRUCT_TRAITS_MEMBER(tabs_to_links) IPC_STRUCT_TRAITS_MEMBER(history_entry_requires_user_gesture) IPC_STRUCT_TRAITS_MEMBER(hyperlink_auditing_enabled) IPC_STRUCT_TRAITS_MEMBER(allow_universal_access_from_file_urls) IPC_STRUCT_TRAITS_MEMBER(allow_file_access_from_file_urls) IPC_STRUCT_TRAITS_MEMBER(experimental_webgl_enabled) IPC_STRUCT_TRAITS_MEMBER(pepper_3d_enabled) IPC_STRUCT_TRAITS_MEMBER(inert_visual_viewport) IPC_STRUCT_TRAITS_MEMBER(record_whole_document) IPC_STRUCT_TRAITS_MEMBER(pinch_overlay_scrollbar_thickness) IPC_STRUCT_TRAITS_MEMBER(use_solid_color_scrollbars) IPC_STRUCT_TRAITS_MEMBER(flash_3d_enabled) IPC_STRUCT_TRAITS_MEMBER(flash_stage3d_enabled) IPC_STRUCT_TRAITS_MEMBER(flash_stage3d_baseline_enabled) IPC_STRUCT_TRAITS_MEMBER(privileged_webgl_extensions_enabled) IPC_STRUCT_TRAITS_MEMBER(webgl_errors_to_console_enabled) IPC_STRUCT_TRAITS_MEMBER(mock_scrollbars_enabled) IPC_STRUCT_TRAITS_MEMBER(hide_scrollbars) IPC_STRUCT_TRAITS_MEMBER(accelerated_2d_canvas_enabled) IPC_STRUCT_TRAITS_MEMBER(minimum_accelerated_2d_canvas_size) IPC_STRUCT_TRAITS_MEMBER(disable_2d_canvas_copy_on_write) IPC_STRUCT_TRAITS_MEMBER(antialiased_2d_canvas_disabled) IPC_STRUCT_TRAITS_MEMBER(antialiased_clips_2d_canvas_enabled) IPC_STRUCT_TRAITS_MEMBER(accelerated_2d_canvas_msaa_sample_count) IPC_STRUCT_TRAITS_MEMBER(accelerated_filters_enabled) IPC_STRUCT_TRAITS_MEMBER(deferred_filters_enabled) IPC_STRUCT_TRAITS_MEMBER(container_culling_enabled) IPC_STRUCT_TRAITS_MEMBER(allow_running_insecure_content) IPC_STRUCT_TRAITS_MEMBER(disable_reading_from_canvas) IPC_STRUCT_TRAITS_MEMBER(strict_mixed_content_checking) IPC_STRUCT_TRAITS_MEMBER(strict_powerful_feature_restrictions) IPC_STRUCT_TRAITS_MEMBER(allow_geolocation_on_insecure_origins) IPC_STRUCT_TRAITS_MEMBER(strictly_block_blockable_mixed_content) IPC_STRUCT_TRAITS_MEMBER(block_mixed_plugin_content) IPC_STRUCT_TRAITS_MEMBER(enable_scroll_animator) IPC_STRUCT_TRAITS_MEMBER(password_echo_enabled) IPC_STRUCT_TRAITS_MEMBER(should_clear_document_background) IPC_STRUCT_TRAITS_MEMBER(touch_enabled) IPC_STRUCT_TRAITS_MEMBER(device_supports_touch) IPC_STRUCT_TRAITS_MEMBER(device_supports_mouse) IPC_STRUCT_TRAITS_MEMBER(touch_adjustment_enabled) IPC_STRUCT_TRAITS_MEMBER(pointer_events_max_touch_points) IPC_STRUCT_TRAITS_MEMBER(available_pointer_types) IPC_STRUCT_TRAITS_MEMBER(primary_pointer_type) IPC_STRUCT_TRAITS_MEMBER(available_hover_types) IPC_STRUCT_TRAITS_MEMBER(primary_hover_type) IPC_STRUCT_TRAITS_MEMBER(sync_xhr_in_documents_enabled) IPC_STRUCT_TRAITS_MEMBER(color_correct_rendering_enabled) IPC_STRUCT_TRAITS_MEMBER(should_respect_image_orientation) IPC_STRUCT_TRAITS_MEMBER(number_of_cpu_cores) IPC_STRUCT_TRAITS_MEMBER(editing_behavior) IPC_STRUCT_TRAITS_MEMBER(supports_multiple_windows) IPC_STRUCT_TRAITS_MEMBER(viewport_enabled) IPC_STRUCT_TRAITS_MEMBER(viewport_meta_enabled) IPC_STRUCT_TRAITS_MEMBER(shrinks_viewport_contents_to_fit) IPC_STRUCT_TRAITS_MEMBER(viewport_style) IPC_STRUCT_TRAITS_MEMBER(main_frame_resizes_are_orientation_changes) IPC_STRUCT_TRAITS_MEMBER(initialize_at_minimum_page_scale) IPC_STRUCT_TRAITS_MEMBER(smart_insert_delete_enabled) IPC_STRUCT_TRAITS_MEMBER(cookie_enabled) IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop) IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled) IPC_STRUCT_TRAITS_MEMBER(v8_cache_options) IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled) IPC_STRUCT_TRAITS_MEMBER(animation_policy) IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_presentation) IPC_STRUCT_TRAITS_MEMBER(text_track_margin_percentage) #if defined(OS_ANDROID) IPC_STRUCT_TRAITS_MEMBER(text_autosizing_enabled) IPC_STRUCT_TRAITS_MEMBER(font_scale_factor) IPC_STRUCT_TRAITS_MEMBER(device_scale_adjustment) IPC_STRUCT_TRAITS_MEMBER(force_enable_zoom) IPC_STRUCT_TRAITS_MEMBER(fullscreen_supported) IPC_STRUCT_TRAITS_MEMBER(double_tap_to_zoom_enabled) IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_media_playback) IPC_STRUCT_TRAITS_MEMBER(default_video_poster_url) IPC_STRUCT_TRAITS_MEMBER(support_deprecated_target_density_dpi) IPC_STRUCT_TRAITS_MEMBER(use_legacy_background_size_shorthand_behavior) IPC_STRUCT_TRAITS_MEMBER(wide_viewport_quirk) IPC_STRUCT_TRAITS_MEMBER(use_wide_viewport) IPC_STRUCT_TRAITS_MEMBER(force_zero_layout_height) IPC_STRUCT_TRAITS_MEMBER(viewport_meta_layout_size_quirk) IPC_STRUCT_TRAITS_MEMBER(viewport_meta_merge_content_quirk) IPC_STRUCT_TRAITS_MEMBER(viewport_meta_non_user_scalable_quirk) IPC_STRUCT_TRAITS_MEMBER(viewport_meta_zero_values_quirk) IPC_STRUCT_TRAITS_MEMBER(clobber_user_agent_initial_scale_quirk) IPC_STRUCT_TRAITS_MEMBER(ignore_main_frame_overflow_hidden_quirk) IPC_STRUCT_TRAITS_MEMBER(report_screen_size_in_physical_pixels_quirk) IPC_STRUCT_TRAITS_MEMBER(resue_global_for_unowned_main_frame) IPC_STRUCT_TRAITS_MEMBER(autoplay_muted_videos_enabled) IPC_STRUCT_TRAITS_MEMBER(progress_bar_completion) IPC_STRUCT_TRAITS_MEMBER(spellcheck_enabled_by_default) #endif IPC_STRUCT_TRAITS_MEMBER(autoplay_experiment_mode) IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor) IPC_STRUCT_TRAITS_MEMBER(default_maximum_page_scale_factor) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(blink::WebWindowFeatures) IPC_STRUCT_TRAITS_MEMBER(x) IPC_STRUCT_TRAITS_MEMBER(xSet) IPC_STRUCT_TRAITS_MEMBER(y) IPC_STRUCT_TRAITS_MEMBER(ySet) IPC_STRUCT_TRAITS_MEMBER(width) IPC_STRUCT_TRAITS_MEMBER(widthSet) IPC_STRUCT_TRAITS_MEMBER(height) IPC_STRUCT_TRAITS_MEMBER(heightSet) IPC_STRUCT_TRAITS_MEMBER(menuBarVisible) IPC_STRUCT_TRAITS_MEMBER(statusBarVisible) IPC_STRUCT_TRAITS_MEMBER(toolBarVisible) IPC_STRUCT_TRAITS_MEMBER(locationBarVisible) IPC_STRUCT_TRAITS_MEMBER(scrollbarsVisible) IPC_STRUCT_TRAITS_MEMBER(resizable) IPC_STRUCT_TRAITS_MEMBER(fullscreen) IPC_STRUCT_TRAITS_MEMBER(dialog) IPC_STRUCT_TRAITS_END() IPC_ENUM_TRAITS_MAX_VALUE(ui::AXEvent, ui::AX_EVENT_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXRole, ui::AX_ROLE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXBoolAttribute, ui::AX_BOOL_ATTRIBUTE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXFloatAttribute, ui::AX_FLOAT_ATTRIBUTE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXIntAttribute, ui::AX_INT_ATTRIBUTE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXIntListAttribute, ui::AX_INT_LIST_ATTRIBUTE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXStringAttribute, ui::AX_STRING_ATTRIBUTE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXTextAffinity, ui::AX_TEXT_AFFINITY_LAST) IPC_ENUM_TRAITS_MAX_VALUE(ui::AXEventFrom, ui::AX_EVENT_FROM_LAST) IPC_STRUCT_TRAITS_BEGIN(ui::AXRelativeBounds) IPC_STRUCT_TRAITS_MEMBER(offset_container_id) IPC_STRUCT_TRAITS_MEMBER(bounds) IPC_STRUCT_TRAITS_MEMBER(transform) IPC_STRUCT_TRAITS_END() #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
50c64246d23876abca5c67f4dfd406eef6d59ef1
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/weston/src/libweston/backend-drm/state-propose.c
b403e304cd1ed512a2501b44a80dc76780e12567
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LGPL-2.0-or-later", "GPL-1.0-or-later", "BSD-3-Clause" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C
false
false
36,799
c
/* * Copyright © 2008-2011 Kristian Høgsberg * Copyright © 2011 Intel Corporation * Copyright © 2017, 2018 Collabora, Ltd. * Copyright © 2017, 2018 General Electric Company * Copyright (c) 2018 DisplayLink (UK) Ltd. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "config.h" #include <xf86drm.h> #include <xf86drmMode.h> #include <libweston/libweston.h> #include <libweston/backend-drm.h> #include <libweston/pixel-formats.h> #include "drm-internal.h" #include "linux-dmabuf.h" #include "presentation-time-server-protocol.h" enum drm_output_propose_state_mode { DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */ DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY, /**< only assign to renderer & cursor */ DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY, /**< no renderer use, only planes */ }; static const char *const drm_output_propose_state_mode_as_string[] = { [DRM_OUTPUT_PROPOSE_STATE_MIXED] = "mixed state", [DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY] = "render-only state", [DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY] = "plane-only state" }; static const char * drm_propose_state_mode_to_string(enum drm_output_propose_state_mode mode) { if (mode < 0 || mode >= ARRAY_LENGTH(drm_output_propose_state_mode_as_string)) return " unknown compositing mode"; return drm_output_propose_state_mode_as_string[mode]; } static void drm_output_add_zpos_plane(struct drm_plane *plane, struct wl_list *planes) { struct drm_backend *b = plane->backend; struct drm_plane_zpos *h_plane; struct drm_plane_zpos *plane_zpos; plane_zpos = zalloc(sizeof(*plane_zpos)); if (!plane_zpos) return; plane_zpos->plane = plane; drm_debug(b, "\t\t\t\t[plane] plane %d added to candidate list\n", plane->plane_id); if (wl_list_empty(planes)) { wl_list_insert(planes, &plane_zpos->link); return; } h_plane = wl_container_of(planes->next, h_plane, link); if (h_plane->plane->zpos_max >= plane->zpos_max) { wl_list_insert(planes->prev, &plane_zpos->link); } else { struct drm_plane_zpos *p_zpos = NULL; if (wl_list_length(planes) == 1) { wl_list_insert(planes->prev, &plane_zpos->link); return; } wl_list_for_each(p_zpos, planes, link) { if (p_zpos->plane->zpos_max > plane_zpos->plane->zpos_max) break; } wl_list_insert(p_zpos->link.prev, &plane_zpos->link); } } static void drm_output_destroy_zpos_plane(struct drm_plane_zpos *plane_zpos) { wl_list_remove(&plane_zpos->link); free(plane_zpos); } static bool drm_output_check_plane_has_view_assigned(struct drm_plane *plane, struct drm_output_state *output_state) { struct drm_plane_state *ps; wl_list_for_each(ps, &output_state->plane_list, link) { if (ps->plane == plane && ps->fb) return true; } return false; } static bool drm_output_plane_has_valid_format(struct drm_plane *plane, struct drm_output_state *state, struct drm_fb *fb) { struct drm_backend *b = plane->backend; unsigned int i; if (!fb) return false; /* Check whether the format is supported */ for (i = 0; i < plane->count_formats; i++) { unsigned int j; if (plane->formats[i].format != fb->format->format) continue; if (fb->modifier == DRM_FORMAT_MOD_INVALID) return true; for (j = 0; j < plane->formats[i].count_modifiers; j++) { if (plane->formats[i].modifiers[j] == fb->modifier) return true; } } drm_debug(b, "\t\t\t\t[%s] not placing view on %s: " "no free %s planes matching format %s (0x%lx) " "modifier 0x%llx\n", drm_output_get_plane_type_name(plane), drm_output_get_plane_type_name(plane), drm_output_get_plane_type_name(plane), fb->format->drm_format_name, (unsigned long) fb->format, (unsigned long long) fb->modifier); return false; } static bool drm_output_plane_cursor_has_valid_format(struct weston_view *ev) { struct wl_shm_buffer *shmbuf = wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource); if (shmbuf && wl_shm_buffer_get_format(shmbuf) == WL_SHM_FORMAT_ARGB8888) return true; return false; } static struct drm_plane_state * drm_output_prepare_overlay_view(struct drm_plane *plane, struct drm_output_state *output_state, struct weston_view *ev, enum drm_output_propose_state_mode mode, struct drm_fb *fb, uint64_t zpos) { struct drm_output *output = output_state->output; struct weston_compositor *ec = output->base.compositor; struct drm_backend *b = to_drm_backend(ec); struct drm_plane_state *state = NULL; int ret; assert(!b->sprites_are_broken); assert(b->atomic_modeset); if (!fb) { drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay: " " couldn't get fb\n", ev); return NULL; } state = drm_output_state_get_plane(output_state, plane); /* we can't have a 'pending' framebuffer as never set one before reaching here */ assert(!state->fb); state->ev = ev; state->output = output; if (!drm_plane_state_coords_for_view(state, ev, zpos)) { drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay: " "unsuitable transform\n", ev); drm_plane_state_put_back(state); state = NULL; goto out; } /* If the surface buffer has an in-fence fd, but the plane * doesn't support fences, we can't place the buffer on this * plane. */ if (ev->surface->acquire_fence_fd >= 0 && plane->props[WDRM_PLANE_IN_FENCE_FD].prop_id == 0) { drm_debug(b, "\t\t\t\t[overlay] not placing view %p on overlay: " "no in-fence support\n", ev); drm_plane_state_put_back(state); state = NULL; goto out; } /* We hold one reference for the lifetime of this function; from * calling drm_fb_get_from_view() in drm_output_prepare_plane_view(), * so, we take another reference here to live within the state. */ state->fb = drm_fb_ref(fb); state->in_fence_fd = ev->surface->acquire_fence_fd; /* In planes-only mode, we don't have an incremental state to * test against, so we just hope it'll work. */ if (mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) { drm_debug(b, "\t\t\t[overlay] provisionally placing " "view %p on overlay %lu in planes-only mode\n", ev, (unsigned long) plane->plane_id); goto out; } ret = drm_pending_state_test(output_state->pending_state); if (ret == 0) { drm_debug(b, "\t\t\t[overlay] provisionally placing " "view %p on overlay %d in mixed mode\n", ev, plane->plane_id); goto out; } drm_debug(b, "\t\t\t[overlay] not placing view %p on overlay %lu " "in mixed mode: kernel test failed\n", ev, (unsigned long) plane->plane_id); drm_plane_state_put_back(state); state = NULL; out: return state; } #ifdef BUILD_DRM_GBM /** * Update the image for the current cursor surface * * @param plane_state DRM cursor plane state * @param ev Source view for cursor */ static void cursor_bo_update(struct drm_plane_state *plane_state, struct weston_view *ev) { struct drm_backend *b = plane_state->plane->backend; struct gbm_bo *bo = plane_state->fb->bo; struct weston_buffer *buffer = ev->surface->buffer_ref.buffer; uint32_t buf[b->cursor_width * b->cursor_height]; int32_t stride; uint8_t *s; int i; assert(buffer && buffer->shm_buffer); assert(buffer->shm_buffer == wl_shm_buffer_get(buffer->resource)); assert(buffer->width <= b->cursor_width); assert(buffer->height <= b->cursor_height); memset(buf, 0, sizeof buf); stride = wl_shm_buffer_get_stride(buffer->shm_buffer); s = wl_shm_buffer_get_data(buffer->shm_buffer); wl_shm_buffer_begin_access(buffer->shm_buffer); for (i = 0; i < buffer->height; i++) memcpy(buf + i * b->cursor_width, s + i * stride, buffer->width * 4); wl_shm_buffer_end_access(buffer->shm_buffer); if (gbm_bo_write(bo, buf, sizeof buf) < 0) weston_log("failed update cursor: %s\n", strerror(errno)); } static struct drm_plane_state * drm_output_prepare_cursor_view(struct drm_output_state *output_state, struct weston_view *ev, uint64_t zpos) { struct drm_output *output = output_state->output; struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_plane *plane = output->cursor_plane; struct drm_plane_state *plane_state; bool needs_update = false; const char *p_name = drm_output_get_plane_type_name(plane); assert(!b->cursors_are_broken); if (!plane) return NULL; if (!plane->state_cur->complete) return NULL; if (plane->state_cur->output && plane->state_cur->output != output) return NULL; /* We use GBM to import SHM buffers. */ if (b->gbm == NULL) return NULL; plane_state = drm_output_state_get_plane(output_state, output->cursor_plane); if (plane_state && plane_state->fb) return NULL; /* We can't scale with the legacy API, and we don't try to account for * simple cropping/translation in cursor_bo_update. */ plane_state->output = output; if (!drm_plane_state_coords_for_view(plane_state, ev, zpos)) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " "unsuitable transform\n", p_name, ev, p_name); goto err; } if (plane_state->src_x != 0 || plane_state->src_y != 0 || plane_state->src_w > (unsigned) b->cursor_width << 16 || plane_state->src_h > (unsigned) b->cursor_height << 16 || plane_state->src_w != plane_state->dest_w << 16 || plane_state->src_h != plane_state->dest_h << 16) { drm_debug(b, "\t\t\t\t[%s] not assigning view %p to %s plane " "(positioning requires cropping or scaling)\n", p_name, ev, p_name); goto err; } /* Since we're setting plane state up front, we need to work out * whether or not we need to upload a new cursor. We can't use the * plane damage, since the planes haven't actually been calculated * yet: instead try to figure it out directly. KMS cursor planes are * pretty unique here, in that they lie partway between a Weston plane * (direct scanout) and a renderer. */ if (ev != output->cursor_view || pixman_region32_not_empty(&ev->surface->damage)) { output->current_cursor++; output->current_cursor = output->current_cursor % ARRAY_LENGTH(output->gbm_cursor_fb); needs_update = true; } output->cursor_view = ev; plane_state->ev = ev; plane_state->fb = drm_fb_ref(output->gbm_cursor_fb[output->current_cursor]); if (needs_update) { drm_debug(b, "\t\t\t\t[%s] copying new content to cursor BO\n", p_name); cursor_bo_update(plane_state, ev); } /* The cursor API is somewhat special: in cursor_bo_update(), we upload * a buffer which is always cursor_width x cursor_height, even if the * surface we want to promote is actually smaller than this. Manually * mangle the plane state to deal with this. */ plane_state->src_w = b->cursor_width << 16; plane_state->src_h = b->cursor_height << 16; plane_state->dest_w = b->cursor_width; plane_state->dest_h = b->cursor_height; drm_debug(b, "\t\t\t\t[%s] provisionally assigned view %p to cursor\n", p_name, ev); return plane_state; err: drm_plane_state_put_back(plane_state); return NULL; } #else static struct drm_plane_state * drm_output_prepare_cursor_view(struct drm_output_state *output_state, struct weston_view *ev, uint64_t zpos) { return NULL; } #endif static struct drm_plane_state * drm_output_prepare_scanout_view(struct drm_output_state *output_state, struct weston_view *ev, enum drm_output_propose_state_mode mode, struct drm_fb *fb, uint64_t zpos) { struct drm_output *output = output_state->output; struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_plane *scanout_plane = output->scanout_plane; struct drm_plane_state *state; const char *p_name = drm_output_get_plane_type_name(scanout_plane); assert(!b->sprites_are_broken); assert(b->atomic_modeset); assert(mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY); /* Check the view spans exactly the output size, calculated in the * logical co-ordinate space. */ if (!weston_view_matches_output_entirely(ev, &output->base)) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " " view does not match output entirely\n", p_name, ev, p_name); return NULL; } /* If the surface buffer has an in-fence fd, but the plane doesn't * support fences, we can't place the buffer on this plane. */ if (ev->surface->acquire_fence_fd >= 0 && scanout_plane->props[WDRM_PLANE_IN_FENCE_FD].prop_id == 0) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " "no in-fence support\n", p_name, ev, p_name); return NULL; } if (!fb) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " " couldn't get fb\n", p_name, ev, p_name); return NULL; } state = drm_output_state_get_plane(output_state, scanout_plane); /* The only way we can already have a buffer in the scanout plane is * if we are in mixed mode, or if a client buffer has already been * placed into scanout. The former case will never call into here, * and in the latter case, the view must have been marked as occluded, * meaning we should never have ended up here. */ assert(!state->fb); /* take another reference here to live within the state */ state->fb = drm_fb_ref(fb); state->ev = ev; state->output = output; if (!drm_plane_state_coords_for_view(state, ev, zpos)) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " "unsuitable transform\n", p_name, ev, p_name); goto err; } if (state->dest_x != 0 || state->dest_y != 0 || state->dest_w != (unsigned) output->base.current_mode->width || state->dest_h != (unsigned) output->base.current_mode->height) { drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: " " invalid plane state\n", p_name, ev, p_name); goto err; } state->in_fence_fd = ev->surface->acquire_fence_fd; /* In plane-only mode, we don't need to test the state now, as we * will only test it once at the end. */ return state; err: drm_plane_state_put_back(state); return NULL; } static bool drm_output_plane_view_has_valid_format(struct drm_plane *plane, struct drm_output_state *state, struct weston_view *ev, struct drm_fb *fb) { /* depending on the type of the plane we have different requirements */ switch (plane->type) { case WDRM_PLANE_TYPE_CURSOR: return drm_output_plane_cursor_has_valid_format(ev); case WDRM_PLANE_TYPE_OVERLAY: return drm_output_plane_has_valid_format(plane, state, fb); case WDRM_PLANE_TYPE_PRIMARY: return drm_output_plane_has_valid_format(plane, state, fb); default: assert(0); return false; } return false; } static struct drm_plane_state * drm_output_try_view_on_plane(struct drm_plane *plane, struct drm_output_state *state, struct weston_view *ev, enum drm_output_propose_state_mode mode, struct drm_fb *fb, uint64_t zpos) { struct drm_backend *b = state->pending_state->backend; struct weston_output *wet_output = &state->output->base; bool view_matches_entire_output, scanout_has_view_assigned; struct drm_plane *scanout_plane = state->output->scanout_plane; struct drm_plane_state *ps = NULL; const char *p_name = drm_output_get_plane_type_name(plane); enum { NO_PLANES, /* generic err-handle */ NO_PLANES_ACCEPTED, PLACED_ON_PLANE, } availability = NO_PLANES; /* sanity checks in case we over/underflow zpos or pass incorrect * values */ assert(zpos <= plane->zpos_max || zpos != DRM_PLANE_ZPOS_INVALID_PLANE); switch (plane->type) { case WDRM_PLANE_TYPE_CURSOR: if (b->cursors_are_broken) { availability = NO_PLANES_ACCEPTED; goto out; } ps = drm_output_prepare_cursor_view(state, ev, zpos); if (ps) availability = PLACED_ON_PLANE; break; case WDRM_PLANE_TYPE_OVERLAY: /* do not attempt to place it in the overlay if we don't have * anything in the scanout/primary and the view doesn't cover * the entire output */ view_matches_entire_output = weston_view_matches_output_entirely(ev, wet_output); scanout_has_view_assigned = drm_output_check_plane_has_view_assigned(scanout_plane, state); if (view_matches_entire_output && !scanout_has_view_assigned) { availability = NO_PLANES_ACCEPTED; goto out; } ps = drm_output_prepare_overlay_view(plane, state, ev, mode, fb, zpos); if (ps) availability = PLACED_ON_PLANE; break; case WDRM_PLANE_TYPE_PRIMARY: if (mode != DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) { availability = NO_PLANES_ACCEPTED; goto out; } ps = drm_output_prepare_scanout_view(state, ev, mode, fb, zpos); if (ps) availability = PLACED_ON_PLANE; break; default: assert(0); break; } out: switch (availability) { case NO_PLANES: /* set initial to this catch-all case, such that * prepare_cursor/overlay/scanout() should have/contain the * reason for failling */ break; case NO_PLANES_ACCEPTED: drm_debug(b, "\t\t\t\t[plane] plane %d refusing to " "place view %p in %s\n", plane->plane_id, ev, p_name); break; case PLACED_ON_PLANE: break; } return ps; } static void drm_output_check_zpos_plane_states(struct drm_output_state *state) { struct drm_plane_state *ps; wl_list_for_each(ps, &state->plane_list, link) { struct wl_list *next_node = ps->link.next; bool found_dup = false; /* skip any plane that is not enabled */ if (!ps->fb) continue; assert(ps->zpos != DRM_PLANE_ZPOS_INVALID_PLANE); /* find another plane with the same zpos value */ if (next_node == &state->plane_list) break; while (next_node && next_node != &state->plane_list) { struct drm_plane_state *ps_next; ps_next = container_of(next_node, struct drm_plane_state, link); if (ps->zpos == ps_next->zpos) { found_dup = true; break; } next_node = next_node->next; } /* this should never happen so exit hard in case * we screwed up that bad */ assert(!found_dup); } } static struct drm_plane_state * drm_output_prepare_plane_view(struct drm_output_state *state, struct weston_view *ev, enum drm_output_propose_state_mode mode, struct drm_plane_state *scanout_state, uint64_t current_lowest_zpos) { struct drm_output *output = state->output; struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_plane_state *ps = NULL; struct drm_plane *plane; struct drm_plane_zpos *p_zpos, *p_zpos_next; struct wl_list zpos_candidate_list; struct drm_fb *fb; wl_list_init(&zpos_candidate_list); /* check view for valid buffer, doesn't make sense to even try */ if (!weston_view_has_valid_buffer(ev)) return ps; fb = drm_fb_get_from_view(state, ev); /* assemble a list with possible candidates */ wl_list_for_each(plane, &b->plane_list, link) { if (!drm_plane_is_available(plane, output)) continue; if (drm_output_check_plane_has_view_assigned(plane, state)) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d to" " candidate list: view already assigned " "to a plane\n", plane->plane_id); continue; } if (plane->zpos_min >= current_lowest_zpos) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d to " "candidate list: minium zpos (%"PRIu64") " "plane's above current lowest zpos " "(%"PRIu64")\n", plane->plane_id, plane->zpos_min, current_lowest_zpos); continue; } if (mode == DRM_OUTPUT_PROPOSE_STATE_MIXED) { assert(scanout_state != NULL); if (scanout_state->zpos >= plane->zpos_max) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d to " "candidate list: primary's zpos " "value (%"PRIu64") higher than " "plane's maximum value (%"PRIu64")\n", plane->plane_id, scanout_state->zpos, plane->zpos_max); continue; } } if (mode == DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY && (plane->type == WDRM_PLANE_TYPE_OVERLAY || plane->type == WDRM_PLANE_TYPE_PRIMARY)) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d to " "candidate list: renderer-only mode\n", plane->plane_id); continue; } if (plane->type != WDRM_PLANE_TYPE_CURSOR && b->sprites_are_broken) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d, type %s to " "candidate list: sprites are broken!\n", plane->plane_id, drm_output_get_plane_type_name(plane)); continue; } if (!drm_output_plane_view_has_valid_format(plane, state, ev, fb)) { drm_debug(b, "\t\t\t\t[plane] not adding plane %d to " "candidate list: invalid pixel format\n", plane->plane_id); continue; } drm_output_add_zpos_plane(plane, &zpos_candidate_list); } /* go over the potential candidate list and try to find a possible * plane suitable for \c ev; start with the highest zpos value of a * plane to maximize our chances, but do note we pass the zpos value * based on current tracked value by \c current_lowest_zpos_in_use */ while (!wl_list_empty(&zpos_candidate_list)) { struct drm_plane_zpos *head_p_zpos = wl_container_of(zpos_candidate_list.next, head_p_zpos, link); struct drm_plane *plane = head_p_zpos->plane; const char *p_name = drm_output_get_plane_type_name(plane); uint64_t zpos; if (current_lowest_zpos == DRM_PLANE_ZPOS_INVALID_PLANE) zpos = plane->zpos_max; else zpos = MIN(current_lowest_zpos - 1, plane->zpos_max); drm_debug(b, "\t\t\t\t[plane] plane %d picked " "from candidate list, type: %s\n", plane->plane_id, p_name); ps = drm_output_try_view_on_plane(plane, state, ev, mode, fb, zpos); drm_output_destroy_zpos_plane(head_p_zpos); if (ps) { drm_debug(b, "\t\t\t\t[view] view %p has been placed to " "%s plane with computed zpos %"PRIu64"\n", ev, p_name, zpos); break; } } wl_list_for_each_safe(p_zpos, p_zpos_next, &zpos_candidate_list, link) drm_output_destroy_zpos_plane(p_zpos); drm_fb_unref(fb); return ps; } static struct drm_output_state * drm_output_propose_state(struct weston_output *output_base, struct drm_pending_state *pending_state, enum drm_output_propose_state_mode mode) { struct drm_output *output = to_drm_output(output_base); struct drm_backend *b = to_drm_backend(output->base.compositor); struct drm_output_state *state; struct drm_plane_state *scanout_state = NULL; struct weston_view *ev; pixman_region32_t surface_overlap, renderer_region, planes_region; pixman_region32_t occluded_region; bool renderer_ok = (mode != DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY); int ret; uint64_t current_lowest_zpos = DRM_PLANE_ZPOS_INVALID_PLANE; assert(!output->state_last); state = drm_output_state_duplicate(output->state_cur, pending_state, DRM_OUTPUT_STATE_CLEAR_PLANES); /* We implement mixed mode by progressively creating and testing * incremental states, of scanout + overlay + cursor. Since we * walk our views top to bottom, the scanout plane is last, however * we always need it in our scene for the test modeset to be * meaningful. To do this, we steal a reference to the last * renderer framebuffer we have, if we think it's basically * compatible. If we don't have that, then we conservatively fall * back to only using the renderer for this repaint. */ if (mode == DRM_OUTPUT_PROPOSE_STATE_MIXED) { struct drm_plane *plane = output->scanout_plane; struct drm_fb *scanout_fb = plane->state_cur->fb; if (!scanout_fb || (scanout_fb->type != BUFFER_GBM_SURFACE && scanout_fb->type != BUFFER_PIXMAN_DUMB)) { drm_debug(b, "\t\t[state] cannot propose mixed mode: " "for output %s (%lu): no previous renderer " "fb\n", output->base.name, (unsigned long) output->base.id); drm_output_state_free(state); return NULL; } if (scanout_fb->width != output_base->current_mode->width || scanout_fb->height != output_base->current_mode->height) { drm_debug(b, "\t\t[state] cannot propose mixed mode " "for output %s (%lu): previous fb has " "different size\n", output->base.name, (unsigned long) output->base.id); drm_output_state_free(state); return NULL; } scanout_state = drm_plane_state_duplicate(state, plane->state_cur); /* assign the primary primary the lowest zpos value */ scanout_state->zpos = plane->zpos_min; drm_debug(b, "\t\t[state] using renderer FB ID %lu for mixed " "mode for output %s (%lu)\n", (unsigned long) scanout_fb->fb_id, output->base.name, (unsigned long) output->base.id); drm_debug(b, "\t\t[state] scanout will use for zpos %"PRIu64"\n", scanout_state->zpos); } /* - renderer_region contains the total region which which will be * covered by the renderer * - planes_region contains the total region which has been covered by * hardware planes * - occluded_region contains the total region which which will be * covered by the renderer and hardware planes, where the view's * visible-and-opaque region is added in both cases (the view's * opaque region accumulates there for each view); it is being used * to skip the view, if it is completely occluded; includes the * situation where occluded_region covers entire output's region. */ pixman_region32_init(&renderer_region); pixman_region32_init(&planes_region); pixman_region32_init(&occluded_region); wl_list_for_each(ev, &output_base->compositor->view_list, link) { struct drm_plane_state *ps = NULL; bool force_renderer = false; pixman_region32_t clipped_view; bool totally_occluded = false; drm_debug(b, "\t\t\t[view] evaluating view %p for " "output %s (%lu)\n", ev, output->base.name, (unsigned long) output->base.id); /* If this view doesn't touch our output at all, there's no * reason to do anything with it. */ if (!(ev->output_mask & (1u << output->base.id))) { drm_debug(b, "\t\t\t\t[view] ignoring view %p " "(not on our output)\n", ev); continue; } /* Ignore views we know to be totally occluded. */ pixman_region32_init(&clipped_view); pixman_region32_intersect(&clipped_view, &ev->transform.boundingbox, &output->base.region); pixman_region32_init(&surface_overlap); pixman_region32_subtract(&surface_overlap, &clipped_view, &occluded_region); /* if the view is completely occluded then ignore that * view; includes the case where occluded_region covers * the entire output */ totally_occluded = !pixman_region32_not_empty(&surface_overlap); if (totally_occluded) { drm_debug(b, "\t\t\t\t[view] ignoring view %p " "(occluded on our output)\n", ev); pixman_region32_fini(&surface_overlap); pixman_region32_fini(&clipped_view); continue; } /* We only assign planes to views which are exclusively present * on our output. */ if (ev->output_mask != (1u << output->base.id)) { drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane " "(on multiple outputs)\n", ev); force_renderer = true; } if (!weston_view_has_valid_buffer(ev)) { drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane " "(no buffer available)\n", ev); force_renderer = true; } /* Since we process views from top to bottom, we know that if * the view intersects the calculated renderer region, it must * be part of, or occluded by, it, and cannot go on a plane. */ pixman_region32_intersect(&surface_overlap, &renderer_region, &clipped_view); if (pixman_region32_not_empty(&surface_overlap)) { drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane " "(occluded by renderer views)\n", ev); force_renderer = true; } pixman_region32_fini(&surface_overlap); /* In case of enforced mode of content-protection do not * assign planes for a protected surface on an unsecured output. */ if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED && ev->surface->desired_protection > output_base->current_protection) { drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane " "(enforced protection mode on unsecured output)\n", ev); force_renderer = true; } if (!force_renderer) { drm_debug(b, "\t\t\t[plane] started with zpos %"PRIu64"\n", current_lowest_zpos); ps = drm_output_prepare_plane_view(state, ev, mode, scanout_state, current_lowest_zpos); } if (ps) { current_lowest_zpos = ps->zpos; drm_debug(b, "\t\t\t[plane] next zpos to use %"PRIu64"\n", current_lowest_zpos); /* If we have been assigned to an overlay or scanout * plane, add this area to the occluded region, so * other views are known to be behind it. The cursor * plane, however, is special, in that it blends with * the content underneath it: the area should neither * be added to the renderer region nor the occluded * region. */ if (ps->plane->type != WDRM_PLANE_TYPE_CURSOR) { pixman_region32_union(&planes_region, &planes_region, &clipped_view); if (!weston_view_is_opaque(ev, &clipped_view)) pixman_region32_intersect(&clipped_view, &clipped_view, &ev->transform.opaque); /* the visible-and-opaque region of this view * will occlude views underneath it */ pixman_region32_union(&occluded_region, &occluded_region, &clipped_view); pixman_region32_fini(&clipped_view); } continue; } /* We have been assigned to the primary (renderer) plane: * check if this is OK, and add ourselves to the renderer * region if so. */ if (!renderer_ok) { drm_debug(b, "\t\t[view] failing state generation: " "placing view %p to renderer not allowed\n", ev); pixman_region32_fini(&clipped_view); goto err_region; } pixman_region32_union(&renderer_region, &renderer_region, &clipped_view); if (!weston_view_is_opaque(ev, &clipped_view)) pixman_region32_intersect(&clipped_view, &clipped_view, &ev->transform.opaque); pixman_region32_union(&occluded_region, &occluded_region, &clipped_view); pixman_region32_fini(&clipped_view); drm_debug(b, "\t\t\t\t[view] view %p will be placed " "on the renderer\n", ev); } pixman_region32_fini(&renderer_region); pixman_region32_fini(&planes_region); pixman_region32_fini(&occluded_region); /* In renderer-only mode, we can't test the state as we don't have a * renderer buffer yet. */ if (mode == DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY) return state; /* check if we have invalid zpos values, like duplicate(s) */ drm_output_check_zpos_plane_states(state); /* Check to see if this state will actually work. */ ret = drm_pending_state_test(state->pending_state); if (ret != 0) { drm_debug(b, "\t\t[view] failing state generation: " "atomic test not OK\n"); goto err; } /* Counterpart to duplicating scanout state at the top of this * function: if we have taken a renderer framebuffer and placed it in * the pending state in order to incrementally test overlay planes, * remove it now. */ if (mode == DRM_OUTPUT_PROPOSE_STATE_MIXED) { assert(scanout_state->fb->type == BUFFER_GBM_SURFACE || scanout_state->fb->type == BUFFER_PIXMAN_DUMB); drm_plane_state_put_back(scanout_state); } return state; err_region: pixman_region32_fini(&renderer_region); pixman_region32_fini(&occluded_region); err: drm_output_state_free(state); return NULL; } void drm_assign_planes(struct weston_output *output_base, void *repaint_data) { struct drm_backend *b = to_drm_backend(output_base->compositor); struct drm_pending_state *pending_state = repaint_data; struct drm_output *output = to_drm_output(output_base); struct drm_output_state *state = NULL; struct drm_plane_state *plane_state; struct weston_view *ev; struct weston_plane *primary = &output_base->compositor->primary_plane; enum drm_output_propose_state_mode mode = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY; drm_debug(b, "\t[repaint] preparing state for output %s (%lu)\n", output_base->name, (unsigned long) output_base->id); if (!b->sprites_are_broken && !output->virtual) { drm_debug(b, "\t[repaint] trying planes-only build state\n"); state = drm_output_propose_state(output_base, pending_state, mode); if (!state) { drm_debug(b, "\t[repaint] could not build planes-only " "state, trying mixed\n"); mode = DRM_OUTPUT_PROPOSE_STATE_MIXED; state = drm_output_propose_state(output_base, pending_state, mode); } if (!state) { drm_debug(b, "\t[repaint] could not build mixed-mode " "state, trying renderer-only\n"); } } else { drm_debug(b, "\t[state] no overlay plane support\n"); } if (!state) { mode = DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY; state = drm_output_propose_state(output_base, pending_state, mode); } assert(state); drm_debug(b, "\t[repaint] Using %s composition\n", drm_propose_state_mode_to_string(mode)); wl_list_for_each(ev, &output_base->compositor->view_list, link) { struct drm_plane *target_plane = NULL; /* If this view doesn't touch our output at all, there's no * reason to do anything with it. */ if (!(ev->output_mask & (1u << output->base.id))) continue; /* Test whether this buffer can ever go into a plane: * non-shm, or small enough to be a cursor. * * Also, keep a reference when using the pixman renderer. * That makes it possible to do a seamless switch to the GL * renderer and since the pixman renderer keeps a reference * to the buffer anyway, there is no side effects. */ if (b->use_pixman || (weston_view_has_valid_buffer(ev) && (!wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) || (ev->surface->width <= b->cursor_width && ev->surface->height <= b->cursor_height)))) ev->surface->keep_buffer = true; else ev->surface->keep_buffer = false; /* This is a bit unpleasant, but lacking a temporary place to * hang a plane off the view, we have to do a nested walk. * Our first-order iteration has to be planes rather than * views, because otherwise we won't reset views which were * previously on planes to being on the primary plane. */ wl_list_for_each(plane_state, &state->plane_list, link) { if (plane_state->ev == ev) { plane_state->ev = NULL; target_plane = plane_state->plane; break; } } if (target_plane) { drm_debug(b, "\t[repaint] view %p on %s plane %lu\n", ev, plane_type_enums[target_plane->type].name, (unsigned long) target_plane->plane_id); weston_view_move_to_plane(ev, &target_plane->base); } else { drm_debug(b, "\t[repaint] view %p using renderer " "composition\n", ev); weston_view_move_to_plane(ev, primary); } if (!target_plane || target_plane->type == WDRM_PLANE_TYPE_CURSOR) { /* cursor plane & renderer involve a copy */ ev->psf_flags = 0; } else { /* All other planes are a direct scanout of a * single client buffer. */ ev->psf_flags = WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY; } } /* We rely on output->cursor_view being both an accurate reflection of * the cursor plane's state, but also being maintained across repaints * to avoid unnecessary damage uploads, per the comment in * drm_output_prepare_cursor_view. In the event that we go from having * a cursor view to not having a cursor view, we need to clear it. */ if (output->cursor_view) { plane_state = drm_output_state_get_existing_plane(state, output->cursor_plane); if (!plane_state || !plane_state->fb) output->cursor_view = NULL; } }
[ "jengelh@inai.de" ]
jengelh@inai.de
d9039ed1a1ce7802129b9e9de194b3d08fa099b2
c2cedcf36667730f558ab354bea4505b616c90d2
/players/mizan/opl/vehicles/yellow_h2.c
7ffe272acc224fd828eb7aa4548c43a6ebae779f
[]
no_license
wugouzi/Nirvlp312mudlib
965ed876c7080ab00e28c5d8cd5ea9fc9e46258f
616cad7472279cc97c9693f893940f5336916ff8
refs/heads/master
2023-03-16T03:45:05.510851
2017-09-21T17:05:00
2017-09-21T17:05:00
null
0
0
null
null
null
null
UTF-8
C
false
false
2,716
c
inherit "/players/mizan/opl/core/vehicle.c"; #include "/obj/ansi.h" /* * our reset method * */ reset(arg) { string tmp_ldesc; string tmp_long; object bin; tmp_ldesc = " You are inside the massively boxy Hummer H2. Although concieved as\n"; tmp_ldesc += " the more budget version of the original H1, it is more sought after\n"; tmp_ldesc += " than its military-birthed sibling. It's offroading performance is\n"; tmp_ldesc += " also more suspect as well. However none of this matters, as it is\n"; tmp_ldesc += " a big, tough-looking vehicle that people will march in horedes to buy.\n"; tmp_long = " This is the monstrosity known as the Hummer H2. Surrounded by 6400 lbs.\n\n"; tmp_long += " of truck, you can't help but feel safe and secure. But are you? None of that\n"; tmp_long += " is particularly relevant, since you are inside the vehicle which has caused\n"; tmp_long += " more buzz and publicity for any Detroit-generated vehicle for some time.\n"; ::reset(arg); if(arg) return; set_name("Hummer H2"); set_race("hummer"); set_alias("h2"); set_short(BLK + HBYEL + "A bright yellow Hummer H2 SUV" + NORM + NORM); set_long(tmp_long); set_level(10); set_hp(1000); set_al(0); set_wc(3); set_ac(30); set_aggressive(0); set_hatch_id("door"); set_maximum_fuel(100); set_maximum_occupants(8); set_key_id("h2hummer_key"); set_engine_key_id("h2hummer_ignition_key"); set_fuel(85); set_fuel_id("gasoline_fuel"); set_inside_short_desc("Inside the Hummer H2"); set_inside_long_desc(tmp_ldesc); set_exit_mess("leaves with a deafening roar"); set_enter_mess("arrives, it's sheer bulk terrifying you"); set_engine_startup_message("The Hummer H2's engine kicks to life with a deafening roar!\n"); set_engine_stop_message("The Hummer H2's engine shuts off.\nSilence can be enjoyed again.\n"); set_fuel_idle_consumption(20); set_fuel_overflow_mess("The tank is full, and some extra gasoline gushes out.\n"); enable_horn(); set_horn_verb("honk"); set_horn_mess("The Hummer H2's horn goes off... HOOOOONK! HOOOOONK!\n"); enable_headlights(); set_maximum_battery(50); set_battery_id("battery"); set_headlight_consumption(40); /* an array of just idle messages */ arr_idle_chat_mess = ({ "You boggle at the sheer mass and wastefulness of the Hummer H2.", }); /* an array of engine noise messages */ arr_engine_chat_mess = ({ "The Hummer H2's engine rumbles noisily.", }); set_idle_chat_chance(1); set_engine_chat_chance(2); } /* end function reset(); */
[ "rump.nirv@gmail.com" ]
rump.nirv@gmail.com
28437528f9b61d0e6c0c7b9b47558304214e5f2d
70defb2b1c4879ee58b523b23b1e9b992a5ce3e2
/src/workspace/FreeRTOS-Demo/src/Common/Minimal/comtest.c
2b42e924affea61f073e625e71dab6d7e8788b82
[]
no_license
jefchavesfer/H3DGE
7e3284d3353b5d95baa4afd1f45e943ae0f80d99
1f97880798e9f7c6c1a2a0c5419b3c286f14bc2d
refs/heads/master
2021-01-01T18:41:39.986334
2012-01-10T01:51:38
2012-01-10T01:51:38
3,139,988
0
0
null
null
null
null
UTF-8
C
false
false
11,476
c
/* FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * * FreeRTOS tutorial books are available in pdf and paperback. * * Complete, revised, and edited pdf reference manuals are also * * available. * * * * Purchasing FreeRTOS documentation will not only help you, by * * ensuring you get running as quickly as possible and with an * * in-depth knowledge of how to use FreeRTOS, it will also help * * the FreeRTOS project to continue with its mission of providing * * professional grade, cross platform, de facto standard solutions * * for microcontrollers - completely free of charge! * * * * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * * * * Thank you for using FreeRTOS, and thank you for your support! * * * *************************************************************************** This file is part of the FreeRTOS distribution. FreeRTOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (version 2) as published by the Free Software Foundation AND MODIFIED BY the FreeRTOS exception. >>>NOTE<<< The modification to the GPL is included to allow you to distribute a combined work that includes FreeRTOS without being obliged to provide the source code for proprietary components outside of the FreeRTOS kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. 1 tab == 4 spaces! http://www.FreeRTOS.org - Documentation, latest information, license and contact details. http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ /* * This version of comtest. c is for use on systems that have limited stack * space and no display facilities. The complete version can be found in * the Demo/Common/Full directory. * * Creates two tasks that operate on an interrupt driven serial port. A * loopback connector should be used so that everything that is transmitted is * also received. The serial port does not use any flow control. On a * standard 9way 'D' connector pins two and three should be connected together. * * The first task posts a sequence of characters to the Tx queue, toggling an * LED on each successful post. At the end of the sequence it sleeps for a * pseudo-random period before resending the same sequence. * * The UART Tx end interrupt is enabled whenever data is available in the Tx * queue. The Tx end ISR removes a single character from the Tx queue and * passes it to the UART for transmission. * * The second task blocks on the Rx queue waiting for a character to become * available. When the UART Rx end interrupt receives a character it places * it in the Rx queue, waking the second task. The second task checks that the * characters removed from the Rx queue form the same sequence as those posted * to the Tx queue, and toggles an LED for each correct character. * * The receiving task is spawned with a higher priority than the transmitting * task. The receiver will therefore wake every time a character is * transmitted so neither the Tx or Rx queue should ever hold more than a few * characters. * */ /* Scheduler include files. */ #include <stdlib.h> #include "FreeRTOS.h" #include "task.h" /* Demo program include files. */ #include "serial.h" #include "comtest.h" #include "partest.h" #define comSTACK_SIZE configMINIMAL_STACK_SIZE #define comTX_LED_OFFSET ( 0 ) #define comRX_LED_OFFSET ( 1 ) #define comTOTAL_PERMISSIBLE_ERRORS ( 2 ) /* The Tx task will transmit the sequence of characters at a pseudo random interval. This is the maximum and minimum block time between sends. */ #define comTX_MAX_BLOCK_TIME ( ( portTickType ) 0x96 ) #define comTX_MIN_BLOCK_TIME ( ( portTickType ) 0x32 ) #define comOFFSET_TIME ( ( portTickType ) 3 ) /* We should find that each character can be queued for Tx immediately and we don't have to block to send. */ #define comNO_BLOCK ( ( portTickType ) 0 ) /* The Rx task will block on the Rx queue for a long period. */ #define comRX_BLOCK_TIME ( ( portTickType ) 0xffff ) /* The sequence transmitted is from comFIRST_BYTE to and including comLAST_BYTE. */ #define comFIRST_BYTE ( 'A' ) #define comLAST_BYTE ( 'X' ) #define comBUFFER_LEN ( ( unsigned portBASE_TYPE ) ( comLAST_BYTE - comFIRST_BYTE ) + ( unsigned portBASE_TYPE ) 1 ) #define comINITIAL_RX_COUNT_VALUE ( 0 ) /* Handle to the com port used by both tasks. */ static xComPortHandle xPort = NULL; /* The transmit task as described at the top of the file. */ static portTASK_FUNCTION_PROTO( vComTxTask, pvParameters ); /* The receive task as described at the top of the file. */ static portTASK_FUNCTION_PROTO( vComRxTask, pvParameters ); /* The LED that should be toggled by the Rx and Tx tasks. The Rx task will toggle LED ( uxBaseLED + comRX_LED_OFFSET). The Tx task will toggle LED ( uxBaseLED + comTX_LED_OFFSET ). */ static unsigned portBASE_TYPE uxBaseLED = 0; /* Check variable used to ensure no error have occurred. The Rx task will increment this variable after every successfully received sequence. If at any time the sequence is incorrect the the variable will stop being incremented. */ static volatile unsigned portBASE_TYPE uxRxLoops = comINITIAL_RX_COUNT_VALUE; /*-----------------------------------------------------------*/ void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED ) { /* Initialise the com port then spawn the Rx and Tx tasks. */ uxBaseLED = uxLED; xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN ); /* The Tx task is spawned with a lower priority than the Rx task. */ xTaskCreate( vComTxTask, ( signed char * ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL ); xTaskCreate( vComRxTask, ( signed char * ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL ); } /*-----------------------------------------------------------*/ static portTASK_FUNCTION( vComTxTask, pvParameters ) { signed char cByteToSend; portTickType xTimeToWait; /* Just to stop compiler warnings. */ ( void ) pvParameters; for( ;; ) { /* Simply transmit a sequence of characters from comFIRST_BYTE to comLAST_BYTE. */ for( cByteToSend = comFIRST_BYTE; cByteToSend <= comLAST_BYTE; cByteToSend++ ) { if( xSerialPutChar( xPort, cByteToSend, comNO_BLOCK ) == pdPASS ) { vParTestToggleLED( uxBaseLED + comTX_LED_OFFSET ); } } /* Turn the LED off while we are not doing anything. */ vParTestSetLED( uxBaseLED + comTX_LED_OFFSET, pdFALSE ); /* We have posted all the characters in the string - wait before re-sending. Wait a pseudo-random time as this will provide a better test. */ xTimeToWait = xTaskGetTickCount() + comOFFSET_TIME; /* Make sure we don't wait too long... */ xTimeToWait %= comTX_MAX_BLOCK_TIME; /* ...but we do want to wait. */ if( xTimeToWait < comTX_MIN_BLOCK_TIME ) { xTimeToWait = comTX_MIN_BLOCK_TIME; } vTaskDelay( xTimeToWait ); } } /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */ /*-----------------------------------------------------------*/ static portTASK_FUNCTION( vComRxTask, pvParameters ) { signed char cExpectedByte, cByteRxed; portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; for( ;; ) { /* We expect to receive the characters from comFIRST_BYTE to comLAST_BYTE in an incrementing order. Loop to receive each byte. */ for( cExpectedByte = comFIRST_BYTE; cExpectedByte <= comLAST_BYTE; cExpectedByte++ ) { /* Block on the queue that contains received bytes until a byte is available. */ if( xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ) ) { /* Was this the byte we were expecting? If so, toggle the LED, otherwise we are out on sync and should break out of the loop until the expected character sequence is about to restart. */ if( cByteRxed == cExpectedByte ) { vParTestToggleLED( uxBaseLED + comRX_LED_OFFSET ); } else { xResyncRequired = pdTRUE; break; /*lint !e960 Non-switch break allowed. */ } } } /* Turn the LED off while we are not doing anything. */ vParTestSetLED( uxBaseLED + comRX_LED_OFFSET, pdFALSE ); /* Did we break out of the loop because the characters were received in an unexpected order? If so wait here until the character sequence is about to restart. */ if( xResyncRequired == pdTRUE ) { while( cByteRxed != comLAST_BYTE ) { /* Block until the next char is available. */ xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ); } /* Note that an error occurred which caused us to have to resync. We use this to stop incrementing the loop counter so sAreComTestTasksStillRunning() will return false - indicating an error. */ xErrorOccurred++; /* We have now resynced with the Tx task and can continue. */ xResyncRequired = pdFALSE; } else { if( xErrorOccurred < comTOTAL_PERMISSIBLE_ERRORS ) { /* Increment the count of successful loops. As error occurring (i.e. an unexpected character being received) will prevent this counter being incremented for the rest of the execution. Don't worry about mutual exclusion on this variable - it doesn't really matter as we just want it to change. */ uxRxLoops++; } } } } /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */ /*-----------------------------------------------------------*/ portBASE_TYPE xAreComTestTasksStillRunning( void ) { portBASE_TYPE xReturn; /* If the count of successful reception loops has not changed than at some time an error occurred (i.e. a character was received out of sequence) and we will return false. */ if( uxRxLoops == comINITIAL_RX_COUNT_VALUE ) { xReturn = pdFALSE; } else { xReturn = pdTRUE; } /* Reset the count of successful Rx loops. When this function is called again we expect this to have been incremented. */ uxRxLoops = comINITIAL_RX_COUNT_VALUE; return xReturn; }
[ "lord.jchaves@gmail.com" ]
lord.jchaves@gmail.com
af233fc43d9d643aeab695248ae777960e6f652a
a8fa2036df8e2c99d836bd909e1567cddcabf6ea
/include/glad/glad.h
044beebc64501c64d79e017d4be1ebf1d881a74e
[]
no_license
tommasie/Chip8
37fb7060e02ad1bb970df43e1bea9a6ef2b4b55b
0f98883358355cc12647661562e2bb4d200be222
refs/heads/master
2020-03-18T07:12:41.191973
2018-05-22T14:57:07
2018-05-22T14:57:07
134,439,068
0
0
null
null
null
null
UTF-8
C
false
false
110,489
h
/* OpenGL loader generated by glad 0.1.20a0 on Sun May 20 12:57:00 2018. Language/Generator: C/C++ Specification: gl APIs: gl=3.3 Profile: core Extensions: Loader: True Local files: False Omit khrplatform: False Commandline: --profile="core" --api="gl=3.3" --generator="c" --spec="gl" --extensions="" Online: http://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3 */ #ifndef __glad_h_ #define __glad_h_ #ifdef __gl_h_ #error OpenGL header already included, remove this include, glad already provides it #endif #define __gl_h_ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #ifndef NOMINMAX #define NOMINMAX 1 #endif #include <windows.h> #endif #ifndef APIENTRY #define APIENTRY #endif #ifndef APIENTRYP #define APIENTRYP APIENTRY * #endif #ifdef __cplusplus extern "C" { #endif struct gladGLversionStruct { int major; int minor; }; typedef void* (* GLADloadproc)(const char *name); #ifndef GLAPI # if defined(GLAD_GLAPI_EXPORT) # if defined(_WIN32) || defined(__CYGWIN__) # if defined(GLAD_GLAPI_EXPORT_BUILD) # if defined(__GNUC__) # define GLAPI __attribute__ ((dllexport)) extern # else # define GLAPI __declspec(dllexport) extern # endif # else # if defined(__GNUC__) # define GLAPI __attribute__ ((dllimport)) extern # else # define GLAPI __declspec(dllimport) extern # endif # endif # elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) # define GLAPI __attribute__ ((visibility ("default"))) extern # else # define GLAPI extern # endif # else # define GLAPI extern # endif #endif GLAPI struct gladGLversionStruct GLVersion; GLAPI int gladLoadGL(void); GLAPI int gladLoadGLLoader(GLADloadproc); #include <stddef.h> #include <KHR/khrplatform.h> #ifndef GLEXT_64_TYPES_DEFINED /* This code block is duplicated in glxext.h, so must be protected */ #define GLEXT_64_TYPES_DEFINED /* Define int32_t, int64_t, and uint64_t types for UST/MSC */ /* (as used in the GL_EXT_timer_query extension). */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #include <inttypes.h> #elif defined(__sun__) || defined(__digital__) #include <inttypes.h> #if defined(__STDC__) #if defined(__arch64__) || defined(_LP64) typedef long int int64_t; typedef unsigned long int uint64_t; #else typedef long long int int64_t; typedef unsigned long long int uint64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ #elif defined( __VMS ) || defined(__sgi) #include <inttypes.h> #elif defined(__SCO__) || defined(__USLC__) #include <stdint.h> #elif defined(__UNIXOS2__) || defined(__SOL64__) typedef long int int32_t; typedef long long int int64_t; typedef unsigned long long int uint64_t; #elif defined(_WIN32) && defined(__GNUC__) #include <stdint.h> #elif defined(_WIN32) typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else /* Fallback if nothing above works */ #include <inttypes.h> #endif #endif typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; typedef signed char GLbyte; typedef short GLshort; typedef int GLint; typedef int GLclampx; typedef unsigned char GLubyte; typedef unsigned short GLushort; typedef unsigned int GLuint; typedef int GLsizei; typedef float GLfloat; typedef float GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void *GLeglClientBufferEXT; typedef void *GLeglImageOES; typedef char GLchar; typedef char GLcharARB; #ifdef __APPLE__ typedef void *GLhandleARB; #else typedef unsigned int GLhandleARB; #endif typedef unsigned short GLhalfARB; typedef unsigned short GLhalf; typedef GLint GLfixed; #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLintptr; #else typedef ptrdiff_t GLintptr; #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLsizeiptr; #else typedef ptrdiff_t GLsizeiptr; #endif typedef int64_t GLint64; typedef uint64_t GLuint64; #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLintptrARB; #else typedef ptrdiff_t GLintptrARB; #endif #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef long GLsizeiptrARB; #else typedef ptrdiff_t GLsizeiptrARB; #endif typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; typedef struct __GLsync *GLsync; struct _cl_context; struct _cl_event; typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); typedef unsigned short GLhalfNV; typedef GLintptr GLvdpauSurfaceNV; typedef void (APIENTRY *GLVULKANPROCNV)(void); #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_FALSE 0 #define GL_TRUE 1 #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 #define GL_LINE_STRIP 0x0003 #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 #define GL_LEQUAL 0x0203 #define GL_GREATER 0x0204 #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 #define GL_ZERO 0 #define GL_ONE 1 #define GL_SRC_COLOR 0x0300 #define GL_ONE_MINUS_SRC_COLOR 0x0301 #define GL_SRC_ALPHA 0x0302 #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 #define GL_NONE 0 #define GL_FRONT_LEFT 0x0400 #define GL_FRONT_RIGHT 0x0401 #define GL_BACK_LEFT 0x0402 #define GL_BACK_RIGHT 0x0403 #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_LEFT 0x0406 #define GL_RIGHT 0x0407 #define GL_FRONT_AND_BACK 0x0408 #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_OUT_OF_MEMORY 0x0505 #define GL_CW 0x0900 #define GL_CCW 0x0901 #define GL_POINT_SIZE 0x0B11 #define GL_POINT_SIZE_RANGE 0x0B12 #define GL_POINT_SIZE_GRANULARITY 0x0B13 #define GL_LINE_SMOOTH 0x0B20 #define GL_LINE_WIDTH 0x0B21 #define GL_LINE_WIDTH_RANGE 0x0B22 #define GL_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_POLYGON_MODE 0x0B40 #define GL_POLYGON_SMOOTH 0x0B41 #define GL_CULL_FACE 0x0B44 #define GL_CULL_FACE_MODE 0x0B45 #define GL_FRONT_FACE 0x0B46 #define GL_DEPTH_RANGE 0x0B70 #define GL_DEPTH_TEST 0x0B71 #define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_CLEAR_VALUE 0x0B73 #define GL_DEPTH_FUNC 0x0B74 #define GL_STENCIL_TEST 0x0B90 #define GL_STENCIL_CLEAR_VALUE 0x0B91 #define GL_STENCIL_FUNC 0x0B92 #define GL_STENCIL_VALUE_MASK 0x0B93 #define GL_STENCIL_FAIL 0x0B94 #define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 #define GL_STENCIL_REF 0x0B97 #define GL_STENCIL_WRITEMASK 0x0B98 #define GL_VIEWPORT 0x0BA2 #define GL_DITHER 0x0BD0 #define GL_BLEND_DST 0x0BE0 #define GL_BLEND_SRC 0x0BE1 #define GL_BLEND 0x0BE2 #define GL_LOGIC_OP_MODE 0x0BF0 #define GL_DRAW_BUFFER 0x0C01 #define GL_READ_BUFFER 0x0C02 #define GL_SCISSOR_BOX 0x0C10 #define GL_SCISSOR_TEST 0x0C11 #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_DOUBLEBUFFER 0x0C32 #define GL_STEREO 0x0C33 #define GL_LINE_SMOOTH_HINT 0x0C52 #define GL_POLYGON_SMOOTH_HINT 0x0C53 #define GL_UNPACK_SWAP_BYTES 0x0CF0 #define GL_UNPACK_LSB_FIRST 0x0CF1 #define GL_UNPACK_ROW_LENGTH 0x0CF2 #define GL_UNPACK_SKIP_ROWS 0x0CF3 #define GL_UNPACK_SKIP_PIXELS 0x0CF4 #define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_PACK_SWAP_BYTES 0x0D00 #define GL_PACK_LSB_FIRST 0x0D01 #define GL_PACK_ROW_LENGTH 0x0D02 #define GL_PACK_SKIP_ROWS 0x0D03 #define GL_PACK_SKIP_PIXELS 0x0D04 #define GL_PACK_ALIGNMENT 0x0D05 #define GL_MAX_TEXTURE_SIZE 0x0D33 #define GL_MAX_VIEWPORT_DIMS 0x0D3A #define GL_SUBPIXEL_BITS 0x0D50 #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 #define GL_TEXTURE_WIDTH 0x1000 #define GL_TEXTURE_HEIGHT 0x1001 #define GL_TEXTURE_BORDER_COLOR 0x1004 #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 #define GL_UNSIGNED_SHORT 0x1403 #define GL_INT 0x1404 #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_CLEAR 0x1500 #define GL_AND 0x1501 #define GL_AND_REVERSE 0x1502 #define GL_COPY 0x1503 #define GL_AND_INVERTED 0x1504 #define GL_NOOP 0x1505 #define GL_XOR 0x1506 #define GL_OR 0x1507 #define GL_NOR 0x1508 #define GL_EQUIV 0x1509 #define GL_INVERT 0x150A #define GL_OR_REVERSE 0x150B #define GL_COPY_INVERTED 0x150C #define GL_OR_INVERTED 0x150D #define GL_NAND 0x150E #define GL_SET 0x150F #define GL_TEXTURE 0x1702 #define GL_COLOR 0x1800 #define GL_DEPTH 0x1801 #define GL_STENCIL 0x1802 #define GL_STENCIL_INDEX 0x1901 #define GL_DEPTH_COMPONENT 0x1902 #define GL_RED 0x1903 #define GL_GREEN 0x1904 #define GL_BLUE 0x1905 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 #define GL_POINT 0x1B00 #define GL_LINE 0x1B01 #define GL_FILL 0x1B02 #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 #define GL_DECR 0x1E03 #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 #define GL_REPEAT 0x2901 #define GL_COLOR_LOGIC_OP 0x0BF2 #define GL_POLYGON_OFFSET_UNITS 0x2A00 #define GL_POLYGON_OFFSET_POINT 0x2A01 #define GL_POLYGON_OFFSET_LINE 0x2A02 #define GL_POLYGON_OFFSET_FILL 0x8037 #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_TEXTURE_BINDING_1D 0x8068 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_TEXTURE_INTERNAL_FORMAT 0x1003 #define GL_TEXTURE_RED_SIZE 0x805C #define GL_TEXTURE_GREEN_SIZE 0x805D #define GL_TEXTURE_BLUE_SIZE 0x805E #define GL_TEXTURE_ALPHA_SIZE 0x805F #define GL_DOUBLE 0x140A #define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_2D 0x8064 #define GL_R3_G3_B2 0x2A10 #define GL_RGB4 0x804F #define GL_RGB5 0x8050 #define GL_RGB8 0x8051 #define GL_RGB10 0x8052 #define GL_RGB12 0x8053 #define GL_RGB16 0x8054 #define GL_RGBA2 0x8055 #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGBA8 0x8058 #define GL_RGB10_A2 0x8059 #define GL_RGBA12 0x805A #define GL_RGBA16 0x805B #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_TEXTURE_BINDING_3D 0x806A #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_TEXTURE_3D 0x806F #define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_WRAP_R 0x8072 #define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_BGR 0x80E0 #define GL_BGRA 0x80E1 #define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_CLAMP_TO_EDGE 0x812F #define GL_TEXTURE_MIN_LOD 0x813A #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F #define GL_SAMPLE_COVERAGE 0x80A0 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 #define GL_TEXTURE_COMPRESSED 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_LOD_BIAS 0x8501 #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_BLEND_COLOR 0x8005 #define GL_BLEND_EQUATION 0x8009 #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_FUNC_ADD 0x8006 #define GL_FUNC_REVERSE_SUBTRACT 0x800B #define GL_FUNC_SUBTRACT 0x800A #define GL_MIN 0x8007 #define GL_MAX 0x8008 #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 #define GL_CURRENT_QUERY 0x8865 #define GL_QUERY_RESULT 0x8866 #define GL_QUERY_RESULT_AVAILABLE 0x8867 #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F #define GL_READ_ONLY 0x88B8 #define GL_WRITE_ONLY 0x88B9 #define GL_READ_WRITE 0x88BA #define GL_BUFFER_ACCESS 0x88BB #define GL_BUFFER_MAPPED 0x88BC #define GL_BUFFER_MAP_POINTER 0x88BD #define GL_STREAM_DRAW 0x88E0 #define GL_STREAM_READ 0x88E1 #define GL_STREAM_COPY 0x88E2 #define GL_STATIC_DRAW 0x88E4 #define GL_STATIC_READ 0x88E5 #define GL_STATIC_COPY 0x88E6 #define GL_DYNAMIC_DRAW 0x88E8 #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 #define GL_SRC1_ALPHA 0x8589 #define GL_BLEND_EQUATION_RGB 0x8009 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 #define GL_MAX_DRAW_BUFFERS 0x8824 #define GL_DRAW_BUFFER0 0x8825 #define GL_DRAW_BUFFER1 0x8826 #define GL_DRAW_BUFFER2 0x8827 #define GL_DRAW_BUFFER3 0x8828 #define GL_DRAW_BUFFER4 0x8829 #define GL_DRAW_BUFFER5 0x882A #define GL_DRAW_BUFFER6 0x882B #define GL_DRAW_BUFFER7 0x882C #define GL_DRAW_BUFFER8 0x882D #define GL_DRAW_BUFFER9 0x882E #define GL_DRAW_BUFFER10 0x882F #define GL_DRAW_BUFFER11 0x8830 #define GL_DRAW_BUFFER12 0x8831 #define GL_DRAW_BUFFER13 0x8832 #define GL_DRAW_BUFFER14 0x8833 #define GL_DRAW_BUFFER15 0x8834 #define GL_BLEND_EQUATION_ALPHA 0x883D #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A #define GL_MAX_VARYING_FLOATS 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D #define GL_SHADER_TYPE 0x8B4F #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 #define GL_INT_VEC2 0x8B53 #define GL_INT_VEC3 0x8B54 #define GL_INT_VEC4 0x8B55 #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 #define GL_BOOL_VEC4 0x8B59 #define GL_FLOAT_MAT2 0x8B5A #define GL_FLOAT_MAT3 0x8B5B #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_1D 0x8B5D #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_3D 0x8B5F #define GL_SAMPLER_CUBE 0x8B60 #define GL_SAMPLER_1D_SHADOW 0x8B61 #define GL_SAMPLER_2D_SHADOW 0x8B62 #define GL_DELETE_STATUS 0x8B80 #define GL_COMPILE_STATUS 0x8B81 #define GL_LINK_STATUS 0x8B82 #define GL_VALIDATE_STATUS 0x8B83 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_ATTACHED_SHADERS 0x8B85 #define GL_ACTIVE_UNIFORMS 0x8B86 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_ACTIVE_ATTRIBUTES 0x8B89 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #define GL_CURRENT_PROGRAM 0x8B8D #define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 #define GL_LOWER_LEFT 0x8CA1 #define GL_UPPER_LEFT 0x8CA2 #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF #define GL_FLOAT_MAT2x3 0x8B65 #define GL_FLOAT_MAT2x4 0x8B66 #define GL_FLOAT_MAT3x2 0x8B67 #define GL_FLOAT_MAT3x4 0x8B68 #define GL_FLOAT_MAT4x2 0x8B69 #define GL_FLOAT_MAT4x3 0x8B6A #define GL_SRGB 0x8C40 #define GL_SRGB8 0x8C41 #define GL_SRGB_ALPHA 0x8C42 #define GL_SRGB8_ALPHA8 0x8C43 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_CLIP_DISTANCE0 0x3000 #define GL_CLIP_DISTANCE1 0x3001 #define GL_CLIP_DISTANCE2 0x3002 #define GL_CLIP_DISTANCE3 0x3003 #define GL_CLIP_DISTANCE4 0x3004 #define GL_CLIP_DISTANCE5 0x3005 #define GL_CLIP_DISTANCE6 0x3006 #define GL_CLIP_DISTANCE7 0x3007 #define GL_MAX_CLIP_DISTANCES 0x0D32 #define GL_MAJOR_VERSION 0x821B #define GL_MINOR_VERSION 0x821C #define GL_NUM_EXTENSIONS 0x821D #define GL_CONTEXT_FLAGS 0x821E #define GL_COMPRESSED_RED 0x8225 #define GL_COMPRESSED_RG 0x8226 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 #define GL_RGBA32F 0x8814 #define GL_RGB32F 0x8815 #define GL_RGBA16F 0x881A #define GL_RGB16F 0x881B #define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD #define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF #define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 #define GL_CLAMP_READ_COLOR 0x891C #define GL_FIXED_ONLY 0x891D #define GL_MAX_VARYING_COMPONENTS 0x8B4B #define GL_TEXTURE_1D_ARRAY 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 #define GL_TEXTURE_2D_ARRAY 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B #define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D #define GL_R11F_G11F_B10F 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B #define GL_RGB9_E5 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E #define GL_TEXTURE_SHARED_SIZE 0x8C3F #define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 #define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 #define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 #define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 #define GL_PRIMITIVES_GENERATED 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 #define GL_RASTERIZER_DISCARD 0x8C89 #define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B #define GL_INTERLEAVED_ATTRIBS 0x8C8C #define GL_SEPARATE_ATTRIBS 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F #define GL_RGBA32UI 0x8D70 #define GL_RGB32UI 0x8D71 #define GL_RGBA16UI 0x8D76 #define GL_RGB16UI 0x8D77 #define GL_RGBA8UI 0x8D7C #define GL_RGB8UI 0x8D7D #define GL_RGBA32I 0x8D82 #define GL_RGB32I 0x8D83 #define GL_RGBA16I 0x8D88 #define GL_RGB16I 0x8D89 #define GL_RGBA8I 0x8D8E #define GL_RGB8I 0x8D8F #define GL_RED_INTEGER 0x8D94 #define GL_GREEN_INTEGER 0x8D95 #define GL_BLUE_INTEGER 0x8D96 #define GL_RGB_INTEGER 0x8D98 #define GL_RGBA_INTEGER 0x8D99 #define GL_BGR_INTEGER 0x8D9A #define GL_BGRA_INTEGER 0x8D9B #define GL_SAMPLER_1D_ARRAY 0x8DC0 #define GL_SAMPLER_2D_ARRAY 0x8DC1 #define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 #define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 #define GL_SAMPLER_CUBE_SHADOW 0x8DC5 #define GL_UNSIGNED_INT_VEC2 0x8DC6 #define GL_UNSIGNED_INT_VEC3 0x8DC7 #define GL_UNSIGNED_INT_VEC4 0x8DC8 #define GL_INT_SAMPLER_1D 0x8DC9 #define GL_INT_SAMPLER_2D 0x8DCA #define GL_INT_SAMPLER_3D 0x8DCB #define GL_INT_SAMPLER_CUBE 0x8DCC #define GL_INT_SAMPLER_1D_ARRAY 0x8DCE #define GL_INT_SAMPLER_2D_ARRAY 0x8DCF #define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 #define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 #define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 #define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 #define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 #define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 #define GL_QUERY_WAIT 0x8E13 #define GL_QUERY_NO_WAIT 0x8E14 #define GL_QUERY_BY_REGION_WAIT 0x8E15 #define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 #define GL_BUFFER_ACCESS_FLAGS 0x911F #define GL_BUFFER_MAP_LENGTH 0x9120 #define GL_BUFFER_MAP_OFFSET 0x9121 #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 #define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 #define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 #define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 #define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 #define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 #define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 #define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 #define GL_FRAMEBUFFER_DEFAULT 0x8218 #define GL_FRAMEBUFFER_UNDEFINED 0x8219 #define GL_DEPTH_STENCIL_ATTACHMENT 0x821A #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 #define GL_DEPTH_STENCIL 0x84F9 #define GL_UNSIGNED_INT_24_8 0x84FA #define GL_DEPTH24_STENCIL8 0x88F0 #define GL_TEXTURE_STENCIL_SIZE 0x88F1 #define GL_TEXTURE_RED_TYPE 0x8C10 #define GL_TEXTURE_GREEN_TYPE 0x8C11 #define GL_TEXTURE_BLUE_TYPE 0x8C12 #define GL_TEXTURE_ALPHA_TYPE 0x8C13 #define GL_TEXTURE_DEPTH_TYPE 0x8C16 #define GL_UNSIGNED_NORMALIZED 0x8C17 #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_READ_FRAMEBUFFER 0x8CA8 #define GL_DRAW_FRAMEBUFFER 0x8CA9 #define GL_READ_FRAMEBUFFER_BINDING 0x8CAA #define GL_RENDERBUFFER_SAMPLES 0x8CAB #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS 0x8CDF #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_COLOR_ATTACHMENT1 0x8CE1 #define GL_COLOR_ATTACHMENT2 0x8CE2 #define GL_COLOR_ATTACHMENT3 0x8CE3 #define GL_COLOR_ATTACHMENT4 0x8CE4 #define GL_COLOR_ATTACHMENT5 0x8CE5 #define GL_COLOR_ATTACHMENT6 0x8CE6 #define GL_COLOR_ATTACHMENT7 0x8CE7 #define GL_COLOR_ATTACHMENT8 0x8CE8 #define GL_COLOR_ATTACHMENT9 0x8CE9 #define GL_COLOR_ATTACHMENT10 0x8CEA #define GL_COLOR_ATTACHMENT11 0x8CEB #define GL_COLOR_ATTACHMENT12 0x8CEC #define GL_COLOR_ATTACHMENT13 0x8CED #define GL_COLOR_ATTACHMENT14 0x8CEE #define GL_COLOR_ATTACHMENT15 0x8CEF #define GL_COLOR_ATTACHMENT16 0x8CF0 #define GL_COLOR_ATTACHMENT17 0x8CF1 #define GL_COLOR_ATTACHMENT18 0x8CF2 #define GL_COLOR_ATTACHMENT19 0x8CF3 #define GL_COLOR_ATTACHMENT20 0x8CF4 #define GL_COLOR_ATTACHMENT21 0x8CF5 #define GL_COLOR_ATTACHMENT22 0x8CF6 #define GL_COLOR_ATTACHMENT23 0x8CF7 #define GL_COLOR_ATTACHMENT24 0x8CF8 #define GL_COLOR_ATTACHMENT25 0x8CF9 #define GL_COLOR_ATTACHMENT26 0x8CFA #define GL_COLOR_ATTACHMENT27 0x8CFB #define GL_COLOR_ATTACHMENT28 0x8CFC #define GL_COLOR_ATTACHMENT29 0x8CFD #define GL_COLOR_ATTACHMENT30 0x8CFE #define GL_COLOR_ATTACHMENT31 0x8CFF #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 #define GL_STENCIL_INDEX1 0x8D46 #define GL_STENCIL_INDEX4 0x8D47 #define GL_STENCIL_INDEX8 0x8D48 #define GL_STENCIL_INDEX16 0x8D49 #define GL_RENDERBUFFER_RED_SIZE 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 #define GL_INDEX 0x8222 #define GL_FRAMEBUFFER_SRGB 0x8DB9 #define GL_HALF_FLOAT 0x140B #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 #define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 #define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 #define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 #define GL_COMPRESSED_RED_RGTC1 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC #define GL_COMPRESSED_RG_RGTC2 0x8DBD #define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE #define GL_RG 0x8227 #define GL_RG_INTEGER 0x8228 #define GL_R8 0x8229 #define GL_R16 0x822A #define GL_RG8 0x822B #define GL_RG16 0x822C #define GL_R16F 0x822D #define GL_R32F 0x822E #define GL_RG16F 0x822F #define GL_RG32F 0x8230 #define GL_R8I 0x8231 #define GL_R8UI 0x8232 #define GL_R16I 0x8233 #define GL_R16UI 0x8234 #define GL_R32I 0x8235 #define GL_R32UI 0x8236 #define GL_RG8I 0x8237 #define GL_RG8UI 0x8238 #define GL_RG16I 0x8239 #define GL_RG16UI 0x823A #define GL_RG32I 0x823B #define GL_RG32UI 0x823C #define GL_VERTEX_ARRAY_BINDING 0x85B5 #define GL_SAMPLER_2D_RECT 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 #define GL_SAMPLER_BUFFER 0x8DC2 #define GL_INT_SAMPLER_2D_RECT 0x8DCD #define GL_INT_SAMPLER_BUFFER 0x8DD0 #define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 #define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 #define GL_TEXTURE_BUFFER 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B #define GL_TEXTURE_BINDING_BUFFER 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 #define GL_R8_SNORM 0x8F94 #define GL_RG8_SNORM 0x8F95 #define GL_RGB8_SNORM 0x8F96 #define GL_RGBA8_SNORM 0x8F97 #define GL_R16_SNORM 0x8F98 #define GL_RG16_SNORM 0x8F99 #define GL_RGB16_SNORM 0x8F9A #define GL_RGBA16_SNORM 0x8F9B #define GL_SIGNED_NORMALIZED 0x8F9C #define GL_PRIMITIVE_RESTART 0x8F9D #define GL_PRIMITIVE_RESTART_INDEX 0x8F9E #define GL_COPY_READ_BUFFER 0x8F36 #define GL_COPY_WRITE_BUFFER 0x8F37 #define GL_UNIFORM_BUFFER 0x8A11 #define GL_UNIFORM_BUFFER_BINDING 0x8A28 #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B #define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 #define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 #define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 #define GL_UNIFORM_TYPE 0x8A37 #define GL_UNIFORM_SIZE 0x8A38 #define GL_UNIFORM_NAME_LENGTH 0x8A39 #define GL_UNIFORM_BLOCK_INDEX 0x8A3A #define GL_UNIFORM_OFFSET 0x8A3B #define GL_UNIFORM_ARRAY_STRIDE 0x8A3C #define GL_UNIFORM_MATRIX_STRIDE 0x8A3D #define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E #define GL_UNIFORM_BLOCK_BINDING 0x8A3F #define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 #define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 #define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFF #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_LINES_ADJACENCY 0x000A #define GL_LINE_STRIP_ADJACENCY 0x000B #define GL_TRIANGLES_ADJACENCY 0x000C #define GL_TRIANGLE_STRIP_ADJACENCY 0x000D #define GL_PROGRAM_POINT_SIZE 0x8642 #define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 #define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 #define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 #define GL_GEOMETRY_SHADER 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT 0x8916 #define GL_GEOMETRY_INPUT_TYPE 0x8917 #define GL_GEOMETRY_OUTPUT_TYPE 0x8918 #define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF #define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 #define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 #define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 #define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 #define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 #define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 #define GL_CONTEXT_PROFILE_MASK 0x9126 #define GL_DEPTH_CLAMP 0x864F #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E #define GL_PROVOKING_VERTEX 0x8E4F #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 #define GL_OBJECT_TYPE 0x9112 #define GL_SYNC_CONDITION 0x9113 #define GL_SYNC_STATUS 0x9114 #define GL_SYNC_FLAGS 0x9115 #define GL_SYNC_FENCE 0x9116 #define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 #define GL_UNSIGNALED 0x9118 #define GL_SIGNALED 0x9119 #define GL_ALREADY_SIGNALED 0x911A #define GL_TIMEOUT_EXPIRED 0x911B #define GL_CONDITION_SATISFIED 0x911C #define GL_WAIT_FAILED 0x911D #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF #define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 #define GL_SAMPLE_POSITION 0x8E50 #define GL_SAMPLE_MASK 0x8E51 #define GL_SAMPLE_MASK_VALUE 0x8E52 #define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 #define GL_TEXTURE_2D_MULTISAMPLE 0x9100 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 #define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 #define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 #define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 #define GL_TEXTURE_SAMPLES 0x9106 #define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 #define GL_SAMPLER_2D_MULTISAMPLE 0x9108 #define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A #define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B #define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D #define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E #define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F #define GL_MAX_INTEGER_SAMPLES 0x9110 #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE #define GL_SRC1_COLOR 0x88F9 #define GL_ONE_MINUS_SRC1_COLOR 0x88FA #define GL_ONE_MINUS_SRC1_ALPHA 0x88FB #define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC #define GL_ANY_SAMPLES_PASSED 0x8C2F #define GL_SAMPLER_BINDING 0x8919 #define GL_RGB10_A2UI 0x906F #define GL_TEXTURE_SWIZZLE_R 0x8E42 #define GL_TEXTURE_SWIZZLE_G 0x8E43 #define GL_TEXTURE_SWIZZLE_B 0x8E44 #define GL_TEXTURE_SWIZZLE_A 0x8E45 #define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 #define GL_TIME_ELAPSED 0x88BF #define GL_TIMESTAMP 0x8E28 #define GL_INT_2_10_10_10_REV 0x8D9F #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 GLAPI int GLAD_GL_VERSION_1_0; typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); GLAPI PFNGLCULLFACEPROC glad_glCullFace; #define glCullFace glad_glCullFace typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; #define glFrontFace glad_glFrontFace typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); GLAPI PFNGLHINTPROC glad_glHint; #define glHint glad_glHint typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; #define glLineWidth glad_glLineWidth typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; #define glPointSize glad_glPointSize typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; #define glPolygonMode glad_glPolygonMode typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); GLAPI PFNGLSCISSORPROC glad_glScissor; #define glScissor glad_glScissor typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; #define glTexParameterf glad_glTexParameterf typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; #define glTexParameterfv glad_glTexParameterfv typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; #define glTexParameteri glad_glTexParameteri typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; #define glTexParameteriv glad_glTexParameteriv typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; #define glTexImage1D glad_glTexImage1D typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; #define glTexImage2D glad_glTexImage2D typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; #define glDrawBuffer glad_glDrawBuffer typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); GLAPI PFNGLCLEARPROC glad_glClear; #define glClear glad_glClear typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; #define glClearColor glad_glClearColor typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; #define glClearStencil glad_glClearStencil typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; #define glClearDepth glad_glClearDepth typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; #define glStencilMask glad_glStencilMask typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); GLAPI PFNGLCOLORMASKPROC glad_glColorMask; #define glColorMask glad_glColorMask typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; #define glDepthMask glad_glDepthMask typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); GLAPI PFNGLDISABLEPROC glad_glDisable; #define glDisable glad_glDisable typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); GLAPI PFNGLENABLEPROC glad_glEnable; #define glEnable glad_glEnable typedef void (APIENTRYP PFNGLFINISHPROC)(void); GLAPI PFNGLFINISHPROC glad_glFinish; #define glFinish glad_glFinish typedef void (APIENTRYP PFNGLFLUSHPROC)(void); GLAPI PFNGLFLUSHPROC glad_glFlush; #define glFlush glad_glFlush typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; #define glBlendFunc glad_glBlendFunc typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); GLAPI PFNGLLOGICOPPROC glad_glLogicOp; #define glLogicOp glad_glLogicOp typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; #define glStencilFunc glad_glStencilFunc typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; #define glStencilOp glad_glStencilOp typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; #define glDepthFunc glad_glDepthFunc typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; #define glPixelStoref glad_glPixelStoref typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; #define glPixelStorei glad_glPixelStorei typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; #define glReadBuffer glad_glReadBuffer typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; #define glReadPixels glad_glReadPixels typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; #define glGetBooleanv glad_glGetBooleanv typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; #define glGetDoublev glad_glGetDoublev typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); GLAPI PFNGLGETERRORPROC glad_glGetError; #define glGetError glad_glGetError typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; #define glGetFloatv glad_glGetFloatv typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; #define glGetIntegerv glad_glGetIntegerv typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); GLAPI PFNGLGETSTRINGPROC glad_glGetString; #define glGetString glad_glGetString typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; #define glGetTexImage glad_glGetTexImage typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; #define glGetTexParameterfv glad_glGetTexParameterfv typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; #define glGetTexParameteriv glad_glGetTexParameteriv typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; #define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; #define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; #define glIsEnabled glad_glIsEnabled typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; #define glDepthRange glad_glDepthRange typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); GLAPI PFNGLVIEWPORTPROC glad_glViewport; #define glViewport glad_glViewport #endif #ifndef GL_VERSION_1_1 #define GL_VERSION_1_1 1 GLAPI int GLAD_GL_VERSION_1_1; typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; #define glDrawArrays glad_glDrawArrays typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; #define glDrawElements glad_glDrawElements typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; #define glPolygonOffset glad_glPolygonOffset typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; #define glCopyTexImage1D glad_glCopyTexImage1D typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; #define glCopyTexImage2D glad_glCopyTexImage2D typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; #define glCopyTexSubImage1D glad_glCopyTexSubImage1D typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; #define glCopyTexSubImage2D glad_glCopyTexSubImage2D typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; #define glTexSubImage1D glad_glTexSubImage1D typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; #define glTexSubImage2D glad_glTexSubImage2D typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; #define glBindTexture glad_glBindTexture typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; #define glDeleteTextures glad_glDeleteTextures typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; #define glGenTextures glad_glGenTextures typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; #define glIsTexture glad_glIsTexture #endif #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 GLAPI int GLAD_GL_VERSION_1_2; typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; #define glDrawRangeElements glad_glDrawRangeElements typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; #define glTexImage3D glad_glTexImage3D typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; #define glTexSubImage3D glad_glTexSubImage3D typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; #define glCopyTexSubImage3D glad_glCopyTexSubImage3D #endif #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 GLAPI int GLAD_GL_VERSION_1_3; typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; #define glActiveTexture glad_glActiveTexture typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; #define glSampleCoverage glad_glSampleCoverage typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; #define glCompressedTexImage3D glad_glCompressedTexImage3D typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; #define glCompressedTexImage2D glad_glCompressedTexImage2D typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; #define glCompressedTexImage1D glad_glCompressedTexImage1D typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; #define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; #define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; #define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; #define glGetCompressedTexImage glad_glGetCompressedTexImage #endif #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 GLAPI int GLAD_GL_VERSION_1_4; typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; #define glBlendFuncSeparate glad_glBlendFuncSeparate typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; #define glMultiDrawArrays glad_glMultiDrawArrays typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; #define glMultiDrawElements glad_glMultiDrawElements typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; #define glPointParameterf glad_glPointParameterf typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; #define glPointParameterfv glad_glPointParameterfv typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; #define glPointParameteri glad_glPointParameteri typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; #define glPointParameteriv glad_glPointParameteriv typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; #define glBlendColor glad_glBlendColor typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; #define glBlendEquation glad_glBlendEquation #endif #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 GLAPI int GLAD_GL_VERSION_1_5; typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; #define glGenQueries glad_glGenQueries typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; #define glDeleteQueries glad_glDeleteQueries typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); GLAPI PFNGLISQUERYPROC glad_glIsQuery; #define glIsQuery glad_glIsQuery typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; #define glBeginQuery glad_glBeginQuery typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); GLAPI PFNGLENDQUERYPROC glad_glEndQuery; #define glEndQuery glad_glEndQuery typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; #define glGetQueryiv glad_glGetQueryiv typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; #define glGetQueryObjectiv glad_glGetQueryObjectiv typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; #define glGetQueryObjectuiv glad_glGetQueryObjectuiv typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; #define glBindBuffer glad_glBindBuffer typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; #define glDeleteBuffers glad_glDeleteBuffers typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; #define glGenBuffers glad_glGenBuffers typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; #define glIsBuffer glad_glIsBuffer typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; #define glBufferData glad_glBufferData typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; #define glBufferSubData glad_glBufferSubData typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; #define glGetBufferSubData glad_glGetBufferSubData typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; #define glMapBuffer glad_glMapBuffer typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; #define glUnmapBuffer glad_glUnmapBuffer typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; #define glGetBufferParameteriv glad_glGetBufferParameteriv typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; #define glGetBufferPointerv glad_glGetBufferPointerv #endif #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 GLAPI int GLAD_GL_VERSION_2_0; typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; #define glBlendEquationSeparate glad_glBlendEquationSeparate typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; #define glDrawBuffers glad_glDrawBuffers typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; #define glStencilOpSeparate glad_glStencilOpSeparate typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; #define glStencilFuncSeparate glad_glStencilFuncSeparate typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; #define glStencilMaskSeparate glad_glStencilMaskSeparate typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; #define glAttachShader glad_glAttachShader typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; #define glBindAttribLocation glad_glBindAttribLocation typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; #define glCompileShader glad_glCompileShader typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; #define glCreateProgram glad_glCreateProgram typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; #define glCreateShader glad_glCreateShader typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; #define glDeleteProgram glad_glDeleteProgram typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; #define glDeleteShader glad_glDeleteShader typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; #define glDetachShader glad_glDetachShader typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; #define glDisableVertexAttribArray glad_glDisableVertexAttribArray typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; #define glEnableVertexAttribArray glad_glEnableVertexAttribArray typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; #define glGetActiveAttrib glad_glGetActiveAttrib typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; #define glGetActiveUniform glad_glGetActiveUniform typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; #define glGetAttachedShaders glad_glGetAttachedShaders typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; #define glGetAttribLocation glad_glGetAttribLocation typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; #define glGetProgramiv glad_glGetProgramiv typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; #define glGetProgramInfoLog glad_glGetProgramInfoLog typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; #define glGetShaderiv glad_glGetShaderiv typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; #define glGetShaderInfoLog glad_glGetShaderInfoLog typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; #define glGetShaderSource glad_glGetShaderSource typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; #define glGetUniformLocation glad_glGetUniformLocation typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; #define glGetUniformfv glad_glGetUniformfv typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; #define glGetUniformiv glad_glGetUniformiv typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; #define glGetVertexAttribdv glad_glGetVertexAttribdv typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; #define glGetVertexAttribfv glad_glGetVertexAttribfv typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; #define glGetVertexAttribiv glad_glGetVertexAttribiv typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; #define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; #define glIsProgram glad_glIsProgram typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); GLAPI PFNGLISSHADERPROC glad_glIsShader; #define glIsShader glad_glIsShader typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; #define glLinkProgram glad_glLinkProgram typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; #define glShaderSource glad_glShaderSource typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; #define glUseProgram glad_glUseProgram typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; #define glUniform1f glad_glUniform1f typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; #define glUniform2f glad_glUniform2f typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; #define glUniform3f glad_glUniform3f typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; #define glUniform4f glad_glUniform4f typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; #define glUniform1i glad_glUniform1i typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; #define glUniform2i glad_glUniform2i typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; #define glUniform3i glad_glUniform3i typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; #define glUniform4i glad_glUniform4i typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; #define glUniform1fv glad_glUniform1fv typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; #define glUniform2fv glad_glUniform2fv typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; #define glUniform3fv glad_glUniform3fv typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; #define glUniform4fv glad_glUniform4fv typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; #define glUniform1iv glad_glUniform1iv typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; #define glUniform2iv glad_glUniform2iv typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; #define glUniform3iv glad_glUniform3iv typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; #define glUniform4iv glad_glUniform4iv typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; #define glUniformMatrix2fv glad_glUniformMatrix2fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; #define glUniformMatrix3fv glad_glUniformMatrix3fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; #define glUniformMatrix4fv glad_glUniformMatrix4fv typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; #define glValidateProgram glad_glValidateProgram typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; #define glVertexAttrib1d glad_glVertexAttrib1d typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; #define glVertexAttrib1dv glad_glVertexAttrib1dv typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; #define glVertexAttrib1f glad_glVertexAttrib1f typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; #define glVertexAttrib1fv glad_glVertexAttrib1fv typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; #define glVertexAttrib1s glad_glVertexAttrib1s typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; #define glVertexAttrib1sv glad_glVertexAttrib1sv typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; #define glVertexAttrib2d glad_glVertexAttrib2d typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; #define glVertexAttrib2dv glad_glVertexAttrib2dv typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; #define glVertexAttrib2f glad_glVertexAttrib2f typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; #define glVertexAttrib2fv glad_glVertexAttrib2fv typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; #define glVertexAttrib2s glad_glVertexAttrib2s typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; #define glVertexAttrib2sv glad_glVertexAttrib2sv typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; #define glVertexAttrib3d glad_glVertexAttrib3d typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; #define glVertexAttrib3dv glad_glVertexAttrib3dv typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; #define glVertexAttrib3f glad_glVertexAttrib3f typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; #define glVertexAttrib3fv glad_glVertexAttrib3fv typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; #define glVertexAttrib3s glad_glVertexAttrib3s typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; #define glVertexAttrib3sv glad_glVertexAttrib3sv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; #define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; #define glVertexAttrib4Niv glad_glVertexAttrib4Niv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; #define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; #define glVertexAttrib4Nub glad_glVertexAttrib4Nub typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; #define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; #define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; #define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; #define glVertexAttrib4bv glad_glVertexAttrib4bv typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; #define glVertexAttrib4d glad_glVertexAttrib4d typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; #define glVertexAttrib4dv glad_glVertexAttrib4dv typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; #define glVertexAttrib4f glad_glVertexAttrib4f typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; #define glVertexAttrib4fv glad_glVertexAttrib4fv typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; #define glVertexAttrib4iv glad_glVertexAttrib4iv typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; #define glVertexAttrib4s glad_glVertexAttrib4s typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; #define glVertexAttrib4sv glad_glVertexAttrib4sv typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; #define glVertexAttrib4ubv glad_glVertexAttrib4ubv typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; #define glVertexAttrib4uiv glad_glVertexAttrib4uiv typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; #define glVertexAttrib4usv glad_glVertexAttrib4usv typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; #define glVertexAttribPointer glad_glVertexAttribPointer #endif #ifndef GL_VERSION_2_1 #define GL_VERSION_2_1 1 GLAPI int GLAD_GL_VERSION_2_1; typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; #define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; #define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; #define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; #define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; #define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; #define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv #endif #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 1 GLAPI int GLAD_GL_VERSION_3_0; typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; #define glColorMaski glad_glColorMaski typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; #define glGetBooleani_v glad_glGetBooleani_v typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; #define glGetIntegeri_v glad_glGetIntegeri_v typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); GLAPI PFNGLENABLEIPROC glad_glEnablei; #define glEnablei glad_glEnablei typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); GLAPI PFNGLDISABLEIPROC glad_glDisablei; #define glDisablei glad_glDisablei typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; #define glIsEnabledi glad_glIsEnabledi typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; #define glBeginTransformFeedback glad_glBeginTransformFeedback typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; #define glEndTransformFeedback glad_glEndTransformFeedback typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; #define glBindBufferRange glad_glBindBufferRange typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; #define glBindBufferBase glad_glBindBufferBase typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; #define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; #define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; #define glClampColor glad_glClampColor typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; #define glBeginConditionalRender glad_glBeginConditionalRender typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; #define glEndConditionalRender glad_glEndConditionalRender typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; #define glVertexAttribIPointer glad_glVertexAttribIPointer typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; #define glGetVertexAttribIiv glad_glGetVertexAttribIiv typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; #define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; #define glVertexAttribI1i glad_glVertexAttribI1i typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; #define glVertexAttribI2i glad_glVertexAttribI2i typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; #define glVertexAttribI3i glad_glVertexAttribI3i typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; #define glVertexAttribI4i glad_glVertexAttribI4i typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; #define glVertexAttribI1ui glad_glVertexAttribI1ui typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; #define glVertexAttribI2ui glad_glVertexAttribI2ui typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; #define glVertexAttribI3ui glad_glVertexAttribI3ui typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; #define glVertexAttribI4ui glad_glVertexAttribI4ui typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; #define glVertexAttribI1iv glad_glVertexAttribI1iv typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; #define glVertexAttribI2iv glad_glVertexAttribI2iv typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; #define glVertexAttribI3iv glad_glVertexAttribI3iv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; #define glVertexAttribI4iv glad_glVertexAttribI4iv typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; #define glVertexAttribI1uiv glad_glVertexAttribI1uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; #define glVertexAttribI2uiv glad_glVertexAttribI2uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; #define glVertexAttribI3uiv glad_glVertexAttribI3uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; #define glVertexAttribI4uiv glad_glVertexAttribI4uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; #define glVertexAttribI4bv glad_glVertexAttribI4bv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; #define glVertexAttribI4sv glad_glVertexAttribI4sv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; #define glVertexAttribI4ubv glad_glVertexAttribI4ubv typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; #define glVertexAttribI4usv glad_glVertexAttribI4usv typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; #define glGetUniformuiv glad_glGetUniformuiv typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; #define glBindFragDataLocation glad_glBindFragDataLocation typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; #define glGetFragDataLocation glad_glGetFragDataLocation typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; #define glUniform1ui glad_glUniform1ui typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; #define glUniform2ui glad_glUniform2ui typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; #define glUniform3ui glad_glUniform3ui typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; #define glUniform4ui glad_glUniform4ui typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; #define glUniform1uiv glad_glUniform1uiv typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; #define glUniform2uiv glad_glUniform2uiv typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; #define glUniform3uiv glad_glUniform3uiv typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; #define glUniform4uiv glad_glUniform4uiv typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; #define glTexParameterIiv glad_glTexParameterIiv typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; #define glTexParameterIuiv glad_glTexParameterIuiv typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; #define glGetTexParameterIiv glad_glGetTexParameterIiv typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; #define glGetTexParameterIuiv glad_glGetTexParameterIuiv typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; #define glClearBufferiv glad_glClearBufferiv typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; #define glClearBufferuiv glad_glClearBufferuiv typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; #define glClearBufferfv glad_glClearBufferfv typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; #define glClearBufferfi glad_glClearBufferfi typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; #define glGetStringi glad_glGetStringi typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; #define glIsRenderbuffer glad_glIsRenderbuffer typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; #define glBindRenderbuffer glad_glBindRenderbuffer typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; #define glDeleteRenderbuffers glad_glDeleteRenderbuffers typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; #define glGenRenderbuffers glad_glGenRenderbuffers typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; #define glRenderbufferStorage glad_glRenderbufferStorage typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; #define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; #define glIsFramebuffer glad_glIsFramebuffer typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; #define glBindFramebuffer glad_glBindFramebuffer typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; #define glDeleteFramebuffers glad_glDeleteFramebuffers typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; #define glGenFramebuffers glad_glGenFramebuffers typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; #define glCheckFramebufferStatus glad_glCheckFramebufferStatus typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; #define glFramebufferTexture1D glad_glFramebufferTexture1D typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; #define glFramebufferTexture2D glad_glFramebufferTexture2D typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; #define glFramebufferTexture3D glad_glFramebufferTexture3D typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; #define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; #define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; #define glGenerateMipmap glad_glGenerateMipmap typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; #define glBlitFramebuffer glad_glBlitFramebuffer typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; #define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; #define glFramebufferTextureLayer glad_glFramebufferTextureLayer typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; #define glMapBufferRange glad_glMapBufferRange typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; #define glFlushMappedBufferRange glad_glFlushMappedBufferRange typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; #define glBindVertexArray glad_glBindVertexArray typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; #define glDeleteVertexArrays glad_glDeleteVertexArrays typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; #define glGenVertexArrays glad_glGenVertexArrays typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; #define glIsVertexArray glad_glIsVertexArray #endif #ifndef GL_VERSION_3_1 #define GL_VERSION_3_1 1 GLAPI int GLAD_GL_VERSION_3_1; typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; #define glDrawArraysInstanced glad_glDrawArraysInstanced typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; #define glDrawElementsInstanced glad_glDrawElementsInstanced typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; #define glTexBuffer glad_glTexBuffer typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; #define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; #define glCopyBufferSubData glad_glCopyBufferSubData typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; #define glGetUniformIndices glad_glGetUniformIndices typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; #define glGetActiveUniformsiv glad_glGetActiveUniformsiv typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; #define glGetActiveUniformName glad_glGetActiveUniformName typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; #define glGetUniformBlockIndex glad_glGetUniformBlockIndex typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; #define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; #define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; #define glUniformBlockBinding glad_glUniformBlockBinding #endif #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 1 GLAPI int GLAD_GL_VERSION_3_2; typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; #define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; #define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; #define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; #define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; #define glProvokingVertex glad_glProvokingVertex typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; #define glFenceSync glad_glFenceSync typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync sync); GLAPI PFNGLISSYNCPROC glad_glIsSync; #define glIsSync glad_glIsSync typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; #define glDeleteSync glad_glDeleteSync typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; #define glClientWaitSync glad_glClientWaitSync typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; #define glWaitSync glad_glWaitSync typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; #define glGetInteger64v glad_glGetInteger64v typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; #define glGetSynciv glad_glGetSynciv typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; #define glGetInteger64i_v glad_glGetInteger64i_v typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; #define glGetBufferParameteri64v glad_glGetBufferParameteri64v typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; #define glFramebufferTexture glad_glFramebufferTexture typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; #define glTexImage2DMultisample glad_glTexImage2DMultisample typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; #define glTexImage3DMultisample glad_glTexImage3DMultisample typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat *val); GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; #define glGetMultisamplefv glad_glGetMultisamplefv typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; #define glSampleMaski glad_glSampleMaski #endif #ifndef GL_VERSION_3_3 #define GL_VERSION_3_3 1 GLAPI int GLAD_GL_VERSION_3_3; typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); GLAPI PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; #define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar *name); GLAPI PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; #define glGetFragDataIndex glad_glGetFragDataIndex typedef void (APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); GLAPI PFNGLGENSAMPLERSPROC glad_glGenSamplers; #define glGenSamplers glad_glGenSamplers typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); GLAPI PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; #define glDeleteSamplers glad_glDeleteSamplers typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); GLAPI PFNGLISSAMPLERPROC glad_glIsSampler; #define glIsSampler glad_glIsSampler typedef void (APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); GLAPI PFNGLBINDSAMPLERPROC glad_glBindSampler; #define glBindSampler glad_glBindSampler typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); GLAPI PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; #define glSamplerParameteri glad_glSamplerParameteri typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); GLAPI PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; #define glSamplerParameteriv glad_glSamplerParameteriv typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); GLAPI PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; #define glSamplerParameterf glad_glSamplerParameterf typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); GLAPI PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; #define glSamplerParameterfv glad_glSamplerParameterfv typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint *param); GLAPI PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; #define glSamplerParameterIiv glad_glSamplerParameterIiv typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint *param); GLAPI PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; #define glSamplerParameterIuiv glad_glSamplerParameterIuiv typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); GLAPI PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; #define glGetSamplerParameteriv glad_glGetSamplerParameteriv typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint *params); GLAPI PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; #define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); GLAPI PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; #define glGetSamplerParameterfv glad_glGetSamplerParameterfv typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint *params); GLAPI PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; #define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); GLAPI PFNGLQUERYCOUNTERPROC glad_glQueryCounter; #define glQueryCounter glad_glQueryCounter typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 *params); GLAPI PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; #define glGetQueryObjecti64v glad_glGetQueryObjecti64v typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 *params); GLAPI PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; #define glGetQueryObjectui64v glad_glGetQueryObjectui64v typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); GLAPI PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; #define glVertexAttribDivisor glad_glVertexAttribDivisor typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); GLAPI PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; #define glVertexAttribP1ui glad_glVertexAttribP1ui typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); GLAPI PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; #define glVertexAttribP1uiv glad_glVertexAttribP1uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); GLAPI PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; #define glVertexAttribP2ui glad_glVertexAttribP2ui typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); GLAPI PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; #define glVertexAttribP2uiv glad_glVertexAttribP2uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); GLAPI PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; #define glVertexAttribP3ui glad_glVertexAttribP3ui typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); GLAPI PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; #define glVertexAttribP3uiv glad_glVertexAttribP3uiv typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); GLAPI PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; #define glVertexAttribP4ui glad_glVertexAttribP4ui typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); GLAPI PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; #define glVertexAttribP4uiv glad_glVertexAttribP4uiv typedef void (APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP2UIPROC glad_glVertexP2ui; #define glVertexP2ui glad_glVertexP2ui typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; #define glVertexP2uiv glad_glVertexP2uiv typedef void (APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP3UIPROC glad_glVertexP3ui; #define glVertexP3ui glad_glVertexP3ui typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; #define glVertexP3uiv glad_glVertexP3uiv typedef void (APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); GLAPI PFNGLVERTEXP4UIPROC glad_glVertexP4ui; #define glVertexP4ui glad_glVertexP4ui typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); GLAPI PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; #define glVertexP4uiv glad_glVertexP4uiv typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; #define glTexCoordP1ui glad_glTexCoordP1ui typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; #define glTexCoordP1uiv glad_glTexCoordP1uiv typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; #define glTexCoordP2ui glad_glTexCoordP2ui typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; #define glTexCoordP2uiv glad_glTexCoordP2uiv typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; #define glTexCoordP3ui glad_glTexCoordP3ui typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; #define glTexCoordP3uiv glad_glTexCoordP3uiv typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; #define glTexCoordP4ui glad_glTexCoordP4ui typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; #define glTexCoordP4uiv glad_glTexCoordP4uiv typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); GLAPI PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; #define glMultiTexCoordP1ui glad_glMultiTexCoordP1ui typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; #define glMultiTexCoordP1uiv glad_glMultiTexCoordP1uiv typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); GLAPI PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; #define glMultiTexCoordP2ui glad_glMultiTexCoordP2ui typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; #define glMultiTexCoordP2uiv glad_glMultiTexCoordP2uiv typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); GLAPI PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; #define glMultiTexCoordP3ui glad_glMultiTexCoordP3ui typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; #define glMultiTexCoordP3uiv glad_glMultiTexCoordP3uiv typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); GLAPI PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; #define glMultiTexCoordP4ui glad_glMultiTexCoordP4ui typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); GLAPI PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; #define glMultiTexCoordP4uiv glad_glMultiTexCoordP4uiv typedef void (APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); GLAPI PFNGLNORMALP3UIPROC glad_glNormalP3ui; #define glNormalP3ui glad_glNormalP3ui typedef void (APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); GLAPI PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; #define glNormalP3uiv glad_glNormalP3uiv typedef void (APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); GLAPI PFNGLCOLORP3UIPROC glad_glColorP3ui; #define glColorP3ui glad_glColorP3ui typedef void (APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); GLAPI PFNGLCOLORP3UIVPROC glad_glColorP3uiv; #define glColorP3uiv glad_glColorP3uiv typedef void (APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); GLAPI PFNGLCOLORP4UIPROC glad_glColorP4ui; #define glColorP4ui glad_glColorP4ui typedef void (APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); GLAPI PFNGLCOLORP4UIVPROC glad_glColorP4uiv; #define glColorP4uiv glad_glColorP4uiv typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); GLAPI PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; #define glSecondaryColorP3ui glad_glSecondaryColorP3ui typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint *color); GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; #define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv #endif #ifdef __cplusplus } #endif #endif
[ "tho.collerton@gmail.com" ]
tho.collerton@gmail.com
53e741f4f9b46559f08b705b080cc7b7b002118c
78eccdfc7f8b57b6eee1f388cad9c19af83b569b
/lib-src/portaudio/pa_mac_core/pa_mac_core.c
4be339f4d7af3d90781dfdd2ed0a9088be8cd5ef
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
minorninth/audacity_jan_2010
e7abe8aa090df0c58c7a8525d646b77e534237d5
448fd8463b926edde503c3e51ceddba370b69910
refs/heads/master
2022-11-17T22:37:07.620225
2020-07-16T06:37:18
2020-07-16T06:37:18
280,072,933
0
0
null
null
null
null
UTF-8
C
false
false
82,162
c
/* * $Id: pa_mac_core.c,v 1.9.2.2 2004/07/07 07:28:57 dmazzoni Exp $ * pa_mac_core.c * Implementation of PortAudio for Mac OS X Core Audio * * PortAudio Portable Real-Time Audio Library * Latest Version at: http://www.portaudio.com * * Authors: Ross Bencina and Phil Burk * Copyright (c) 1999-2002 Ross Bencina and Phil Burk * * Theory of Operation * * This code uses the HAL (Hardware Access Layer) of the Apple CoreAudio library. * This is the layer closes to the hardware. * The HAL layer only supports the native HW supported sample rates. * So if the chip only supports 44100 Hz, then the HAL only supports 44100. * To provide other rates we use the handy Apple AudioConverter which provides * sample rate conversion, mono-to-stereo conversion, and buffer size adaptation. * * There are four modes of operation: * PA_MODE_OUTPUT_ONLY, * PA_MODE_INPUT_ONLY, * PA_MODE_IO_ONE_DEVICE, * PA_MODE_IO_TWO_DEVICES * * The processing pipeline for PA_MODE_IO_ONE_DEVICE is in one thread: * * PaOSX_CoreAudioIOCallback() input buffers -> RingBuffer -> input.AudioConverter -> * PortAudio callback -> output.AudioConverter -> PaOSX_CoreAudioIOCallback() output buffers * * For two separate devices, we have to use two separate callbacks. * We pass data between them using a RingBuffer FIFO. * The processing pipeline for PA_MODE_IO_TWO_DEVICES is split into two threads: * * PaOSX_CoreAudioInputCallback() input buffers -> RingBuffer * * RingBuffer -> input.AudioConverter -> * PortAudio callback -> output.AudioConverter -> PaOSX_CoreAudioIOCallback() output buffers * * License * * 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. * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that * they can be incorporated into the canonical version. * * 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. * * CHANGE HISTORY: 3.29.2001 - Phil Burk - First pass... converted from Window MME code with help from Darren. 3.30.2001 - Darren Gibbs - Added more support for dynamically querying device info. 12.7.2001 - Gord Peters - Tweaks to compile on PA V17 and OS X 10.1 2.7.2002 - Darren and Phil - fixed isInput so GetProperty works better, fixed device queries for numChannels and sampleRates, one CoreAudio device now maps to separate input and output PaDevices, audio input works if using same CoreAudio device (some HW devices make separate CoreAudio devices). 2.22.2002 - Stephane Letz - Explicit cast needed for compilation with Code Warrior 7 3.19.2002 - Phil Burk - Added paInt16, paInt8, format using new "pa_common/pa_convert.c" file. Return error if opened in mono mode cuz not supported. [Supported 10.12.2002] Add support for Pa_GetCPULoad(); Fixed timestamp in callback and Pa_StreamTime() (Thanks n++k for the advice!) Check for invalid sample rates and return an error. Check for getenv("PA_MIN_LATENCY_MSEC") to set latency externally. Better error checking for invalid channel counts and invalid devices. 3.29.2002 - Phil Burk - Fixed Pa_GetCPULoad() for small buffers. 3.31.2002 - Phil Burk - Use getrusage() instead of gettimeofday() for CPU Load calculation. 10.12.2002 - Phil Burk - Use AudioConverter to allow wide range of sample rates, and mono. Use FIFO (from pablio/rinbuffer.h) so that we can pull data through converter. Added PaOSX_FixVolumeScalar() to make iMic audible. 10.17.2002 - Phil Burk - Support full duplex between two different devices. Name internal functions PaOSX_* Dumped useless PA_MIN_LATENCY_MSEC environment variable. Use kAudioDevicePropertyStreamFormatMatch to determine max channels. 02.03.2003 - Phil Burk - always use AudioConverters so that we can adapt when format changes. Synchronize with device when format changes. TODO: */ #include <CoreServices/CoreServices.h> #include <CoreAudio/CoreAudio.h> #include <sys/time.h> #include <sys/resource.h> #include <sys/types.h> #include <unistd.h> #include <unistd.h> #include <AudioUnit/AudioUnit.h> #include <AudioToolbox/DefaultAudioOutput.h> #include <AudioToolbox/AudioConverter.h> #include "portaudio.h" #include "pa_host.h" #include "pa_trace.h" #include "ringbuffer.h" /************************************************* Constants ********/ #define SET_DEVICE_BUFFER_SIZE (1) /* To trace program, enable TRACE_REALTIME_EVENTS in pa_trace.h */ #define PA_TRACE_RUN (0) #define PA_TRACE_START_STOP (0) #define PA_MIN_LATENCY_MSEC (20) /* FIXME */ #define MIN_TIMEOUT_MSEC (3000) #define PRINT(x) { printf x; fflush(stdout); } #define PRINT_ERR( msg, err ) PRINT(( msg ": error = 0x%0lX = '%s'\n", (err), ErrorToString(err)) ) #define DBUG(x) /* PRINT(x) */ #define DBUGBACK(x) /* if( sMaxBackgroundErrorMessages-- > 0 ) PRINT(x) */ #define DBUGX(x) // define value of isInput passed to CoreAudio routines #define IS_INPUT (true) #define IS_OUTPUT (false) typedef enum PaDeviceMode { PA_MODE_OUTPUT_ONLY, PA_MODE_INPUT_ONLY, PA_MODE_IO_ONE_DEVICE, PA_MODE_IO_TWO_DEVICES } PaDeviceMode; #define PA_USING_OUTPUT (pahsc->mode != PA_MODE_INPUT_ONLY) #define PA_USING_INPUT (pahsc->mode != PA_MODE_OUTPUT_ONLY) /************************************************************** * Information needed by PortAudio specific to a CoreAudio device. */ typedef struct PaHostInOut_s { AudioDeviceID audioDeviceID; /* CoreAudio specific ID */ int bytesPerUserNativeBuffer; /* User buffer size in native host format. Depends on numChannels. */ AudioConverterRef converter; void *converterBuffer; int numChannels; } PaHostInOut; /************************************************************** * Structure for internal host specific stream data. * This is allocated on a per stream basis. */ typedef struct PaHostSoundControl { PaHostInOut input; PaHostInOut output; AudioDeviceID primaryDeviceID; PaDeviceMode mode; RingBuffer ringBuffer; char *ringBufferData; Boolean formatListenerCalled; /* For measuring CPU utilization. */ struct rusage entryRusage; double inverseMicrosPerHostBuffer; /* 1/Microseconds of real-time audio per user buffer. */ } PaHostSoundControl; /************************************************************** * Structure for internal extended device info query. * There will be one or two PortAudio devices for each Core Audio device: * one input and or one output. */ typedef struct PaHostDeviceInfo { PaDeviceInfo paInfo; AudioDeviceID audioDeviceID; } PaHostDeviceInfo; /************************************************* Shared Data ********/ /* FIXME - put Mutex around this shared data. */ static int sNumPaDevices = 0; /* Total number of PaDeviceInfos */ static int sNumInputDevices = 0; /* Total number of input PaDeviceInfos */ static int sNumOutputDevices = 0; static int sNumCoreDevices = 0; static AudioDeviceID *sCoreDeviceIDs; // Array of Core AudioDeviceIDs static PaHostDeviceInfo *sDeviceInfos = NULL; static int sDefaultInputDeviceID = paNoDevice; static int sDefaultOutputDeviceID = paNoDevice; static int sSavedHostError = 0; static const double supportedSampleRateRange[] = { 8000.0, 96000.0 }; /* FIXME - go to double HW rate. */ static const char sMapperSuffixInput[] = " - Input"; static const char sMapperSuffixOutput[] = " - Output"; /* Debug support. */ //static int sMaxBackgroundErrorMessages = 100; //static int sCoverageCounter = 1; // used to check code coverage during validation static char *FourCharCode2Str(unsigned int code) { static char str[5]; str[0] = (char)((code & 0xFF000000) >> 24); str[1] = (char)((code & 0xFF0000) >> 16); str[2] = (char)((code & 0xFF00) >> 8); str[3] = (char)((code & 0xFF)); str[4] = 0; return str; } /* We index the input devices first, then the output devices. */ #define LOWEST_INPUT_DEVID (0) #define HIGHEST_INPUT_DEVID (sNumInputDevices - 1) #define LOWEST_OUTPUT_DEVID (sNumInputDevices) #define HIGHEST_OUTPUT_DEVID (sNumPaDevices - 1) /************************************************* Macros ********/ /************************************************* Prototypes **********/ static PaError PaOSX_QueryDevices( void ); static int PaOSX_ScanDevices( Boolean isInput ); static int PaOSX_QueryDeviceInfo( PaHostDeviceInfo *hostDeviceInfo, int coreDeviceIndex, Boolean isInput ); static PaDeviceID PaOSX_QueryDefaultInputDevice( void ); static PaDeviceID PaOSX_QueryDefaultOutputDevice( void ); static void PaOSX_CalcHostBufferSize( internalPortAudioStream *past ); static OSStatus PAOSX_DevicePropertyListener (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void* inClientData); /**********************************************************************/ /* OS X errors are 4 character ID that can be printed. * Note that uses a static pad so result must be printed immediately. */ static OSStatus statusText[2] = { 0, 0 }; static const char *ErrorToString( OSStatus err ) { const char *str; switch (err) { case kAudioHardwareUnspecifiedError: str = "kAudioHardwareUnspecifiedError"; break; case kAudioHardwareNotRunningError: str = "kAudioHardwareNotRunningError"; break; case kAudioHardwareUnknownPropertyError: str = "kAudioHardwareUnknownPropertyError"; break; case kAudioDeviceUnsupportedFormatError: str = "kAudioDeviceUnsupportedFormatError"; break; case kAudioHardwareBadPropertySizeError: str = "kAudioHardwareBadPropertySizeError"; break; case kAudioHardwareIllegalOperationError: str = "kAudioHardwareIllegalOperationError"; break; default: statusText[0] = err; str = (const char *)statusText; break; } return str; } /**********************************************************************/ static unsigned long RoundUpToNextPowerOf2( unsigned long n ) { long numBits = 0; if( ((n-1) & n) == 0) return n; /* Already Power of two. */ while( n > 0 ) { n= n>>1; numBits++; } return (1<<numBits); } /********************************* BEGIN CPU UTILIZATION MEASUREMENT ****/ static void Pa_StartUsageCalculation( internalPortAudioStream *past ) { PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; if( pahsc == NULL ) return; /* Query user CPU timer for usage analysis and to prevent overuse of CPU. */ getrusage( RUSAGE_SELF, &pahsc->entryRusage ); } static long SubtractTime_AminusB( struct timeval *timeA, struct timeval *timeB ) { long secs = timeA->tv_sec - timeB->tv_sec; long usecs = secs * 1000000; usecs += (timeA->tv_usec - timeB->tv_usec); return usecs; } /****************************************************************************** ** Measure fractional CPU load based on real-time it took to calculate ** buffers worth of output. */ static void Pa_EndUsageCalculation( internalPortAudioStream *past ) { struct rusage currentRusage; long usecsElapsed; double newUsage; #define LOWPASS_COEFFICIENT_0 (0.95) #define LOWPASS_COEFFICIENT_1 (0.99999 - LOWPASS_COEFFICIENT_0) PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; if( pahsc == NULL ) return; if( getrusage( RUSAGE_SELF, &currentRusage ) == 0 ) { usecsElapsed = SubtractTime_AminusB( &currentRusage.ru_utime, &pahsc->entryRusage.ru_utime ); /* Use inverse because it is faster than the divide. */ newUsage = usecsElapsed * pahsc->inverseMicrosPerHostBuffer; past->past_Usage = (LOWPASS_COEFFICIENT_0 * past->past_Usage) + (LOWPASS_COEFFICIENT_1 * newUsage); } } /****************************************** END CPU UTILIZATION *******/ /************************************************************************/ static PaDeviceID PaOSX_QueryDefaultInputDevice( void ) { OSStatus err = noErr; UInt32 count; int i; AudioDeviceID tempDeviceID = kAudioDeviceUnknown; PaDeviceID defaultDeviceID = paNoDevice; // get the default output device for the HAL // it is required to pass the size of the data to be returned count = sizeof(tempDeviceID); err = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultInputDevice, &count, (void *) &tempDeviceID); if (err != noErr) goto error; // scan input devices to see which one matches this device defaultDeviceID = paNoDevice; for( i=LOWEST_INPUT_DEVID; i<=HIGHEST_INPUT_DEVID; i++ ) { DBUG(("PaOSX_QueryDefaultInputDevice: i = %d, aDevId = %ld\n", i, sDeviceInfos[i].audioDeviceID )); if( sDeviceInfos[i].audioDeviceID == tempDeviceID ) { defaultDeviceID = i; break; } } error: return defaultDeviceID; } /************************************************************************/ static PaDeviceID PaOSX_QueryDefaultOutputDevice( void ) { OSStatus err = noErr; UInt32 count; int i; AudioDeviceID tempDeviceID = kAudioDeviceUnknown; PaDeviceID defaultDeviceID = paNoDevice; // get the default output device for the HAL // it is required to pass the size of the data to be returned count = sizeof(tempDeviceID); err = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultOutputDevice, &count, (void *) &tempDeviceID); if (err != noErr) goto error; // scan output devices to see which one matches this device defaultDeviceID = paNoDevice; for( i=LOWEST_OUTPUT_DEVID; i<=HIGHEST_OUTPUT_DEVID; i++ ) { DBUG(("PaOSX_QueryDefaultOutputDevice: i = %d, aDevId = %ld\n", i, sDeviceInfos[i].audioDeviceID )); if( sDeviceInfos[i].audioDeviceID == tempDeviceID ) { defaultDeviceID = i; break; } } error: return defaultDeviceID; } /******************************************************************/ static PaError PaOSX_QueryDevices( void ) { OSStatus err = noErr; UInt32 outSize; Boolean outWritable; int numBytes; // find out how many Core Audio devices there are, if any outSize = sizeof(outWritable); err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &outSize, &outWritable); if (err != noErr) { PRINT_ERR("Couldn't get info about list of audio devices", err); sSavedHostError = err; return paHostError; } // calculate the number of device available sNumCoreDevices = outSize / sizeof(AudioDeviceID); // Bail if there aren't any devices if (sNumCoreDevices < 1) { PRINT(("No Devices Available")); return paHostError; } // make space for the devices we are about to get sCoreDeviceIDs = (AudioDeviceID *)malloc(outSize); // get an array of AudioDeviceIDs err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &outSize, (void *)sCoreDeviceIDs); if (err != noErr) { PRINT_ERR("Couldn't get list of audio device IDs", err); sSavedHostError = err; return paHostError; } // Allocate structures to hold device info pointers. // There will be a maximum of two Pa devices per Core Audio device, input and/or output. numBytes = sNumCoreDevices * 2 * sizeof(PaHostDeviceInfo); sDeviceInfos = (PaHostDeviceInfo *) PaHost_AllocateFastMemory( numBytes ); if( sDeviceInfos == NULL ) return paInsufficientMemory; // Scan all the Core Audio devices to see which support input and allocate a // PaHostDeviceInfo structure for each one. DBUG(("PaOSX_QueryDevices: scan for input ======================\n")); PaOSX_ScanDevices( IS_INPUT ); sNumInputDevices = sNumPaDevices; // Now scan all the output devices. DBUG(("PaOSX_QueryDevices: scan for output ======================\n")); PaOSX_ScanDevices( IS_OUTPUT ); sNumOutputDevices = sNumPaDevices - sNumInputDevices; // Figure out which of the devices that we scanned is the default device. sDefaultInputDeviceID = PaOSX_QueryDefaultInputDevice(); sDefaultOutputDeviceID = PaOSX_QueryDefaultOutputDevice(); return paNoError; } /*************************************************************************/ /* Query a device for its sample rate. * @return positive rate or 0.0 on error. */ static Float64 PaOSX_GetDeviceSampleRate( AudioDeviceID deviceID, Boolean isInput ) { OSStatus err = noErr; AudioStreamBasicDescription formatDesc; UInt32 dataSize; dataSize = sizeof(formatDesc); err = AudioDeviceGetProperty( deviceID, 0, isInput, kAudioDevicePropertyStreamFormat, &dataSize, &formatDesc); if( err != noErr ) return 0.0; else return formatDesc.mSampleRate; } /*************************************************************************/ /* Allocate a string containing the device name. */ static char *PaOSX_DeviceNameFromID(AudioDeviceID deviceID, Boolean isInput ) { OSStatus err = noErr; UInt32 outSize; Boolean outWritable; char *deviceName = nil; // query size of name err = AudioDeviceGetPropertyInfo(deviceID, 0, isInput, kAudioDevicePropertyDeviceName, &outSize, &outWritable); if (err == noErr) { deviceName = (char*)malloc( outSize + 1); if( deviceName ) { err = AudioDeviceGetProperty(deviceID, 0, isInput, kAudioDevicePropertyDeviceName, &outSize, deviceName); if (err != noErr) PRINT_ERR("Couldn't get audio device name", err); } } return deviceName; } /************************************************************************* ** Scan all of the Core Audio devices to see which support selected ** input or output mode. ** Changes sNumDevices, and fills in sDeviceInfos. */ static int PaOSX_ScanDevices( Boolean isInput ) { int coreDeviceIndex; int result; PaHostDeviceInfo *hostDeviceInfo; int numAdded = 0; for( coreDeviceIndex=0; coreDeviceIndex<sNumCoreDevices; coreDeviceIndex++ ) { // try to fill in next PaHostDeviceInfo hostDeviceInfo = &sDeviceInfos[sNumPaDevices]; result = PaOSX_QueryDeviceInfo( hostDeviceInfo, coreDeviceIndex, isInput ); DBUG(("PaOSX_ScanDevices: paDevId = %d, coreDevId = %d\n", sNumPaDevices, coreDeviceIndex )); if( result > 0 ) { sNumPaDevices += 1; // bump global counter if we got one numAdded += 1; } else if( result < 0 ) return result; } return numAdded; } /************************************************************************* ** Try to fill in the device info for this device. ** Return 1 if a good device that PA can use. ** Return 0 if not appropriate ** or return negative error. ** */ static int PaOSX_QueryDeviceInfo( PaHostDeviceInfo *hostDeviceInfo, int coreDeviceIndex, Boolean isInput ) { AudioStreamBasicDescription *allStreamFormats; AudioStreamBasicDescription formatDesc; OSStatus err; UInt32 outSize; Boolean outWritable; AudioDeviceID devID; int numStreamFormats; int maxChannels; int i; PaDeviceInfo *deviceInfo = &hostDeviceInfo->paInfo; deviceInfo->structVersion = 1; deviceInfo->maxInputChannels = 0; deviceInfo->maxOutputChannels = 0; deviceInfo->sampleRates = supportedSampleRateRange; // because we use sample rate converter to get continuous rates deviceInfo->numSampleRates = -1; devID = sCoreDeviceIDs[ coreDeviceIndex ]; hostDeviceInfo->audioDeviceID = devID; DBUG(("PaOSX_QueryDeviceInfo: name = %s\n", PaOSX_DeviceNameFromID( devID, isInput ))); DBUG(("PaOSX_QueryDeviceInfo: coreDeviceIndex = %d, devID = %d, isInput = %d\n", coreDeviceIndex, devID, isInput )); // Get data format info from the device. outSize = sizeof(formatDesc); err = AudioDeviceGetProperty(devID, 0, isInput, kAudioDevicePropertyStreamFormat, &outSize, &formatDesc); // This just may not be an appropriate device for input or output so leave quietly. if( (err != noErr) || (formatDesc.mChannelsPerFrame == 0) ) goto error; DBUG(("PaOSX_QueryDeviceInfo: mFormatID = %4s\n", &formatDesc.mFormatID)); DBUG(("PaOSX_QueryDeviceInfo: mFormatFlags = 0x%x\n", formatDesc.mFormatFlags)); DBUG(("PaOSX_QueryDeviceInfo: kLinearPCMFormatFlagIsFloat = 0x%x\n", kLinearPCMFormatFlagIsFloat)); // dmazzoni: all OS X devices support the float32 format. When we open the // device, if it isn't in this format, we will change it at that point. deviceInfo->nativeSampleFormats = paFloat32; // Determine maximum number of channels supported by looping through // all possible supported stream formats outSize = 0; err = AudioDeviceGetPropertyInfo( devID, 0, isInput, kAudioDevicePropertyStreamFormats, &outSize, &outWritable ); allStreamFormats = (AudioStreamBasicDescription *)malloc(outSize); numStreamFormats = outSize / sizeof(AudioStreamBasicDescription); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyStreamFormats, &outSize, allStreamFormats); DBUG(("%d supported formats!\n", numStreamFormats)); maxChannels = 0; for(i=0; i<numStreamFormats; i++) { DBUG(("Format %d: formatID=%4s flags=0x%x channels=%d rate=%.0f\n", i, &allStreamFormats[i].mFormatID, allStreamFormats[i].mFormatFlags, allStreamFormats[i].mChannelsPerFrame, allStreamFormats[i].mSampleRate)); if (allStreamFormats[i].mChannelsPerFrame > maxChannels) maxChannels = allStreamFormats[i].mChannelsPerFrame; } free(allStreamFormats); #if 0 memset( &formatDesc, 0, sizeof(formatDesc)); formatDesc.mChannelsPerFrame = 256; // FIXME - what about device with > 256 channels formatDesc.mFormatID = kAudioFormatLinearPCM; formatDesc.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsBigEndian | kAudioFormatFlagIsPacked; outSize = sizeof(formatDesc); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyStreamFormatMatch, &outSize, &formatDesc); if( err != noErr ) { PRINT_ERR("PaOSX_QueryDeviceInfo: Could not get device format match", err); sSavedHostError = err; return paHostError; } #endif if( isInput ) { deviceInfo->maxInputChannels = maxChannels; } else { deviceInfo->maxOutputChannels = maxChannels; } // Get the device name deviceInfo->name = PaOSX_DeviceNameFromID( devID, isInput ); return 1; DBUG(("\n")); error: return 0; } /**********************************************************************/ static PaError PaOSX_MaybeQueryDevices( void ) { if( sNumPaDevices == 0 ) { return PaOSX_QueryDevices(); } return 0; } static char zeroPad[256] = { 0 }; /********************************************************************** ** This is the proc that supplies the data to the AudioConverterFillBuffer call. ** We can pass back arbitrarily sized blocks so if the FIFO region is split ** just pass back the first half. */ static OSStatus PaOSX_InputConverterCallbackProc (AudioConverterRef inAudioConverter, UInt32* outDataSize, void** outData, void* inUserData) { internalPortAudioStream *past = (internalPortAudioStream *) inUserData; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; void *dataPtr1; long size1; void *dataPtr2; long size2; /* Pass contiguous region from FIFO directly to converter. */ RingBuffer_GetReadRegions( &pahsc->ringBuffer, *outDataSize, &dataPtr1, &size1, &dataPtr2, &size2 ); if( size1 > 0 ) { *outData = dataPtr1; *outDataSize = size1; RingBuffer_AdvanceReadIndex( &pahsc->ringBuffer, size1 ); DBUGX(("PaOSX_InputConverterCallbackProc: read %ld bytes from FIFO.\n", size1 )); } else { DBUGBACK(("PaOSX_InputConverterCallbackProc: got no data!\n")); *outData = zeroPad; /* Give it zero data to keep it happy. */ *outDataSize = sizeof(zeroPad); } return noErr; } /***************************************************************************** ** Get audio input, if any, from passed in buffer, or from converter or from FIFO, ** then run PA callback and output data. */ static OSStatus PaOSX_LoadAndProcess( internalPortAudioStream *past, void *inputBuffer, void *outputBuffer ) { OSStatus err = noErr; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; if( past->past_StopSoon ) { if( outputBuffer ) { /* Clear remainder of audio buffer if we are waiting for stop. */ AddTraceMessage("PaOSX_LoadAndProcess: zero rest of wave buffer ", i ); memset( outputBuffer, 0, pahsc->output.bytesPerUserNativeBuffer ); } } else { /* Do we need data from the converted input? */ if( PA_USING_INPUT ) { UInt32 size = pahsc->input.bytesPerUserNativeBuffer; err = AudioConverterFillBuffer( pahsc->input.converter, PaOSX_InputConverterCallbackProc, past, &size, pahsc->input.converterBuffer); if( err != noErr ) return err; inputBuffer = pahsc->input.converterBuffer; } /* Fill part of audio converter buffer by converting input to user format, * calling user callback, then converting output to native format. */ if( PaConvert_Process( past, inputBuffer, outputBuffer )) { past->past_StopSoon = 1; } } return err; } /***************************************************************************** ** This is the proc that supplies the data to the AudioConverterFillBuffer call */ static OSStatus PaOSX_OutputConverterCallbackProc (AudioConverterRef inAudioConverter, UInt32* outDataSize, void** outData, void* inUserData) { internalPortAudioStream *past = (internalPortAudioStream *) inUserData; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; *outData = pahsc->output.converterBuffer; *outDataSize = pahsc->output.bytesPerUserNativeBuffer; return PaOSX_LoadAndProcess ( past, pahsc->input.converterBuffer, pahsc->output.converterBuffer ); } /********************************************************************** ** Fill any available output buffers and use any available ** input buffers by calling user callback. ** Will set past->past_StopSoon if user callback indicates that it is finished. */ static OSStatus PaOSX_HandleInputOutput( internalPortAudioStream *past, const AudioBufferList* inInputData, AudioBufferList* outOutputData ) { OSStatus err = noErr; char *inputNativeBufferfPtr = NULL; char *outputNativeBufferfPtr = NULL; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; /* If we are using output, then we need an empty output buffer. */ if( outOutputData->mNumberBuffers > 0 ) { outputNativeBufferfPtr = (char*)outOutputData->mBuffers[0].mData; } if( inInputData->mNumberBuffers > 0 ) { inputNativeBufferfPtr = (char*)inInputData->mBuffers[0].mData; /* Write to FIFO here if we are only using this callback. */ if( (pahsc->mode == PA_MODE_INPUT_ONLY) || (pahsc->mode == PA_MODE_IO_ONE_DEVICE) ) { long writeRoom = RingBuffer_GetWriteAvailable( &pahsc->ringBuffer ); long numBytes = inInputData->mBuffers[0].mDataByteSize; if( numBytes <= writeRoom ) { RingBuffer_Write( &pahsc->ringBuffer, inputNativeBufferfPtr, numBytes ); DBUGBACK(("PaOSX_HandleInputOutput: wrote %ld bytes to FIFO.\n", inInputData->mBuffers[0].mDataByteSize)); } // FIXME else drop samples on floor, remember overflow??? } } if( pahsc->mode == PA_MODE_INPUT_ONLY ) { /* Generate user buffers as long as we have a half full input FIFO. */ long halfSize = pahsc->ringBuffer.bufferSize / 2; while( (RingBuffer_GetReadAvailable( &pahsc->ringBuffer ) >= halfSize) && (past->past_StopSoon == 0) ) { err = PaOSX_LoadAndProcess ( past, NULL, NULL ); if( err != noErr ) goto error; } } else { UInt32 size = outOutputData->mBuffers[0].mDataByteSize; err = AudioConverterFillBuffer( pahsc->output.converter, PaOSX_OutputConverterCallbackProc, past, &size, outputNativeBufferfPtr); if( err != noErr ) { PRINT_ERR("PaOSX_HandleInputOutput: AudioConverterFillBuffer failed", err); goto error; } } error: return err; } /****************************************************************** * This callback is used when two separate devices are used for input and output. * This often happens when using USB devices which present as two devices: input and output. * It just writes its data to a FIFO so that it can be read by the main callback * proc PaOSX_CoreAudioIOCallback(). */ static OSStatus PaOSX_CoreAudioInputCallback (AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* contextPtr) { internalPortAudioStream *past = (internalPortAudioStream *) contextPtr; PaHostSoundControl *pahsc; pahsc = (PaHostSoundControl *) past->past_DeviceData; /* If there is a FIFO for input then write to it. */ if( pahsc->ringBufferData != NULL ) { long writeRoom = RingBuffer_GetWriteAvailable( &pahsc->ringBuffer ); long numBytes = inInputData->mBuffers[0].mDataByteSize; if( numBytes <= writeRoom ) { RingBuffer_Write( &pahsc->ringBuffer, inInputData->mBuffers[0].mData, inInputData->mBuffers[0].mDataByteSize ); } else { DBUGBACK(("PaOSX_CoreAudioInputCallback: FIFO too full to write!\n")); } } return noErr; } /****************************************************************** * This is the primary callback for CoreAudio. * It can handle input and/or output for a single device. * It takes input from CoreAudio, converts it and passes it to the * PortAudio user callback. Then takes the PA results and passes it * back to CoreAudio. */ static OSStatus PaOSX_CoreAudioIOCallback (AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* contextPtr) { OSStatus err = noErr; internalPortAudioStream *past; PaHostSoundControl *pahsc; past = (internalPortAudioStream *) contextPtr; pahsc = (PaHostSoundControl *) past->past_DeviceData; /* Has someone asked us to abort by calling Pa_AbortStream()? */ if( past->past_StopNow ) { past->past_IsActive = 0; /* Will cause thread to return. */ } /* Has someone asked us to stop by calling Pa_StopStream() * OR has a user callback returned '1' to indicate finished. */ else if( past->past_StopSoon ) { // FIXME - Pretend all done. Should wait for audio to play out but CoreAudio latency very low. past->past_IsActive = 0; /* Will cause thread to return. */ } else { /* use time stamp from CoreAudio if valid */ /* dmazzoni: this is unreliable! if( inOutputTime->mFlags & kAudioTimeStampSampleTimeValid) { past->past_FrameCount = inOutputTime->mSampleTime; } else if( inInputTime->mFlags & kAudioTimeStampSampleTimeValid) { past->past_FrameCount = inInputTime->mSampleTime; } */ /* Measure CPU load. */ Pa_StartUsageCalculation( past ); past->past_NumCallbacks += 1; /* Process full input buffer and fill up empty output buffers. */ err = PaOSX_HandleInputOutput( past, inInputData, outOutputData ); Pa_EndUsageCalculation( past ); } if( err != 0 ) DBUG(("PaOSX_CoreAudioIOCallback: returns %ld.\n", err )); return err; } /*******************************************************************/ /** Attempt to set device sample rate. * This is not critical because we use an AudioConverter but we may * get better fidelity if we can avoid resampling. * * Only set format once because some devices take time to settle. * Return flag indicating whether format changed so we know whether to wait * for DevicePropertyListener to get called. * * @return negative error, zero if no change, or one if changed successfully. */ static PaError PaOSX_SetFormat( AudioDeviceID devID, Boolean isInput, double desiredRate, int desiredNumChannels ) { AudioStreamBasicDescription origDesc; AudioStreamBasicDescription formatDesc; AudioStreamID *streams; PaError result = 0; OSStatus err; Boolean outWritable; UInt32 outSize; UInt32 dataSize; UInt32 supportsMixing; Float64 originalRate; int originalChannels; int numStreams; pid_t hog_pid; pid_t this_pid = getpid(); int did_set_hog_mode = 0; int i; /* Get current device format. This is critical because if we pass * zeros for unspecified fields then the iMic device gets switched to a 16 bit * integer format!!! I don't know if this is a Mac bug or not. But it only * started happening when I upgraded from OS X V10.1 to V10.2 (Jaguar). */ dataSize = sizeof(formatDesc); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyStreamFormat, &dataSize, &formatDesc); if( err != noErr ) { PRINT_ERR("PaOSX_SetFormat: Could not get format.", err); sSavedHostError = err; return paHostError; } origDesc = formatDesc; originalRate = origDesc.mSampleRate; originalChannels = origDesc.mChannelsPerFrame; // Is it already set to the correct format? if( (originalRate != desiredRate) || (originalChannels != desiredNumChannels) || (origDesc.mFormatID != kAudioFormatLinearPCM) || (origDesc.mFormatFlags & kLinearPCMFormatFlagIsFloat)==0 ) { if (originalRate != desiredRate) DBUG(("PaOSX_SetFormat: try to change sample rate to %f.\n", desiredRate )); if (originalChannels != desiredNumChannels) DBUG(("PaOSX_SetFormat: try to set number of channels to %d\n", desiredNumChannels)); if (formatDesc.mFormatID != kAudioFormatLinearPCM) DBUG(("PaOSX_SetFormat: try to set formatID to linear PCM\n")); if ((formatDesc.mFormatFlags & kLinearPCMFormatFlagIsFloat)==0) DBUG(("PaOSX_SetFormat: try to set formatFlags to float32\n")); // First we try to grab hog mode on the device, because otherwise it won't let // us change the format. -dmazzoni DBUG(("Checking hog mode\n")); outSize = sizeof(hog_pid); err = AudioDeviceGetProperty(devID, 0, isInput, kAudioDevicePropertyHogMode, &outSize, &hog_pid); if (!err) { DBUG(("Current status of hog mode: pid=%d this_pid=%d\n", (int)hog_pid, (int)this_pid)); if (hog_pid != this_pid) { hog_pid = this_pid; err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioDevicePropertyHogMode, sizeof(hog_pid), &hog_pid); if (!err) { DBUG(("Successfully set hog mode - new pid=%d!\n", (int)hog_pid)); err = AudioDeviceGetProperty(devID, 0, isInput, kAudioDevicePropertyHogMode, &outSize, &hog_pid); if (!err) { DBUG(("Checking new status of hog mode: pid=%d this_pid=%d\n", (int)hog_pid, (int)this_pid)); did_set_hog_mode = 1; } } } } // Get a list of the device's streams err = AudioDeviceGetPropertyInfo( devID, 0, isInput, kAudioDevicePropertyStreams, &outSize, &outWritable ); streams = (AudioStreamID *)malloc(outSize); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyStreams, &outSize, streams); // If that was successful, loop through each stream and set its format to // linear PCM float. if (err) { DBUG(("Couldn't get device's streams! err=%d\n", err)); } else { numStreams = outSize / sizeof(AudioStreamID); for(i=0; i<numStreams; i++) { memset(&formatDesc, 0, sizeof(AudioStreamBasicDescription)); formatDesc.mFormatID = kAudioFormatLinearPCM; outSize = sizeof(AudioStreamBasicDescription); err = AudioDeviceGetProperty(devID, 0, isInput, kAudioStreamPropertyPhysicalFormatMatch, &outSize, &formatDesc); DBUG(("Asked for stream physical format match, got " "err=%d, rate=%1f, formatID=%s, flags=%d channels=%d\n", err, formatDesc.mSampleRate, FourCharCode2Str(formatDesc.mFormatID), formatDesc.mFormatFlags, formatDesc.mChannelsPerFrame)); if (formatDesc.mFormatID != kAudioFormatLinearPCM) { DBUG(("Couldn't even get linear PCM!\n")); } else { err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioStreamPropertyPhysicalFormat, sizeof(formatDesc), &formatDesc); if (err) { DBUG(("Could not set stream %d to linear PCM: %s (%d)\n", i, FourCharCode2Str(err), err)); } else { DBUG(("Successfully set stream %d to linear PCM\n", i)); } if (formatDesc.mSampleRate != desiredRate) { /* Let's also try to get the sample rate to match */ double origRate = formatDesc.mSampleRate; formatDesc.mSampleRate = desiredRate; err = AudioDeviceGetProperty(devID, 0, isInput, kAudioStreamPropertyPhysicalFormatMatch, &outSize, &formatDesc); if (!err && formatDesc.mFormatID == kAudioFormatLinearPCM && formatDesc.mSampleRate != origRate) { err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioStreamPropertyPhysicalFormat, sizeof(formatDesc), &formatDesc); if (!err) { DBUG(("We were able to set the sample rate to %.1f, too!\n", formatDesc.mSampleRate)); } } } } } } free(streams); // Find the closest match to the stream format that we want. memset(&formatDesc, 0, sizeof(AudioStreamBasicDescription)); formatDesc.mFormatID = kAudioFormatLinearPCM; /* formatDesc.mSampleRate = desiredRate; Since we already set the physical format, we'll definitely get the sample rate we wanted if possible. And if not, then our converter will do the sample rate conversion anyway. Either way, it doesn't help to ask for the rate we want, and it could hurt (because some devices will switch into a non-linear-PCM mode to give you the rate you want). */ /* Should this be in here? I'm not sure... (Yes, if not many devices will default to mono instead of stereo...) */ formatDesc.mChannelsPerFrame = desiredNumChannels; /* These probably don't matter... formatDesc.mBytesPerFrame = formatDesc.mChannelsPerFrame * sizeof(float); formatDesc.mBytesPerPacket = formatDesc.mBytesPerFrame * formatDesc.mFramesPerPacket; */ outSize = sizeof(AudioStreamBasicDescription); err = AudioDeviceGetProperty(devID, 0, isInput, kAudioDevicePropertyStreamFormatMatch, &outSize, &formatDesc); DBUG(("Asked for stream format match, got err=%d, rate=%1f, formatID=%s, flags=%d channels=%d\n", err, formatDesc.mSampleRate, FourCharCode2Str(formatDesc.mFormatID), formatDesc.mFormatFlags, formatDesc.mChannelsPerFrame)); // It's absolutely necessary that we get linear PCM. If not, // we must fail. if (formatDesc.mFormatID != kAudioFormatLinearPCM) { DBUG(("Couldn't even get any linear PCM format!!!\n")); result = paSampleFormatNotSupported; } else { if( formatDesc.mSampleRate == origDesc.mSampleRate && formatDesc.mChannelsPerFrame == origDesc.mChannelsPerFrame && formatDesc.mFormatID == origDesc.mFormatID && formatDesc.mFormatFlags == origDesc.mFormatFlags) { DBUG(("No need to change the device, it's already in an acceptable format\n")); result = 0; } else { DBUG(("Changing device format\n")); DBUG(("Orig: rate=%1f, formatID=%s, flags=%d channels=%d\n", origDesc.mSampleRate, FourCharCode2Str(origDesc.mFormatID), origDesc.mFormatFlags, origDesc.mChannelsPerFrame)); DBUG((" New: rate=%1f, formatID=%s, flags=%d channels=%d\n", formatDesc.mSampleRate, FourCharCode2Str(formatDesc.mFormatID), formatDesc.mFormatFlags, formatDesc.mChannelsPerFrame)); err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioDevicePropertyStreamFormat, sizeof(formatDesc), &formatDesc); if (err) { DBUG(("Error trying to change device format: %d\n", err)); if (did_set_hog_mode) result = paSampleFormatNotSupported; else result = paDeviceUnavailable; } else { DBUG(("Success!\n")); result = 1; } } } // Try to turn on mixing if possible (lets other programs play // sounds, too) if (result == 1) { supportsMixing = 1; err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioDevicePropertySupportsMixing, sizeof(UInt32), &supportsMixing); if (err) { DBUG(("Unable to turn on mixing\n")); } else { DBUG(("Turned on mixing!\n")); } } // Release hog mode if necessary if (did_set_hog_mode) { DBUG(("Releasing hog mode.\n")); hog_pid = -1; err = AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioDevicePropertyHogMode, sizeof(hog_pid), &hog_pid); if (!err) DBUG(("Hog release successful.\n")); } } return result; } /******************************************************************* * Check volume level of device. If below threshold, then set to newLevel. * Using volume instead of decibels because decibel range varies by device. */ static void PaOSX_FixVolumeScalars( AudioDeviceID devID, Boolean isInput, int numChannels, double threshold, double newLevel ) { OSStatus err = noErr; UInt32 dataSize; int iChannel; /* The master channel is 0. Left and right are channels 1 and 2. */ /* Fix volume. */ for( iChannel = 0; iChannel<=numChannels; iChannel++ ) { Float32 fdata32; dataSize = sizeof( fdata32 ); err = AudioDeviceGetProperty( devID, iChannel, isInput, kAudioDevicePropertyVolumeScalar, &dataSize, &fdata32 ); printf("devID=%d\n", devID); printf("Channel=%d input=%d volume=%f\n", iChannel, (int)isInput, fdata32); if( err == noErr ) { DBUG(("kAudioDevicePropertyVolumeScalar for channel %d = %f\n", iChannel, fdata32)); if( fdata32 <= (Float32) threshold ) { dataSize = sizeof( fdata32 ); fdata32 = (Float32) newLevel; printf("Channel=%d input=%d new volume=%f\n", iChannel, (int)isInput, fdata32); err = AudioDeviceSetProperty( devID, 0, iChannel, isInput, kAudioDevicePropertyVolumeScalar, dataSize, &fdata32 ); if( err != noErr ) { PRINT(("Warning: audio volume is very low and could not be turned up.\n")); } else { PRINT(("Volume for audio channel %d was <= %4.2f so set to %4.2f by PortAudio!\n", iChannel, threshold, newLevel )); } } } } /* Unmute if muted. */ for( iChannel = 0; iChannel<=numChannels; iChannel++ ) { UInt32 uidata32; dataSize = sizeof( uidata32 ); err = AudioDeviceGetProperty( devID, iChannel, isInput, kAudioDevicePropertyMute, &dataSize, &uidata32 ); if( err == noErr ) { DBUG(("uidata32 for channel %d = %ld\n", iChannel, uidata32)); if( uidata32 == 1 ) // muted? { dataSize = sizeof( uidata32 ); uidata32 = 0; // unmute err = AudioDeviceSetProperty( devID, 0, iChannel, isInput, kAudioDevicePropertyMute, dataSize, &uidata32 ); if( err != noErr ) { PRINT(("Warning: audio is muted and could not be unmuted!\n")); } else { PRINT(("Audio channel %d was unmuted by PortAudio!\n", iChannel )); } } } } } #if 0 static void PaOSX_DumpDeviceInfo( AudioDeviceID devID, Boolean isInput ) { OSStatus err = noErr; UInt32 dataSize; UInt32 uidata32; Float32 fdata32; AudioValueRange audioRange; dataSize = sizeof( uidata32 ); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyLatency, &dataSize, &uidata32 ); if( err != noErr ) { PRINT_ERR("Error reading kAudioDevicePropertyLatency", err); return; } PRINT(("kAudioDevicePropertyLatency = %d\n", (int)uidata32 )); dataSize = sizeof( fdata32 ); err = AudioDeviceGetProperty( devID, 1, isInput, kAudioDevicePropertyVolumeScalar, &dataSize, &fdata32 ); if( err != noErr ) { PRINT_ERR("Error reading kAudioDevicePropertyVolumeScalar", err); return; } PRINT(("kAudioDevicePropertyVolumeScalar = %f\n", fdata32 )); dataSize = sizeof( uidata32 ); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyBufferSize, &dataSize, &uidata32 ); if( err != noErr ) { PRINT_ERR("Error reading buffer size", err); return; } PRINT(("kAudioDevicePropertyBufferSize = %d bytes\n", (int)uidata32 )); dataSize = sizeof( audioRange ); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyBufferSizeRange, &dataSize, &audioRange ); if( err != noErr ) { PRINT_ERR("Error reading buffer size range", err); return; } PRINT(("kAudioDevicePropertyBufferSizeRange = %g to %g bytes\n", audioRange.mMinimum, audioRange.mMaximum )); dataSize = sizeof( uidata32 ); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyBufferFrameSize, &dataSize, &uidata32 ); if( err != noErr ) { PRINT_ERR("Error reading buffer size", err); return; } PRINT(("kAudioDevicePropertyBufferFrameSize = %d frames\n", (int)uidata32 )); dataSize = sizeof( audioRange ); err = AudioDeviceGetProperty( devID, 0, isInput, kAudioDevicePropertyBufferFrameSizeRange, &dataSize, &audioRange ); if( err != noErr ) { PRINT_ERR("Error reading buffer size range", err); return; } PRINT(("kAudioDevicePropertyBufferFrameSizeRange = %g to %g frames\n", audioRange.mMinimum, audioRange.mMaximum )); return; } #endif /*******************************************************************/ static OSStatus PAOSX_DevicePropertyListener (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void* inClientData) { PaHostSoundControl *pahsc; internalPortAudioStream *past; UInt32 dataSize; OSStatus err = noErr; AudioStreamBasicDescription userStreamFormat, hardwareStreamFormat; Boolean updateInverseMicros; Boolean updateConverter; past = (internalPortAudioStream *) inClientData; pahsc = (PaHostSoundControl *) past->past_DeviceData; DBUG(("PAOSX_DevicePropertyListener: called with propertyID = 0x%0X\n", (unsigned int) inPropertyID )); updateInverseMicros = (inDevice == pahsc->primaryDeviceID) && ((inPropertyID == kAudioDevicePropertyStreamFormat) || (inPropertyID == kAudioDevicePropertyBufferFrameSize)); updateConverter = (inPropertyID == kAudioDevicePropertyStreamFormat); // Sample rate needed for both. if( updateConverter || updateInverseMicros ) { /* Get target device format */ dataSize = sizeof(hardwareStreamFormat); err = AudioDeviceGetProperty(inDevice, 0, isInput, kAudioDevicePropertyStreamFormat, &dataSize, &hardwareStreamFormat); if( err != noErr ) { PRINT_ERR("PAOSX_DevicePropertyListener: Could not get device format", err); sSavedHostError = err; goto error; } } if( updateConverter ) { DBUG(("PAOSX_DevicePropertyListener: HW rate = %f\n", hardwareStreamFormat.mSampleRate )); DBUG(("PAOSX_DevicePropertyListener: user rate = %f\n", past->past_SampleRate )); /* Set source user format. */ memset(&userStreamFormat, 0, sizeof(AudioStreamBasicDescription)); userStreamFormat.mFormatID = kAudioFormatLinearPCM; userStreamFormat.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsBigEndian | kAudioFormatFlagIsPacked; userStreamFormat.mBitsPerChannel = 32; userStreamFormat.mSampleRate = past->past_SampleRate; // sample rate of the user synthesis code userStreamFormat.mChannelsPerFrame = (isInput) ? past->past_NumInputChannels : past->past_NumOutputChannels; // the number of channels in each frame userStreamFormat.mBytesPerFrame = userStreamFormat.mChannelsPerFrame * sizeof(float); userStreamFormat.mFramesPerPacket = 1; userStreamFormat.mBytesPerPacket = userStreamFormat.mBytesPerFrame * userStreamFormat.mFramesPerPacket; if( isInput ) { if( pahsc->input.converter != NULL ) { verify_noerr(AudioConverterDispose (pahsc->input.converter)); } // Convert from hardware format to user format. err = AudioConverterNew ( &hardwareStreamFormat, &userStreamFormat, &pahsc->input.converter ); if( err != noErr ) { PRINT_ERR("Could not create input format converter", err); sSavedHostError = err; goto error; } } else { if( pahsc->output.converter != NULL ) { verify_noerr(AudioConverterDispose (pahsc->output.converter)); } // Convert from user format to hardware format. err = AudioConverterNew ( &userStreamFormat, &hardwareStreamFormat, &pahsc->output.converter ); if( err != noErr ) { PRINT_ERR("Could not create output format converter", err); sSavedHostError = err; goto error; } } } if( updateInverseMicros ) { // Update coefficient used to calculate CPU Load based on sampleRate and bufferSize. UInt32 ioBufferSize; dataSize = sizeof(ioBufferSize); err = AudioDeviceGetProperty( inDevice, 0, isInput, kAudioDevicePropertyBufferFrameSize, &dataSize, &ioBufferSize); if( err == noErr ) { pahsc->inverseMicrosPerHostBuffer = hardwareStreamFormat.mSampleRate / (1000000.0 * ioBufferSize); } } error: pahsc->formatListenerCalled = true; return err; } /* Allocate FIFO between Device callback and Converter callback so that device can push data * and converter can pull data. */ static PaError PaOSX_CreateInputRingBuffer( internalPortAudioStream *past ) { PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; OSStatus err = noErr; UInt32 dataSize; double sampleRateRatio; long numBytes; UInt32 framesPerHostBuffer; UInt32 bytesForDevice; UInt32 bytesForUser; AudioStreamBasicDescription formatDesc; dataSize = sizeof(formatDesc); err = AudioDeviceGetProperty( pahsc->input.audioDeviceID, 0, IS_INPUT, kAudioDevicePropertyStreamFormat, &dataSize, &formatDesc); if( err != noErr ) { PRINT_ERR("PaOSX_CreateInputRingBuffer: Could not get I/O buffer size.\n", err); sSavedHostError = err; return paHostError; } // If device is delivering audio faster than being consumed then buffer must be bigger. sampleRateRatio = formatDesc.mSampleRate / past->past_SampleRate; // Get size of CoreAudio IO buffers. dataSize = sizeof(framesPerHostBuffer); err = AudioDeviceGetProperty( pahsc->input.audioDeviceID, 0, IS_INPUT, kAudioDevicePropertyBufferFrameSize, &dataSize, &framesPerHostBuffer); if( err != noErr ) { PRINT_ERR("PaOSX_CreateInputRingBuffer: Could not get I/O buffer size.\n", err); sSavedHostError = err; return paHostError; } bytesForDevice = framesPerHostBuffer * formatDesc.mChannelsPerFrame * sizeof(Float32) * 2; bytesForUser = past->past_FramesPerUserBuffer * past->past_NumInputChannels * sizeof(Float32) * 3 * sampleRateRatio; // Ring buffer should be large enough to consume audio input from device, // and to deliver a complete user buffer. numBytes = (bytesForDevice > bytesForUser) ? bytesForDevice : bytesForUser; numBytes = RoundUpToNextPowerOf2( numBytes ); DBUG(("PaOSX_CreateInputRingBuffer: FIFO numBytes = %ld\n", numBytes)); pahsc->ringBufferData = PaHost_AllocateFastMemory( numBytes ); if( pahsc->ringBufferData == NULL ) { return paInsufficientMemory; } RingBuffer_Init( &pahsc->ringBuffer, numBytes, pahsc->ringBufferData ); // make it look full at beginning RingBuffer_AdvanceWriteIndex( &pahsc->ringBuffer, numBytes ); return paNoError; } /****************************************************************** * Try to set the I/O bufferSize of the device. * Scale the size by the ratio of the sample rates so that the converter will have * enough data to operate on. */ static OSStatus PaOSX_SetDeviceBufferSize( AudioDeviceID devID, Boolean isInput, int framesPerUserBuffer, Float64 sampleRateRatio ) { UInt32 dataSize; UInt32 ioBufferSize; int scaler; scaler = (int) sampleRateRatio; if( sampleRateRatio > (Float64) scaler ) scaler += 1; DBUG(("PaOSX_SetDeviceBufferSize: buffer size scaler = %d\n", scaler )); ioBufferSize = framesPerUserBuffer * scaler; // Limit buffer size to reasonable value. if( ioBufferSize < 128 ) ioBufferSize = 128; dataSize = sizeof(ioBufferSize); return AudioDeviceSetProperty( devID, 0, 0, isInput, kAudioDevicePropertyBufferFrameSize, dataSize, &ioBufferSize); } /*******************************************************************/ static PaError PaOSX_OpenCommonDevice( internalPortAudioStream *past, PaHostInOut *inOut, Boolean isInput ) { PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; PaError result = paNoError; OSStatus err = noErr; Float64 deviceRate; /* dmazzoni: this is not needed because we use PortMixer PaOSX_FixVolumeScalars( inOut->audioDeviceID, isInput, inOut->numChannels, -0.1, 0.9 ); */ pahsc->formatListenerCalled = false; // Add listener for when format changed by other apps. DBUG(("PaOSX_OpenCommonDevice: call AudioDeviceAddPropertyListener()\n" )); err = AudioDeviceAddPropertyListener( inOut->audioDeviceID, 0, isInput, kAudioDevicePropertyStreamFormat, (AudioDevicePropertyListenerProc) PAOSX_DevicePropertyListener, past ); if (err != noErr) { return -1; // FIXME } // Only change format if current HW format is different. // Don't bother to check result because we are going to use an AudioConverter anyway. result = PaOSX_SetFormat( inOut->audioDeviceID, isInput, past->past_SampleRate, inOut->numChannels ); // Synchronize with device because format changes put some devices into unusable mode. if( result == 1 ) { const int sleepDurMsec = 10; int spinCount = MIN_TIMEOUT_MSEC / sleepDurMsec; while( !pahsc->formatListenerCalled && (spinCount > 0) ) { DBUG(("Sleeping: %d\n", spinCount)); Pa_Sleep( sleepDurMsec ); // FIXME - use a semaphore or signal spinCount--; } if( !pahsc->formatListenerCalled ) { PRINT(("PaOSX_OpenCommonDevice: timed out waiting for device format to settle.\n")); } result = 0; } // The HW device format changes are asynchronous. If the DevicePropertyListener // still hasn't been called, we call it manually here. if( inOut->converter == NULL ) { err = PAOSX_DevicePropertyListener (inOut->audioDeviceID, 0, isInput, kAudioDevicePropertyStreamFormat, past); if (err != kAudioHardwareNoError) { PRINT_ERR("PaOSX_OpenCommonDevice: PAOSX_DevicePropertyListener failed.\n", err); sSavedHostError = err; return paHostError; } } #if SET_DEVICE_BUFFER_SIZE // Try to set the I/O bufferSize of the device. { Float64 ratio; deviceRate = PaOSX_GetDeviceSampleRate( inOut->audioDeviceID, isInput ); if( deviceRate <= 0.0 ) deviceRate = past->past_SampleRate; ratio = deviceRate / past->past_SampleRate ; err = PaOSX_SetDeviceBufferSize( inOut->audioDeviceID, isInput, past->past_FramesPerUserBuffer, ratio ); if( err != noErr ) { DBUG(("PaOSX_OpenCommonDevice: Could not set I/O buffer size.\n")); } } #endif /* Allocate an input buffer because we need it between the user callback and the converter. */ inOut->converterBuffer = PaHost_AllocateFastMemory( inOut->bytesPerUserNativeBuffer ); if( inOut->converterBuffer == NULL ) { return paInsufficientMemory; } return result; } /*******************************************************************/ static PaError PaOSX_OpenInputDevice( internalPortAudioStream *past ) { PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; const PaHostDeviceInfo *hostDeviceInfo; PaError result = paNoError; DBUG(("PaOSX_OpenInputDevice: -------------\n")); if( (past->past_InputDeviceID < LOWEST_INPUT_DEVID) || (past->past_InputDeviceID > HIGHEST_INPUT_DEVID) ) { return paInvalidDeviceId; } hostDeviceInfo = &sDeviceInfos[past->past_InputDeviceID]; if( past->past_NumInputChannels > hostDeviceInfo->paInfo.maxInputChannels ) { DBUG(("Too many channels! requested: %d max: %d\n", past->past_NumInputChannels, hostDeviceInfo->paInfo.maxInputChannels)); return paInvalidChannelCount; /* Too many channels! */ } pahsc->input.numChannels = past->past_NumInputChannels; // setup PA conversion procedure result = PaConvert_SetupInput( past, paFloat32 ); result = PaOSX_OpenCommonDevice( past, &pahsc->input, IS_INPUT ); if( result != paNoError ) goto error; // Allocate a ring buffer so we can push in data from device, and pull through AudioConverter. result = PaOSX_CreateInputRingBuffer( past ); if( result != paNoError ) goto error; error: return result; } /*******************************************************************/ static PaError PaOSX_OpenOutputDevice( internalPortAudioStream *past ) { PaHostSoundControl *pahsc; const PaHostDeviceInfo *hostDeviceInfo; PaError result = paNoError; DBUG(("PaOSX_OpenOutputDevice: -------------\n")); pahsc = (PaHostSoundControl *) past->past_DeviceData; // Validate DeviceID DBUG(("PaOSX_OpenOutputDevice: deviceID = 0x%x\n", past->past_OutputDeviceID)); if( (past->past_OutputDeviceID < LOWEST_OUTPUT_DEVID) || (past->past_OutputDeviceID > HIGHEST_OUTPUT_DEVID) ) { return paInvalidDeviceId; } hostDeviceInfo = &sDeviceInfos[past->past_OutputDeviceID]; // Validate number of channels. if( past->past_NumOutputChannels > hostDeviceInfo->paInfo.maxOutputChannels ) { DBUG(("Too many channels! requested: %d max: %d\n", past->past_NumOutputChannels, hostDeviceInfo->paInfo.maxOutputChannels)); return paInvalidChannelCount; /* Too many channels! */ } pahsc->output.numChannels = past->past_NumOutputChannels; // setup conversion procedure result = PaConvert_SetupOutput( past, paFloat32 ); if( result != paNoError ) goto error; result = PaOSX_OpenCommonDevice( past, &pahsc->output, IS_OUTPUT ); if( result != paNoError ) goto error; error: return result; } /******************************************************************* * Determine how many User Buffers we can put into our CoreAudio stream buffer. * Uses: * past->past_FramesPerUserBuffer, etc. * Sets: * past->past_NumUserBuffers * pahsc->input.bytesPerUserNativeBuffer * pahsc->output.bytesPerUserNativeBuffer */ static void PaOSX_CalcHostBufferSize( internalPortAudioStream *past ) { PaHostSoundControl *pahsc = ( PaHostSoundControl *)past->past_DeviceData; // Determine number of user buffers based strictly on minimum reasonable buffer size. // We ignore the Pa_OpenStream numBuffer parameter because CoreAudio has a big // mix buffer and handles latency automatically. past->past_NumUserBuffers = Pa_GetMinNumBuffers( past->past_FramesPerUserBuffer, past->past_SampleRate ); // calculate buffer sizes in bytes pahsc->input.bytesPerUserNativeBuffer = past->past_FramesPerUserBuffer * Pa_GetSampleSize(paFloat32) * past->past_NumInputChannels; pahsc->output.bytesPerUserNativeBuffer = past->past_FramesPerUserBuffer * Pa_GetSampleSize(paFloat32) * past->past_NumOutputChannels; DBUG(("PaOSX_CalcNumHostBuffers: past_NumUserBuffers = %ld\n", past->past_NumUserBuffers )); DBUG(("PaOSX_CalcNumHostBuffers: input.bytesPerUserNativeBuffer = %d\n", pahsc->input.bytesPerUserNativeBuffer )); DBUG(("PaOSX_CalcNumHostBuffers: output.bytesPerUserNativeBuffer = %d\n", pahsc->output.bytesPerUserNativeBuffer )); } /*****************************************************************************/ /************** Internal Host API ********************************************/ /*****************************************************************************/ PaError PaHost_OpenStream( internalPortAudioStream *past ) { PaError result = paNoError; PaHostSoundControl *pahsc; Boolean useInput; Boolean useOutput; assert( past->past_Magic == PA_MAGIC ); /* Allocate and initialize host data. */ pahsc = (PaHostSoundControl *) malloc(sizeof(PaHostSoundControl)); if( pahsc == NULL ) { result = paInsufficientMemory; goto error; } memset( pahsc, 0, sizeof(PaHostSoundControl) ); past->past_DeviceData = (void *) pahsc; pahsc->primaryDeviceID = kAudioDeviceUnknown; pahsc->input.audioDeviceID = kAudioDeviceUnknown; pahsc->output.audioDeviceID = kAudioDeviceUnknown; PaOSX_CalcHostBufferSize( past ); useOutput = (past->past_OutputDeviceID != paNoDevice) && (past->past_NumOutputChannels > 0); useInput = (past->past_InputDeviceID != paNoDevice) && (past->past_NumInputChannels > 0); // Set device IDs and determine IO Device mode. if( useOutput ) { pahsc->output.audioDeviceID = sDeviceInfos[past->past_OutputDeviceID].audioDeviceID; pahsc->primaryDeviceID = pahsc->output.audioDeviceID; if( useInput ) { pahsc->input.audioDeviceID = sDeviceInfos[past->past_InputDeviceID].audioDeviceID; pahsc->mode = ( pahsc->input.audioDeviceID != pahsc->primaryDeviceID ) ? PA_MODE_IO_TWO_DEVICES : PA_MODE_IO_ONE_DEVICE; } else { pahsc->mode = PA_MODE_OUTPUT_ONLY; } } else { /* Just input, not output. */ pahsc->input.audioDeviceID = sDeviceInfos[past->past_InputDeviceID].audioDeviceID; pahsc->primaryDeviceID = pahsc->input.audioDeviceID; pahsc->mode = PA_MODE_INPUT_ONLY; } DBUG(("outputDeviceID = %ld\n", pahsc->output.audioDeviceID )); DBUG(("inputDeviceID = %ld\n", pahsc->input.audioDeviceID )); DBUG(("primaryDeviceID = %ld\n", pahsc->primaryDeviceID )); /* ------------------ OUTPUT */ if( useOutput ) { result = PaOSX_OpenOutputDevice( past ); if( result < 0 ) goto error; } /* ------------------ INPUT */ if( useInput ) { result = PaOSX_OpenInputDevice( past ); if( result < 0 ) goto error; } return result; error: PaHost_CloseStream( past ); return result; } /*************************************************************************/ PaError PaHost_StartOutput( internalPortAudioStream *past ) { return 0; } /*************************************************************************/ PaError PaHost_StartInput( internalPortAudioStream *past ) { return 0; } /*************************************************************************/ PaError PaHost_StartEngine( internalPortAudioStream *past ) { OSStatus err = noErr; PaError result = paNoError; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; past->past_StopSoon = 0; past->past_StopNow = 0; past->past_IsActive = 1; past->past_FrameCount = 0; /* If full duplex and using two separate devices then start input device. */ if( pahsc->mode == PA_MODE_IO_TWO_DEVICES ) { // Associate an IO proc with the device and pass a pointer to the audio data context err = AudioDeviceAddIOProc(pahsc->input.audioDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioInputCallback, past); if (err != noErr) { PRINT_ERR("PaHost_StartEngine: AudioDeviceAddIOProc secondary failed", err ); goto error; } // start playing sound through the device err = AudioDeviceStart(pahsc->input.audioDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioInputCallback); if (err != noErr) { PRINT_ERR("PaHost_StartEngine: AudioDeviceStart secondary failed", err ); PRINT(("The program may succeed if you run it again!\n")); goto error; } } // Associate an IO proc with the device and pass a pointer to the audio data context err = AudioDeviceAddIOProc(pahsc->primaryDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioIOCallback, past); if (err != noErr) { PRINT_ERR("PaHost_StartEngine: AudioDeviceAddIOProc primary failed", err ); goto error; } // start playing sound through the device err = AudioDeviceStart(pahsc->primaryDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioIOCallback); if (err != noErr) { PRINT_ERR("PaHost_StartEngine: AudioDeviceStart primary failed", err ); PRINT(("The program may succeed if you run it again!\n")); goto error; } return result; error: sSavedHostError = err; return paHostError; } /*************************************************************************/ PaError PaHost_StopEngine( internalPortAudioStream *past, int abort ) { OSStatus err = noErr; PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData; if( pahsc == NULL ) return paNoError; (void) abort; /* Tell background thread to stop generating more data and to let current data play out. */ past->past_StopSoon = 1; /* If aborting, tell background thread to stop NOW! */ if( abort ) past->past_StopNow = 1; past->past_IsActive = 0; #if PA_TRACE_START_STOP AddTraceMessage( "PaHost_StopOutput: pahsc_HWaveOut ", (int) pahsc->pahsc_HWaveOut ); #endif // FIXME - we should ask proc to stop instead of stopping abruptly err = AudioDeviceStop(pahsc->primaryDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioIOCallback); if (err != noErr) { goto error; } err = AudioDeviceRemoveIOProc(pahsc->primaryDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioIOCallback); if (err != noErr) goto error; /* If full duplex and using two separate devices then stop second input device. */ if( pahsc->mode == PA_MODE_IO_TWO_DEVICES ) { err = AudioDeviceStop(pahsc->input.audioDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioInputCallback); if (err != noErr) goto error; err = AudioDeviceRemoveIOProc(pahsc->input.audioDeviceID, (AudioDeviceIOProc)PaOSX_CoreAudioInputCallback); if (err != noErr) goto error; } return paNoError; error: sSavedHostError = err; return paHostError; } /*************************************************************************/ PaError PaHost_StopInput( internalPortAudioStream *past, int abort ) { return paNoError; } /*************************************************************************/ PaError PaHost_StopOutput( internalPortAudioStream *past, int abort ) { return paNoError; } /*******************************************************************/ PaError PaHost_CloseStream( internalPortAudioStream *past ) { PaHostSoundControl *pahsc; if( past == NULL ) return paBadStreamPtr; pahsc = (PaHostSoundControl *) past->past_DeviceData; if( pahsc == NULL ) return paNoError; //PaOSX_DumpDeviceInfo( sDeviceInfos[past->past_OutputDeviceID].audioDeviceID, IS_OUTPUT ); #if PA_TRACE_START_STOP AddTraceMessage( "PaHost_CloseStream: pahsc_HWaveOut ", (int) pahsc->pahsc_HWaveOut ); #endif // Stop Listener callbacks ASAP before dismantling stream. if( PA_USING_INPUT ) { AudioDeviceRemovePropertyListener( pahsc->input.audioDeviceID, 0, IS_INPUT, kAudioDevicePropertyStreamFormat, (AudioDevicePropertyListenerProc) PAOSX_DevicePropertyListener ); } if( PA_USING_OUTPUT ) { AudioDeviceRemovePropertyListener( pahsc->output.audioDeviceID, 0, IS_OUTPUT, kAudioDevicePropertyStreamFormat, (AudioDevicePropertyListenerProc) PAOSX_DevicePropertyListener ); } if( pahsc->output.converterBuffer != NULL ) { PaHost_FreeFastMemory( pahsc->output.converterBuffer, pahsc->output.bytesPerUserNativeBuffer ); } if( pahsc->input.converterBuffer != NULL ) { PaHost_FreeFastMemory( pahsc->input.converterBuffer, pahsc->input.bytesPerUserNativeBuffer ); } if( pahsc->ringBufferData != NULL ) { PaHost_FreeFastMemory( pahsc->ringBufferData, pahsc->ringBuffer.bufferSize ); } if( pahsc->output.converter != NULL ) { verify_noerr(AudioConverterDispose (pahsc->output.converter)); } if( pahsc->input.converter != NULL ) { verify_noerr(AudioConverterDispose (pahsc->input.converter)); } free( pahsc ); past->past_DeviceData = NULL; return paNoError; } /********************************************************************** ** Initialize Host dependant part of API. */ PaError PaHost_Init( void ) { return PaOSX_MaybeQueryDevices(); } /************************************************************************* ** Cleanup device info. */ PaError PaHost_Term( void ) { int i; if( sDeviceInfos != NULL ) { for( i=0; i<sNumPaDevices; i++ ) { if( sDeviceInfos[i].paInfo.name != NULL ) { free( (char*)sDeviceInfos[i].paInfo.name ); } } free( sDeviceInfos ); sDeviceInfos = NULL; } sNumPaDevices = 0; return paNoError; } /************************************************************************* * Allocate memory that can be accessed in real-time. * This may need to be held in physical memory so that it is not * paged to virtual memory. * This call MUST be balanced with a call to PaHost_FreeFastMemory(). */ void *PaHost_AllocateFastMemory( long numBytes ) { void *addr = malloc( numBytes ); /* FIXME - do we need physical memory, not virtual memory? */ if( addr != NULL ) memset( addr, 0, numBytes ); return addr; } /************************************************************************* * Free memory that could be accessed in real-time. * This call MUST be balanced with a call to PaHost_AllocateFastMemory(). */ void PaHost_FreeFastMemory( void *addr, long numBytes ) { if( addr != NULL ) free( addr ); } /***********************************************************************/ PaError PaHost_StreamActive( internalPortAudioStream *past ) { PaHostSoundControl *pahsc; if( past == NULL ) return paBadStreamPtr; pahsc = (PaHostSoundControl *) past->past_DeviceData; if( pahsc == NULL ) return paInternalError; return (PaError) past->past_IsActive; } /*****************************************************************************/ /************** External User API ********************************************/ /*****************************************************************************/ /********************************************************************** ** Query devices and use result. */ PaDeviceID Pa_GetDefaultInputDeviceID( void ) { PaError result = PaOSX_MaybeQueryDevices(); if( result < 0 ) return result; return sDefaultInputDeviceID; } PaDeviceID Pa_GetDefaultOutputDeviceID( void ) { PaError result = PaOSX_MaybeQueryDevices(); if( result < 0 ) return result; return sDefaultOutputDeviceID; } /************************************************************************* ** Determine minimum number of buffers required for this host based ** on minimum latency. Because CoreAudio manages latency, this just selects ** a reasonably small number of buffers. */ int Pa_GetMinNumBuffers( int framesPerBuffer, double framesPerSecond ) { int minBuffers; double denominator; int minLatencyMsec = PA_MIN_LATENCY_MSEC; denominator = 1000.0 * framesPerBuffer; minBuffers = (int) (((minLatencyMsec * framesPerSecond) + denominator - 1) / denominator ); if( minBuffers < 1 ) minBuffers = 1; return minBuffers; } /*************************************************************************/ void Pa_Sleep( long msec ) { usleep( msec * 1000 ); } /*************************************************************************/ PaTimestamp Pa_StreamTime( PortAudioStream *stream ) { AudioTimeStamp timeStamp; PaTimestamp streamTime; PaHostSoundControl *pahsc; internalPortAudioStream *past = (internalPortAudioStream *) stream; if( past == NULL ) return paBadStreamPtr; pahsc = (PaHostSoundControl *) past->past_DeviceData; /* dmazzoni: this is unreliable AudioDeviceGetCurrentTime(pahsc->primaryDeviceID, &timeStamp); streamTime = ( timeStamp.mFlags & kAudioTimeStampSampleTimeValid) ? timeStamp.mSampleTime : past->past_FrameCount; */ return past->past_FrameCount; return streamTime; } /************************************************************************************/ long Pa_GetHostError() { return sSavedHostError; } /*************************************************************************/ int Pa_CountDevices() { if( sNumPaDevices <= 0 ) Pa_Initialize(); return sNumPaDevices; } /************************************************************************* ** PaDeviceInfo structures have already been created ** so just return the pointer. ** */ const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID id ) { if( id < 0 || id >= sNumPaDevices ) return NULL; return &sDeviceInfos[id].paInfo; }
[ "" ]
19cd60de49419a3cf5ee9345e67a2c0131bbe2d0
f0e2df670e69d9a6ee6500bada82622bd8e888fc
/ext/phalcon/mvc/viewbaseinterface.zep.c
bef481ba4bbeef902f3909a40a8064e8bed2698d
[ "BSD-3-Clause", "Zend-2.0" ]
permissive
wl6179/cphalcon
25824301614d5cb46d5374b8b729f98e6ce35e73
a66c99e924aa986687cd21efb651b2f47b06fc74
refs/heads/master
2018-12-22T12:57:24.771374
2018-12-20T01:59:28
2018-12-20T01:59:28
119,639,692
1
0
NOASSERTION
2018-09-30T18:43:57
2018-01-31T05:32:17
PHP
UTF-8
C
false
true
1,683
c
#ifdef HAVE_CONFIG_H #include "../../ext_config.h" #endif #include <php.h> #include "../../php_ext.h" #include "../../ext.h" #include <Zend/zend_exceptions.h> #include "kernel/main.h" /** * Phalcon\Mvc\ViewInterface * * Interface for Phalcon\Mvc\View and Phalcon\Mvc\View\Simple */ ZEPHIR_INIT_CLASS(Phalcon_Mvc_ViewBaseInterface) { ZEPHIR_REGISTER_INTERFACE(Phalcon\\Mvc, ViewBaseInterface, phalcon, mvc_viewbaseinterface, phalcon_mvc_viewbaseinterface_method_entry); return SUCCESS; } /** * Sets views directory. Depending of your platform, always add a trailing slash or backslash */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setViewsDir); /** * Gets views directory */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getViewsDir); /** * Adds parameters to views (alias of setVar) */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setParamToView); /** * Adds parameters to views * * @param string key * @param mixed value */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setVar); /** * Returns parameters to views */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getParamsToView); /** * Returns the cache instance used to cache */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getCache); /** * Cache the actual view render to certain level */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, cache); /** * Externally sets the view content */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, setContent); /** * Returns cached output from another view stage */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, getContent); /** * Renders a partial view */ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewBaseInterface, partial);
[ "gutierrezandresfelipe@gmail.com" ]
gutierrezandresfelipe@gmail.com
0fb42b248cc3465dab0bd00249af94487e5a12f5
0f3ffae87ae98b7c57ec5023d92acf326cc02603
/lab6/source/main.c
9b9b1bf1ae6824c0eeff6937862dc3ee70c74870
[]
no_license
kotooriiii/CS120B_Lab6_SyncSM
70a19271be20aaccde1854dedbda46bd6efd619a
0eedc9ecf3c3907d8f625ddeeddca1f7bf93586c
refs/heads/master
2023-04-16T04:56:47.876000
2021-04-30T00:09:04
2021-04-30T00:09:04
362,302,066
0
0
null
null
null
null
UTF-8
C
false
false
3,824
c
/* Author: Carlos Miranda cmira039@ucr.edu * Partner(s) Name: n/a * Lab Section: 23 * Assignment: Lab #6 Exercise #3 * Exercise Description: [optional - include for your own benefit] * * I acknowledge all content contained herein, excluding template or example * code, is my own original work. * * Demo Link: */ #include <avr/io.h> #include <avr/interrupt.h> #ifdef _SIMULATE_ #include "simAVRHeader.h" #endif enum CounterType { INIT, WAIT_MAIN, INC, DEC, RESET, WAIT_INC, WAIT_DEC, WAIT_RESET} COUNTER_TYPE; unsigned char TEMPC = 0x00; unsigned char waitCounter = 0x00; unsigned const char maxWaitCounter = 0x0A; unsigned char IPINA() { return ~PINA; } unsigned char isA0() { return IPINA() & 0x01; } unsigned char isA1() { return IPINA() & 0x02; } /* Time start */ volatile unsigned char TimerFlag = 0; unsigned long _avr_timer_M = 1; unsigned long _avr_timer_cntcurr = 0; void TimerISR() { TimerFlag = 1; } void TimerOff() { TCCR1B = 0x00; } void TimerOn() { TCCR1B = 0x0B; OCR1A = 125; TIMSK1 = 0x02; TCNT1 = 0; _avr_timer_cntcurr = _avr_timer_M; SREG |= 0x80; } ISR(TIMER1_COMPA_vect) { _avr_timer_cntcurr--; if(_avr_timer_cntcurr == 0) { TimerISR(); _avr_timer_cntcurr = _avr_timer_M; } } void TimerSet(unsigned long M) { _avr_timer_M = M; _avr_timer_cntcurr = _avr_timer_M; } /* Time end */ void tickCounter() { switch(COUNTER_TYPE) { case INIT: COUNTER_TYPE = WAIT_MAIN; break; case WAIT_MAIN: if(!isA0() && !isA1()) { COUNTER_TYPE = WAIT_MAIN; } else if(isA0() && !isA1()) { COUNTER_TYPE = INC; } else if(!isA0() && isA1()) { COUNTER_TYPE = DEC; } else if(isA0() && isA1()){ COUNTER_TYPE = RESET; } break; case INC: if(isA0() && isA1()) { COUNTER_TYPE = RESET; break; } COUNTER_TYPE = WAIT_INC; break; case WAIT_INC: if(isA0() && isA1()) { COUNTER_TYPE = RESET; } else if(isA0() && !isA1()) { COUNTER_TYPE = WAIT_INC; } else{ COUNTER_TYPE = WAIT_MAIN; } break; case DEC: if(isA0() && isA1()) { COUNTER_TYPE = RESET; break; } COUNTER_TYPE = WAIT_DEC; break; case WAIT_DEC: if(isA0() && isA1()) { COUNTER_TYPE = RESET; } else if(!isA0() && isA1()) { COUNTER_TYPE = WAIT_DEC; } else { COUNTER_TYPE = WAIT_MAIN; } break; case RESET: COUNTER_TYPE = WAIT_RESET; break; case WAIT_RESET: if(isA0() && isA1()) { COUNTER_TYPE = WAIT_RESET; } else { COUNTER_TYPE = WAIT_MAIN; } break; default: COUNTER_TYPE = INIT; break; } switch(COUNTER_TYPE) { case INIT: waitCounter = 0x00; TEMPC = 0x07; PORTC = TEMPC; break; case WAIT_MAIN: waitCounter = 0x00; break; case INC: waitCounter = 0x00; if(TEMPC < 0x09) { TEMPC = TEMPC + 1; PORTC = TEMPC; } break; case WAIT_INC: if(waitCounter >= maxWaitCounter) { if(TEMPC < 0x09) { TEMPC = TEMPC + 1; PORTC = TEMPC; } waitCounter = 0x00; } else { waitCounter++; } break; case DEC: waitCounter = 0x00; if(TEMPC > 0x00) { TEMPC = TEMPC - 1; PORTC = TEMPC; } break; case WAIT_DEC: if(waitCounter >= maxWaitCounter) { if(TEMPC > 0x00) { TEMPC = TEMPC - 1; PORTC = TEMPC; } waitCounter = 0x00; } else { waitCounter++; } break; case RESET: TEMPC = 0x00; PORTC = TEMPC; waitCounter = 0x00; break; case WAIT_RESET: waitCounter = 0x00; break; default: break; } } int main(void) { //Inputs DDRA = 0x00; PORTA = 0xFF; //Outputs DDRC = 0xFF; PORTC = 0x00; COUNTER_TYPE = INIT; TEMPC = 0x07; PORTC = TEMPC; TimerSet(100); TimerOn(); while(1) { tickCounter(); while(!TimerFlag); TimerFlag = 0; } return 1; }
[ "carlosmiranda0643@hotmail.com" ]
carlosmiranda0643@hotmail.com
a5948aa034633c10014f10b276473125e92d0027
d25ed4f74abd95bf8f7e6dba52a7a7c2eca2f0ea
/src/deemon/fs/native_fs.c
6946e584c8c5a695a774e2d850b2ea4e199742d5
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
GrieferAtWork/deemon-legacy-
95a83dee1b261a94caa95eba0a17f741958037c9
4b79f9c4dec76292f40f072c3a601683cfc4bd58
refs/heads/master
2021-07-14T19:26:58.952725
2017-10-16T09:33:17
2017-10-16T09:33:17
null
0
0
null
null
null
null
UTF-8
C
false
false
3,252
c
/* Copyright (c) 2016 - deemon by Griefer@Work * * * * 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 GUARD_DEEMON_FS_NATIVE_FS_C #define GUARD_DEEMON_FS_NATIVE_FS_C 1 #define DEE_LIMITED_API 1 #include <deemon/__conf.inl> #include <deemon/fs/native_fs.h> DEE_DECL_BEGIN DEE_DECL_END #ifndef __INTELLISENSE__ #include "native_fs.chdir.c.inl" #include "native_fs.chmod.c.inl" #include "native_fs.chown.c.inl" #include "native_fs.copy.c.inl" #include "native_fs.delenv.c.inl" #include "native_fs.enumenv.c.inl" #include "native_fs.exists.c.inl" #include "native_fs.getcwd.c.inl" #include "native_fs.getenv.c.inl" #include "native_fs.gethome.c.inl" #include "native_fs.getmod.c.inl" #include "native_fs.getown.c.inl" #include "native_fs.gettimes.c.inl" #include "native_fs.gettmp.c.inl" #include "native_fs.getuserhome.c.inl" #include "native_fs.hasenv.c.inl" #include "native_fs.hasproperty.c.inl" #include "native_fs.isabs.c.inl" #include "native_fs.isblockdev.c.inl" #include "native_fs.ischardev.c.inl" #include "native_fs.isdir.c.inl" #include "native_fs.isdrive.c.inl" #include "native_fs.isexecutable.c.inl" #include "native_fs.isfifo.c.inl" #include "native_fs.isfile.c.inl" #include "native_fs.ishidden.c.inl" #include "native_fs.islink.c.inl" #include "native_fs.ismount.c.inl" #include "native_fs.issocket.c.inl" #include "native_fs.link.c.inl" #include "native_fs.mkdir.c.inl" #include "native_fs.move.c.inl" #include "native_fs.open.c.inl" #include "native_fs.opendir.c.inl" #include "native_fs.readlink.c.inl" #include "native_fs.remove.c.inl" #include "native_fs.rmdir.c.inl" #include "native_fs.setenv.c.inl" #include "native_fs.settimes.c.inl" #include "native_fs.unlink.c.inl" #endif #endif /* !GUARD_DEEMON_FS_NATIVE_FS_H */
[ "sagebar@web.de" ]
sagebar@web.de
f5ac22bca029b56281167909018acdec2617c21d
a556c07ecfa1031dae46fd3433762941ceca68b1
/newbiequest/wudang/milin/milin5.c
108a9fce3670db4efe83a96b388b12d8d780adca
[]
no_license
yqzcabao/pkuxkx-utf8
53c3c24f4e3a9125372bca72b6a4b10aa6293a7f
0eaf237c9970795a51aa4cc04b5b762003300cbd
refs/heads/main
2023-04-01T21:16:23.894845
2021-04-09T13:33:24
2021-04-09T13:33:24
null
0
0
null
null
null
null
UTF-8
C
false
false
645
c
// milin5.c 密林 // seagate@pkuxkx 路径动态更新 inherit ROOM; void create() { set("short", "密林"); set("long", "林中阴森森的,除了几声鸟叫外再没有其他的声音,四周\n" "都是参天大树,遮天蔽日。脚下是厚厚的落叶,看不出有什么\n" "人迹,显得格外怕人。\n" ); set("exits", ([ "north" : __DIR__"milin2", "west" : __DIR__"milin1", "east" : __DIR__"milin1", ])); set("outdoors", "wudang"); set("dynroom/type",1); //1为动态房间,0为固定房间 set("no_clean_up",1); setup(); } void reset() { ::reset(); set("no_clean_up",1); }
[ "i@oiuv.cn" ]
i@oiuv.cn
da098ca35bcc6b55376402d60e673ec6fc3635c1
b71b8bd385c207dffda39d96c7bee5f2ccce946c
/testcases/CWE427_Uncontrolled_Search_Path_Element/CWE427_Uncontrolled_Search_Path_Element__char_environment_17.c
4717581c29fe88df7165dd320f947b8543bc7118
[]
no_license
Sporknugget/Juliet_prep
e9bda84a30bdc7938bafe338b4ab2e361449eda5
97d8922244d3d79b62496ede4636199837e8b971
refs/heads/master
2023-05-05T14:41:30.243718
2021-05-25T16:18:13
2021-05-25T16:18:13
369,334,230
0
0
null
null
null
null
UTF-8
C
false
false
2,893
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE427_Uncontrolled_Search_Path_Element__char_environment_17.c Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml Template File: sources-sink-17.tmpl.c */ /* * @description * CWE: 427 Uncontrolled Search Path Element * BadSource: environment Read input from an environment variable * GoodSource: Use a hardcoded path * Sink: * BadSink : Set the environment variable * Flow Variant: 17 Control flow: for loops * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define NEW_PATH "%SystemRoot%\\system32" #define PUTENV _putenv #else #define NEW_PATH "/bin" #define PUTENV putenv #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #ifndef OMITBAD void CWE427_Uncontrolled_Search_Path_Element__char_environment_17_bad() { char * data; char dataBuffer[250] = "PATH="; data = dataBuffer; { { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 250-dataLen-1); } } } /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */ PUTENV(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() - use goodsource and badsink by changing the conditions on the for statements */ static void goodG2B() { char * data; char dataBuffer[250] = "PATH="; data = dataBuffer; { /* FIX: Set the path as the "system" path */ strcat(data, NEW_PATH); } /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */ PUTENV(data); } void CWE427_Uncontrolled_Search_Path_Element__char_environment_17_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE427_Uncontrolled_Search_Path_Element__char_environment_17_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE427_Uncontrolled_Search_Path_Element__char_environment_17_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "jaredzap@rams.colostate.edu" ]
jaredzap@rams.colostate.edu
b729de6e077f4c643e5da6d06219ccdc552c70cf
1b8ae277ef7f39af15b6e0bff057c433dc44a109
/src/mame/drivers/segas18.c
9915bba1e46f8d6a6e313c6dcecabe90fa6cfc35
[]
no_license
ilitirit-za/ShmupMame-unofficial
2ea58e7674df935c98e73d34ca888152b82c570d
2ddd533fbaceac256cf0fbc2f918de1966280a22
refs/heads/master
2021-01-11T02:07:06.094952
2016-10-24T11:17:30
2016-10-24T11:17:30
70,804,668
3
0
null
2016-10-21T13:17:50
2016-10-13T12:35:08
C
UTF-8
C
false
false
114,862
c
/*************************************************************************** Sega System 18 hardware **************************************************************************** Copyright Aaron Giles 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 'MAME' 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 AARON GILES ''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 AARON GILES 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. **************************************************************************** Known bugs: * lghost sprites seem to be slightly out of sync * vdp gfx on 2nd attract level of lghost are corrupt at top of stairs after attract mode loops * pauses in lghost where all sprites vanish * some minor gfx bugs in moonwalker (see mametesters) **************************************************************************** ** MC68000 + Z80 ** 2xYM3438 + Custom PCM ** ** Alien Storm ** Bloxeed ** Clutch Hitter ** D.D. Crew ** Laser Ghost ** Michael Jackson's Moonwalker ** Shadow Dancer ** Wally wo Sagase! (Where's Wally?) ***************************************************************************/ #include "emu.h" #include "machine/segaic16.h" #include "machine/nvram.h" #include "includes/segas18.h" #include "sound/2612intf.h" #include "sound/rf5c68.h" #include "includes/segaipt.h" /************************************* * * Memory mapping tables * *************************************/ void segas18_state::memory_mapper(sega_315_5195_mapper_device &mapper, UINT8 index) { UINT32 romsize = m_maincpu->region()->bytes(); switch (index) { case 7: mapper.map_as_handler(0x00000, 0x04000, 0xffc000, read16_delegate(FUNC(segas18_state::misc_io_r), this), write16_delegate(FUNC(segas18_state::misc_io_w), this)); break; case 6: mapper.map_as_ram(0x00000, 0x01000, 0xfff000, "paletteram", write16_delegate(FUNC(segas18_state::paletteram_w), this)); break; case 5: mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas18_state::legacy_wrapper<segaic16_tileram_0_w>), this)); mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas18_state::legacy_wrapper<segaic16_textram_0_w>), this)); break; case 4: mapper.map_as_ram(0x00000, 0x00800, 0xfff800, "sprites", write16_delegate()); break; case 3: mapper.map_as_ram(0x00000, 0x04000, 0xffc000, "workram", write16_delegate()); break; case 2: switch (m_romboard) { case ROM_BOARD_171_SHADOW: break; // ??? case ROM_BOARD_171_5874: case ROM_BOARD_171_5987: mapper.map_as_handler(0x00000, 0x00010, 0xfffff0, read16_delegate(FUNC(segas18_state::genesis_vdp_r), this), write16_delegate(FUNC(segas18_state::genesis_vdp_w), this)); break; default: assert(false); } break; case 1: switch (m_romboard) { case ROM_BOARD_171_SHADOW: mapper.map_as_handler(0x00000, 0x00010, 0xfffff0, read16_delegate(FUNC(segas18_state::genesis_vdp_r), this), write16_delegate(FUNC(segas18_state::genesis_vdp_w), this)); break; case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", 0x80000, write16_delegate()); break; case ROM_BOARD_171_5987: if (romsize <= 0x100000) mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom1base", 0x80000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); else mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom1base",0x100000, write16_delegate(FUNC(segas18_state::rom_5987_bank_w), this)); break; default: assert(false); } break; case 0: switch (m_romboard) { case ROM_BOARD_171_SHADOW: case ROM_BOARD_171_5874: mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", 0x00000, write16_delegate()); break; case ROM_BOARD_171_5987: if (romsize <= 0x100000) mapper.map_as_rom(0x00000, 0x80000, 0xf80000, "rom0base", 0x00000, write16_delegate()); else mapper.map_as_rom(0x00000,0x100000, 0xf00000, "rom0base", 0x00000, write16_delegate()); break; default: assert(false); } break; } } /************************************* * * Configuration * *************************************/ UINT8 segas18_state::mapper_sound_r() { return m_mcu_data; } void segas18_state::mapper_sound_w(UINT8 data) { soundlatch_write(data & 0xff); m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } void segas18_state::init_generic(segas18_rom_board rom_board) { // set the ROM board m_romboard = rom_board; // configure the NVRAM to point to our workram m_nvram->set_base(m_workram, m_workram.bytes()); // point globals to allocated memory regions segaic16_tileram_0 = reinterpret_cast<UINT16 *>(memshare("tileram")->ptr()); segaic16_textram_0 = reinterpret_cast<UINT16 *>(memshare("textram")->ptr()); // save state save_item(NAME(m_mcu_data)); save_item(NAME(m_lghost_value)); save_item(NAME(m_lghost_select)); save_item(NAME(m_misc_io_data)); save_item(NAME(m_wwally_last_x)); save_item(NAME(m_wwally_last_y)); } /************************************* * * Initialization & interrupts * *************************************/ void segas18_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TID_INITIAL_BOOST: machine().scheduler().boost_interleave(attotime::zero, attotime::from_msec(10)); break; } } void segas18_state::machine_reset() { segaic16_tilemap_reset(machine(), 0); megadriv_reset_vdp(machine()); genvdp_use_cram = 1; // if we are running with a real live 8751, we need to boost the interleave at startup if (m_mcu != NULL && m_mcu->type() == I8751) synchronize(TID_INITIAL_BOOST); } /************************************* * * I/O space * *************************************/ READ16_MEMBER( segas18_state::io_chip_r ) { static const char *const portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" }; offset &= 0x1f/2; switch (offset) { // I/O ports case 0x00/2: case 0x02/2: case 0x04/2: case 0x06/2: case 0x08/2: case 0x0a/2: case 0x0c/2: case 0x0e/2: // if the port is configured as an output, return the last thing written if (m_misc_io_data[0x1e/2] & (1 << offset)) return m_misc_io_data[offset]; // otherwise, return an input port return ioport(portnames[offset])->read(); // 'SEGA' protection case 0x10/2: return 'S'; case 0x12/2: return 'E'; case 0x14/2: return 'G'; case 0x16/2: return 'A'; // CNT register & mirror case 0x18/2: case 0x1c/2: return m_misc_io_data[0x1c/2]; // port direction register & mirror case 0x1a/2: case 0x1e/2: return m_misc_io_data[0x1e/2]; } return 0xffff; } WRITE16_MEMBER( segas18_state::io_chip_w ) { // generic implementation offset &= 0x1f/2; UINT8 old = m_misc_io_data[offset]; m_misc_io_data[offset] = data; switch (offset) { // I/O ports case 0x00/2: case 0x02/2: case 0x04/2: case 0x08/2: case 0x0a/2: case 0x0c/2: if (m_has_guns) { // outputs for lghost only output_set_value("P1_Gun_Recoil",(~data & 0x01)); output_set_value("P2_Gun_Recoil",(~data & 0x02)>>1); output_set_value("P3_Gun_Recoil",(~data & 0x04)>>2); } break; // miscellaneous output case 0x06/2: set_grayscale(~data & 0x40); segaic16_tilemap_set_flip(machine(), 0, data & 0x20); m_sprites->set_flip(data & 0x20); // These are correct according to cgfm's docs, but mwalker and ddcrew both // enable the lockout and never turn it off // coin_lockout_w(machine(), 1, data & 0x08); // coin_lockout_w(machine(), 0, data & 0x04); coin_counter_w(machine(), 1, data & 0x02); coin_counter_w(machine(), 0, data & 0x01); break; // tile banking case 0x0e/2: if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW) for (int i = 0; i < 4; i++) { segaic16_tilemap_set_bank(machine(), 0, 0 + i, (data & 0xf) * 4 + i); segaic16_tilemap_set_bank(machine(), 0, 4 + i, ((data >> 4) & 0xf) * 4 + i); } break; // CNT register case 0x1c/2: segaic16_set_display_enable(machine(), data & 2); if ((old ^ data) & 4) set_vdp_enable(data & 4); break; } } READ16_MEMBER( segas18_state::misc_io_r ) { static const char *const portnames[] = { "SERVICE", "COINAGE" }; offset &= 0x1fff; switch (offset & (0x3000/2)) { // I/O chip case 0x0000/2: case 0x1000/2: return io_chip_r(space, offset, mem_mask); // video control latch case 0x2000/2: return ioport(portnames[offset & 1])->read(); } if (!m_custom_io_r.isnull()) return m_custom_io_r(space, offset, mem_mask); logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } WRITE16_MEMBER( segas18_state::misc_io_w ) { offset &= 0x1fff; switch (offset & (0x3000/2)) { // I/O chip case 0x0000/2: case 0x1000/2: if (ACCESSING_BITS_0_7) { io_chip_w(space, offset, data, mem_mask); return; } break; // video control latch case 0x2000/2: if (ACCESSING_BITS_0_7) { set_vdp_mixing(data & 0xff); return; } break; } if (!m_custom_io_w.isnull()) { m_custom_io_w(space, offset, data, mem_mask); return; } logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } /************************************* * * Tile banking * *************************************/ WRITE16_MEMBER( segas18_state::rom_5987_bank_w ) { if (!ACCESSING_BITS_0_7) return; offset &= 0xf; data &= 0xff; // tile banking if (offset < 8) { int maxbanks = machine().gfx[0]->elements() / 1024; if (data >= maxbanks) data %= maxbanks; segaic16_tilemap_set_bank(machine(), 0, offset, data); } // sprite banking else { int maxbanks = memregion("sprites")->bytes() / 0x40000; if (data >= maxbanks) data = 255; m_sprites->set_bank((offset - 8) * 2 + 0, data * 2 + 0); m_sprites->set_bank((offset - 8) * 2 + 1, data * 2 + 1); } } /************************************* * * D.D.Crew Custom I/O * *************************************/ READ16_MEMBER( segas18_state::ddcrew_custom_io_r ) { switch (offset) { case 0x3020/2: return ioport("P3")->read(); case 0x3022/2: return ioport("P4")->read(); case 0x3024/2: return ioport("P34START")->read(); } return open_bus_r(space, 0, mem_mask); } /************************************* * * Laser Ghost Custom I/O * *************************************/ READ16_MEMBER( segas18_state::lghost_custom_io_r ) { UINT16 result; switch (offset) { case 0x3010/2: case 0x3012/2: case 0x3014/2: case 0x3016/2: result = m_lghost_value | 0x7f; m_lghost_value <<= 1; return result; } return open_bus_r(space, 0, mem_mask); } WRITE16_MEMBER( segas18_state::lghost_custom_io_w ) { switch (offset) { case 0x3010/2: m_lghost_value = 255 - ioport("GUNY1")->read(); break; case 0x3012/2: m_lghost_value = ioport("GUNX1")->read(); break; case 0x3014/2: m_lghost_value = 255 - ioport(m_lghost_select ? "GUNY3" : "GUNY2")->read(); break; case 0x3016/2: m_lghost_value = ioport(m_lghost_select ? "GUNX3" : "GUNX2")->read(); break; case 0x3020/2: m_lghost_select = data & 1; break; } } /************************************* * * Where's Wally Custom I/O * *************************************/ READ16_MEMBER( segas18_state::wwally_custom_io_r ) { switch (offset) { case 0x3000/2: return (ioport("TRACKX1")->read() - m_wwally_last_x[0]) & 0xff; case 0x3004/2: return (ioport("TRACKY1")->read() - m_wwally_last_y[0]) & 0xff; case 0x3008/2: return (ioport("TRACKX2")->read() - m_wwally_last_x[1]) & 0xff; case 0x300c/2: return (ioport("TRACKY2")->read() - m_wwally_last_y[1]) & 0xff; case 0x3010/2: return (ioport("TRACKX3")->read() - m_wwally_last_x[2]) & 0xff; case 0x3014/2: return (ioport("TRACKY3")->read() - m_wwally_last_y[2]) & 0xff; } return open_bus_r(space, 0, mem_mask); } WRITE16_MEMBER( segas18_state::wwally_custom_io_w ) { switch (offset) { case 0x3000/2: case 0x3004/2: m_wwally_last_x[0] = ioport("TRACKX1")->read(); m_wwally_last_y[0] = ioport("TRACKY1")->read(); break; case 0x3008/2: case 0x300c/2: m_wwally_last_x[1] = ioport("TRACKX2")->read(); m_wwally_last_y[1] = ioport("TRACKY2")->read(); break; case 0x3010/2: case 0x3014/2: m_wwally_last_x[2] = ioport("TRACKX3")->read(); m_wwally_last_y[2] = ioport("TRACKY3")->read(); break; } } /************************************* * * Sound handlers * *************************************/ WRITE8_MEMBER( segas18_state::soundbank_w ) { membank("bank1")->set_base(memregion("soundcpu")->base() + 0x10000 + 0x2000 * data); } WRITE8_MEMBER( segas18_state::mcu_data_w ) { m_mcu_data = data; m_mcu->set_input_line(MCS51_INT1_LINE, HOLD_LINE); } /************************************* * * VDP memory handlers * *************************************/ READ16_MEMBER( segas18_state::genesis_vdp_r ) { return m_vdp->megadriv_vdp_r(space,offset,mem_mask); } WRITE16_MEMBER( segas18_state::genesis_vdp_w ) { m_vdp->megadriv_vdp_w(space,offset,data,mem_mask); } /************************************* * * Main CPU memory handlers * *************************************/ static ADDRESS_MAP_START( system18_map, AS_PROGRAM, 16, segas18_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0xffffff) AM_DEVREADWRITE8("mapper", sega_315_5195_mapper_device, read, write, 0x00ff) // these get overwritten by the memory mapper above, but we put them here // so they are properly allocated and tracked for saving AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_SHARE("sprites") AM_RANGE(0x200000, 0x200fff) AM_RAM AM_SHARE("paletteram") AM_RANGE(0x300000, 0x30ffff) AM_RAM AM_SHARE("tileram") AM_RANGE(0x400000, 0x400fff) AM_RAM AM_SHARE("textram") AM_RANGE(0x500000, 0x503fff) AM_RAM AM_SHARE("workram") ADDRESS_MAP_END /************************************* * * Sound CPU memory handlers * *************************************/ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segas18_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("soundcpu", 0x10000) AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE_LEGACY("rfsnd", rf5c68_w) AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE_LEGACY("rfsnd", rf5c68_mem_r, rf5c68_mem_w) AM_RANGE(0xe000, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas18_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym1", ym3438_r, ym3438_w) AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym2", ym3438_r, ym3438_w) AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(soundbank_w) AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READ(soundlatch_byte_r) AM_WRITE(mcu_data_w) ADDRESS_MAP_END /************************************* * * i8751 MCU memory handlers * *************************************/ static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, segas18_state ) ADDRESS_MAP_UNMAP_HIGH // port 2 not used for high order address byte AM_RANGE(0x0000, 0x001f) AM_MIRROR(0xff00) AM_DEVREADWRITE("mapper", sega_315_5195_mapper_device, read, write) ADDRESS_MAP_END /************************************* * * Generic port definitions * *************************************/ static INPUT_PORTS_START( system18_generic ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL PORT_START("PORTC") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("PORTD") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SERVICE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("COINAGE") SEGA_COINAGE_LOC(SW1) PORT_START("DSW") PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW2:1" ) PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW2:2" ) PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW2:3" ) PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:5" ) PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) PORT_START("PORTH") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END /************************************* * * Game-specific port definitions * *************************************/ static INPUT_PORTS_START( astorm ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("PORTC") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_MODIFY("SERVICE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4,5") PORT_DIPSETTING( 0x04, DEF_STR( Easiest ) ) PORT_DIPSETTING( 0x08, DEF_STR( Easier ) ) PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x1c, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x14, DEF_STR( Harder ) ) PORT_DIPSETTING( 0x18, DEF_STR( Hardest ) ) PORT_DIPSETTING( 0x00, "Special" ) PORT_DIPNAME( 0x20, 0x20, "Coin Chutes" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x20, "3" ) PORT_DIPSETTING( 0x00, "1" ) //"SW2:7" unused //"SW2:8" unused INPUT_PORTS_END static INPUT_PORTS_START( astorm2p ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4,5") PORT_DIPSETTING( 0x04, DEF_STR( Easiest ) ) PORT_DIPSETTING( 0x08, DEF_STR( Easier ) ) PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x1c, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x14, DEF_STR( Harder ) ) PORT_DIPSETTING( 0x18, DEF_STR( Hardest ) ) PORT_DIPSETTING( 0x00, "Special" ) PORT_DIPNAME( 0x20, 0x20, "Coin Chutes" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x20, "2" ) PORT_DIPSETTING( 0x00, "1" ) //"SW2:7" unused //"SW2:8" unused INPUT_PORTS_END static INPUT_PORTS_START( bloxeed ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("SERVICE") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x03, 0x03, "Price Type" ) PORT_DIPLOCATION("SW2:1,2") // Normal game | VS Mode PORT_DIPSETTING( 0x03, "A" ) // 1 Start / 1 Continue | 2 Start / 1 Continue PORT_DIPSETTING( 0x02, "B" ) // 1 Start / 1 Continue | 1 Start / 1 Continue PORT_DIPSETTING( 0x01, "C" ) // 2 Start / 1 Continue | 4 Start / 2 Continue PORT_DIPSETTING( 0x00, "D" ) // 2 Start / 1 Continue | 2 Start / 2 Continue //"SW2:3" unused PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x20, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) //"SW2:7" unused PORT_DIPNAME( 0x80, 0x00, "High Speed Mode" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END static INPUT_PORTS_START( cltchitr ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x0c, 0x0c, "Game Time P1" ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPSETTING( 0x04, "2 Credits 18 Outcounts 14 Min." ) PORT_DIPSETTING( 0x00, "1 Credit 6 Outcounts 7 Min." ) PORT_DIPSETTING( 0x08, "1 Credit 12 Outcounts 12 Min." ) PORT_DIPSETTING( 0x0c, "1Credit 6 Outcounts 8M./2Credits 18 Outcounts 14M." ) PORT_DIPNAME( 0x30, 0x30, "Game Time P2" ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x10, "4 Credits 18 Outcounts 16 Min." ) PORT_DIPSETTING( 0x00, "2 Credits 6 Outcounts 8 Min." ) PORT_DIPSETTING( 0x20, "2 Credits 12 Outcounts 14 Min." ) PORT_DIPSETTING( 0x30, "2Credits 6 Outcounts 8M./4Credits 18 Outcounts 16M." ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Easiest ) ) PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) INPUT_PORTS_END static INPUT_PORTS_START( ddcrew ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "Credits needed" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, "1 to start, 1 to continue" ) PORT_DIPSETTING( 0x00, "2 to start, 1 to continue" ) PORT_DIPNAME( 0x02, 0x02, "Switch to Start" ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, "Start" ) PORT_DIPSETTING( 0x00, "Attack" ) PORT_DIPNAME( 0x04, 0x04, "Coin Chute" ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x04, "Common" ) PORT_DIPSETTING( 0x00, "Individual" ) PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x30, 0x30, "Player Start/Continue" ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x30, "3/3" ) PORT_DIPSETTING( 0x20, "2/3" ) PORT_DIPSETTING( 0x10, "2/2" ) PORT_DIPSETTING( 0x00, "3/4" ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_START("P3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_START("P4") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) PORT_START("P34START") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) // individual mode PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) // individual mode PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( ddcrew2p ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "Credits needed" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, "1 to start, 1 to continue" ) PORT_DIPSETTING( 0x00, "2 to start, 1 to continue" ) PORT_DIPNAME( 0x02, 0x02, "Switch to Start" ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, "Start" ) PORT_DIPSETTING( 0x00, "Attack" ) PORT_DIPNAME( 0x04, 0x04, "Coin Chute" ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x04, "Common" ) PORT_DIPSETTING( 0x00, "Individual" ) PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x30, 0x30, "Player Start/Continue" ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x30, "3/3" ) PORT_DIPSETTING( 0x20, "2/3" ) PORT_DIPSETTING( 0x10, "2/2" ) PORT_DIPSETTING( 0x00, "3/4" ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END static INPUT_PORTS_START( desertbr ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("PORTC") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_MODIFY("SERVICE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3) // individual mode PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, "1" ) PORT_DIPSETTING( 0x00, "2" ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) //"SW2:3" unused PORT_DIPNAME( 0x08, 0x08, "Play Mode" ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x00, "2 players" ) PORT_DIPSETTING( 0x08, "3 players" ) PORT_DIPNAME( 0x10, 0x10, "Coin Chute" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x10, "Common" ) PORT_DIPSETTING( 0x00, "Individual" ) PORT_DIPNAME( 0x20, 0x20, "Start Button" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x20, "Use" ) PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END static INPUT_PORTS_START( lghost ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_MODIFY("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // P2 joystick inputs, unused in lghost PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_MODIFY("SERVICE") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4,5") PORT_DIPSETTING( 0x0c, DEF_STR( Easiest ) ) PORT_DIPSETTING( 0x14, DEF_STR( Easier ) ) PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x1c, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x04, DEF_STR( Harder ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hardest ) ) PORT_DIPSETTING( 0x00, "Extra Hardest" ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) PORT_DIPNAME( 0x40, 0x40, "Coin Chute" ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x00, "Common" ) PORT_DIPSETTING( 0x40, "Individual" ) //"SW2:8" unused PORT_START("GUNX1") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_START("GUNY1") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_START("GUNX2") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_START("GUNY2") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_START("GUNX3") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(3) PORT_START("GUNY3") PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(3) INPUT_PORTS_END static INPUT_PORTS_START( mwalk ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("PORTC") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) PORT_MODIFY("SERVICE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) // individual mode PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) // individual mode PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x00, DEF_STR( Lives) ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x04, "2" ) PORT_DIPSETTING( 0x00, "3" ) PORT_DIPNAME( 0x08, 0x00, "Player Vitality" ) PORT_DIPLOCATION("SW2:4") PORT_DIPSETTING( 0x08, DEF_STR( Low ) ) PORT_DIPSETTING( 0x00, DEF_STR( High ) ) PORT_DIPNAME( 0x10, 0x00, "Play Mode" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x10, "2 Players" ) PORT_DIPSETTING( 0x00, "3 Players" ) PORT_DIPNAME( 0x20, 0x00, "Coin Chute" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x20, "Common" ) PORT_DIPSETTING( 0x00, "Individual" ) PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x80, DEF_STR( Easy ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) INPUT_PORTS_END static INPUT_PORTS_START( mwalka ) PORT_INCLUDE( mwalk ) PORT_MODIFY("DSW") //"SW2:1" not divert from "mwalk" //"SW2:2" not divert from "mwalk" //"SW2:3" not divert from "mwalk" //"SW2:4" not divert from "mwalk" PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x00, "2 Players" ) PORT_DIPSETTING( 0x10, "3 Players" ) PORT_DIPNAME( 0x20, 0x20, "Coin Chute" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x00, "Common" ) PORT_DIPSETTING( 0x20, "Individual" ) //"SW2:7" not divert from "mwalk" //"SW2:8" not divert from "mwalk" INPUT_PORTS_END static INPUT_PORTS_START( shdancer ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPSETTING( 0x00, "2" ) PORT_DIPSETTING( 0x0c, "3" ) PORT_DIPSETTING( 0x08, "4" ) PORT_DIPSETTING( 0x04, "5" ) PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x20, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust" ) PORT_DIPLOCATION("SW2:7,8") PORT_DIPSETTING( 0x00, "2.20" ) PORT_DIPSETTING( 0x40, "2.40" ) PORT_DIPSETTING( 0xc0, "3.00" ) PORT_DIPSETTING( 0x80, "3.30" ) INPUT_PORTS_END static INPUT_PORTS_START( wwally ) PORT_INCLUDE( system18_generic ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, "Coin Chute" ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x04, "Common" ) PORT_DIPSETTING( 0x00, "Individual" ) //"SW2:4" unused //"SW2:5" unused PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,7") PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x60, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) //"SW2:8" unused PORT_START("TRACKX1") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_REVERSE PORT_START("TRACKY1") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_START("TRACKX2") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_REVERSE PORT_START("TRACKY2") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_START("TRACKX3") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_PLAYER(3) PORT_REVERSE PORT_START("TRACKY3") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(75) PORT_KEYDELTA(5) PORT_PLAYER(3) INPUT_PORTS_END /************************************* * * Graphics definitions * *************************************/ static const gfx_layout charlayout = { 8,8, RGN_FRAC(1,3), 3, { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, 8*8 }; static GFXDECODE_START( segas18 ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1024 ) GFXDECODE_END // are any of the VDP interrupt lines hooked up to anything? void genesis_vdp_sndirqline_callback_segas18(running_machine &machine, bool state) { } void genesis_vdp_lv6irqline_callback_segas18(running_machine &machine, bool state) { } void genesis_vdp_lv4irqline_callback_segas18(running_machine &machine, bool state) { } /************************************* * * Machine driver * *************************************/ static const sega315_5124_interface sms_vdp_ntsc_intf = { false, "screen", DEVCB_NULL, DEVCB_NULL, }; static MACHINE_CONFIG_START( system18, segas18_state ) // basic machine hardware MCFG_CPU_ADD("maincpu", M68000, 10000000) MCFG_CPU_PROGRAM_MAP(system18_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold) MCFG_CPU_ADD("soundcpu", Z80, 8000000) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_CPU_IO_MAP(sound_portmap) MCFG_NVRAM_ADD_0FILL("nvram") MCFG_SEGA_315_5195_MAPPER_ADD("mapper", "maincpu", segas18_state, memory_mapper, mapper_sound_r, mapper_sound_w) MCFG_DEVICE_ADD("gen_vdp", SEGA_GEN_VDP, 0) MCFG_DEVICE_CONFIG( sms_vdp_ntsc_intf ) sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, genesis_vdp_sndirqline_callback_segas18); sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, genesis_vdp_lv6irqline_callback_segas18); sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, genesis_vdp_lv4irqline_callback_segas18); sega_genesis_vdp_device::set_genesis_vdp_alt_timing(*device, 1); sega_genesis_vdp_device::set_genesis_vdp_palwrite_base(*device, 0x2000); MCFG_TIMER_ADD_SCANLINE("scantimer", megadriv_scanline_timer_callback_alt_timing, "screen", 0, 1) // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb MCFG_SCREEN_SIZE(342,262) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE_DRIVER(segas18_state, screen_update) MCFG_GFXDECODE(segas18) MCFG_PALETTE_LENGTH(2048*3+2048 + 64*3) MCFG_SEGA_SYS16B_SPRITES_ADD("sprites") // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ym1", YM3438, 8000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ADD("ym2", YM3438, 8000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MCFG_SOUND_ADD("rfsnd", RF5C68, 10000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system18_fd1094, system18 ) MCFG_CPU_REPLACE("maincpu", FD1094, 10000000) MCFG_CPU_PROGRAM_MAP(system18_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system18_fd1094_i8751, system18_fd1094 ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_VBLANK_INT(NULL, NULL) MCFG_CPU_ADD("mcu", I8751, 8000000) MCFG_CPU_IO_MAP(mcu_io_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", segas18_state, irq0_line_hold) MACHINE_CONFIG_END /************************************* * * ROM definition(s) * *************************************/ /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Alien Storm (2 players World version), Sega System 18 CPU: FD1094 (317-0154) ROM Board: 171-5873B */ ROM_START( astorm ) ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13182.a6", 0x000000, 0x40000, CRC(e31f2a1c) SHA1(690ee10c36e5bb6175470fb5564527e0e4a94d2c) ) ROM_LOAD16_BYTE( "epr-13181.a5", 0x000001, 0x40000, CRC(78cd3b26) SHA1(a81b807c5da625d8e4648ae80c41e4ca3870c0fa) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0154.key", 0x0000, 0x2000, CRC(b86b6b8f) SHA1(869405383d563a3f3842c89462a7b2e184928532) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13073.bin", 0x00000, 0x40000, CRC(df5d0a61) SHA1(79ad71de348f280bad847566c507b7a31f022292) ) ROM_LOAD( "epr-13074.bin", 0x40000, 0x40000, CRC(787afab8) SHA1(a119042bb2dad54e9733bfba4eaab0ac5fc0f9e7) ) ROM_LOAD( "epr-13075.bin", 0x80000, 0x40000, CRC(4e01b477) SHA1(4178ce4a87ea427c3b0195e64acef6cddfb3485f) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13082.bin", 0x000001, 0x40000, CRC(a782b704) SHA1(ba15bdfbc267b8d86f03e5310ce60846ff846de3) ) ROM_LOAD16_BYTE( "mpr-13089.bin", 0x000000, 0x40000, CRC(2a4227f0) SHA1(47284dce8f896f8e8eace9c20302842cacb479c1) ) ROM_LOAD16_BYTE( "mpr-13081.bin", 0x080001, 0x40000, CRC(eb510228) SHA1(4cd387b160ec7050e1300ebe708853742169e643) ) ROM_LOAD16_BYTE( "mpr-13088.bin", 0x080000, 0x40000, CRC(3b6b4c55) SHA1(970495c54b3e1893ee8060f6ca1338c2cbbd1074) ) ROM_LOAD16_BYTE( "mpr-13080.bin", 0x100001, 0x40000, CRC(e668eefb) SHA1(d4a087a238b4d3ac2d23fe148d6a73018e348a89) ) ROM_LOAD16_BYTE( "mpr-13087.bin", 0x100000, 0x40000, CRC(2293427d) SHA1(4fd07763ff060afd594e3f64fa4750577f56c80e) ) ROM_LOAD16_BYTE( "epr-13079.bin", 0x180001, 0x40000, CRC(de9221ed) SHA1(5e2e434d1aa547be1e5652fc906d2e18c5122023) ) ROM_LOAD16_BYTE( "epr-13086.bin", 0x180000, 0x40000, CRC(8c9a71c4) SHA1(40b774765ac888792aad46b6351a24b7ef40d2dc) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13083a.bin", 0x010000, 0x20000, CRC(e7528e06) SHA1(1f4e618692c20aeb316d578c5ded12440eb072ab) ) ROM_LOAD( "epr-13076.bin", 0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) ) ROM_LOAD( "epr-13077.bin", 0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) ) ROM_LOAD( "epr-13078.bin", 0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) ) ROM_END /************************************************************************************************************************** Alien Storm (3 players World version), Sega System 18 CPU: FD1094 (317-0148) ROM Board: 171-5873B Game numbers: 833-7379-02 (main pcb: 834-7381-02, rom pcb: 834-7380-02) */ ROM_START( astorm3 ) ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13165.a6", 0x000000, 0x40000, CRC(6efcd381) SHA1(547c6703a34c3b9b887f5a63ec59a7055067bf3b) ) ROM_LOAD16_BYTE( "epr-13164.a5", 0x000001, 0x40000, CRC(97d693c6) SHA1(1a9aa98b32aae9367ed897e6931b2633b11b079e) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0148.key", 0x0000, 0x2000, CRC(72e4b64a) SHA1(945580d0cf25691370e9f2056cdffc01331d54ad) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13073.bin", 0x00000, 0x40000, CRC(df5d0a61) SHA1(79ad71de348f280bad847566c507b7a31f022292) ) ROM_LOAD( "epr-13074.bin", 0x40000, 0x40000, CRC(787afab8) SHA1(a119042bb2dad54e9733bfba4eaab0ac5fc0f9e7) ) ROM_LOAD( "epr-13075.bin", 0x80000, 0x40000, CRC(4e01b477) SHA1(4178ce4a87ea427c3b0195e64acef6cddfb3485f) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13082.bin", 0x000001, 0x40000, CRC(a782b704) SHA1(ba15bdfbc267b8d86f03e5310ce60846ff846de3) ) ROM_LOAD16_BYTE( "mpr-13089.bin", 0x000000, 0x40000, CRC(2a4227f0) SHA1(47284dce8f896f8e8eace9c20302842cacb479c1) ) ROM_LOAD16_BYTE( "mpr-13081.bin", 0x080001, 0x40000, CRC(eb510228) SHA1(4cd387b160ec7050e1300ebe708853742169e643) ) ROM_LOAD16_BYTE( "mpr-13088.bin", 0x080000, 0x40000, CRC(3b6b4c55) SHA1(970495c54b3e1893ee8060f6ca1338c2cbbd1074) ) ROM_LOAD16_BYTE( "mpr-13080.bin", 0x100001, 0x40000, CRC(e668eefb) SHA1(d4a087a238b4d3ac2d23fe148d6a73018e348a89) ) ROM_LOAD16_BYTE( "mpr-13087.bin", 0x100000, 0x40000, CRC(2293427d) SHA1(4fd07763ff060afd594e3f64fa4750577f56c80e) ) ROM_LOAD16_BYTE( "epr-13079.bin", 0x180001, 0x40000, CRC(de9221ed) SHA1(5e2e434d1aa547be1e5652fc906d2e18c5122023) ) ROM_LOAD16_BYTE( "epr-13086.bin", 0x180000, 0x40000, CRC(8c9a71c4) SHA1(40b774765ac888792aad46b6351a24b7ef40d2dc) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13083.bin", 0x010000, 0x20000, CRC(5df3af20) SHA1(e49105fcfd5bf37d14bd760f6adca5ce2412883d) ) ROM_LOAD( "epr-13076.bin", 0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) ) ROM_LOAD( "epr-13077.bin", 0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) ) ROM_LOAD( "epr-13078.bin", 0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) ) ROM_END /************************************************************************************************************************** Alien Storm (3 players US version), Sega System 18 CPU: FD1094 (317-0147) */ ROM_START( astormu ) ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13095.a6", 0x000000, 0x40000, CRC(55d40742) SHA1(c30fcd7da1fe062b1f00275dc8ac79c3c619b719) ) ROM_LOAD16_BYTE( "epr-13094.a5", 0x000001, 0x40000, CRC(92b305f9) SHA1(d24a1de619d29a8f6ff9dfce455c2c7d6457ddbe) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0147.key", 0x0000, 0x2000, CRC(3fd54ba7) SHA1(2d74f44f2ed779ed2b119b4fc0bc844d90678c74) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13073.bin", 0x00000, 0x40000, CRC(df5d0a61) SHA1(79ad71de348f280bad847566c507b7a31f022292) ) ROM_LOAD( "epr-13074.bin", 0x40000, 0x40000, CRC(787afab8) SHA1(a119042bb2dad54e9733bfba4eaab0ac5fc0f9e7) ) ROM_LOAD( "epr-13075.bin", 0x80000, 0x40000, CRC(4e01b477) SHA1(4178ce4a87ea427c3b0195e64acef6cddfb3485f) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13082.bin", 0x000001, 0x40000, CRC(a782b704) SHA1(ba15bdfbc267b8d86f03e5310ce60846ff846de3) ) ROM_LOAD16_BYTE( "mpr-13089.bin", 0x000000, 0x40000, CRC(2a4227f0) SHA1(47284dce8f896f8e8eace9c20302842cacb479c1) ) ROM_LOAD16_BYTE( "mpr-13081.bin", 0x080001, 0x40000, CRC(eb510228) SHA1(4cd387b160ec7050e1300ebe708853742169e643) ) ROM_LOAD16_BYTE( "mpr-13088.bin", 0x080000, 0x40000, CRC(3b6b4c55) SHA1(970495c54b3e1893ee8060f6ca1338c2cbbd1074) ) ROM_LOAD16_BYTE( "mpr-13080.bin", 0x100001, 0x40000, CRC(e668eefb) SHA1(d4a087a238b4d3ac2d23fe148d6a73018e348a89) ) ROM_LOAD16_BYTE( "mpr-13087.bin", 0x100000, 0x40000, CRC(2293427d) SHA1(4fd07763ff060afd594e3f64fa4750577f56c80e) ) ROM_LOAD16_BYTE( "epr-13079.bin", 0x180001, 0x40000, CRC(de9221ed) SHA1(5e2e434d1aa547be1e5652fc906d2e18c5122023) ) ROM_LOAD16_BYTE( "epr-13086.bin", 0x180000, 0x40000, CRC(8c9a71c4) SHA1(40b774765ac888792aad46b6351a24b7ef40d2dc) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13083.bin", 0x010000, 0x20000, CRC(5df3af20) SHA1(e49105fcfd5bf37d14bd760f6adca5ce2412883d) ) ROM_LOAD( "epr-13076.bin", 0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) ) ROM_LOAD( "epr-13077.bin", 0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) ) ROM_LOAD( "epr-13078.bin", 0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) ) ROM_END /************************************************************************************************************************** Alien Storm, Sega System 18 CPU: FD1094 (317-0146) ROM Board: 171-5873B */ ROM_START( astormj ) ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13085.a6", 0x000000, 0x40000, CRC(15f74e2d) SHA1(30d9d099ec18907edd3d20df312565c3bd5a80de) ) ROM_LOAD16_BYTE( "epr-13084.a5", 0x000001, 0x40000, CRC(9687b38f) SHA1(cdeb5b4f06ad4ad8ca579392c1ec901487b08e76) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0146.key", 0x0000, 0x2000, CRC(e94991c5) SHA1(c9a8b56e01792654436f24b219d7a92c0852461f) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13073.bin", 0x00000, 0x40000, CRC(df5d0a61) SHA1(79ad71de348f280bad847566c507b7a31f022292) ) ROM_LOAD( "epr-13074.bin", 0x40000, 0x40000, CRC(787afab8) SHA1(a119042bb2dad54e9733bfba4eaab0ac5fc0f9e7) ) ROM_LOAD( "epr-13075.bin", 0x80000, 0x40000, CRC(4e01b477) SHA1(4178ce4a87ea427c3b0195e64acef6cddfb3485f) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13082.bin", 0x000001, 0x40000, CRC(a782b704) SHA1(ba15bdfbc267b8d86f03e5310ce60846ff846de3) ) ROM_LOAD16_BYTE( "mpr-13089.bin", 0x000000, 0x40000, CRC(2a4227f0) SHA1(47284dce8f896f8e8eace9c20302842cacb479c1) ) ROM_LOAD16_BYTE( "mpr-13081.bin", 0x080001, 0x40000, CRC(eb510228) SHA1(4cd387b160ec7050e1300ebe708853742169e643) ) ROM_LOAD16_BYTE( "mpr-13088.bin", 0x080000, 0x40000, CRC(3b6b4c55) SHA1(970495c54b3e1893ee8060f6ca1338c2cbbd1074) ) ROM_LOAD16_BYTE( "mpr-13080.bin", 0x100001, 0x40000, CRC(e668eefb) SHA1(d4a087a238b4d3ac2d23fe148d6a73018e348a89) ) ROM_LOAD16_BYTE( "mpr-13087.bin", 0x100000, 0x40000, CRC(2293427d) SHA1(4fd07763ff060afd594e3f64fa4750577f56c80e) ) ROM_LOAD16_BYTE( "epr-13079.bin", 0x180001, 0x40000, CRC(de9221ed) SHA1(5e2e434d1aa547be1e5652fc906d2e18c5122023) ) ROM_LOAD16_BYTE( "epr-13086.bin", 0x180000, 0x40000, CRC(8c9a71c4) SHA1(40b774765ac888792aad46b6351a24b7ef40d2dc) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13083.bin", 0x010000, 0x20000, CRC(5df3af20) SHA1(e49105fcfd5bf37d14bd760f6adca5ce2412883d) ) ROM_LOAD( "epr-13076.bin", 0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) ) ROM_LOAD( "epr-13077.bin", 0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) ) ROM_LOAD( "epr-13078.bin", 0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Bloxeed, Sega System 18, 834-7307 CPU: FD1094 (317-0139) ROM Board: 171-5874B */ ROM_START( bloxeed ) ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12911.a6", 0x000000, 0x20000, CRC(a481581a)SHA1(5ce5a0a082622919d2fe0e7d52ec807b2e2c25a2) ) ROM_LOAD16_BYTE( "epr-12910.a5", 0x000001, 0x20000, CRC(dd1bc3bf)SHA1(c0d79862a349ea4dac103c17325633c5dd4a93d1) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0139.key", 0x0000, 0x2000, CRC(9aae84cb)SHA1(806515d61ecacb260b2b5e5fe023b494d35ce315) ) ROM_REGION( 0x30000, "gfx1", 0 ) // tiles ROM_LOAD( "opr-12884.b1", 0x00000, 0x10000, CRC(e024aa33)SHA1(d734be240cd05031aaadf9735c0b1b00e8e6d4cb) ) ROM_LOAD( "opr-12885.b2", 0x10000, 0x10000, CRC(8041b814)SHA1(29fa49ba9a73eed07865a86ea774e2c6a60aed5b) ) ROM_LOAD( "opr-12886.b3", 0x20000, 0x10000, CRC(de32285e)SHA1(8994dc128d6a23763e5fcfca1868b336d4aa0a21) ) ROM_REGION( 0x20000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "opr-12891.a11", 0x00001, 0x10000, CRC(90d31a8c)SHA1(1747652a5109ce65add197cf06535f2463a99fdc) ) ROM_LOAD16_BYTE( "opr-12887.b11", 0x00000, 0x10000, CRC(f0c0f49d)SHA1(7ecd591265165f3149241e2ceb5059faab88360f) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-12888.a4", 0x010000, 0x20000, CRC(6f2fc63c)SHA1(3cce22c8f80013f05b5a2d36c42a61a81e4d6cbd) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Clutch Hitter, Sega System 18 CPU: FD1094 (317-0176) ROM Board: 171-5873B game No. 833-7916-01 CLUTCH HITTER rom No. 834-7917-01 */ ROM_START( cltchitr ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13794.a4", 0x00000, 0x40000, CRC(c8d80233) SHA1(69cdbb989f580abbb006820347becf8d233fa773) ) ROM_LOAD16_BYTE( "epr-13795.a6", 0x00001, 0x40000, CRC(b0b60b67) SHA1(ee3325ddb7461008f556c1696157a766225b9ef5) ) ROM_LOAD16_BYTE( "epr-13784.a5", 0x80000, 0x40000, CRC(80c8180d) SHA1(80e72ab7d97714009fd31b3d50176af84b0dcdb7) ) ROM_LOAD16_BYTE( "epr-13786.a7", 0x80001, 0x40000, CRC(3095dac0) SHA1(20edce74b6f2a82a3865613e601a0e212615d0e4) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0176.key", 0x0000, 0x2000, CRC(9b072430) SHA1(3bc1c7a6d71b4351a42d85e68e70715a7659c096) ) ROM_REGION( 0x180000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-13773.c1", 0x000000, 0x80000, CRC(3fc600e5) SHA1(8bec4ecf6a4e4b38d13133960036a5a4800a668e) ) ROM_LOAD( "mpr-13774.c2", 0x080000, 0x80000, CRC(2411a824) SHA1(0e383ccc4e0830ffb395d5102e2950610c147007) ) ROM_LOAD( "mpr-13775.c3", 0x100000, 0x80000, CRC(cf527bf6) SHA1(1f9cf1f0e92709f0465dc97ebbdaa715a419f7a7) ) ROM_REGION16_BE( 0x600000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13779.c10", 0x000001, 0x80000, CRC(c707f416) SHA1(e6a9d89849f7f1c303a3ca29a629f81397945a2d) ) ROM_LOAD16_BYTE( "mpr-13787.a10", 0x000000, 0x80000, CRC(f05c68c6) SHA1(b6a0535b6c734a0c89fdb6506c32ffe6ab3aa8cd) ) ROM_LOAD16_BYTE( "mpr-13780.c11", 0x200001, 0x80000, CRC(a4c341e0) SHA1(15a0b5a42b56465a7b7df98968cc2ed177ce6f59) ) ROM_LOAD16_BYTE( "mpr-13788.a11", 0x200000, 0x80000, CRC(0106fea6) SHA1(e16e2a469ecbbc704021dee6264db30aa0898368) ) ROM_LOAD16_BYTE( "mpr-13781.c12", 0x400001, 0x80000, CRC(f33b13af) SHA1(d3eb64dcf12d532454bf3cd6c86528c0f11ee316) ) ROM_LOAD16_BYTE( "mpr-13789.a12", 0x400000, 0x80000, CRC(09ba8835) SHA1(72e83dd1793a7f4b2b881e71f262493e3d4992b3) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13793.c7", 0x010000, 0x80000, CRC(a3d31944) SHA1(44d17aa0598eacfac4b12c8955fd1067ca09abbd) ) ROM_LOAD( "epr-13792.c6", 0x090000, 0x80000, CRC(808f9695) SHA1(d50677d20083ad56dbf0864db05f76f93a4e9eba) ) ROM_LOAD( "epr-13791.c5", 0x110000, 0x80000, CRC(35c16d80) SHA1(7ed04600748c5efb63e25f066daa163e9c0d8038) ) ROM_END /************************************************************************************************************************** Clutch Hitter, Sega System 18 CPU: FD1094 (317-0175) ROM Board: 171-???? */ ROM_START( cltchitrj ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13783.a4", 0x00000, 0x40000, CRC(e2a1d5af) SHA1(cb6710fe2093889d5d159eaf55a3bd95c6f2ef87) ) ROM_LOAD16_BYTE( "epr-13796.a6", 0x00001, 0x40000, CRC(06001c67) SHA1(3aa48631013e6dc55e4c1d222b465e6b41ece36b) ) ROM_LOAD16_BYTE( "epr-13785.a5", 0x80000, 0x40000, CRC(09714762) SHA1(c75c88b1c313e172fdb7f9a570d57be38f959b2b) ) ROM_LOAD16_BYTE( "epr-13797.a7", 0x80001, 0x40000, CRC(361ade9f) SHA1(a7fd48c55695fd322d0456ff7dc2d2b2bc3e561b) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0175.key", 0x0000, 0x2000, CRC(70d9d283) SHA1(ff309b2a221d9a03ccf301a208c76a7c2eaea790) ) ROM_REGION( 0x180000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-13773.c1", 0x000000, 0x80000, CRC(3fc600e5) SHA1(8bec4ecf6a4e4b38d13133960036a5a4800a668e) ) ROM_LOAD( "mpr-13774.c2", 0x080000, 0x80000, CRC(2411a824) SHA1(0e383ccc4e0830ffb395d5102e2950610c147007) ) ROM_LOAD( "mpr-13775.c3", 0x100000, 0x80000, CRC(cf527bf6) SHA1(1f9cf1f0e92709f0465dc97ebbdaa715a419f7a7) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13779.c10", 0x000001, 0x80000, CRC(c707f416) SHA1(e6a9d89849f7f1c303a3ca29a629f81397945a2d) ) ROM_LOAD16_BYTE( "mpr-13787.a10", 0x000000, 0x80000, CRC(f05c68c6) SHA1(b6a0535b6c734a0c89fdb6506c32ffe6ab3aa8cd) ) ROM_LOAD16_BYTE( "mpr-13780.c11", 0x200001, 0x80000, CRC(a4c341e0) SHA1(15a0b5a42b56465a7b7df98968cc2ed177ce6f59) ) ROM_LOAD16_BYTE( "mpr-13788.a11", 0x200000, 0x80000, CRC(0106fea6) SHA1(e16e2a469ecbbc704021dee6264db30aa0898368) ) ROM_LOAD16_BYTE( "mpr-13781.c12", 0x400001, 0x80000, CRC(f33b13af) SHA1(d3eb64dcf12d532454bf3cd6c86528c0f11ee316) ) ROM_LOAD16_BYTE( "mpr-13789.a12", 0x400000, 0x80000, CRC(09ba8835) SHA1(72e83dd1793a7f4b2b881e71f262493e3d4992b3) ) // extra gfx roms??*/ ROM_LOAD16_BYTE( "epr-13782.c13", 0x600001, 0x40000, CRC(73790852) SHA1(891345cb8ce4b04bd293ee9bac9b1b9940d6bcb2) ) ROM_LOAD16_BYTE( "epr-13790.a13", 0x600000, 0x40000, CRC(23849101) SHA1(1aeb0fefb6688dfd841bd7d0b17ffdfce69f1dd9) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU // another copy in different set is epr-13778.b7 - 9c54c038 ROM_LOAD( "epr-13778.c7", 0x010000, 0x20000, CRC(35e86146) SHA1(9be82165dc12d5f32ef26f37ea02b29e3621893f) ) ROM_LOAD( "epr-13777.c6", 0x090000, 0x80000, CRC(d1524782) SHA1(121c5804927ed686ea50d5d81d0226e041f50f6f) ) ROM_LOAD( "epr-13776.c5", 0x110000, 0x80000, CRC(282ac9fe) SHA1(4f54d93779c35c036d7c85fce6736df80f3bbe33) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** D.D. Crew, Sega System 18 CPU: FD1094 (317-0190) ROM Board: 171-5873B */ ROM_START( ddcrew ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-14160.a4", 0x00000, 0x40000, CRC(b9f897b7) SHA1(65cee6c8006f328eee648e144e11fa60b1433ff5) ) ROM_LOAD16_BYTE( "epr-14161.a6", 0x00001, 0x40000, CRC(bb03c1f0) SHA1(9e7fbd2cda448992c6cbf4b96078b57305def097) ) ROM_LOAD16_BYTE( "mpr-14139.a5", 0x80000, 0x40000, CRC(06c31531) SHA1(d084cb72bf83578b34e959bb60a0695faf4161f8) ) ROM_LOAD16_BYTE( "mpr-14141.a7", 0x80001, 0x40000, CRC(080a494b) SHA1(64522dccbf6ed856ab80aa185454183df87d7ae9) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0190.key", 0x0000, 0x2000, CRC(2d502b11) SHA1(c4e94da59b0e15a5a302ebe88988d1657e7e9814 ) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-14127.c1", 0x00000, 0x40000, CRC(2228cd88) SHA1(5774bb6a401c3da05c5f3c9d3996b20bb3713cb2) ) ROM_LOAD( "epr-14128.c2", 0x40000, 0x40000, CRC(edba8e10) SHA1(25a2833ead4ca363802ddc2eb97c40976502921a) ) ROM_LOAD( "epr-14129.c3", 0x80000, 0x40000, CRC(e8ecc305) SHA1(a26d0c5c7826cd315f8b2c27e5a503a2a7b535c4) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14134.c10", 0x000001, 0x80000, CRC(4fda6a4b) SHA1(a9e582e494ab967e8f3ccf4d5844bb8ef889928c) ) ROM_LOAD16_BYTE( "mpr-14142.a10", 0x000000, 0x80000, CRC(3cbf1f2a) SHA1(80b6b006936740087786acd538e28aca85fa6894) ) ROM_LOAD16_BYTE( "mpr-14135.c11", 0x200001, 0x80000, CRC(e9c74876) SHA1(aff9d071e77f01c6937188bf67be38fa898343e6) ) ROM_LOAD16_BYTE( "mpr-14143.a11", 0x200000, 0x80000, CRC(59022c31) SHA1(5e1409fe0f29284dc6a3ffacf69b761aae09f132) ) ROM_LOAD16_BYTE( "mpr-14136.c12", 0x400001, 0x80000, CRC(720d9858) SHA1(8ebcb8b3e9555ca48b28908d47dcbbd654398b6f) ) ROM_LOAD16_BYTE( "mpr-14144.a12", 0x400000, 0x80000, CRC(7775fdd4) SHA1(a03cac039b400b651a4bf2167a8f2338f488ce26) ) ROM_LOAD16_BYTE( "epr-14137.c13", 0x600001, 0x80000, CRC(846c4265) SHA1(58d0c213d085fb4dee18b7aefb05087d9d522950) ) ROM_LOAD16_BYTE( "epr-14145.a13", 0x600000, 0x80000, CRC(0e76c797) SHA1(9a44dc948e84e5acac36e80105c2349ee78e6cfa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14133.c7", 0x010000, 0x20000, CRC(cff96665) SHA1(b4dc7f1a03415ebebdb99a82ae89328c345e7678) ) ROM_LOAD( "mpr-14132.c6", 0x090000, 0x80000, CRC(1fae0220) SHA1(8414c74318ea915816c6b67801ac7c8c3fc905f9) ) ROM_LOAD( "mpr-14131.c5", 0x110000, 0x80000, CRC(be5a7d0b) SHA1(c2c598b0cf711273fdd568f3401375e9772c1d61) ) ROM_LOAD( "epr-14130.c4", 0x190000, 0x80000, CRC(948f34a1) SHA1(d4c6728d5eea06cee6ac15a34ec8cccb4cc4b982) ) ROM_END /************************************************************************************************************************** D.D. Crew, Sega System 18 CPU: FD1094 (317-0186) ROM Board: 171-5873B */ ROM_START( ddcrewu ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-14152.a4", 0x00000, 0x40000, CRC(69c7b571) SHA1(9fe4815a1cff0a46a754a6bdee12abaf7beb6501) ) ROM_LOAD16_BYTE( "epr-14153.a6", 0x00001, 0x40000, CRC(e01fae0c) SHA1(7166f955324f73e94d8ae6d2a5b2f4b497e62933) ) ROM_LOAD16_BYTE( "mpr-14139.a5", 0x80000, 0x40000, CRC(06c31531) SHA1(d084cb72bf83578b34e959bb60a0695faf4161f8) ) ROM_LOAD16_BYTE( "mpr-14141.a7", 0x80001, 0x40000, CRC(080a494b) SHA1(64522dccbf6ed856ab80aa185454183df87d7ae9) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0186.key", 0x0000, 0x2000, CRC(7acaf1fd) SHA1(236d6382072adda8f7907d98d428fcca36700fa0) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-14127.c1", 0x00000, 0x40000, CRC(2228cd88) SHA1(5774bb6a401c3da05c5f3c9d3996b20bb3713cb2) ) ROM_LOAD( "epr-14128.c2", 0x40000, 0x40000, CRC(edba8e10) SHA1(25a2833ead4ca363802ddc2eb97c40976502921a) ) ROM_LOAD( "epr-14129.c3", 0x80000, 0x40000, CRC(e8ecc305) SHA1(a26d0c5c7826cd315f8b2c27e5a503a2a7b535c4) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14134.c10", 0x000001, 0x80000, CRC(4fda6a4b) SHA1(a9e582e494ab967e8f3ccf4d5844bb8ef889928c) ) ROM_LOAD16_BYTE( "mpr-14142.a10", 0x000000, 0x80000, CRC(3cbf1f2a) SHA1(80b6b006936740087786acd538e28aca85fa6894) ) ROM_LOAD16_BYTE( "mpr-14135.c11", 0x200001, 0x80000, CRC(e9c74876) SHA1(aff9d071e77f01c6937188bf67be38fa898343e6) ) ROM_LOAD16_BYTE( "mpr-14143.a11", 0x200000, 0x80000, CRC(59022c31) SHA1(5e1409fe0f29284dc6a3ffacf69b761aae09f132) ) ROM_LOAD16_BYTE( "mpr-14136.c12", 0x400001, 0x80000, CRC(720d9858) SHA1(8ebcb8b3e9555ca48b28908d47dcbbd654398b6f) ) ROM_LOAD16_BYTE( "mpr-14144.a12", 0x400000, 0x80000, CRC(7775fdd4) SHA1(a03cac039b400b651a4bf2167a8f2338f488ce26) ) ROM_LOAD16_BYTE( "epr-14137.c13", 0x600001, 0x80000, CRC(846c4265) SHA1(58d0c213d085fb4dee18b7aefb05087d9d522950) ) ROM_LOAD16_BYTE( "epr-14145.a13", 0x600000, 0x80000, CRC(0e76c797) SHA1(9a44dc948e84e5acac36e80105c2349ee78e6cfa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14133.c7", 0x010000, 0x20000, CRC(cff96665) SHA1(b4dc7f1a03415ebebdb99a82ae89328c345e7678) ) ROM_LOAD( "mpr-14132.c6", 0x090000, 0x80000, CRC(1fae0220) SHA1(8414c74318ea915816c6b67801ac7c8c3fc905f9) ) ROM_LOAD( "mpr-14131.c5", 0x110000, 0x80000, CRC(be5a7d0b) SHA1(c2c598b0cf711273fdd568f3401375e9772c1d61) ) ROM_LOAD( "epr-14130.c4", 0x190000, 0x80000, CRC(948f34a1) SHA1(d4c6728d5eea06cee6ac15a34ec8cccb4cc4b982) ) ROM_END /************************************************************************************************************************** D.D. Crew, Sega System 18 CPU: FD1094 (317-0184) ROM Board: 171-5873B */ ROM_START( ddcrew2 ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-14148.a4", 0x00000, 0x40000, CRC(df4cb0cf) SHA1(153993997e9ceb06a9d4c73794ea66d0c585a291) ) ROM_LOAD16_BYTE( "epr-14149.a6", 0x00001, 0x40000, CRC(380ff818) SHA1(7c7dd7aa825665f1a9aaebb5af4ecf5dd109b0ca) ) ROM_LOAD16_BYTE( "mpr-14139.a5", 0x80000, 0x40000, CRC(06c31531) SHA1(d084cb72bf83578b34e959bb60a0695faf4161f8) ) ROM_LOAD16_BYTE( "mpr-14141.a7", 0x80001, 0x40000, CRC(080a494b) SHA1(64522dccbf6ed856ab80aa185454183df87d7ae9) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0184.key", 0x0000, 0x2000, CRC(cee06254) SHA1(d64903055fdefb49c584cbcd84f0d4fa811bd789) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-14127.c1", 0x00000, 0x40000, CRC(2228cd88) SHA1(5774bb6a401c3da05c5f3c9d3996b20bb3713cb2) ) ROM_LOAD( "epr-14128.c2", 0x40000, 0x40000, CRC(edba8e10) SHA1(25a2833ead4ca363802ddc2eb97c40976502921a) ) ROM_LOAD( "epr-14129.c3", 0x80000, 0x40000, CRC(e8ecc305) SHA1(a26d0c5c7826cd315f8b2c27e5a503a2a7b535c4) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14134.c10", 0x000001, 0x80000, CRC(4fda6a4b) SHA1(a9e582e494ab967e8f3ccf4d5844bb8ef889928c) ) ROM_LOAD16_BYTE( "mpr-14142.a10", 0x000000, 0x80000, CRC(3cbf1f2a) SHA1(80b6b006936740087786acd538e28aca85fa6894) ) ROM_LOAD16_BYTE( "mpr-14135.c11", 0x200001, 0x80000, CRC(e9c74876) SHA1(aff9d071e77f01c6937188bf67be38fa898343e6) ) ROM_LOAD16_BYTE( "mpr-14143.a11", 0x200000, 0x80000, CRC(59022c31) SHA1(5e1409fe0f29284dc6a3ffacf69b761aae09f132) ) ROM_LOAD16_BYTE( "mpr-14136.c12", 0x400001, 0x80000, CRC(720d9858) SHA1(8ebcb8b3e9555ca48b28908d47dcbbd654398b6f) ) ROM_LOAD16_BYTE( "mpr-14144.a12", 0x400000, 0x80000, CRC(7775fdd4) SHA1(a03cac039b400b651a4bf2167a8f2338f488ce26) ) ROM_LOAD16_BYTE( "epr-14137.c13", 0x600001, 0x80000, CRC(846c4265) SHA1(58d0c213d085fb4dee18b7aefb05087d9d522950) ) ROM_LOAD16_BYTE( "epr-14145.a13", 0x600000, 0x80000, CRC(0e76c797) SHA1(9a44dc948e84e5acac36e80105c2349ee78e6cfa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14133.c7", 0x010000, 0x20000, CRC(cff96665) SHA1(b4dc7f1a03415ebebdb99a82ae89328c345e7678) ) ROM_LOAD( "mpr-14132.c6", 0x090000, 0x80000, CRC(1fae0220) SHA1(8414c74318ea915816c6b67801ac7c8c3fc905f9) ) ROM_LOAD( "mpr-14131.c5", 0x110000, 0x80000, CRC(be5a7d0b) SHA1(c2c598b0cf711273fdd568f3401375e9772c1d61) ) ROM_LOAD( "epr-14130.c4", 0x190000, 0x80000, CRC(948f34a1) SHA1(d4c6728d5eea06cee6ac15a34ec8cccb4cc4b982) ) ROM_END /************************************************************************************************************************** D.D. Crew, Sega System 18 CPU: FD1094 (317-0187) PCB Board: 171-5873-02B (833-8165-05) Rom Board : 171-5987A (834-8166-05) */ ROM_START( ddcrew1 ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-14154.a4", 0x00000, 0x40000, CRC(9a0dadf0) SHA1(b55c8cdd3158607ec8203bfebc9e7aba24d6d565) ) ROM_LOAD16_BYTE( "epr-14155.a6", 0x00001, 0x40000, CRC(e74362f4) SHA1(a6f96d714baeb826221b712b996e99831cf25abf) ) ROM_LOAD16_BYTE( "mpr-14139.a5", 0x80000, 0x40000, CRC(06c31531) SHA1(d084cb72bf83578b34e959bb60a0695faf4161f8) ) ROM_LOAD16_BYTE( "mpr-14141.a7", 0x80001, 0x40000, CRC(080a494b) SHA1(64522dccbf6ed856ab80aa185454183df87d7ae9) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0187.key", 0x0000, 0x2000, CRC(1dfb60be) SHA1(7bd42a2e54fca574076e5ed164ab4e0cbb645a4f) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-14127.c1", 0x00000, 0x40000, CRC(2228cd88) SHA1(5774bb6a401c3da05c5f3c9d3996b20bb3713cb2) ) ROM_LOAD( "epr-14128.c2", 0x40000, 0x40000, CRC(edba8e10) SHA1(25a2833ead4ca363802ddc2eb97c40976502921a) ) ROM_LOAD( "epr-14129.c3", 0x80000, 0x40000, CRC(e8ecc305) SHA1(a26d0c5c7826cd315f8b2c27e5a503a2a7b535c4) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14134.c10", 0x000001, 0x80000, CRC(4fda6a4b) SHA1(a9e582e494ab967e8f3ccf4d5844bb8ef889928c) ) ROM_LOAD16_BYTE( "mpr-14142.a10", 0x000000, 0x80000, CRC(3cbf1f2a) SHA1(80b6b006936740087786acd538e28aca85fa6894) ) ROM_LOAD16_BYTE( "mpr-14135.c11", 0x200001, 0x80000, CRC(e9c74876) SHA1(aff9d071e77f01c6937188bf67be38fa898343e6) ) ROM_LOAD16_BYTE( "mpr-14143.a11", 0x200000, 0x80000, CRC(59022c31) SHA1(5e1409fe0f29284dc6a3ffacf69b761aae09f132) ) ROM_LOAD16_BYTE( "mpr-14136.c12", 0x400001, 0x80000, CRC(720d9858) SHA1(8ebcb8b3e9555ca48b28908d47dcbbd654398b6f) ) ROM_LOAD16_BYTE( "mpr-14144.a12", 0x400000, 0x80000, CRC(7775fdd4) SHA1(a03cac039b400b651a4bf2167a8f2338f488ce26) ) ROM_LOAD16_BYTE( "epr-14137.c13", 0x600001, 0x80000, CRC(846c4265) SHA1(58d0c213d085fb4dee18b7aefb05087d9d522950) ) ROM_LOAD16_BYTE( "epr-14145.a13", 0x600000, 0x80000, CRC(0e76c797) SHA1(9a44dc948e84e5acac36e80105c2349ee78e6cfa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14133.c7", 0x010000, 0x20000, CRC(cff96665) SHA1(b4dc7f1a03415ebebdb99a82ae89328c345e7678) ) ROM_LOAD( "mpr-14132.c6", 0x090000, 0x80000, CRC(1fae0220) SHA1(8414c74318ea915816c6b67801ac7c8c3fc905f9) ) ROM_LOAD( "mpr-14131.c5", 0x110000, 0x80000, CRC(be5a7d0b) SHA1(c2c598b0cf711273fdd568f3401375e9772c1d61) ) ROM_LOAD( "epr-14130.c4", 0x190000, 0x80000, CRC(948f34a1) SHA1(d4c6728d5eea06cee6ac15a34ec8cccb4cc4b982) ) ROM_END /************************************************************************************************************************** D.D. Crew, Sega System 18 CPU: FD1094 (317-0182 for 2P version, 317-0185 for 4P version, 317-0188 for 3P version) ROM Board: 171-5987A (4th Player on Sega System 18,24) I/O Board: 837-7968 */ ROM_START( ddcrewj ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-14138.a4", 0x00000, 0x40000, CRC(df280b1b) SHA1(581e8b6cbf3231d772de6b0e26b94541931215fd) ) ROM_LOAD16_BYTE( "epr-14140.a6", 0x00001, 0x40000, CRC(48f223ee) SHA1(5192b92d081829d2a4fcf2258675b24c94cfb4e5) ) ROM_LOAD16_BYTE( "mpr-14139.a5", 0x80000, 0x40000, CRC(06c31531) SHA1(d084cb72bf83578b34e959bb60a0695faf4161f8) ) ROM_LOAD16_BYTE( "mpr-14141.a7", 0x80001, 0x40000, CRC(080a494b) SHA1(64522dccbf6ed856ab80aa185454183df87d7ae9) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0182.key", 0x0000, 0x2000, CRC(2e8a3601) SHA1(8b6e10babfd2398c1669ba6bf9aad61cd02f23ba) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-14127.c1", 0x00000, 0x40000, CRC(2228cd88) SHA1(5774bb6a401c3da05c5f3c9d3996b20bb3713cb2) ) ROM_LOAD( "epr-14128.c2", 0x40000, 0x40000, CRC(edba8e10) SHA1(25a2833ead4ca363802ddc2eb97c40976502921a) ) ROM_LOAD( "epr-14129.c3", 0x80000, 0x40000, CRC(e8ecc305) SHA1(a26d0c5c7826cd315f8b2c27e5a503a2a7b535c4) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14134.c10", 0x000001, 0x80000, CRC(4fda6a4b) SHA1(a9e582e494ab967e8f3ccf4d5844bb8ef889928c) ) ROM_LOAD16_BYTE( "mpr-14142.a10", 0x000000, 0x80000, CRC(3cbf1f2a) SHA1(80b6b006936740087786acd538e28aca85fa6894) ) ROM_LOAD16_BYTE( "mpr-14135.c11", 0x200001, 0x80000, CRC(e9c74876) SHA1(aff9d071e77f01c6937188bf67be38fa898343e6) ) ROM_LOAD16_BYTE( "mpr-14143.a11", 0x200000, 0x80000, CRC(59022c31) SHA1(5e1409fe0f29284dc6a3ffacf69b761aae09f132) ) ROM_LOAD16_BYTE( "mpr-14136.c12", 0x400001, 0x80000, CRC(720d9858) SHA1(8ebcb8b3e9555ca48b28908d47dcbbd654398b6f) ) ROM_LOAD16_BYTE( "mpr-14144.a12", 0x400000, 0x80000, CRC(7775fdd4) SHA1(a03cac039b400b651a4bf2167a8f2338f488ce26) ) ROM_LOAD16_BYTE( "epr-14137.c13", 0x600001, 0x80000, CRC(846c4265) SHA1(58d0c213d085fb4dee18b7aefb05087d9d522950) ) ROM_LOAD16_BYTE( "epr-14145.a13", 0x600000, 0x80000, CRC(0e76c797) SHA1(9a44dc948e84e5acac36e80105c2349ee78e6cfa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14133.c7", 0x010000, 0x20000, CRC(cff96665) SHA1(b4dc7f1a03415ebebdb99a82ae89328c345e7678) ) ROM_LOAD( "mpr-14132.c6", 0x090000, 0x80000, CRC(1fae0220) SHA1(8414c74318ea915816c6b67801ac7c8c3fc905f9) ) ROM_LOAD( "mpr-14131.c5", 0x110000, 0x80000, CRC(be5a7d0b) SHA1(c2c598b0cf711273fdd568f3401375e9772c1d61) ) ROM_LOAD( "epr-14130.c4", 0x190000, 0x80000, CRC(948f34a1) SHA1(d4c6728d5eea06cee6ac15a34ec8cccb4cc4b982) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Desert Breaker, Sega System 18 game No. 833-8830-02 pcb No. 837-8832-02 (171-5873-02b) rom No. 834-8831-02 (171-5987a) CPU Hiatchi FD1094 317-0196 */ ROM_START( desertbr ) ROM_REGION( 0x200000, "maincpu", 0 ) // 68000 code - custom CPU 317-0196 ROM_LOAD16_BYTE( "epr-14802.a4", 0x000000, 0x80000, CRC(9ab93cbc) SHA1(a8d0013e17519c26c6ba7d28ec73e22ea5bde0e9) ) ROM_LOAD16_BYTE( "epr-14902.a6", 0x000001, 0x80000, CRC(6724e7b1) SHA1(540c8bb7e848488dead81ca58f3bece45a87e611) ) ROM_LOAD16_BYTE( "epr-14793.a5", 0x100000, 0x80000, CRC(dc9d7af3) SHA1(1fc1fedc1a4beed94cece268d0bb4bf62eeb407c) ) ROM_LOAD16_BYTE( "epr-14795.a7", 0x100001, 0x80000, CRC(7e5bf7d9) SHA1(32ac68ee423a34e0f1bedc8765e03f40e01c3af1) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0196.key", 0x0000, 0x2000, CRC(cb942262) SHA1(7ad7cd3df887c6e6435d74784cb12ce016acd0da) ) ROM_REGION( 0x300000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-14781.c1", 0x000000, 0x100000, CRC(c4f7d7aa) SHA1(3c69dd7a26efccd7111ef33dfa6e8b738095c0bf) ) ROM_LOAD( "mpr-14782.c2", 0x100000, 0x100000, CRC(ccc98d05) SHA1(b89594bbfff45e3b4fe433aeeaf8b4073c2cabb5) ) ROM_LOAD( "mpr-14783.c3", 0x200000, 0x100000, CRC(ef202bec) SHA1(b557092f8a3e1c9889d34588344c6dd2c6f06731) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14788.c10", 0x000001, 0x100000, CRC(b5b05536) SHA1(f8fde7ebca38c0a6f6a864c17771aa155e6fc30d) ) ROM_LOAD16_BYTE( "mpr-14796.a10", 0x000000, 0x100000, CRC(c033220a) SHA1(279d3ef62b41d2c6a18ce1217a549402a874638b) ) ROM_LOAD16_BYTE( "mpr-14789.c11", 0x200001, 0x100000, CRC(0f9bcb97) SHA1(c15ab3ece596c54e1c4d8e8a755473609334e8ba) ) ROM_LOAD16_BYTE( "mpr-14797.a11", 0x200000, 0x100000, CRC(4c301cc9) SHA1(8aea8af0b078b81d1054331b273568b1b903531b) ) ROM_LOAD16_BYTE( "mpr-14790.c12", 0x400001, 0x100000, CRC(6a07ac27) SHA1(0558b662c7965c5b74cbc552423194a8facbc092) ) ROM_LOAD16_BYTE( "mpr-14798.a12", 0x400000, 0x100000, CRC(50634625) SHA1(f4baaebdb1f850e92ca865e103fbca68cdb0de0f) ) ROM_LOAD16_BYTE( "mpr-14791.c13", 0x600001, 0x100000, CRC(a4ae352b) SHA1(dc814e1c2e167e191cd43fa554ff8ee974d47152) ) ROM_LOAD16_BYTE( "mpr-14799.a13", 0x600000, 0x100000, CRC(aeb7b025) SHA1(9ce2a9a46176a110c8d2e77deb3d8b9b69b902fa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14787.c7", 0x010000, 0x40000, CRC(cc6feec7) SHA1(31cc243178b98681a52500a485d74ed9e1274888) ) ROM_LOAD( "mpr-14786.c6", 0x090000, 0x80000, CRC(cc8349f2) SHA1(9f00d8ea372b70ba44a90dab497deadcc5be3dab) ) ROM_LOAD( "mpr-14785.c5", 0x110000, 0x80000, CRC(7babba13) SHA1(190cd9ea0f73272e0df34bbdfd8e0035f9e9b0b0) ) ROM_LOAD( "mpr-14784.c4", 0x190000, 0x80000, CRC(073878e4) SHA1(eff08080d06a16fccf4876e42b389fef599cceba) ) ROM_END /************************************************************************************************************************** Desert Breaker, Sega System 18 game No. 833-8830? pcb No. 837-8832? (171-5873B) rom No. 834-8831 (171-5987A) CPU Hiatchi FD1094 317-0194 */ ROM_START( desertbrj ) ROM_REGION( 0x200000, "maincpu", 0 ) // 68000 code - custom CPU 317-0196 ROM_LOAD16_BYTE( "epr-14792.a4", 0x000000, 0x80000, CRC(453d9d02) SHA1(df5d85c2e1a25c18860aa96462ea4893bb633190) ) ROM_LOAD16_BYTE( "epr-14794.a6", 0x000001, 0x80000, CRC(4426758f) SHA1(d8bebcf05a83d34a93f74e2263f4290e995656ba) ) ROM_LOAD16_BYTE( "epr-14793.a5", 0x100000, 0x80000, CRC(dc9d7af3) SHA1(1fc1fedc1a4beed94cece268d0bb4bf62eeb407c) ) ROM_LOAD16_BYTE( "epr-14795.a7", 0x100001, 0x80000, CRC(7e5bf7d9) SHA1(32ac68ee423a34e0f1bedc8765e03f40e01c3af1) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0194.key", 0x0000, 0x2000, CRC(40cbc4cb) SHA1(51777d8a619268ac0b1fda6e7781cde753354419) ) ROM_REGION( 0x300000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-14781.c1", 0x000000, 0x100000, CRC(c4f7d7aa) SHA1(3c69dd7a26efccd7111ef33dfa6e8b738095c0bf) ) ROM_LOAD( "mpr-14782.c2", 0x100000, 0x100000, CRC(ccc98d05) SHA1(b89594bbfff45e3b4fe433aeeaf8b4073c2cabb5) ) ROM_LOAD( "mpr-14783.c3", 0x200000, 0x100000, CRC(ef202bec) SHA1(b557092f8a3e1c9889d34588344c6dd2c6f06731) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14788.c10", 0x000001, 0x100000, CRC(b5b05536) SHA1(f8fde7ebca38c0a6f6a864c17771aa155e6fc30d) ) ROM_LOAD16_BYTE( "mpr-14796.a10", 0x000000, 0x100000, CRC(c033220a) SHA1(279d3ef62b41d2c6a18ce1217a549402a874638b) ) ROM_LOAD16_BYTE( "mpr-14789.c11", 0x200001, 0x100000, CRC(0f9bcb97) SHA1(c15ab3ece596c54e1c4d8e8a755473609334e8ba) ) ROM_LOAD16_BYTE( "mpr-14797.a11", 0x200000, 0x100000, CRC(4c301cc9) SHA1(8aea8af0b078b81d1054331b273568b1b903531b) ) ROM_LOAD16_BYTE( "mpr-14790.c12", 0x400001, 0x100000, CRC(6a07ac27) SHA1(0558b662c7965c5b74cbc552423194a8facbc092) ) ROM_LOAD16_BYTE( "mpr-14798.a12", 0x400000, 0x100000, CRC(50634625) SHA1(f4baaebdb1f850e92ca865e103fbca68cdb0de0f) ) ROM_LOAD16_BYTE( "mpr-14791.c13", 0x600001, 0x100000, CRC(a4ae352b) SHA1(dc814e1c2e167e191cd43fa554ff8ee974d47152) ) ROM_LOAD16_BYTE( "mpr-14799.a13", 0x600000, 0x100000, CRC(aeb7b025) SHA1(9ce2a9a46176a110c8d2e77deb3d8b9b69b902fa) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14787.c7", 0x010000, 0x40000, CRC(cc6feec7) SHA1(31cc243178b98681a52500a485d74ed9e1274888) ) ROM_LOAD( "mpr-14786.c6", 0x090000, 0x80000, CRC(cc8349f2) SHA1(9f00d8ea372b70ba44a90dab497deadcc5be3dab) ) ROM_LOAD( "mpr-14785.c5", 0x110000, 0x80000, CRC(7babba13) SHA1(190cd9ea0f73272e0df34bbdfd8e0035f9e9b0b0) ) ROM_LOAD( "mpr-14784.c4", 0x190000, 0x80000, CRC(073878e4) SHA1(eff08080d06a16fccf4876e42b389fef599cceba) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Laser Ghost, Sega System 18 CPU: FD1094 (317-0166) ROM Board: 171-5873B */ ROM_START( lghost ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13429.a4", 0x00000, 0x40000, CRC(09bd65c0) SHA1(f2b332a86d52af3c5270f668bdd43a0d44eca346) ) ROM_LOAD16_BYTE( "epr-13430.a6", 0x00001, 0x40000, CRC(51009fe0) SHA1(f1e6e3714c01c15c0e932470a9e1a17abb59e958) ) ROM_LOAD16_BYTE( "epr-13411.a5", 0x80000, 0x40000, CRC(5160167b) SHA1(3d176a18c7527b1e485f10b144bb4db1b945e709) ) ROM_LOAD16_BYTE( "epr-13413.a7", 0x80001, 0x40000, CRC(656b3bd8) SHA1(db81d4ae3138308dce1e3db7a859f1d63c4ff815) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0166.key", 0x0000, 0x2000, CRC(8379961f) SHA1(44e0662e92ece65ad2049b2cd804f516e631166e) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13414.c1", 0x00000, 0x40000, CRC(dada2419) SHA1(f6ffd02d75232a09ea83fd199e5e30b2773b0cf5) ) ROM_LOAD( "epr-13415.c2", 0x40000, 0x40000, CRC(bbb62c48) SHA1(7a4c5bd11b73a92deece72b55627f48ac167acd6) ) ROM_LOAD( "epr-13416.c3", 0x80000, 0x40000, CRC(1d11dbae) SHA1(331aa49c6b38d32ec33184dbd0851888463ddbc7) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "epr-13603.a10", 0x000000, 0x80000, CRC(5350a94e) SHA1(47e99803cab4b508feb51069c940d6c824d6961d) ) ROM_LOAD16_BYTE( "epr-13604.c10", 0x000001, 0x80000, CRC(4009c8e5) SHA1(97f513d312f4c90f8bffdf797afa3749779989a5) ) ROM_LOAD16_BYTE( "mpr-13421.a11", 0x200000, 0x80000, CRC(2fc75890) SHA1(9f97f07dba3b978df8eb357894168ad74f151d30) ) ROM_LOAD16_BYTE( "mpr-13424.c11", 0x200001, 0x80000, CRC(fb98d920) SHA1(cebdebe88902e96c631df6053ac2589f794da155) ) ROM_LOAD16_BYTE( "mpr-13422.a12", 0x400000, 0x80000, CRC(48a0754d) SHA1(9fead9f8319593adb4bddaaa4d053b21ca726009) ) ROM_LOAD16_BYTE( "mpr-13425.c12", 0x400001, 0x80000, CRC(f8252589) SHA1(5a1ed24296d0609393e53df3ee585a366da4ee46) ) ROM_LOAD16_BYTE( "mpr-13423.a13", 0x600000, 0x80000, CRC(335bbc9d) SHA1(78793335b2f8a1bb05809259521db193c17c9b98) ) ROM_LOAD16_BYTE( "mpr-13426.c13", 0x600001, 0x80000, CRC(5cfb1e25) SHA1(1dd57475604f339e58bf946e17ae0dc5cf4a3dba) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13417.c7", 0x010000, 0x20000, CRC(cd7beb49) SHA1(2435ce000f1eefdd06b27ea93e22fd82c0e999d2) ) // these seem best 3 from the different sized dumps ROM_LOAD( "mpr-13420.c6", 0x090000, 0x40000, CRC(3de0dee4) SHA1(31833684df5a34d5e9ef04f2ab42355b8e9cbb45) ) ROM_LOAD( "mpr-13419.c5", 0x110000, 0x40000, CRC(e7021b0a) SHA1(82e390fac63965d4f80ae01758c19ae951c39475) ) ROM_LOAD( "mpr-13418.c4", 0x190000, 0x40000, CRC(0732594d) SHA1(9fbeae29f1a31d136ddc9a49c786b2a08a523e0d) ) ROM_END /************************************************************************************************************************** Laser Ghost, Sega System 18 CPU: FD1094 (317-0165) Game BD: 833-7627-04 LASER GHOST ROM Board: 834-7597-04 (type 171-5873B) A/D BD NO. 837-7536 */ ROM_START( lghostu ) ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13427.a4", 0x00000, 0x40000, CRC(5bf8fb6b) SHA1(587bbf45b5e470da7d9166b2cbf4ac58a1f2a825) ) ROM_LOAD16_BYTE( "epr-13428.a6", 0x00001, 0x40000, CRC(276775f5) SHA1(5dd5dabe7e9311b3520d0405dda0c983e9bc4ba2) ) ROM_LOAD16_BYTE( "epr-13411.a5", 0x80000, 0x40000, CRC(5160167b) SHA1(3d176a18c7527b1e485f10b144bb4db1b945e709) ) ROM_LOAD16_BYTE( "epr-13413.a7", 0x80001, 0x40000, CRC(656b3bd8) SHA1(db81d4ae3138308dce1e3db7a859f1d63c4ff815) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0165.key", 0x0000, 0x2000, CRC(a04267ab) SHA1(688ee59dfaaf240e23de4cada648689d1717ab04) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13414.c1", 0x00000, 0x40000, CRC(dada2419) SHA1(f6ffd02d75232a09ea83fd199e5e30b2773b0cf5) ) ROM_LOAD( "epr-13415.c2", 0x40000, 0x40000, CRC(bbb62c48) SHA1(7a4c5bd11b73a92deece72b55627f48ac167acd6) ) ROM_LOAD( "epr-13416.c3", 0x80000, 0x40000, CRC(1d11dbae) SHA1(331aa49c6b38d32ec33184dbd0851888463ddbc7) ) ROM_REGION16_BE( 0x800000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "epr-13603.a10", 0x000000, 0x80000, CRC(5350a94e) SHA1(47e99803cab4b508feb51069c940d6c824d6961d) ) ROM_LOAD16_BYTE( "epr-13604.c10", 0x000001, 0x80000, CRC(4009c8e5) SHA1(97f513d312f4c90f8bffdf797afa3749779989a5) ) ROM_LOAD16_BYTE( "mpr-13421.a11", 0x200000, 0x80000, CRC(2fc75890) SHA1(9f97f07dba3b978df8eb357894168ad74f151d30) ) ROM_LOAD16_BYTE( "mpr-13424.c11", 0x200001, 0x80000, CRC(fb98d920) SHA1(cebdebe88902e96c631df6053ac2589f794da155) ) ROM_LOAD16_BYTE( "mpr-13422.a12", 0x400000, 0x80000, CRC(48a0754d) SHA1(9fead9f8319593adb4bddaaa4d053b21ca726009) ) ROM_LOAD16_BYTE( "mpr-13425.c12", 0x400001, 0x80000, CRC(f8252589) SHA1(5a1ed24296d0609393e53df3ee585a366da4ee46) ) ROM_LOAD16_BYTE( "mpr-13423.a13", 0x600000, 0x80000, CRC(335bbc9d) SHA1(78793335b2f8a1bb05809259521db193c17c9b98) ) ROM_LOAD16_BYTE( "mpr-13426.c13", 0x600001, 0x80000, CRC(5cfb1e25) SHA1(1dd57475604f339e58bf946e17ae0dc5cf4a3dba) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13417.c7", 0x010000, 0x20000, CRC(cd7beb49) SHA1(2435ce000f1eefdd06b27ea93e22fd82c0e999d2) ) // these seem best 3 from the different sized dumps ROM_LOAD( "mpr-13420.c6", 0x090000, 0x40000, CRC(3de0dee4) SHA1(31833684df5a34d5e9ef04f2ab42355b8e9cbb45) ) ROM_LOAD( "mpr-13419.c5", 0x110000, 0x40000, CRC(e7021b0a) SHA1(82e390fac63965d4f80ae01758c19ae951c39475) ) ROM_LOAD( "mpr-13418.c4", 0x190000, 0x40000, CRC(0732594d) SHA1(9fbeae29f1a31d136ddc9a49c786b2a08a523e0d) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Moonwalker, Sega System 18 CPU: FD1094 (317-0159) ROM Board: 171-5873B */ ROM_START( mwalk ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code - custom cpu 317-0159 ROM_LOAD16_BYTE( "epr-13235.a6", 0x000000, 0x40000, CRC(6983e129) SHA1(a8dd430620ab8ce11df46aa208d762d47f510464) ) ROM_LOAD16_BYTE( "epr-13234.a5", 0x000001, 0x40000, CRC(c9fd20f2) SHA1(9476e6481e6d8f223acd52f543fa04f408d48dc3) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0159.key", 0x0000, 0x2000, CRC(507838f0) SHA1(0c92d313da40b5dec7398c05b57698de6153b4b0) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-13216.b1", 0x00000, 0x40000, CRC(862d2c03) SHA1(3c5446d702a639b62a602c6d687f9875d8450218) ) ROM_LOAD( "mpr-13217.b2", 0x40000, 0x40000, CRC(7d1ac3ec) SHA1(8495357304f1df135bba77ef3b96e79a883b8ff0) ) ROM_LOAD( "mpr-13218.b3", 0x80000, 0x40000, CRC(56d3393c) SHA1(50a2d065060692c9ecaa56046a781cb21d93e554) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13224.b11", 0x000001, 0x40000, CRC(c59f107b) SHA1(10fa60fca6e34eda277c483bb1c0e81bb88c8a47) ) ROM_LOAD16_BYTE( "mpr-13231.a11", 0x000000, 0x40000, CRC(a5e96346) SHA1(a854f4dd5dc16975373255110fdb8ab3d121b1af) ) ROM_LOAD16_BYTE( "mpr-13223.b10", 0x080001, 0x40000, CRC(364f60ff) SHA1(9ac887ec0b2e32b504b7c6a5f3bb1ce3fe41a15a) ) ROM_LOAD16_BYTE( "mpr-13230.a10", 0x080000, 0x40000, CRC(9550091f) SHA1(bb6e898f7b540e130fd338c10f74609a7604cef4) ) ROM_LOAD16_BYTE( "mpr-13222.b9", 0x100001, 0x40000, CRC(523df3ed) SHA1(2e496125e75decd674c3a08404fbdb53791a965d) ) ROM_LOAD16_BYTE( "mpr-13229.a9", 0x100000, 0x40000, CRC(f40dc45d) SHA1(e9468cef428f52ecdf6837c6d9a9fea934e7676c) ) ROM_LOAD16_BYTE( "epr-13221.b8", 0x180001, 0x40000, CRC(9ae7546a) SHA1(5413b0131881b0b32bac8de51da9a299835014bb) ) ROM_LOAD16_BYTE( "epr-13228.a8", 0x180000, 0x40000, CRC(de3786be) SHA1(2279bb390aa3efab9aeee0a643e5cb6a4f5933b6) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13225.a4", 0x010000, 0x20000, CRC(56c2e82b) SHA1(d5755a1bb6e889d274dc60e883d4d65f12fdc877) ) ROM_LOAD( "mpr-13219.b4", 0x090000, 0x40000, CRC(19e2061f) SHA1(2dcf1718a43dab4da53b4f67722664e70ddd2169) ) ROM_LOAD( "mpr-13220.b5", 0x110000, 0x40000, CRC(58d4d9ce) SHA1(725e73a656845b02702ef131b4c0aa2a73cdd02e) ) ROM_LOAD( "mpr-13249.b6", 0x190000, 0x40000, CRC(623edc5d) SHA1(c32d9f818d40f311877fbe6532d9e95b6045c3c4) ) ROM_REGION( 0x10000, "mcu", 0 ) // protection MCU ROM_LOAD( "315-5437.ic4", 0x00000, 0x1000, CRC(4bf63bc1) SHA1(2766ab30b466b079febb30c488adad9ea56813f7) ) ROM_END /************************************************************************************************************************** Moonwalker, Sega System 18 CPU: FD1094 (317-0158) ROM Board: 171-5873B */ ROM_START( mwalku ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code - custom cpu 317-0158 ROM_LOAD16_BYTE( "epr-13233.a6", 0x000000, 0x40000, CRC(f3dac671) SHA1(cd9d372c7e272d2371bc1f9fb0167831c804423f) ) ROM_LOAD16_BYTE( "epr-13232.a5", 0x000001, 0x40000, CRC(541d8bdf) SHA1(6a99153fddca246ba070e93c4bacd145f15f76bf) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0158.key", 0x0000, 0x2000, CRC(a8a50e8c) SHA1(6e05a40dbf31b4007df1bb27eee85a78da3d8417) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-13216.b1", 0x00000, 0x40000, CRC(862d2c03) SHA1(3c5446d702a639b62a602c6d687f9875d8450218) ) ROM_LOAD( "mpr-13217.b2", 0x40000, 0x40000, CRC(7d1ac3ec) SHA1(8495357304f1df135bba77ef3b96e79a883b8ff0) ) ROM_LOAD( "mpr-13218.b3", 0x80000, 0x40000, CRC(56d3393c) SHA1(50a2d065060692c9ecaa56046a781cb21d93e554) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13224.b11", 0x000001, 0x40000, CRC(c59f107b) SHA1(10fa60fca6e34eda277c483bb1c0e81bb88c8a47) ) ROM_LOAD16_BYTE( "mpr-13231.a11", 0x000000, 0x40000, CRC(a5e96346) SHA1(a854f4dd5dc16975373255110fdb8ab3d121b1af) ) ROM_LOAD16_BYTE( "mpr-13223.b10", 0x080001, 0x40000, CRC(364f60ff) SHA1(9ac887ec0b2e32b504b7c6a5f3bb1ce3fe41a15a) ) ROM_LOAD16_BYTE( "mpr-13230.a10", 0x080000, 0x40000, CRC(9550091f) SHA1(bb6e898f7b540e130fd338c10f74609a7604cef4) ) ROM_LOAD16_BYTE( "mpr-13222.b9", 0x100001, 0x40000, CRC(523df3ed) SHA1(2e496125e75decd674c3a08404fbdb53791a965d) ) ROM_LOAD16_BYTE( "mpr-13229.a9", 0x100000, 0x40000, CRC(f40dc45d) SHA1(e9468cef428f52ecdf6837c6d9a9fea934e7676c) ) ROM_LOAD16_BYTE( "epr-13221.b8", 0x180001, 0x40000, CRC(9ae7546a) SHA1(5413b0131881b0b32bac8de51da9a299835014bb) ) ROM_LOAD16_BYTE( "epr-13228.a8", 0x180000, 0x40000, CRC(de3786be) SHA1(2279bb390aa3efab9aeee0a643e5cb6a4f5933b6) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13225.a4", 0x010000, 0x20000, CRC(56c2e82b) SHA1(d5755a1bb6e889d274dc60e883d4d65f12fdc877) ) ROM_LOAD( "mpr-13219.b4", 0x090000, 0x40000, CRC(19e2061f) SHA1(2dcf1718a43dab4da53b4f67722664e70ddd2169) ) ROM_LOAD( "mpr-13220.b5", 0x110000, 0x40000, CRC(58d4d9ce) SHA1(725e73a656845b02702ef131b4c0aa2a73cdd02e) ) ROM_LOAD( "mpr-13249.b6", 0x190000, 0x40000, CRC(623edc5d) SHA1(c32d9f818d40f311877fbe6532d9e95b6045c3c4) ) ROM_REGION( 0x10000, "mcu", 0 ) // protection MCU ROM_LOAD( "315-5437.ic4", 0x00000, 0x1000, CRC(4bf63bc1) SHA1(2766ab30b466b079febb30c488adad9ea56813f7) ) ROM_END /************************************************************************************************************************** Moonwalker, Sega System 18 CPU: FD1094 (317-0157, version uses i8751(315-5437) known to be exist) ROM Board: 171-5873B */ ROM_START( mwalkj ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code - custom cpu 317-0157 ROM_LOAD16_BYTE( "epr-13227.a6", 0x000000, 0x40000, CRC(6c0534b3) SHA1(23f35d1a15275cbc4b6d2f81f5634abac3832282) ) ROM_LOAD16_BYTE( "epr-13226.a5", 0x000001, 0x40000, CRC(99765854) SHA1(c00776c676b77fed4e94bb02f52f905c845ee73c) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0157.key", 0x0000, 0x2000, CRC(324d6931) SHA1(f8f4530a75aeeace1c8456da37118975c5c43316) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-13216.b1", 0x00000, 0x40000, CRC(862d2c03) SHA1(3c5446d702a639b62a602c6d687f9875d8450218) ) ROM_LOAD( "mpr-13217.b2", 0x40000, 0x40000, CRC(7d1ac3ec) SHA1(8495357304f1df135bba77ef3b96e79a883b8ff0) ) ROM_LOAD( "mpr-13218.b3", 0x80000, 0x40000, CRC(56d3393c) SHA1(50a2d065060692c9ecaa56046a781cb21d93e554) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-13224.b11", 0x000001, 0x40000, CRC(c59f107b) SHA1(10fa60fca6e34eda277c483bb1c0e81bb88c8a47) ) ROM_LOAD16_BYTE( "mpr-13231.a11", 0x000000, 0x40000, CRC(a5e96346) SHA1(a854f4dd5dc16975373255110fdb8ab3d121b1af) ) ROM_LOAD16_BYTE( "mpr-13223.b10", 0x080001, 0x40000, CRC(364f60ff) SHA1(9ac887ec0b2e32b504b7c6a5f3bb1ce3fe41a15a) ) ROM_LOAD16_BYTE( "mpr-13230.a10", 0x080000, 0x40000, CRC(9550091f) SHA1(bb6e898f7b540e130fd338c10f74609a7604cef4) ) ROM_LOAD16_BYTE( "mpr-13222.b9", 0x100001, 0x40000, CRC(523df3ed) SHA1(2e496125e75decd674c3a08404fbdb53791a965d) ) ROM_LOAD16_BYTE( "mpr-13229.a9", 0x100000, 0x40000, CRC(f40dc45d) SHA1(e9468cef428f52ecdf6837c6d9a9fea934e7676c) ) ROM_LOAD16_BYTE( "epr-13221.b8", 0x180001, 0x40000, CRC(9ae7546a) SHA1(5413b0131881b0b32bac8de51da9a299835014bb) ) ROM_LOAD16_BYTE( "epr-13228.a8", 0x180000, 0x40000, CRC(de3786be) SHA1(2279bb390aa3efab9aeee0a643e5cb6a4f5933b6) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-13225.a4", 0x010000, 0x20000, CRC(56c2e82b) SHA1(d5755a1bb6e889d274dc60e883d4d65f12fdc877) ) ROM_LOAD( "mpr-13219.b4", 0x090000, 0x40000, CRC(19e2061f) SHA1(2dcf1718a43dab4da53b4f67722664e70ddd2169) ) ROM_LOAD( "mpr-13220.b5", 0x110000, 0x40000, CRC(58d4d9ce) SHA1(725e73a656845b02702ef131b4c0aa2a73cdd02e) ) ROM_LOAD( "mpr-13249.b6", 0x190000, 0x40000, CRC(623edc5d) SHA1(c32d9f818d40f311877fbe6532d9e95b6045c3c4) ) ROM_REGION( 0x10000, "mcu", 0 ) // protection MCU // not verified if mcu is the same as the other sets.. ROM_LOAD( "315-5437.ic4", 0x00000, 0x1000, BAD_DUMP CRC(4bf63bc1) SHA1(2766ab30b466b079febb30c488adad9ea56813f7) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Pontoon, Sega System 18 CPU: FD1094 317-0153 ROM Board: 171-5873B */ ROM_START( pontoon ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-13175.a6", 0x000000, 0x40000, CRC(a2a5d0f5) SHA1(e22b13f152e0edadeb0f84b4a93ad366201cbae9) ) ROM_LOAD16_BYTE( "epr-13174.a5", 0x000001, 0x40000, CRC(db976b13) SHA1(3970968b21491beb8aac109eeb753b69ca752205) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0153.key", 0x0000, 0x2000, CRC(bcac8c7a) SHA1(1ee9db8f21a55cbfc391af9731d6a1dcf7f2d4c2) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "epr-13097.b1", 0x00000, 0x40000, CRC(6474b245) SHA1(af7db8ac8e74628a8ba61d0860960deeca4a3e3f) ) ROM_LOAD( "epr-13098.b2", 0x40000, 0x40000, CRC(89fc9a9b) SHA1(d98691eb5fef8aca4ad5e416d0a3797d6ca9b012) ) ROM_LOAD( "epr-13099.b3", 0x80000, 0x40000, CRC(790e0ac6) SHA1(a4999b7015ef27d6cbe4f53bc0d7fe05ee40d178) ) ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "epr-13173.b11", 0x000001, 0x40000, CRC(40a0ddfa) SHA1(f3917361f627865d2f1a22791904da056ce8a93a) ) ROM_LOAD16_BYTE( "epr-13176.a11", 0x000000, 0x40000, CRC(1184fbd2) SHA1(685ee2d7c4a0134af13ccf5d15f2e56a6b905195) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-12826a.a4", 0x10000, 0x20000, CRC(d41e2a3f) SHA1(087a6515ebefc3252a1feab5bf7b8a22bff9e379) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Shadow Dancer, Sega System 18 CPU: 68000 ROM Board: 171-5873B */ ROM_START( shdancer ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "shdancer.a6", 0x000000, 0x40000, CRC(3d5b3fa9) SHA1(370dd6e8ab9fb9e77eee9262d13fbdb4cf575abc) ) ROM_LOAD16_BYTE( "shdancer.a5", 0x000001, 0x40000, CRC(2596004e) SHA1(1b993aa74e7559f7e99253fd2144db9449c04cce) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-12712.b1", 0x00000, 0x40000, CRC(9bdabe3d) SHA1(4bb30fa2d4cdefe4a864cef7153b516bc5b02c42) ) ROM_LOAD( "mpr-12713.b2", 0x40000, 0x40000, CRC(852d2b1c) SHA1(8e5bc83d45e48b621ea3016207f2028fe41701e6) ) ROM_LOAD( "mpr-12714.b3", 0x80000, 0x40000, CRC(448226ce) SHA1(3060e4a43311069e2691d659c1e0c1a48edfeedb) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-12719.b11", 0x000001, 0x40000, CRC(d6888534) SHA1(2201f1921a68cf39e5a94b487c90e48d032d630f) ) ROM_LOAD16_BYTE( "mpr-12726.a11", 0x000000, 0x40000, CRC(ff344945) SHA1(2743778c42f53321f9691d60bbf94ea8baf1382f) ) ROM_LOAD16_BYTE( "mpr-12718.b10", 0x080001, 0x40000, CRC(ba2efc0c) SHA1(459a1a280f870c94aefb70127ed007cb090ed203) ) ROM_LOAD16_BYTE( "mpr-12725.a10", 0x080000, 0x40000, CRC(268a0c17) SHA1(2756054fa3c3aed30a1fce5e41acb0ceaebe90b5) ) ROM_LOAD16_BYTE( "mpr-12717.b9", 0x100001, 0x40000, CRC(c81cc4f8) SHA1(22f364e85057ceef533e051c8d0755b9691c5ec4) ) ROM_LOAD16_BYTE( "mpr-12724.a9", 0x100000, 0x40000, CRC(0f4903dc) SHA1(851bd60e877c9e39be23dc1fde91efc9da513c29) ) ROM_LOAD16_BYTE( "epr-12716.b8", 0x180001, 0x40000, CRC(a870e629) SHA1(29f6633240f9737ec19e16100decc7aa045b2060) ) ROM_LOAD16_BYTE( "epr-12723.a8", 0x180000, 0x40000, CRC(c606cf90) SHA1(cb53ae9a6da1eb31c584173d1fbbd1c8539fb54c) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-12720.a4", 0x10000, 0x20000, CRC(7a0d8de1) SHA1(eca5e2104e5b3e772d083a718171234f06ea8a55) ) ROM_LOAD( "mpr-12715.b4", 0x90000, 0x40000, CRC(07051a52) SHA1(d48658497f4a34665d3e051f893ff057c38925ae) ) ROM_END /************************************************************************************************************************** Shadow Dancer, Sega System 18 CPU: 68000 ROM Board: 171-5873B */ ROM_START( shdancerj ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12722b.a6", 0x000000, 0x40000, CRC(c00552a2) SHA1(74fddfe596bc00bc11c4a06e2103417e8fd334f6) ) ROM_LOAD16_BYTE( "epr-12721b.a5", 0x000001, 0x40000, CRC(653d351a) SHA1(1a03a154cb81a5a2f28c38aecdd6b5d107ea7ffa) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-12712.b1", 0x00000, 0x40000, CRC(9bdabe3d) SHA1(4bb30fa2d4cdefe4a864cef7153b516bc5b02c42) ) ROM_LOAD( "mpr-12713.b2", 0x40000, 0x40000, CRC(852d2b1c) SHA1(8e5bc83d45e48b621ea3016207f2028fe41701e6) ) ROM_LOAD( "mpr-12714.b3", 0x80000, 0x40000, CRC(448226ce) SHA1(3060e4a43311069e2691d659c1e0c1a48edfeedb) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-12719.b11", 0x000001, 0x40000, CRC(d6888534) SHA1(2201f1921a68cf39e5a94b487c90e48d032d630f) ) ROM_LOAD16_BYTE( "mpr-12726.a11", 0x000000, 0x40000, CRC(ff344945) SHA1(2743778c42f53321f9691d60bbf94ea8baf1382f) ) ROM_LOAD16_BYTE( "mpr-12718.b10", 0x080001, 0x40000, CRC(ba2efc0c) SHA1(459a1a280f870c94aefb70127ed007cb090ed203) ) ROM_LOAD16_BYTE( "mpr-12725.a10", 0x080000, 0x40000, CRC(268a0c17) SHA1(2756054fa3c3aed30a1fce5e41acb0ceaebe90b5) ) ROM_LOAD16_BYTE( "mpr-12717.b9", 0x100001, 0x40000, CRC(c81cc4f8) SHA1(22f364e85057ceef533e051c8d0755b9691c5ec4) ) ROM_LOAD16_BYTE( "mpr-12724.a9", 0x100000, 0x40000, CRC(0f4903dc) SHA1(851bd60e877c9e39be23dc1fde91efc9da513c29) ) ROM_LOAD16_BYTE( "epr-12716.b8", 0x180001, 0x40000, CRC(a870e629) SHA1(29f6633240f9737ec19e16100decc7aa045b2060) ) ROM_LOAD16_BYTE( "epr-12723.a8", 0x180000, 0x40000, CRC(c606cf90) SHA1(cb53ae9a6da1eb31c584173d1fbbd1c8539fb54c) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-12720.a4", 0x10000, 0x20000, CRC(7a0d8de1) SHA1(eca5e2104e5b3e772d083a718171234f06ea8a55) ) ROM_LOAD( "mpr-12715.b4", 0x90000, 0x40000, CRC(07051a52) SHA1(d48658497f4a34665d3e051f893ff057c38925ae) ) ROM_END /************************************************************************************************************************** Shadow Dancer, Sega System 18 CPU: 68000 ROM Board: 171-5873B game No. 833-7246-01 pcb No. 837-7248 rom No. 834-7247-01 */ ROM_START( shdancer1 ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "epr-12772b.a6", 0x000000, 0x40000, CRC(6868a4d4) SHA1(f0d142c81fe1eba4f5c59a0163e25c80ccfe85d7) ) ROM_LOAD16_BYTE( "epr-12771b.a5", 0x000001, 0x40000, CRC(04e30c84) SHA1(6c5705f7de6ee1bd754b51988cc7d1008f817c78) ) ROM_REGION( 0xc0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-12712.b1", 0x00000, 0x40000, CRC(9bdabe3d) SHA1(4bb30fa2d4cdefe4a864cef7153b516bc5b02c42) ) ROM_LOAD( "mpr-12713.b2", 0x40000, 0x40000, CRC(852d2b1c) SHA1(8e5bc83d45e48b621ea3016207f2028fe41701e6) ) ROM_LOAD( "mpr-12714.b3", 0x80000, 0x40000, CRC(448226ce) SHA1(3060e4a43311069e2691d659c1e0c1a48edfeedb) ) ROM_REGION16_BE( 0x200000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-12719.b11", 0x000001, 0x40000, CRC(d6888534) SHA1(2201f1921a68cf39e5a94b487c90e48d032d630f) ) ROM_LOAD16_BYTE( "mpr-12726.a11", 0x000000, 0x40000, CRC(ff344945) SHA1(2743778c42f53321f9691d60bbf94ea8baf1382f) ) ROM_LOAD16_BYTE( "mpr-12718.b10", 0x080001, 0x40000, CRC(ba2efc0c) SHA1(459a1a280f870c94aefb70127ed007cb090ed203) ) ROM_LOAD16_BYTE( "mpr-12725.a10", 0x080000, 0x40000, CRC(268a0c17) SHA1(2756054fa3c3aed30a1fce5e41acb0ceaebe90b5) ) ROM_LOAD16_BYTE( "mpr-12717.b9", 0x100001, 0x40000, CRC(c81cc4f8) SHA1(22f364e85057ceef533e051c8d0755b9691c5ec4) ) ROM_LOAD16_BYTE( "mpr-12724.a9", 0x100000, 0x40000, CRC(0f4903dc) SHA1(851bd60e877c9e39be23dc1fde91efc9da513c29) ) ROM_LOAD16_BYTE( "epr-12716.b8", 0x180001, 0x40000, CRC(a870e629) SHA1(29f6633240f9737ec19e16100decc7aa045b2060) ) ROM_LOAD16_BYTE( "epr-12723.a8", 0x180000, 0x40000, CRC(c606cf90) SHA1(cb53ae9a6da1eb31c584173d1fbbd1c8539fb54c) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-12720.a4", 0x10000, 0x20000, CRC(7a0d8de1) SHA1(eca5e2104e5b3e772d083a718171234f06ea8a55) ) ROM_LOAD( "mpr-12715.b4", 0x90000, 0x40000, CRC(07051a52) SHA1(d48658497f4a34665d3e051f893ff057c38925ae) ) ROM_END /************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Wally wo Sagase! (Where's Wally?), Sega System 18 CPU: FD1094 317-0197B ROM Board: 171-5873B */ ROM_START( wwallyj ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code - custom CPU 317-0197 (?) ROM_LOAD16_BYTE( "epr-14730b.a4", 0x000000, 0x40000, CRC(e72bc17a) SHA1(ac3b7d86571a6f510c202735134c1bc4809aa26e) ) ROM_LOAD16_BYTE( "epr-14731b.a6", 0x000001, 0x40000, CRC(6e3235b9) SHA1(11d5628644e8301550c36c93e5f137c67c11e735) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0197b.key", 0x0000, 0x2000, CRC(f5b7c5b4) SHA1(be971a2349e7c3adc995581355fea48f5123421c) ) ROM_REGION( 0x0c0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-14719.c1", 0x000000, 0x40000, CRC(8b58c743) SHA1(ee50baa184d68558d62d1817b2b9c138226ed25a) ) ROM_LOAD( "mpr-14720.c2", 0x040000, 0x40000, CRC(f96d19f4) SHA1(e350b551db8d01062397cd9a0c952a7b5dbf3fe6) ) ROM_LOAD( "mpr-14721.c3", 0x080000, 0x40000, CRC(c4ced91d) SHA1(4c8a070959ca10e2dddf407ddbba212415d78727) ) ROM_REGION16_BE( 0x500000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14726.c10", 0x000001, 0x100000, CRC(7213d1d3) SHA1(b70346a1dd3aa112bc696a7f4dd9ca908c3e5afa) ) ROM_LOAD16_BYTE( "mpr-14732.a10", 0x000000, 0x100000, CRC(04ced549) SHA1(59fd6510f0e14613d830ac6527f12ccc0b9351a5) ) ROM_LOAD16_BYTE( "mpr-14727.c11", 0x200001, 0x100000, CRC(3b74e0f0) SHA1(40432dbbbf75dae1e5e32b7cc2c4884f5e9e3bf5) ) ROM_LOAD16_BYTE( "mpr-14733.a11", 0x200000, 0x100000, CRC(6da0444f) SHA1(80c32895af19bda3277376fdbd1c163f0ed25665) ) ROM_LOAD16_BYTE( "mpr-14728.c12", 0x400001, 0x080000, CRC(5b921587) SHA1(2779dc658bb7a51f2399af5a6463ccb2dd388e88) ) ROM_LOAD16_BYTE( "mpr-14734.a12", 0x400000, 0x080000, CRC(6f3f5ed9) SHA1(01972c8bd5bfde58715bc0adc7dea73bf6350a26) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14725.c7", 0x010000, 0x20000, CRC(2b29684f) SHA1(b83962a4f475f9b3e79d4f7ff577b170c4043156) ) ROM_LOAD( "mpr-14724.c6", 0x090000, 0x80000, CRC(47cbea86) SHA1(c70d1fed2912c7c05223ce0bb0941706f957295f) ) ROM_LOAD( "mpr-14723.c5", 0x110000, 0x80000, CRC(bc5adc27) SHA1(09405002b940a3d3eb0f1258f37af51e0b7581b9) ) ROM_LOAD( "mpr-14722.c4", 0x190000, 0x80000, CRC(1bd081f8) SHA1(e5b0b5d8334486f813d7c430bb7fce3f69605a21) ) ROM_END /************************************************************************************************************************** Wally wo Sagase! (Where's Wally?), Sega System 18 CPU: FD1094 317-0197A ROM Board: 171-5873B */ ROM_START( wwallyja ) ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code - custom CPU 317-0197a ROM_LOAD16_BYTE( "epr-14730a.a4", 0x000000, 0x40000, CRC(daa7880e) SHA1(9ea83e04c3e07d84afa67097c28b3951c9db8d00) ) ROM_LOAD16_BYTE( "epr-14731a.a6", 0x000001, 0x40000, CRC(5e36353b) SHA1(488c54bbef3c8a129785465887bff3b301e11387) ) ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key ROM_LOAD( "317-0197a.key", 0x0000, 0x2000, CRC(2fb6a9a1) SHA1(2649d0905527dbe0dd0ad5cf68c457b4aa5fb32c) ) ROM_REGION( 0x0c0000, "gfx1", 0 ) // tiles ROM_LOAD( "mpr-14719.c1", 0x000000, 0x40000, CRC(8b58c743) SHA1(ee50baa184d68558d62d1817b2b9c138226ed25a) ) ROM_LOAD( "mpr-14720.c2", 0x040000, 0x40000, CRC(f96d19f4) SHA1(e350b551db8d01062397cd9a0c952a7b5dbf3fe6) ) ROM_LOAD( "mpr-14721.c3", 0x080000, 0x40000, CRC(c4ced91d) SHA1(4c8a070959ca10e2dddf407ddbba212415d78727) ) ROM_REGION16_BE( 0x500000, "sprites", 0 ) // sprites ROM_LOAD16_BYTE( "mpr-14726.c10", 0x000001, 0x100000, CRC(7213d1d3) SHA1(b70346a1dd3aa112bc696a7f4dd9ca908c3e5afa) ) ROM_LOAD16_BYTE( "mpr-14732.a10", 0x000000, 0x100000, CRC(04ced549) SHA1(59fd6510f0e14613d830ac6527f12ccc0b9351a5) ) ROM_LOAD16_BYTE( "mpr-14727.c11", 0x200001, 0x100000, CRC(3b74e0f0) SHA1(40432dbbbf75dae1e5e32b7cc2c4884f5e9e3bf5) ) ROM_LOAD16_BYTE( "mpr-14733.a11", 0x200000, 0x100000, CRC(6da0444f) SHA1(80c32895af19bda3277376fdbd1c163f0ed25665) ) ROM_LOAD16_BYTE( "mpr-14728.c12", 0x400001, 0x080000, CRC(5b921587) SHA1(2779dc658bb7a51f2399af5a6463ccb2dd388e88) ) ROM_LOAD16_BYTE( "mpr-14734.a12", 0x400000, 0x080000, CRC(6f3f5ed9) SHA1(01972c8bd5bfde58715bc0adc7dea73bf6350a26) ) ROM_REGION( 0x210000, "soundcpu", ROMREGION_ERASEFF ) // sound CPU ROM_LOAD( "epr-14725.c7", 0x010000, 0x20000, CRC(2b29684f) SHA1(b83962a4f475f9b3e79d4f7ff577b170c4043156) ) ROM_LOAD( "mpr-14724.c6", 0x090000, 0x80000, CRC(47cbea86) SHA1(c70d1fed2912c7c05223ce0bb0941706f957295f) ) ROM_LOAD( "mpr-14723.c5", 0x110000, 0x80000, CRC(bc5adc27) SHA1(09405002b940a3d3eb0f1258f37af51e0b7581b9) ) ROM_LOAD( "mpr-14722.c4", 0x190000, 0x80000, CRC(1bd081f8) SHA1(e5b0b5d8334486f813d7c430bb7fce3f69605a21) ) ROM_END /************************************* * * Generic driver initialization * *************************************/ DRIVER_INIT_MEMBER(segas18_state,generic_shad) { init_generic(ROM_BOARD_171_SHADOW); } DRIVER_INIT_MEMBER(segas18_state,generic_5874) { init_generic(ROM_BOARD_171_5874); } DRIVER_INIT_MEMBER(segas18_state,generic_5987) { init_generic(ROM_BOARD_171_5987); } /************************************* * * Game-specific driver inits * *************************************/ DRIVER_INIT_MEMBER(segas18_state,ddcrew) { init_generic_5987(); m_custom_io_r = read16_delegate(FUNC(segas18_state::ddcrew_custom_io_r), this); } DRIVER_INIT_MEMBER(segas18_state,lghost) { m_has_guns = true; init_generic_5987(); m_custom_io_r = read16_delegate(FUNC(segas18_state::lghost_custom_io_r), this); m_custom_io_w = write16_delegate(FUNC(segas18_state::lghost_custom_io_w), this); } DRIVER_INIT_MEMBER(segas18_state,wwally) { init_generic_5987(); m_custom_io_r = read16_delegate(FUNC(segas18_state::wwally_custom_io_r), this); m_custom_io_w = write16_delegate(FUNC(segas18_state::wwally_custom_io_w), this); } /************************************* * * Game driver(s) * *************************************/ // YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS GAME( 1990, astorm, 0, system18_fd1094, astorm2p, segas18_state,generic_5874, ROT0, "Sega", "Alien Storm (World, 2 Players, FD1094 317-0154)", 0 ) GAME( 1990, astorm3, astorm, system18_fd1094, astorm, segas18_state,generic_5874, ROT0, "Sega", "Alien Storm (World, 3 Players, FD1094 317-0148)", 0 ) GAME( 1990, astormu, astorm, system18_fd1094, astorm, segas18_state,generic_5874, ROT0, "Sega", "Alien Storm (US, 3 Players, FD1094 317-0147)", 0 ) GAME( 1990, astormj, astorm, system18_fd1094, astorm2p, segas18_state,generic_5874, ROT0, "Sega", "Alien Storm (Japan, 2 Players, FD1094 317-0146)", 0 ) GAME( 1989, bloxeed, 0, system18_fd1094, bloxeed, segas18_state,generic_5874, ROT0, "Sega", "Bloxeed (Japan, FD1094 317-0139)", 0 ) GAME( 1991, cltchitr, 0, system18_fd1094, cltchitr, segas18_state,generic_5987, ROT0, "Sega", "Clutch Hitter (US, FD1094 317-0176)", 0 ) GAME( 1991, cltchitrj, cltchitr, system18_fd1094, cltchitr, segas18_state,generic_5987, ROT0, "Sega", "Clutch Hitter (Japan, FD1094 317-0175)", 0 ) GAME( 1992, desertbr, 0, system18_fd1094, desertbr, segas18_state,generic_5987, ROT270, "Sega", "Desert Breaker (World, FD1094 317-0196)", 0 ) GAME( 1992, desertbrj, desertbr, system18_fd1094, desertbr, segas18_state,generic_5987, ROT270, "Sega", "Desert Breaker (Japan, FD1094 317-0194)", 0 ) GAME( 1991, ddcrew, 0, system18_fd1094, ddcrew, segas18_state,ddcrew, ROT0, "Sega", "D. D. Crew (World, 3 Players, FD1094 317-0190)", 0 ) GAME( 1991, ddcrewu, ddcrew, system18_fd1094, ddcrew, segas18_state,ddcrew, ROT0, "Sega", "D. D. Crew (US, 4 Players, FD1094 317-0186)", 0 ) GAME( 1991, ddcrew2, ddcrew, system18_fd1094, ddcrew2p, segas18_state,ddcrew, ROT0, "Sega", "D. D. Crew (World, 2 Players, FD1094 317-0184)", 0 ) GAME( 1991, ddcrew1, ddcrew, system18_fd1094, ddcrew, segas18_state,ddcrew, ROT0, "Sega", "D. D. Crew (World, 4 Players, FD1094 317-0187)", 0 ) GAME( 1991, ddcrewj, ddcrew, system18_fd1094, ddcrew2p, segas18_state,ddcrew, ROT0, "Sega", "D. D. Crew (Japan, 2 Players, FD1094 317-0182)", 0 ) GAME( 1990, lghost, 0, system18_fd1094, lghost, segas18_state,lghost, ROT0, "Sega", "Laser Ghost (World, FD1094 317-0166)", 0 ) GAME( 1990, lghostu, lghost, system18_fd1094, lghost, segas18_state,lghost, ROT0, "Sega", "Laser Ghost (US, FD1094 317-0165)", 0 ) GAME( 1990, mwalk, 0, system18_fd1094_i8751,mwalk, segas18_state,generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (World, FD1094/8751 317-0159)", 0 ) GAME( 1990, mwalku, mwalk, system18_fd1094_i8751,mwalka, segas18_state,generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (US, FD1094/8751 317-0158)", 0 ) GAME( 1990, mwalkj, mwalk, system18_fd1094_i8751,mwalk, segas18_state,generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (Japan, FD1094/8751 317-0157)", 0 ) GAME( 1989, pontoon, 0, system18, shdancer, segas18_state,generic_5874, ROT0, "Sega", "Pontoon", GAME_NOT_WORKING ) GAME( 1989, shdancer, 0, system18, shdancer, segas18_state,generic_shad, ROT0, "Sega", "Shadow Dancer (World)", 0 ) GAME( 1989, shdancerj, shdancer, system18, shdancer, segas18_state,generic_shad, ROT0, "Sega", "Shadow Dancer (Japan)", 0 ) GAME( 1989, shdancer1, shdancer, system18, shdancer, segas18_state,generic_shad, ROT0, "Sega", "Shadow Dancer (US)", 0 ) GAME( 1992, wwallyj, 0, system18_fd1094, wwally, segas18_state,wwally, ROT0, "Sega", "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0) // the roms do contain an english logo so maybe there is a world / us set too GAME( 1992, wwallyja, wwallyj, system18_fd1094, wwally, segas18_state,wwally, ROT0, "Sega", "Wally wo Sagase! (rev A, Japan, FD1094 317-0197A)", 0 )
[ "ilitirit@gmail.com" ]
ilitirit@gmail.com
a305bcac7a15971fe8400bd737f6074a9d9eff19
6bbc5bb4f4ee45743befea6ef50a1ea7e78c3b5b
/src/ch5/ch5_3.c
3476cec773d44be1370ddd67e1eb1053401e23f1
[]
no_license
salgado/apue-4
ce4fa91f4c8edab261723387fa69a90ca71f608f
9da750073dc0ed05f1a216bdc9c4b06aae6427db
refs/heads/master
2021-01-18T20:19:24.479599
2013-08-23T14:59:26
2013-08-23T14:59:26
null
0
0
null
null
null
null
UTF-8
C
false
false
869
c
#include <apue.h> void pr_stdio(const char*, FILE *); int main(int argc, char* argv[]) { FILE* fp; fputs("enter any character\n", stdout); if (getchar() == EOF) err_sys("getchar error"); fputs("one line to standard error\n", stderr); pr_stdio("stdin", stdin); pr_stdio("stdout", stdout); pr_stdio("stderr", stderr); if ((fp = fopen("/etc/motd", "r")) == NULL) err_sys("fopen error"); if (getc(fp) == EOF) err_sys("getc error"); pr_stdio("/etc/motd", fp); return 0; } void pr_stdio(const char* name, FILE* fp) { printf("stream = %s, ", name); if (fp->_IO_file_flags & _IO_UNBUFFERED) { printf("unbuffered"); } else if (fp->_IO_file_flags & _IO_LINE_BUF) { printf("line buffered"); } else { printf("fully buffered"); } printf(", buffer size = %d\n", fp->_IO_buf_end - fp->_IO_buf_base); return; }
[ "leimou@leimou-PC.(none)" ]
leimou@leimou-PC.(none)
b8afca2a818d034a3cda50474efeb6105783ceb3
872b06be8dc2f13a992f95341dceb7b635a68740
/schedule_rr.c
03eb0b3c5025a806ab2231e3b74c9a7295be95ea
[]
no_license
PauloHMTeixeira/Scheduling-Algorithms
b08f0a34bfe7d4f10eff23172215486983ef0c6b
a3c53ec8a5eaa31495aa0832197c9d87e02f2638
refs/heads/master
2021-04-18T14:27:05.568888
2020-03-26T06:54:21
2020-03-26T06:54:21
249,553,386
0
1
null
null
null
null
UTF-8
C
false
false
4,081
c
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 100 #define QUANTUM 25 void schedule(char* name[],int array[],int array2[],int tamanho); int main(int argc, char *argv[]){ FILE *in; char *temp; char task[SIZE]; char *name; char *array_nomes[SIZE]; int array_priority[SIZE]; int array_burst[SIZE]; int priority; int burst; in = fopen(argv[1],"r"); int i = 0; int j = 0; while (fgets(task,SIZE,in) != NULL) { temp = strdup(task); name = strsep(&temp,","); array_nomes[j] = name; j++; priority = atoi(strsep(&temp,",")); array_priority[i] = priority; burst = atoi(strsep(&temp,",")); array_burst[i] = burst; i++; free(temp); } fclose(in); schedule(array_nomes,array_priority,array_burst,i); } void schedule(char* name[],int array_priority[],int array_burst[],int tamanho){ FILE *fp = fopen("rr.txt","a"); fprintf(fp,"%s\n\n","EXECUTION BY RR"); int aux_burst[tamanho]; int aux_response[tamanho]; for(int i=0;i<tamanho;i++){ aux_burst[i] = array_burst[i]; aux_response[i] = QUANTUM*i; } double media_turnaround = 0.0; double media_waiting = 0.0; double media_response = 0.0; int restante = 0; int tempo=0; int marcador; int i=0; int turnaround = 0; int waiting = 0; int response = 0; double turnaround_total = 0; double waiting_total = 0; double response_total = 0; while(1){ if(restante==tamanho){ break; } else{ if(aux_burst[i]>0 && aux_burst[i]>=QUANTUM){ fprintf(fp,"[%s] %s %d %s\n",name[i],"for",QUANTUM,"units"); }if(aux_burst[i]>0 && aux_burst[i]<QUANTUM){ fprintf(fp,"[%s] %s %d %s\n",name[i],"for",aux_burst[i],"units"); } if(aux_burst[i]<=QUANTUM && aux_burst[i]>0){ aux_burst[i]=0; marcador=1; }else if(aux_burst[i]>0){ aux_burst[i]-=QUANTUM; }if(aux_burst[i]==0 && marcador==1){ restante++; marcador=0; } i++; if(tamanho==i){ i=0; } } } for(int i=0;i<tamanho;i++){ aux_burst[i] = array_burst[i]; } restante = 0; i = 0; fprintf(fp,"\n%s\n","METRICS"); while(1){ if(restante==tamanho){ break; } else{ // printf("nome: %s ----------- tempo restante: %d\n",name[i],aux_burst[i]); if(aux_burst[i]<=QUANTUM && aux_burst[i]>0){ tempo += aux_burst[i]; aux_burst[i]=0; marcador=1; }else if(aux_burst[i]>0){ aux_burst[i]-=QUANTUM; tempo += QUANTUM; }if(aux_burst[i]==0 && marcador==1){ // printf("oi"); turnaround_total += tempo; waiting=tempo-array_burst[i]; response+=tempo-array_burst[i]; fprintf(fp,"\n[%s]\n",name[i]); fprintf(fp,"%s %s %d\n","Turnaround","time:",tempo); fprintf(fp,"%s %s %d\n","Wainting","time:",waiting); fprintf(fp,"%s %s %d\n","Response","time:",aux_response[i]); waiting_total+=waiting; response_total+=aux_response[i]; marcador = 0; restante++; } i++; if(tamanho==i){ i=0; } } } media_turnaround = turnaround_total/tamanho; media_waiting = waiting_total/tamanho; media_response = response_total/tamanho; fprintf(fp,"\n%s %s %s %s %f\n","Average","turnaround","time","=",media_turnaround); fprintf(fp,"%s %s %s %s %f\n","Average","waiting","time","=",media_waiting); fprintf(fp,"%s %s %s %s %f","Average","response","time","=",media_response); }
[ "noreply@github.com" ]
PauloHMTeixeira.noreply@github.com
f6c818fb488fadac68573b901553ed154bc62d86
b356adc9bd515d919edcdda9b2aceded1b7dc905
/include/linux/atm.h
ea09022197bc783cccf7263275655d81a02d85a2
[]
no_license
wisen/tiny_kernel_comment
ca57b10a4df8eef989435ac5974fae5df0f1cc20
3401fe62392c62f735fc6dac1d96c51cca44d249
refs/heads/master
2020-03-17T21:48:36.830903
2018-11-05T16:52:57
2018-11-05T16:52:57
133,976,587
0
0
null
null
null
null
UTF-8
C
false
false
296
h
/* atm.h - general ATM declarations */ #ifndef _LINUX_ATM_H #define _LINUX_ATM_H #include <uapi/linux/atm.h> #if 0//#ifdef CONFIG_COMPAT//CONFIG_COMPAT is not set #include <linux/compat.h> struct compat_atmif_sioc { int number; int length; compat_uptr_t arg; }; #endif #endif
[ "wisen.wang.ah@gmail.com" ]
wisen.wang.ah@gmail.com
29290cf8d709dc1cd8f76a7b9df7212ff8d4bf97
e2713d3231b2bd5cfbbb69c9b662621838b38b4f
/libsrc/epay/GetFullName.c
d54873daade8d8d8c3e84ecc7ca1131cc717076b
[]
no_license
sqf-ice/epay5
ba5bc190b30aac33a783e87568ee294fd149e7d7
7d9943f6cfe5982f40c7a539bd55b1f61f8024cb
refs/heads/master
2020-05-16T10:33:01.840749
2013-07-16T08:50:11
2013-07-16T08:50:11
182,988,702
0
1
null
2019-04-23T10:10:45
2019-04-23T10:10:45
null
GB18030
C
false
false
1,409
c
/****************************************************************** ** Copyright(C)2006 - 2008联迪商用设备有限公司 ** 主要内容:易收付平台epay公共库 获取完整文件名 ** 创 建 人:冯炜 ** 创建日期:2012-12-10 ** ** $Revision: 1.3 $ ** $Log: GetFullName.c,v $ ** Revision 1.3 2012/12/20 09:25:54 wukj ** Revision后的美元符 ** *******************************************************************/ #include <stdlib.h> #include <stdio.h> #include <string.h> /**************************************************************** ** 功 能:获取完整文件名 ** 输入参数: ** szEnvName 环境变量名 ** szFileName 短文件名 ** 输出参数: ** szFullFileName 完整文件名 ** 返 回 值: ** char* 完整文件名 ** 作 者: ** fengwei ** 日 期: ** 2012/12/10 ** 调用说明: ** ** 修改日志: ****************************************************************/ char* GetFullName(char* szEnvName, char* szFileName, char* szFullFileName) { char szEnv[64+1]; memset(szEnv, 0, sizeof(szEnv)); if(getenv(szEnvName) != NULL) { strcpy(szEnv, getenv(szEnvName)); } else { strcpy(szEnv, "/"); } sprintf(szFullFileName, "%s%s", szEnv, szFileName); return szFullFileName; }
[ "charlielin6@foxmail.com" ]
charlielin6@foxmail.com
e27ae7034cc489f5ac6cafc399d0c09b5eebd933
637fcd60a4e2a98ebbeaaa9551554a13e1ebfdba
/quad/ctrl/paparazzi/sw/airborne/subsystems/electrical.c
54ecb6f4355c44cfcf1e49eeccfc167f99bc9f78
[]
no_license
zoomx/lxyppc-tetrix
b7079c07aee9b85a34207245f526e1613fdb0498
884027f37594f9f006f88d634c4392a60c482491
refs/heads/master
2021-01-10T21:04:54.219013
2015-05-10T08:45:33
2015-05-10T08:45:33
35,362,463
12
0
null
null
null
null
UTF-8
C
false
false
2,662
c
#include "subsystems/electrical.h" #include "mcu_periph/adc.h" #include "commands.h" #include "generated/airframe.h" #include BOARD_CONFIG #ifdef MILLIAMP_PER_PERCENT #warning "deprecated MILLIAMP_PER_PERCENT --> Please use MILLIAMP_AT_FULL_THROTTLE" #endif #if defined BATTERY_SENS || defined BATTERY_OFFSET #warning "BATTERY_SENS and BATTERY_OFFSET are deprecated, please remove them --> if you want to change the default use VoltageOfAdc" #endif struct Electrical electrical; static struct { struct adc_buf vsupply_adc_buf; #ifdef ADC_CHANNEL_CURRENT struct adc_buf current_adc_buf; #endif #ifdef MILLIAMP_AT_FULL_THROTTLE float nonlin_factor; #endif } electrical_priv; #ifndef VoltageOfAdc #define VoltageOfAdc(adc) DefaultVoltageOfAdc(adc) #endif #ifndef MilliAmpereOfAdc #define MilliAmpereOfAdc(adc) DefaultMilliAmpereOfAdc(adc) #endif #ifndef CURRENT_ESTIMATION_NONLINEARITY #define CURRENT_ESTIMATION_NONLINEARITY 1.2 #endif void electrical_init(void) { electrical.vsupply = 0; electrical.current = 0; adc_buf_channel(ADC_CHANNEL_VSUPPLY, &electrical_priv.vsupply_adc_buf, DEFAULT_AV_NB_SAMPLE); #ifdef ADC_CHANNEL_CURRENT adc_buf_channel(ADC_CHANNEL_CURRENT, &electrical_priv.current_adc_buf, DEFAULT_AV_NB_SAMPLE); #endif #ifdef MILLIAMP_AT_FULL_THROTTLE electrical_priv.nonlin_factor = CURRENT_ESTIMATION_NONLINEARITY; #endif } void electrical_periodic(void) { #ifndef SITL electrical.vsupply = VoltageOfAdc((10*(electrical_priv.vsupply_adc_buf.sum/electrical_priv.vsupply_adc_buf.av_nb_sample))); #endif #ifdef ADC_CHANNEL_CURRENT #ifndef SITL electrical.current = MilliAmpereOfAdc((electrical_priv.current_adc_buf.sum/electrical_priv.current_adc_buf.av_nb_sample)); #endif #else #if defined MILLIAMP_AT_FULL_THROTTLE && defined COMMAND_THROTTLE /* * Superellipse: abs(x/a)^n + abs(y/b)^n = 1 * with a = 1 * b = mA at full throttle * n = 1.2 This defines nonlinearity (1 = linear) * x = throttle * y = current * * define CURRENT_ESTIMATION_NONLINEARITY in your airframe file to change the default nonlinearity factor of 1.2 */ float b = (float)MILLIAMP_AT_FULL_THROTTLE; float x = ((float)commands[COMMAND_THROTTLE]) / ((float)MAX_PPRZ); /* electrical.current y = ( b^n - (b* x/a)^n )^1/n * a=1, n = electrical_priv.nonlin_factor */ electrical.current = b - pow((pow(b,electrical_priv.nonlin_factor)-pow((b*x),electrical_priv.nonlin_factor)), (1./electrical_priv.nonlin_factor)); #endif #endif /* ADC_CHANNEL_CURRENT */ }
[ "lxyppc@gmail.com@a1e0bfe9-9f80-e943-2008-5ec03726fcf4" ]
lxyppc@gmail.com@a1e0bfe9-9f80-e943-2008-5ec03726fcf4
2717ae0912c87ef5cfbce0879ea91c141e7b1788
f59a6d5664f11ae261034b62960fb705222fc36d
/mem_debug.h
2452dc6de386f1e359d1cae13e0fdc736ef55216
[]
no_license
tristanlee/mem_debug
c73aa84085f41a8525be56bf26f54e2c696c4ef1
c285c3c05bf0eb3b1c18c0457786781ba4bf748b
refs/heads/master
2022-01-16T08:15:24.340386
2018-08-19T07:23:33
2018-08-19T07:23:33
145,282,101
0
0
null
null
null
null
UTF-8
C
false
false
590
h
#ifndef __MEM_DEBUG_H__ #define __MEM_DEBUG_H__ #ifdef __cplusplus extern "C" { #endif // Here we write our own secure malloc that will be monitoring memory heap void* MEMD_Alloc(long nbytes, const char *file, int line); void MEMD_Free(void *ptr, const char *file, int line); void* MEMD_Calloc(long count, long nbytes, const char *file, int line); void* MEMD_Realloc(void *ptr, long nbytes, const char *file, int line); void* MEMD_Strdup(const char *str, const char *file, int line); void MEMD_Init(void); void MEMD_Check( void ); #ifdef __cplusplus } #endif #endif // __MEM_DEBUG_H__
[ "tristan.lee@qq.com" ]
tristan.lee@qq.com
0f7117c105dc7ade7034afa27126faa22129a69b
5b4a604c5fd4b0d1f92965a1d8c2ddbbe7449acd
/hw15/warmup.c
89735fafebe680ce0981730eae525760daf3357f
[]
no_license
huynhtritaiml2/ECE-264-Advanced-C-Programming
3f5eb8b1d44ec962e0cc2f14cc13c4b224fa0e45
90f05c3f9766e5b15339690f4710834bd24f8ad4
refs/heads/master
2022-12-07T16:06:46.688799
2020-09-04T00:04:17
2020-09-04T00:04:17
null
0
0
null
null
null
null
UTF-8
C
false
false
8,488
c
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <stdint.h> #include <string.h> #include "print_bits.h" /******************************************************************************************\ * Instructions: * * Fill in each function, according to the description following the restrictions below. * * To compile this file use this command: * gcc -o warmup warmup.c print_bits.o * * RESTRICTIONS: * ∙ The body of every function must be exactly one statement, except for print_bits(…) * which must be exactly 3 statements. * ∙ Do not use the constant 0xff in create_string_of_eight_1s(). Other functions are fine. * In fact, you *should* use it in other functions. * * The comments in this file write numbers in bits like this: 11111111₂ or 10111010₂. * * C11 does not actually accept constants like that. When writing code that uses bit * manipulations, always write constants in hexadecimal notation (e.g., 0xff for 11111111₂, * 0xBA for 10111010₂), except zero, which you can write as either 0 or 0x00 (your choice). * * Note: The last file ends with ".o" not ".c". It is a compiled "object file". We are * giving you code you can use to diagnose the correctness of your other code, while also * asking you to implement the print_bits(…) function. * * The two functions provided by print_bits.o are described in print_bits.h. * * You may add anything you like to the main(…) function. If you do not want to use * the functions in print_bits.o, you may remove the #include "print_bits.h". \******************************************************************************************/ uint8_t create_string_of_eight_1s() { // This function always returns 11111111₂. return 0xff; // TODO: Rewrite this to use 0x00 and a bitwise operator. } uint8_t create_string_of_0s_at_left(uint8_t num_0s) { // Examples: // ∙ create_string_of_0s_at_left(1) would return 01111111₂. // ∙ create_string_of_0s_at_left(2) would return 00111111₂. // ∙ create_string_of_0s_at_left(3) would return 00011111₂. // ∙ create_string_of_0s_at_left(0) would return 11111111₂. // ∙ create_string_of_0s_at_left(8) would return 00000000₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t create_string_of_0s_at_right(uint8_t num_0s) { // Examples: // ∙ create_string_of_0s_at_right(1) would return 11111110₂. // ∙ create_string_of_0s_at_right(2) would return 11111100₂. // ∙ create_string_of_0s_at_right(3) would return 11111000₂. // ∙ create_string_of_0s_at_right(0) would return 11111111₂. // ∙ create_string_of_0s_at_right(8) would return 00000000₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t create_string_of_1s_at_left(uint8_t num_1s) { // Examples: // ∙ create_string_of_1s_at_left(2) would return 11000000₂. // ∙ create_string_of_1s_at_left(0) would return 00000000₂. // ∙ create_string_of_1s_at_left(8) would return 11111111₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t create_string_of_1s_at_right(uint8_t num_1s) { // Examples: // ∙ create_string_of_1s_at_right(2) would return 00000011₂. // ∙ create_string_of_1s_at_right(0) would return 00000000₂. // ∙ create_string_of_1s_at_right(8) would return 11111111₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t set_left_bits(uint8_t byte, uint8_t num_bits_to_set) { // Examples: // ∙ set_left_bits(00000000₂, 2) would return 11000000₂. // ∙ set_left_bits(00001010₂, 2) would return 11001010₂. // ∙ set_left_bits(10101010₂, 2) would return 11101010₂. // ∙ set_left_bits(10101010₂, 0) would return 10101010₂. // ∙ set_left_bits(11111111₂, 0) would return 11111111₂. // ∙ set_left_bits(10101010₂, 8) would return 11111111₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t set_right_bits(uint8_t byte, uint8_t num_bits_to_set) { // Examples: // ∙ set_right_bits(00000000₂, 2) would return 00000011₂. // ∙ set_right_bits(00001010₂, 2) would return 00001011₂. // ∙ set_right_bits(10101010₂, 2) would return 10101011₂. // ∙ set_right_bits(10101010₂, 0) would return 10101010₂. // ∙ set_right_bits(11111111₂, 0) would return 11111111₂. // ∙ set_right_bits(10101010₂, 8) would return 11111111₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t unset_left_bits(uint8_t byte, uint8_t num_bits_to_unset) { // Examples: // ∙ unset_left_bits(00111111₂, 2) would return 00111111₂. // ∙ unset_left_bits(11110101₂, 2) would return 00110101₂. // ∙ unset_left_bits(01010101₂, 2) would return 00010101₂. // ∙ unset_left_bits(01010101₂, 1) would return 01010101₂. // ∙ unset_left_bits(00000000₂, 1) would return 00000000₂. // ∙ unset_left_bits(01010101₂, 8) would return 00000000₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t unset_right_bits(uint8_t byte, uint8_t num_bits_to_unset) { // Examples: // ∙ unset_right_bits(11111111₂, 2) would return 11111100₂. // ∙ unset_right_bits(11110101₂, 2) would return 11110100₂. // ∙ unset_right_bits(01010101₂, 2) would return 01010100₂. // ∙ unset_right_bits(01010101₂, 1) would return 01010100₂. // ∙ unset_right_bits(00000000₂, 1) would return 00000000₂. // ∙ unset_right_bits(01010101₂, 8) would return 00000000₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t toggle_left_bits(uint8_t byte, uint8_t num_bits_to_toggle) { // Examples: // ∙ toggle_left_bits(11111111₂, 2) would return 00111111₂. // ∙ toggle_left_bits(01011111₂, 4) would return 10101111₂. return 0; // TODO: replace this with a one-line implementation of this function. } uint8_t toggle_right_bits(uint8_t byte, uint8_t num_bits_to_toggle) { // Examples: // ∙ toggle_right_bits(11111111₂, 2) would return 00111100₂. // ∙ toggle_right_bits(11110101₂, 4) would return 11111010₂. return 0; // TODO: replace this with a one-line implementation of this function. } void print_bits(uint8_t bits) { // Print the bits in 'bits' as '0' and '1' characters. Do not print a newline at the end. // // Example: // ∙ print_bits_plain(0xff) should output the same as // → printf("11111111"). } int main(int argc, char* argv[]) { printf("Print 10111010 to demonstrate color (m=magenta, y=yellow)\n"); printf("expected: mmmyyyyy\nactual: "); print_bits_color(0xba, 3, "magenta", "yellow"); printf("\n"); printf("create_string_of_eight_1s()\n"); printf("expected: 11111111\nactual: "); print_bits_plain(create_string_of_eight_1s()); printf("\n"); printf("create_string_of_1s_at_left(3)\n"); printf("expected: 11100000\nactual: "); print_bits_color(create_string_of_1s_at_left(3), 3, NULL, "green"); printf("\n"); printf("create_string_of_1s_at_right(3)\n"); printf("expected: 00000111\nactual: "); print_bits_color(create_string_of_1s_at_right(3), 5, NULL, "green"); printf("\n"); printf("set_left_bits(00000000₂, 2)\n"); printf("expected: 11000000\nactual: "); print_bits_color(set_left_bits(0x00, 2), 2, "green", NULL); printf("\n"); printf("set_right_bits(00000000₂, 2)\n"); printf("expected: 00000011\nactual: "); print_bits_color(set_right_bits(0x00, 2), 6, NULL, "green"); printf("\n"); printf("unset_left_bits(11111111₂, 2)\n"); printf("expected: 00111111\nactual: "); print_bits_color(unset_left_bits(0xff, 2), 2, "green", NULL); printf("\n"); printf("unset_right_bits(11111111₂, 2)\n"); printf("expected: 11111100\nactual: "); print_bits_color(unset_right_bits(0xff, 2), 6, NULL, "green"); printf("\n"); printf("toggle_left_bits(10101010₂, 4)\n"); printf("expected: 01011010\nactual: "); print_bits_color(toggle_left_bits(0xaa, 4), 4, "green", NULL); // 0xaa is 10101010₂ printf("\n"); printf("toggle_right_bits(10101010₂, 4)\n"); printf("expected: 10100101\nactual: "); print_bits_color(toggle_right_bits(0xaa, 4), 4, NULL, "green"); // 0xaa is 10101010₂ printf("\n"); return EXIT_SUCCESS; } #define __WARMUP_C_V2__ /* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */
[ "nguyen.tb17@gmail.com" ]
nguyen.tb17@gmail.com
fbac5783e0dcc533590a820ea193730149fda871
727f1bc2205c88577b419cf0036c029b8c6f7766
/out-bin/py/google/fhir/models/model_test.runfiles/com_google_fhir/external/pypi__tensorflow_1_12_0/tensorflow-1.12.0.data/purelib/tensorflow/include/external/boringssl/src/include/openssl/ec.h
a37ff06338a861fbd8fdb93cac6f6092b20357ee
[ "Apache-2.0" ]
permissive
rasalt/fhir
55cf78feed3596a3101b86f9e9bbf6652c6ed4ad
d49883cc4d4986e11ca66058d5a327691e6e048a
refs/heads/master
2020-04-13T00:16:54.050913
2019-01-15T14:22:15
2019-01-15T14:22:15
160,260,223
0
0
Apache-2.0
2018-12-03T22:07:01
2018-12-03T22:07:01
null
UTF-8
C
false
false
203
h
/home/rkharwar/.cache/bazel/_bazel_rkharwar/c4bcd65252c8f8250f091ba96375f9a5/external/pypi__tensorflow_1_12_0/tensorflow-1.12.0.data/purelib/tensorflow/include/external/boringssl/src/include/openssl/ec.h
[ "ruchika.kharwar@gmail.com" ]
ruchika.kharwar@gmail.com
8812d5ce0182bcf3e5c6d9c5fa5c55f64134e165
1dc1a37c1d3164f8f4de774b6e2b29322e0860bb
/Software/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal.c
03bc12a290449cada2f79905ef018e37549c2fe5
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
ImperialSpaceSociety/picotracker-Lora
72101043c1facb3fab5b1e25c27405a5683e50c2
90b6139331d7e5baef461a63c06570be112ad7e4
refs/heads/master
2021-10-08T00:37:10.617798
2021-09-28T16:49:25
2021-09-28T16:49:25
216,109,895
16
2
null
2021-07-10T22:07:20
2019-10-18T21:32:32
C
UTF-8
C
false
false
17,736
c
/** ****************************************************************************** * @file stm32l0xx_hal.c * @author MCD Application Team * @brief HAL module driver. * This is the common part of the HAL initialization * @verbatim ============================================================================== ##### How to use this driver ##### ============================================================================== [..] The common HAL driver contains a set of generic and common APIs that can be used by the PPP peripheral drivers and the user to start using the HAL. [..] The HAL contains two APIs categories: (+) Common HAL APIs (+) Services HAL APIs @endverbatim ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32l0xx_hal.h" /** @addtogroup STM32L0xx_HAL_Driver * @{ */ #ifdef HAL_MODULE_ENABLED /** @addtogroup HAL * @brief HAL module driver. * @{ */ /** @addtogroup HAL_Exported_Constants * @{ */ /** @defgroup SysTick System Tick * @{ */ /** * @brief uwTick_variable uwTick variable */ __IO uint32_t uwTick; /** * @} */ /** @defgroup HAL_Version HAL Version * @{ */ /** * @brief STM32L0xx HAL Driver version number */ #define __STM32L0xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ #define __STM32L0xx_HAL_VERSION_SUB1 (0x09U) /*!< [23:16] sub1 version */ #define __STM32L0xx_HAL_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ #define __STM32L0xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ #define __STM32L0xx_HAL_VERSION ((__STM32L0xx_HAL_VERSION_MAIN << 24U)\ |(__STM32L0xx_HAL_VERSION_SUB1 << 16U)\ |(__STM32L0xx_HAL_VERSION_SUB2 << 8U )\ |(__STM32L0xx_HAL_VERSION_RC)) #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFFU) /** * @} */ /** * @} */ /** @defgroup HAL_Private HAL Private * @{ */ /** * @} */ /** @addtogroup HAL_Exported_Functions HAL Exported Functions * @{ */ /** @addtogroup HAL_Exported_Functions_Group1 * @brief Initialization and de-initialization functions * @verbatim =============================================================================== ##### Initialization and de-initialization functions ##### =============================================================================== [..] This section provides functions allowing to: (+) Initializes the Flash interface, the NVIC allocation and initial clock configuration. It initializes the source of time base also when timeout is needed and the backup domain when enabled. (+) de-Initializes common part of the HAL. (+) Configure The time base source to have 1ms time base with a dedicated Tick interrupt priority. (++) Systick timer is used by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. (++) Time base configuration function (HAL_InitTick ()) is called automatically at the beginning of the program after reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). (++) Source of time base is configured to generate interrupts at regular time intervals. Care must be taken if HAL_Delay() is called from a peripheral ISR process, the Tick interrupt line must have higher priority (numerically lower) than the peripheral interrupt. Otherwise the caller ISR process will be blocked. (++) functions affecting time base configurations are declared as __weak to make override possible in case of other implementations in user file. @endverbatim * @{ */ /** * @brief This function configures the Flash prefetch, Flash preread and Buffer cache, * Configures time base source, NVIC and Low level hardware * @note This function is called at the beginning of program after reset and before * the clock configuration * @note The time base configuration is based on MSI clock when exiting from Reset. * Once done, time base tick start incrementing. * In the default implementation,Systick is used as source of time base. * the tick variable is incremented each 1ms in its ISR. * @retval HAL status */ HAL_StatusTypeDef HAL_Init(void) { /* Configure Buffer cache, Flash prefetch, Flash preread */ #if (BUFFER_CACHE_DISABLE != 0) __HAL_FLASH_BUFFER_CACHE_DISABLE(); #endif /* BUFFER_CACHE_DISABLE */ #if (PREREAD_ENABLE != 0) __HAL_FLASH_PREREAD_BUFFER_ENABLE(); #endif /* PREREAD_ENABLE */ #if (PREFETCH_ENABLE != 0) __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); #endif /* PREFETCH_ENABLE */ /* Use systick as time base source and configure 1ms tick (default clock after Reset is MSI) */ HAL_InitTick(TICK_INT_PRIORITY); /* Init the low level hardware */ HAL_MspInit(); /* Return function status */ return HAL_OK; } /** * @brief This function de-Initializes common part of the HAL and stops the source * of time base. * @note This function is optional. * @retval HAL status */ HAL_StatusTypeDef HAL_DeInit(void) { /* Reset of all peripherals */ __HAL_RCC_APB1_FORCE_RESET(); __HAL_RCC_APB1_RELEASE_RESET(); __HAL_RCC_APB2_FORCE_RESET(); __HAL_RCC_APB2_RELEASE_RESET(); __HAL_RCC_AHB_FORCE_RESET(); __HAL_RCC_AHB_RELEASE_RESET(); __HAL_RCC_IOP_FORCE_RESET(); __HAL_RCC_IOP_RELEASE_RESET(); /* De-Init the low level hardware */ HAL_MspDeInit(); /* Return function status */ return HAL_OK; } /** * @brief Initializes the MSP. * @retval None */ __weak void HAL_MspInit(void) { /* NOTE : This function Should not be modified, when the callback is needed, the HAL_MspInit could be implemented in the user file */ } /** * @brief DeInitializes the MSP. * @retval None */ __weak void HAL_MspDeInit(void) { /* NOTE : This function Should not be modified, when the callback is needed, the HAL_MspDeInit could be implemented in the user file */ } /** * @brief This function configures the source of the time base. * The time source is configured to have 1ms time base with a dedicated * Tick interrupt priority. * @note This function is called automatically at the beginning of program after * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig(). * @note In the default implementation, SysTick timer is the source of time base. * It is used to generate interrupts at regular time intervals. * Care must be taken if HAL_Delay() is called from a peripheral ISR process, * The the SysTick interrupt must have higher priority (numerically lower) * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. * The function is declared as __Weak to be overwritten in case of other * implementation in user file. * @param TickPriority: Tick interrupt priority. * @retval HAL status */ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) { /*Configure the SysTick to have interrupt in 1ms time basis*/ HAL_SYSTICK_Config(SystemCoreClock/1000U); /*Configure the SysTick IRQ priority */ HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0U); /* Return function status */ return HAL_OK; } /** * @} */ /** @addtogroup HAL_Exported_Functions_Group2 * @brief Peripheral Control functions * @verbatim =============================================================================== ##### HAL Control functions ##### =============================================================================== [..] This section provides functions allowing to: (+) Provide a tick value in millisecond (+) Provide a blocking delay in millisecond (+) Suspend the time base source interrupt (+) Resume the time base source interrupt (+) Get the HAL API driver version (+) Get the device identifier (+) Get the device revision identifier (+) Configure low power mode behavior when the MCU is in Debug mode (+) Manage the VEREFINT feature (activation, lock, output selection) @endverbatim * @{ */ /** * @brief This function is called to increment a global variable "uwTick" * used as application time base. * @note In the default implementation, this variable is incremented each 1ms * in Systick ISR. * @note This function is declared as __weak to be overwritten in case of other * implementations in user file. * @retval None */ __weak void HAL_IncTick(void) { uwTick++; } /** * @brief Provides a tick value in millisecond. * @note This function is declared as __weak to be overwritten in case of other * implementations in user file. * @retval tick value */ __weak uint32_t HAL_GetTick(void) { return uwTick; } /** * @brief This function provides accurate delay (in ms) based on a variable incremented. * @note In the default implementation , SysTick timer is the source of time base. * It is used to generate interrupts at regular time intervals where uwTick * is incremented. * @note ThiS function is declared as __weak to be overwritten in case of other * implementations in user file. * @param Delay: specifies the delay time length, in milliseconds. * @retval None */ __weak void HAL_Delay(__IO uint32_t Delay) { uint32_t tickstart = 0U; tickstart = HAL_GetTick(); while((HAL_GetTick() - tickstart) < Delay) { } } /** * @brief Suspends the Tick increment. * @note In the default implementation , SysTick timer is the source of time base. It is * used to generate interrupts at regular time intervals. Once HAL_SuspendTick() * is called, the the SysTick interrupt will be disabled and so Tick increment * is suspended. * @note This function is declared as __weak to be overwritten in case of other * implementations in user file. * @retval None */ __weak void HAL_SuspendTick(void) { /* Disable SysTick Interrupt */ SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; } /** * @brief Resumes the Tick increment. * @note In the default implementation , SysTick timer is the source of time base. It is * used to generate interrupts at regular time intervals. Once HAL_ResumeTick() * is called, the the SysTick interrupt will be enabled and so Tick increment * is resumed. * @note This function is declared as __weak to be overwritten in case of other * implementations in user file. * @retval None */ __weak void HAL_ResumeTick(void) { /* Enable SysTick Interrupt */ SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; } /** * @brief Returns the HAL revision * @retval version: 0xXYZR (8bits for each decimal, R for RC) */ uint32_t HAL_GetHalVersion(void) { return __STM32L0xx_HAL_VERSION; } /** * @brief Returns the device revision identifier. * @retval Device revision identifier */ uint32_t HAL_GetREVID(void) { return((DBGMCU->IDCODE) >> 16U); } /** * @brief Returns the device identifier. * @retval Device identifier */ uint32_t HAL_GetDEVID(void) { return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); } /** * @brief Enables the Debug Module during SLEEP mode * @retval None */ void HAL_DBGMCU_EnableDBGSleepMode(void) { SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); } /** * @brief Disables the Debug Module during SLEEP mode * @retval None */ void HAL_DBGMCU_DisableDBGSleepMode(void) { CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); } /** * @brief Enables the Debug Module during STOP mode * @retval None */ void HAL_DBGMCU_EnableDBGStopMode(void) { SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); } /** * @brief Disables the Debug Module during STOP mode * @retval None */ void HAL_DBGMCU_DisableDBGStopMode(void) { CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); } /** * @brief Enables the Debug Module during STANDBY mode * @retval None */ void HAL_DBGMCU_EnableDBGStandbyMode(void) { SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); } /** * @brief Disables the Debug Module during STANDBY mode * @retval None */ void HAL_DBGMCU_DisableDBGStandbyMode(void) { CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); } /** * @brief Enable low power mode behavior when the MCU is in Debug mode. * @param Periph: specifies the low power mode. * This parameter can be any combination of the following values: * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode * @arg DBGMCU_STOP: Keep debugger connection during STOP mode * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode * @retval None */ void HAL_DBGMCU_DBG_EnableLowPowerConfig(uint32_t Periph) { /* Check the parameters */ assert_param(IS_DBGMCU_PERIPH(Periph)); DBGMCU->CR |= Periph; } /** * @brief Disable low power mode behavior when the MCU is in Debug mode. * @param Periph: specifies the low power mode. * This parameter can be any combination of the following values: * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode * @arg DBGMCU_STOP: Keep debugger connection during STOP mode * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode * @retval None */ void HAL_DBGMCU_DBG_DisableLowPowerConfig(uint32_t Periph) { /* Check the parameters */ assert_param(IS_DBGMCU_PERIPH(Periph)); { DBGMCU->CR &= ~Periph; } } /** * @brief Returns the boot mode as configured by user. * @retval The boot mode as configured by user. The returned value can be one * of the following values: * - 0x00000000 : Boot is configured in Main Flash memory * - 0x00000100 : Boot is configured in System Flash memory * - 0x00000300 : Boot is configured in Embedded SRAM memory */ uint32_t HAL_SYSCFG_GetBootMode(void) { return (SYSCFG->CFGR1 & SYSCFG_CFGR1_BOOT_MODE); } /** * @brief Selects the output of internal reference voltage (VREFINT). * The VREFINT output can be routed to(PB0) or * (PB1) or both. * @param SYSCFG_Vrefint_OUTPUT: new state of the Vrefint output. * This parameter can be one of the following values: * @arg SYSCFG_VREFINT_OUT_NONE * @arg SYSCFG_VREFINT_OUT_PB0 * @arg SYSCFG_VREFINT_OUT_PB1 * @arg SYSCFG_VREFINT_OUT_PB0_PB1 * @retval None */ void HAL_SYSCFG_VREFINT_OutputSelect(uint32_t SYSCFG_Vrefint_OUTPUT) { /* Check the parameters */ assert_param(IS_SYSCFG_VREFINT_OUT_SELECT(SYSCFG_Vrefint_OUTPUT)); /* Set the output Vrefint pin */ SYSCFG->CFGR3 &= ~(SYSCFG_CFGR3_VREF_OUT); SYSCFG->CFGR3 |= (uint32_t)(SYSCFG_Vrefint_OUTPUT); } /** * @brief Lock the SYSCFG VREF register values * @retval None */ void HAL_SYSCFG_Enable_Lock_VREFINT(void) { /* Enable the LOCK by setting REF_LOCK bit in the CFGR3 register */ SET_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_REF_LOCK); } /** * @brief Unlock the overall SYSCFG VREF register values * @retval None */ void HAL_SYSCFG_Disable_Lock_VREFINT(void) { /* Disable the LOCK by setting REF_LOCK bit in the CFGR3 register */ CLEAR_BIT(SYSCFG->CFGR3, SYSCFG_CFGR3_REF_LOCK); } /** * @} */ /** * @} */ /** * @} */ #endif /* HAL_MODULE_ENABLED */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
[ "richard.ibbotson@btinternet.com" ]
richard.ibbotson@btinternet.com
c7868a95b2addeb610a760374f305d8f13f080b0
1fce6c73452126d0a6fea8fcfe6721306eb737ef
/Funksjoner.h
a69a93b38cc4a19da07b6262e4392937cf4fb1a4
[]
no_license
terjetopland/sum-calc
c028304d72110516d3bf35841579eebed3e0b861
039a3f87c6491030c882f45ec636645710eb26df
refs/heads/main
2023-08-24T08:17:31.859075
2021-10-31T10:03:03
2021-10-31T10:03:03
423,110,274
0
0
null
null
null
null
UTF-8
C
false
false
281
h
// // Created by terje on 17.09.2021. // #ifndef TESTFORFUNKSJONEKSTERN_FUNKSJONER_H #define TESTFORFUNKSJONEKSTERN_FUNKSJONER_H //code navn int greeting(); int sum(int an_array[], int array_size); int you_array(); //end code navn #endif //TESTFORFUNKSJONEKSTERN_FUNKSJONER_H
[ "74875770+terjetopland@users.noreply.github.com" ]
74875770+terjetopland@users.noreply.github.com
0e17556cac7e1a38e73a87c6ffdbf37b5fd62448
9463a7649c814bb6d692e4120aa528de50cf12b5
/fractol/srcs/init_radius.c
d5d786a75709139a62c6a9b8aeb17ad891787b26
[]
no_license
danlee65071/school21-main-
64a02579fa93971f7b22930f47baef62bd20786d
2aa0543c4ba0497681fbed83226d9e4d04a0972a
refs/heads/master
2023-06-14T01:25:19.747257
2021-07-18T12:31:10
2021-07-18T12:31:10
368,201,178
2
0
null
null
null
null
UTF-8
C
false
false
999
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* init_radius.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hcharlsi <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/06/05 18:52:38 by hcharlsi #+# #+# */ /* Updated: 2021/06/05 18:52:40 by hcharlsi ### ########.fr */ /* */ /* ************************************************************************** */ #include "fractol.h" float init_radius(t_complex c) { return ((1 + sqrt(1 + 4 * abs_complex(c))) / 2); }
[ "hcharlsi@mi-o3.msk.21-school.ru" ]
hcharlsi@mi-o3.msk.21-school.ru
50a3bff932c47065bd349df703ab07d67f2c4abf
1ca76f254bca397b38caec2621a96388867c69dc
/arch/x86/include/asm/paravirt.h
9be2bf13825bd6bdb577755732b8a7f97f05e511
[ "Unlicense" ]
permissive
gameslayer12/system_call
3a79d6e59c345ad954437dffece8e572b58c7631
36d4789b17409e9a995f97bde2e44e7131ecc434
refs/heads/master
2020-08-08T12:17:56.354786
2019-10-12T03:16:10
2019-10-12T03:16:10
213,830,368
0
0
Unlicense
2019-10-09T05:41:56
2019-10-09T05:41:53
null
UTF-8
C
false
false
24,009
h
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PARAVIRT_H #define _ASM_X86_PARAVIRT_H /* Various instructions on x86 need to be replaced for * para-virtualization: those hooks are defined here. */ #ifdef CONFIG_PARAVIRT #include <asm/pgtable_types.h> #include <asm/asm.h> #include <asm/nospec-branch.h> #include <asm/paravirt_types.h> #ifndef __ASSEMBLY__ #include <linux/bug.h> #include <linux/types.h> #include <linux/cpumask.h> #include <asm/frame.h> static inline void load_sp0(unsigned long sp0) { PVOP_VCALL1(pv_cpu_ops.load_sp0, sp0); } /* The paravirtualized CPUID instruction. */ static inline void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { PVOP_VCALL4(pv_cpu_ops.cpuid, eax, ebx, ecx, edx); } /* * These special macros can be used to get or set a debugging register */ static inline unsigned long paravirt_get_debugreg(int reg) { return PVOP_CALL1(unsigned long, pv_cpu_ops.get_debugreg, reg); } #define get_debugreg(var, reg) var = paravirt_get_debugreg(reg) static inline void set_debugreg(unsigned long val, int reg) { PVOP_VCALL2(pv_cpu_ops.set_debugreg, reg, val); } static inline unsigned long read_cr0(void) { return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr0); } static inline void write_cr0(unsigned long x) { PVOP_VCALL1(pv_cpu_ops.write_cr0, x); } static inline unsigned long read_cr2(void) { return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr2); } static inline void write_cr2(unsigned long x) { PVOP_VCALL1(pv_mmu_ops.write_cr2, x); } static inline unsigned long __read_cr3(void) { return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr3); } static inline void write_cr3(unsigned long x) { PVOP_VCALL1(pv_mmu_ops.write_cr3, x); } static inline void __write_cr4(unsigned long x) { PVOP_VCALL1(pv_cpu_ops.write_cr4, x); } #ifdef CONFIG_X86_64 static inline unsigned long read_cr8(void) { return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr8); } static inline void write_cr8(unsigned long x) { PVOP_VCALL1(pv_cpu_ops.write_cr8, x); } #endif static inline void arch_safe_halt(void) { PVOP_VCALL0(pv_irq_ops.safe_halt); } static inline void halt(void) { PVOP_VCALL0(pv_irq_ops.halt); } static inline void wbinvd(void) { PVOP_VCALL0(pv_cpu_ops.wbinvd); } #define get_kernel_rpl() (pv_info.kernel_rpl) static inline u64 paravirt_read_msr(unsigned msr) { return PVOP_CALL1(u64, pv_cpu_ops.read_msr, msr); } static inline void paravirt_write_msr(unsigned msr, unsigned low, unsigned high) { PVOP_VCALL3(pv_cpu_ops.write_msr, msr, low, high); } static inline u64 paravirt_read_msr_safe(unsigned msr, int *err) { return PVOP_CALL2(u64, pv_cpu_ops.read_msr_safe, msr, err); } static inline int paravirt_write_msr_safe(unsigned msr, unsigned low, unsigned high) { return PVOP_CALL3(int, pv_cpu_ops.write_msr_safe, msr, low, high); } #define rdmsr(msr, val1, val2) \ do { \ u64 _l = paravirt_read_msr(msr); \ val1 = (u32)_l; \ val2 = _l >> 32; \ } while (0) #define wrmsr(msr, val1, val2) \ do { \ paravirt_write_msr(msr, val1, val2); \ } while (0) #define rdmsrl(msr, val) \ do { \ val = paravirt_read_msr(msr); \ } while (0) static inline void wrmsrl(unsigned msr, u64 val) { wrmsr(msr, (u32)val, (u32)(val>>32)); } #define wrmsr_safe(msr, a, b) paravirt_write_msr_safe(msr, a, b) /* rdmsr with exception handling */ #define rdmsr_safe(msr, a, b) \ ({ \ int _err; \ u64 _l = paravirt_read_msr_safe(msr, &_err); \ (*a) = (u32)_l; \ (*b) = _l >> 32; \ _err; \ }) static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) { int err; *p = paravirt_read_msr_safe(msr, &err); return err; } static inline unsigned long long paravirt_sched_clock(void) { return PVOP_CALL0(unsigned long long, pv_time_ops.sched_clock); } struct static_key; extern struct static_key paravirt_steal_enabled; extern struct static_key paravirt_steal_rq_enabled; static inline u64 paravirt_steal_clock(int cpu) { return PVOP_CALL1(u64, pv_time_ops.steal_clock, cpu); } static inline unsigned long long paravirt_read_pmc(int counter) { return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter); } #define rdpmc(counter, low, high) \ do { \ u64 _l = paravirt_read_pmc(counter); \ low = (u32)_l; \ high = _l >> 32; \ } while (0) #define rdpmcl(counter, val) ((val) = paravirt_read_pmc(counter)) static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries) { PVOP_VCALL2(pv_cpu_ops.alloc_ldt, ldt, entries); } static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries) { PVOP_VCALL2(pv_cpu_ops.free_ldt, ldt, entries); } static inline void load_TR_desc(void) { PVOP_VCALL0(pv_cpu_ops.load_tr_desc); } static inline void load_gdt(const struct desc_ptr *dtr) { PVOP_VCALL1(pv_cpu_ops.load_gdt, dtr); } static inline void load_idt(const struct desc_ptr *dtr) { PVOP_VCALL1(pv_cpu_ops.load_idt, dtr); } static inline void set_ldt(const void *addr, unsigned entries) { PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries); } static inline unsigned long paravirt_store_tr(void) { return PVOP_CALL0(unsigned long, pv_cpu_ops.store_tr); } #define store_tr(tr) ((tr) = paravirt_store_tr()) static inline void load_TLS(struct thread_struct *t, unsigned cpu) { PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu); } #ifdef CONFIG_X86_64 static inline void load_gs_index(unsigned int gs) { PVOP_VCALL1(pv_cpu_ops.load_gs_index, gs); } #endif static inline void write_ldt_entry(struct desc_struct *dt, int entry, const void *desc) { PVOP_VCALL3(pv_cpu_ops.write_ldt_entry, dt, entry, desc); } static inline void write_gdt_entry(struct desc_struct *dt, int entry, void *desc, int type) { PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, desc, type); } static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) { PVOP_VCALL3(pv_cpu_ops.write_idt_entry, dt, entry, g); } static inline void set_iopl_mask(unsigned mask) { PVOP_VCALL1(pv_cpu_ops.set_iopl_mask, mask); } /* The paravirtualized I/O functions */ static inline void slow_down_io(void) { pv_cpu_ops.io_delay(); #ifdef REALLY_SLOW_IO pv_cpu_ops.io_delay(); pv_cpu_ops.io_delay(); pv_cpu_ops.io_delay(); #endif } static inline void paravirt_activate_mm(struct mm_struct *prev, struct mm_struct *next) { PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next); } static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm); } static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) { PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm); } static inline void __flush_tlb(void) { PVOP_VCALL0(pv_mmu_ops.flush_tlb_user); } static inline void __flush_tlb_global(void) { PVOP_VCALL0(pv_mmu_ops.flush_tlb_kernel); } static inline void __flush_tlb_one_user(unsigned long addr) { PVOP_VCALL1(pv_mmu_ops.flush_tlb_one_user, addr); } static inline void flush_tlb_others(const struct cpumask *cpumask, const struct flush_tlb_info *info) { PVOP_VCALL2(pv_mmu_ops.flush_tlb_others, cpumask, info); } static inline int paravirt_pgd_alloc(struct mm_struct *mm) { return PVOP_CALL1(int, pv_mmu_ops.pgd_alloc, mm); } static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) { PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); } static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); } static inline void paravirt_release_pte(unsigned long pfn) { PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); } static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); } static inline void paravirt_release_pmd(unsigned long pfn) { PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); } static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); } static inline void paravirt_release_pud(unsigned long pfn) { PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); } static inline void paravirt_alloc_p4d(struct mm_struct *mm, unsigned long pfn) { PVOP_VCALL2(pv_mmu_ops.alloc_p4d, mm, pfn); } static inline void paravirt_release_p4d(unsigned long pfn) { PVOP_VCALL1(pv_mmu_ops.release_p4d, pfn); } static inline pte_t __pte(pteval_t val) { pteval_t ret; if (sizeof(pteval_t) > sizeof(long)) ret = PVOP_CALLEE2(pteval_t, pv_mmu_ops.make_pte, val, (u64)val >> 32); else ret = PVOP_CALLEE1(pteval_t, pv_mmu_ops.make_pte, val); return (pte_t) { .pte = ret }; } static inline pteval_t pte_val(pte_t pte) { pteval_t ret; if (sizeof(pteval_t) > sizeof(long)) ret = PVOP_CALLEE2(pteval_t, pv_mmu_ops.pte_val, pte.pte, (u64)pte.pte >> 32); else ret = PVOP_CALLEE1(pteval_t, pv_mmu_ops.pte_val, pte.pte); return ret; } static inline pgd_t __pgd(pgdval_t val) { pgdval_t ret; if (sizeof(pgdval_t) > sizeof(long)) ret = PVOP_CALLEE2(pgdval_t, pv_mmu_ops.make_pgd, val, (u64)val >> 32); else ret = PVOP_CALLEE1(pgdval_t, pv_mmu_ops.make_pgd, val); return (pgd_t) { ret }; } static inline pgdval_t pgd_val(pgd_t pgd) { pgdval_t ret; if (sizeof(pgdval_t) > sizeof(long)) ret = PVOP_CALLEE2(pgdval_t, pv_mmu_ops.pgd_val, pgd.pgd, (u64)pgd.pgd >> 32); else ret = PVOP_CALLEE1(pgdval_t, pv_mmu_ops.pgd_val, pgd.pgd); return ret; } #define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION static inline pte_t ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pteval_t ret; ret = PVOP_CALL3(pteval_t, pv_mmu_ops.ptep_modify_prot_start, mm, addr, ptep); return (pte_t) { .pte = ret }; } static inline void ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) /* 5 arg words */ pv_mmu_ops.ptep_modify_prot_commit(mm, addr, ptep, pte); else PVOP_VCALL4(pv_mmu_ops.ptep_modify_prot_commit, mm, addr, ptep, pte.pte); } static inline void set_pte(pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) PVOP_VCALL3(pv_mmu_ops.set_pte, ptep, pte.pte, (u64)pte.pte >> 32); else PVOP_VCALL2(pv_mmu_ops.set_pte, ptep, pte.pte); } static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { if (sizeof(pteval_t) > sizeof(long)) /* 5 arg words */ pv_mmu_ops.set_pte_at(mm, addr, ptep, pte); else PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte); } static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) { pmdval_t val = native_pmd_val(pmd); if (sizeof(pmdval_t) > sizeof(long)) PVOP_VCALL3(pv_mmu_ops.set_pmd, pmdp, val, (u64)val >> 32); else PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, val); } #if CONFIG_PGTABLE_LEVELS >= 3 static inline pmd_t __pmd(pmdval_t val) { pmdval_t ret; if (sizeof(pmdval_t) > sizeof(long)) ret = PVOP_CALLEE2(pmdval_t, pv_mmu_ops.make_pmd, val, (u64)val >> 32); else ret = PVOP_CALLEE1(pmdval_t, pv_mmu_ops.make_pmd, val); return (pmd_t) { ret }; } static inline pmdval_t pmd_val(pmd_t pmd) { pmdval_t ret; if (sizeof(pmdval_t) > sizeof(long)) ret = PVOP_CALLEE2(pmdval_t, pv_mmu_ops.pmd_val, pmd.pmd, (u64)pmd.pmd >> 32); else ret = PVOP_CALLEE1(pmdval_t, pv_mmu_ops.pmd_val, pmd.pmd); return ret; } static inline void set_pud(pud_t *pudp, pud_t pud) { pudval_t val = native_pud_val(pud); if (sizeof(pudval_t) > sizeof(long)) PVOP_VCALL3(pv_mmu_ops.set_pud, pudp, val, (u64)val >> 32); else PVOP_VCALL2(pv_mmu_ops.set_pud, pudp, val); } #if CONFIG_PGTABLE_LEVELS >= 4 static inline pud_t __pud(pudval_t val) { pudval_t ret; if (sizeof(pudval_t) > sizeof(long)) ret = PVOP_CALLEE2(pudval_t, pv_mmu_ops.make_pud, val, (u64)val >> 32); else ret = PVOP_CALLEE1(pudval_t, pv_mmu_ops.make_pud, val); return (pud_t) { ret }; } static inline pudval_t pud_val(pud_t pud) { pudval_t ret; if (sizeof(pudval_t) > sizeof(long)) ret = PVOP_CALLEE2(pudval_t, pv_mmu_ops.pud_val, pud.pud, (u64)pud.pud >> 32); else ret = PVOP_CALLEE1(pudval_t, pv_mmu_ops.pud_val, pud.pud); return ret; } static inline void pud_clear(pud_t *pudp) { set_pud(pudp, __pud(0)); } static inline void set_p4d(p4d_t *p4dp, p4d_t p4d) { p4dval_t val = native_p4d_val(p4d); if (sizeof(p4dval_t) > sizeof(long)) PVOP_VCALL3(pv_mmu_ops.set_p4d, p4dp, val, (u64)val >> 32); else PVOP_VCALL2(pv_mmu_ops.set_p4d, p4dp, val); } #if CONFIG_PGTABLE_LEVELS >= 5 static inline p4d_t __p4d(p4dval_t val) { p4dval_t ret = PVOP_CALLEE1(p4dval_t, pv_mmu_ops.make_p4d, val); return (p4d_t) { ret }; } static inline p4dval_t p4d_val(p4d_t p4d) { return PVOP_CALLEE1(p4dval_t, pv_mmu_ops.p4d_val, p4d.p4d); } static inline void __set_pgd(pgd_t *pgdp, pgd_t pgd) { PVOP_VCALL2(pv_mmu_ops.set_pgd, pgdp, native_pgd_val(pgd)); } #define set_pgd(pgdp, pgdval) do { \ if (pgtable_l5_enabled) \ __set_pgd(pgdp, pgdval); \ else \ set_p4d((p4d_t *)(pgdp), (p4d_t) { (pgdval).pgd }); \ } while (0) #define pgd_clear(pgdp) do { \ if (pgtable_l5_enabled) \ set_pgd(pgdp, __pgd(0)); \ } while (0) #endif /* CONFIG_PGTABLE_LEVELS == 5 */ static inline void p4d_clear(p4d_t *p4dp) { set_p4d(p4dp, __p4d(0)); } #endif /* CONFIG_PGTABLE_LEVELS == 4 */ #endif /* CONFIG_PGTABLE_LEVELS >= 3 */ #ifdef CONFIG_X86_PAE /* Special-case pte-setting operations for PAE, which can't update a 64-bit pte atomically */ static inline void set_pte_atomic(pte_t *ptep, pte_t pte) { PVOP_VCALL3(pv_mmu_ops.set_pte_atomic, ptep, pte.pte, pte.pte >> 32); } static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { PVOP_VCALL3(pv_mmu_ops.pte_clear, mm, addr, ptep); } static inline void pmd_clear(pmd_t *pmdp) { PVOP_VCALL1(pv_mmu_ops.pmd_clear, pmdp); } #else /* !CONFIG_X86_PAE */ static inline void set_pte_atomic(pte_t *ptep, pte_t pte) { set_pte(ptep, pte); } static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { set_pte_at(mm, addr, ptep, __pte(0)); } static inline void pmd_clear(pmd_t *pmdp) { set_pmd(pmdp, __pmd(0)); } #endif /* CONFIG_X86_PAE */ #define __HAVE_ARCH_START_CONTEXT_SWITCH static inline void arch_start_context_switch(struct task_struct *prev) { PVOP_VCALL1(pv_cpu_ops.start_context_switch, prev); } static inline void arch_end_context_switch(struct task_struct *next) { PVOP_VCALL1(pv_cpu_ops.end_context_switch, next); } #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE static inline void arch_enter_lazy_mmu_mode(void) { PVOP_VCALL0(pv_mmu_ops.lazy_mode.enter); } static inline void arch_leave_lazy_mmu_mode(void) { PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); } static inline void arch_flush_lazy_mmu_mode(void) { PVOP_VCALL0(pv_mmu_ops.lazy_mode.flush); } static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, phys_addr_t phys, pgprot_t flags) { pv_mmu_ops.set_fixmap(idx, phys, flags); } #if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS) static __always_inline void pv_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) { PVOP_VCALL2(pv_lock_ops.queued_spin_lock_slowpath, lock, val); } static __always_inline void pv_queued_spin_unlock(struct qspinlock *lock) { PVOP_VCALLEE1(pv_lock_ops.queued_spin_unlock, lock); } static __always_inline void pv_wait(u8 *ptr, u8 val) { PVOP_VCALL2(pv_lock_ops.wait, ptr, val); } static __always_inline void pv_kick(int cpu) { PVOP_VCALL1(pv_lock_ops.kick, cpu); } static __always_inline bool pv_vcpu_is_preempted(long cpu) { return PVOP_CALLEE1(bool, pv_lock_ops.vcpu_is_preempted, cpu); } #endif /* SMP && PARAVIRT_SPINLOCKS */ #ifdef CONFIG_X86_32 #define PV_SAVE_REGS "pushl %ecx; pushl %edx;" #define PV_RESTORE_REGS "popl %edx; popl %ecx;" /* save and restore all caller-save registers, except return value */ #define PV_SAVE_ALL_CALLER_REGS "pushl %ecx;" #define PV_RESTORE_ALL_CALLER_REGS "popl %ecx;" #define PV_FLAGS_ARG "0" #define PV_EXTRA_CLOBBERS #define PV_VEXTRA_CLOBBERS #else /* save and restore all caller-save registers, except return value */ #define PV_SAVE_ALL_CALLER_REGS \ "push %rcx;" \ "push %rdx;" \ "push %rsi;" \ "push %rdi;" \ "push %r8;" \ "push %r9;" \ "push %r10;" \ "push %r11;" #define PV_RESTORE_ALL_CALLER_REGS \ "pop %r11;" \ "pop %r10;" \ "pop %r9;" \ "pop %r8;" \ "pop %rdi;" \ "pop %rsi;" \ "pop %rdx;" \ "pop %rcx;" /* We save some registers, but all of them, that's too much. We clobber all * caller saved registers but the argument parameter */ #define PV_SAVE_REGS "pushq %%rdi;" #define PV_RESTORE_REGS "popq %%rdi;" #define PV_EXTRA_CLOBBERS EXTRA_CLOBBERS, "rcx" , "rdx", "rsi" #define PV_VEXTRA_CLOBBERS EXTRA_CLOBBERS, "rdi", "rcx" , "rdx", "rsi" #define PV_FLAGS_ARG "D" #endif /* * Generate a thunk around a function which saves all caller-save * registers except for the return value. This allows C functions to * be called from assembler code where fewer than normal registers are * available. It may also help code generation around calls from C * code if the common case doesn't use many registers. * * When a callee is wrapped in a thunk, the caller can assume that all * arg regs and all scratch registers are preserved across the * call. The return value in rax/eax will not be saved, even for void * functions. */ #define PV_THUNK_NAME(func) "__raw_callee_save_" #func #define PV_CALLEE_SAVE_REGS_THUNK(func) \ extern typeof(func) __raw_callee_save_##func; \ \ asm(".pushsection .text;" \ ".globl " PV_THUNK_NAME(func) ";" \ ".type " PV_THUNK_NAME(func) ", @function;" \ PV_THUNK_NAME(func) ":" \ FRAME_BEGIN \ PV_SAVE_ALL_CALLER_REGS \ "call " #func ";" \ PV_RESTORE_ALL_CALLER_REGS \ FRAME_END \ "ret;" \ ".popsection") /* Get a reference to a callee-save function */ #define PV_CALLEE_SAVE(func) \ ((struct paravirt_callee_save) { __raw_callee_save_##func }) /* Promise that "func" already uses the right calling convention */ #define __PV_IS_CALLEE_SAVE(func) \ ((struct paravirt_callee_save) { func }) static inline notrace unsigned long arch_local_save_flags(void) { return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl); } static inline notrace void arch_local_irq_restore(unsigned long f) { PVOP_VCALLEE1(pv_irq_ops.restore_fl, f); } static inline notrace void arch_local_irq_disable(void) { PVOP_VCALLEE0(pv_irq_ops.irq_disable); } static inline notrace void arch_local_irq_enable(void) { PVOP_VCALLEE0(pv_irq_ops.irq_enable); } static inline notrace unsigned long arch_local_irq_save(void) { unsigned long f; f = arch_local_save_flags(); arch_local_irq_disable(); return f; } /* Make sure as little as possible of this mess escapes. */ #undef PARAVIRT_CALL #undef __PVOP_CALL #undef __PVOP_VCALL #undef PVOP_VCALL0 #undef PVOP_CALL0 #undef PVOP_VCALL1 #undef PVOP_CALL1 #undef PVOP_VCALL2 #undef PVOP_CALL2 #undef PVOP_VCALL3 #undef PVOP_CALL3 #undef PVOP_VCALL4 #undef PVOP_CALL4 extern void default_banner(void); #else /* __ASSEMBLY__ */ #define _PVSITE(ptype, clobbers, ops, word, algn) \ 771:; \ ops; \ 772:; \ .pushsection .parainstructions,"a"; \ .align algn; \ word 771b; \ .byte ptype; \ .byte 772b-771b; \ .short clobbers; \ .popsection #define COND_PUSH(set, mask, reg) \ .if ((~(set)) & mask); push %reg; .endif #define COND_POP(set, mask, reg) \ .if ((~(set)) & mask); pop %reg; .endif #ifdef CONFIG_X86_64 #define PV_SAVE_REGS(set) \ COND_PUSH(set, CLBR_RAX, rax); \ COND_PUSH(set, CLBR_RCX, rcx); \ COND_PUSH(set, CLBR_RDX, rdx); \ COND_PUSH(set, CLBR_RSI, rsi); \ COND_PUSH(set, CLBR_RDI, rdi); \ COND_PUSH(set, CLBR_R8, r8); \ COND_PUSH(set, CLBR_R9, r9); \ COND_PUSH(set, CLBR_R10, r10); \ COND_PUSH(set, CLBR_R11, r11) #define PV_RESTORE_REGS(set) \ COND_POP(set, CLBR_R11, r11); \ COND_POP(set, CLBR_R10, r10); \ COND_POP(set, CLBR_R9, r9); \ COND_POP(set, CLBR_R8, r8); \ COND_POP(set, CLBR_RDI, rdi); \ COND_POP(set, CLBR_RSI, rsi); \ COND_POP(set, CLBR_RDX, rdx); \ COND_POP(set, CLBR_RCX, rcx); \ COND_POP(set, CLBR_RAX, rax) #define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8) #define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8) #define PARA_INDIRECT(addr) *addr(%rip) #else #define PV_SAVE_REGS(set) \ COND_PUSH(set, CLBR_EAX, eax); \ COND_PUSH(set, CLBR_EDI, edi); \ COND_PUSH(set, CLBR_ECX, ecx); \ COND_PUSH(set, CLBR_EDX, edx) #define PV_RESTORE_REGS(set) \ COND_POP(set, CLBR_EDX, edx); \ COND_POP(set, CLBR_ECX, ecx); \ COND_POP(set, CLBR_EDI, edi); \ COND_POP(set, CLBR_EAX, eax) #define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) #define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4) #define PARA_INDIRECT(addr) *%cs:addr #endif #define INTERRUPT_RETURN \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);) #define DISABLE_INTERRUPTS(clobbers) \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) #define ENABLE_INTERRUPTS(clobbers) \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) #ifdef CONFIG_X86_32 #define GET_CR0_INTO_EAX \ push %ecx; push %edx; \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0); \ pop %edx; pop %ecx #else /* !CONFIG_X86_32 */ /* * If swapgs is used while the userspace stack is still current, * there's no way to call a pvop. The PV replacement *must* be * inlined, or the swapgs instruction must be trapped and emulated. */ #define SWAPGS_UNSAFE_STACK \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ swapgs) /* * Note: swapgs is very special, and in practise is either going to be * implemented with a single "swapgs" instruction or something very * special. Either way, we don't need to save any registers for * it. */ #define SWAPGS \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ ) #define GET_CR2_INTO_RAX \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2); #define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ CLBR_NONE, \ ANNOTATE_RETPOLINE_SAFE; \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);) #ifdef CONFIG_DEBUG_ENTRY #define SAVE_FLAGS(clobbers) \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) #endif #endif /* CONFIG_X86_32 */ #endif /* __ASSEMBLY__ */ #else /* CONFIG_PARAVIRT */ # define default_banner x86_init_noop #ifndef __ASSEMBLY__ static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { } static inline void paravirt_arch_exit_mmap(struct mm_struct *mm) { } #endif /* __ASSEMBLY__ */ #endif /* !CONFIG_PARAVIRT */ #endif /* _ASM_X86_PARAVIRT_H */
[ "kyeung5@mail.sfsu.edu" ]
kyeung5@mail.sfsu.edu
10376649923d642cbafa028364a4063e3a448ace
c47c254ca476c1f9969f8f3e89acb4d0618c14b6
/datasets/linux-4.11-rc3/drivers/staging/greybus/uart.c
43255e2e9276734538424325b06cd0f90a90ab7a
[ "BSD-2-Clause", "Linux-syscall-note", "GPL-2.0-only" ]
permissive
yijunyu/demo
5cf4e83f585254a28b31c4a050630b8f661a90c8
11c0c84081a3181494b9c469bda42a313c457ad2
refs/heads/master
2023-02-22T09:00:12.023083
2021-01-25T16:51:40
2021-01-25T16:51:40
175,939,000
3
6
BSD-2-Clause
2021-01-09T23:00:12
2019-03-16T07:13:00
C
UTF-8
C
false
false
26,282
c
/* * UART driver for the Greybus "generic" UART module. * * Copyright 2014 Google Inc. * Copyright 2014 Linaro Ltd. * * Released under the GPLv2 only. * * Heavily based on drivers/usb/class/cdc-acm.c and * drivers/usb/serial/usb-serial.c. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> #include <linux/errno.h> #include <linux/module.h> #include <linux/sched/signal.h> #include <linux/wait.h> #include <linux/slab.h> #include <linux/uaccess.h> #include <linux/mutex.h> #include <linux/tty.h> #include <linux/serial.h> #include <linux/tty_driver.h> #include <linux/tty_flip.h> #include <linux/serial.h> #include <linux/idr.h> #include <linux/fs.h> #include <linux/kdev_t.h> #include <linux/kfifo.h> #include <linux/workqueue.h> #include <linux/completion.h> #include "greybus.h" #include "gbphy.h" #define GB_NUM_MINORS 16 /* 16 is is more than enough */ #define GB_NAME "ttyGB" #define GB_UART_WRITE_FIFO_SIZE PAGE_SIZE #define GB_UART_WRITE_ROOM_MARGIN 1 /* leave some space in fifo */ #define GB_UART_FIRMWARE_CREDITS 4096 #define GB_UART_CREDIT_WAIT_TIMEOUT_MSEC 10000 struct gb_tty_line_coding { __le32 rate; __u8 format; __u8 parity; __u8 data_bits; __u8 flow_control; }; struct gb_tty { struct gbphy_device *gbphy_dev; struct tty_port port; void *buffer; size_t buffer_payload_max; struct gb_connection *connection; u16 cport_id; unsigned int minor; unsigned char clocal; bool disconnected; spinlock_t read_lock; spinlock_t write_lock; struct async_icount iocount; struct async_icount oldcount; wait_queue_head_t wioctl; struct mutex mutex; u8 ctrlin; /* input control lines */ u8 ctrlout; /* output control lines */ struct gb_tty_line_coding line_coding; struct work_struct tx_work; struct kfifo write_fifo; bool close_pending; unsigned int credits; struct completion credits_complete; }; static struct tty_driver *gb_tty_driver; static DEFINE_IDR(tty_minors); static DEFINE_MUTEX(table_lock); static int gb_uart_receive_data_handler(struct gb_operation *op) { struct gb_connection *connection = op->connection; struct gb_tty *gb_tty = gb_connection_get_data(connection); struct tty_port *port = &gb_tty->port; struct gb_message *request = op->request; struct gb_uart_recv_data_request *receive_data; u16 recv_data_size; int count; unsigned long tty_flags = TTY_NORMAL; if (request->payload_size < sizeof(*receive_data)) { dev_err(&gb_tty->gbphy_dev->dev, "short receive-data request received (%zu < %zu)\n", request->payload_size, sizeof(*receive_data)); return -EINVAL; } receive_data = op->request->payload; recv_data_size = le16_to_cpu(receive_data->size); if (recv_data_size != request->payload_size - sizeof(*receive_data)) { dev_err(&gb_tty->gbphy_dev->dev, "malformed receive-data request received (%u != %zu)\n", recv_data_size, request->payload_size - sizeof(*receive_data)); return -EINVAL; } if (!recv_data_size) return -EINVAL; if (receive_data->flags) { if (receive_data->flags & GB_UART_RECV_FLAG_BREAK) tty_flags = TTY_BREAK; else if (receive_data->flags & GB_UART_RECV_FLAG_PARITY) tty_flags = TTY_PARITY; else if (receive_data->flags & GB_UART_RECV_FLAG_FRAMING) tty_flags = TTY_FRAME; /* overrun is special, not associated with a char */ if (receive_data->flags & GB_UART_RECV_FLAG_OVERRUN) tty_insert_flip_char(port, 0, TTY_OVERRUN); } count = tty_insert_flip_string_fixed_flag(port, receive_data->data, tty_flags, recv_data_size); if (count != recv_data_size) { dev_err(&gb_tty->gbphy_dev->dev, "UART: RX 0x%08x bytes only wrote 0x%08x\n", recv_data_size, count); } if (count) tty_flip_buffer_push(port); return 0; } static int gb_uart_serial_state_handler(struct gb_operation *op) { struct gb_connection *connection = op->connection; struct gb_tty *gb_tty = gb_connection_get_data(connection); struct gb_message *request = op->request; struct gb_uart_serial_state_request *serial_state; if (request->payload_size < sizeof(*serial_state)) { dev_err(&gb_tty->gbphy_dev->dev, "short serial-state event received (%zu < %zu)\n", request->payload_size, sizeof(*serial_state)); return -EINVAL; } serial_state = request->payload; gb_tty->ctrlin = serial_state->control; return 0; } static int gb_uart_receive_credits_handler(struct gb_operation *op) { struct gb_connection *connection = op->connection; struct gb_tty *gb_tty = gb_connection_get_data(connection); struct gb_message *request = op->request; struct gb_uart_receive_credits_request *credit_request; unsigned long flags; unsigned int incoming_credits; int ret = 0; if (request->payload_size < sizeof(*credit_request)) { dev_err(&gb_tty->gbphy_dev->dev, "short receive_credits event received (%zu < %zu)\n", request->payload_size, sizeof(*credit_request)); return -EINVAL; } credit_request = request->payload; incoming_credits = le16_to_cpu(credit_request->count); spin_lock_irqsave(&gb_tty->write_lock, flags); gb_tty->credits += incoming_credits; if (gb_tty->credits > GB_UART_FIRMWARE_CREDITS) { gb_tty->credits -= incoming_credits; ret = -EINVAL; } spin_unlock_irqrestore(&gb_tty->write_lock, flags); if (ret) { dev_err(&gb_tty->gbphy_dev->dev, "invalid number of incoming credits: %d\n", incoming_credits); return ret; } if (!gb_tty->close_pending) schedule_work(&gb_tty->tx_work); /* * the port the tty layer may be waiting for credits */ tty_port_tty_wakeup(&gb_tty->port); if (gb_tty->credits == GB_UART_FIRMWARE_CREDITS) complete(&gb_tty->credits_complete); return ret; } static int gb_uart_request_handler(struct gb_operation *op) { struct gb_connection *connection = op->connection; struct gb_tty *gb_tty = gb_connection_get_data(connection); int type = op->type; int ret; switch (type) { case GB_UART_TYPE_RECEIVE_DATA: ret = gb_uart_receive_data_handler(op); break; case GB_UART_TYPE_SERIAL_STATE: ret = gb_uart_serial_state_handler(op); break; case GB_UART_TYPE_RECEIVE_CREDITS: ret = gb_uart_receive_credits_handler(op); break; default: dev_err(&gb_tty->gbphy_dev->dev, "unsupported unsolicited request: 0x%02x\n", type); ret = -EINVAL; } return ret; } static void gb_uart_tx_write_work(struct work_struct *work) { struct gb_uart_send_data_request *request; struct gb_tty *gb_tty; unsigned long flags; unsigned int send_size; int ret; gb_tty = container_of(work, struct gb_tty, tx_work); request = gb_tty->buffer; while (1) { if (gb_tty->close_pending) break; spin_lock_irqsave(&gb_tty->write_lock, flags); send_size = gb_tty->buffer_payload_max; if (send_size > gb_tty->credits) send_size = gb_tty->credits; send_size = kfifo_out_peek(&gb_tty->write_fifo, &request->data[0], send_size); if (!send_size) { spin_unlock_irqrestore(&gb_tty->write_lock, flags); break; } gb_tty->credits -= send_size; spin_unlock_irqrestore(&gb_tty->write_lock, flags); request->size = cpu_to_le16(send_size); ret = gb_operation_sync(gb_tty->connection, GB_UART_TYPE_SEND_DATA, request, sizeof(*request) + send_size, NULL, 0); if (ret) { dev_err(&gb_tty->gbphy_dev->dev, "send data error: %d\n", ret); spin_lock_irqsave(&gb_tty->write_lock, flags); gb_tty->credits += send_size; spin_unlock_irqrestore(&gb_tty->write_lock, flags); if (!gb_tty->close_pending) schedule_work(work); return; } spin_lock_irqsave(&gb_tty->write_lock, flags); ret = kfifo_out(&gb_tty->write_fifo, &request->data[0], send_size); spin_unlock_irqrestore(&gb_tty->write_lock, flags); tty_port_tty_wakeup(&gb_tty->port); } } static int send_line_coding(struct gb_tty *tty) { struct gb_uart_set_line_coding_request request; memcpy(&request, &tty->line_coding, sizeof(tty->line_coding)); return gb_operation_sync(tty->connection, GB_UART_TYPE_SET_LINE_CODING, &request, sizeof(request), NULL, 0); } static int send_control(struct gb_tty *gb_tty, u8 control) { struct gb_uart_set_control_line_state_request request; request.control = control; return gb_operation_sync(gb_tty->connection, GB_UART_TYPE_SET_CONTROL_LINE_STATE, &request, sizeof(request), NULL, 0); } static int send_break(struct gb_tty *gb_tty, u8 state) { struct gb_uart_set_break_request request; if ((state != 0) && (state != 1)) { dev_err(&gb_tty->gbphy_dev->dev, "invalid break state of %d\n", state); return -EINVAL; } request.state = state; return gb_operation_sync(gb_tty->connection, GB_UART_TYPE_SEND_BREAK, &request, sizeof(request), NULL, 0); } static int gb_uart_wait_for_all_credits(struct gb_tty *gb_tty) { int ret; if (gb_tty->credits == GB_UART_FIRMWARE_CREDITS) return 0; ret = wait_for_completion_timeout(&gb_tty->credits_complete, msecs_to_jiffies(GB_UART_CREDIT_WAIT_TIMEOUT_MSEC)); if (!ret) { dev_err(&gb_tty->gbphy_dev->dev, "time out waiting for credits\n"); return -ETIMEDOUT; } return 0; } static int gb_uart_flush(struct gb_tty *gb_tty, u8 flags) { struct gb_uart_serial_flush_request request; request.flags = flags; return gb_operation_sync(gb_tty->connection, GB_UART_TYPE_FLUSH_FIFOS, &request, sizeof(request), NULL, 0); } static struct gb_tty *get_gb_by_minor(unsigned int minor) { struct gb_tty *gb_tty; mutex_lock(&table_lock); gb_tty = idr_find(&tty_minors, minor); if (gb_tty) { mutex_lock(&gb_tty->mutex); if (gb_tty->disconnected) { mutex_unlock(&gb_tty->mutex); gb_tty = NULL; } else { tty_port_get(&gb_tty->port); mutex_unlock(&gb_tty->mutex); } } mutex_unlock(&table_lock); return gb_tty; } static int alloc_minor(struct gb_tty *gb_tty) { int minor; mutex_lock(&table_lock); minor = idr_alloc(&tty_minors, gb_tty, 0, GB_NUM_MINORS, GFP_KERNEL); mutex_unlock(&table_lock); if (minor >= 0) gb_tty->minor = minor; return minor; } static void release_minor(struct gb_tty *gb_tty) { int minor = gb_tty->minor; gb_tty->minor = 0; /* Maybe should use an invalid value instead */ mutex_lock(&table_lock); idr_remove(&tty_minors, minor); mutex_unlock(&table_lock); } static int gb_tty_install(struct tty_driver *driver, struct tty_struct *tty) { struct gb_tty *gb_tty; int retval; gb_tty = get_gb_by_minor(tty->index); if (!gb_tty) return -ENODEV; retval = tty_standard_install(driver, tty); if (retval) goto error; tty->driver_data = gb_tty; return 0; error: tty_port_put(&gb_tty->port); return retval; } static int gb_tty_open(struct tty_struct *tty, struct file *file) { struct gb_tty *gb_tty = tty->driver_data; return tty_port_open(&gb_tty->port, tty, file); } static void gb_tty_close(struct tty_struct *tty, struct file *file) { struct gb_tty *gb_tty = tty->driver_data; tty_port_close(&gb_tty->port, tty, file); } static void gb_tty_cleanup(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; tty_port_put(&gb_tty->port); } static void gb_tty_hangup(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; tty_port_hangup(&gb_tty->port); } static int gb_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct gb_tty *gb_tty = tty->driver_data; count = kfifo_in_spinlocked(&gb_tty->write_fifo, buf, count, &gb_tty->write_lock); if (count && !gb_tty->close_pending) schedule_work(&gb_tty->tx_work); return count; } static int gb_tty_write_room(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; unsigned long flags; int room; spin_lock_irqsave(&gb_tty->write_lock, flags); room = kfifo_avail(&gb_tty->write_fifo); spin_unlock_irqrestore(&gb_tty->write_lock, flags); room -= GB_UART_WRITE_ROOM_MARGIN; if (room < 0) return 0; return room; } static int gb_tty_chars_in_buffer(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; unsigned long flags; int chars; spin_lock_irqsave(&gb_tty->write_lock, flags); chars = kfifo_len(&gb_tty->write_fifo); if (gb_tty->credits < GB_UART_FIRMWARE_CREDITS) chars += GB_UART_FIRMWARE_CREDITS - gb_tty->credits; spin_unlock_irqrestore(&gb_tty->write_lock, flags); return chars; } static int gb_tty_break_ctl(struct tty_struct *tty, int state) { struct gb_tty *gb_tty = tty->driver_data; return send_break(gb_tty, state ? 1 : 0); } static void gb_tty_set_termios(struct tty_struct *tty, struct ktermios *termios_old) { struct gb_tty *gb_tty = tty->driver_data; struct ktermios *termios = &tty->termios; struct gb_tty_line_coding newline; u8 newctrl = gb_tty->ctrlout; newline.rate = cpu_to_le32(tty_get_baud_rate(tty)); newline.format = termios->c_cflag & CSTOPB ? GB_SERIAL_2_STOP_BITS : GB_SERIAL_1_STOP_BITS; newline.parity = termios->c_cflag & PARENB ? (termios->c_cflag & PARODD ? 1 : 2) + (termios->c_cflag & CMSPAR ? 2 : 0) : 0; switch (termios->c_cflag & CSIZE) { case CS5: newline.data_bits = 5; break; case CS6: newline.data_bits = 6; break; case CS7: newline.data_bits = 7; break; case CS8: default: newline.data_bits = 8; break; } /* FIXME: needs to clear unsupported bits in the termios */ gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0); if (C_BAUD(tty) == B0) { newline.rate = gb_tty->line_coding.rate; newctrl &= ~(GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) { newctrl |= (GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); } if (newctrl != gb_tty->ctrlout) { gb_tty->ctrlout = newctrl; send_control(gb_tty, newctrl); } if (C_CRTSCTS(tty) && C_BAUD(tty) != B0) newline.flow_control |= GB_SERIAL_AUTO_RTSCTS_EN; else newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN; if (memcmp(&gb_tty->line_coding, &newline, sizeof(newline))) { memcpy(&gb_tty->line_coding, &newline, sizeof(newline)); send_line_coding(gb_tty); } } static int gb_tty_tiocmget(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; return (gb_tty->ctrlout & GB_UART_CTRL_DTR ? TIOCM_DTR : 0) | (gb_tty->ctrlout & GB_UART_CTRL_RTS ? TIOCM_RTS : 0) | (gb_tty->ctrlin & GB_UART_CTRL_DSR ? TIOCM_DSR : 0) | (gb_tty->ctrlin & GB_UART_CTRL_RI ? TIOCM_RI : 0) | (gb_tty->ctrlin & GB_UART_CTRL_DCD ? TIOCM_CD : 0) | TIOCM_CTS; } static int gb_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct gb_tty *gb_tty = tty->driver_data; u8 newctrl = gb_tty->ctrlout; set = (set & TIOCM_DTR ? GB_UART_CTRL_DTR : 0) | (set & TIOCM_RTS ? GB_UART_CTRL_RTS : 0); clear = (clear & TIOCM_DTR ? GB_UART_CTRL_DTR : 0) | (clear & TIOCM_RTS ? GB_UART_CTRL_RTS : 0); newctrl = (newctrl & ~clear) | set; if (gb_tty->ctrlout == newctrl) return 0; gb_tty->ctrlout = newctrl; return send_control(gb_tty, newctrl); } static void gb_tty_throttle(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; unsigned char stop_char; int retval; if (I_IXOFF(tty)) { stop_char = STOP_CHAR(tty); retval = gb_tty_write(tty, &stop_char, 1); if (retval <= 0) return; } if (tty->termios.c_cflag & CRTSCTS) { gb_tty->ctrlout &= ~GB_UART_CTRL_RTS; retval = send_control(gb_tty, gb_tty->ctrlout); } } static void gb_tty_unthrottle(struct tty_struct *tty) { struct gb_tty *gb_tty = tty->driver_data; unsigned char start_char; int retval; if (I_IXOFF(tty)) { start_char = START_CHAR(tty); retval = gb_tty_write(tty, &start_char, 1); if (retval <= 0) return; } if (tty->termios.c_cflag & CRTSCTS) { gb_tty->ctrlout |= GB_UART_CTRL_RTS; retval = send_control(gb_tty, gb_tty->ctrlout); } } static int get_serial_info(struct gb_tty *gb_tty, struct serial_struct __user *info) { struct serial_struct tmp; memset(&tmp, 0, sizeof(tmp)); tmp.type = PORT_16550A; tmp.line = gb_tty->minor; tmp.xmit_fifo_size = 16; tmp.baud_base = 9600; tmp.close_delay = gb_tty->port.close_delay / 10; tmp.closing_wait = gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : gb_tty->port.closing_wait / 10; if (copy_to_user(info, &tmp, sizeof(tmp))) return -EFAULT; return 0; } static int set_serial_info(struct gb_tty *gb_tty, struct serial_struct __user *newinfo) { struct serial_struct new_serial; unsigned int closing_wait; unsigned int close_delay; int retval = 0; if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) return -EFAULT; close_delay = new_serial.close_delay * 10; closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : new_serial.closing_wait * 10; mutex_lock(&gb_tty->port.mutex); if (!capable(CAP_SYS_ADMIN)) { if ((close_delay != gb_tty->port.close_delay) || (closing_wait != gb_tty->port.closing_wait)) retval = -EPERM; else retval = -EOPNOTSUPP; } else { gb_tty->port.close_delay = close_delay; gb_tty->port.closing_wait = closing_wait; } mutex_unlock(&gb_tty->port.mutex); return retval; } static int wait_serial_change(struct gb_tty *gb_tty, unsigned long arg) { int retval = 0; DECLARE_WAITQUEUE(wait, current); struct async_icount old; struct async_icount new; if (!(arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD))) return -EINVAL; do { spin_lock_irq(&gb_tty->read_lock); old = gb_tty->oldcount; new = gb_tty->iocount; gb_tty->oldcount = new; spin_unlock_irq(&gb_tty->read_lock); if ((arg & TIOCM_DSR) && (old.dsr != new.dsr)) break; if ((arg & TIOCM_CD) && (old.dcd != new.dcd)) break; if ((arg & TIOCM_RI) && (old.rng != new.rng)) break; add_wait_queue(&gb_tty->wioctl, &wait); set_current_state(TASK_INTERRUPTIBLE); schedule(); remove_wait_queue(&gb_tty->wioctl, &wait); if (gb_tty->disconnected) { if (arg & TIOCM_CD) break; retval = -ENODEV; } else if (signal_pending(current)) { retval = -ERESTARTSYS; } } while (!retval); return retval; } static int gb_tty_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount) { struct gb_tty *gb_tty = tty->driver_data; icount->dsr = gb_tty->iocount.dsr; icount->rng = gb_tty->iocount.rng; icount->dcd = gb_tty->iocount.dcd; icount->frame = gb_tty->iocount.frame; icount->overrun = gb_tty->iocount.overrun; icount->parity = gb_tty->iocount.parity; icount->brk = gb_tty->iocount.brk; return 0; } static int gb_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct gb_tty *gb_tty = tty->driver_data; switch (cmd) { case TIOCGSERIAL: return get_serial_info(gb_tty, (struct serial_struct __user *)arg); case TIOCSSERIAL: return set_serial_info(gb_tty, (struct serial_struct __user *)arg); case TIOCMIWAIT: return wait_serial_change(gb_tty, arg); } return -ENOIOCTLCMD; } static void gb_tty_dtr_rts(struct tty_port *port, int on) { struct gb_tty *gb_tty; u8 newctrl; gb_tty = container_of(port, struct gb_tty, port); newctrl = gb_tty->ctrlout; if (on) newctrl |= (GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); else newctrl &= ~(GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); gb_tty->ctrlout = newctrl; send_control(gb_tty, newctrl); } static int gb_tty_port_activate(struct tty_port *port, struct tty_struct *tty) { struct gb_tty *gb_tty; gb_tty = container_of(port, struct gb_tty, port); return gbphy_runtime_get_sync(gb_tty->gbphy_dev); } static void gb_tty_port_shutdown(struct tty_port *port) { struct gb_tty *gb_tty; unsigned long flags; int ret; gb_tty = container_of(port, struct gb_tty, port); gb_tty->close_pending = true; cancel_work_sync(&gb_tty->tx_work); spin_lock_irqsave(&gb_tty->write_lock, flags); kfifo_reset_out(&gb_tty->write_fifo); spin_unlock_irqrestore(&gb_tty->write_lock, flags); if (gb_tty->credits == GB_UART_FIRMWARE_CREDITS) goto out; ret = gb_uart_flush(gb_tty, GB_SERIAL_FLAG_FLUSH_TRANSMITTER); if (ret) { dev_err(&gb_tty->gbphy_dev->dev, "error flushing transmitter: %d\n", ret); } gb_uart_wait_for_all_credits(gb_tty); out: gb_tty->close_pending = false; gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev); } static const struct tty_operations gb_ops = { .install = gb_tty_install, .open = gb_tty_open, .close = gb_tty_close, .cleanup = gb_tty_cleanup, .hangup = gb_tty_hangup, .write = gb_tty_write, .write_room = gb_tty_write_room, .ioctl = gb_tty_ioctl, .throttle = gb_tty_throttle, .unthrottle = gb_tty_unthrottle, .chars_in_buffer = gb_tty_chars_in_buffer, .break_ctl = gb_tty_break_ctl, .set_termios = gb_tty_set_termios, .tiocmget = gb_tty_tiocmget, .tiocmset = gb_tty_tiocmset, .get_icount = gb_tty_get_icount, }; static const struct tty_port_operations gb_port_ops = { .dtr_rts = gb_tty_dtr_rts, .activate = gb_tty_port_activate, .shutdown = gb_tty_port_shutdown, }; static int gb_uart_probe(struct gbphy_device *gbphy_dev, const struct gbphy_device_id *id) { struct gb_connection *connection; size_t max_payload; struct gb_tty *gb_tty; struct device *tty_dev; int retval; int minor; gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); if (!gb_tty) return -ENOMEM; connection = gb_connection_create(gbphy_dev->bundle, le16_to_cpu(gbphy_dev->cport_desc->id), gb_uart_request_handler); if (IS_ERR(connection)) { retval = PTR_ERR(connection); goto exit_tty_free; } max_payload = gb_operation_get_payload_size_max(connection); if (max_payload < sizeof(struct gb_uart_send_data_request)) { retval = -EINVAL; goto exit_connection_destroy; } gb_tty->buffer_payload_max = max_payload - sizeof(struct gb_uart_send_data_request); gb_tty->buffer = kzalloc(gb_tty->buffer_payload_max, GFP_KERNEL); if (!gb_tty->buffer) { retval = -ENOMEM; goto exit_connection_destroy; } INIT_WORK(&gb_tty->tx_work, gb_uart_tx_write_work); retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE, GFP_KERNEL); if (retval) goto exit_buf_free; gb_tty->credits = GB_UART_FIRMWARE_CREDITS; init_completion(&gb_tty->credits_complete); minor = alloc_minor(gb_tty); if (minor < 0) { if (minor == -ENOSPC) { dev_err(&gbphy_dev->dev, "no more free minor numbers\n"); retval = -ENODEV; } else { retval = minor; } goto exit_kfifo_free; } gb_tty->minor = minor; spin_lock_init(&gb_tty->write_lock); spin_lock_init(&gb_tty->read_lock); init_waitqueue_head(&gb_tty->wioctl); mutex_init(&gb_tty->mutex); tty_port_init(&gb_tty->port); gb_tty->port.ops = &gb_port_ops; gb_tty->connection = connection; gb_tty->gbphy_dev = gbphy_dev; gb_connection_set_data(connection, gb_tty); gb_gbphy_set_data(gbphy_dev, gb_tty); retval = gb_connection_enable_tx(connection); if (retval) goto exit_release_minor; send_control(gb_tty, gb_tty->ctrlout); /* initialize the uart to be 9600n81 */ gb_tty->line_coding.rate = cpu_to_le32(9600); gb_tty->line_coding.format = GB_SERIAL_1_STOP_BITS; gb_tty->line_coding.parity = GB_SERIAL_NO_PARITY; gb_tty->line_coding.data_bits = 8; send_line_coding(gb_tty); retval = gb_connection_enable(connection); if (retval) goto exit_connection_disable; tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor, &gbphy_dev->dev); if (IS_ERR(tty_dev)) { retval = PTR_ERR(tty_dev); goto exit_connection_disable; } gbphy_runtime_put_autosuspend(gbphy_dev); return 0; exit_connection_disable: gb_connection_disable(connection); exit_release_minor: release_minor(gb_tty); exit_kfifo_free: kfifo_free(&gb_tty->write_fifo); exit_buf_free: kfree(gb_tty->buffer); exit_connection_destroy: gb_connection_destroy(connection); exit_tty_free: kfree(gb_tty); return retval; } static void gb_uart_remove(struct gbphy_device *gbphy_dev) { struct gb_tty *gb_tty = gb_gbphy_get_data(gbphy_dev); struct gb_connection *connection = gb_tty->connection; struct tty_struct *tty; int ret; ret = gbphy_runtime_get_sync(gbphy_dev); if (ret) gbphy_runtime_get_noresume(gbphy_dev); mutex_lock(&gb_tty->mutex); gb_tty->disconnected = true; wake_up_all(&gb_tty->wioctl); mutex_unlock(&gb_tty->mutex); tty = tty_port_tty_get(&gb_tty->port); if (tty) { tty_vhangup(tty); tty_kref_put(tty); } gb_connection_disable_rx(connection); tty_unregister_device(gb_tty_driver, gb_tty->minor); /* FIXME - free transmit / receive buffers */ gb_connection_disable(connection); tty_port_destroy(&gb_tty->port); gb_connection_destroy(connection); release_minor(gb_tty); kfifo_free(&gb_tty->write_fifo); kfree(gb_tty->buffer); kfree(gb_tty); } static int gb_tty_init(void) { int retval = 0; gb_tty_driver = tty_alloc_driver(GB_NUM_MINORS, 0); if (IS_ERR(gb_tty_driver)) { pr_err("Can not allocate tty driver\n"); retval = -ENOMEM; goto fail_unregister_dev; } gb_tty_driver->driver_name = "gb"; gb_tty_driver->name = GB_NAME; gb_tty_driver->major = 0; gb_tty_driver->minor_start = 0; gb_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; gb_tty_driver->subtype = SERIAL_TYPE_NORMAL; gb_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; gb_tty_driver->init_termios = tty_std_termios; gb_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; tty_set_operations(gb_tty_driver, &gb_ops); retval = tty_register_driver(gb_tty_driver); if (retval) { pr_err("Can not register tty driver: %d\n", retval); goto fail_put_gb_tty; } return 0; fail_put_gb_tty: put_tty_driver(gb_tty_driver); fail_unregister_dev: return retval; } static void gb_tty_exit(void) { tty_unregister_driver(gb_tty_driver); put_tty_driver(gb_tty_driver); idr_destroy(&tty_minors); } static const struct gbphy_device_id gb_uart_id_table[] = { { GBPHY_PROTOCOL(GREYBUS_PROTOCOL_UART) }, { }, }; MODULE_DEVICE_TABLE(gbphy, gb_uart_id_table); static struct gbphy_driver uart_driver = { .name = "uart", .probe = gb_uart_probe, .remove = gb_uart_remove, .id_table = gb_uart_id_table, }; static int gb_uart_driver_init(void) { int ret; ret = gb_tty_init(); if (ret) return ret; ret = gb_gbphy_register(&uart_driver); if (ret) { gb_tty_exit(); return ret; } return 0; } module_init(gb_uart_driver_init); static void gb_uart_driver_exit(void) { gb_gbphy_deregister(&uart_driver); gb_tty_exit(); } module_exit(gb_uart_driver_exit); MODULE_LICENSE("GPL v2");
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk
589eb60ad6670915ad3cacd801b9bdf6f43fa1fa
48eb9e9f46019eb11f7f2b5be967b4c927b12920
/Chapter08/select1.c
28a32477c936cbb14a639c9450ab76ad34285f81
[]
no_license
JiaheXu/Beginning-Linux-Programming
5023cb110013c9f4c7195484d2e03b62c96050ca
482a2a7c450ca7ad6c220151ced3a03b0d719fa5
refs/heads/master
2022-05-21T07:40:31.714150
2019-01-21T14:57:00
2019-01-21T14:57:00
null
0
0
null
null
null
null
UTF-8
C
false
false
1,522
c
#include <stdlib.h> #include <stdio.h> #include "mysql.h" MYSQL my_connection; MYSQL_RES *res_ptr; MYSQL_ROW sqlrow; int main(int argc, char *argv[]) { int res; mysql_init(&my_connection); /* 与数据库进行连接 */ if (mysql_real_connect(&my_connection, "localhost", "rick", "secret", "foo", 0, NULL, 0)) { printf("Connection success\n"); /* 执行SQL语句 */ res = mysql_query(&my_connection, "SELECT childno, fname, age FROM children WHERE age > 5"); if (res) { printf("SELECT error: %s\n", mysql_error(&my_connection)); } else { /* 将数据库中的数据一次性全部取出,该函数返回一个指向结果集结构的指针 */ res_ptr = mysql_store_result(&my_connection); if (res_ptr) { /* 使用mysql_num_rows语句得到数据库中记录的数目 */ printf("Retrieved %lu rows\n", (unsigned long)mysql_num_rows(res_ptr)); /* 一次从结果集中提取一行 */ while ((sqlrow = mysql_fetch_row(res_ptr))) { printf("Fetched data……\n"); } if (mysql_errno(&my_connection)) { fprintf(stderr, "Retrieved error: %s\n", mysql_error(&my_connection)); } /* 释放查询占用的内存资源,进行清理 */ mysql_free_result(res_ptr); } } mysql_close(&my_connection); } else { fprintf(stderr, "Connection failed\n"); if (mysql_errno(&my_connection)) { fprintf(stderr, "Connection error %d: %s\n", mysql_errno(&my_connection), mysql_error(&my_connection)); } } return EXIT_SUCCESS; }
[ "shangchaoneuq@gmail.com" ]
shangchaoneuq@gmail.com
8c5a30f6708c01ce569f74928f7e47a1171194cc
3f9134b63040f802ccc111e75ab66c2ac292cb10
/base e a altura de um retângulo.c
6f4e1a29399312cddebb128f9ea4d8eeb91170b7
[]
no_license
DANIELDG-design/Programas-em-C
6813cddcfd127b2d87d2da194d72617a1f5378d4
9bdf2a3b084f22f7a52867acfa1c2d495c7b482f
refs/heads/master
2020-09-06T21:39:28.711926
2019-11-22T22:57:25
2019-11-22T22:57:25
220,562,141
0
0
null
null
null
null
UTF-8
C
false
false
335
c
#include<stdio.h> #include<stdlib.h> int main (void) { float base, altura, perimetro,area; printf("Digite a base:"); scanf ("%f",&base); printf("Digite a altura:"); scanf("%f",&altura); perimetro=base+altura; printf("Perimetro:%f\n",perimetro); area=base*altura; printf("Area:%f\n",area); return 0; }
[ "noreply@github.com" ]
DANIELDG-design.noreply@github.com
94bd27b2152f3a3dde9bfff41c0647dbf90b5e4a
feda0c02bcdb1b27e38ed60c289f4abb12d38282
/examples/heart/Piha/Cells/Generated/LeftBundleBranch.c
f16c9d7070be8c3efdc8740dd07340c14538a04a
[]
no_license
sidns5/DATE2016_codegen
6c7ea963b4712a6848aa3db24d9ee102b140a2bf
f2d77d0280ce1496f526b04327f6307a59ef79b2
refs/heads/master
2020-04-09T05:52:06.753157
2015-11-27T00:57:39
2015-11-27T00:57:39
40,632,137
0
2
null
null
null
null
UTF-8
C
false
false
6,348
c
#include "LeftBundleBranch.h" #define True 1 #define False 0 #include <math.h> static double f(double theta) { if(theta >= 0.04) return 4.03947; return 0.29*exp(62.89*theta) + 0.70*exp(-10.99*theta); } static double t1_ode_1(LeftBundleBranch* me) { double t1_ode_1_change = -0.0087 * me->v_x; return me->v_x + STEP_SIZE * t1_ode_1_change; } static double t1_ode_2(LeftBundleBranch* me) { double t1_ode_2_change = -0.1909 * me->v_y; return me->v_y + STEP_SIZE * t1_ode_2_change; } static double t1_ode_3(LeftBundleBranch* me) { double t1_ode_3_change = -0.1904 * me->v_z; return me->v_z + STEP_SIZE * t1_ode_3_change; } static double t2_ode_1(LeftBundleBranch* me) { double t2_ode_1_change = -0.0236 * me->v_x + 0.7772 * me->g; return me->v_x + STEP_SIZE * t2_ode_1_change; } static double t2_ode_2(LeftBundleBranch* me) { double t2_ode_2_change = -0.0455 * me->v_y + 0.0589 * me->g; return me->v_y + STEP_SIZE * t2_ode_2_change; } static double t2_ode_3(LeftBundleBranch* me) { double t2_ode_3_change = -0.0129 * me->v_z + 0.2766 * me->g; return me->v_z + STEP_SIZE * t2_ode_3_change; } static double t3_ode_1(LeftBundleBranch* me) { double t3_ode_1_change = -0.0069 * me->v_x; return me->v_x + STEP_SIZE * t3_ode_1_change; } static double t3_ode_2(LeftBundleBranch* me) { double t3_ode_2_change = 0.0759 * me->v_y; return me->v_y + STEP_SIZE * t3_ode_2_change; } static double t3_ode_3(LeftBundleBranch* me) { double t3_ode_3_change = 6.8265 * me->v_z; return me->v_z + STEP_SIZE * t3_ode_3_change; } static double t4_ode_1(LeftBundleBranch* me) { double t4_ode_1_change = -0.0332 * me->v_x * me->f_theta; return me->v_x + STEP_SIZE * t4_ode_1_change; } static double t4_ode_2(LeftBundleBranch* me) { double t4_ode_2_change = 0.011 * me->v_y * me->f_theta; return me->v_y + STEP_SIZE * t4_ode_2_change; } static double t4_ode_3(LeftBundleBranch* me) { double t4_ode_3_change = 0.002 * me->v_z; return me->v_z + STEP_SIZE * t4_ode_3_change; } // Initialization function void LeftBundleBranchInit(LeftBundleBranch* me) { me->state = t1; me->v_x = 0; me->v_y = 0; me->v_z = 0; me->v = 0; me->theta = 0; me->v_O = 0; me->g = 0; } // Execution function void LeftBundleBranchRun(LeftBundleBranch* me) { enum cellStates state_u = me->state; double v_x_u = me->v_x; double v_y_u = me->v_y; double v_z_u = me->v_z; double v_u = me->v; double theta_u = me->theta; double v_O_u = me->v_O; double f_theta_u = me->f_theta; me->g = 0; me->g += (100 * 0.1 * (me->v_i_0 - me->v)) / (100 * 0.01 * 10); me->g += (100 * 0.1 * (me->v_i_1 - me->v)) / (100 * 0.01 * 10); switch (me->state) { case (t1): if(me->v <= 44.5 && me->g <= 44.5) { v_x_u = t1_ode_1(me); v_y_u = t1_ode_2(me); v_z_u = t1_ode_3(me); v_u = v_x_u - v_y_u + v_z_u; state_u = t1; } else if(me->g > 44.5) { v_x_u = 0.3*me->v; v_y_u = 0; v_z_u = 0.7*me->v; v_u = v_x_u - v_y_u + v_z_u; theta_u = v_u / 30; v_O_u = (131.1 - 80.1*sqrt(theta_u)); f_theta_u = f(theta_u); state_u = t2; } else { fprintf(stderr,"Unreachable state!"); exit(1); } break; case (t2): if(me->v < 44.5 && me->g > 0) { v_x_u = t2_ode_1(me); v_y_u = t2_ode_2(me); v_z_u = t2_ode_3(me); v_u = v_x_u - v_y_u + v_z_u; if(v_u > 44.5) { double frac = (44.5 - me->v) / (v_u - me->v); v_x_u = me->v_x + frac * (v_x_u - me->v_x); v_y_u = me->v_y + frac * (v_y_u - me->v_y); v_z_u = 44.5 - v_x_u + v_y_u; v_u = 44.5; } state_u = t2; } else if(me->g <= 0 && me->v < 44.5) { v_x_u = me->v_x; v_y_u = me->v_y; v_z_u = me->v_z; v_u = v_x_u - v_y_u + v_z_u; state_u = t1; } else if(me->v >= 44.5) { v_x_u = me->v_x; v_y_u = me->v_y; v_z_u = me->v_z; v_u = v_x_u - v_y_u + v_z_u; state_u = t3; } else { fprintf(stderr,"Unreachable state!"); exit(1); } break; case (t3): if(me->v < me->v_O) { v_x_u = t3_ode_1(me); v_y_u = t3_ode_2(me); v_z_u = t3_ode_3(me); v_u = v_x_u - v_y_u + v_z_u; if(v_u > me->v_O) { double frac = (me->v_O - me->v) / (v_u - me->v); v_x_u = me->v_x + frac * (v_x_u - me->v_x); v_y_u = me->v_y + frac * (v_y_u - me->v_y); v_z_u = me->v_O - v_x_u + v_y_u; v_u = me->v_O; } state_u = t3; } else if(me->v >= me->v_O) { v_x_u = me->v_x; v_y_u = me->v_y; v_z_u = me->v_z; v_u = v_x_u - v_y_u + v_z_u; state_u = t4; } else { fprintf(stderr,"Unreachable state!"); exit(1); } break; case (t4): if(me->v > 30) { v_x_u = t4_ode_1(me); v_y_u = t4_ode_2(me); v_z_u = t4_ode_3(me); v_u = v_x_u - v_y_u + v_z_u; if(v_u < 30) { double frac = (30 - me->v) / (v_u - me->v); v_x_u = me->v_x + frac * (v_x_u - me->v_x); v_y_u = me->v_y + frac * (v_y_u - me->v_y); v_z_u = 30 - v_x_u + v_y_u; v_u = 30; } state_u = t4; } else if(me->v <= 30) { v_x_u = me->v_x; v_y_u = me->v_y; v_z_u = me->v_z; v_u = v_x_u - v_y_u + v_z_u; state_u = t1; } else { fprintf(stderr,"Unreachable state!"); exit(1); } break; default: exit(1); } me->state = state_u; me->v_x = v_x_u; me->v_y = v_y_u; me->v_z = v_z_u; me->v = v_u; me->theta = theta_u; me->v_O = v_O_u; me->f_theta = f_theta_u; }
[ "nathan.allen.nz@gmail.com" ]
nathan.allen.nz@gmail.com
c9e574ba9a9df7e7d5cc4113c935ab1ee8af1298
0c663e0d69e03c828d9196ee428427b1a644d87e
/APP/gameover/gameover.c
75fb404af68878f11faf686dede365c9b6a01ac8
[]
no_license
zm1296/snake
72a91536d3beac66a004cd65a0f84fbb1f73b65a
c07056ec4ac74f7409624408e6128fa7f0f34900
refs/heads/master
2020-08-04T09:53:20.272585
2019-10-02T14:29:40
2019-10-02T14:29:40
212,096,424
0
0
null
null
null
null
WINDOWS-1252
C
false
false
136,156
c
// Generate By BMP to RAW Conveter, By Leajian const char gameover[] = { /* Source File: C:\Users\test\Desktop\²¶»ñ.bin */ /* File Size: 20000 Bytes */ /*0x0*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x10*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x20*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x30*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x40*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x50*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x60*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x70*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x80*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0x90*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0xa0*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0xb0*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, /*0xc0*/ 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0xba, 0xd6, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0xd0*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0xe0*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0xf0*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x100*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x110*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x120*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x130*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x140*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x150*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x160*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x170*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x180*/ 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, 0x0c, 0x63, /*0x190*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x200*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x210*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x220*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x230*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x240*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x250*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x260*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x270*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x280*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x290*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x300*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x310*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x320*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x330*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x340*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x350*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x360*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x370*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x380*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x390*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x400*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x410*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x420*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x430*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x440*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x450*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x460*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x470*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x480*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x490*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x500*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x510*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x520*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x530*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x540*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x550*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x560*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x570*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x580*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x590*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x5f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x600*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x610*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x620*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x630*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x640*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x650*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x660*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x670*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x680*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x690*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x6f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x700*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x710*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x720*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x730*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x740*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x750*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x760*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x770*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x780*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x790*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x7f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x800*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x810*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x820*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x830*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x840*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x850*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x860*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x870*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x880*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x890*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x8f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x900*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x910*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x920*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x930*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x940*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x950*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x960*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x970*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x980*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x990*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x9f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xa90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xaa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xab0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xac0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xad0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xae0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xaf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xb90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xba0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xbb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xbc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xbd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xbe0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xbf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xc90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xca0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xcb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xcc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xcd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xce0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xcf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xd90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xda0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xdb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xdc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xdd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xde0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xdf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xe90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xea0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xeb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xec0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xed0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xee0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xef0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xf90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xfa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xfb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xfc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xfd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xfe0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0xff0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1000*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1010*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1020*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1030*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1040*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1050*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1060*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1070*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1080*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1090*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x10f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1100*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1110*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1120*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1130*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1140*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1150*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1160*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1170*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1180*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1190*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x11f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1200*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1210*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1220*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1230*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1240*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1250*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1260*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1270*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1280*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1290*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x12f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1300*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1310*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1320*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1330*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1340*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1350*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1360*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1370*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1380*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1390*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x13f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1400*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1410*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1420*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1430*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1440*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1450*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1460*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1470*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1480*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1490*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x14f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1500*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1510*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1520*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1530*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1540*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1550*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1560*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1570*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1580*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1590*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x15f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1600*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1610*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1620*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1630*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1640*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1650*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1660*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1670*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1680*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1690*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x16f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1700*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1710*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1720*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1730*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1740*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1750*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1760*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1770*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1780*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1790*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x17f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1800*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1810*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1820*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1830*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1840*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1850*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1860*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1870*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1880*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1890*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x18f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1900*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1910*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1920*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1930*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1940*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1950*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1960*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1970*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1980*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1990*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x19f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1a90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1aa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ab0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ac0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ad0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ae0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1af0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1b90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ba0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1bb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1bc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1bd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1be0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1bf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1c90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ca0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1cb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1cc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1cd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ce0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1cf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1d90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1da0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1db0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1dc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1dd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1de0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1df0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1e90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ea0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1eb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ec0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ed0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ee0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ef0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1f90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1fa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1fb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1fc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1fd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1fe0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x1ff0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2000*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2010*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2020*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2030*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2040*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2050*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2060*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2070*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2080*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2090*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x20f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2100*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2110*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2120*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2130*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2140*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2150*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2160*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2170*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2180*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2190*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x21f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2200*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2210*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2220*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2230*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2240*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2250*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2260*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2270*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2280*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2290*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x22f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2300*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2310*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2320*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2330*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2340*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2350*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2360*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2370*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2380*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2390*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x23f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, /*0x2400*/ 0x02, 0x00, 0x22, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2410*/ 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x21, 0x08, 0x00, 0x10, 0x20, 0x08, /*0x2420*/ 0x21, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /*0x2430*/ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2440*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, /*0x2450*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x08, 0x01, 0x00, /*0x2460*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2470*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, /*0x2480*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2490*/ 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x24a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, /*0x24b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x24c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x21, 0x18, 0x20, 0x30, 0x20, 0x28, /*0x24d0*/ 0x20, 0x28, 0x20, 0x28, 0x20, 0x30, 0x00, 0x18, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10, 0x20, 0x18, /*0x24e0*/ 0x21, 0x30, 0x01, 0x38, 0x20, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x28, /*0x24f0*/ 0x20, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x40, 0x28, 0x00, 0x00, 0x00, 0x00, /*0x2500*/ 0x20, 0x18, 0x00, 0x20, 0x20, 0x28, 0x20, 0x28, 0x00, 0x28, 0x00, 0x30, 0x20, 0x30, 0x00, 0x20, /*0x2510*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2520*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x18, 0x20, 0x28, 0x00, 0x28, 0x20, 0x28, 0x00, 0x30, /*0x2530*/ 0x00, 0x38, 0x20, 0x10, 0x20, 0x00, 0x00, 0x10, 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, /*0x2540*/ 0x00, 0x00, 0x00, 0x18, 0x20, 0x30, 0x20, 0x20, 0x00, 0x00, 0x20, 0x00, 0x21, 0x20, 0x00, 0x28, /*0x2550*/ 0x00, 0x28, 0x01, 0x28, 0x21, 0x20, 0x00, 0x28, 0x21, 0x30, 0x21, 0x20, 0x01, 0x20, 0x21, 0x30, /*0x2560*/ 0x00, 0x28, 0x20, 0x28, 0x20, 0x30, 0x20, 0x30, 0x20, 0x28, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, /*0x2570*/ 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2580*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, /*0x2590*/ 0x00, 0x00, 0xc3, 0x80, 0x26, 0xf1, 0x07, 0xe1, 0x68, 0xd9, 0x65, 0xe1, 0xc5, 0xe1, 0x03, 0x69, /*0x25a0*/ 0x00, 0x00, 0x20, 0x00, 0xa3, 0x78, 0x46, 0xe1, 0x05, 0xe9, 0x46, 0xe1, 0xe2, 0x58, 0x00, 0x00, /*0x25b0*/ 0x00, 0x00, 0x41, 0x30, 0x87, 0xd1, 0xc4, 0xe8, 0xa2, 0x78, 0x00, 0x10, 0x00, 0x00, 0x20, 0x48, /*0x25c0*/ 0x66, 0xe1, 0x65, 0xe1, 0x00, 0x28, 0x00, 0x00, 0x66, 0x91, 0xe4, 0xe8, 0x04, 0xe9, 0x86, 0xc9, /*0x25d0*/ 0x45, 0xe1, 0x64, 0xe1, 0x65, 0xe9, 0xc4, 0x88, 0x00, 0x08, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, /*0x25e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x28, 0xc4, 0xa8, /*0x25f0*/ 0x87, 0xe9, 0x65, 0xd9, 0x65, 0xe9, 0x27, 0xe9, 0x06, 0xe9, 0xe4, 0x88, 0x20, 0x08, 0x01, 0x48, /*0x2600*/ 0xc4, 0xe0, 0x67, 0xe1, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x78, 0xe5, 0xe8, 0xa7, 0xd1, /*0x2610*/ 0x00, 0x08, 0x00, 0x08, 0x03, 0xc1, 0x23, 0xf1, 0xe3, 0xe8, 0x25, 0xe1, 0x26, 0xe1, 0x24, 0xe1, /*0x2620*/ 0xc7, 0xf1, 0x04, 0x69, 0xa3, 0x58, 0x64, 0xe9, 0x23, 0xe9, 0x85, 0xe1, 0x25, 0xe1, 0x05, 0xe1, /*0x2630*/ 0x66, 0xf1, 0xc3, 0x90, 0x00, 0x18, 0x01, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2640*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2650*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x10, 0x25, 0x89, 0x87, 0xe1, 0xe5, 0xc0, 0x42, 0x60, /*0x2660*/ 0x62, 0x48, 0x61, 0x50, 0x81, 0x50, 0x61, 0x20, 0x00, 0x00, 0xc3, 0x48, 0x67, 0xd9, 0x05, 0xd1, /*0x2670*/ 0xe3, 0xa8, 0x05, 0xd9, 0x86, 0xc9, 0xe4, 0x48, 0x00, 0x00, 0x41, 0x28, 0x67, 0xe9, 0x43, 0xf1, /*0x2680*/ 0xe5, 0xd0, 0x23, 0x51, 0x20, 0x20, 0xe5, 0xb0, 0x45, 0xf9, 0x45, 0xe9, 0x00, 0x20, 0x00, 0x00, /*0x2690*/ 0x65, 0xa1, 0x44, 0xf9, 0x26, 0xd1, 0x82, 0x48, 0x61, 0x58, 0x61, 0x48, 0x81, 0x58, 0x41, 0x40, /*0x26a0*/ 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x26b0*/ 0x00, 0x00, 0x61, 0x20, 0xe3, 0x90, 0x45, 0xe9, 0x04, 0xa9, 0x61, 0x50, 0x81, 0x58, 0x83, 0x60, /*0x26c0*/ 0x24, 0xd1, 0xe5, 0xd8, 0x04, 0x71, 0x00, 0x40, 0x03, 0xf1, 0x67, 0xf1, 0x00, 0x10, 0x00, 0x00, /*0x26d0*/ 0x00, 0x00, 0xe3, 0x80, 0x23, 0xf9, 0xc7, 0xd9, 0x00, 0x00, 0x00, 0x08, 0x45, 0xd9, 0x65, 0xf9, /*0x26e0*/ 0x04, 0xd9, 0x82, 0x70, 0x41, 0x40, 0x41, 0x48, 0xa2, 0x58, 0x61, 0x20, 0xa4, 0x70, 0x46, 0xf9, /*0x26f0*/ 0xc3, 0xe0, 0x83, 0x80, 0x62, 0x50, 0x41, 0x40, 0xe5, 0xa8, 0x67, 0xe9, 0xa3, 0x68, 0x00, 0x10, /*0x2700*/ 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2710*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x62, 0x30, 0xa6, 0xd9, /*0x2720*/ 0x66, 0xf9, 0x82, 0x90, 0x00, 0x08, 0x61, 0x10, 0xc2, 0x40, 0x82, 0x48, 0xa2, 0x40, 0x40, 0x18, /*0x2730*/ 0xe3, 0x78, 0xa7, 0xf9, 0x82, 0xb0, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0xa1, 0xb8, 0x07, 0xfa, /*0x2740*/ 0x46, 0x79, 0x21, 0x28, 0x46, 0xe1, 0xe3, 0xf8, 0xc3, 0xf8, 0x65, 0xf1, 0x04, 0xf1, 0xc4, 0xf8, /*0x2750*/ 0x03, 0xf9, 0x04, 0xf1, 0x00, 0x20, 0x00, 0x00, 0x45, 0xa1, 0x04, 0xf9, 0x26, 0xd9, 0xa2, 0x50, /*0x2760*/ 0xa2, 0x48, 0xe3, 0x48, 0x61, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2770*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x30, 0x04, 0xc1, 0x84, 0xf9, /*0x2780*/ 0xc2, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0xa1, 0x23, 0xf9, 0x04, 0xc9, 0x00, 0x40, /*0x2790*/ 0x04, 0xe9, 0x05, 0xf1, 0x83, 0x58, 0x00, 0x08, 0xa3, 0x28, 0xe4, 0xa8, 0xe3, 0xf8, 0xa6, 0xe1, /*0x27a0*/ 0x00, 0x10, 0x00, 0x08, 0x44, 0xd1, 0x64, 0xf9, 0xe3, 0xd0, 0xa3, 0x70, 0xa3, 0x48, 0xc3, 0x48, /*0x27b0*/ 0x61, 0x18, 0x00, 0x00, 0xc4, 0x70, 0x66, 0xf9, 0xa2, 0xc0, 0x00, 0x28, 0x00, 0x00, 0x61, 0x18, /*0x27c0*/ 0x23, 0xa1, 0x45, 0xf9, 0xa2, 0xb0, 0x00, 0x28, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x27d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x27e0*/ 0x00, 0x08, 0x20, 0x00, 0x20, 0x48, 0x44, 0xf9, 0x65, 0xf9, 0x82, 0x68, 0x00, 0x00, 0x43, 0x59, /*0x27f0*/ 0x26, 0xd2, 0xa6, 0xe9, 0x28, 0xe2, 0x03, 0x61, 0x62, 0x80, 0x44, 0xf9, 0x81, 0xa0, 0x21, 0x20, /*0x2800*/ 0x21, 0x10, 0x41, 0x28, 0x83, 0xa8, 0x65, 0xf9, 0xe3, 0x90, 0x20, 0x40, 0x65, 0xd9, 0x03, 0xf9, /*0x2810*/ 0x82, 0xf0, 0x03, 0xe9, 0x03, 0xf1, 0xa3, 0xe8, 0x03, 0xf9, 0x04, 0xf1, 0x00, 0x28, 0x00, 0x00, /*0x2820*/ 0x85, 0x99, 0xe4, 0xf8, 0x47, 0xf9, 0xc7, 0xe1, 0xe6, 0xe1, 0x09, 0xea, 0x24, 0x79, 0x20, 0x08, /*0x2830*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2840*/ 0x00, 0x00, 0x42, 0x28, 0xe3, 0xb8, 0x84, 0xf9, 0xc3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, /*0x2850*/ 0x43, 0xa9, 0x43, 0xe9, 0xc4, 0xc8, 0x00, 0x38, 0xc5, 0xe0, 0x24, 0xf1, 0x67, 0xe9, 0x61, 0x40, /*0x2860*/ 0x07, 0x8a, 0xa5, 0xe9, 0xa4, 0xf8, 0x26, 0xd9, 0x00, 0x08, 0x01, 0x08, 0x04, 0xd1, 0x24, 0xf9, /*0x2870*/ 0x24, 0xe9, 0x87, 0xe1, 0xe9, 0xe1, 0x08, 0xda, 0x23, 0x61, 0x00, 0x00, 0xa4, 0x78, 0x46, 0xf9, /*0x2880*/ 0xa2, 0xc8, 0x21, 0x40, 0x20, 0x18, 0x84, 0x89, 0xa5, 0xe1, 0xe5, 0xf0, 0xa3, 0xa0, 0x00, 0x30, /*0x2890*/ 0x40, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x28a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xe5, 0xd8, /*0x28b0*/ 0x67, 0xf9, 0xe4, 0x90, 0x41, 0x10, 0x20, 0x00, 0x20, 0x48, 0xa4, 0xc0, 0x88, 0xf1, 0xe3, 0x58, /*0x28c0*/ 0x82, 0x78, 0x04, 0xf9, 0xe3, 0xd8, 0x24, 0xc9, 0x44, 0xc9, 0x23, 0xc1, 0xe3, 0xe8, 0x65, 0xf9, /*0x28d0*/ 0x03, 0x81, 0x20, 0x28, 0xa5, 0xd1, 0xe4, 0xf8, 0x82, 0x78, 0x22, 0x80, 0x05, 0xb1, 0x40, 0x48, /*0x28e0*/ 0x45, 0xe1, 0x45, 0xe9, 0x00, 0x28, 0x00, 0x00, 0x45, 0x99, 0x05, 0xf9, 0xc5, 0xe0, 0x00, 0x30, /*0x28f0*/ 0x00, 0x20, 0x00, 0x28, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2900*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x20, 0xe3, 0xb0, 0x45, 0xf9, /*0x2910*/ 0xa3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0xa9, 0xe3, 0xf8, 0x25, 0xc9, 0x00, 0x08, /*0x2920*/ 0x00, 0x30, 0x05, 0xd1, 0x24, 0xf9, 0x24, 0xd1, 0x45, 0xf1, 0xa4, 0xf0, 0xe5, 0xb0, 0x20, 0x18, /*0x2930*/ 0x00, 0x00, 0x00, 0x08, 0x24, 0xc9, 0x25, 0xf9, 0xc4, 0xd0, 0x41, 0x50, 0x00, 0x10, 0x20, 0x28, /*0x2940*/ 0x01, 0x18, 0x00, 0x00, 0xc4, 0x78, 0x46, 0xf9, 0x03, 0xe9, 0x05, 0xd1, 0x06, 0xd9, 0x26, 0xf9, /*0x2950*/ 0xe4, 0xa0, 0x61, 0x28, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, /*0x2960*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2970*/ 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x62, 0x90, 0x66, 0xe9, 0x86, 0xd9, 0xa2, 0x60, 0x00, 0x00, /*0x2980*/ 0x40, 0x28, 0x83, 0xb8, 0x66, 0xf9, 0xe2, 0x50, 0xa1, 0x70, 0x83, 0xf9, 0xc1, 0xd0, 0x82, 0xa0, /*0x2990*/ 0xa3, 0x90, 0xa1, 0x88, 0xa2, 0xd0, 0x65, 0xf9, 0xe2, 0x88, 0x20, 0x38, 0x85, 0xd9, 0xe4, 0xf8, /*0x29a0*/ 0x83, 0x68, 0x01, 0x40, 0xa3, 0x68, 0x60, 0x30, 0xc5, 0xf0, 0x85, 0xe1, 0x00, 0x28, 0x00, 0x00, /*0x29b0*/ 0x64, 0x99, 0x24, 0xf9, 0x25, 0xc9, 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x08, /*0x29c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x29d0*/ 0x00, 0x00, 0x40, 0x28, 0xc2, 0xb8, 0x25, 0xf9, 0xa3, 0x80, 0x00, 0x00, 0x00, 0x08, 0x20, 0x10, /*0x29e0*/ 0x64, 0xa1, 0x03, 0xf9, 0x65, 0xc1, 0x00, 0x08, 0x00, 0x00, 0xc3, 0x88, 0x44, 0xf9, 0xc2, 0xf8, /*0x29f0*/ 0xa3, 0xf8, 0xa4, 0xd0, 0x04, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x64, 0xc1, 0x66, 0xf9, /*0x2a00*/ 0xe4, 0xc8, 0x41, 0x38, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0xa3, 0x80, 0x45, 0xf9, /*0x2a10*/ 0xc1, 0xd8, 0x42, 0xc0, 0xa4, 0xe8, 0x23, 0xf9, 0xe5, 0xc1, 0x24, 0x59, 0x00, 0x00, 0x00, 0x00, /*0x2a20*/ 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2a30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /*0x2a40*/ 0xa3, 0x60, 0x26, 0xb9, 0x45, 0xb9, 0x04, 0x71, 0x25, 0x81, 0x25, 0xc1, 0x86, 0xe1, 0xc2, 0x60, /*0x2a50*/ 0x62, 0x78, 0x45, 0xf9, 0xa2, 0x88, 0x01, 0x10, 0x01, 0x00, 0x00, 0x20, 0xa3, 0xa0, 0xa6, 0xf1, /*0x2a60*/ 0xe2, 0x80, 0x40, 0x30, 0x85, 0xc1, 0x25, 0xe1, 0xc3, 0x60, 0x20, 0x00, 0x00, 0x00, 0x41, 0x30, /*0x2a70*/ 0x46, 0xd9, 0x26, 0xe1, 0x00, 0x28, 0x00, 0x00, 0x44, 0x89, 0xe4, 0xe0, 0x45, 0xd9, 0x04, 0x79, /*0x2a80*/ 0x45, 0x71, 0x44, 0x79, 0x45, 0x91, 0xa3, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2a90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x81, 0x58, 0x24, 0xc1, /*0x2aa0*/ 0x65, 0xb1, 0xe4, 0x78, 0xe4, 0x80, 0xe4, 0x88, 0x66, 0xb1, 0xa4, 0xc8, 0xa2, 0x58, 0x00, 0x00, /*0x2ab0*/ 0x20, 0x00, 0x01, 0x10, 0xc3, 0x78, 0x45, 0xc9, 0xc4, 0xa8, 0x82, 0x38, 0x00, 0x08, 0x41, 0x08, /*0x2ac0*/ 0x00, 0x00, 0x00, 0x08, 0x05, 0xb9, 0x25, 0xe9, 0xe4, 0xd0, 0x25, 0x89, 0x45, 0x69, 0x23, 0x69, /*0x2ad0*/ 0x66, 0x69, 0xa3, 0x30, 0xa3, 0x70, 0x47, 0xf1, 0xc4, 0xb8, 0x61, 0x40, 0x41, 0x58, 0xa3, 0xd0, /*0x2ae0*/ 0x65, 0xe9, 0x86, 0xb1, 0xa3, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x20, 0x08, 0x00, 0x00, /*0x2af0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, /*0x2b00*/ 0x00, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa4, 0x60, 0x66, 0x99, 0x65, 0x89, /*0x2b10*/ 0x26, 0x91, 0x26, 0x99, 0x86, 0xa1, 0xc2, 0x38, 0x62, 0x48, 0x65, 0xa1, 0xc2, 0x50, 0x00, 0x08, /*0x2b20*/ 0x00, 0x00, 0x00, 0x08, 0xc3, 0x68, 0x85, 0xa9, 0xe3, 0x50, 0x41, 0x10, 0x65, 0x89, 0x24, 0x99, /*0x2b30*/ 0xc3, 0x40, 0x00, 0x08, 0x02, 0x00, 0x42, 0x28, 0x45, 0x91, 0x86, 0x99, 0x01, 0x10, 0x01, 0x00, /*0x2b40*/ 0x25, 0x69, 0x65, 0x99, 0x45, 0x99, 0x26, 0x91, 0x65, 0x91, 0x45, 0xa1, 0xa6, 0xa1, 0xe4, 0x50, /*0x2b50*/ 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2b60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc3, 0x60, 0x86, 0xa1, 0x66, 0x89, 0x46, 0x81, 0x45, 0x89, /*0x2b70*/ 0x85, 0x79, 0x63, 0x60, 0x00, 0x08, 0x01, 0x00, 0x40, 0x00, 0x01, 0x10, 0x20, 0x08, 0x25, 0x79, /*0x2b80*/ 0x63, 0x50, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x79, 0x24, 0x91, /*0x2b90*/ 0x44, 0x91, 0x86, 0x91, 0x86, 0x89, 0x64, 0x91, 0x87, 0x99, 0xc4, 0x38, 0xa3, 0x40, 0x67, 0xa1, /*0x2ba0*/ 0x04, 0x71, 0x61, 0x20, 0x00, 0x00, 0xa3, 0x68, 0x45, 0xa1, 0x64, 0x91, 0x02, 0x59, 0x00, 0x10, /*0x2bb0*/ 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2bc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2bd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2be0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2bf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2c90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ca0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2cb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2cc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2cd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ce0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2cf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2d90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2da0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2db0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2dc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2dd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2de0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2df0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2e90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ea0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2eb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ec0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ed0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ee0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ef0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2f90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2fa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2fb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2fc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2fd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2fe0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x2ff0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3000*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3010*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3020*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3030*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3040*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3050*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3060*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3070*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3080*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3090*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3100*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3110*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3120*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3130*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3140*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3150*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3160*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3170*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3180*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3190*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x31f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3200*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3210*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3220*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3230*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3240*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3250*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3260*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3270*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3280*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3290*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x32f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3300*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3310*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3320*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3330*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3340*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3350*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3360*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3370*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3380*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3390*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x33f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3400*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3410*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3420*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3430*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3440*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3450*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3460*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3470*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3480*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3490*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x34f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3500*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3510*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3520*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3530*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3540*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3550*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3560*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3570*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3580*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3590*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x35f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3600*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3610*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3620*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3630*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3640*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3650*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3660*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3670*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3680*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3690*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x36f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3700*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3710*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3720*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3730*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3740*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3750*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3760*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3770*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3780*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3790*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x37f0*/ 0x04, 0x21, 0x65, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3800*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3810*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3820*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3830*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3840*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3850*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3860*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3870*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3880*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3890*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x38a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x38b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x29, 0xae, 0x73, 0x00, 0x00, 0x00, 0x00, /*0x38c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x38d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x38e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x38f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3900*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3910*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3920*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3930*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3940*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3950*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3960*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3970*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3980*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3990*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x39f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3a90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3aa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ab0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ac0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ad0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ae0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3af0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3b90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ba0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3bb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3bc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3bd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3be0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3bf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3c90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ca0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3cb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3cc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3cd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ce0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3cf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3d90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3da0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3db0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3dc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3dd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3de0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3df0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3e90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ea0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3eb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ec0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ed0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ee0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ef0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3f90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3fa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3fb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3fc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3fd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3fe0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x3ff0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4000*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4010*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4020*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4030*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4040*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4050*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4060*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4070*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4080*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4090*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4100*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4110*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4120*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4130*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4140*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4150*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4160*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4170*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4180*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4190*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x41f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4200*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4210*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4220*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4230*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4240*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4250*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4260*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4270*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4280*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4290*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x42f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4300*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4310*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4320*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4330*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4340*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4350*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4360*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4370*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4380*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4390*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x43f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4400*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4410*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4420*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4430*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4440*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4450*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4460*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4470*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4480*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4490*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x44f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4500*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4510*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4520*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4530*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4540*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4550*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4560*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4570*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4580*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4590*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x45f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4600*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4610*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4620*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4630*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4640*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4650*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4660*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4670*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4680*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4690*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x46f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4700*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4710*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4720*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4730*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4740*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4750*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4760*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4770*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4780*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4790*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x47f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4800*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4810*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4820*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4830*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4840*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4850*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4860*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4870*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4880*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4890*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4900*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4910*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4920*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4930*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4940*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4950*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4960*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4970*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4980*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4990*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49a0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49b0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49d0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x49f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4a90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4aa0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4ab0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4ac0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4ad0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4ae0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4af0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4b90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4ba0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4bb0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4bc0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4bd0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4be0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4bf0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c20*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c30*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c40*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c50*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c60*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x4c90*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4ca0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4cb0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4cc0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4cd0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4ce0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4cf0*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d00*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d10*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d20*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d30*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d40*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, /*0x4d50*/ 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4d60*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4d70*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4d80*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4d90*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4da0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4db0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4dc0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4dd0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4de0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4df0*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4e00*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, /*0x4e10*/ 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, }; // End of File
[ "1907833638@qq.com" ]
1907833638@qq.com
cd962181db3580975e3d223be0b04e2ef7053fb8
ab09e5a4937ffab292814d816933592d9b393d6c
/core/tmpltfun.c
fa9c8a08e45a677e62a9fc89ea66f058aa768a9c
[]
no_license
rmattes/clipsrules
a10fe624c98fe382ce2f859e97ff62fbf8892e64
3587f0a3edf136d95df8af20f07db90ed495665f
refs/heads/master
2021-01-19T14:06:27.996826
2015-08-20T18:19:25
2015-08-20T18:19:25
41,115,524
2
0
null
null
null
null
UTF-8
C
false
false
78,134
c
/*******************************************************/ /* "C" Language Integrated Production System */ /* */ /* CLIPS Version 6.31 08/04/15 */ /* */ /* DEFTEMPLATE FUNCTIONS MODULE */ /*******************************************************/ /*************************************************************/ /* Purpose: Implements the modify and duplicate functions. */ /* */ /* Principal Programmer(s): */ /* Gary D. Riley */ /* */ /* Contributing Programmer(s): */ /* */ /* Revision History: */ /* */ /* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */ /* */ /* 6.24: Added deftemplate-slot-names, */ /* deftemplate-slot-default-value, */ /* deftemplate-slot-cardinality, */ /* deftemplate-slot-allowed-values, */ /* deftemplate-slot-range, */ /* deftemplate-slot-types, */ /* deftemplate-slot-multip, */ /* deftemplate-slot-singlep, */ /* deftemplate-slot-existp, and */ /* deftemplate-slot-defaultp functions. */ /* */ /* Renamed BOOLEAN macro type to intBool. */ /* */ /* 6.30: Support for deftemplate slot facets. */ /* */ /* Removed conditional code for unsupported */ /* compilers/operating systems (IBM_MCW and */ /* MAC_MCW). */ /* */ /* Added deftemplate-slot-facet-existp and */ /* deftemplate-slot-facet-value functions. */ /* */ /* Support for long long integers. */ /* */ /* Used gensprintf instead of sprintf. */ /* */ /* Support for modify callback function. */ /* */ /* Added additional argument to function */ /* CheckDeftemplateAndSlotArguments to specify */ /* the expected number of arguments. */ /* */ /* Added const qualifiers to remove C++ */ /* deprecation warnings. */ /* */ /* Converted API macros to function calls. */ /* */ /* Added code to prevent a clear command from */ /* being executed during fact assertions via */ /* Increment/DecrementClearReadyLocks API. */ /* */ /* 6.31: Added Env prefix to GetEvaluationError and */ /* SetEvaluationError functions. */ /* */ /*************************************************************/ #define _TMPLTFUN_SOURCE_ #include "setup.h" #if DEFTEMPLATE_CONSTRUCT #include <stdio.h> #define _STDIO_INCLUDED_ #include <string.h> #include "constant.h" #include "memalloc.h" #include "symbol.h" #include "scanner.h" #include "exprnpsr.h" #include "envrnmnt.h" #include "argacces.h" #include "router.h" #include "cstrnchk.h" #include "default.h" #include "factmngr.h" #include "commline.h" #include "factrhs.h" #include "modulutl.h" #include "reorder.h" #include "sysdep.h" #include "tmpltdef.h" #include "tmpltlhs.h" #include "tmpltutl.h" #include "tmpltrhs.h" #include "tmpltfun.h" /***************************************/ /* LOCAL INTERNAL FUNCTION DEFINITIONS */ /***************************************/ static void DuplicateModifyCommand(void *,int,DATA_OBJECT_PTR); static SYMBOL_HN *CheckDeftemplateAndSlotArguments(void *,const char *,struct deftemplate **,int); #if (! RUN_TIME) && (! BLOAD_ONLY) static struct expr *ModAndDupParse(void *,struct expr *,const char *,const char *); static SYMBOL_HN *FindTemplateForFactAddress(SYMBOL_HN *,struct lhsParseNode *); #endif /****************************************************************/ /* DeftemplateFunctions: Initializes the deftemplate functions. */ /****************************************************************/ globle void DeftemplateFunctions( void *theEnv) { #if ! RUN_TIME EnvDefineFunction(theEnv,"modify",'u', PTIEF ModifyCommand,"ModifyCommand"); EnvDefineFunction(theEnv,"duplicate",'u', PTIEF DuplicateCommand,"DuplicateCommand"); EnvDefineFunction2(theEnv,"deftemplate-slot-names",'u', PTIEF DeftemplateSlotNamesFunction, "DeftemplateSlotNamesFunction", "11z"); EnvDefineFunction2(theEnv,"deftemplate-slot-default-value",'u',PTIEF DeftemplateSlotDefaultValueFunction, "DeftemplateSlotDefaultValueFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-cardinality",'u',PTIEF DeftemplateSlotCardinalityFunction, "DeftemplateSlotCardinalityFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-allowed-values",'u',PTIEF DeftemplateSlotAllowedValuesFunction, "DeftemplateSlotAllowedValuesFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-range",'u',PTIEF DeftemplateSlotRangeFunction, "DeftemplateSlotRangeFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-types",'u',PTIEF DeftemplateSlotTypesFunction, "DeftemplateSlotTypesFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-multip",'b',PTIEF DeftemplateSlotMultiPFunction, "DeftemplateSlotMultiPFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-singlep",'b',PTIEF DeftemplateSlotSinglePFunction, "DeftemplateSlotSinglePFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-existp",'b',PTIEF DeftemplateSlotExistPFunction, "DeftemplateSlotExistPFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-defaultp",'w',PTIEF DeftemplateSlotDefaultPFunction, "DeftemplateSlotDefaultPFunction","22w"); EnvDefineFunction2(theEnv,"deftemplate-slot-facet-existp",'b',PTIEF DeftemplateSlotFacetExistPFunction, "DeftemplateSlotFacetExistPFunction","33w"); EnvDefineFunction2(theEnv,"deftemplate-slot-facet-value",'u',PTIEF DeftemplateSlotFacetValueFunction, "DeftemplateSlotFacetValueFunction","33w"); #if (! BLOAD_ONLY) AddFunctionParser(theEnv,"modify",ModifyParse); AddFunctionParser(theEnv,"duplicate",DuplicateParse); #endif FuncSeqOvlFlags(theEnv,"modify",FALSE,FALSE); FuncSeqOvlFlags(theEnv,"duplicate",FALSE,FALSE); #else #if MAC_XCD #pragma unused(theEnv) #endif #endif } /*********************************************************************/ /* ModifyCommand: H/L access routine for the modify command. Calls */ /* the DuplicateModifyCommand function to perform the actual work. */ /*********************************************************************/ globle void ModifyCommand( void *theEnv, DATA_OBJECT_PTR returnValue) { DuplicateModifyCommand(theEnv,TRUE,returnValue); } /***************************************************************************/ /* DuplicateCommand: H/L access routine for the duplicate command. Calls */ /* the DuplicateModifyCommand function to perform the actual work. */ /***************************************************************************/ globle void DuplicateCommand( void *theEnv, DATA_OBJECT_PTR returnValue) { DuplicateModifyCommand(theEnv,FALSE,returnValue); } /***************************************************************/ /* DuplicateModifyCommand: Implements the duplicate and modify */ /* commands. The fact being duplicated or modified is first */ /* copied to a new fact. Replacements to the fields of the */ /* new fact are then made. If a modify command is being */ /* performed, the original fact is retracted. Lastly, the */ /* new fact is asserted. */ /***************************************************************/ static void DuplicateModifyCommand( void *theEnv, int retractIt, DATA_OBJECT_PTR returnValue) { long long factNum; struct fact *oldFact, *newFact, *theFact; struct expr *testPtr; DATA_OBJECT computeResult; struct deftemplate *templatePtr; struct templateSlot *slotPtr; int i, position, found; /*===================================================*/ /* Set the default return value to the symbol FALSE. */ /*===================================================*/ SetpType(returnValue,SYMBOL); SetpValue(returnValue,EnvFalseSymbol(theEnv)); /*==================================================*/ /* Evaluate the first argument which is used to get */ /* a pointer to the fact to be modified/duplicated. */ /*==================================================*/ testPtr = GetFirstArgument(); EnvIncrementClearReadyLocks(theEnv); EvaluateExpression(theEnv,testPtr,&computeResult); EnvDecrementClearReadyLocks(theEnv); /*==============================================================*/ /* If an integer is supplied, then treat it as a fact-index and */ /* search the fact-list for the fact with that fact-index. */ /*==============================================================*/ if (computeResult.type == INTEGER) { factNum = ValueToLong(computeResult.value); if (factNum < 0) { if (retractIt) ExpectedTypeError2(theEnv,"modify",1); else ExpectedTypeError2(theEnv,"duplicate",1); EnvSetEvaluationError(theEnv,TRUE); return; } oldFact = (struct fact *) EnvGetNextFact(theEnv,NULL); while (oldFact != NULL) { if (oldFact->factIndex == factNum) { break; } else { oldFact = oldFact->nextFact; } } if (oldFact == NULL) { char tempBuffer[20]; gensprintf(tempBuffer,"f-%lld",factNum); CantFindItemErrorMessage(theEnv,"fact",tempBuffer); return; } } /*==========================================*/ /* Otherwise, if a pointer is supplied then */ /* no lookup is required. */ /*==========================================*/ else if (computeResult.type == FACT_ADDRESS) { oldFact = (struct fact *) computeResult.value; } /*===========================================*/ /* Otherwise, the first argument is invalid. */ /*===========================================*/ else { if (retractIt) ExpectedTypeError2(theEnv,"modify",1); else ExpectedTypeError2(theEnv,"duplicate",1); EnvSetEvaluationError(theEnv,TRUE); return; } /*==================================*/ /* See if it is a deftemplate fact. */ /*==================================*/ templatePtr = oldFact->whichDeftemplate; if (templatePtr->implied) return; /*================================================================*/ /* Duplicate the values from the old fact (skipping multifields). */ /*================================================================*/ newFact = (struct fact *) CreateFactBySize(theEnv,oldFact->theProposition.multifieldLength); newFact->whichDeftemplate = templatePtr; for (i = 0; i < (int) oldFact->theProposition.multifieldLength; i++) { newFact->theProposition.theFields[i].type = oldFact->theProposition.theFields[i].type; if (newFact->theProposition.theFields[i].type != MULTIFIELD) { newFact->theProposition.theFields[i].value = oldFact->theProposition.theFields[i].value; } else { newFact->theProposition.theFields[i].value = NULL; } } /*========================*/ /* Start replacing slots. */ /*========================*/ testPtr = testPtr->nextArg; while (testPtr != NULL) { /*============================================================*/ /* If the slot identifier is an integer, then the slot was */ /* previously identified and its position within the template */ /* was stored. Otherwise, the position of the slot within the */ /* deftemplate has to be determined by comparing the name of */ /* the slot against the list of slots for the deftemplate. */ /*============================================================*/ if (testPtr->type == INTEGER) { position = (int) ValueToLong(testPtr->value); } else { found = FALSE; position = 0; slotPtr = templatePtr->slotList; while (slotPtr != NULL) { if (slotPtr->slotName == (SYMBOL_HN *) testPtr->value) { found = TRUE; slotPtr = NULL; } else { slotPtr = slotPtr->next; position++; } } if (! found) { InvalidDeftemplateSlotMessage(theEnv,ValueToString(testPtr->value), ValueToString(templatePtr->header.name),TRUE); EnvSetEvaluationError(theEnv,TRUE); ReturnFact(theEnv,newFact); return; } } /*===================================================*/ /* If a single field slot is being replaced, then... */ /*===================================================*/ if (newFact->theProposition.theFields[position].type != MULTIFIELD) { /*======================================================*/ /* If the list of values to store in the slot is empty */ /* or contains more than one member than an error has */ /* occured because a single field slot can only contain */ /* a single value. */ /*======================================================*/ if ((testPtr->argList == NULL) ? TRUE : (testPtr->argList->nextArg != NULL)) { MultiIntoSingleFieldSlotError(theEnv,GetNthSlot(templatePtr,position),templatePtr); ReturnFact(theEnv,newFact); return; } /*===================================================*/ /* Evaluate the expression to be stored in the slot. */ /*===================================================*/ EnvIncrementClearReadyLocks(theEnv); EvaluateExpression(theEnv,testPtr->argList,&computeResult); EnvSetEvaluationError(theEnv,FALSE); EnvDecrementClearReadyLocks(theEnv); /*====================================================*/ /* If the expression evaluated to a multifield value, */ /* then an error occured since a multifield value can */ /* not be stored in a single field slot. */ /*====================================================*/ if (computeResult.type == MULTIFIELD) { ReturnFact(theEnv,newFact); MultiIntoSingleFieldSlotError(theEnv,GetNthSlot(templatePtr,position),templatePtr); return; } /*=============================*/ /* Store the value in the slot */ /*=============================*/ newFact->theProposition.theFields[position].type = computeResult.type; newFact->theProposition.theFields[position].value = computeResult.value; } /*=================================*/ /* Else replace a multifield slot. */ /*=================================*/ else { /*======================================*/ /* Determine the new value of the slot. */ /*======================================*/ EnvIncrementClearReadyLocks(theEnv); StoreInMultifield(theEnv,&computeResult,testPtr->argList,FALSE); EnvSetEvaluationError(theEnv,FALSE); EnvDecrementClearReadyLocks(theEnv); /*=============================*/ /* Store the value in the slot */ /*=============================*/ newFact->theProposition.theFields[position].type = computeResult.type; newFact->theProposition.theFields[position].value = computeResult.value; } testPtr = testPtr->nextArg; } /*=====================================*/ /* Copy the multifield values from the */ /* old fact that were not replaced. */ /*=====================================*/ for (i = 0; i < (int) oldFact->theProposition.multifieldLength; i++) { if ((newFact->theProposition.theFields[i].type == MULTIFIELD) && (newFact->theProposition.theFields[i].value == NULL)) { newFact->theProposition.theFields[i].value = CopyMultifield(theEnv,(struct multifield *) oldFact->theProposition.theFields[i].value); } } /*================================================*/ /* Call registered modify notification functions. */ /*================================================*/ if (retractIt && (FactData(theEnv)->ListOfModifyFunctions != NULL)) { struct callFunctionItemWithArg *theModifyFunction; struct fact *replacement = newFact; /*==================================================================*/ /* If the fact already exists, determine if it's the fact we're */ /* modifying. If so it will be retracted and reasserted. If not, */ /* it will just be retracted, so pass NULL as the replacement fact. */ /*==================================================================*/ if (! FactWillBeAsserted(theEnv,newFact)) { if (! MultifieldsEqual(&oldFact->theProposition, &newFact->theProposition)) { replacement = NULL; } } /*=========================================================*/ /* Preassign the factIndex and timeTag so the notification */ /* function will see the correct values. */ /*=========================================================*/ if (replacement != NULL) { replacement->factIndex = FactData(theEnv)->NextFactIndex; replacement->factHeader.timeTag = DefruleData(theEnv)->CurrentEntityTimeTag; } /*=========================================*/ /* Call each modify notification function. */ /*=========================================*/ for (theModifyFunction = FactData(theEnv)->ListOfModifyFunctions; theModifyFunction != NULL; theModifyFunction = theModifyFunction->next) { SetEnvironmentCallbackContext(theEnv,theModifyFunction->context); if (theModifyFunction->environmentAware) { ((void (*)(void *,void *,void *))(*theModifyFunction->func))(theEnv,oldFact,replacement); } else { ((void (*)(void *,void *))(*theModifyFunction->func))(oldFact,replacement); } } } /*======================================*/ /* Perform the duplicate/modify action. */ /*======================================*/ if (retractIt) EnvRetract(theEnv,oldFact); theFact = (struct fact *) EnvAssert(theEnv,newFact); /*========================================*/ /* The asserted fact is the return value. */ /*========================================*/ if (theFact != NULL) { SetpDOBegin(returnValue,1); SetpDOEnd(returnValue,theFact->theProposition.multifieldLength); SetpType(returnValue,FACT_ADDRESS); SetpValue(returnValue,(void *) theFact); } return; } /****************************************************/ /* DeftemplateSlotNamesFunction: H/L access routine */ /* for the deftemplate-slot-names function. */ /****************************************************/ globle void DeftemplateSlotNamesFunction( void *theEnv, DATA_OBJECT *returnValue) { const char *deftemplateName; struct deftemplate *theDeftemplate; /*=============================================*/ /* Set up the default return value for errors. */ /*=============================================*/ returnValue->type = SYMBOL; returnValue->value = EnvFalseSymbol(theEnv); /*============================================*/ /* Check for the correct number of arguments. */ /*============================================*/ if (EnvArgCountCheck(theEnv,"deftemplate-slot-names",EXACTLY,1) == -1) return; /*=======================================*/ /* Get the reference to the deftemplate. */ /*=======================================*/ deftemplateName = GetConstructName(theEnv,"deftemplate-slot-names","deftemplate name"); if (deftemplateName == NULL) return; theDeftemplate = (struct deftemplate *) EnvFindDeftemplate(theEnv,deftemplateName); if (theDeftemplate == NULL) { CantFindItemErrorMessage(theEnv,"deftemplate",deftemplateName); return; } /*=====================*/ /* Get the slot names. */ /*=====================*/ EnvDeftemplateSlotNames(theEnv,theDeftemplate,returnValue); } /**********************************************/ /* EnvDeftemplateSlotNames: C access routine */ /* for the deftemplate-slot-names function. */ /**********************************************/ globle void EnvDeftemplateSlotNames( void *theEnv, void *vTheDeftemplate, DATA_OBJECT *returnValue) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; struct multifield *theList; struct templateSlot *theSlot; unsigned long count; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { SetpType(returnValue,MULTIFIELD); SetpDOBegin(returnValue,1); SetpDOEnd(returnValue,1); theList = (struct multifield *) EnvCreateMultifield(theEnv,(int) 1); SetMFType(theList,1,SYMBOL); SetMFValue(theList,1,EnvAddSymbol(theEnv,"implied")); SetpValue(returnValue,(void *) theList); return; } /*=================================*/ /* Count the number of slot names. */ /*=================================*/ for (count = 0, theSlot = theDeftemplate->slotList; theSlot != NULL; count++, theSlot = theSlot->next) { /* Do Nothing */ } /*=============================================================*/ /* Create a multifield value in which to store the slot names. */ /*=============================================================*/ SetpType(returnValue,MULTIFIELD); SetpDOBegin(returnValue,1); SetpDOEnd(returnValue,(long) count); theList = (struct multifield *) EnvCreateMultifield(theEnv,count); SetpValue(returnValue,(void *) theList); /*===============================================*/ /* Store the slot names in the multifield value. */ /*===============================================*/ for (count = 1, theSlot = theDeftemplate->slotList; theSlot != NULL; count++, theSlot = theSlot->next) { SetMFType(theList,count,SYMBOL); SetMFValue(theList,count,theSlot->slotName); } } /*******************************************************/ /* DeftemplateSlotDefaultPFunction: H/L access routine */ /* for the deftemplate-slot-defaultp function. */ /*******************************************************/ globle void *DeftemplateSlotDefaultPFunction( void *theEnv) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; int defaultType; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-existp",&theDeftemplate,2); if (slotName == NULL) { return(EnvFalseSymbol(theEnv)); } /*===============================*/ /* Does the slot have a default? */ /*===============================*/ defaultType = EnvDeftemplateSlotDefaultP(theEnv,theDeftemplate,ValueToString(slotName)); if (defaultType == STATIC_DEFAULT) { return(EnvAddSymbol(theEnv,"static")); } else if (defaultType == DYNAMIC_DEFAULT) { return(EnvAddSymbol(theEnv,"dynamic")); } return(EnvFalseSymbol(theEnv)); } /*************************************************/ /* EnvDeftemplateSlotDefaultP: C access routine */ /* for the deftemplate-slot-defaultp function. */ /*************************************************/ globle int EnvDeftemplateSlotDefaultP( void *theEnv, void *vTheDeftemplate, const char *slotName) { short position; struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; struct templateSlot *theSlot; /*==================================================*/ /* Make sure the slot exists (the symbol implied is */ /* used for the implied slot of an ordered fact). */ /*==================================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { return(STATIC_DEFAULT); } else { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(NO_DEFAULT); } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(NO_DEFAULT); } /*======================================*/ /* Return the default type of the slot. */ /*======================================*/ if (theSlot->noDefault) { return(NO_DEFAULT); } else if (theSlot->defaultDynamic) { return(DYNAMIC_DEFAULT); } return(STATIC_DEFAULT); } /*************************************************************/ /* DeftemplateSlotDefaultValueFunction: H/L access routine */ /* for the deftemplate-slot-default-value function. */ /*************************************************************/ globle void DeftemplateSlotDefaultValueFunction( void *theEnv, DATA_OBJECT_PTR theValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-default-value",&theDeftemplate,2); if (slotName == NULL) { theValue->type = SYMBOL; theValue->value = EnvFalseSymbol(theEnv); return; } /*=========================================*/ /* Get the deftemplate slot default value. */ /*=========================================*/ EnvDeftemplateSlotDefaultValue(theEnv,theDeftemplate,ValueToString(slotName),theValue); } /******************************************************/ /* EnvDeftemplateSlotDefaultValue: C access routine */ /* for the deftemplate-slot-default-value function. */ /******************************************************/ globle intBool EnvDeftemplateSlotDefaultValue( void *theEnv, void *vTheDeftemplate, const char *slotName, DATA_OBJECT_PTR theValue) { short position; struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; struct templateSlot *theSlot; DATA_OBJECT tempDO; /*=============================================*/ /* Set up the default return value for errors. */ /*=============================================*/ SetpType(theValue,SYMBOL); SetpValue(theValue,EnvFalseSymbol(theEnv)); /*==================================================*/ /* Make sure the slot exists (the symbol implied is */ /* used for the implied slot of an ordered fact). */ /*==================================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { theValue->type = MULTIFIELD; theValue->value = EnvCreateMultifield(theEnv,0L); theValue->begin = 1; theValue->end = 0; return(TRUE); } else { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } /*=======================================*/ /* Return the default value of the slot. */ /*=======================================*/ if (theSlot->noDefault) { SetpType(theValue,SYMBOL); SetpValue(theValue,EnvAddSymbol(theEnv,"?NONE")); } else if (DeftemplateSlotDefault(theEnv,theDeftemplate,theSlot,&tempDO,TRUE)) { SetpDOBegin(theValue,GetDOBegin(tempDO)); SetpDOEnd(theValue,GetDOEnd(tempDO)); SetpType(theValue,tempDO.type); SetpValue(theValue,tempDO.value); } else { return (FALSE); } return(TRUE); } /**********************************************************/ /* DeftemplateSlotCardinalityFunction: H/L access routine */ /* for the deftemplate-slot-cardinality function. */ /**********************************************************/ globle void DeftemplateSlotCardinalityFunction( void *theEnv, DATA_OBJECT_PTR theValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-cardinality",&theDeftemplate,2); if (slotName == NULL) { EnvSetMultifieldErrorValue(theEnv,theValue); return; } /*=======================================*/ /* Get the deftemplate slot cardinality. */ /*=======================================*/ EnvDeftemplateSlotCardinality(theEnv,theDeftemplate,ValueToString(slotName),theValue); } /****************************************************/ /* EnvDeftemplateSlotCardinality: C access routine */ /* for the deftemplate-slot-cardinality function. */ /****************************************************/ globle void EnvDeftemplateSlotCardinality( void *theEnv, void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { result->type = MULTIFIELD; result->begin = 0; result->end = 1; result->value = EnvCreateMultifield(theEnv,2L); SetMFType(result->value,1,INTEGER); SetMFValue(result->value,1,SymbolData(theEnv)->Zero); SetMFType(result->value,2,SYMBOL); SetMFValue(result->value,2,SymbolData(theEnv)->PositiveInfinity); return; } else { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } /*=====================================*/ /* Return the cardinality of the slot. */ /*=====================================*/ if (theSlot->multislot == 0) { EnvSetMultifieldErrorValue(theEnv,result); return; } result->type = MULTIFIELD; result->begin = 0; result->end = 1; result->value = EnvCreateMultifield(theEnv,2L); if (theSlot->constraints != NULL) { SetMFType(result->value,1,theSlot->constraints->minFields->type); SetMFValue(result->value,1,theSlot->constraints->minFields->value); SetMFType(result->value,2,theSlot->constraints->maxFields->type); SetMFValue(result->value,2,theSlot->constraints->maxFields->value); } else { SetMFType(result->value,1,INTEGER); SetMFValue(result->value,1,SymbolData(theEnv)->Zero); SetMFType(result->value,2,SYMBOL); SetMFValue(result->value,2,SymbolData(theEnv)->PositiveInfinity); } } /************************************************************/ /* DeftemplateSlotAllowedValuesFunction: H/L access routine */ /* for the deftemplate-slot-allowed-values function. */ /************************************************************/ globle void DeftemplateSlotAllowedValuesFunction( void *theEnv, DATA_OBJECT_PTR theValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-allowed-values",&theDeftemplate,2); if (slotName == NULL) { EnvSetMultifieldErrorValue(theEnv,theValue); return; } /*==========================================*/ /* Get the deftemplate slot allowed values. */ /*==========================================*/ EnvDeftemplateSlotAllowedValues(theEnv,theDeftemplate,ValueToString(slotName),theValue); } /*******************************************************/ /* EnvDeftemplateSlotAllowedValues: C access routine */ /* for the deftemplate-slot-allowed-values function. */ /*******************************************************/ globle void EnvDeftemplateSlotAllowedValues( void *theEnv, void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; int i; EXPRESSION *theExp; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { result->type = SYMBOL; result->value = EnvFalseSymbol(theEnv); return; } else { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } /*========================================*/ /* Return the allowed values of the slot. */ /*========================================*/ if ((theSlot->constraints != NULL) ? (theSlot->constraints->restrictionList == NULL) : TRUE) { result->type = SYMBOL; result->value = EnvFalseSymbol(theEnv); return; } result->type = MULTIFIELD; result->begin = 0; result->end = ExpressionSize(theSlot->constraints->restrictionList) - 1; result->value = EnvCreateMultifield(theEnv,(unsigned long) (result->end + 1)); i = 1; theExp = theSlot->constraints->restrictionList; while (theExp != NULL) { SetMFType(result->value,i,theExp->type); SetMFValue(result->value,i,theExp->value); theExp = theExp->nextArg; i++; } } /****************************************************/ /* DeftemplateSlotRangeFunction: H/L access routine */ /* for the deftemplate-slot-range function. */ /****************************************************/ globle void DeftemplateSlotRangeFunction( void *theEnv, DATA_OBJECT_PTR theValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-range",&theDeftemplate,2); if (slotName == NULL) { EnvSetMultifieldErrorValue(theEnv,theValue); return; } /*=================================*/ /* Get the deftemplate slot range. */ /*=================================*/ EnvDeftemplateSlotRange(theEnv,theDeftemplate,ValueToString(slotName),theValue); } /**********************************************/ /* EnvDeftemplateSlotRange: C access routine */ /* for the deftemplate-slot-range function. */ /**********************************************/ globle void EnvDeftemplateSlotRange( void *theEnv, void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { result->type = MULTIFIELD; result->begin = 0; result->end = 1; result->value = EnvCreateMultifield(theEnv,2L); SetMFType(result->value,1,SYMBOL); SetMFValue(result->value,1,SymbolData(theEnv)->NegativeInfinity); SetMFType(result->value,2,SYMBOL); SetMFValue(result->value,2,SymbolData(theEnv)->PositiveInfinity); return; } else { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } /*===============================*/ /* Return the range of the slot. */ /*===============================*/ if ((theSlot->constraints == NULL) ? FALSE : (theSlot->constraints->anyAllowed || theSlot->constraints->floatsAllowed || theSlot->constraints->integersAllowed)) { result->type = MULTIFIELD; result->begin = 0; result->end = 1; result->value = EnvCreateMultifield(theEnv,2L); SetMFType(result->value,1,theSlot->constraints->minValue->type); SetMFValue(result->value,1,theSlot->constraints->minValue->value); SetMFType(result->value,2,theSlot->constraints->maxValue->type); SetMFValue(result->value,2,theSlot->constraints->maxValue->value); } else { result->type = SYMBOL; result->value = EnvFalseSymbol(theEnv); return; } } /****************************************************/ /* DeftemplateSlotTypesFunction: H/L access routine */ /* for the deftemplate-slot-types function. */ /****************************************************/ globle void DeftemplateSlotTypesFunction( void *theEnv, DATA_OBJECT_PTR theValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-types",&theDeftemplate,2); if (slotName == NULL) { EnvSetMultifieldErrorValue(theEnv,theValue); return; } /*=================================*/ /* Get the deftemplate slot types. */ /*=================================*/ EnvDeftemplateSlotTypes(theEnv,theDeftemplate,ValueToString(slotName),theValue); } /**********************************************/ /* EnvDeftemplateSlotTypes: C access routine */ /* for the deftemplate-slot-types function. */ /**********************************************/ globle void EnvDeftemplateSlotTypes( void *theEnv, void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot = NULL; int numTypes, i, allTypes = FALSE; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot name is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") != 0) { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetMultifieldErrorValue(theEnv,result); EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return; } /*==============================================*/ /* If the slot has no constraint information or */ /* there is no type restriction, then all types */ /* are allowed for the slot. */ /*==============================================*/ if ((theDeftemplate->implied) || ((theSlot->constraints != NULL) ? theSlot->constraints->anyAllowed : TRUE)) { #if OBJECT_SYSTEM numTypes = 8; #else numTypes = 6; #endif allTypes = TRUE; } /*==============================================*/ /* Otherwise count the number of types allowed. */ /*==============================================*/ else { numTypes = theSlot->constraints->symbolsAllowed + theSlot->constraints->stringsAllowed + theSlot->constraints->floatsAllowed + theSlot->constraints->integersAllowed + theSlot->constraints->instanceNamesAllowed + theSlot->constraints->instanceAddressesAllowed + theSlot->constraints->externalAddressesAllowed + theSlot->constraints->factAddressesAllowed; } /*========================================*/ /* Return the allowed types for the slot. */ /*========================================*/ result->type = MULTIFIELD; result->begin = 0; result->end = numTypes - 1; result->value = EnvCreateMultifield(theEnv,(long) numTypes); i = 1; if (allTypes || theSlot->constraints->floatsAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"FLOAT")); } if (allTypes || theSlot->constraints->integersAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"INTEGER")); } if (allTypes || theSlot->constraints->symbolsAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"SYMBOL")); } if (allTypes || theSlot->constraints->stringsAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"STRING")); } if (allTypes || theSlot->constraints->externalAddressesAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"EXTERNAL-ADDRESS")); } if (allTypes || theSlot->constraints->factAddressesAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"FACT-ADDRESS")); } #if OBJECT_SYSTEM if (allTypes || theSlot->constraints->instanceAddressesAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i++,EnvAddSymbol(theEnv,"INSTANCE-ADDRESS")); } if (allTypes || theSlot->constraints->instanceNamesAllowed) { SetMFType(result->value,i,SYMBOL); SetMFValue(result->value,i,EnvAddSymbol(theEnv,"INSTANCE-NAME")); } #endif } /*****************************************************/ /* DeftemplateSlotMultiPFunction: H/L access routine */ /* for the deftemplate-slot-multip function. */ /*****************************************************/ globle int DeftemplateSlotMultiPFunction( void *theEnv) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-multip",&theDeftemplate,2); if (slotName == NULL) { return(FALSE); } /*================================*/ /* Is the slot a multifield slot? */ /*================================*/ return EnvDeftemplateSlotMultiP(theEnv,theDeftemplate,ValueToString(slotName)); } /***********************************************/ /* EnvDeftemplateSlotMultiP: C access routine */ /* for the deftemplate-slot-multip function. */ /***********************************************/ globle int EnvDeftemplateSlotMultiP( void *theEnv, void *vTheDeftemplate, const char *slotName) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { return(TRUE); } else { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } /*================================*/ /* Is the slot a multifield slot? */ /*================================*/ return(theSlot->multislot); } /******************************************************/ /* DeftemplateSlotSinglePFunction: H/L access routine */ /* for the deftemplate-slot-singlep function. */ /******************************************************/ globle int DeftemplateSlotSinglePFunction( void *theEnv) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-singlep",&theDeftemplate,2); if (slotName == NULL) { return(FALSE); } /*==================================*/ /* Is the slot a single field slot? */ /*==================================*/ return EnvDeftemplateSlotSingleP(theEnv,theDeftemplate,ValueToString(slotName)); } /************************************************/ /* EnvDeftemplateSlotSingleP: C access routine */ /* for the deftemplate-slot-singlep function. */ /************************************************/ globle int EnvDeftemplateSlotSingleP( void *theEnv, void *vTheDeftemplate, const char *slotName) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { return(FALSE); } else { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { EnvSetEvaluationError(theEnv,TRUE); InvalidDeftemplateSlotMessage(theEnv,slotName, ValueToString(theDeftemplate->header.name),FALSE); return(FALSE); } /*==================================*/ /* Is the slot a single field slot? */ /*==================================*/ return(! theSlot->multislot); } /*****************************************************/ /* DeftemplateSlotExistPFunction: H/L access routine */ /* for the deftemplate-slot-existp function. */ /*****************************************************/ globle int DeftemplateSlotExistPFunction( void *theEnv) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-existp",&theDeftemplate,2); if (slotName == NULL) { return(FALSE); } /*======================*/ /* Does the slot exist? */ /*======================*/ return EnvDeftemplateSlotExistP(theEnv,theDeftemplate,ValueToString(slotName)); } /************************************************/ /* EnvDeftemplateSlotExistP: C access routine */ /* for the deftemplate-slot-existp function. */ /************************************************/ globle int EnvDeftemplateSlotExistP( void *theEnv, void *vTheDeftemplate, const char *slotName) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; /*===============================================*/ /* If we're dealing with an implied deftemplate, */ /* then the only slot names is "implied." */ /*===============================================*/ if (theDeftemplate->implied) { if (strcmp(slotName,"implied") == 0) { return(TRUE); } else { return(FALSE); } } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if (FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position) == NULL) { return(FALSE); } /*==================*/ /* The slot exists. */ /*==================*/ return(TRUE); } /**********************************************************/ /* DeftemplateSlotFacetExistPFunction: H/L access routine */ /* for the deftemplate-slot-facet-existp function. */ /**********************************************************/ globle int DeftemplateSlotFacetExistPFunction( void *theEnv) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; DATA_OBJECT facetName; /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-facet-existp",&theDeftemplate,3); if (slotName == NULL) { return(FALSE); } /*============================*/ /* Get the name of the facet. */ /*============================*/ if (EnvArgTypeCheck(theEnv,"deftemplate-slot-facet-existp",3,SYMBOL,&facetName) == FALSE) { return(FALSE); } /*======================*/ /* Does the slot exist? */ /*======================*/ return EnvDeftemplateSlotFacetExistP(theEnv,theDeftemplate,ValueToString(slotName),DOToString(facetName)); } /*****************************************************/ /* EnvDeftemplateSlotFacetExistP: C access routine */ /* for the deftemplate-slot-facet-existp function. */ /*****************************************************/ globle int EnvDeftemplateSlotFacetExistP( void *theEnv, void *vTheDeftemplate, const char *slotName, const char *facetName) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; SYMBOL_HN *facetHN; struct expr *tempFacet; /*=================================================*/ /* An implied deftemplate doesn't have any facets. */ /*=================================================*/ if (theDeftemplate->implied) { return(FALSE); } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { return(FALSE); } /*=======================*/ /* Search for the facet. */ /*=======================*/ facetHN = FindSymbolHN(theEnv,facetName); for (tempFacet = theSlot->facetList; tempFacet != NULL; tempFacet = tempFacet->nextArg) { if (tempFacet->value == facetHN) { return(TRUE); } } /*===========================*/ /* The facet does not exist. */ /*===========================*/ return(FALSE); } /*********************************************************/ /* DeftemplateSlotFacetValueFunction: H/L access routine */ /* for the deftemplate-slot-facet-value function. */ /*********************************************************/ globle void DeftemplateSlotFacetValueFunction( void *theEnv, DATA_OBJECT *returnValue) { struct deftemplate *theDeftemplate; SYMBOL_HN *slotName; DATA_OBJECT facetName; /*=============================================*/ /* Set up the default return value for errors. */ /*=============================================*/ returnValue->type = SYMBOL; returnValue->value = EnvFalseSymbol(theEnv); /*===================================================*/ /* Retrieve the deftemplate and slot name arguments. */ /*===================================================*/ slotName = CheckDeftemplateAndSlotArguments(theEnv,"deftemplate-slot-facet-existp",&theDeftemplate,3); if (slotName == NULL) { return; } /*============================*/ /* Get the name of the facet. */ /*============================*/ if (EnvArgTypeCheck(theEnv,"deftemplate-slot-facet-existp",3,SYMBOL,&facetName) == FALSE) { return; } /*===========================*/ /* Retrieve the facet value. */ /*===========================*/ EnvDeftemplateSlotFacetValue(theEnv,theDeftemplate,ValueToString(slotName),DOToString(facetName),returnValue); } /****************************************************/ /* EnvDeftemplateSlotFacetValue: C access routine */ /* for the deftemplate-slot-facet-value function. */ /****************************************************/ globle int EnvDeftemplateSlotFacetValue( void *theEnv, void *vTheDeftemplate, const char *slotName, const char *facetName, DATA_OBJECT *rv) { struct deftemplate *theDeftemplate = (struct deftemplate *) vTheDeftemplate; short position; struct templateSlot *theSlot; SYMBOL_HN *facetHN; struct expr *tempFacet; /*=================================================*/ /* An implied deftemplate doesn't have any facets. */ /*=================================================*/ if (theDeftemplate->implied) { return(FALSE); } /*============================================*/ /* Otherwise search for the slot name in the */ /* list of slots defined for the deftemplate. */ /*============================================*/ else if ((theSlot = FindSlot(theDeftemplate,(SYMBOL_HN *) EnvAddSymbol(theEnv,slotName),&position)) == NULL) { return(FALSE); } /*=======================*/ /* Search for the facet. */ /*=======================*/ facetHN = FindSymbolHN(theEnv,facetName); for (tempFacet = theSlot->facetList; tempFacet != NULL; tempFacet = tempFacet->nextArg) { if (tempFacet->value == facetHN) { EvaluateExpression(theEnv,tempFacet->argList,rv); return(TRUE); } } /*===========================*/ /* The facet does not exist. */ /*===========================*/ return(FALSE); } /************************************************************/ /* CheckDeftemplateAndSlotArguments: Checks the deftemplate */ /* and slot arguments for various functions. */ /************************************************************/ static SYMBOL_HN *CheckDeftemplateAndSlotArguments( void *theEnv, const char *functionName, struct deftemplate **theDeftemplate, int expectedArgs) { DATA_OBJECT tempDO; const char *deftemplateName; /*============================================*/ /* Check for the correct number of arguments. */ /*============================================*/ if (EnvArgCountCheck(theEnv,functionName,EXACTLY,expectedArgs) == -1) { return(NULL); } /*=====================================*/ /* There must be at least 2 arguments. */ /*=====================================*/ if (EnvArgCountCheck(theEnv,functionName,AT_LEAST,2) == -1) { return(NULL); } /*=======================================*/ /* Get the reference to the deftemplate. */ /*=======================================*/ EnvRtnUnknown(theEnv,1,&tempDO); if (GetType(tempDO) != SYMBOL) { ExpectedTypeError1(theEnv,functionName,1,"deftemplate name"); return(NULL); } deftemplateName = DOToString(tempDO); *theDeftemplate = (struct deftemplate *) EnvFindDeftemplate(theEnv,deftemplateName); if (*theDeftemplate == NULL) { CantFindItemErrorMessage(theEnv,"deftemplate",deftemplateName); return(NULL); } /*===========================*/ /* Get the name of the slot. */ /*===========================*/ if (EnvArgTypeCheck(theEnv,functionName,2,SYMBOL,&tempDO) == FALSE) { return(NULL); } return((SYMBOL_HN *) GetValue(tempDO)); } #if (! RUN_TIME) && (! BLOAD_ONLY) /***************************************************************/ /* UpdateModifyDuplicate: Changes the modify/duplicate command */ /* found on the RHS of a rule such that the positions of the */ /* slots for replacement are stored rather than the slot */ /* name which allows quicker replacement of slots. This */ /* substitution can only take place when the deftemplate */ /* type is known (i.e. if a fact-index is used you don't */ /* know which type of deftemplate is going to be replaced */ /* until you actually do the replacement of slots). */ /***************************************************************/ globle intBool UpdateModifyDuplicate( void *theEnv, struct expr *top, const char *name, void *vTheLHS) { struct expr *functionArgs, *tempArg; SYMBOL_HN *templateName; struct deftemplate *theDeftemplate; struct templateSlot *slotPtr; short position; /*========================================*/ /* Determine the fact-address or index to */ /* be retracted by the modify command. */ /*========================================*/ functionArgs = top->argList; if (functionArgs->type == SF_VARIABLE) { templateName = FindTemplateForFactAddress((SYMBOL_HN *) functionArgs->value, (struct lhsParseNode *) vTheLHS); if (templateName == NULL) return(TRUE); } else { return(TRUE); } /*========================================*/ /* Make sure that the fact being modified */ /* has a corresponding deftemplate. */ /*========================================*/ theDeftemplate = (struct deftemplate *) LookupConstruct(theEnv,DeftemplateData(theEnv)->DeftemplateConstruct, ValueToString(templateName), FALSE); if (theDeftemplate == NULL) return(TRUE); if (theDeftemplate->implied) return(TRUE); /*=============================================================*/ /* Make sure all the slot names are valid for the deftemplate. */ /*=============================================================*/ tempArg = functionArgs->nextArg; while (tempArg != NULL) { /*======================*/ /* Does the slot exist? */ /*======================*/ if ((slotPtr = FindSlot(theDeftemplate,(SYMBOL_HN *) tempArg->value,&position)) == NULL) { InvalidDeftemplateSlotMessage(theEnv,ValueToString(tempArg->value), ValueToString(theDeftemplate->header.name),TRUE); return(FALSE); } /*=========================================================*/ /* Is a multifield value being put in a single field slot? */ /*=========================================================*/ if (slotPtr->multislot == FALSE) { if (tempArg->argList == NULL) { SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents); return(FALSE); } else if (tempArg->argList->nextArg != NULL) { SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents); return(FALSE); } else if ((tempArg->argList->type == MF_VARIABLE) || ((tempArg->argList->type == FCALL) ? (((struct FunctionDefinition *) tempArg->argList->value)->returnValueType == 'm') : FALSE)) { SingleFieldSlotCardinalityError(theEnv,slotPtr->slotName->contents); return(FALSE); } } /*======================================*/ /* Are the slot restrictions satisfied? */ /*======================================*/ if (CheckRHSSlotTypes(theEnv,tempArg->argList,slotPtr,name) == 0) return(FALSE); /*=============================================*/ /* Replace the slot with the integer position. */ /*=============================================*/ tempArg->type = INTEGER; tempArg->value = (void *) EnvAddLong(theEnv,(long long) (FindSlotPosition(theDeftemplate,(SYMBOL_HN *) tempArg->value) - 1)); tempArg = tempArg->nextArg; } return(TRUE); } /**************************************************/ /* FindTemplateForFactAddress: Searches for the */ /* deftemplate name associated with the pattern */ /* to which a fact address has been bound. */ /**************************************************/ static SYMBOL_HN *FindTemplateForFactAddress( SYMBOL_HN *factAddress, struct lhsParseNode *theLHS) { struct lhsParseNode *thePattern = NULL; /*===============================================*/ /* Look through the LHS patterns for the pattern */ /* which is bound to the fact address used by */ /* the modify/duplicate function. */ /*===============================================*/ while (theLHS != NULL) { if (theLHS->value == (void *) factAddress) { thePattern = theLHS; theLHS = NULL; } else { theLHS = theLHS->bottom; } } if (thePattern == NULL) return(NULL); /*=====================================*/ /* Verify that just a symbol is stored */ /* as the first field of the pattern. */ /*=====================================*/ thePattern = thePattern->right; if ((thePattern->type != SF_WILDCARD) || (thePattern->bottom == NULL)) { return(NULL); } thePattern = thePattern->bottom; if ((thePattern->type != SYMBOL) || (thePattern->right != NULL) || (thePattern->bottom != NULL)) { return(NULL); } /*==============================*/ /* Return the deftemplate name. */ /*==============================*/ return((SYMBOL_HN *) thePattern->value); } /*******************************************/ /* ModifyParse: Parses the modify command. */ /*******************************************/ globle struct expr *ModifyParse( void *theEnv, struct expr *top, const char *logicalName) { return(ModAndDupParse(theEnv,top,logicalName,"modify")); } /*************************************************/ /* DuplicateParse: Parses the duplicate command. */ /*************************************************/ globle struct expr *DuplicateParse( void *theEnv, struct expr *top, const char *logicalName) { return(ModAndDupParse(theEnv,top,logicalName,"duplicate")); } /*************************************************************/ /* ModAndDupParse: Parses the modify and duplicate commands. */ /*************************************************************/ static struct expr *ModAndDupParse( void *theEnv, struct expr *top, const char *logicalName, const char *name) { int error = FALSE; struct token theToken; struct expr *nextOne, *tempSlot; struct expr *newField, *firstField, *lastField; int printError; short done; /*==================================================================*/ /* Parse the fact-address or index to the modify/duplicate command. */ /*==================================================================*/ SavePPBuffer(theEnv," "); GetToken(theEnv,logicalName,&theToken); if ((theToken.type == SF_VARIABLE) || (theToken.type == GBL_VARIABLE)) { nextOne = GenConstant(theEnv,theToken.type,theToken.value); } else if (theToken.type == INTEGER) { if (! TopLevelCommand(theEnv)) { PrintErrorID(theEnv,"TMPLTFUN",1,TRUE); EnvPrintRouter(theEnv,WERROR,"Fact-indexes can only be used by "); EnvPrintRouter(theEnv,WERROR,name); EnvPrintRouter(theEnv,WERROR," as a top level command.\n"); ReturnExpression(theEnv,top); return(NULL); } nextOne = GenConstant(theEnv,INTEGER,theToken.value); } else { ExpectedTypeError2(theEnv,name,1); ReturnExpression(theEnv,top); return(NULL); } nextOne->nextArg = NULL; nextOne->argList = NULL; top->argList = nextOne; nextOne = top->argList; /*=======================================================*/ /* Parse the remaining modify/duplicate slot specifiers. */ /*=======================================================*/ GetToken(theEnv,logicalName,&theToken); while (theToken.type != RPAREN) { PPBackup(theEnv); SavePPBuffer(theEnv," "); SavePPBuffer(theEnv,theToken.printForm); /*=================================================*/ /* Slot definition begins with a left parenthesis. */ /*=================================================*/ if (theToken.type != LPAREN) { SyntaxErrorMessage(theEnv,"duplicate/modify function"); ReturnExpression(theEnv,top); return(NULL); } /*=================================*/ /* The slot name must be a symbol. */ /*=================================*/ GetToken(theEnv,logicalName,&theToken); if (theToken.type != SYMBOL) { SyntaxErrorMessage(theEnv,"duplicate/modify function"); ReturnExpression(theEnv,top); return(NULL); } /*=================================*/ /* Check for duplicate slot names. */ /*=================================*/ for (tempSlot = top->argList->nextArg; tempSlot != NULL; tempSlot = tempSlot->nextArg) { if (tempSlot->value == theToken.value) { AlreadyParsedErrorMessage(theEnv,"slot ",ValueToString(theToken.value)); ReturnExpression(theEnv,top); return(NULL); } } /*=========================================*/ /* Add the slot name to the list of slots. */ /*=========================================*/ nextOne->nextArg = GenConstant(theEnv,SYMBOL,theToken.value); nextOne = nextOne->nextArg; /*====================================================*/ /* Get the values to be stored in the specified slot. */ /*====================================================*/ firstField = NULL; lastField = NULL; done = FALSE; while (! done) { SavePPBuffer(theEnv," "); newField = GetAssertArgument(theEnv,logicalName,&theToken,&error, RPAREN,FALSE,&printError); if (error) { if (printError) SyntaxErrorMessage(theEnv,"deftemplate pattern"); ReturnExpression(theEnv,top); return(NULL); } if (newField == NULL) { done = TRUE; } if (lastField == NULL) { firstField = newField; } else { lastField->nextArg = newField; } lastField = newField; } /*================================================*/ /* Slot definition ends with a right parenthesis. */ /*================================================*/ if (theToken.type != RPAREN) { SyntaxErrorMessage(theEnv,"duplicate/modify function"); ReturnExpression(theEnv,top); ReturnExpression(theEnv,firstField); return(NULL); } else { PPBackup(theEnv); PPBackup(theEnv); SavePPBuffer(theEnv,")"); } nextOne->argList = firstField; GetToken(theEnv,logicalName,&theToken); } /*================================================*/ /* Return the parsed modify/duplicate expression. */ /*================================================*/ return(top); } #endif /* (! RUN_TIME) && (! BLOAD_ONLY) */ /*#####################################*/ /* ALLOW_ENVIRONMENT_GLOBALS Functions */ /*#####################################*/ #if ALLOW_ENVIRONMENT_GLOBALS globle void DeftemplateSlotNames( void *vTheDeftemplate, DATA_OBJECT *returnValue) { EnvDeftemplateSlotNames(GetCurrentEnvironment(),vTheDeftemplate,returnValue); } globle intBool DeftemplateSlotDefaultValue( void *vTheDeftemplate, const char *slotName, DATA_OBJECT_PTR theValue) { return EnvDeftemplateSlotDefaultValue(GetCurrentEnvironment(),vTheDeftemplate,slotName,theValue); } globle void DeftemplateSlotCardinality( void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { EnvDeftemplateSlotCardinality(GetCurrentEnvironment(),vTheDeftemplate,slotName,result); } globle void DeftemplateSlotAllowedValues( void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { EnvDeftemplateSlotAllowedValues(GetCurrentEnvironment(),vTheDeftemplate,slotName,result); } globle void DeftemplateSlotRange( void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { EnvDeftemplateSlotRange(GetCurrentEnvironment(),vTheDeftemplate,slotName,result); } globle void DeftemplateSlotTypes( void *vTheDeftemplate, const char *slotName, DATA_OBJECT *result) { EnvDeftemplateSlotTypes(GetCurrentEnvironment(),vTheDeftemplate,slotName,result); } globle int DeftemplateSlotMultiP( void *vTheDeftemplate, const char *slotName) { return EnvDeftemplateSlotMultiP(GetCurrentEnvironment(),vTheDeftemplate,slotName); } globle int DeftemplateSlotSingleP( void *vTheDeftemplate, const char *slotName) { return EnvDeftemplateSlotSingleP(GetCurrentEnvironment(),vTheDeftemplate,slotName); } globle int DeftemplateSlotExistP( void *vTheDeftemplate, const char *slotName) { return EnvDeftemplateSlotExistP(GetCurrentEnvironment(),vTheDeftemplate,slotName); } globle int DeftemplateSlotDefaultP( void *vTheDeftemplate, const char *slotName) { return EnvDeftemplateSlotDefaultP(GetCurrentEnvironment(),vTheDeftemplate,slotName); } #endif /* ALLOW_ENVIRONMENT_GLOBALS */ #endif /* DEFTEMPLATE_CONSTRUCT */
[ "garyriley@e08858b5-663f-48cb-b8ec-ee4f463dcae4" ]
garyriley@e08858b5-663f-48cb-b8ec-ee4f463dcae4
13566f16ff076035c151b2ddc71dc222909d537a
d04b3215a8e667b4a1499378934d78da5c71f86a
/6_국제로봇콘테스트/App SW/cam_disp.c
f0eb98c9ee0fd77f23b96eb1b9677778eb98abae
[]
no_license
JuyeonHong/OPTC
6f6b3e23de3d3a44eaef6291373df5fcee7f0204
d41ec9498123692ec275e4865540ffe7f4570703
refs/heads/master
2020-09-28T02:45:53.552517
2019-12-08T13:18:13
2019-12-08T13:18:13
null
0
0
null
null
null
null
UTF-8
C
false
false
734
c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include "cam_disp.h" #define SDK_DEV_NAME "/dev/eagle_sdk" #define EAGLE_CAMERA_DISP_OFF (0x12480) #define EAGLE_CAMERA_DISP_ON (0x12481) int eagle_camera_off(void) { int handle; if ((handle = open(SDK_DEV_NAME, O_RDWR)) < 0) { printf("Open Error %s\n", SDK_DEV_NAME); return -1; } ioctl(handle, EAGLE_CAMERA_DISP_OFF, 0); close(handle); return 0; } int eagle_camera_on(void) { int handle; if ((handle = open(SDK_DEV_NAME, O_RDWR)) < 0) { printf("Open Error %s\n", SDK_DEV_NAME); return -1; } ioctl(handle, EAGLE_CAMERA_DISP_ON, 0); close(handle); return 0; }
[ "hyunzion@gmail.com" ]
hyunzion@gmail.com
1c1ec89f975b3d692ba4f4f05734d86c649ab3e6
82a2ef67760561afa8168a4627c8fce03bc0ff71
/OTL_Header.h
e581eded883972446ff929695aaa84b32ce266ba
[]
no_license
Olernov/TAP3.Loader
ddd3bb4f86097d00781e1deea8284718e9e90842
0411268778ea5b8fc6203c61896870db6c933d85
refs/heads/master
2020-04-16T17:23:34.972239
2017-05-25T15:00:07
2017-05-25T15:00:07
37,660,857
1
0
null
null
null
null
UTF-8
C
false
false
2,209
h
#pragma once #define OTL_ORA9I // Compile OTL 4.0/OCI9i // #define OTL_ORA8 // #define OTL_ORA8I #if defined(_MSC_VER) // VC++ // Enabling support for 64-bit signed integers // Since 64-bit integers are not part of the ANSI C++ // standard, this definition is compiler specific. #define OTL_BIGINT __int64 // Defining a bigint constant that is larger than // the max 32-bit integer value. const OTL_BIGINT BIGINT_VAL1=12345678901234000; // Defining a string-to-bigint conversion // that is used by OTL internally. // Since 64-bit ineteger conversion functions are // not part of the ANSI C++ standard, the code // below is compiler specific #define OTL_STR_TO_BIGINT(str,n) \ { \ n=_atoi64(str); \ } // Defining a bigint-to-string conversion // that is used by OTL internally. // Since 64-bit ineteger conversion functions are // not part of the ANSI C++ standard, the code // below is compiler specific #define OTL_BIGINT_TO_STR(n,str) \ { \ _i64toa(n,str,10); \ } #elif defined(__GNUC__) // GNU C++ #include <stdlib.h> // Enabling support for 64-bit signed integers // Since 64-bit integers are not part of the ANSI C++ // standard, this definition is compiler specific. #define OTL_BIGINT long long const OTL_BIGINT BIGINT_VAL1=12345678901234000LL; // Defining a string-to-bigint conversion // that is used by OTL internally. // Since 64-bit ineteger conversion functions are // not part of the ANSI C++ standard, the code // below is compiler specific. #define OTL_STR_TO_BIGINT(str,n) \ { \ n=strtoll(str,0,10); \ } // Defining a bigint-to-string conversion // that is used by OTL internally. // Since 64-bit ineteger conversion functions are // not part of the ANSI C++ standard, the code // below is compiler specific #define OTL_BIGINT_TO_STR(n,str) \ { \ sprintf(str,"%lld",n); \ } #endif #define OTL_STL #include "otlv4.h"
[ "olernov@gmail.com" ]
olernov@gmail.com
0a99a98926eb2e5671bbb5a33e065208f16d5265
e46a761542918fd80cbe5afb62925a5d7bf6b2bc
/C/TP1/PoM/ft_winner_is.c
b2f01a2e5da7d3531d7f7bf6f56f82b3278af2cf
[]
no_license
pacnijim/OpenClassroom
f9b113702946b369e5138098cb3c5ecb37b9e916
8595b3fcbb573f46a7684a56779f6486ec28c71b
refs/heads/master
2020-04-23T04:22:59.211054
2019-02-16T12:19:23
2019-02-16T12:19:23
170,905,990
0
0
null
null
null
null
UTF-8
C
false
false
429
c
#include "plus_ou_moins.h" //void ft_putstr(char *str); void ft_winner_is(int score_1, int score_2) { if (score_1 == score_2) ft_putstr("Draw, anyone win, your are twice loser. ;p\n"); else if (score_1 < score_2) ft_putstr("Congratulation player one, you win.\nPlayer two you are a LOSER\n"); else ft_putstr("Player two win 'bravo'.\nPlayer one you can cry ----> LOSER\n"); }
[ "pacnijim@student.42.fr" ]
pacnijim@student.42.fr
629869dc031bb656671951df4a591303a660bcb1
aca31b63c0c5defba8dd91913154f589ef89523a
/chapter (3)/myseek.c
146e4aa337cc4b8693dc91b683d3dc9d7012d3ba
[]
no_license
Forasen/chapter_linux_git
47e6416b95945ebf02c5b24f4c11f31fd98d3f13
9fd77d90cdc7595e15b7471b7ff15b1ef59c38a2
refs/heads/master
2021-06-18T10:17:54.486707
2015-08-09T15:19:28
2015-08-09T15:19:28
null
0
0
null
null
null
null
UTF-8
C
false
false
504
c
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> typedef struct stu { int st_id ; char st_name[20]; }stu_t, *pstu_t; int main(int argc, char* argv[])// file_name { int fd = open(argv[1], O_RDONLY); if(fd == -1) { perror("open"); exit(1); } stu_t stu = {0, ""} ; lseek(fd, 2 * sizeof(stu_t), SEEK_SET); read(fd, &stu, sizeof(stu)); printf("id: %d, name: %s\n", stu.st_id, stu.st_name); close(fd); }
[ "2287794993@qq.com" ]
2287794993@qq.com
1c9c2f0db0d7a3112d5657457e0d19ae0040f61c
ae0da0c1ce410f894f588319d1677c26d7ec1403
/libft/libft_srcs/ft_lstdel.c
72950e3879f4f4377f1a5010f6368518b1abca3b
[]
no_license
Draeyo/malloc2
85b10121d02c224b683ed7c4509e3949dae16903
147438a17be2a3c473201663d4184e3f8f077bd4
refs/heads/master
2020-05-09T09:43:26.052342
2019-07-05T09:47:58
2019-07-05T09:47:58
181,013,762
0
0
null
null
null
null
UTF-8
C
false
false
1,127
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstdel.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vlistrat <vlistrat@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/12/01 17:47:10 by vlistrat #+# #+# */ /* Updated: 2015/12/05 14:50:52 by vlistrat ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) { t_list *list; list = *alst; while (list->next) { ft_lstdelone(&list, del); list = (*alst)->next; } ft_lstdelone(&list, del); *alst = NULL; }
[ "vlistrat@e1r5p11.42.fr" ]
vlistrat@e1r5p11.42.fr
d45afa416e4a2fecdddb3393fa26e3fa86b4abdc
53b6f891e264f35625bc9ad227c766be03eaff9a
/15-PWM调光/PWM调光.c
b73ac15e4e8595710a5c5a1cc2aef2055beaee40
[]
no_license
xiaoyaoltian/51-single-chip-microcomputer
5dc7f60a7e50b5bf86e1f0142856dbbaad3d94a4
826e4ae21608e67bb6b365868f5bc28da20fd97e
refs/heads/master
2020-03-26T22:53:03.895888
2018-09-17T01:48:56
2018-09-17T01:48:56
145,493,783
11
1
null
null
null
null
UTF-8
C
false
false
2,293
c
/******************************************************************************* * 版 权 : 红梅科技工作室 * 论 坛 :https://blog.csdn.net/Qingzhusshuiyun * Q Q :2369099714 * 版权所有,盗版必究。 * 工 程 : PWM调光 * 文件名 : PWM调光.c * 处理器 : STC89C52RC * 编译环境 : Keil 5 * 系统时钟 : 12MHZ * 版 本 : V1.0 * 生成日期 : 2018-05-14 * 修改日期 : * 简单描述 : 通过PWM(脉宽调制)调节LED的亮度 *******************************************************************************/ #include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义 //sbit LED0=P1^0;// 用sbit 关键字 定义 LED到P1.0端口,LED是自己任意定义且容易记忆的符号 sbit P20=P2^0; void Delay(unsigned int t); //函数声明 /*------------------------------------------------ 主函数 ------------------------------------------------*/ void main (void) { //unsigned int kk; unsigned int CYCLE=100,PWM_LOW=0;//定义周期并赋值 // while (1) //主循环 { if(P20==0){Delay(3);if(P20==0){CYCLE=CYCLE+100;if(CYCLE==600){CYCLE=100;}while(P20==0);}} P1=0XFF;// LED0=1; Delay(60000); //特意加延时,可以看到熄灭的过程 for(PWM_LOW=1;PWM_LOW<CYCLE;PWM_LOW++){ //PWM_LOW表示低 //电平时间,这个循环中低电平时长从1累加到CYCLE(周期)的值,即600次 P1=0X00; // LED0=0; //点亮LED Delay(PWM_LOW);//延时长度,600次循环中从1加至599 P1=0XFF; // LED0=1; //熄灭LED Delay(CYCLE-PWM_LOW);//延时长度,600次循环中从599减至1 } P1=0X00;// LED0=0; for(PWM_LOW=CYCLE-1;PWM_LOW>0;PWM_LOW--){ //与逐渐变亮相反的过程 P1=0X00; // LED0=0; Delay(PWM_LOW); P1=0XFF; // LED0=1; Delay(CYCLE-PWM_LOW); } //主循环中添加其他需要一直工作的程序 } } /*------------------------------------------------ 延时函数,含有输入参数 unsigned int t,无返回值 unsigned int 是定义无符号整形变量,其值的范围是 0~65535 ------------------------------------------------*/ void Delay(unsigned int t) { while(--t); }
[ "32162482+xiaoyaoltian@users.noreply.github.com" ]
32162482+xiaoyaoltian@users.noreply.github.com
7f8a1e8f6db3c9e48b24de1823d2591e34e32fe1
c8abb7c0a610348eb0b8474ce66463584ec5bc98
/third_party/liblfds711@da3494fef10df4681e267d8b2b8cce2c90d5a9fa/src/lfds711_queue_bounded_manyproducer_manyconsumer/lfds711_queue_bounded_manyproducer_manyconsumer_query.c
cdabb6a315cb30f8fbb31f3e5a87be01438b0996
[ "GPL-1.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
microsoft/BuildXL
d31b74ba23057dd251bcd9040390a7e751f04fae
f884dd1e34ed50f76d27d3fb1b8679235995653d
refs/heads/main
2023-08-31T21:19:44.385093
2023-08-30T23:36:57
2023-08-30T23:36:57
152,813,045
436
114
MIT
2023-09-13T09:49:08
2018-10-12T22:16:45
C#
UTF-8
C
false
false
4,483
c
/***** includes *****/ #include "lfds711_queue_bounded_manyproducer_manyconsumer_internal.h" /***** private prototypes *****/ static void lfds711_queue_bmm_internal_validate( struct lfds711_queue_bmm_state *qbmms, struct lfds711_misc_validation_info *vi, enum lfds711_misc_validity *lfds711_validity ); /****************************************************************************/ void lfds711_queue_bmm_query( struct lfds711_queue_bmm_state *qbmms, enum lfds711_queue_bmm_query query_type, void *query_input, void *query_output ) { LFDS711_PAL_ASSERT( qbmms != NULL ); // TRD : query_type can be any value in its range switch( query_type ) { case LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: { lfds711_pal_uint_t local_read_index, local_write_index; LFDS711_PAL_ASSERT( query_input == NULL ); LFDS711_PAL_ASSERT( query_output != NULL ); LFDS711_MISC_BARRIER_LOAD; local_read_index = qbmms->read_index; local_write_index = qbmms->write_index; *(lfds711_pal_uint_t *) query_output = +( local_write_index - local_read_index ); if( local_read_index > local_write_index ) *(lfds711_pal_uint_t *) query_output = ((lfds711_pal_uint_t) -1) - *(lfds711_pal_uint_t *) query_output; } break; case LFDS711_QUEUE_BMM_QUERY_SINGLETHREADED_VALIDATE: // TRD : query_input can be NULL LFDS711_PAL_ASSERT( query_output != NULL ); lfds711_queue_bmm_internal_validate( qbmms, (struct lfds711_misc_validation_info *) query_input, (enum lfds711_misc_validity *) query_output ); break; } return; } /****************************************************************************/ static void lfds711_queue_bmm_internal_validate( struct lfds711_queue_bmm_state *qbmms, struct lfds711_misc_validation_info *vi, enum lfds711_misc_validity *lfds711_validity ) { lfds711_pal_uint_t expected_sequence_number, loop, number_elements, sequence_number; LFDS711_PAL_ASSERT( qbmms != NULL ); // TRD : vi can be NULL LFDS711_PAL_ASSERT( lfds711_validity != NULL ); *lfds711_validity = LFDS711_MISC_VALIDITY_VALID; /* TRD : starting from the read_index, we should find number_elements of incrementing sequence numbers we then perform a second scan from the write_index onwards, which should have (max elements in queue - number_elements) incrementing sequence numbers */ lfds711_queue_bmm_query( qbmms, LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); expected_sequence_number = qbmms->element_array[ qbmms->read_index & qbmms->mask ].sequence_number; for( loop = 0 ; loop < number_elements ; loop++ ) { sequence_number = qbmms->element_array[ (qbmms->read_index + loop) & qbmms->mask ].sequence_number; if( sequence_number != expected_sequence_number ) *lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ORDER; if( sequence_number == expected_sequence_number ) expected_sequence_number = sequence_number + 1; } // TRD : now the write_index onwards expected_sequence_number = qbmms->element_array[ qbmms->write_index & qbmms->mask ].sequence_number; for( loop = 0 ; loop < qbmms->number_elements - number_elements ; loop++ ) { sequence_number = qbmms->element_array[ (qbmms->write_index + loop) & qbmms->mask ].sequence_number; if( sequence_number != expected_sequence_number ) *lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ORDER; if( sequence_number == expected_sequence_number ) expected_sequence_number = sequence_number + 1; } // TRD : now check against the expected number of elements if( *lfds711_validity == LFDS711_MISC_VALIDITY_VALID and vi != NULL ) { lfds711_pal_uint_t number_elements; lfds711_queue_bmm_query( qbmms, LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); if( number_elements < vi->min_elements ) *lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; if( number_elements > vi->max_elements ) *lfds711_validity = LFDS711_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; } return; }
[ "angerlic@microsoft.com" ]
angerlic@microsoft.com
c9540670ce3009d362fe374c743e07e0f164f02a
739b462e40efcc4cc65a8c3d0335cfc611b8a0e8
/PsyScopeEditor/DebugHelper.h
151fb602a3da7998bd4e3a2ba4aa04c14cfc4fbf
[]
no_license
PsyScopeX/PsyScopeEditor
549d18528f1425b53adb7ab476c4117ccd12218b
435277c9ec5b8c190eedb5be62849f7f9a4f09ec
refs/heads/master
2020-04-29T14:59:32.364897
2016-01-18T10:55:03
2016-01-18T10:55:03
38,607,702
2
3
null
null
null
null
UTF-8
C
false
false
238
h
// // NSDebugHelper.h // PsyScopeX // // Created by luca on 04/11/2014. // Copyright (c) 2014 SISSA/ISAS Trieste. All rights reserved. // #ifndef PsyScopeX_DebugHelper_h #define PsyScopeX_DebugHelper_h #include FileLogger.h #endif
[ "jamesa333uk@gmail.com" ]
jamesa333uk@gmail.com
ee05adfb5f32c6082cbe6ca9498053f4b7e47771
c44b288ed44960d6b3eb7cc28f00d0f209e8d8c9
/ebox/other_svn/svn3_old/RobotArm/RA1_et_rtw/rtwtypes.h
83c318823c92ba96198fa38cb9dc57249a4f3533
[]
no_license
MartinPlantinga/Edrive
1fb6ac09766ff16196449620e4f55a5c734eecc7
6397a083ceab5dc2b00c54ee2ab9fba88bdf0afd
refs/heads/master
2023-03-01T14:16:34.204694
2017-03-16T19:20:34
2017-03-16T19:20:34
80,610,028
0
0
null
null
null
null
UTF-8
C
false
false
1,084
h
/* * rtwtypes.h * * Academic License - for use in teaching, academic research, and meeting * course requirements at degree granting institutions only. Not for * government, commercial, or other organizational use. * * Code generation for model "RA1". * * Model version : 1.900 * Simulink Coder version : 8.9 (R2015b) 13-Aug-2015 * C source code generated on : Thu Mar 24 12:53:29 2016 * * Target selection: ectarget.tlc * Note: GRT includes extra infrastructure and instrumentation for prototyping * Embedded hardware selection: 32-bit Generic * Code generation objectives: Unspecified * Validation result: Not run */ #ifndef __RTWTYPES_H__ #define __RTWTYPES_H__ #include "tmwtypes.h" #include "simstruc_types.h" #ifndef POINTER_T # define POINTER_T typedef void * pointer_T; #endif /* Logical type definitions */ #if (!defined(__cplusplus)) # ifndef false # define false (0U) # endif # ifndef true # define true (1U) # endif #endif #endif /* __RTWTYPES_H__ */
[ "m.plantinga@student.tue.nl" ]
m.plantinga@student.tue.nl
8a68f9da0e87f2ddd2c346832bb4f7c1f7617f9e
b4764dab45feaaaeac0ecafef58971a4bc19d494
/components/bt/esp_ble_mesh/mesh_models/server/include/server_common.h
d1a313ee73af79588f305e99f802bde94d046022
[ "Apache-2.0" ]
permissive
brunocasu/esp-idf
cca813644766844e1e5cb8544c39dc5be8ae3a1e
dfcb844445185f3c095b2b8f655d8f09cb67607c
refs/heads/master
2020-12-23T21:43:26.021536
2020-08-20T19:23:06
2020-08-20T19:23:06
237,282,722
1
0
Apache-2.0
2020-01-30T18:54:11
2020-01-30T18:54:11
null
UTF-8
C
false
false
4,965
h
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE 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. #ifndef _SERVER_COMMON_H_ #define _SERVER_COMMON_H_ #include <string.h> #include <stdint.h> #include "mesh_buf.h" #include "mesh_access.h" #include "mesh_kernel.h" #define BLE_MESH_SERVER_RSP_MAX_LEN 384 #define BLE_MESH_SERVER_TRANS_MIC_SIZE 4 #define BLE_MESH_CHECK_SEND_STATUS(_func) do { \ int __status = (_func); \ if (__status) { \ BT_ERR("%s, Send failed, err %d", __func__, __status); \ } \ } while(0); #define BLE_MESH_STATE_OFF 0x00 #define BLE_MESH_STATE_ON 0x01 #define BLE_MESH_STATE_RESTORE 0x02 /* Following 4 values are as per Mesh Model specification */ #define BLE_MESH_LIGHTNESS_MIN 0x0001 #define BLE_MESH_LIGHTNESS_MAX 0xFFFF #define BLE_MESH_TEMPERATURE_MIN 0x0320 #define BLE_MESH_TEMPERATURE_MAX 0x4E20 #define BLE_MESH_TEMPERATURE_UNKNOWN 0xFFFF /* Refer 7.2 of Mesh Model Specification */ #define BLE_MESH_RANGE_UPDATE_SUCCESS 0x00 #define BLE_MESH_CANNOT_SET_RANGE_MIN 0x01 #define BLE_MESH_CANNOT_SET_RANGE_MAX 0x02 #define BLE_MESH_UNKNOWN_REMAIN_TIME 0x3F #define BLE_MESH_DEVICE_SPECIFIC_RESOLUTION 10 #define BLE_MESH_INVALID_DEVICE_PROPERTY_ID 0x0000 enum { BLE_MESH_TRANS_TIMER_START, /* Proper transition timer has been started */ BLE_MESH_TRANS_FLAG_MAX, }; struct bt_mesh_state_transition { bool just_started; u8_t trans_time; u8_t remain_time; u8_t delay; u32_t quo_tt; u32_t counter; u32_t total_duration; s64_t start_timestamp; BLE_MESH_ATOMIC_DEFINE(flag, BLE_MESH_TRANS_FLAG_MAX); struct k_delayed_work timer; }; struct bt_mesh_last_msg_info { u8_t tid; u16_t src; u16_t dst; s64_t timestamp; }; #define BLE_MESH_SERVER_RSP_BY_APP 0 #define BLE_MESH_SERVER_AUTO_RSP 1 struct bt_mesh_server_rsp_ctrl { /** * @brief BLE Mesh Server Response Option * 1. If get_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response * of Client Get messages need to be replied by the application; * 2. If get_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response * of Client Get messages will be replied by the server models; * 3. If set_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response * of Client Set messages need to be replied by the application; * 4. If set_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response * of Client Set messages will be replied by the server models; * 5. If status_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response * of Server Status messages need to be replied by the application; * 6. If status_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response * of Server status messages will be replied by the server models; */ u8_t get_auto_rsp : 1, /* Response for Client Get messages */ set_auto_rsp : 1, /* Response for Client Set messages */ status_auto_rsp : 1; /* Response for Server Status messages */ }; u8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model); int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, u8_t *trans_time); int bt_mesh_server_get_optional(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf, u8_t *trans_time, u8_t *delay, bool *optional); void bt_mesh_server_alloc_ctx(struct k_work *work); bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last, u8_t tid, u16_t src, u16_t dst, s64_t *now); void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last, u8_t tid, u16_t src, u16_t dst, s64_t *now); struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u16_t msg_len); #endif /* _SERVER_COMMON_H_ */
[ "lly@espressif.com" ]
lly@espressif.com
9c5c760e8bc9322f4ac768d77e6d82c89909db9a
5aea61e3ff5d4577a38a1b97e79eef4613a8b7bb
/Lab4-BlockRAM/Lab4-2_HDL_Synthesis/project_1/design_1_wrapper/zynq_fsbl/zynq_fsbl_bsp/ps7_cortexa9_0/include/xparameters.h
410d3c7031c787e1fdf73b7086b6b8087666bdb7
[]
no_license
TAKE72K/2021-FPGA-System-Design
07c3e91226aad918fc8eaa27d91b940319aa1392
0937c3f76f6a32c9049cff637953ff8824d6e066
refs/heads/master
2023-05-03T11:27:40.413974
2021-05-26T05:41:43
2021-05-26T05:41:43
null
0
0
null
null
null
null
UTF-8
C
false
false
14,001
h
#ifndef XPARAMETERS_H /* prevent circular inclusions */ #define XPARAMETERS_H /* by using protection macros */ /* Definition for CPU ID */ #define XPAR_CPU_ID 0U /* Definitions for peripheral PS7_CORTEXA9_0 */ #define XPAR_PS7_CORTEXA9_0_CPU_CLK_FREQ_HZ 650000000 /******************************************************************/ /* Canonical definitions for peripheral PS7_CORTEXA9_0 */ #define XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ 650000000 /******************************************************************/ #include "xparameters_ps.h" #define STDIN_BASEADDRESS 0xE0000000 #define STDOUT_BASEADDRESS 0xE0000000 /******************************************************************/ /* Platform specific definitions */ #define PLATFORM_ZYNQ /* Definitions for sleep timer configuration */ #define XSLEEP_TIMER_IS_DEFAULT_TIMER /******************************************************************/ /* Definitions for driver BRAM */ #define XPAR_BRAM_NUM_INSTANCES 1 /* Definitions for peripheral BRAM_0 */ #define XPAR_BRAM_0_DEVICE_ID 0 #define XPAR_BRAM_0_S00_AXI_BASEADDR 0x43C00000 #define XPAR_BRAM_0_S00_AXI_HIGHADDR 0x43C0FFFF /******************************************************************/ /* Definitions for peripheral PS7_DDR_0 */ #define XPAR_PS7_DDR_0_S_AXI_BASEADDR 0x00100000 #define XPAR_PS7_DDR_0_S_AXI_HIGHADDR 0x1FFFFFFF /******************************************************************/ /* Definitions for driver DEVCFG */ #define XPAR_XDCFG_NUM_INSTANCES 1U /* Definitions for peripheral PS7_DEV_CFG_0 */ #define XPAR_PS7_DEV_CFG_0_DEVICE_ID 0U #define XPAR_PS7_DEV_CFG_0_BASEADDR 0xF8007000U #define XPAR_PS7_DEV_CFG_0_HIGHADDR 0xF80070FFU /******************************************************************/ /* Canonical definitions for peripheral PS7_DEV_CFG_0 */ #define XPAR_XDCFG_0_DEVICE_ID XPAR_PS7_DEV_CFG_0_DEVICE_ID #define XPAR_XDCFG_0_BASEADDR 0xF8007000U #define XPAR_XDCFG_0_HIGHADDR 0xF80070FFU /******************************************************************/ /* Definitions for driver DMAPS */ #define XPAR_XDMAPS_NUM_INSTANCES 2 /* Definitions for peripheral PS7_DMA_NS */ #define XPAR_PS7_DMA_NS_DEVICE_ID 0 #define XPAR_PS7_DMA_NS_BASEADDR 0xF8004000 #define XPAR_PS7_DMA_NS_HIGHADDR 0xF8004FFF /* Definitions for peripheral PS7_DMA_S */ #define XPAR_PS7_DMA_S_DEVICE_ID 1 #define XPAR_PS7_DMA_S_BASEADDR 0xF8003000 #define XPAR_PS7_DMA_S_HIGHADDR 0xF8003FFF /******************************************************************/ /* Canonical definitions for peripheral PS7_DMA_NS */ #define XPAR_XDMAPS_0_DEVICE_ID XPAR_PS7_DMA_NS_DEVICE_ID #define XPAR_XDMAPS_0_BASEADDR 0xF8004000 #define XPAR_XDMAPS_0_HIGHADDR 0xF8004FFF /* Canonical definitions for peripheral PS7_DMA_S */ #define XPAR_XDMAPS_1_DEVICE_ID XPAR_PS7_DMA_S_DEVICE_ID #define XPAR_XDMAPS_1_BASEADDR 0xF8003000 #define XPAR_XDMAPS_1_HIGHADDR 0xF8003FFF /******************************************************************/ /* Definitions for driver EMACPS */ #define XPAR_XEMACPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_ETHERNET_0 */ #define XPAR_PS7_ETHERNET_0_DEVICE_ID 0 #define XPAR_PS7_ETHERNET_0_BASEADDR 0xE000B000 #define XPAR_PS7_ETHERNET_0_HIGHADDR 0xE000BFFF #define XPAR_PS7_ETHERNET_0_ENET_CLK_FREQ_HZ 125000000 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV0 8 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_1000MBPS_DIV1 1 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV0 8 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_100MBPS_DIV1 5 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV0 8 #define XPAR_PS7_ETHERNET_0_ENET_SLCR_10MBPS_DIV1 50 #define XPAR_PS7_ETHERNET_0_ENET_TSU_CLK_FREQ_HZ 0 /******************************************************************/ #define XPAR_PS7_ETHERNET_0_IS_CACHE_COHERENT 0 #define XPAR_XEMACPS_0_IS_CACHE_COHERENT 0 /* Canonical definitions for peripheral PS7_ETHERNET_0 */ #define XPAR_XEMACPS_0_DEVICE_ID XPAR_PS7_ETHERNET_0_DEVICE_ID #define XPAR_XEMACPS_0_BASEADDR 0xE000B000 #define XPAR_XEMACPS_0_HIGHADDR 0xE000BFFF #define XPAR_XEMACPS_0_ENET_CLK_FREQ_HZ 125000000 #define XPAR_XEMACPS_0_ENET_SLCR_1000Mbps_DIV0 8 #define XPAR_XEMACPS_0_ENET_SLCR_1000Mbps_DIV1 1 #define XPAR_XEMACPS_0_ENET_SLCR_100Mbps_DIV0 8 #define XPAR_XEMACPS_0_ENET_SLCR_100Mbps_DIV1 5 #define XPAR_XEMACPS_0_ENET_SLCR_10Mbps_DIV0 8 #define XPAR_XEMACPS_0_ENET_SLCR_10Mbps_DIV1 50 #define XPAR_XEMACPS_0_ENET_TSU_CLK_FREQ_HZ 0 /******************************************************************/ /* Definitions for peripheral PS7_AFI_0 */ #define XPAR_PS7_AFI_0_S_AXI_BASEADDR 0xF8008000 #define XPAR_PS7_AFI_0_S_AXI_HIGHADDR 0xF8008FFF /* Definitions for peripheral PS7_AFI_1 */ #define XPAR_PS7_AFI_1_S_AXI_BASEADDR 0xF8009000 #define XPAR_PS7_AFI_1_S_AXI_HIGHADDR 0xF8009FFF /* Definitions for peripheral PS7_AFI_2 */ #define XPAR_PS7_AFI_2_S_AXI_BASEADDR 0xF800A000 #define XPAR_PS7_AFI_2_S_AXI_HIGHADDR 0xF800AFFF /* Definitions for peripheral PS7_AFI_3 */ #define XPAR_PS7_AFI_3_S_AXI_BASEADDR 0xF800B000 #define XPAR_PS7_AFI_3_S_AXI_HIGHADDR 0xF800BFFF /* Definitions for peripheral PS7_DDRC_0 */ #define XPAR_PS7_DDRC_0_S_AXI_BASEADDR 0xF8006000 #define XPAR_PS7_DDRC_0_S_AXI_HIGHADDR 0xF8006FFF /* Definitions for peripheral PS7_GLOBALTIMER_0 */ #define XPAR_PS7_GLOBALTIMER_0_S_AXI_BASEADDR 0xF8F00200 #define XPAR_PS7_GLOBALTIMER_0_S_AXI_HIGHADDR 0xF8F002FF /* Definitions for peripheral PS7_GPV_0 */ #define XPAR_PS7_GPV_0_S_AXI_BASEADDR 0xF8900000 #define XPAR_PS7_GPV_0_S_AXI_HIGHADDR 0xF89FFFFF /* Definitions for peripheral PS7_INTC_DIST_0 */ #define XPAR_PS7_INTC_DIST_0_S_AXI_BASEADDR 0xF8F01000 #define XPAR_PS7_INTC_DIST_0_S_AXI_HIGHADDR 0xF8F01FFF /* Definitions for peripheral PS7_IOP_BUS_CONFIG_0 */ #define XPAR_PS7_IOP_BUS_CONFIG_0_S_AXI_BASEADDR 0xE0200000 #define XPAR_PS7_IOP_BUS_CONFIG_0_S_AXI_HIGHADDR 0xE0200FFF /* Definitions for peripheral PS7_L2CACHEC_0 */ #define XPAR_PS7_L2CACHEC_0_S_AXI_BASEADDR 0xF8F02000 #define XPAR_PS7_L2CACHEC_0_S_AXI_HIGHADDR 0xF8F02FFF /* Definitions for peripheral PS7_OCMC_0 */ #define XPAR_PS7_OCMC_0_S_AXI_BASEADDR 0xF800C000 #define XPAR_PS7_OCMC_0_S_AXI_HIGHADDR 0xF800CFFF /* Definitions for peripheral PS7_PL310_0 */ #define XPAR_PS7_PL310_0_S_AXI_BASEADDR 0xF8F02000 #define XPAR_PS7_PL310_0_S_AXI_HIGHADDR 0xF8F02FFF /* Definitions for peripheral PS7_PMU_0 */ #define XPAR_PS7_PMU_0_S_AXI_BASEADDR 0xF8891000 #define XPAR_PS7_PMU_0_S_AXI_HIGHADDR 0xF8891FFF #define XPAR_PS7_PMU_0_PMU1_S_AXI_BASEADDR 0xF8893000 #define XPAR_PS7_PMU_0_PMU1_S_AXI_HIGHADDR 0xF8893FFF /* Definitions for peripheral PS7_QSPI_LINEAR_0 */ #define XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR 0xFC000000 #define XPAR_PS7_QSPI_LINEAR_0_S_AXI_HIGHADDR 0xFCFFFFFF /* Definitions for peripheral PS7_RAM_0 */ #define XPAR_PS7_RAM_0_S_AXI_BASEADDR 0x00000000 #define XPAR_PS7_RAM_0_S_AXI_HIGHADDR 0x0003FFFF /* Definitions for peripheral PS7_RAM_1 */ #define XPAR_PS7_RAM_1_S_AXI_BASEADDR 0xFFFC0000 #define XPAR_PS7_RAM_1_S_AXI_HIGHADDR 0xFFFFFFFF /* Definitions for peripheral PS7_SCUC_0 */ #define XPAR_PS7_SCUC_0_S_AXI_BASEADDR 0xF8F00000 #define XPAR_PS7_SCUC_0_S_AXI_HIGHADDR 0xF8F000FC /* Definitions for peripheral PS7_SLCR_0 */ #define XPAR_PS7_SLCR_0_S_AXI_BASEADDR 0xF8000000 #define XPAR_PS7_SLCR_0_S_AXI_HIGHADDR 0xF8000FFF /******************************************************************/ /* Definitions for driver GPIOPS */ #define XPAR_XGPIOPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_GPIO_0 */ #define XPAR_PS7_GPIO_0_DEVICE_ID 0 #define XPAR_PS7_GPIO_0_BASEADDR 0xE000A000 #define XPAR_PS7_GPIO_0_HIGHADDR 0xE000AFFF /******************************************************************/ /* Canonical definitions for peripheral PS7_GPIO_0 */ #define XPAR_XGPIOPS_0_DEVICE_ID XPAR_PS7_GPIO_0_DEVICE_ID #define XPAR_XGPIOPS_0_BASEADDR 0xE000A000 #define XPAR_XGPIOPS_0_HIGHADDR 0xE000AFFF /******************************************************************/ /* Definitions for driver QSPIPS */ #define XPAR_XQSPIPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_QSPI_0 */ #define XPAR_PS7_QSPI_0_DEVICE_ID 0 #define XPAR_PS7_QSPI_0_BASEADDR 0xE000D000 #define XPAR_PS7_QSPI_0_HIGHADDR 0xE000DFFF #define XPAR_PS7_QSPI_0_QSPI_CLK_FREQ_HZ 200000000 #define XPAR_PS7_QSPI_0_QSPI_MODE 0 #define XPAR_PS7_QSPI_0_QSPI_BUS_WIDTH 2 /******************************************************************/ /* Canonical definitions for peripheral PS7_QSPI_0 */ #define XPAR_XQSPIPS_0_DEVICE_ID XPAR_PS7_QSPI_0_DEVICE_ID #define XPAR_XQSPIPS_0_BASEADDR 0xE000D000 #define XPAR_XQSPIPS_0_HIGHADDR 0xE000DFFF #define XPAR_XQSPIPS_0_QSPI_CLK_FREQ_HZ 200000000 #define XPAR_XQSPIPS_0_QSPI_MODE 0 #define XPAR_XQSPIPS_0_QSPI_BUS_WIDTH 2 /******************************************************************/ /* Definitions for driver SCUGIC */ #define XPAR_XSCUGIC_NUM_INSTANCES 1U /* Definitions for peripheral PS7_SCUGIC_0 */ #define XPAR_PS7_SCUGIC_0_DEVICE_ID 0U #define XPAR_PS7_SCUGIC_0_BASEADDR 0xF8F00100U #define XPAR_PS7_SCUGIC_0_HIGHADDR 0xF8F001FFU #define XPAR_PS7_SCUGIC_0_DIST_BASEADDR 0xF8F01000U /******************************************************************/ /* Canonical definitions for peripheral PS7_SCUGIC_0 */ #define XPAR_SCUGIC_0_DEVICE_ID 0U #define XPAR_SCUGIC_0_CPU_BASEADDR 0xF8F00100U #define XPAR_SCUGIC_0_CPU_HIGHADDR 0xF8F001FFU #define XPAR_SCUGIC_0_DIST_BASEADDR 0xF8F01000U /******************************************************************/ /* Definitions for driver SCUTIMER */ #define XPAR_XSCUTIMER_NUM_INSTANCES 1 /* Definitions for peripheral PS7_SCUTIMER_0 */ #define XPAR_PS7_SCUTIMER_0_DEVICE_ID 0 #define XPAR_PS7_SCUTIMER_0_BASEADDR 0xF8F00600 #define XPAR_PS7_SCUTIMER_0_HIGHADDR 0xF8F0061F /******************************************************************/ /* Canonical definitions for peripheral PS7_SCUTIMER_0 */ #define XPAR_XSCUTIMER_0_DEVICE_ID XPAR_PS7_SCUTIMER_0_DEVICE_ID #define XPAR_XSCUTIMER_0_BASEADDR 0xF8F00600 #define XPAR_XSCUTIMER_0_HIGHADDR 0xF8F0061F /******************************************************************/ /* Definitions for driver SCUWDT */ #define XPAR_XSCUWDT_NUM_INSTANCES 1 /* Definitions for peripheral PS7_SCUWDT_0 */ #define XPAR_PS7_SCUWDT_0_DEVICE_ID 0 #define XPAR_PS7_SCUWDT_0_BASEADDR 0xF8F00620 #define XPAR_PS7_SCUWDT_0_HIGHADDR 0xF8F006FF /******************************************************************/ /* Canonical definitions for peripheral PS7_SCUWDT_0 */ #define XPAR_SCUWDT_0_DEVICE_ID XPAR_PS7_SCUWDT_0_DEVICE_ID #define XPAR_SCUWDT_0_BASEADDR 0xF8F00620 #define XPAR_SCUWDT_0_HIGHADDR 0xF8F006FF /******************************************************************/ /* Definitions for driver SDPS */ #define XPAR_XSDPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_SD_0 */ #define XPAR_PS7_SD_0_DEVICE_ID 0 #define XPAR_PS7_SD_0_BASEADDR 0xE0100000 #define XPAR_PS7_SD_0_HIGHADDR 0xE0100FFF #define XPAR_PS7_SD_0_SDIO_CLK_FREQ_HZ 50000000 #define XPAR_PS7_SD_0_HAS_CD 1 #define XPAR_PS7_SD_0_HAS_WP 0 #define XPAR_PS7_SD_0_BUS_WIDTH 0 #define XPAR_PS7_SD_0_MIO_BANK 0 #define XPAR_PS7_SD_0_HAS_EMIO 0 /******************************************************************/ #define XPAR_PS7_SD_0_IS_CACHE_COHERENT 0 /* Canonical definitions for peripheral PS7_SD_0 */ #define XPAR_XSDPS_0_DEVICE_ID XPAR_PS7_SD_0_DEVICE_ID #define XPAR_XSDPS_0_BASEADDR 0xE0100000 #define XPAR_XSDPS_0_HIGHADDR 0xE0100FFF #define XPAR_XSDPS_0_SDIO_CLK_FREQ_HZ 50000000 #define XPAR_XSDPS_0_HAS_CD 1 #define XPAR_XSDPS_0_HAS_WP 0 #define XPAR_XSDPS_0_BUS_WIDTH 0 #define XPAR_XSDPS_0_MIO_BANK 0 #define XPAR_XSDPS_0_HAS_EMIO 0 #define XPAR_XSDPS_0_IS_CACHE_COHERENT 0 /******************************************************************/ /* Definitions for driver UARTPS */ #define XPAR_XUARTPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_UART_0 */ #define XPAR_PS7_UART_0_DEVICE_ID 0 #define XPAR_PS7_UART_0_BASEADDR 0xE0000000 #define XPAR_PS7_UART_0_HIGHADDR 0xE0000FFF #define XPAR_PS7_UART_0_UART_CLK_FREQ_HZ 100000000 #define XPAR_PS7_UART_0_HAS_MODEM 0 /******************************************************************/ /* Canonical definitions for peripheral PS7_UART_0 */ #define XPAR_XUARTPS_0_DEVICE_ID XPAR_PS7_UART_0_DEVICE_ID #define XPAR_XUARTPS_0_BASEADDR 0xE0000000 #define XPAR_XUARTPS_0_HIGHADDR 0xE0000FFF #define XPAR_XUARTPS_0_UART_CLK_FREQ_HZ 100000000 #define XPAR_XUARTPS_0_HAS_MODEM 0 /******************************************************************/ /* Definition for input Clock */ /* Definitions for driver USBPS */ #define XPAR_XUSBPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_USB_0 */ #define XPAR_PS7_USB_0_DEVICE_ID 0 #define XPAR_PS7_USB_0_BASEADDR 0xE0002000 #define XPAR_PS7_USB_0_HIGHADDR 0xE0002FFF /******************************************************************/ /* Canonical definitions for peripheral PS7_USB_0 */ #define XPAR_XUSBPS_0_DEVICE_ID XPAR_PS7_USB_0_DEVICE_ID #define XPAR_XUSBPS_0_BASEADDR 0xE0002000 #define XPAR_XUSBPS_0_HIGHADDR 0xE0002FFF /******************************************************************/ /* Definitions for driver XADCPS */ #define XPAR_XADCPS_NUM_INSTANCES 1 /* Definitions for peripheral PS7_XADC_0 */ #define XPAR_PS7_XADC_0_DEVICE_ID 0 #define XPAR_PS7_XADC_0_BASEADDR 0xF8007100 #define XPAR_PS7_XADC_0_HIGHADDR 0xF8007120 /******************************************************************/ /* Canonical definitions for peripheral PS7_XADC_0 */ #define XPAR_XADCPS_0_DEVICE_ID XPAR_PS7_XADC_0_DEVICE_ID #define XPAR_XADCPS_0_BASEADDR 0xF8007100 #define XPAR_XADCPS_0_HIGHADDR 0xF8007120 /******************************************************************/ /* Xilinx FAT File System Library (XilFFs) User Settings */ #define FILE_SYSTEM_INTERFACE_SD #define FILE_SYSTEM_USE_MKFS #define FILE_SYSTEM_NUM_LOGIC_VOL 2 #define FILE_SYSTEM_USE_STRFUNC 0 #define FILE_SYSTEM_SET_FS_RPATH 0 #define FILE_SYSTEM_WORD_ACCESS #endif /* end of protection macro */
[ "42601145+WeiChengHowSwai@users.noreply.github.com" ]
42601145+WeiChengHowSwai@users.noreply.github.com
dc98bebb4600d29746f7985d87ac6e96ab652ea0
4c2ecdfebb4499570fd0c62976b111e39f26626d
/includes/libft.h
f8e35f85b39bfb7e05351700b62f003542b62f34
[]
no_license
NoelleMostert/push_swap
28f6205f81461f4daa075906139f5e43ba7d55e4
6fa833728d87d72d47f005d38814d7daa43f7c64
refs/heads/master
2020-03-27T06:15:16.724503
2018-09-07T07:23:26
2018-09-07T07:23:26
146,092,691
0
0
null
null
null
null
UTF-8
C
false
false
4,535
h
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: nmostert <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/05/30 10:44:33 by nmostert #+# #+# */ /* Updated: 2018/09/04 09:38:53 by nmostert ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_H # define LIBFT_H # include <string.h> # include <stdlib.h> # include <unistd.h> # include "colours.h" # define BUFF_SIZE 1 typedef struct s_list { void *content; size_t content_size; struct s_list *next; } t_list; int ft_isupper(int c); int ft_islower(int c); int ft_toupper(int c); int ft_tolower(int c); int ft_isalpha(int c); int ft_isdigit(int c); int ft_isascii(int c); int ft_isalnum(int c); int ft_isprint(int c); int ft_isspace(int c); int ft_strcmp(const char *s1, const char *s2); int ft_strncmp(const char *s1, const char *s2, size_t n); int ft_atoi(const char *str); int ft_memcmp(const void *s1, const void *s2, size_t n); int ft_strequ(char const *s1, char const *s2); int ft_strnequ(char const *s1, char const *s2, size_t n); int get_next_line(const int fd, char **line); int ft_containscol(char **s, int col, int height, int c); int ft_containsrow(const char *s, int c); void *ft_memcpy(void *dst, const void *src, size_t n); void *ft_memset(void *str, int c, size_t n); void ft_bzero(void *s, size_t n); void *ft_memccpy(void *dst, const void *src, int c, size_t n); void *ft_memchr(const void *s, int c, size_t n); void *ft_memmove(void *dst, const void *src, size_t len); void *ft_memalloc(size_t size); void ft_memdel(void **ap); void ft_strdel(char **as); void ft_strclr(char *s); void ft_striter(char *s, void (*f)(char *)); void ft_striteri(char *s, void (*f)(unsigned int, char *)); void ft_putchar(char c); void ft_putstr(char const *s); void ft_putendl(char const *s); void ft_putnbr(int n); void ft_putchar_fd(char c, int fd); void ft_putnbr_fd(int n, int fd); void ft_putstr_fd(char const *s, int fd); void ft_putstr_clr(char const *clr, char const *str); void ft_putendl_fd(char const *s, int fd); void ft_puttab(char **s); void ft_puttab_fd(char **s, int fd); char *ft_lastdigits(char *str); char *ft_secondword(char *str); char *ft_strdup(const char *s1); char *ft_itoa(int n); char **ft_strsplit(char const *s, char c); char *ft_strtrim(char const *s); char *ft_strjoin(char const *s1, char const *s2); char *ft_strsub(char const *s, unsigned int start, size_t len); char *ft_strmap(char const *s, char (*f)(char)); char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); char *ft_strnew(size_t size); char *ft_strchr(const char *s, int c); char *ft_strrchr(const char *s, int c); char *ft_strcpy(char *dst, const char *src); char *ft_strncpy(char *dst, const char *src, size_t len); char *ft_strnstr(const char *haystack, const char *needle, size_t len); char *ft_strcat(char *s1, const char *s2); char *ft_strncat(char *s1, const char *s2, size_t n); char *ft_strstr(const char *haystack, const char *needle); char *ft_strndup(const char *s1, size_t n); char *ft_strsplit_word(char const *s, char c, size_t num); long ft_atol(const char *str); size_t ft_strlen(const char *s); size_t ft_strlcat(char *dst, const char *src, size_t dstsize); char *ft_strjoin(char const *s1, char const *s2); char *ft_stringput(char *dest, const char *src, int dcount); char *ft_strcopy(char *ret, const char *s, int start, int end); int ft_remspace(const char *str, int c); int ft_wordcount(const char *str, char c); t_list *ft_lstnew(const void *content, size_t content_size); void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)); void ft_lstdel(t_list **alst, void (*del)(void *, size_t)); void ft_lstadd(t_list **alst, t_list *new); void ft_lstiter(t_list *lst, void (*f)(t_list *elem)); #endif
[ "nmostert@e4r20p2.wethinkcode.co.za" ]
nmostert@e4r20p2.wethinkcode.co.za
8cf01e87e837d758a69efce409d35f46b8d1f1e3
4b6513522f6eaed529c9e7cf51dad8bc396c9b1c
/app/libs/fftw-3.3.7/dft/simd/common/t1bv_10.c
90b6a260d2811850e03c1b8c8ab8086465a2f5a2
[ "FSFAP", "GPL-2.0-or-later", "GPL-2.0-only", "MIT" ]
permissive
RickyBobby2nd/DFMTuner
c51fbe5942e6bd1515278c3d239e31774be330d4
e772457dbf75f97bf0dacc809d85ffbd92bbfc4b
refs/heads/master
2020-07-06T06:01:46.749582
2018-05-25T20:33:07
2018-05-25T20:33:07
202,915,304
1
0
MIT
2019-08-17T17:57:28
2019-08-17T17:57:27
null
UTF-8
C
false
false
9,470
c
/* * Copyright (c) 2003, 2007-14 Matteo Frigo * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* This file was automatically generated --- DO NOT EDIT */ /* Generated on Sun Oct 29 08:17:22 EDT 2017 */ #include "dft/codelet-dft.h" #if defined(ARCH_PREFERS_FMA) || defined(ISA_EXTENSION_PREFERS_FMA) /* Generated by: ../../../genfft/gen_twiddle_c.native -fma -simd -compact -variables 4 -pipeline-latency 8 -n 10 -name t1bv_10 -include dft/simd/t1b.h -sign 1 */ /* * This function contains 51 FP additions, 40 FP multiplications, * (or, 33 additions, 22 multiplications, 18 fused multiply/add), * 32 stack variables, 4 constants, and 20 memory accesses */ #include "dft/simd/t1b.h" static void t1bv_10(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms) { DVK(KP559016994, +0.559016994374947424102293417182819058860154590); DVK(KP618033988, +0.618033988749894848204586834365638117720309180); DVK(KP951056516, +0.951056516295153572116439333379382143405698634); DVK(KP250000000, +0.250000000000000000000000000000000000000000000); { INT m; R *x; x = ii; for (m = mb, W = W + (mb * ((TWVL / VL) * 18)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 18), MAKE_VOLATILE_STRIDE(10, rs)) { V T4, TA, Tk, Tp, Tq, TE, TF, TG, T9, Te, Tf, TB, TC, TD, T1; V T3, T2; T1 = LD(&(x[0]), ms, &(x[0])); T2 = LD(&(x[WS(rs, 5)]), ms, &(x[WS(rs, 1)])); T3 = BYTW(&(W[TWVL * 8]), T2); T4 = VSUB(T1, T3); TA = VADD(T1, T3); { V Th, To, Tj, Tm; { V Tg, Tn, Ti, Tl; Tg = LD(&(x[WS(rs, 4)]), ms, &(x[0])); Th = BYTW(&(W[TWVL * 6]), Tg); Tn = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)])); To = BYTW(&(W[0]), Tn); Ti = LD(&(x[WS(rs, 9)]), ms, &(x[WS(rs, 1)])); Tj = BYTW(&(W[TWVL * 16]), Ti); Tl = LD(&(x[WS(rs, 6)]), ms, &(x[0])); Tm = BYTW(&(W[TWVL * 10]), Tl); } Tk = VSUB(Th, Tj); Tp = VSUB(Tm, To); Tq = VADD(Tk, Tp); TE = VADD(Th, Tj); TF = VADD(Tm, To); TG = VADD(TE, TF); } { V T6, Td, T8, Tb; { V T5, Tc, T7, Ta; T5 = LD(&(x[WS(rs, 2)]), ms, &(x[0])); T6 = BYTW(&(W[TWVL * 2]), T5); Tc = LD(&(x[WS(rs, 3)]), ms, &(x[WS(rs, 1)])); Td = BYTW(&(W[TWVL * 4]), Tc); T7 = LD(&(x[WS(rs, 7)]), ms, &(x[WS(rs, 1)])); T8 = BYTW(&(W[TWVL * 12]), T7); Ta = LD(&(x[WS(rs, 8)]), ms, &(x[0])); Tb = BYTW(&(W[TWVL * 14]), Ta); } T9 = VSUB(T6, T8); Te = VSUB(Tb, Td); Tf = VADD(T9, Te); TB = VADD(T6, T8); TC = VADD(Tb, Td); TD = VADD(TB, TC); } { V Tt, Tr, Ts, Tx, Tz, Tv, Tw, Ty, Tu; Tt = VSUB(Tf, Tq); Tr = VADD(Tf, Tq); Ts = VFNMS(LDK(KP250000000), Tr, T4); Tv = VSUB(T9, Te); Tw = VSUB(Tk, Tp); Tx = VMUL(LDK(KP951056516), VFMA(LDK(KP618033988), Tw, Tv)); Tz = VMUL(LDK(KP951056516), VFNMS(LDK(KP618033988), Tv, Tw)); ST(&(x[WS(rs, 5)]), VADD(T4, Tr), ms, &(x[WS(rs, 1)])); Ty = VFNMS(LDK(KP559016994), Tt, Ts); ST(&(x[WS(rs, 3)]), VFMAI(Tz, Ty), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 7)]), VFNMSI(Tz, Ty), ms, &(x[WS(rs, 1)])); Tu = VFMA(LDK(KP559016994), Tt, Ts); ST(&(x[WS(rs, 1)]), VFMAI(Tx, Tu), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 9)]), VFNMSI(Tx, Tu), ms, &(x[WS(rs, 1)])); } { V TJ, TH, TI, TN, TP, TL, TM, TO, TK; TJ = VSUB(TD, TG); TH = VADD(TD, TG); TI = VFNMS(LDK(KP250000000), TH, TA); TL = VSUB(TE, TF); TM = VSUB(TB, TC); TN = VMUL(LDK(KP951056516), VFNMS(LDK(KP618033988), TM, TL)); TP = VMUL(LDK(KP951056516), VFMA(LDK(KP618033988), TL, TM)); ST(&(x[0]), VADD(TA, TH), ms, &(x[0])); TO = VFMA(LDK(KP559016994), TJ, TI); ST(&(x[WS(rs, 4)]), VFNMSI(TP, TO), ms, &(x[0])); ST(&(x[WS(rs, 6)]), VFMAI(TP, TO), ms, &(x[0])); TK = VFNMS(LDK(KP559016994), TJ, TI); ST(&(x[WS(rs, 2)]), VFNMSI(TN, TK), ms, &(x[0])); ST(&(x[WS(rs, 8)]), VFMAI(TN, TK), ms, &(x[0])); } } } VLEAVE(); } static const tw_instr twinstr[] = { VTW(0, 1), VTW(0, 2), VTW(0, 3), VTW(0, 4), VTW(0, 5), VTW(0, 6), VTW(0, 7), VTW(0, 8), VTW(0, 9), {TW_NEXT, VL, 0} }; static const ct_desc desc = { 10, XSIMD_STRING("t1bv_10"), twinstr, &GENUS, {33, 22, 18, 0}, 0, 0, 0 }; void XSIMD(codelet_t1bv_10) (planner *p) { X(kdft_dit_register) (p, t1bv_10, &desc); } #else /* Generated by: ../../../genfft/gen_twiddle_c.native -simd -compact -variables 4 -pipeline-latency 8 -n 10 -name t1bv_10 -include dft/simd/t1b.h -sign 1 */ /* * This function contains 51 FP additions, 30 FP multiplications, * (or, 45 additions, 24 multiplications, 6 fused multiply/add), * 32 stack variables, 4 constants, and 20 memory accesses */ #include "dft/simd/t1b.h" static void t1bv_10(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms) { DVK(KP587785252, +0.587785252292473129168705954639072768597652438); DVK(KP951056516, +0.951056516295153572116439333379382143405698634); DVK(KP250000000, +0.250000000000000000000000000000000000000000000); DVK(KP559016994, +0.559016994374947424102293417182819058860154590); { INT m; R *x; x = ii; for (m = mb, W = W + (mb * ((TWVL / VL) * 18)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 18), MAKE_VOLATILE_STRIDE(10, rs)) { V Tu, TH, Tg, Tl, Tp, TD, TE, TJ, T5, Ta, To, TA, TB, TI, Tr; V Tt, Ts; Tr = LD(&(x[0]), ms, &(x[0])); Ts = LD(&(x[WS(rs, 5)]), ms, &(x[WS(rs, 1)])); Tt = BYTW(&(W[TWVL * 8]), Ts); Tu = VSUB(Tr, Tt); TH = VADD(Tr, Tt); { V Td, Tk, Tf, Ti; { V Tc, Tj, Te, Th; Tc = LD(&(x[WS(rs, 4)]), ms, &(x[0])); Td = BYTW(&(W[TWVL * 6]), Tc); Tj = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)])); Tk = BYTW(&(W[0]), Tj); Te = LD(&(x[WS(rs, 9)]), ms, &(x[WS(rs, 1)])); Tf = BYTW(&(W[TWVL * 16]), Te); Th = LD(&(x[WS(rs, 6)]), ms, &(x[0])); Ti = BYTW(&(W[TWVL * 10]), Th); } Tg = VSUB(Td, Tf); Tl = VSUB(Ti, Tk); Tp = VADD(Tg, Tl); TD = VADD(Td, Tf); TE = VADD(Ti, Tk); TJ = VADD(TD, TE); } { V T2, T9, T4, T7; { V T1, T8, T3, T6; T1 = LD(&(x[WS(rs, 2)]), ms, &(x[0])); T2 = BYTW(&(W[TWVL * 2]), T1); T8 = LD(&(x[WS(rs, 3)]), ms, &(x[WS(rs, 1)])); T9 = BYTW(&(W[TWVL * 4]), T8); T3 = LD(&(x[WS(rs, 7)]), ms, &(x[WS(rs, 1)])); T4 = BYTW(&(W[TWVL * 12]), T3); T6 = LD(&(x[WS(rs, 8)]), ms, &(x[0])); T7 = BYTW(&(W[TWVL * 14]), T6); } T5 = VSUB(T2, T4); Ta = VSUB(T7, T9); To = VADD(T5, Ta); TA = VADD(T2, T4); TB = VADD(T7, T9); TI = VADD(TA, TB); } { V Tq, Tv, Tw, Tn, Tz, Tb, Tm, Ty, Tx; Tq = VMUL(LDK(KP559016994), VSUB(To, Tp)); Tv = VADD(To, Tp); Tw = VFNMS(LDK(KP250000000), Tv, Tu); Tb = VSUB(T5, Ta); Tm = VSUB(Tg, Tl); Tn = VBYI(VFMA(LDK(KP951056516), Tb, VMUL(LDK(KP587785252), Tm))); Tz = VBYI(VFNMS(LDK(KP951056516), Tm, VMUL(LDK(KP587785252), Tb))); ST(&(x[WS(rs, 5)]), VADD(Tu, Tv), ms, &(x[WS(rs, 1)])); Ty = VSUB(Tw, Tq); ST(&(x[WS(rs, 3)]), VSUB(Ty, Tz), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 7)]), VADD(Tz, Ty), ms, &(x[WS(rs, 1)])); Tx = VADD(Tq, Tw); ST(&(x[WS(rs, 1)]), VADD(Tn, Tx), ms, &(x[WS(rs, 1)])); ST(&(x[WS(rs, 9)]), VSUB(Tx, Tn), ms, &(x[WS(rs, 1)])); } { V TM, TK, TL, TG, TP, TC, TF, TO, TN; TM = VMUL(LDK(KP559016994), VSUB(TI, TJ)); TK = VADD(TI, TJ); TL = VFNMS(LDK(KP250000000), TK, TH); TC = VSUB(TA, TB); TF = VSUB(TD, TE); TG = VBYI(VFNMS(LDK(KP951056516), TF, VMUL(LDK(KP587785252), TC))); TP = VBYI(VFMA(LDK(KP951056516), TC, VMUL(LDK(KP587785252), TF))); ST(&(x[0]), VADD(TH, TK), ms, &(x[0])); TO = VADD(TM, TL); ST(&(x[WS(rs, 4)]), VSUB(TO, TP), ms, &(x[0])); ST(&(x[WS(rs, 6)]), VADD(TP, TO), ms, &(x[0])); TN = VSUB(TL, TM); ST(&(x[WS(rs, 2)]), VADD(TG, TN), ms, &(x[0])); ST(&(x[WS(rs, 8)]), VSUB(TN, TG), ms, &(x[0])); } } } VLEAVE(); } static const tw_instr twinstr[] = { VTW(0, 1), VTW(0, 2), VTW(0, 3), VTW(0, 4), VTW(0, 5), VTW(0, 6), VTW(0, 7), VTW(0, 8), VTW(0, 9), {TW_NEXT, VL, 0} }; static const ct_desc desc = { 10, XSIMD_STRING("t1bv_10"), twinstr, &GENUS, {45, 24, 6, 0}, 0, 0, 0 }; void XSIMD(codelet_t1bv_10) (planner *p) { X(kdft_dit_register) (p, t1bv_10, &desc); } #endif
[ "paul.ciarlo@gmail.com" ]
paul.ciarlo@gmail.com
40f526a778460eafa89bfc7fcd64320355d0e848
33303cfbb0b5861667f8d8896b88656bbcbac5ee
/Cell Doxygen.h
ed2ffe8bb0d4defeb07e86335e27105365c52a58
[]
no_license
emiliarazak/Virtual_Zoo
de7df7876c68f64dc79e4eb728687ab543c558eb
b8d3f3c1e9f0c81d217f4fdb204744b3a21da64e
refs/heads/master
2021-06-13T08:23:49.068652
2017-03-16T02:17:48
2017-03-16T02:17:48
null
0
0
null
null
null
null
UTF-8
C
false
false
3,953
h
//Cell.h /** @brief Constructor dari Cell * Menghidupkan cell * * @param I Indices adalah alamat dimana cell dihidupkan * @param Type integer adalah kode dari cell dimana 0=Habitat, 1=Facility * @param Code character adalah suatu huruf untuk merepresentasikan cell di layar. */ /** @brief Destructor dari Cell * Menghilangkan alokasi memori cell */ /** @brief Mengembalikan nilai character render dari objek Cell * Character ini nantinya yang siap di Print ke layar */ /** @brief Mengembalikan nilai Indices dimana cell berada */ /** @brief Mengembalikan nilai boolean apakah cell adalah habitat */ /** @brief Mengembalikan nilai boolean apakah cell adalah fasilitas */ /** @brief Mengembalikan nilai char Code yang adalah atribut cell */ /** @brief Attribut Koordinat yang adalah Indices letak cell */ /** @brief Attribut Type yang adalah type dari Cell */ /** @brief Attribut Code yang adalah code dari Cell */ --- //Habitat.h /** @brief Constructor dari Habitat * Menghidupkan habitat * * @param I Indices adalah alamat dimana habitat dihidupkan * @param type integer adalah kode dari habitat dimana 0=Land, 1=Water, 2=Air * @param code character adalah suatu huruf untuk merepresentasikan habitat di layar. */ /** @brief Mengembalikan nilai boolean apakah habitat adalah land */ /** @brief Mengembalikan nilai boolean apakah habitat adalah water */ /** @brief Mengembalikan nilai boolean apakah habitat adalah air */ /** @brief Attribut Htype yang adalah type dari habitat */ --- //Facility.h /** @brief Constructor dari Fasilitas * Menghidupkan fasilitas * * @param I Indices adalah alamat dimana fasilitas dihidupkan * @param type integer adalah kode dari fasilitas dimana 0=Road, 1=Park, 2=Restaurant * @param code character adalah suatu huruf untuk merepresentasikan fasilitas di layar. */ /** @brief Mengembalikan nilai boolean apakah fasilitas adalah road */ /** @brief Mengembalikan nilai boolean apakah fasilitas adalah park */ /** @brief Mengembalikan nilai boolean apakah fasilitas adalah restaurant */ /** @brief Attribut Ftype yang adalah type dari fasilitas */ --- //AirHabitat.h /** @brief Constructor dari Air Habitat * Menghidupkan habitat udara * * @param I Indices adalah alamat dimana habitat dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Air Habitat * Character ini nantinya yang siap di Print ke layar */ --- //WaterHabitat.h /** @brief Constructor dari Water Habitat * Menghidupkan habitat air * * @param I Indices adalah alamat dimana habitat dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Water Habitat * Character ini nantinya yang siap di Print ke layar */ --- //LandHabitat.h /** @brief Constructor dari Land Habitat * Menghidupkan habitat darat * * @param I Indices adalah alamat dimana habitat dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Land Habitat * Character ini nantinya yang siap di Print ke layar */ --- //Restaurant.h /** @brief Constructor dari Restaurant * Menghidupkan fasilitas restauran * * @param I Indices adalah alamat dimana fasilitas dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Restaurant * Character ini nantinya yang siap di Print ke layar */ --- //Road.h /** @brief Constructor dari Road * Menghidupkan fasilitas jalan * * @param I Indices adalah alamat dimana fasilitas dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Road * Character ini nantinya yang siap di Print ke layar */ --- //Park.h /** @brief Constructor dari Park * Menghidupkan fasilitas taman * * @param I Indices adalah alamat dimana fasilitas dihidupkan */ /** @brief Mengembalikan nilai character kode dari objek Park * Character ini nantinya yang siap di Print ke layar */
[ "noreply@github.com" ]
emiliarazak.noreply@github.com
cc0ccb958867222b641a8bea3ec1fb3c996367c8
8d34fc4bcca2d7bb9f12094dada3179147ea3b43
/mudlib/room/entryroom.c
b33f0fda39951b0b36a644c4aacde792fb77d67f
[]
no_license
Shea690901/fr
20c8adffb1b130f77ef3cd2a73ef60cdef8995d6
16308bd1b17caafba478a16c032bbeb996eb7d42
refs/heads/master
2021-04-28T13:53:23.280635
1998-11-10T20:06:02
1998-11-10T20:06:02
null
0
0
null
null
null
null
UTF-8
C
false
false
2,077
c
inherit "/std/room.c"; void setup() { set_short("FR:Illumitech Entrance"); set_long("You find yourself in a great hall that looks not unlike most "+ "entrances to colleges. Various academic-looking people mill "+ "about here. Most of them have the aspect of someone who doesn't "+ "quite know where to begin or what to do. Thankfully "+ "for you, there is a large sign in front of you that might give "+ "you an idea of what's going on and where to go.\n" + "%^RED%^BOLD%^You may wish to examine the sign.%^RESET%^\n" + "To the west is the meeting-room, and to the east is the post "+ "office.\n\n"); set_light(80); add_item("sign", " +==========================================================+\n" + " | FR:Illumitech -- Dedicated to Mud Instruction and the |\n" + " | Continuing Development of the FR:Mudlib |\n" + " | |\n" + " | New Applicants: |\n" + " | Please enter the Post Office (to the east |\n" + " | of here) and mail Benedick your request |\n" + " | to become a student here. Please include |\n" + " | your Real Name, Email Address, The name |\n" + " | and IP address of the MUD you're normally |\n" + " | on, What you would like to learn (and how |\n" + " | much you might know about coding already) |\n" + " | and lastly how you heard about us. |\n" + " | |\n" + " +==========================================================+\n"); add_item("hall","It's a hall, but your eyes are rather drawn to looking "+ "at the sign.\n"); add_item("people","You see the people are examining the sign.\n"); add_exit("west","/room/meeting","door"); add_exit("east","/room/post","door"); }
[ "quixadhal@gmail.com" ]
quixadhal@gmail.com
dc5885f5e65d56345074b314614591801dccc728
15d9931453afe102b9a2a008d0e8c5345d738027
/pset3/runoff/runoff.c
b6897e2db84b561635e1da82f5305edc734d734d
[]
no_license
lerolynn/CS50
58bcb402b209c80d7948d10094c8d271bd04b73d
9c23c39b1f337ba49647aaeefef5ae1e0b6e2e59
refs/heads/master
2023-04-06T22:29:23.062553
2021-04-18T15:19:17
2021-04-18T15:19:17
204,510,067
0
0
null
null
null
null
UTF-8
C
false
false
5,276
c
#include <cs50.h> #include <stdio.h> #include <string.h> #include <math.h> // Max voters and candidates #define MAX_VOTERS 100 #define MAX_CANDIDATES 9 // preferences[i][j] is jth preference for voter i int preferences[MAX_VOTERS][MAX_CANDIDATES]; // Candidates have name, vote count, eliminated status typedef struct { string name; int votes; bool eliminated; } candidate; // Array of candidates candidate candidates[MAX_CANDIDATES]; // Numbers of voters and candidates int voter_count; int candidate_count; // Function prototypes bool vote(int voter, int rank, string name); void tabulate(void); bool print_winner(void); int find_min(void); bool is_tie(int min); void eliminate(int min); int main(int argc, string argv[]) { // Check for invalid usage if (argc < 2) { printf("Usage: runoff [candidate ...]\n"); return 1; } // Populate array of candidates candidate_count = argc - 1; if (candidate_count > MAX_CANDIDATES) { printf("Maximum number of candidates is %i\n", MAX_CANDIDATES); return 2; } for (int i = 0; i < candidate_count; i++) { candidates[i].name = argv[i + 1]; candidates[i].votes = 0; candidates[i].eliminated = false; } voter_count = get_int("Number of voters: "); if (voter_count > MAX_VOTERS) { printf("Maximum number of voters is %i\n", MAX_VOTERS); return 3; } // Keep querying for votes for (int i = 0; i < voter_count; i++) { // Query for each rank for (int j = 0; j < candidate_count; j++) { string name = get_string("Rank %i: ", j + 1); // Record vote, unless it's invalid if (!vote(i, j, name)) { printf("Invalid vote.\n"); return 4; } } printf("\n"); } // Keep holding runoffs until winner exists while (true) { // Calculate votes given remaining candidates tabulate(); // Check if election has been won bool won = print_winner(); if (won) { break; } // Eliminate last-place candidates int min = find_min(); bool tie = is_tie(min); // If tie, everyone wins if (tie) { for (int i = 0; i < candidate_count; i++) { if (!candidates[i].eliminated) { printf("%s\n", candidates[i].name); } } break; } // Eliminate anyone with minimum number of votes eliminate(min); // Reset vote counts back to zero for (int i = 0; i < candidate_count; i++) { candidates[i].votes = 0; } } return 0; } // Record preference if vote is valid bool vote(int voter, int rank, string name) { // Fill in preferences table for (int i = 0; i < candidate_count; i++) { if (strcmp(name, candidates[i].name) == 0) { preferences[voter][rank] = i; return true; } } return false; } // Tabulate votes for non-eliminated candidates void tabulate(void) { // Loop through preferences table for (int i = 0; i < voter_count; i++) { for (int j = 0; j < candidate_count; j++) { if (!candidates[preferences[i][j]].eliminated) { candidates[preferences[i][j]].votes++; break; } } } return; } // Print the winner of the election, if there is one bool print_winner(void) { // Loop through all candidates and see if any candidate has the required majority for (int i = 0; i < candidate_count; i++) { if (!candidates[i].eliminated) { if (candidates[i].votes > voter_count / 2) { printf("%s\n", candidates[i].name); return true; } } } return false; } // Return the minimum number of votes any remaining candidate has int find_min(void) { int minVotes = 101; for (int i = 0; i < candidate_count; i++) { if (!candidates[i].eliminated) { if (candidates[i].votes <= minVotes) { minVotes = candidates[i].votes; } } } return minVotes; } // Return true if the election is tied between all candidates, false otherwise bool is_tie(int min) { // Count number of candidates with min vote values int minCandidate = 0; int totalCandidate = 0; for (int i = 0; i < candidate_count; i++) { if (!candidates[i].eliminated) { totalCandidate++; if (candidates[i].votes == min) { minCandidate++; } } } if (minCandidate == totalCandidate) { return true; } else { return false; } } // Eliminate the candidate (or candidiates) in last place void eliminate(int min) { for (int i = 0; i < candidate_count; i++) { if (candidates[i].votes == min) { candidates[i].eliminated = true; } } return; }
[ "lerolynn@gmail.com" ]
lerolynn@gmail.com
1ff41d42a2607535befeae9487110b1ed07e733e
8cf708785053605920262a97a7295dc7d93ca4be
/src/vim.h
cbab10190197ad3d5e8e4dc64ff5033d89ae863c
[ "Vim" ]
permissive
aifei7320/vim
572b3d0dc6c04ee231cbc1e309974c1e117fdf06
4cf56bbc85f77846aeb378cfb071677336dfad6d
refs/heads/master
2021-06-28T01:28:52.718247
2017-09-16T13:50:32
2017-09-16T13:50:32
null
0
0
null
null
null
null
UTF-8
C
false
false
83,818
h
/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. */ #ifndef VIM__H # define VIM__H /* use fastcall for Borland, when compiling for Win32 */ #if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG) #if defined(FEAT_PERL) || \ defined(FEAT_PYTHON) || \ defined(FEAT_PYTHON3) || \ defined(FEAT_RUBY) || \ defined(FEAT_TCL) || \ defined(FEAT_MZSCHEME) || \ defined(DYNAMIC_GETTEXT) || \ defined(DYNAMIC_ICONV) || \ defined(DYNAMIC_IME) || \ defined(XPM) #pragma option -pc # else #pragma option -pr # endif #endif #if defined(WIN32) || defined(_WIN64) # include "vimio.h" #endif /* ============ the header file puzzle (ca. 50-100 pieces) ========= */ #ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */ # include "auto/config.h" # define HAVE_PATHDEF /* * Check if configure correctly managed to find sizeof(int). If this failed, * it becomes zero. This is likely a problem of not being able to run the * test program. Other items from configure may also be wrong then! */ # if (VIM_SIZEOF_INT == 0) Error: configure did not run properly. Check auto/config.log. # endif /* * Cygwin may have fchdir() in a newer release, but in most versions it * doesn't work well and avoiding it keeps the binary backward compatible. */ # if defined(__CYGWIN32__) && defined(HAVE_FCHDIR) # undef HAVE_FCHDIR # endif /* We may need to define the uint32_t on non-Unix system, but using the same * identifier causes conflicts. Therefore use UINT32_T. */ # define UINT32_TYPEDEF uint32_t #endif #if !defined(UINT32_TYPEDEF) # if defined(uint32_t) /* this doesn't catch typedefs, unfortunately */ # define UINT32_TYPEDEF uint32_t # else /* Fall back to assuming unsigned int is 32 bit. If this is wrong then the * test in blowfish.c will fail. */ # define UINT32_TYPEDEF unsigned int # endif #endif /* user ID of root is usually zero, but not for everybody */ #ifdef __TANDEM # ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE # endif # include <floss.h> # define ROOT_UID 65535 # define OLDXAW # if (_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 621) # define SA_ONSTACK_COMPATIBILITY # endif #else # define ROOT_UID 0 #endif /* * MACOS_CLASSIC compiling for MacOS prior to MacOS X * MACOS_X_UNIX compiling for MacOS X (using os_unix.c) * MACOS_X compiling for MacOS X (using os_unix.c) * MACOS compiling for either one */ #if defined(macintosh) && !defined(MACOS_CLASSIC) # define MACOS_CLASSIC #endif #if defined(MACOS_X_UNIX) # define MACOS_X # ifndef HAVE_CONFIG_H # define UNIX # endif #endif #if defined(MACOS_X) || defined(MACOS_CLASSIC) # define MACOS #endif #if defined(MACOS_X) && defined(MACOS_CLASSIC) Error: To compile for both MACOS X and Classic use a Classic Carbon #endif /* Unless made through the Makefile enforce GUI on Mac */ #if defined(MACOS) && !defined(HAVE_CONFIG_H) # define FEAT_GUI_MAC #endif #if defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_ATHENA) \ || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_W32) \ || defined(FEAT_GUI_PHOTON) # define FEAT_GUI_ENABLED /* also defined with NO_X11_INCLUDES */ # if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES) # define FEAT_GUI # endif #endif /* Check support for rendering options */ #ifdef FEAT_GUI # if defined(FEAT_DIRECTX) # define FEAT_RENDER_OPTIONS # endif #endif /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ #if _MSC_VER >= 1400 # define _CRT_SECURE_NO_DEPRECATE # define _CRT_NONSTDC_NO_DEPRECATE #endif #if defined(FEAT_GUI_W32) # define FEAT_GUI_MSWIN #endif #if defined(WIN32) || defined(_WIN64) # define MSWIN #endif /* Practically everything is common to both Win32 and Win64 */ #if defined(WIN32) || defined(_WIN64) # define WIN3264 #endif /* * VIM_SIZEOF_INT is used in feature.h, and the system-specific included files * need items from feature.h. Therefore define VIM_SIZEOF_INT here. */ #ifdef WIN3264 # define VIM_SIZEOF_INT 4 #endif #ifdef AMIGA /* Be conservative about sizeof(int). It could be 4 too. */ # ifndef FEAT_GUI_GTK /* avoid problems when generating prototypes */ # ifdef __GNUC__ # define VIM_SIZEOF_INT 4 # else # define VIM_SIZEOF_INT 2 # endif # endif #endif #ifdef MACOS # if defined(__POWERPC__) || defined(MACOS_X) || defined(__fourbyteints__) \ || defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)/* MPW Compilers */ # define VIM_SIZEOF_INT 4 # else # define VIM_SIZEOF_INT 2 # endif #endif /* * #defines for optionals and features * Also defines FEAT_TINY, FEAT_SMALL, etc. when FEAT_HUGE is defined. */ #include "feature.h" #if defined(MACOS_X_UNIX) # if defined(FEAT_SMALL) && !defined(FEAT_CLIPBOARD) # define FEAT_CLIPBOARD # endif # if defined(FEAT_SMALL) && !defined(FEAT_MOUSE) # define FEAT_MOUSE # endif #endif /* +x11 is only enabled when it's both available and wanted. */ #if defined(HAVE_X11) && defined(WANT_X11) # define FEAT_X11 #endif #ifdef NO_X11_INCLUDES /* In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid * X11 headers. Disable all X11 related things to avoid conflicts. */ # ifdef FEAT_X11 # undef FEAT_X11 # endif # ifdef FEAT_GUI_X11 # undef FEAT_GUI_X11 # endif # ifdef FEAT_XCLIPBOARD # undef FEAT_XCLIPBOARD # endif # ifdef FEAT_GUI_MOTIF # undef FEAT_GUI_MOTIF # endif # ifdef FEAT_GUI_ATHENA # undef FEAT_GUI_ATHENA # endif # ifdef FEAT_GUI_GTK # undef FEAT_GUI_GTK # endif # ifdef FEAT_BEVAL_TIP # undef FEAT_BEVAL_TIP # endif # ifdef FEAT_XIM # undef FEAT_XIM # endif # ifdef FEAT_CLIENTSERVER # undef FEAT_CLIENTSERVER # endif #endif /* The Mac conversion stuff doesn't work under X11. */ #if defined(FEAT_MBYTE) && defined(MACOS_X) # define MACOS_CONVERT #endif /* Can't use "PACKAGE" here, conflicts with a Perl include file. */ #ifndef VIMPACKAGE # define VIMPACKAGE "vim" #endif /* * Find out if function definitions should include argument types */ #ifdef AZTEC_C # include <functions.h> #endif #ifdef SASC # include <clib/exec_protos.h> #endif #ifdef _DCC # include <clib/exec_protos.h> #endif #ifdef __BEOS__ # include "os_beos.h" #endif #if (defined(UNIX) || defined(VMS)) \ && (!defined(MACOS_X) || defined(HAVE_CONFIG_H)) # include "os_unix.h" /* bring lots of system header files */ #endif /* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter * can be used to check for mistakes. */ #ifdef HAVE_ATTRIBUTE_UNUSED # define UNUSED __attribute__((unused)) #else # define UNUSED #endif /* Used to check for "sun", "__sun" is used by newer compilers. */ #if defined(__sun) # define SUN_SYSTEM #endif /* if we're compiling in C++ (currently only KVim), the system * headers must have the correct prototypes or nothing will build. * conversely, our prototypes might clash due to throw() specifiers and * cause compilation failures even though the headers are correct. For * a concrete example, gcc-3.2 enforces exception specifications, and * glibc-2.2.5 has them in their system headers. */ #if !defined(__cplusplus) && defined(UNIX) \ && !defined(MACOS_X) /* MACOS_X doesn't yet support osdef.h */ # include "auto/osdef.h" /* bring missing declarations in */ #endif #ifdef AMIGA # include "os_amiga.h" #endif #ifdef WIN3264 # include "os_win32.h" #endif #ifdef __MINT__ # include "os_mint.h" #endif #if defined(MACOS) # if defined(__MRC__) || defined(__SC__) /* MPW Compilers */ # define HAVE_SETENV # endif # include "os_mac.h" #endif #ifdef __QNX__ # include "os_qnx.h" #endif #ifdef FEAT_SUN_WORKSHOP # include "workshop.h" #endif #ifdef X_LOCALE # include <X11/Xlocale.h> #else # ifdef HAVE_LOCALE_H # include <locale.h> # endif #endif /* * Maximum length of a path (for non-unix systems) Make it a bit long, to stay * on the safe side. But not too long to put on the stack. */ #ifndef MAXPATHL # ifdef MAXPATHLEN # define MAXPATHL MAXPATHLEN # else # define MAXPATHL 256 # endif #endif #ifdef BACKSLASH_IN_FILENAME # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<") #else # ifdef VMS /* VMS allows a lot of characters in the file name */ # define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!") # define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&") # else # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") # define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") # endif #endif /* length of a buffer to store a number in ASCII (64 bits binary + NUL) */ #define NUMBUFLEN 65 /* flags for vim_str2nr() */ #define STR2NR_BIN 1 #define STR2NR_OCT 2 #define STR2NR_HEX 4 #define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) #define STR2NR_FORCE 8 /* only when ONE of the above is used */ /* * Shorthand for unsigned variables. Many systems, but not all, have u_char * already defined, so we use char_u to avoid trouble. */ typedef unsigned char char_u; typedef unsigned short short_u; typedef unsigned int int_u; /* Make sure long_u is big enough to hold a pointer. * On Win64, longs are 32 bits and pointers are 64 bits. * For printf() and scanf(), we need to take care of long_u specifically. */ #ifdef _WIN64 typedef unsigned __int64 long_u; typedef __int64 long_i; # define SCANF_HEX_LONG_U "%Ix" # define SCANF_DECIMAL_LONG_U "%Iu" # define PRINTF_HEX_LONG_U "0x%Ix" #else /* Microsoft-specific. The __w64 keyword should be specified on any typedefs * that change size between 32-bit and 64-bit platforms. For any such type, * __w64 should appear only on the 32-bit definition of the typedef. * Define __w64 as an empty token for everything but MSVC 7.x or later. */ # if !defined(_MSC_VER) || (_MSC_VER < 1300) # define __w64 # endif typedef unsigned long __w64 long_u; typedef long __w64 long_i; # define SCANF_HEX_LONG_U "%lx" # define SCANF_DECIMAL_LONG_U "%lu" # define PRINTF_HEX_LONG_U "0x%lx" #endif #define PRINTF_DECIMAL_LONG_U SCANF_DECIMAL_LONG_U /* * Only systems which use configure will have SIZEOF_OFF_T and VIM_SIZEOF_LONG * defined, which is ok since those are the same systems which can have * varying sizes for off_t. The other systems will continue to use "%ld" to * print off_t since off_t is simply a typedef to long for them. */ #if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T > VIM_SIZEOF_LONG) # define LONG_LONG_OFF_T #endif /* * We use 64-bit file functions here, if available. E.g. ftello() returns * off_t instead of long, which helps if long is 32 bit and off_t is 64 bit. * We assume that when fseeko() is available then ftello() is too. * Note that Windows has different function names. */ #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) typedef __int64 off_T; # ifdef __MINGW32__ # define vim_lseek lseek64 # define vim_fseek fseeko64 # define vim_ftell ftello64 # else # define vim_lseek _lseeki64 # define vim_fseek _fseeki64 # define vim_ftell _ftelli64 # endif #else # ifdef PROTO typedef long off_T; # else typedef off_t off_T; # endif # ifdef HAVE_FSEEKO # define vim_lseek lseek # define vim_ftell ftello # define vim_fseek fseeko # else # define vim_lseek lseek # define vim_ftell ftell # define vim_fseek(a, b, c) fseek(a, (long)b, c) # endif #endif /* * The characters and attributes cached for the screen. */ typedef char_u schar_T; typedef unsigned short sattr_T; #define MAX_TYPENR 65535 /* * The u8char_T can hold one decoded UTF-8 character. * We normally use 32 bits now, since some Asian characters don't fit in 16 * bits. u8char_T is only used for displaying, it could be 16 bits to save * memory. */ #ifdef FEAT_MBYTE # ifdef UNICODE16 typedef unsigned short u8char_T; /* short should be 16 bits */ # else # if VIM_SIZEOF_INT >= 4 typedef unsigned int u8char_T; /* int is 32 bits */ # else typedef unsigned long u8char_T; /* long should be 32 bits or more */ # endif # endif #endif #ifndef UNIX /* For Unix this is included in os_unix.h */ # include <stdio.h> # include <ctype.h> #endif #include "ascii.h" #include "keymap.h" #include "term.h" #include "macros.h" #ifdef LATTICE # include <sys/types.h> # include <sys/stat.h> #endif #ifdef _DCC # include <sys/stat.h> #endif #if defined(MSWIN) # include <sys/stat.h> #endif #if defined(HAVE_ERRNO_H) \ || defined(WIN32) || defined(_WIN64) # include <errno.h> #endif /* for INT_MAX et al. */ #include <limits.h> /* * Allow other (non-unix) systems to configure themselves now * These are also in os_unix.h, because osdef.sh needs them there. */ #ifndef UNIX /* Note: Some systems need both string.h and strings.h (Savage). If the * system can't handle this, define NO_STRINGS_WITH_STRING_H. */ # ifdef HAVE_STRING_H # include <string.h> # endif # if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H) # include <strings.h> # endif # ifdef HAVE_STAT_H # include <stat.h> # endif # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif #endif /* NON-UNIX */ #include <assert.h> #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_WCTYPE_H # include <wctype.h> #endif #include <stdarg.h> /* for offsetof() */ #include <stddef.h> #if defined(HAVE_SYS_SELECT_H) && \ (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME)) # include <sys/select.h> #endif #ifndef HAVE_SELECT # ifdef HAVE_SYS_POLL_H # include <sys/poll.h> # elif defined(WIN32) # define HAVE_SELECT # else # ifdef HAVE_POLL_H # include <poll.h> # endif # endif #endif /* ================ end of the header file puzzle =============== */ /* * For dynamically loaded imm library. Currently, only for Win32. */ #ifdef DYNAMIC_IME # ifndef FEAT_MBYTE_IME # define FEAT_MBYTE_IME # endif #endif /* * Check input method control. */ #if defined(FEAT_XIM) \ || (defined(FEAT_GUI) && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \ || (defined(FEAT_GUI_MAC) && defined(FEAT_MBYTE)) # define USE_IM_CONTROL #endif /* * For dynamically loaded gettext library. Currently, only for Win32. */ #ifdef DYNAMIC_GETTEXT # ifndef FEAT_GETTEXT # define FEAT_GETTEXT # endif /* These are in os_win32.c */ extern char *(*dyn_libintl_gettext)(const char *msgid); extern char *(*dyn_libintl_ngettext)(const char *msgid, const char *msgid_plural, unsigned long n); extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *dirname); extern char *(*dyn_libintl_bind_textdomain_codeset)(const char *domainname, const char *codeset); extern char *(*dyn_libintl_textdomain)(const char *domainname); extern int (*dyn_libintl_putenv)(const char *envstring); #endif /* * The _() stuff is for using gettext(). It is a no-op when libintl.h is not * found or the +multilang feature is disabled. */ #ifdef FEAT_GETTEXT # ifdef DYNAMIC_GETTEXT # define _(x) (*dyn_libintl_gettext)((char *)(x)) # define NGETTEXT(x, xs, n) (*dyn_libintl_ngettext)((char *)(x), (char *)(xs), (n)) # define N_(x) x # define bindtextdomain(domain, dir) (*dyn_libintl_bindtextdomain)((domain), (dir)) # define bind_textdomain_codeset(domain, codeset) (*dyn_libintl_bind_textdomain_codeset)((domain), (codeset)) # if !defined(HAVE_BIND_TEXTDOMAIN_CODESET) # define HAVE_BIND_TEXTDOMAIN_CODESET 1 # endif # define textdomain(domain) (*dyn_libintl_textdomain)(domain) # define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring) # define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring) # else # include <libintl.h> # define _(x) gettext((char *)(x)) # define NGETTEXT(x, xs, n) ngettext((x), (xs), (n)) # ifdef gettext_noop # define N_(x) gettext_noop(x) # else # define N_(x) x # endif # endif #else # define _(x) ((char *)(x)) # define NGETTEXT(x, xs, n) (((n) == 1) ? (char *)(x) : (char *)(xs)) # define N_(x) x # ifdef bindtextdomain # undef bindtextdomain # endif # define bindtextdomain(x, y) /* empty */ # ifdef bind_textdomain_codeset # undef bind_textdomain_codeset # endif # define bind_textdomain_codeset(x, y) /* empty */ # ifdef textdomain # undef textdomain # endif # define textdomain(x) /* empty */ #endif /* * flags for update_screen() * The higher the value, the higher the priority */ #define VALID_NO_UPDATE 5 /* no new changes, keep the command line if possible */ #define VALID 10 /* buffer not changed, or changes marked with b_mod_* */ #define INVERTED 20 /* redisplay inverted part that changed */ #define INVERTED_ALL 25 /* redisplay whole inverted part */ #define REDRAW_TOP 30 /* display first w_upd_rows screen lines */ #define SOME_VALID 35 /* like NOT_VALID but may scroll */ #define NOT_VALID 40 /* buffer needs complete redraw */ #define CLEAR 50 /* screen messed up, clear it */ /* * Flags for w_valid. * These are set when something in a window structure becomes invalid, except * when the cursor is moved. Call check_cursor_moved() before testing one of * the flags. * These are reset when that thing has been updated and is valid again. * * Every function that invalidates one of these must call one of the * invalidate_* functions. * * w_valid is supposed to be used only in screen.c. From other files, use the * functions that set or reset the flags. * * VALID_BOTLINE VALID_BOTLINE_AP * on on w_botline valid * off on w_botline approximated * off off w_botline not valid * on off not possible */ #define VALID_WROW 0x01 /* w_wrow (window row) is valid */ #define VALID_WCOL 0x02 /* w_wcol (window col) is valid */ #define VALID_VIRTCOL 0x04 /* w_virtcol (file col) is valid */ #define VALID_CHEIGHT 0x08 /* w_cline_height and w_cline_folded valid */ #define VALID_CROW 0x10 /* w_cline_row is valid */ #define VALID_BOTLINE 0x20 /* w_botine and w_empty_rows are valid */ #define VALID_BOTLINE_AP 0x40 /* w_botine is approximated */ #define VALID_TOPLINE 0x80 /* w_topline is valid (for cursor position) */ /* * Terminal highlighting attribute bits. * Attributes above HL_ALL are used for syntax highlighting. */ #define HL_NORMAL 0x00 #define HL_INVERSE 0x01 #define HL_BOLD 0x02 #define HL_ITALIC 0x04 #define HL_UNDERLINE 0x08 #define HL_UNDERCURL 0x10 #define HL_STANDOUT 0x20 #define HL_NOCOMBINE 0x40 #define HL_STRIKETHROUGH 0x80 #define HL_ALL 0xff /* special attribute addition: Put message in history */ #define MSG_HIST 0x1000 /* * values for State * * The lower bits up to 0x20 are used to distinguish normal/visual/op_pending * and cmdline/insert+replace mode. This is used for mapping. If none of * these bits are set, no mapping is done. * The upper bits are used to distinguish between other states. */ #define NORMAL 0x01 /* Normal mode, command expected */ #define VISUAL 0x02 /* Visual mode - use get_real_state() */ #define OP_PENDING 0x04 /* Normal mode, operator is pending - use get_real_state() */ #define CMDLINE 0x08 /* Editing command line */ #define INSERT 0x10 /* Insert mode */ #define LANGMAP 0x20 /* Language mapping, can be combined with INSERT and CMDLINE */ #define REPLACE_FLAG 0x40 /* Replace mode flag */ #define REPLACE (REPLACE_FLAG + INSERT) #ifdef FEAT_VREPLACE # define VREPLACE_FLAG 0x80 /* Virtual-replace mode flag */ # define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT) #endif #define LREPLACE (REPLACE_FLAG + LANGMAP) #define NORMAL_BUSY (0x100 + NORMAL) /* Normal mode, busy with a command */ #define HITRETURN (0x200 + NORMAL) /* waiting for return or command */ #define ASKMORE 0x300 /* Asking if you want --more-- */ #define SETWSIZE 0x400 /* window size has changed */ #define ABBREV 0x500 /* abbreviation instead of mapping */ #define EXTERNCMD 0x600 /* executing an external command */ #define SHOWMATCH (0x700 + INSERT) /* show matching paren */ #define CONFIRM 0x800 /* ":confirm" prompt */ #define SELECTMODE 0x1000 /* Select mode, only for mappings */ #define TERMINAL 0x2000 /* Terminal mode */ /* all mode bits used for mapping */ #define MAP_ALL_MODES (0x3f | SELECTMODE | TERMINAL) /* directions */ #define FORWARD 1 #define BACKWARD (-1) #define FORWARD_FILE 3 #define BACKWARD_FILE (-3) /* return values for functions */ #if !(defined(OK) && (OK == 1)) /* OK already defined to 1 in MacOS X curses, skip this */ # define OK 1 #endif #define FAIL 0 #define NOTDONE 2 /* not OK or FAIL but skipped */ /* flags for b_flags */ #define BF_RECOVERED 0x01 /* buffer has been recovered */ #define BF_CHECK_RO 0x02 /* need to check readonly when loading file into buffer (set by ":e", may be reset by ":buf" */ #define BF_NEVERLOADED 0x04 /* file has never been loaded into buffer, many variables still need to be set */ #define BF_NOTEDITED 0x08 /* Set when file name is changed after starting to edit, reset when file is written out. */ #define BF_NEW 0x10 /* file didn't exist when editing started */ #define BF_NEW_W 0x20 /* Warned for BF_NEW and file created */ #define BF_READERR 0x40 /* got errors while reading the file */ #define BF_DUMMY 0x80 /* dummy buffer, only used internally */ #define BF_PRESERVED 0x100 /* ":preserve" was used */ /* Mask to check for flags that prevent normal writing */ #define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR) /* * values for xp_context when doing command line completion */ #define EXPAND_UNSUCCESSFUL (-2) #define EXPAND_OK (-1) #define EXPAND_NOTHING 0 #define EXPAND_COMMANDS 1 #define EXPAND_FILES 2 #define EXPAND_DIRECTORIES 3 #define EXPAND_SETTINGS 4 #define EXPAND_BOOL_SETTINGS 5 #define EXPAND_TAGS 6 #define EXPAND_OLD_SETTING 7 #define EXPAND_HELP 8 #define EXPAND_BUFFERS 9 #define EXPAND_EVENTS 10 #define EXPAND_MENUS 11 #define EXPAND_SYNTAX 12 #define EXPAND_HIGHLIGHT 13 #define EXPAND_AUGROUP 14 #define EXPAND_USER_VARS 15 #define EXPAND_MAPPINGS 16 #define EXPAND_TAGS_LISTFILES 17 #define EXPAND_FUNCTIONS 18 #define EXPAND_USER_FUNC 19 #define EXPAND_EXPRESSION 20 #define EXPAND_MENUNAMES 21 #define EXPAND_USER_COMMANDS 22 #define EXPAND_USER_CMD_FLAGS 23 #define EXPAND_USER_NARGS 24 #define EXPAND_USER_COMPLETE 25 #define EXPAND_ENV_VARS 26 #define EXPAND_LANGUAGE 27 #define EXPAND_COLORS 28 #define EXPAND_COMPILER 29 #define EXPAND_USER_DEFINED 30 #define EXPAND_USER_LIST 31 #define EXPAND_SHELLCMD 32 #define EXPAND_CSCOPE 33 #define EXPAND_SIGN 34 #define EXPAND_PROFILE 35 #define EXPAND_BEHAVE 36 #define EXPAND_FILETYPE 37 #define EXPAND_FILES_IN_PATH 38 #define EXPAND_OWNSYNTAX 39 #define EXPAND_LOCALES 40 #define EXPAND_HISTORY 41 #define EXPAND_USER 42 #define EXPAND_SYNTIME 43 #define EXPAND_USER_ADDR_TYPE 44 #define EXPAND_PACKADD 45 #define EXPAND_MESSAGES 46 #define EXPAND_MAPCLEAR 47 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 #define EXMODE_VIM 2 /* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */ #define WILD_FREE 1 #define WILD_EXPAND_FREE 2 #define WILD_EXPAND_KEEP 3 #define WILD_NEXT 4 #define WILD_PREV 5 #define WILD_ALL 6 #define WILD_LONGEST 7 #define WILD_ALL_KEEP 8 #define WILD_LIST_NOTFOUND 0x01 #define WILD_HOME_REPLACE 0x02 #define WILD_USE_NL 0x04 #define WILD_NO_BEEP 0x08 #define WILD_ADD_SLASH 0x10 #define WILD_KEEP_ALL 0x20 #define WILD_SILENT 0x40 #define WILD_ESCAPE 0x80 #define WILD_ICASE 0x100 #define WILD_ALLLINKS 0x200 /* Flags for expand_wildcards() */ #define EW_DIR 0x01 /* include directory names */ #define EW_FILE 0x02 /* include file names */ #define EW_NOTFOUND 0x04 /* include not found names */ #define EW_ADDSLASH 0x08 /* append slash to directory name */ #define EW_KEEPALL 0x10 /* keep all matches */ #define EW_SILENT 0x20 /* don't print "1 returned" from shell */ #define EW_EXEC 0x40 /* executable files */ #define EW_PATH 0x80 /* search in 'path' too */ #define EW_ICASE 0x100 /* ignore case */ #define EW_NOERROR 0x200 /* no error for bad regexp */ #define EW_NOTWILD 0x400 /* add match with literal name if exists */ #define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */ /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND * is used when executing commands and EW_SILENT for interactive expanding. */ #define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */ #define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check * if executable is in $PATH */ #define EW_DODOT 0x4000 /* also files starting with a dot */ #define EW_EMPTYOK 0x8000 /* no matches is not an error */ /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ #define FINDFILE_DIR 1 /* only directories */ #define FINDFILE_BOTH 2 /* files and directories */ #ifdef FEAT_WINDOWS # define W_WINCOL(wp) (wp->w_wincol) # define W_WIDTH(wp) (wp->w_width) # define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) # define W_VSEP_WIDTH(wp) (wp->w_vsep_width) #else # define W_WINCOL(wp) 0 # define W_WIDTH(wp) Columns # define W_ENDCOL(wp) Columns # define W_VSEP_WIDTH(wp) 0 #endif #ifdef FEAT_WINDOWS # define W_STATUS_HEIGHT(wp) (wp->w_status_height) # define W_WINROW(wp) (wp->w_winrow) #else # define W_STATUS_HEIGHT(wp) 0 # define W_WINROW(wp) 0 #endif #ifdef NO_EXPANDPATH # define gen_expand_wildcards mch_expand_wildcards #endif /* Values for the find_pattern_in_path() function args 'type' and 'action': */ #define FIND_ANY 1 #define FIND_DEFINE 2 #define CHECK_PATH 3 #define ACTION_SHOW 1 #define ACTION_GOTO 2 #define ACTION_SPLIT 3 #define ACTION_SHOW_ALL 4 #ifdef FEAT_INS_EXPAND # define ACTION_EXPAND 5 #endif #ifdef FEAT_SYN_HL # define SST_MIN_ENTRIES 150 /* minimal size for state stack array */ # define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ # define SST_FIX_STATES 7 /* size of sst_stack[]. */ # define SST_DIST 16 /* normal distance between entries */ # define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */ # define HL_CONTAINED 0x01 /* not used on toplevel */ # define HL_TRANSP 0x02 /* has no highlighting */ # define HL_ONELINE 0x04 /* match within one line only */ # define HL_HAS_EOL 0x08 /* end pattern that matches with $ */ # define HL_SYNC_HERE 0x10 /* sync point after this item (syncing only) */ # define HL_SYNC_THERE 0x20 /* sync point at current line (syncing only) */ # define HL_MATCH 0x40 /* use match ID instead of item ID */ # define HL_SKIPNL 0x80 /* nextgroup can skip newlines */ # define HL_SKIPWHITE 0x100 /* nextgroup can skip white space */ # define HL_SKIPEMPTY 0x200 /* nextgroup can skip empty lines */ # define HL_KEEPEND 0x400 /* end match always kept */ # define HL_EXCLUDENL 0x800 /* exclude NL from match */ # define HL_DISPLAY 0x1000 /* only used for displaying, not syncing */ # define HL_FOLD 0x2000 /* define fold */ # define HL_EXTEND 0x4000 /* ignore a keepend */ # define HL_MATCHCONT 0x8000 /* match continued from previous line */ # define HL_TRANS_CONT 0x10000 /* transparent item without contains arg */ # define HL_CONCEAL 0x20000 /* can be concealed */ # define HL_CONCEALENDS 0x40000 /* can be concealed */ #endif /* Values for 'options' argument in do_search() and searchit() */ #define SEARCH_REV 0x01 /* go in reverse of previous dir. */ #define SEARCH_ECHO 0x02 /* echo the search command and handle options */ #define SEARCH_MSG 0x0c /* give messages (yes, it's not 0x04) */ #define SEARCH_NFMSG 0x08 /* give all messages except not found */ #define SEARCH_OPT 0x10 /* interpret optional flags */ #define SEARCH_HIS 0x20 /* put search pattern in history */ #define SEARCH_END 0x40 /* put cursor at end of match */ #define SEARCH_NOOF 0x80 /* don't add offset to position */ #define SEARCH_START 0x100 /* start search without col offset */ #define SEARCH_MARK 0x200 /* set previous context mark */ #define SEARCH_KEEP 0x400 /* keep previous search pattern */ #define SEARCH_PEEK 0x800 /* peek for typed char, cancel search */ #define SEARCH_COL 0x1000 /* start at specified column instead of zero */ /* Values for find_ident_under_cursor() */ #define FIND_IDENT 1 /* find identifier (word) */ #define FIND_STRING 2 /* find any string (WORD) */ #define FIND_EVAL 4 /* include "->", "[]" and "." */ /* Values for file_name_in_line() */ #define FNAME_MESS 1 /* give error message */ #define FNAME_EXP 2 /* expand to path */ #define FNAME_HYP 4 /* check for hypertext link */ #define FNAME_INCL 8 /* apply 'includeexpr' */ #define FNAME_REL 16 /* ".." and "./" are relative to the (current) file instead of the current directory */ #define FNAME_UNESC 32 /* remove backslashes used for escaping */ /* Values for buflist_getfile() */ #define GETF_SETMARK 0x01 /* set pcmark before jumping */ #define GETF_ALT 0x02 /* jumping to alternate file (not buf num) */ #define GETF_SWITCH 0x04 /* respect 'switchbuf' settings when jumping */ /* Return values of getfile() */ #define GETFILE_ERROR 1 /* normal error */ #define GETFILE_NOT_WRITTEN 2 /* "not written" error */ #define GETFILE_SAME_FILE 0 /* success, same file */ #define GETFILE_OPEN_OTHER -1 /* success, opened another file */ #define GETFILE_UNUSED 8 #define GETFILE_SUCCESS(x) ((x) <= 0) /* Values for buflist_new() flags */ #define BLN_CURBUF 1 /* may re-use curbuf for new buffer */ #define BLN_LISTED 2 /* put new buffer in buffer list */ #define BLN_DUMMY 4 /* allocating dummy buffer */ #define BLN_NEW 8 /* create a new buffer */ #define BLN_NOOPT 16 /* don't copy options to existing buffer */ #define BLN_DUMMY_OK 32 /* also find an existing dummy buffer */ /* Values for in_cinkeys() */ #define KEY_OPEN_FORW 0x101 #define KEY_OPEN_BACK 0x102 #define KEY_COMPLETE 0x103 /* end of completion */ /* Values for "noremap" argument of ins_typebuf(). Also used for * map->m_noremap and menu->noremap[]. */ #define REMAP_YES 0 /* allow remapping */ #define REMAP_NONE -1 /* no remapping */ #define REMAP_SCRIPT -2 /* remap script-local mappings only */ #define REMAP_SKIP -3 /* no remapping for first char */ /* Values for mch_call_shell() second argument */ #define SHELL_FILTER 1 /* filtering text */ #define SHELL_EXPAND 2 /* expanding wildcards */ #define SHELL_COOKED 4 /* set term to cooked mode */ #define SHELL_DOOUT 8 /* redirecting output */ #define SHELL_SILENT 16 /* don't print error returned by command */ #define SHELL_READ 32 /* read lines and insert into buffer */ #define SHELL_WRITE 64 /* write lines from buffer */ /* Values returned by mch_nodetype() */ #define NODE_NORMAL 0 /* file or directory, check with mch_isdir()*/ #define NODE_WRITABLE 1 /* something we can write to (character device, fifo, socket, ..) */ #define NODE_OTHER 2 /* non-writable thing (e.g., block device) */ /* Values for readfile() flags */ #define READ_NEW 0x01 /* read a file into a new buffer */ #define READ_FILTER 0x02 /* read filter output */ #define READ_STDIN 0x04 /* read from stdin */ #define READ_BUFFER 0x08 /* read from curbuf (converting stdin) */ #define READ_DUMMY 0x10 /* reading into a dummy buffer */ #define READ_KEEP_UNDO 0x20 /* keep undo info */ #define READ_FIFO 0x40 /* read from fifo or socket */ /* Values for change_indent() */ #define INDENT_SET 1 /* set indent */ #define INDENT_INC 2 /* increase indent */ #define INDENT_DEC 3 /* decrease indent */ /* Values for flags argument for findmatchlimit() */ #define FM_BACKWARD 0x01 /* search backwards */ #define FM_FORWARD 0x02 /* search forwards */ #define FM_BLOCKSTOP 0x04 /* stop at start/end of block */ #define FM_SKIPCOMM 0x08 /* skip comments */ /* Values for action argument for do_buffer() */ #define DOBUF_GOTO 0 /* go to specified buffer */ #define DOBUF_SPLIT 1 /* split window and go to specified buffer */ #define DOBUF_UNLOAD 2 /* unload specified buffer(s) */ #define DOBUF_DEL 3 /* delete specified buffer(s) from buflist */ #define DOBUF_WIPE 4 /* delete specified buffer(s) really */ /* Values for start argument for do_buffer() */ #define DOBUF_CURRENT 0 /* "count" buffer from current buffer */ #define DOBUF_FIRST 1 /* "count" buffer from first buffer */ #define DOBUF_LAST 2 /* "count" buffer from last buffer */ #define DOBUF_MOD 3 /* "count" mod. buffer from current buffer */ /* Values for sub_cmd and which_pat argument for search_regcomp() */ /* Also used for which_pat argument for searchit() */ #define RE_SEARCH 0 /* save/use pat in/from search_pattern */ #define RE_SUBST 1 /* save/use pat in/from subst_pattern */ #define RE_BOTH 2 /* save pat in both patterns */ #define RE_LAST 2 /* use last used pattern if "pat" is NULL */ /* Second argument for vim_regcomp(). */ #define RE_MAGIC 1 /* 'magic' option */ #define RE_STRING 2 /* match in string instead of buffer text */ #define RE_STRICT 4 /* don't allow [abc] without ] */ #define RE_AUTO 8 /* automatic engine selection */ #ifdef FEAT_SYN_HL /* values for reg_do_extmatch */ # define REX_SET 1 /* to allow \z\(...\), */ # define REX_USE 2 /* to allow \z\1 et al. */ #endif /* Return values for fullpathcmp() */ /* Note: can use (fullpathcmp() & FPC_SAME) to check for equal files */ #define FPC_SAME 1 /* both exist and are the same file. */ #define FPC_DIFF 2 /* both exist and are different files. */ #define FPC_NOTX 4 /* both don't exist. */ #define FPC_DIFFX 6 /* one of them doesn't exist. */ #define FPC_SAMEX 7 /* both don't exist and file names are same. */ /* flags for do_ecmd() */ #define ECMD_HIDE 0x01 /* don't free the current buffer */ #define ECMD_SET_HELP 0x02 /* set b_help flag of (new) buffer before opening file */ #define ECMD_OLDBUF 0x04 /* use existing buffer if it exists */ #define ECMD_FORCEIT 0x08 /* ! used in Ex command */ #define ECMD_ADDBUF 0x10 /* don't edit, just add to buffer list */ /* for lnum argument in do_ecmd() */ #define ECMD_LASTL (linenr_T)0 /* use last position in loaded file */ #define ECMD_LAST (linenr_T)-1 /* use last position in all files */ #define ECMD_ONE (linenr_T)1 /* use first line */ /* flags for do_cmdline() */ #define DOCMD_VERBOSE 0x01 /* included command in error message */ #define DOCMD_NOWAIT 0x02 /* don't call wait_return() and friends */ #define DOCMD_REPEAT 0x04 /* repeat exec. until getline() returns NULL */ #define DOCMD_KEYTYPED 0x08 /* don't reset KeyTyped */ #define DOCMD_EXCRESET 0x10 /* reset exception environment (for debugging)*/ #define DOCMD_KEEPLINE 0x20 /* keep typed line for repeating with "." */ /* flags for beginline() */ #define BL_WHITE 1 /* cursor on first non-white in the line */ #define BL_SOL 2 /* use 'sol' option */ #define BL_FIX 4 /* don't leave cursor on a NUL */ /* flags for mf_sync() */ #define MFS_ALL 1 /* also sync blocks with negative numbers */ #define MFS_STOP 2 /* stop syncing when a character is available */ #define MFS_FLUSH 4 /* flushed file to disk */ #define MFS_ZERO 8 /* only write block 0 */ /* flags for buf_copy_options() */ #define BCO_ENTER 1 /* going to enter the buffer */ #define BCO_ALWAYS 2 /* always copy the options */ #define BCO_NOHELP 4 /* don't touch the help related options */ /* flags for do_put() */ #define PUT_FIXINDENT 1 /* make indent look nice */ #define PUT_CURSEND 2 /* leave cursor after end of new text */ #define PUT_CURSLINE 4 /* leave cursor on last line of new text */ #define PUT_LINE 8 /* put register as lines */ #define PUT_LINE_SPLIT 16 /* split line for linewise register */ #define PUT_LINE_FORWARD 32 /* put linewise register below Visual sel. */ /* flags for set_indent() */ #define SIN_CHANGED 1 /* call changed_bytes() when line changed */ #define SIN_INSERT 2 /* insert indent before existing text */ #define SIN_UNDO 4 /* save line for undo before changing it */ /* flags for insertchar() */ #define INSCHAR_FORMAT 1 /* force formatting */ #define INSCHAR_DO_COM 2 /* format comments */ #define INSCHAR_CTRLV 4 /* char typed just after CTRL-V */ #define INSCHAR_NO_FEX 8 /* don't use 'formatexpr' */ #define INSCHAR_COM_LIST 16 /* format comments with list/2nd line indent */ /* flags for open_line() */ #define OPENLINE_DELSPACES 1 /* delete spaces after cursor */ #define OPENLINE_DO_COM 2 /* format comments */ #define OPENLINE_KEEPTRAIL 4 /* keep trailing spaces */ #define OPENLINE_MARKFIX 8 /* fix mark positions */ #define OPENLINE_COM_LIST 16 /* format comments with list/2nd line indent */ /* * There are five history tables: */ #define HIST_CMD 0 /* colon commands */ #define HIST_SEARCH 1 /* search commands */ #define HIST_EXPR 2 /* expressions (from entering = register) */ #define HIST_INPUT 3 /* input() lines */ #define HIST_DEBUG 4 /* debug commands */ #define HIST_COUNT 5 /* number of history tables */ /* The type numbers are fixed for backwards compatibility. */ #define BARTYPE_VERSION 1 #define BARTYPE_HISTORY 2 #define BARTYPE_REGISTER 3 #define BARTYPE_MARK 4 #define VIMINFO_VERSION 4 #define VIMINFO_VERSION_WITH_HISTORY 2 #define VIMINFO_VERSION_WITH_REGISTERS 3 #define VIMINFO_VERSION_WITH_MARKS 4 typedef enum { BVAL_NR, BVAL_STRING, BVAL_EMPTY } btype_T; typedef struct { btype_T bv_type; long bv_nr; char_u *bv_string; int bv_len; /* length of bv_string */ int bv_allocated; /* bv_string was allocated */ } bval_T; /* * Values for do_tag(). */ #define DT_TAG 1 /* jump to newer position or same tag again */ #define DT_POP 2 /* jump to older position */ #define DT_NEXT 3 /* jump to next match of same tag */ #define DT_PREV 4 /* jump to previous match of same tag */ #define DT_FIRST 5 /* jump to first match of same tag */ #define DT_LAST 6 /* jump to first match of same tag */ #define DT_SELECT 7 /* jump to selection from list */ #define DT_HELP 8 /* like DT_TAG, but no wildcards */ #define DT_JUMP 9 /* jump to new tag or selection from list */ #define DT_CSCOPE 10 /* cscope find command (like tjump) */ #define DT_LTAG 11 /* tag using location list */ #define DT_FREE 99 /* free cached matches */ /* * flags for find_tags(). */ #define TAG_HELP 1 /* only search for help tags */ #define TAG_NAMES 2 /* only return name of tag */ #define TAG_REGEXP 4 /* use tag pattern as regexp */ #define TAG_NOIC 8 /* don't always ignore case */ #ifdef FEAT_CSCOPE # define TAG_CSCOPE 16 /* cscope tag */ #endif #define TAG_VERBOSE 32 /* message verbosity */ #define TAG_INS_COMP 64 /* Currently doing insert completion */ #define TAG_KEEP_LANG 128 /* keep current language */ #define TAG_MANY 300 /* When finding many tags (for completion), find up to this many tags */ /* * Types of dialogs passed to do_vim_dialog(). */ #define VIM_GENERIC 0 #define VIM_ERROR 1 #define VIM_WARNING 2 #define VIM_INFO 3 #define VIM_QUESTION 4 #define VIM_LAST_TYPE 4 /* sentinel value */ /* * Return values for functions like gui_yesnocancel() */ #define VIM_YES 2 #define VIM_NO 3 #define VIM_CANCEL 4 #define VIM_ALL 5 #define VIM_DISCARDALL 6 /* * arguments for win_split() */ #define WSP_ROOM 1 /* require enough room */ #define WSP_VERT 2 /* split vertically */ #define WSP_TOP 4 /* window at top-left of shell */ #define WSP_BOT 8 /* window at bottom-right of shell */ #define WSP_HELP 16 /* creating the help window */ #define WSP_BELOW 32 /* put new window below/right */ #define WSP_ABOVE 64 /* put new window above/left */ #define WSP_NEWLOC 128 /* don't copy location list */ /* * arguments for gui_set_shellsize() */ #define RESIZE_VERT 1 /* resize vertically */ #define RESIZE_HOR 2 /* resize horizontally */ #define RESIZE_BOTH 15 /* resize in both directions */ /* * flags for check_changed() */ #define CCGD_AW 1 /* do autowrite if buffer was changed */ #define CCGD_MULTWIN 2 /* check also when several wins for the buf */ #define CCGD_FORCEIT 4 /* ! used */ #define CCGD_ALLBUF 8 /* may write all buffers */ #define CCGD_EXCMD 16 /* may suggest using ! */ /* * "flags" values for option-setting functions. * When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global * values, get local value. */ #define OPT_FREE 1 /* free old value if it was allocated */ #define OPT_GLOBAL 2 /* use global value */ #define OPT_LOCAL 4 /* use local value */ #define OPT_MODELINE 8 /* option in modeline */ #define OPT_WINONLY 16 /* only set window-local options */ #define OPT_NOWIN 32 /* don't set window-local options */ /* Magic chars used in confirm dialog strings */ #define DLG_BUTTON_SEP '\n' #define DLG_HOTKEY_CHAR '&' /* Values for "starting" */ #define NO_SCREEN 2 /* no screen updating yet */ #define NO_BUFFERS 1 /* not all buffers loaded yet */ /* 0 not starting anymore */ /* Values for swap_exists_action: what to do when swap file already exists */ #define SEA_NONE 0 /* don't use dialog */ #define SEA_DIALOG 1 /* use dialog when possible */ #define SEA_QUIT 2 /* quit editing the file */ #define SEA_RECOVER 3 /* recover the file */ /* * Minimal size for block 0 of a swap file. * NOTE: This depends on size of struct block0! It's not done with a sizeof(), * because struct block0 is defined in memline.c (Sorry). * The maximal block size is arbitrary. */ #define MIN_SWAP_PAGE_SIZE 1048 #define MAX_SWAP_PAGE_SIZE 50000 /* Special values for current_SID. */ #define SID_MODELINE -1 /* when using a modeline */ #define SID_CMDARG -2 /* for "--cmd" argument */ #define SID_CARG -3 /* for "-c" argument */ #define SID_ENV -4 /* for sourcing environment variable */ #define SID_ERROR -5 /* option was reset because of an error */ #define SID_NONE -6 /* don't set scriptID */ /* * Events for autocommands. */ enum auto_event { EVENT_BUFADD = 0, /* after adding a buffer to the buffer list */ EVENT_BUFNEW, /* after creating any buffer */ EVENT_BUFDELETE, /* deleting a buffer from the buffer list */ EVENT_BUFWIPEOUT, /* just before really deleting a buffer */ EVENT_BUFENTER, /* after entering a buffer */ EVENT_BUFFILEPOST, /* after renaming a buffer */ EVENT_BUFFILEPRE, /* before renaming a buffer */ EVENT_BUFLEAVE, /* before leaving a buffer */ EVENT_BUFNEWFILE, /* when creating a buffer for a new file */ EVENT_BUFREADPOST, /* after reading a buffer */ EVENT_BUFREADPRE, /* before reading a buffer */ EVENT_BUFREADCMD, /* read buffer using command */ EVENT_BUFUNLOAD, /* just before unloading a buffer */ EVENT_BUFHIDDEN, /* just after buffer becomes hidden */ EVENT_BUFWINENTER, /* after showing a buffer in a window */ EVENT_BUFWINLEAVE, /* just after buffer removed from window */ EVENT_BUFWRITEPOST, /* after writing a buffer */ EVENT_BUFWRITEPRE, /* before writing a buffer */ EVENT_BUFWRITECMD, /* write buffer using command */ EVENT_CMDWINENTER, /* after entering the cmdline window */ EVENT_CMDWINLEAVE, /* before leaving the cmdline window */ EVENT_COLORSCHEME, /* after loading a colorscheme */ EVENT_COMPLETEDONE, /* after finishing insert complete */ EVENT_FILEAPPENDPOST, /* after appending to a file */ EVENT_FILEAPPENDPRE, /* before appending to a file */ EVENT_FILEAPPENDCMD, /* append to a file using command */ EVENT_FILECHANGEDSHELL, /* after shell command that changed file */ EVENT_FILECHANGEDSHELLPOST, /* after (not) reloading changed file */ EVENT_FILECHANGEDRO, /* before first change to read-only file */ EVENT_FILEREADPOST, /* after reading a file */ EVENT_FILEREADPRE, /* before reading a file */ EVENT_FILEREADCMD, /* read from a file using command */ EVENT_FILETYPE, /* new file type detected (user defined) */ EVENT_FILEWRITEPOST, /* after writing a file */ EVENT_FILEWRITEPRE, /* before writing a file */ EVENT_FILEWRITECMD, /* write to a file using command */ EVENT_FILTERREADPOST, /* after reading from a filter */ EVENT_FILTERREADPRE, /* before reading from a filter */ EVENT_FILTERWRITEPOST, /* after writing to a filter */ EVENT_FILTERWRITEPRE, /* before writing to a filter */ EVENT_FOCUSGAINED, /* got the focus */ EVENT_FOCUSLOST, /* lost the focus to another app */ EVENT_GUIENTER, /* after starting the GUI */ EVENT_GUIFAILED, /* after starting the GUI failed */ EVENT_INSERTCHANGE, /* when changing Insert/Replace mode */ EVENT_INSERTENTER, /* when entering Insert mode */ EVENT_INSERTLEAVE, /* when leaving Insert mode */ EVENT_MENUPOPUP, /* just before popup menu is displayed */ EVENT_QUICKFIXCMDPOST, /* after :make, :grep etc. */ EVENT_QUICKFIXCMDPRE, /* before :make, :grep etc. */ EVENT_QUITPRE, /* before :quit */ EVENT_SESSIONLOADPOST, /* after loading a session file */ EVENT_STDINREADPOST, /* after reading from stdin */ EVENT_STDINREADPRE, /* before reading from stdin */ EVENT_SYNTAX, /* syntax selected */ EVENT_TERMCHANGED, /* after changing 'term' */ EVENT_TERMRESPONSE, /* after setting "v:termresponse" */ EVENT_USER, /* user defined autocommand */ EVENT_VIMENTER, /* after starting Vim */ EVENT_VIMLEAVE, /* before exiting Vim */ EVENT_VIMLEAVEPRE, /* before exiting Vim and writing .viminfo */ EVENT_VIMRESIZED, /* after Vim window was resized */ EVENT_WINENTER, /* after entering a window */ EVENT_WINLEAVE, /* before leaving a window */ EVENT_WINNEW, /* when entering a new window */ EVENT_ENCODINGCHANGED, /* after changing the 'encoding' option */ EVENT_INSERTCHARPRE, /* before inserting a char */ EVENT_CURSORHOLD, /* cursor in same position for a while */ EVENT_CURSORHOLDI, /* idem, in Insert mode */ EVENT_FUNCUNDEFINED, /* if calling a function which doesn't exist */ EVENT_REMOTEREPLY, /* upon string reception from a remote vim */ EVENT_SWAPEXISTS, /* found existing swap file */ EVENT_SOURCEPRE, /* before sourcing a Vim script */ EVENT_SOURCECMD, /* sourcing a Vim script using command */ EVENT_SPELLFILEMISSING, /* spell file missing */ EVENT_CURSORMOVED, /* cursor was moved */ EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */ EVENT_TABENTER, /* after entering a tab page */ EVENT_TABLEAVE, /* before leaving a tab page */ EVENT_TABNEW, /* when entering a new tab page */ EVENT_TABCLOSED, /* after closing a tab page */ EVENT_SHELLCMDPOST, /* after ":!cmd" */ EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ EVENT_TEXTCHANGED, /* text was modified */ EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/ EVENT_CMDUNDEFINED, /* command undefined */ EVENT_OPTIONSET, /* option was set */ NUM_EVENTS /* MUST be the last one */ }; typedef enum auto_event event_T; /* * Values for index in highlight_attr[]. * When making changes, also update HL_FLAGS below! And update the default * value of 'highlight' in option.c. */ typedef enum { HLF_8 = 0 /* Meta & special keys listed with ":map", text that is displayed different from what it is */ , HLF_EOB /* after the last line in the buffer */ , HLF_AT /* @ characters at end of screen, characters that don't really exist in the text */ , HLF_D /* directories in CTRL-D listing */ , HLF_E /* error messages */ , HLF_H /* obsolete, ignored */ , HLF_I /* incremental search */ , HLF_L /* last search string */ , HLF_M /* "--More--" message */ , HLF_CM /* Mode (e.g., "-- INSERT --") */ , HLF_N /* line number for ":number" and ":#" commands */ , HLF_CLN /* current line number */ , HLF_R /* return to continue message and yes/no questions */ , HLF_S /* status lines */ , HLF_SNC /* status lines of not-current windows */ , HLF_C /* column to separate vertically split windows */ , HLF_T /* Titles for output from ":set all", ":autocmd" etc. */ , HLF_V /* Visual mode */ , HLF_VNC /* Visual mode, autoselecting and not clipboard owner */ , HLF_W /* warning messages */ , HLF_WM /* Wildmenu highlight */ , HLF_FL /* Folded line */ , HLF_FC /* Fold column */ , HLF_ADD /* Added diff line */ , HLF_CHD /* Changed diff line */ , HLF_DED /* Deleted diff line */ , HLF_TXD /* Text Changed in diff line */ , HLF_CONCEAL /* Concealed text */ , HLF_SC /* Sign column */ , HLF_SPB /* SpellBad */ , HLF_SPC /* SpellCap */ , HLF_SPR /* SpellRare */ , HLF_SPL /* SpellLocal */ , HLF_PNI /* popup menu normal item */ , HLF_PSI /* popup menu selected item */ , HLF_PSB /* popup menu scrollbar */ , HLF_PST /* popup menu scrollbar thumb */ , HLF_TP /* tabpage line */ , HLF_TPS /* tabpage line selected */ , HLF_TPF /* tabpage line filler */ , HLF_CUC /* 'cursorcolumn' */ , HLF_CUL /* 'cursorline' */ , HLF_MC /* 'colorcolumn' */ , HLF_QFL /* quickfix window line currently selected */ , HLF_ST /* status lines of terminal windows */ , HLF_STNC /* status lines of not-current terminal windows */ , HLF_COUNT /* MUST be the last one */ } hlf_T; /* The HL_FLAGS must be in the same order as the HLF_ enums! * When changing this also adjust the default for 'highlight'. */ #define HL_FLAGS {'8', '~', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ 'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ 'B', 'P', 'R', 'L', \ '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', \ 'z', 'Z'} /* * Boolean constants */ #ifndef TRUE # define FALSE 0 /* note: this is an int, not a long! */ # define TRUE 1 #endif #define MAYBE 2 /* sometimes used for a variant on TRUE */ #ifndef UINT32_T typedef UINT32_TYPEDEF UINT32_T; #endif /* * Operator IDs; The order must correspond to opchars[] in ops.c! */ #define OP_NOP 0 /* no pending operation */ #define OP_DELETE 1 /* "d" delete operator */ #define OP_YANK 2 /* "y" yank operator */ #define OP_CHANGE 3 /* "c" change operator */ #define OP_LSHIFT 4 /* "<" left shift operator */ #define OP_RSHIFT 5 /* ">" right shift operator */ #define OP_FILTER 6 /* "!" filter operator */ #define OP_TILDE 7 /* "g~" switch case operator */ #define OP_INDENT 8 /* "=" indent operator */ #define OP_FORMAT 9 /* "gq" format operator */ #define OP_COLON 10 /* ":" colon operator */ #define OP_UPPER 11 /* "gU" make upper case operator */ #define OP_LOWER 12 /* "gu" make lower case operator */ #define OP_JOIN 13 /* "J" join operator, only for Visual mode */ #define OP_JOIN_NS 14 /* "gJ" join operator, only for Visual mode */ #define OP_ROT13 15 /* "g?" rot-13 encoding */ #define OP_REPLACE 16 /* "r" replace chars, only for Visual mode */ #define OP_INSERT 17 /* "I" Insert column, only for Visual mode */ #define OP_APPEND 18 /* "A" Append column, only for Visual mode */ #define OP_FOLD 19 /* "zf" define a fold */ #define OP_FOLDOPEN 20 /* "zo" open folds */ #define OP_FOLDOPENREC 21 /* "zO" open folds recursively */ #define OP_FOLDCLOSE 22 /* "zc" close folds */ #define OP_FOLDCLOSEREC 23 /* "zC" close folds recursively */ #define OP_FOLDDEL 24 /* "zd" delete folds */ #define OP_FOLDDELREC 25 /* "zD" delete folds recursively */ #define OP_FORMAT2 26 /* "gw" format operator, keeps cursor pos */ #define OP_FUNCTION 27 /* "g@" call 'operatorfunc' */ #define OP_NR_ADD 28 /* "<C-A>" Add to the number or alphabetic character (OP_ADD conflicts with Perl) */ #define OP_NR_SUB 29 /* "<C-X>" Subtract from the number or alphabetic character */ /* * Motion types, used for operators and for yank/delete registers. */ #define MCHAR 0 /* character-wise movement/register */ #define MLINE 1 /* line-wise movement/register */ #define MBLOCK 2 /* block-wise register */ #define MAUTO 0xff /* Decide between MLINE/MCHAR */ /* * Minimum screen size */ #define MIN_COLUMNS 12 /* minimal columns for screen */ #define MIN_LINES 2 /* minimal lines for screen */ #define STATUS_HEIGHT 1 /* height of a status line under a window */ #define QF_WINHEIGHT 10 /* default height for quickfix window */ /* * Buffer sizes */ #ifndef CMDBUFFSIZE # define CMDBUFFSIZE 256 /* size of the command processing buffer */ #endif #define LSIZE 512 /* max. size of a line in the tags file */ #define IOSIZE (1024+1) /* file i/o and sprintf buffer size */ #define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */ #ifdef FEAT_MBYTE # define MSG_BUF_LEN 480 /* length of buffer for small messages */ # define MSG_BUF_CLEN (MSG_BUF_LEN / 6) /* cell length (worst case: utf-8 takes 6 bytes for one cell) */ #else # define MSG_BUF_LEN 80 /* length of buffer for small messages */ # define MSG_BUF_CLEN MSG_BUF_LEN /* cell length */ #endif #define FOLD_TEXT_LEN 51 /* buffer size for get_foldtext() */ /* Size of the buffer used for tgetent(). Unfortunately this is largely * undocumented, some systems use 1024. Using a buffer that is too small * causes a buffer overrun and a crash. Use the maximum known value to stay * on the safe side. */ #define TBUFSZ 2048 /* buffer size for termcap entry */ /* * Maximum length of key sequence to be mapped. * Must be able to hold an Amiga resize report. */ #define MAXMAPLEN 50 /* Size in bytes of the hash used in the undo file. */ #define UNDO_HASH_SIZE 32 #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #ifdef BINARY_FILE_IO # define WRITEBIN "wb" /* no CR-LF translation */ # define READBIN "rb" # define APPENDBIN "ab" #else # define WRITEBIN "w" # define READBIN "r" # define APPENDBIN "a" #endif /* * EMX doesn't have a global way of making open() use binary I/O. * Use O_BINARY for all open() calls. */ #if defined(__CYGWIN32__) # define O_EXTRA O_BINARY #else # define O_EXTRA 0 #endif #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 #endif #ifndef W_OK # define W_OK 2 /* for systems that don't have W_OK in unistd.h */ #endif #ifndef R_OK # define R_OK 4 /* for systems that don't have R_OK in unistd.h */ #endif /* * defines to avoid typecasts from (char_u *) to (char *) and back * (vim_strchr() and vim_strrchr() are now in alloc.c) */ #define STRLEN(s) strlen((char *)(s)) #define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) #define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) #define STRCMP(d, s) strcmp((char *)(d), (char *)(s)) #define STRNCMP(d, s, n) strncmp((char *)(d), (char *)(s), (size_t)(n)) #ifdef HAVE_STRCASECMP # define STRICMP(d, s) strcasecmp((char *)(d), (char *)(s)) #else # ifdef HAVE_STRICMP # define STRICMP(d, s) stricmp((char *)(d), (char *)(s)) # else # define STRICMP(d, s) vim_stricmp((char *)(d), (char *)(s)) # endif #endif /* Like strcpy() but allows overlapped source and destination. */ #define STRMOVE(d, s) mch_memmove((d), (s), STRLEN(s) + 1) #ifdef HAVE_STRNCASECMP # define STRNICMP(d, s, n) strncasecmp((char *)(d), (char *)(s), (size_t)(n)) #else # ifdef HAVE_STRNICMP # define STRNICMP(d, s, n) strnicmp((char *)(d), (char *)(s), (size_t)(n)) # else # define STRNICMP(d, s, n) vim_strnicmp((char *)(d), (char *)(s), (size_t)(n)) # endif #endif #ifdef FEAT_MBYTE /* We need to call mb_stricmp() even when we aren't dealing with a multi-byte * encoding because mb_stricmp() takes care of all ascii and non-ascii * encodings, including characters with umlauts in latin1, etc., while * STRICMP() only handles the system locale version, which often does not * handle non-ascii properly. */ # define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) # define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) #else # define MB_STRICMP(d, s) STRICMP((d), (s)) # define MB_STRNICMP(d, s, n) STRNICMP((d), (s), (n)) #endif #define STRCAT(d, s) strcat((char *)(d), (char *)(s)) #define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n)) #ifdef HAVE_STRPBRK # define vim_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs)) #endif #define MSG(s) msg((char_u *)(s)) #define MSG_ATTR(s, attr) msg_attr((char_u *)(s), (attr)) #define EMSG(s) emsg((char_u *)(s)) #define EMSG2(s, p) emsg2((char_u *)(s), (char_u *)(p)) #define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q)) #define EMSGN(s, n) emsgn((char_u *)(s), (long)(n)) #define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n)) #define IEMSG(s) iemsg((char_u *)(s)) #define IEMSG2(s, p) iemsg2((char_u *)(s), (char_u *)(p)) #define IEMSGN(s, n) iemsgn((char_u *)(s), (long)(n)) #define OUT_STR(s) out_str((char_u *)(s)) #define OUT_STR_NF(s) out_str_nf((char_u *)(s)) #define MSG_PUTS(s) msg_puts((char_u *)(s)) #define MSG_PUTS_ATTR(s, a) msg_puts_attr((char_u *)(s), (a)) #define MSG_PUTS_TITLE(s) msg_puts_title((char_u *)(s)) #define MSG_PUTS_LONG(s) msg_puts_long_attr((char_u *)(s), 0) #define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a)) #ifdef FEAT_GUI # ifdef FEAT_TERMGUICOLORS # define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termgui_##f) # define GUI_FUNCTION2(f, pixel) (gui.in_use \ ? ((pixel) != INVALCOLOR \ ? gui_##f((pixel)) \ : INVALCOLOR) \ : termgui_##f((pixel))) # define USE_24BIT (gui.in_use || p_tgc) # else # define GUI_FUNCTION(f) gui_##f # define GUI_FUNCTION2(f,pixel) ((pixel) != INVALCOLOR \ ? gui_##f((pixel)) \ : INVALCOLOR) # define USE_24BIT gui.in_use # endif #else # ifdef FEAT_TERMGUICOLORS # define GUI_FUNCTION(f) termgui_##f # define GUI_FUNCTION2(f, pixel) termgui_##f((pixel)) # define USE_24BIT p_tgc # endif #endif #ifdef FEAT_TERMGUICOLORS # define IS_CTERM (t_colors > 1 || p_tgc) #else # define IS_CTERM (t_colors > 1) #endif #ifdef GUI_FUNCTION # define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb) # define GUI_MCH_GET_RGB2(pixel) GUI_FUNCTION2(mch_get_rgb, (pixel)) # define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color) # define GUI_GET_COLOR GUI_FUNCTION(get_color) #endif /* Prefer using emsg3(), because perror() may send the output to the wrong * destination and mess up the screen. */ #ifdef HAVE_STRERROR # define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno)) #else # define PERROR(msg) do_perror(msg) #endif typedef long linenr_T; /* line number type */ typedef int colnr_T; /* column number type */ typedef unsigned short disptick_T; /* display tick type */ #define MAXLNUM (0x7fffffffL) /* maximum (invalid) line number */ /* * Well, you won't believe it, but some S/390 machines ("host", now also known * as zServer) use 31 bit pointers. There are also some newer machines, that * use 64 bit pointers. I don't know how to distinguish between 31 and 64 bit * machines, so the best way is to assume 31 bits whenever we detect OS/390 * Unix. * With this we restrict the maximum line length to 1073741823. I guess this is * not a real problem. BTW: Longer lines are split. */ #if VIM_SIZEOF_INT >= 4 # ifdef __MVS__ # define MAXCOL (0x3fffffffL) /* maximum column number, 30 bits */ # else # define MAXCOL (0x7fffffffL) /* maximum column number, 31 bits */ # endif #else # define MAXCOL (0x7fff) /* maximum column number, 15 bits */ #endif #define SHOWCMD_COLS 10 /* columns needed by shown command */ #define STL_MAX_ITEM 80 /* max nr of %<flag> in statusline */ typedef void *vim_acl_T; /* dummy to pass an ACL to a function */ #ifndef mch_memmove # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (size_t)(len)) #endif /* * fnamecmp() is used to compare file names. * On some systems case in a file name does not matter, on others it does. * (this does not account for maximum name lengths and things like "../dir", * thus it is not 100% accurate!) */ #define fnamecmp(x, y) vim_fnamecmp((char_u *)(x), (char_u *)(y)) #define fnamencmp(x, y, n) vim_fnamencmp((char_u *)(x), (char_u *)(y), (size_t)(n)) #ifdef HAVE_MEMSET # define vim_memset(ptr, c, size) memset((ptr), (c), (size)) #else void *vim_memset(void *, int, size_t); #endif #if defined(UNIX) || defined(FEAT_GUI) || defined(VMS) \ || defined(FEAT_CLIENTSERVER) # define USE_INPUT_BUF #endif #ifndef EINTR # define read_eintr(fd, buf, count) vim_read((fd), (buf), (count)) # define write_eintr(fd, buf, count) vim_write((fd), (buf), (count)) #endif #ifdef MSWIN /* On MS-Windows the third argument isn't size_t. This matters for Win64, * where sizeof(size_t)==8, not 4 */ # define vim_read(fd, buf, count) read((fd), (char *)(buf), (unsigned int)(count)) # define vim_write(fd, buf, count) write((fd), (char *)(buf), (unsigned int)(count)) #else # define vim_read(fd, buf, count) read((fd), (char *)(buf), (size_t) (count)) # define vim_write(fd, buf, count) write((fd), (char *)(buf), (size_t) (count)) #endif /* * Enums need a typecast to be used as array index (for Ultrix). */ #define HL_ATTR(n) highlight_attr[(int)(n)] #define TERM_STR(n) term_strings[(int)(n)] /* * EXTERN is only defined in main.c. That's where global variables are * actually defined and initialized. */ #ifndef EXTERN # define EXTERN extern # define INIT(x) #else # ifndef INIT # define INIT(x) x # define DO_INIT # define COMMA , # endif #endif #ifdef FEAT_MBYTE # define MAX_MCO 6 /* maximum value for 'maxcombine' */ /* Maximum number of bytes in a multi-byte character. It can be one 32-bit * character of up to 6 bytes, or one 16-bit character of up to three bytes * plus six following composing characters of three bytes each. */ # define MB_MAXBYTES 21 #else # define MB_MAXBYTES 1 #endif #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) # ifdef WIN3264 typedef LARGE_INTEGER proftime_T; # else typedef struct timeval proftime_T; # endif #else typedef int proftime_T; /* dummy for function prototypes */ #endif /* * When compiling with 32 bit Perl time_t is 32 bits in the Perl code but 64 * bits elsewhere. That causes memory corruption. Define time_T and use it * for global variables to avoid that. */ #ifdef PROTO typedef long time_T; #else # ifdef WIN3264 typedef __time64_t time_T; # else typedef time_t time_T; # endif #endif #ifdef _WIN64 typedef __int64 sock_T; #else typedef int sock_T; #endif /* Include option.h before structs.h, because the number of window-local and * buffer-local options is used there. */ #include "option.h" /* options and default values */ /* Note that gui.h is included by structs.h */ #include "structs.h" /* file that defines many structures */ #include "alloc.h" /* Values for "do_profiling". */ #define PROF_NONE 0 /* profiling not started */ #define PROF_YES 1 /* profiling busy */ #define PROF_PAUSED 2 /* profiling paused */ #ifdef FEAT_MOUSE /* Codes for mouse button events in lower three bits: */ # define MOUSE_LEFT 0x00 # define MOUSE_MIDDLE 0x01 # define MOUSE_RIGHT 0x02 # define MOUSE_RELEASE 0x03 /* bit masks for modifiers: */ # define MOUSE_SHIFT 0x04 # define MOUSE_ALT 0x08 # define MOUSE_CTRL 0x10 /* mouse buttons that are handled like a key press (GUI only) */ /* Note that the scroll wheel keys are inverted: MOUSE_5 scrolls lines up but * the result of this is that the window moves down, similarly MOUSE_6 scrolls * columns left but the window moves right. */ # define MOUSE_4 0x100 /* scroll wheel down */ # define MOUSE_5 0x200 /* scroll wheel up */ # define MOUSE_X1 0x300 /* Mouse-button X1 (6th) */ # define MOUSE_X2 0x400 /* Mouse-button X2 */ # define MOUSE_6 0x500 /* scroll wheel left */ # define MOUSE_7 0x600 /* scroll wheel right */ /* 0x20 is reserved by xterm */ # define MOUSE_DRAG_XTERM 0x40 # define MOUSE_DRAG (0x40 | MOUSE_RELEASE) /* Lowest button code for using the mouse wheel (xterm only) */ # define MOUSEWHEEL_LOW 0x60 # define MOUSE_CLICK_MASK 0x03 # define NUM_MOUSE_CLICKS(code) \ (((unsigned)((code) & 0xC0) >> 6) + 1) # define SET_NUM_MOUSE_CLICKS(code, num) \ (code) = ((code) & 0x3f) | ((((num) - 1) & 3) << 6) /* Added to mouse column for GUI when 'mousefocus' wants to give focus to a * window by simulating a click on its status line. We could use up to 128 * * 128 = 16384 columns, now it's reduced to 10000. */ # define MOUSE_COLOFF 10000 /* * jump_to_mouse() returns one of first four these values, possibly with * some of the other three added. */ # define IN_UNKNOWN 0 # define IN_BUFFER 1 # define IN_STATUS_LINE 2 /* on status or command line */ # define IN_SEP_LINE 4 /* on vertical separator line */ # define IN_OTHER_WIN 8 /* in other window but can't go there */ # define CURSOR_MOVED 0x100 # define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */ # define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */ /* flags for jump_to_mouse() */ # define MOUSE_FOCUS 0x01 /* need to stay in this window */ # define MOUSE_MAY_VIS 0x02 /* may start Visual mode */ # define MOUSE_DID_MOVE 0x04 /* only act when mouse has moved */ # define MOUSE_SETPOS 0x08 /* only set current mouse position */ # define MOUSE_MAY_STOP_VIS 0x10 /* may stop Visual mode */ # define MOUSE_RELEASED 0x20 /* button was released */ # if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) # define CHECK_DOUBLE_CLICK 1 /* Checking for double clicks ourselves. */ # endif #endif /* FEAT_MOUSE */ /* defines for eval_vars() */ #define VALID_PATH 1 #define VALID_HEAD 2 /* Defines for Vim variables. These must match vimvars[] in eval.c! */ #define VV_COUNT 0 #define VV_COUNT1 1 #define VV_PREVCOUNT 2 #define VV_ERRMSG 3 #define VV_WARNINGMSG 4 #define VV_STATUSMSG 5 #define VV_SHELL_ERROR 6 #define VV_THIS_SESSION 7 #define VV_VERSION 8 #define VV_LNUM 9 #define VV_TERMRESPONSE 10 #define VV_FNAME 11 #define VV_LANG 12 #define VV_LC_TIME 13 #define VV_CTYPE 14 #define VV_CC_FROM 15 #define VV_CC_TO 16 #define VV_FNAME_IN 17 #define VV_FNAME_OUT 18 #define VV_FNAME_NEW 19 #define VV_FNAME_DIFF 20 #define VV_CMDARG 21 #define VV_FOLDSTART 22 #define VV_FOLDEND 23 #define VV_FOLDDASHES 24 #define VV_FOLDLEVEL 25 #define VV_PROGNAME 26 #define VV_SEND_SERVER 27 #define VV_DYING 28 #define VV_EXCEPTION 29 #define VV_THROWPOINT 30 #define VV_REG 31 #define VV_CMDBANG 32 #define VV_INSERTMODE 33 #define VV_VAL 34 #define VV_KEY 35 #define VV_PROFILING 36 #define VV_FCS_REASON 37 #define VV_FCS_CHOICE 38 #define VV_BEVAL_BUFNR 39 #define VV_BEVAL_WINNR 40 #define VV_BEVAL_WINID 41 #define VV_BEVAL_LNUM 42 #define VV_BEVAL_COL 43 #define VV_BEVAL_TEXT 44 #define VV_SCROLLSTART 45 #define VV_SWAPNAME 46 #define VV_SWAPCHOICE 47 #define VV_SWAPCOMMAND 48 #define VV_CHAR 49 #define VV_MOUSE_WIN 50 #define VV_MOUSE_WINID 51 #define VV_MOUSE_LNUM 52 #define VV_MOUSE_COL 53 #define VV_OP 54 #define VV_SEARCHFORWARD 55 #define VV_HLSEARCH 56 #define VV_OLDFILES 57 #define VV_WINDOWID 58 #define VV_PROGPATH 59 #define VV_COMPLETED_ITEM 60 #define VV_OPTION_NEW 61 #define VV_OPTION_OLD 62 #define VV_OPTION_TYPE 63 #define VV_ERRORS 64 #define VV_FALSE 65 #define VV_TRUE 66 #define VV_NULL 67 #define VV_NONE 68 #define VV_VIM_DID_ENTER 69 #define VV_TESTING 70 #define VV_TYPE_NUMBER 71 #define VV_TYPE_STRING 72 #define VV_TYPE_FUNC 73 #define VV_TYPE_LIST 74 #define VV_TYPE_DICT 75 #define VV_TYPE_FLOAT 76 #define VV_TYPE_BOOL 77 #define VV_TYPE_NONE 78 #define VV_TYPE_JOB 79 #define VV_TYPE_CHANNEL 80 #define VV_TERMRGBRESP 81 #define VV_TERMU7RESP 82 #define VV_TERMSTYLERESP 83 #define VV_TERMBLINKRESP 84 #define VV_LEN 85 /* number of v: vars */ /* used for v_number in VAR_SPECIAL */ #define VVAL_FALSE 0L #define VVAL_TRUE 1L #define VVAL_NONE 2L #define VVAL_NULL 3L /* Type values for type(). */ #define VAR_TYPE_NUMBER 0 #define VAR_TYPE_STRING 1 #define VAR_TYPE_FUNC 2 #define VAR_TYPE_LIST 3 #define VAR_TYPE_DICT 4 #define VAR_TYPE_FLOAT 5 #define VAR_TYPE_BOOL 6 #define VAR_TYPE_NONE 7 #define VAR_TYPE_JOB 8 #define VAR_TYPE_CHANNEL 9 #ifdef FEAT_CLIPBOARD /* VIM_ATOM_NAME is the older Vim-specific selection type for X11. Still * supported for when a mix of Vim versions is used. VIMENC_ATOM_NAME includes * the encoding to support Vims using different 'encoding' values. */ # define VIM_ATOM_NAME "_VIM_TEXT" # define VIMENC_ATOM_NAME "_VIMENC_TEXT" /* Selection states for modeless selection */ # define SELECT_CLEARED 0 # define SELECT_IN_PROGRESS 1 # define SELECT_DONE 2 # define SELECT_MODE_CHAR 0 # define SELECT_MODE_WORD 1 # define SELECT_MODE_LINE 2 # ifdef FEAT_GUI_W32 # ifdef FEAT_OLE # define WM_OLE (WM_APP+0) # endif # endif /* Info about selected text */ typedef struct VimClipboard { int available; /* Is clipboard available? */ int owned; /* Flag: do we own the selection? */ pos_T start; /* Start of selected area */ pos_T end; /* End of selected area */ int vmode; /* Visual mode character */ /* Fields for selection that doesn't use Visual mode */ short_u origin_row; short_u origin_start_col; short_u origin_end_col; short_u word_start_col; short_u word_end_col; pos_T prev; /* Previous position */ short_u state; /* Current selection state */ short_u mode; /* Select by char, word, or line. */ # if defined(FEAT_GUI_X11) || defined(FEAT_XCLIPBOARD) Atom sel_atom; /* PRIMARY/CLIPBOARD selection ID */ # endif # ifdef FEAT_GUI_GTK GdkAtom gtk_sel_atom; /* PRIMARY/CLIPBOARD selection ID */ # endif # if defined(MSWIN) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) int_u format; /* Vim's own special clipboard format */ int_u format_raw; /* Vim's raw text clipboard format */ # endif } VimClipboard; #else typedef int VimClipboard; /* This is required for the prototypes. */ #endif /* Use 64-bit stat structure if available. */ #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) # define HAVE_STAT64 typedef struct _stat64 stat_T; #else typedef struct stat stat_T; #endif typedef enum { ASSERT_EQUAL, ASSERT_NOTEQUAL, ASSERT_MATCH, ASSERT_NOTMATCH, ASSERT_OTHER } assert_type_T; /* Mode for bracketed_paste(). */ typedef enum { PASTE_INSERT, /* insert mode */ PASTE_CMDLINE, /* command line */ PASTE_EX, /* ex mode line */ PASTE_ONE_CHAR /* return first character */ } paste_mode_T; #include "ex_cmds.h" /* Ex command defines */ #include "spell.h" /* spell checking stuff */ #include "proto.h" /* function prototypes */ /* This has to go after the include of proto.h, as proto/gui.pro declares * functions of these names. The declarations would break if the defines had * been seen at that stage. But it must be before globals.h, where error_ga * is declared. */ #if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \ && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO) # define mch_errmsg(str) fprintf(stderr, "%s", (str)) # define display_errors() fflush(stderr) # define mch_msg(str) printf("%s", (str)) #else # define USE_MCH_ERRMSG #endif #ifndef FEAT_MBYTE # define after_pathsep(b, p) vim_ispathsep(*((p) - 1)) # define transchar_byte(c) transchar(c) #endif #ifndef FEAT_LINEBREAK /* Without the 'numberwidth' option line numbers are always 7 chars. */ # define number_width(x) 7 #endif /* This must come after including proto.h */ #if !(defined(FEAT_MBYTE) && defined(WIN3264)) # define mch_open(n, m, p) open((n), (m), (p)) # define mch_fopen(n, p) fopen((n), (p)) #endif #include "globals.h" /* global variables and messages */ #ifndef FEAT_VIRTUALEDIT # define getvvcol(w, p, s, c, e) getvcol((w), (p), (s), (c), (e)) # define virtual_active() FALSE # define virtual_op FALSE #endif /* * If console dialog not supported, but GUI dialog is, use the GUI one. */ #if defined(FEAT_GUI_DIALOG) && !defined(FEAT_CON_DIALOG) # define do_dialog gui_mch_dialog #endif /* * Default filters for gui_mch_browse(). * The filters are almost system independent. Except for the difference * between "*" and "*.*" for MSDOS-like systems. * NOTE: Motif only uses the very first pattern. Therefore * BROWSE_FILTER_DEFAULT should start with a "*" pattern. */ #ifdef FEAT_BROWSE # ifdef BACKSLASH_IN_FILENAME # define BROWSE_FILTER_MACROS \ (char_u *)"Vim macro files (*.vim)\t*.vim\nAll Files (*.*)\t*.*\n" # define BROWSE_FILTER_ALL_FILES (char_u *)"All Files (*.*)\t*.*\n" # define BROWSE_FILTER_DEFAULT \ (char_u *)"All Files (*.*)\t*.*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVB code (*.bas, *.frm)\t*.bas;*.frm\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" # else # define BROWSE_FILTER_MACROS \ (char_u *)"Vim macro files (*.vim)\t*.vim\nAll Files (*)\t*\n" # define BROWSE_FILTER_ALL_FILES (char_u *)"All Files (*)\t*\n" # define BROWSE_FILTER_DEFAULT \ (char_u *)"All Files (*)\t*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVim files (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" # endif # define BROWSE_SAVE 1 /* flag for do_browse() */ # define BROWSE_DIR 2 /* flag for do_browse() */ #endif /* stop using fastcall for Borland */ #if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG) #pragma option -p. #endif #ifdef _MSC_VER /* Avoid useless warning "conversion from X to Y of greater size". */ #pragma warning(disable : 4312) /* Avoid warning for old style function declarators */ #pragma warning(disable : 4131) /* Avoid warning for conversion to type with smaller range */ #pragma warning(disable : 4244) /* Avoid warning for conversion to larger size */ #pragma warning(disable : 4306) /* Avoid warning for unreferenced formal parameter */ #pragma warning(disable : 4100) /* Avoid warning for differs in indirection to slightly different base type */ #pragma warning(disable : 4057) /* Avoid warning for constant conditional expression */ #pragma warning(disable : 4127) /* Avoid warning for assignment within conditional */ #pragma warning(disable : 4706) #endif /* Note: a NULL argument for vim_realloc() is not portable, don't use it. */ #if defined(MEM_PROFILE) # define vim_realloc(ptr, size) mem_realloc((ptr), (size)) #else # define vim_realloc(ptr, size) realloc((ptr), (size)) #endif /* * The following macros stop display/event loop nesting at the wrong time. */ #ifdef ALT_X_INPUT # define ALT_INPUT_LOCK_OFF suppress_alternate_input = FALSE # define ALT_INPUT_LOCK_ON suppress_alternate_input = TRUE #endif #ifdef FEAT_MBYTE /* * Return byte length of character that starts with byte "b". * Returns 1 for a single-byte character. * MB_BYTE2LEN_CHECK() can be used to count a special key as one byte. * Don't call MB_BYTE2LEN(b) with b < 0 or b > 255! */ # define MB_BYTE2LEN(b) mb_bytelen_tab[b] # define MB_BYTE2LEN_CHECK(b) (((b) < 0 || (b) > 255) ? 1 : mb_bytelen_tab[b]) #endif #if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) /* properties used in enc_canon_table[] (first three mutually exclusive) */ # define ENC_8BIT 0x01 # define ENC_DBCS 0x02 # define ENC_UNICODE 0x04 # define ENC_ENDIAN_B 0x10 /* Unicode: Big endian */ # define ENC_ENDIAN_L 0x20 /* Unicode: Little endian */ # define ENC_2BYTE 0x40 /* Unicode: UCS-2 */ # define ENC_4BYTE 0x80 /* Unicode: UCS-4 */ # define ENC_2WORD 0x100 /* Unicode: UTF-16 */ # define ENC_LATIN1 0x200 /* Latin1 */ # define ENC_LATIN9 0x400 /* Latin9 */ # define ENC_MACROMAN 0x800 /* Mac Roman (not Macro Man! :-) */ #endif #ifdef FEAT_MBYTE # ifdef USE_ICONV # ifndef EILSEQ # define EILSEQ 123 # endif # ifdef DYNAMIC_ICONV /* On Win32 iconv.dll is dynamically loaded. */ # define ICONV_ERRNO (*iconv_errno()) # define ICONV_E2BIG 7 # define ICONV_EINVAL 22 # define ICONV_EILSEQ 42 # else # define ICONV_ERRNO errno # define ICONV_E2BIG E2BIG # define ICONV_EINVAL EINVAL # define ICONV_EILSEQ EILSEQ # endif # endif #endif /* ISSYMLINK(mode) tests if a file is a symbolic link. */ #if (defined(S_IFMT) && defined(S_IFLNK)) || defined(S_ISLNK) # define HAVE_ISSYMLINK # if defined(S_IFMT) && defined(S_IFLNK) # define ISSYMLINK(mode) (((mode) & S_IFMT) == S_IFLNK) # else # define ISSYMLINK(mode) S_ISLNK(mode) # endif #endif #define SIGN_BYTE 1 /* byte value used where sign is displayed; attribute value is sign type */ #ifdef FEAT_NETBEANS_INTG # define MULTISIGN_BYTE 2 /* byte value used where sign is displayed if multiple signs exist on the line */ #endif #if defined(FEAT_GUI) && defined(FEAT_XCLIPBOARD) # ifdef FEAT_GUI_GTK /* Avoid using a global variable for the X display. It's ugly * and is likely to cause trouble in multihead environments. */ # define X_DISPLAY ((gui.in_use) ? gui_mch_get_display() : xterm_dpy) # else # define X_DISPLAY (gui.in_use ? gui.dpy : xterm_dpy) # endif #else # ifdef FEAT_GUI # ifdef FEAT_GUI_GTK # define X_DISPLAY ((gui.in_use) ? gui_mch_get_display() : (Display *)NULL) # else # define X_DISPLAY gui.dpy # endif # else # define X_DISPLAY xterm_dpy # endif #endif #if defined(FEAT_BROWSE) && defined(GTK_CHECK_VERSION) # if GTK_CHECK_VERSION(2,4,0) # define USE_FILE_CHOOSER # endif #endif #ifndef FEAT_NETBEANS_INTG # undef NBDEBUG #endif #ifdef NBDEBUG /* Netbeans debugging. */ # include "nbdebug.h" #else # define nbdebug(a) #endif #ifdef IN_PERL_FILE /* * Avoid clashes between Perl and Vim namespace. */ # undef NORMAL # undef STRLEN # undef FF # undef OP_DELETE # undef OP_JOIN # ifdef __BORLANDC__ # define NOPROTO 1 # endif /* remove MAX and MIN, included by glib.h, redefined by sys/param.h */ # ifdef MAX # undef MAX # endif # ifdef MIN # undef MIN # endif /* We use _() for gettext(), Perl uses it for function prototypes... */ # ifdef _ # undef _ # endif # ifdef DEBUG # undef DEBUG # endif # ifdef _DEBUG # undef _DEBUG # endif # ifdef instr # undef instr # endif /* bool may cause trouble on MACOS but is required on a few other systems * and for Perl */ # if defined(bool) && defined(MACOS) && !defined(FEAT_PERL) # undef bool # endif # ifdef __BORLANDC__ /* Borland has the structure stati64 but not _stati64 */ # define _stati64 stati64 # endif #endif /* values for vim_handle_signal() that are not a signal */ #define SIGNAL_BLOCK -1 #define SIGNAL_UNBLOCK -2 #if !defined(UNIX) && !defined(VMS) # define vim_handle_signal(x) 0 #endif /* flags for skip_vimgrep_pat() */ #define VGR_GLOBAL 1 #define VGR_NOJUMP 2 /* behavior for bad character, "++bad=" argument */ #define BAD_REPLACE '?' /* replace it with '?' (default) */ #define BAD_KEEP -1 /* leave it */ #define BAD_DROP -2 /* erase it */ /* last argument for do_source() */ #define DOSO_NONE 0 #define DOSO_VIMRC 1 /* loading vimrc file */ #define DOSO_GVIMRC 2 /* loading gvimrc file */ /* flags for read_viminfo() and children */ #define VIF_WANT_INFO 1 /* load non-mark info */ #define VIF_WANT_MARKS 2 /* load file marks */ #define VIF_FORCEIT 4 /* overwrite info already read */ #define VIF_GET_OLDFILES 8 /* load v:oldfiles */ /* flags for buf_freeall() */ #define BFA_DEL 1 /* buffer is going to be deleted */ #define BFA_WIPE 2 /* buffer is going to be wiped out */ #define BFA_KEEP_UNDO 4 /* do not free undo information */ /* direction for nv_mousescroll() and ins_mousescroll() */ #define MSCR_DOWN 0 /* DOWN must be FALSE */ #define MSCR_UP 1 #define MSCR_LEFT -1 #define MSCR_RIGHT -2 #define KEYLEN_PART_KEY -1 /* keylen value for incomplete key-code */ #define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */ #define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */ /* Return values from win32_fileinfo(). */ #define FILEINFO_OK 0 #define FILEINFO_ENC_FAIL 1 /* enc_to_utf16() failed */ #define FILEINFO_READ_FAIL 2 /* CreateFile() failed */ #define FILEINFO_INFO_FAIL 3 /* GetFileInformationByHandle() failed */ /* Return value from get_option_value_strict */ #define SOPT_BOOL 0x01 /* Boolean option */ #define SOPT_NUM 0x02 /* Number option */ #define SOPT_STRING 0x04 /* String option */ #define SOPT_GLOBAL 0x08 /* Option has global value */ #define SOPT_WIN 0x10 /* Option has window-local value */ #define SOPT_BUF 0x20 /* Option has buffer-local value */ #define SOPT_UNSET 0x40 /* Option does not have local value set */ /* Option types for various functions in option.c */ #define SREQ_GLOBAL 0 /* Request global option */ #define SREQ_WIN 1 /* Request window-local option */ #define SREQ_BUF 2 /* Request buffer-local option */ /* Flags for get_reg_contents */ #define GREG_NO_EXPR 1 /* Do not allow expression register */ #define GREG_EXPR_SRC 2 /* Return expression itself for "=" register */ #define GREG_LIST 4 /* Return list */ /* Character used as separated in autoload function/variable names. */ #define AUTOLOAD_CHAR '#' #ifdef FEAT_EVAL # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls) #else # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag) #endif #ifdef FEAT_JOB_CHANNEL # define MAX_OPEN_CHANNELS 10 #else # define MAX_OPEN_CHANNELS 0 #endif /* Options for json_encode() and json_decode. */ #define JSON_JS 1 /* use JS instead of JSON */ #define JSON_NO_NONE 2 /* v:none item not allowed */ #define JSON_NL 4 /* append a NL */ /* Used for flags of do_in_path() */ #define DIP_ALL 0x01 /* all matches, not just the first one */ #define DIP_DIR 0x02 /* find directories instead of files. */ #define DIP_ERR 0x04 /* give an error message when none found. */ #define DIP_START 0x08 /* also use "start" directory in 'packpath' */ #define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */ #define DIP_NORTP 0x20 /* do not use 'runtimepath' */ #define DIP_NOAFTER 0x40 /* skip "after" directories */ #define DIP_AFTER 0x80 /* only use "after" directories */ /* Lowest number used for window ID. Cannot have this many windows. */ #define LOWEST_WIN_ID 1000 /* Used by the garbage collector. */ #define COPYID_INC 2 #define COPYID_MASK (~0x1) /* Values for trans_function_name() argument: */ #define TFN_INT 1 /* internal function name OK */ #define TFN_QUIET 2 /* no error messages */ #define TFN_NO_AUTOLOAD 4 /* do not use script autoloading */ #define TFN_NO_DEREF 8 /* do not dereference a Funcref */ #define TFN_READ_ONLY 16 /* will not change the var */ /* Values for get_lval() flags argument: */ #define GLV_QUIET TFN_QUIET /* no error messages */ #define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD /* do not use script autoloading */ #define GLV_READ_ONLY TFN_READ_ONLY /* will not change the var */ #define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not be freed. */ /* errors for when calling a function */ #define ERROR_UNKNOWN 0 #define ERROR_TOOMANY 1 #define ERROR_TOOFEW 2 #define ERROR_SCRIPT 3 #define ERROR_DICT 4 #define ERROR_NONE 5 #define ERROR_OTHER 6 #define ERROR_DELETED 7 /* flags for find_name_end() */ #define FNE_INCL_BR 1 /* include [] in name */ #define FNE_CHECK_START 2 /* check name starts with valid character */ #if (defined(SUN_SYSTEM) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \ && defined(S_ISCHR) # define OPEN_CHR_FILES #endif #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) # define ELAPSED_TIMEVAL # define ELAPSED_INIT(v) gettimeofday(&v, NULL) # define ELAPSED_FUNC(v) elapsed(&v) # define ELAPSED_TYPE struct timeval long elapsed(struct timeval *start_tv); #else # if defined(WIN32) # define ELAPSED_TICKCOUNT # define ELAPSED_INIT(v) v = GetTickCount() # define ELAPSED_FUNC(v) elapsed(v) # define ELAPSED_TYPE DWORD # ifndef PROTO long elapsed(DWORD start_tick); # endif # endif #endif #endif /* VIM__H */
[ "Bram@vim.org" ]
Bram@vim.org
c4310d64854d27caba1cb42ef45d5cc787810a55
d897b6a09aff1bcec5cb68a460f67fd5d1d35144
/RTE/_Target_1/RTE_Components.h
753552f1a130fbcca7bcfcb325d315a3b5a94911
[]
no_license
turing-lab/GalileoHand_EMG_Pattern_Recognition
f6daac134e92f55b638c5cfab5000e77030e9b42
9602a0f6a13f3398ef474b58931211073242dee0
refs/heads/master
2020-08-04T16:55:40.885018
2019-10-01T22:34:55
2019-10-01T22:34:55
212,209,783
0
0
null
null
null
null
UTF-8
C
false
false
355
h
/* * Auto generated Run-Time-Environment Component Configuration File * *** Do not modify ! *** * * Project: 'Galileo Hand_EMGPR' * Target: 'Target 1' */ #ifndef RTE_COMPONENTS_H #define RTE_COMPONENTS_H /* * Define the Device Header File: */ #define CMSIS_device_header "MK20D7.h" #endif /* RTE_COMPONENTS_H */
[ "noreply@github.com" ]
turing-lab.noreply@github.com
24b72093f8e8d22334cb7e2834572b1afa357d3a
5878c2cff7ef1ed2d05e7ff7628dcba0fd134020
/MCUXpresso_11.1.1_3241/workspace/CMSISv2p00_DSPLIB_SRC/src/Cortex-M4-M3/BasicMathFunctions/arm_mult_f32.c
83cf90a369fb4d120e58c9c1b6ad7863171b9413
[ "MIT" ]
permissive
gov466/Embedded-C
16c580b1e87542b4c755c8f604a302010c32cc33
febf81fbda55d38a587335057dd561fc486f5103
refs/heads/master
2023-01-23T10:21:41.458449
2020-11-25T04:22:33
2020-11-25T04:22:33
210,986,393
2
0
null
null
null
null
UTF-8
C
false
false
2,984
c
/* ---------------------------------------------------------------------- * Copyright (C) 2010 ARM Limited. All rights reserved. * * $Date: 29. November 2010 * $Revision: V1.0.3 * * Project: CMSIS DSP Library * Title: arm_mult_f32.c * * Description: Floating-point vector multiplication. * * Target Processor: Cortex-M4/Cortex-M3 * * Version 1.0.3 2010/11/29 * Re-organized the CMSIS folders and updated documentation. * * Version 1.0.2 2010/11/11 * Documentation updated. * * Version 1.0.1 2010/10/05 * Production release and review comments incorporated. * * Version 1.0.0 2010/09/20 * Production release and review comments incorporated. * * Version 0.0.5 2010/04/26 * incorporated review comments and updated with latest CMSIS layer * * Version 0.0.3 2010/03/10 * Initial version * -------------------------------------------------------------------- */ #include "arm_math.h" /** * @ingroup groupMath */ /** * @defgroup BasicMult Vector Multiplication * * Element-by-element multiplication of two vectors. * * <pre> * pDst[n] = pSrcA[n] * pSrcB[n], 0 <= n < blockSize. * </pre> * * There are separate functions for floating-point, Q7, Q15, and Q31 data types. */ /** * @addtogroup BasicMult * @{ */ /** * @brief Floating-point vector multiplication. * @param[in] *pSrcA points to the first input vector * @param[in] *pSrcB points to the second input vector * @param[out] *pDst points to the output vector * @param[in] blockSize number of samples in each vector * @return none. */ void arm_mult_f32( float32_t * pSrcA, float32_t * pSrcB, float32_t * pDst, uint32_t blockSize) { uint32_t blkCnt; /* loop counters */ /* loop Unrolling */ blkCnt = blockSize >> 2u; /* First part of the processing with loop unrolling. Compute 4 outputs at a time. ** a second loop below computes the remaining 1 to 3 samples. */ while(blkCnt > 0u) { /* C = A * B */ /* Multiply the inputs and store the results in output buffer */ *pDst++ = (*pSrcA++) * (*pSrcB++); *pDst++ = (*pSrcA++) * (*pSrcB++); *pDst++ = (*pSrcA++) * (*pSrcB++); *pDst++ = (*pSrcA++) * (*pSrcB++); /* Decrement the blockSize loop counter */ blkCnt--; } /* If the blockSize is not a multiple of 4, compute any remaining output samples here. ** No loop unrolling is used. */ blkCnt = blockSize % 0x4u; while(blkCnt > 0u) { /* C = A * B */ /* Multiply the inputs and store the results in output buffer */ *pDst++ = (*pSrcA++) * (*pSrcB++); /* Decrement the blockSize loop counter */ blkCnt--; } } /** * @} end of BasicMult group */
[ "govind.mndy@gmail.com" ]
govind.mndy@gmail.com
cbc3f57d1d2ef5d90c2c6fac1a376c2e7059c10f
8a2b21ab53f0c66ceac3c25ede8aea7f4f9f79f0
/HC32F460Temp_FreeRTOS/PeripheralDriver/Hw_Uart3_DMA.h
a6d03696c2f111f38bcd6f284e13f2894d7cac42
[]
no_license
SourceWolf/HC32F460_FreeRTOS
3cb79bc2e715fb45cd163573a8e0cff34f1f8c87
f2fd8e591fb263abbb13a17b4c36508ea2151557
refs/heads/master
2023-03-07T06:32:33.435187
2021-02-24T08:33:24
2021-02-24T08:33:24
197,676,821
10
6
null
null
null
null
GB18030
C
false
false
1,307
h
#ifndef UART_DMA_H #define UART_DMA_H #define USART3_UNIT M4_USART3 #define USART3_BAUDRATE (115200) #define USART3_RX_PORT PortE #define USART3_RX_PIN Pin04 #define USART3_RX_FUNC Func_Usart3_Rx #define USART3_TX_PORT PortE #define USART3_TX_PIN Pin05 #define USART3_TX_FUNC Func_Usart3_Tx #define USART3_RI_NUM INT_USART3_RI #define USART3_EI_NUM INT_USART3_EI #define USART3_TI_NUM INT_USART3_TI #define USART3_CLK PWC_FCG1_PERIPH_USART3 //#define USART3_RX_IRQn Int022_IRQn #define USART3_ER_IRQn Int023_IRQn #define USART3_RTO_IRQn Int024_IRQn //#define TIMER02_CHA_IRQn Int025_IRQn #define UART3_DMA2_UNIT (M4_DMA2) #define UART3_DMA_RXCH (DmaCh0) #define UART3_DMA_CLK PWC_FCG0_PERIPH_DMA2 #define UART3_DMA_TRNCNT (40u)//传输次数,最大包长 #define UART3_DMA_BLKSIZE (1u) #define UART3_DMA_RPT_SIZE UART3_DMA_TRNCNT #define UART3_DMA_INT_SRC INT_DMA2_BTC0 #define UART3_DMA_Trg_Src EVT_USART3_RI //#define DMA2_CH0_IRQn Int009_IRQn void hw_rxdma_init(void); void hw_uart3Init(void); void UART_RTO_Timer_Init(void); void Test_UART_TX(void); #endif
[ "snowwolf726@163.com" ]
snowwolf726@163.com
627eccac47b5fae24ee7b2fdd3ac9a795435d547
c1f9fd73a8b5574c6374fdf13ade8fb3414b1932
/figlinks/recvfd_ubuntu.c
5b6d80748362e2a1d9ac1a32d8d244ae803f2115
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
petterxy/apue
b0bbf336e81efa00d7e13f9e4f6bbfdca8e5c262
a44f00470e02bd8bc4b5036220132dc50b08a367
refs/heads/master
2020-04-03T18:44:56.593818
2018-11-20T11:54:15
2018-11-20T11:54:15
155,496,089
0
0
null
null
null
null
UTF-8
C
false
false
2,060
c
#include "apue.h" #include <sys/socket.h> /* struct msghdr */ /* size of control buffer to send/recv one file descriptor */ ///#define CMSG_LEN(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + (l)) #define CONTROLLEN CMSG_LEN(sizeof(int)) ///#define CONTROLLEN 4///CMSG_LEN(sizeof(int)) #ifdef LINUX #define RELOP < #else #define RELOP != #endif static struct cmsghdr *cmptr = NULL; /* malloc'ed first time */ /* * Receive a file descriptor from a server process. Also, any data * received is passed to (*userfunc)(STDERR_FILENO, buf, nbytes). * We have a 2-byte protocol for receiving the fd from send_fd(). */ int recv_fd(int fd, ssize_t (*userfunc)(int, const void *, size_t)) { int newfd, nr, status; char *ptr; char buf[MAXLINE]; struct iovec iov[1]; struct msghdr msg; status = -1; for ( ; ; ) { iov[0].iov_base = buf; iov[0].iov_len = sizeof(buf); msg.msg_iov = iov; msg.msg_iovlen = 1; msg.msg_name = NULL; msg.msg_namelen = 0; if (cmptr == NULL && (cmptr = malloc(CONTROLLEN)) == NULL) return(-1); msg.msg_control = cmptr; msg.msg_controllen = CONTROLLEN; if ((nr = recvmsg(fd, &msg, 0)) < 0) { err_ret("recvmsg error"); return(-1); } else if (nr == 0) { err_ret("connection closed by server"); return(-1); } /* * See if this is the final data with null & status. Null * is next to last byte of buffer; status byte is last byte. * Zero status means there is a file descriptor to receive. */ for (ptr = buf; ptr < &buf[nr]; ) { if (*ptr++ == 0) { if (ptr != &buf[nr-1]) err_dump("message format error"); status = *ptr & 0xFF; /* prevent sign extension */ if (status == 0) { if (msg.msg_controllen RELOP CONTROLLEN) err_dump("status = 0 but no fd"); newfd = *(int *)CMSG_DATA(cmptr); } else { newfd = -status; } nr -= 2; } } if (nr > 0 && (*userfunc)(STDERR_FILENO, buf, nr) != nr) return(-1); if (status >= 0) /* final data has arrived */ return(newfd); /* descriptor, or -status */ } }
[ "petter.xy@gmail.com" ]
petter.xy@gmail.com
df0c66ba02221e21329ea94b38fea8e1b8e11d0e
c6e14f68ba25b6c8a8699bebd14b6146793e59ab
/RRC/code/asn1c/ThresholdEUTRA.h
d6194fa3c27400034d5d5caeac608b5e22d42653
[]
no_license
Captain-One/C_Programe
2a049e0530b863c5ffa53fc55e4f0d96b1ce116f
2c2bc608a1f42f7ecf95e049cf48e45fdf090889
refs/heads/master
2021-07-13T14:49:09.308017
2020-06-16T06:49:46
2020-06-16T06:49:46
136,001,747
0
3
null
null
null
null
UTF-8
C
false
false
1,115
h
/* * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) * From ASN.1 module "EUTRA-RRC-Definitions" * found in "36331-b00.asn" * `asn1c -S /usr/local/share/asn1c -fcompound-names -fskeletons-copy -gen-PER -pdu=auto` */ #ifndef _ThresholdEUTRA_H_ #define _ThresholdEUTRA_H_ #include "asn_application.h" /* Including external dependencies */ #include "RSRP-Range.h" #include "RSRQ-Range.h" #include "constr_CHOICE.h" #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum ThresholdEUTRA_PR { ThresholdEUTRA_PR_NOTHING, /* No components present */ ThresholdEUTRA_PR_threshold_RSRP, ThresholdEUTRA_PR_threshold_RSRQ } ThresholdEUTRA_PR; /* ThresholdEUTRA */ typedef struct ThresholdEUTRA { ThresholdEUTRA_PR present; union ThresholdEUTRA_u { RSRP_Range_t threshold_RSRP; RSRQ_Range_t threshold_RSRQ; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ThresholdEUTRA_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_ThresholdEUTRA; #ifdef __cplusplus } #endif #endif /* _ThresholdEUTRA_H_ */ #include "asn_internal.h"
[ "pxqjoe@sina.com" ]
pxqjoe@sina.com
df105500cc313806f587851cc581c2abbf604c02
fe21475384639e117828e36ce371ff953596abf6
/kern/include/buf.h
8df30e86f22eeefa3a5dd4f7d326f9a1702db918
[]
no_license
abbylyons/LongcatOS
6c4bb1caccf925cc2e82dcca0c5c5ab300616cd9
0165f3fa72e338a9a9f9d65a708b169878f33e7a
refs/heads/master
2020-03-27T21:15:57.872457
2018-09-02T23:35:34
2018-09-02T23:35:34
147,129,552
0
0
null
null
null
null
UTF-8
C
false
false
7,447
h
/* * Copyright (c) 2009 * The President and Fellows of Harvard College. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY 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 UNIVERSITY 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 _BUF_H_ #define _BUF_H_ #include <sfs.h> struct fs; /* fs.h */ /* * The buffer cache is physically indexed; that is, the index or "key" * is a filesystem and block number. (The alternative would be * virtually indexed, where the key is a vnode and block offset within * the vnode.) * * In the real world you'd want buffers to be able to be different * sizes (since not every FS in existence uses the same block size, * and some can use different block sizes as a formatting option) but * to reduce complexity here we'll require all buffers to be the * ONE_TRUE_BUFFER_SIZE, which is defined in buf.c. * * In any event each FS should use buffers of only one size, or at * least of a consistent size for any particular disk offset, because * handling partial or overlapping buffers would be extremely * problematic. */ struct buf; /* Opaque. */ /* * Get-a-buffer operations. * * buffer_get looks for an existing buffer for the given block, and * returns it if found; if not, it creates a new buffer and doesn't * put any data in it. * * buffer_read is the same but reads from disk if necessary, so that * the contents are always valid on return. * * Both mark the buffer busy before returning it. * * The "fsmanaged" variants are the same, except that they tag the * buffer as managed by the file system. This is for use with buffers * that are held for a long time or are otherwise managed in some * complex way. Getting a buffer as "fsmanaged" has the following * consequences: * - It does not participate in buffer reservation. (Thus, it * doesn't have to belong to any one thread and can be used * by multiple threads under file system control. * - The syncer (and explicit sync calls like sync_fs_buffers) * will skip over it until it's released; the file system is * responsible for writing out any managed buffers it's holding. * * buffer_flush looks for an existing buffer and writes it out (if * dirty) immediately without returning it. * * buffer_drop looks for an existing buffer and invalidates it * immediately without returning it. */ int buffer_get(struct fs *fs, daddr_t block, size_t size, struct buf **ret); int buffer_read(struct fs *fs, daddr_t block, size_t size, struct buf **ret); int buffer_get_fsmanaged(struct fs *fs, daddr_t block, size_t size, struct buf **ret); int buffer_read_fsmanaged(struct fs *fs, daddr_t block, size_t size, struct buf **ret); int buffer_flush(struct fs *fs, daddr_t block, size_t size); void buffer_drop(struct fs *fs, daddr_t block, size_t size); /* * Release-a-buffer operations. * * buffer_release lets go of the buffer and marks it no longer busy. * The cache will make sure it gets written out at some point if it's * marked dirty. * * buffer_release_and_invalidate does the same but marks the contents * no longer valid. */ void buffer_release(struct buf *buf); void buffer_release_and_invalidate(struct buf *buf); /* * Per-fs data * * buffer_get_fsdata returns the fs-specific data for this buffer; * buffer_set_fsdata sets new fs-specific data and returns the old. * Synchronization is assumed to be provided by the caller. * * If the fs-specific data has never been set on this buffer, it is * NULL. * * The FSOP_ATTACHBUF and FSOP_DETACHBUF operations can be used to * call these functions. In particular, FSOP_DETACHBUF should always * remove (and presumably free) any fs-specific data and set the * fsdata pointer to NULL. Leftover fs-specific data is dropped on the * floor with a warning printout. */ void *buffer_get_fsdata(struct buf *buf); void *buffer_set_fsdata(struct buf *buf, void *fsd); /* * Other operations on buffers. * * buffer_map returns the data pointer, which is valid until the * (reference to) the buffer is released. * * buffer_mark_dirty marks the buffer dirty. * buffer_mark_valid marks the buffer valid (i.e., contains real data). * buffer_is_dirty/buffer_is_valid tests these conditions. * * buffer_writeout flushes the buffer to disk if it's currently dirty, * and marks it clean. * * The buffer must already be marked busy. */ void *buffer_map(struct buf *buf); bool buffer_is_dirty(struct buf *buf); bool buffer_is_valid(struct buf *buf); void buffer_mark_dirty(struct buf *buf); void buffer_mark_valid(struct buf *buf); int buffer_writeout(struct buf *buf); /* * Sync. */ int sync_fs_buffers(struct fs *fs); /* * For unmounting. */ void drop_fs_buffers(struct fs *fs); /* * Starvation/deadlock avoidance logic. * * Upon entry to any FS operation that will use buffers, the process * involved should reserve some buffers of the proper size; upon * completion it should release this reservation. reserve_buffers may * wait until enough buffers are available. * * The number of buffers to reserve is fixed inside buf.c. (If that * number is larger than really necessary, the only consequence is * reducing the maximum concurrency of your file system by a bit. * * This prevents pathological cases where e.g. every buffer is in use * by a process that's halfway through a truncate and waiting for * another buffer to become available. * * FS-managed buffers (see above) are reserved separately; these * reservations are global rather than per-process, and we expect the * count to be known. */ void reserve_buffers(size_t size); void unreserve_buffers(size_t size); void reserve_fsmanaged_buffers(unsigned count, size_t size); void unreserve_fsmanaged_buffers(unsigned count, size_t size); /* * Print stats. */ void buffer_printstats(void); /* * Bootup. */ void buffer_bootstrap(void); /* Help checkpointer find oldest lsn of dirty buffers */ sfs_lsn_t bufarray_find_oldest_dirty_lsn(struct fs *fs); daddr_t buffer_get_physblock(struct buf *buf); struct fs *buffer_get_fs(struct buf *buf); #endif /* _BUF_H_ */
[ "abigaillyons@college.harvard.edu" ]
abigaillyons@college.harvard.edu
d755fadb2dda92f1d2b85a1350f5b2bf7ee643c8
8627b8aac72a83abb5a82a75b0946b4ecafc1cc3
/Assignments/HW1/getpinfo.h
57489d790bb487527ecfc46f374cd504c3370705
[]
no_license
SamuelDGeorge/Kernel_Code
45ddca0a687c74a4130c2ea8e50c77a3e9cc8e41
c94b24aec8e284515b1d414d84a981df61e1d9a2
refs/heads/master
2020-03-17T11:33:40.841162
2018-05-15T18:23:28
2018-05-15T18:23:28
null
0
0
null
null
null
null
UTF-8
C
false
false
333
h
#define MAX_CALL 100 // characters in call request string #define MAX_LINE 100 // characters in call response string #define MAX_RESP 1100 // total characters in buffer // define the debugfs path name directory and file // full path name will be /sys/kernel/debug/getpid/call char dir_name[] = "getpinfo"; char file_name[] = "call";
[ "sdgeorge@icloud.com" ]
sdgeorge@icloud.com
6b842a15bd488472175fba521abe0be61fcee8a7
ca0b02d38560f039706bdc0d6c663d2181fec2ce
/components/imu/imu.c
5855381b99b06be93ce73901e7e15c50d593a2e8
[ "BSD-2-Clause" ]
permissive
danielealbano/bikenav-esp32
c690c162c53d2a2861036ee9119aaf3c6eff54f0
5328719d547a196c054af14b4d7326e2d1c60713
refs/heads/master
2020-03-18T23:25:52.049862
2018-05-30T21:57:54
2018-05-30T21:57:54
135,402,277
3
0
null
null
null
null
UTF-8
C
false
false
7,162
c
#include "esp_log.h" #include "driver/gpio.h" #include "driver/i2c.h" #include "soc/gpio_struct.h" #include "imu.h" int8_t imu_bmi160_user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t length, void* cb_user_data) { imu_t* imu = (imu_t*)cb_user_data; if (length == 0) { return (int8_t)ESP_ERR_INVALID_SIZE; } i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, I2C_ACK_CHECK_EN); i2c_master_write_byte(cmd, reg_addr, I2C_ACK_CHECK_DIS); i2c_master_start(cmd); i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_READ, I2C_ACK_CHECK_EN); if (length > 1) { i2c_master_read(cmd, reg_data, length - 1, I2C_ACK_VAL); } i2c_master_read_byte(cmd, reg_data+length-1, I2C_NACK_VAL); i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(imu->i2c.port_number, cmd, IMU_I2C_MAX_WAIT); i2c_cmd_link_delete(cmd); return (int8_t)ret; } int8_t imu_bmi160_user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t length, void* cb_user_data) { imu_t* imu = (imu_t*)cb_user_data; i2c_cmd_handle_t cmd = i2c_cmd_link_create(); i2c_master_start(cmd); i2c_master_write_byte(cmd, (dev_id << 1) | I2C_MASTER_WRITE, I2C_ACK_CHECK_EN); i2c_master_write_byte(cmd, reg_addr, I2C_ACK_CHECK_EN); i2c_master_write(cmd, reg_data, length, I2C_ACK_CHECK_EN); i2c_master_stop(cmd); esp_err_t ret = i2c_master_cmd_begin(imu->i2c.port_number, cmd, IMU_I2C_MAX_WAIT); i2c_cmd_link_delete(cmd); return (int8_t)ret; } void imu_bmi160_user_delay_ms(uint32_t period) { uint32_t start = xTaskGetTickCount() * portTICK_PERIOD_MS; do { // do nothing } while((xTaskGetTickCount() * portTICK_PERIOD_MS) - start <= period); } int8_t imu_bmm150_user_read(uint8_t id, uint8_t reg_addr, uint8_t *aux_data, uint16_t len, void* cb_user_data) { imu_t* imu = (imu_t*)cb_user_data; return bmi160_aux_read(reg_addr, aux_data, len, &imu->sensor_bmi160); } int8_t imu_bmm150_user_write(uint8_t id, uint8_t reg_addr, uint8_t *aux_data, uint16_t len, void* cb_user_data) { imu_t* imu = (imu_t*)cb_user_data; return bmi160_aux_write(reg_addr, aux_data, len, &imu->sensor_bmi160); } void imu_bmm150_user_delay_ms(uint32_t period) { uint32_t start = xTaskGetTickCount() * portTICK_PERIOD_MS; do { // do nothing } while((xTaskGetTickCount() * portTICK_PERIOD_MS) - start <= period); } void imu_init_i2c(imu_t *imu) { i2c_config_t conf; memset(&conf, 0, sizeof(conf)); conf.mode = I2C_MODE_MASTER; conf.sda_io_num = imu->i2c.pins.sda; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = imu->i2c.pins.scl; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = imu->i2c.frequency_hz; i2c_param_config(imu->i2c.port_number, &conf); i2c_driver_install(imu->i2c.port_number, conf.mode, 0, 0, 0); } void imu_init_bmi160(imu_t *imu) { int8_t result; imu->sensor_bmi160.id = imu->i2c.bmi160_address; imu->sensor_bmi160.interface = BMI160_I2C_INTF; imu->sensor_bmi160.read = imu_bmi160_user_i2c_read; imu->sensor_bmi160.write = imu_bmi160_user_i2c_write; imu->sensor_bmi160.delay_ms = imu_bmi160_user_delay_ms; imu->sensor_bmi160.cb_user_data = (void*)imu; if ((result = bmi160_init(&imu->sensor_bmi160)) != BMI160_OK) { ESP_LOGE(TAG, "bmi160_init failed: %d", result); return; } ESP_LOGI(TAG, "BMI160 CHIP ID : %d", imu->sensor_bmi160.chip_id); /* Select the Output data rate, range of accelerometer sensor */ imu->sensor_bmi160.accel_cfg.odr = BMI160_ACCEL_ODR_800HZ; imu->sensor_bmi160.accel_cfg.range = BMI160_ACCEL_RANGE_4G; imu->sensor_bmi160.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4; imu->sensor_bmi160.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE; /* Select the Output data rate, range of Gyroscope sensor */ imu->sensor_bmi160.gyro_cfg.odr = BMI160_GYRO_ODR_800HZ; imu->sensor_bmi160.gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS; imu->sensor_bmi160.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE; imu->sensor_bmi160.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE; if ((result = bmi160_set_sens_conf(&imu->sensor_bmi160)) != BMI160_OK) { ESP_LOGE(TAG, "bmi160_set_sens_conf failed: %d", result); return; } } void imu_init_perform_self_testing(imu_t *imu) { // TODO: add support for self testing } void imu_init_bmm150_aux(imu_t *imu) { int8_t result; imu->sensor_bmi160.aux_cfg.aux_sensor_enable = 1; imu->sensor_bmi160.aux_cfg.aux_i2c_addr = imu->i2c.bmm150_address; imu->sensor_bmi160.aux_cfg.manual_enable = 0; imu->sensor_bmi160.aux_cfg.aux_rd_burst_len = 2; imu->sensor_bmm150.read = imu_bmm150_user_read; imu->sensor_bmm150.write = imu_bmm150_user_write; imu->sensor_bmm150.delay_ms = imu_bmm150_user_delay_ms; imu->sensor_bmm150.dev_id = imu->i2c.bmm150_address; imu->sensor_bmm150.intf = BMM150_I2C_INTF; imu->sensor_bmm150.cb_user_data = (void*)imu; if ((result = bmi160_aux_init(&imu->sensor_bmi160)) != BMI160_OK) { ESP_LOGE(TAG, "bmi160_init failed: %d", result); return; } if ((result = bmm150_init(&imu->sensor_bmm150)) != BMI160_OK) { ESP_LOGE(TAG, "bmm150_init failed: %d", result); return; } ESP_LOGI(TAG, "BMM150 CHIP ID : %d", imu->sensor_bmm150.chip_id); imu->sensor_bmm150.settings.pwr_mode = BMM150_NORMAL_MODE; if ((result = bmm150_set_op_mode(&imu->sensor_bmm150)) != BMI160_OK) { ESP_LOGE(TAG, "bmm150_set_op_mode failed: %d", result); return; } imu->sensor_bmm150.settings.preset_mode = BMM150_PRESETMODE_LOWPOWER; if ((result = bmm150_set_presetmode(&imu->sensor_bmm150)) != BMI160_OK) { ESP_LOGE(TAG, "bmm150_set_presetmode failed: %d", result); return; } imu->sensor_bmi160.aux_cfg.aux_odr = 8; if ((result = bmi160_config_aux_mode(&imu->sensor_bmi160)) != BMI160_OK) { ESP_LOGE(TAG, "bmi160_config_aux_mode failed: %d", result); return; } if ((result = bmi160_set_aux_auto_mode(&imu->sensor_bmi160.aux_cfg.aux_i2c_addr, &imu->sensor_bmi160)) != BMI160_OK) { ESP_LOGE(TAG, "bmi160_set_aux_auto_mode failed: %d", result); return; } } imu_t* imu_alloc(uint8_t i2c_bmi160_address, uint8_t i2c_bmm150_address, gpio_num_t i2c_pins_sda, gpio_num_t i2c_pins_scl, uint8_t i2c_port_number, uint32_t frequency_hz) { imu_t *imu = (imu_t*)malloc(sizeof(imu_t)); memset(imu, 0, sizeof(imu_t)); imu->i2c.bmi160_address = i2c_bmi160_address; imu->i2c.bmm150_address = i2c_bmm150_address; imu->i2c.port_number = i2c_port_number; imu->i2c.frequency_hz = frequency_hz; imu->i2c.pins.sda = i2c_pins_sda; imu->i2c.pins.scl = i2c_pins_scl; return imu; } void imu_init(imu_t *imu) { imu_init_i2c(imu); imu_init_bmi160(imu); imu_init_perform_self_testing(imu); imu_init_bmm150_aux(imu); } void imu_free(imu_t *imu) { free(imu); }
[ "d.albano@gmail.com" ]
d.albano@gmail.com
33bd22d78793383a2469604821831d1d95e90d1c
fbe68d84e97262d6d26dd65c704a7b50af2b3943
/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/StdLib/LibC/Containers/Queues/Fifo.c
88c1d9c5d75d4e752b21e3a4cba89a62f090a09b
[ "MIT", "BSD-2-Clause", "GPL-2.0-only", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LGPL-2.1-or-later", "GPL-2.0-or-later", "MPL-1.0", "LicenseRef-scancode-generic-exception", "Apache-2.0", "OpenSSL" ]
permissive
thalium/icebox
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
6f78952d58da52ea4f0e55b2ab297f28e80c1160
refs/heads/master
2022-08-14T00:19:36.984579
2022-02-22T13:10:31
2022-02-22T13:10:31
190,019,914
585
109
MIT
2022-01-13T20:58:15
2019-06-03T14:18:12
C++
UTF-8
C
false
false
15,775
c
/** @file Class for arbitrary sized FIFO queues. The FIFO is empty if both the Read and Write indexes are equal. The FIFO is full if the next write would make the Read and Write indexes equal. Member variable NumElements is the maximum number of elements that can be contained in the FIFO. If NumElements is ZERO, there is an error. NumElements should be in the range 1:N. Members WriteIndex and ReadIndex are indexes into the array implementing the FIFO. They should be in the range 0:(NumElements - 1). One element of the FIFO is always reserved as the "terminator" element. Thus, the capacity of a FIFO is actually NumElements-1. Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include <Uefi.h> #include <Library/BaseLib.h> #include <Library/BaseMemoryLib.h> #include <Library/MemoryAllocationLib.h> #include <LibConfig.h> #include <assert.h> #include <errno.h> #include <stdlib.h> #include <stdint.h> #include <wchar.h> #include <Containers/Fifo.h> /** Determine number of items available to read from the FIFO. The number of items are either the number of bytes, or the number of elements depending upon the value of the As enumerator. @param[in] Self Pointer to the FIFO instance. @param[in] As An enumeration variable whose value determines whether the returned value is the number of bytes or the number of elements currently contained by the FIFO. @retval 0 The FIFO is empty. @retval >=0 The number of items contained by the FIFO. **/ static size_t EFIAPI FIFO_NumInQueue ( cFIFO *Self, FIFO_ElemBytes As ) { size_t Count; if(Self->ReadIndex <= Self->WriteIndex) { Count = Self->WriteIndex - Self->ReadIndex; } else { Count = Self->NumElements - (Self->ReadIndex - Self->WriteIndex); } if(As == AsBytes) { Count *= Self->ElementSize; } return Count; } /** Determine amount of free space in the FIFO that can be written into. The number of items are either the number of bytes, or the number of elements depending upon the value of the As enumerator. @param[in] Self Pointer to the FIFO instance. @param[in] As An enumeration variable whose value determines whether the returned value is the number of bytes or the number of elements currently available in the FIFO. @retval 0 The FIFO is full. @retval >=0 The number of items which can be accepted by the FIFO. **/ static size_t EFIAPI FIFO_FreeSpace ( cFIFO *Self, FIFO_ElemBytes As ) { size_t Count; UINT32 RDex; UINT32 WDex; RDex = Self->ReadIndex; WDex = Self->WriteIndex; if(RDex <= WDex) { Count = (Self->NumElements - (WDex - RDex)) - 1; } else { Count = (RDex - WDex)-1; } if(As == AsBytes) { Count *= Self->ElementSize; } return Count; } /** Reduce the FIFO contents by NumElem elements. @param[in] Self Pointer to the FIFO instance. @param[in] NumElem Number of elements to delete from the FIFO. @retval 0 FIFO is now empty. @retval N>0 There are still N elements in the FIFO. @retval -1 There are fewer than NumElem elements in the FIFO. **/ static ssize_t FIFO_Reduce ( cFIFO *Self, size_t NumElem ) { size_t QCount; ssize_t RetVal; assert(Self != NULL); QCount = FIFO_NumInQueue(Self, AsElements); if(NumElem > QCount) { RetVal = -1; errno = EINVAL; } else { RetVal = (ssize_t)ModuloAdd(Self->ReadIndex, (UINT32)NumElem, Self->NumElements); Self->ReadIndex = (UINT32)RetVal; RetVal = (ssize_t)(QCount - NumElem); } return RetVal; } /** Test whether the FIFO is empty. @param[in] Self Pointer to the FIFO instance. @retval TRUE The FIFO is empty. @retval FALSE There is data in the FIFO. **/ static BOOLEAN EFIAPI FIFO_IsEmpty ( cFIFO *Self ) { assert(Self != NULL); return (BOOLEAN)(Self->WriteIndex == Self->ReadIndex); } /** Test whether the FIFO is full. @param[in] Self Pointer to the FIFO instance. @retval TRUE The FIFO is full. @retval FALSE There is free space in the FIFO. **/ static BOOLEAN EFIAPI FIFO_IsFull ( cFIFO *Self ) { assert(Self != NULL); return (BOOLEAN)(ModuloIncrement(Self->WriteIndex, Self->NumElements) == (INT32)Self->ReadIndex); } /** Add one or more elements to the FIFO. This function allows one to add one or more elements, as specified by Count, to the FIFO. Each element is of the size specified when the FIFO object was instantiated (FIFO.ElementSize). pElement points to the first byte of the first element to be added. If multiple elements are to be added, the elements are expected to be organized as a packed array. @param[in] Self Pointer to the FIFO instance. @param[in] pElement Pointer to the element(s) to enqueue (add). @param[in] Count Number of elements to add. @retval 0 The FIFO is full. @retval >=0 The number of elements added to the FIFO. **/ static size_t EFIAPI FIFO_Enqueue ( cFIFO *Self, const void *pElement, size_t Count ) { uintptr_t ElemPtr; uintptr_t QPtr; size_t i; UINT32 SizeOfElement; UINT32 Windex; assert(Self != NULL); assert(pElement != NULL); if(FIFO_IsFull(Self)) { // FIFO is full so can't add to it Count = 0; // Zero characters added } else { // Otherwise, FIFO is not full... Count = MIN(Count, Self->FreeSpace(Self, AsElements)); // Smaller of requested or available space SizeOfElement = Self->ElementSize; // Size of Elements, in bytes Windex = Self->WriteIndex; // Index of first writable slot in FIFO ElemPtr = (uintptr_t)pElement; // Addr. of element to add, as an integer QPtr = (uintptr_t)Self->Queue + (SizeOfElement * Windex); // Addr. in FIFO to write, as an integer for(i = 0; i < Count; ++i) { // For Count elements... (void)CopyMem((void *)QPtr, (const void *)ElemPtr, SizeOfElement); // Copy an element into the FIFO Windex = (UINT32)ModuloIncrement(Windex, Self->NumElements); // Increment the Write index, wrap if necessary if(Windex == 0) { // If the index wrapped QPtr = (uintptr_t)Self->Queue; // Go to the beginning } else { QPtr += SizeOfElement; // Otherwise, point to next in FIFO } ElemPtr += SizeOfElement; // And also point to next Element to add } Self->WriteIndex = Windex; // Finally, save the new Write Index } return Count; // Number of elements added to FIFO } /** Read or copy elements from the FIFO. This function allows one to read one or more elements, as specified by Count, from the FIFO. Each element is of the size specified when the FIFO object was instantiated (FIFO.ElementSize). pElement points to the destination of the first byte of the first element to be read. If multiple elements are to be read, the elements are expected to be organized as a packed array. @param[in] Self Pointer to the FIFO instance. @param[out] pElement Pointer to where to store the element(s) read from the FIFO. @param[in] Count Number of elements to dequeue. @param[in] Consume If TRUE, consume read elements. Otherwise, preserve. @retval 0 The FIFO is empty. @retval >=0 The number of elements read from the FIFO. **/ static size_t EFIAPI FIFO_Dequeue ( cFIFO *Self, void *pElement, size_t Count, BOOLEAN Consume ) { UINTN QPtr; UINT32 RDex; UINT32 SizeOfElement; UINT32 i; assert(Self != NULL); assert(pElement != NULL); if(FIFO_IsEmpty(Self)) { Count = 0; } else { RDex = Self->ReadIndex; // Get this FIFO's Read Index SizeOfElement = Self->ElementSize; // Get size of this FIFO's elements Count = MIN(Count, Self->Count(Self, AsElements)); // Lesser of requested or actual QPtr = (UINTN)Self->Queue + (RDex * Self->ElementSize); // Point to Read location in FIFO for(i = 0; i < Count; ++i) { // Iterate Count times... (void)CopyMem(pElement, (const void *)QPtr, Self->ElementSize); // Copy element from FIFO to caller's buffer RDex = (UINT32)ModuloIncrement(RDex, Self->NumElements); // Increment Read Index if(RDex == 0) { // If the index wrapped QPtr = (UINTN)Self->Queue; // Point back to beginning of data } else { // Otherwise QPtr += Self->ElementSize; // Point to the next element in FIFO } pElement = (char*)pElement + Self->ElementSize; // Point to next element in caller's buffer } // Iterate: for loop if(Consume) { // If caller requests data consumption Self->ReadIndex = RDex; // Set FIFO's Read Index to new Index } } return Count; // Return number of elements actually read } /** Read elements from the FIFO. Read the specified number of elements from the FIFO, removing each element read. The number of elements actually read from the FIFO is returned. This number can differ from the Count requested if more elements are requested than are in the FIFO. @param[in] Self Pointer to the FIFO instance. @param[out] pElement Pointer to where to store the element read from the FIFO. @param[in] Count Number of elements to dequeue. @retval 0 The FIFO is empty. @retval >=0 The number of elements read from the FIFO. **/ static size_t EFIAPI FIFO_Read ( cFIFO *Self, void *pElement, size_t Count ) { return FIFO_Dequeue(Self, pElement, Count, TRUE); } /** Make a copy of the FIFO's data. The contents of the FIFO is copied out and linearized without affecting the FIFO contents. This function is idempotent. @param[in] Self Pointer to the FIFO instance. @param[out] pElement Pointer to where to store the elements copied from the FIFO. @param[in] Count Number of elements to copy. @retval 0 The FIFO is empty. @retval >=0 The number of elements copied from the FIFO. **/ static size_t EFIAPI FIFO_Copy ( cFIFO *Self, void *pElement, size_t Count ) { return FIFO_Dequeue(Self, pElement, Count, FALSE); } /** Get the FIFO's current Read Index. @param[in] Self Pointer to the FIFO instance. **/ static UINT32 EFIAPI FIFO_GetRDex ( cFIFO *Self ) { assert(Self != NULL); return Self->ReadIndex; } /** Get the FIFO's current Write Index. @param[in] Self Pointer to the FIFO instance. @return The current value of the FIFO's WriteIndex member is returned. **/ static UINT32 EFIAPI FIFO_GetWDex ( cFIFO *Self ) { assert(Self != NULL); return Self->WriteIndex; } /** Cleanly delete a FIFO instance. @param[in] Self Pointer to the FIFO instance. **/ static void EFIAPI FIFO_Delete ( cFIFO *Self ) { assert(Self != NULL); if(Self->Queue != NULL) { FreePool(Self->Queue); Self->Queue = NULL; // Zombie catcher } FreePool(Self); } /** Empty the FIFO, discarding up to NumToFlush elements. @param[in] Self Pointer to the FIFO instance. @param[in] NumToFlush Number of elements to flush from the FIFO. If larger than the number of elements in the FIFO, the FIFO is emptied. @return Returns the number of elements remaining in the FIFO after the flush. **/ static size_t EFIAPI FIFO_Flush ( cFIFO *Self, size_t NumToFlush ) { size_t NumInQ; size_t Remainder; assert(Self != NULL); NumInQ = FIFO_NumInQueue(Self, AsElements); if(NumToFlush >= NumInQ) { Self->ReadIndex = 0; Self->WriteIndex = 0; Remainder = 0; } else { Remainder = FIFO_Reduce(Self, NumToFlush); } return Remainder; } /** Remove the most recently added element from the FIFO. @param[in] Self Pointer to the FIFO instance. @return Returns the number of elements remaining in the FIFO. **/ static size_t EFIAPI FIFO_Truncate ( cFIFO *Self ) { size_t Remainder; assert(Self != NULL); Remainder = FIFO_NumInQueue(Self, AsElements); if(Remainder > 0) { Self->WriteIndex = (UINT32)ModuloDecrement(Self->WriteIndex, Self->NumElements); --Remainder; } return Remainder; } /** Construct a new instance of a FIFO Queue. @param[in] NumElements Number of elements to be contained in the new FIFO. @param[in] ElementSize Size, in bytes, of an element. @retval NULL Unable to create the instance. @retval NonNULL Pointer to the new FIFO instance. **/ cFIFO * EFIAPI New_cFIFO( UINT32 NumElements, size_t ElementSize ) { cFIFO *FIFO; UINT8 *Queue; FIFO = NULL; if((NumElements > 2) && (ElementSize > 0)) { FIFO = (cFIFO *)AllocatePool(sizeof(cFIFO)); if(FIFO != NULL) { Queue = (UINT8 *)AllocateZeroPool(NumElements * ElementSize); if(Queue != NULL) { FIFO->Write = FIFO_Enqueue; FIFO->Read = FIFO_Read; FIFO->Copy = FIFO_Copy; FIFO->IsEmpty = FIFO_IsEmpty; FIFO->IsFull = FIFO_IsFull; FIFO->Count = FIFO_NumInQueue; FIFO->FreeSpace = FIFO_FreeSpace; FIFO->Flush = FIFO_Flush; FIFO->Truncate = FIFO_Truncate; FIFO->Delete = FIFO_Delete; FIFO->GetRDex = FIFO_GetRDex; FIFO->GetWDex = FIFO_GetWDex; FIFO->Queue = Queue; FIFO->ElementSize = (UINT32)ElementSize; FIFO->NumElements = (UINT32)NumElements; FIFO->ReadIndex = 0; FIFO->WriteIndex = 0; } else { FreePool(FIFO); FIFO = NULL; } } } return FIFO; }
[ "benoit.amiaux@gmail.com" ]
benoit.amiaux@gmail.com