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
25856d39072cd809560f75d1900ad20e0eed31d4
29835c831f9a9f21bdc23cc86be5a9621a12bb08
/inc/hw_sysctl.h
5747c05ba2757a489ac3779ad8ee32c824606a8c
[]
no_license
Lboyve/TM4C129X-EPI-uDMA
98785ad6c69c471bfefcd65b58243a1753427b5e
7268e6dfae1f53159ce226115b24c24dfaf36ec9
refs/heads/master
2016-09-05T23:09:25.337513
2015-08-27T01:07:49
2015-08-27T01:07:49
41,399,187
1
1
null
null
null
null
UTF-8
C
false
false
211,540
h
//***************************************************************************** // // hw_sysctl.h - Macros used when accessing the system control hardware. // // Copyright (c) 2005-2013 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated 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 // OWNER 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. // // This is part of revision 2.0 of the Tiva Firmware Development Package. // //***************************************************************************** #ifndef __HW_SYSCTL_H__ #define __HW_SYSCTL_H__ //***************************************************************************** // // The following are defines for the System Control register addresses. // //***************************************************************************** #define SYSCTL_DID0 0x400FE000 // Device Identification 0 #define SYSCTL_DID1 0x400FE004 // Device Identification 1 #define SYSCTL_DC0 0x400FE008 // Device Capabilities 0 #define SYSCTL_DC1 0x400FE010 // Device Capabilities 1 #define SYSCTL_DC2 0x400FE014 // Device Capabilities 2 #define SYSCTL_DC3 0x400FE018 // Device Capabilities 3 #define SYSCTL_DC4 0x400FE01C // Device Capabilities 4 #define SYSCTL_DC5 0x400FE020 // Device Capabilities 5 #define SYSCTL_DC6 0x400FE024 // Device Capabilities 6 #define SYSCTL_DC7 0x400FE028 // Device Capabilities 7 #define SYSCTL_DC8 0x400FE02C // Device Capabilities 8 ADC // Channels #define SYSCTL_PBORCTL 0x400FE030 // Brown-Out Reset Control #define SYSCTL_PTBOCTL 0x400FE038 // Power-Temp Brown Out Control #define SYSCTL_SRCR0 0x400FE040 // Software Reset Control 0 #define SYSCTL_SRCR1 0x400FE044 // Software Reset Control 1 #define SYSCTL_SRCR2 0x400FE048 // Software Reset Control 2 #define SYSCTL_RIS 0x400FE050 // Raw Interrupt Status #define SYSCTL_IMC 0x400FE054 // Interrupt Mask Control #define SYSCTL_MISC 0x400FE058 // Masked Interrupt Status and // Clear #define SYSCTL_RESC 0x400FE05C // Reset Cause #define SYSCTL_PWRTC 0x400FE060 // Power-Temperature Cause #define SYSCTL_RCC 0x400FE060 // Run-Mode Clock Configuration #define SYSCTL_NMIC 0x400FE064 // NMI Cause Register #define SYSCTL_GPIOHBCTL 0x400FE06C // GPIO High-Performance Bus // Control #define SYSCTL_RCC2 0x400FE070 // Run-Mode Clock Configuration 2 #define SYSCTL_MOSCCTL 0x400FE07C // Main Oscillator Control #define SYSCTL_RSCLKCFG 0x400FE0B0 // Run and Sleep Mode Configuration // Register #define SYSCTL_MEMTIM0 0x400FE0C0 // Memory Timing Parameter Register // 0 for Main Flash and EEPROM #define SYSCTL_DSMEMTIM0 0x400FE0C8 // Deep Sleep Mode Memory Timing // Register 0 for Main Flash and // EEPROM #define SYSCTL_RCGC0 0x400FE100 // Run Mode Clock Gating Control // Register 0 #define SYSCTL_RCGC1 0x400FE104 // Run Mode Clock Gating Control // Register 1 #define SYSCTL_RCGC2 0x400FE108 // Run Mode Clock Gating Control // Register 2 #define SYSCTL_SCGC0 0x400FE110 // Sleep Mode Clock Gating Control // Register 0 #define SYSCTL_SCGC1 0x400FE114 // Sleep Mode Clock Gating Control // Register 1 #define SYSCTL_SCGC2 0x400FE118 // Sleep Mode Clock Gating Control // Register 2 #define SYSCTL_DCGC0 0x400FE120 // Deep Sleep Mode Clock Gating // Control Register 0 #define SYSCTL_DCGC1 0x400FE124 // Deep-Sleep Mode Clock Gating // Control Register 1 #define SYSCTL_DCGC2 0x400FE128 // Deep Sleep Mode Clock Gating // Control Register 2 #define SYSCTL_ALTCLKCFG 0x400FE138 // Alternate Clock Configuration #define SYSCTL_DSLPCLKCFG 0x400FE144 // Deep Sleep Clock Configuration #define SYSCTL_DSCLKCFG 0x400FE144 // Deep Sleep Clock Configuration // Register #define SYSCTL_DIVSCLK 0x400FE148 // Divisor and Source Clock // Configuration #define SYSCTL_SYSPROP 0x400FE14C // System Properties #define SYSCTL_PIOSCCAL 0x400FE150 // Precision Internal Oscillator // Calibration #define SYSCTL_PIOSCSTAT 0x400FE154 // Precision Internal Oscillator // Statistics #define SYSCTL_PLLFREQ0 0x400FE160 // PLL Frequency 0 #define SYSCTL_PLLFREQ1 0x400FE164 // PLL Frequency 1 #define SYSCTL_PLLSTAT 0x400FE168 // PLL Status #define SYSCTL_DC9 0x400FE190 // Device Capabilities 9 ADC // Digital Comparators #define SYSCTL_NVMSTAT 0x400FE1A0 // Non-Volatile Memory Information #define SYSCTL_RESBEHAVCTL 0x400FE1D8 // Reset Behavior Control Register #define SYSCTL_HSSR 0x400FE1F4 // Hardware System Service Request #define SYSCTL_USBPDS 0x400FE280 // USB Power Domain Status #define SYSCTL_USBMPC 0x400FE284 // USB Memory Power Control #define SYSCTL_EMACPDS 0x400FE288 // Ethernet MAC Power Domain Status #define SYSCTL_EMACMPC 0x400FE28C // Ethernet MAC Memory Power // Control #define SYSCTL_LCDMPC 0x400FE294 // LCD Memory Power Control #define SYSCTL_PPWD 0x400FE300 // Watchdog Timer Peripheral // Present #define SYSCTL_PPTIMER 0x400FE304 // Timer Peripheral Present #define SYSCTL_PPGPIO 0x400FE308 // General-Purpose Input/Output // Peripheral Present #define SYSCTL_PPDMA 0x400FE30C // Micro Direct Memory Access // Peripheral Present #define SYSCTL_PPEPI 0x400FE310 // EPI Peripheral Present -SCPL #define SYSCTL_PPHIB 0x400FE314 // Hibernation Peripheral Present #define SYSCTL_PPUART 0x400FE318 // Universal Asynchronous // Receiver/Transmitter Peripheral // Present #define SYSCTL_PPSSI 0x400FE31C // Synchronous Serial Interface // Peripheral Present #define SYSCTL_PPI2C 0x400FE320 // Inter-Integrated Circuit // Peripheral Present #define SYSCTL_PPUSB 0x400FE328 // Universal Serial Bus Peripheral // Present #define SYSCTL_PPEPHY 0x400FE330 // Ethernet PHY Peripheral Present #define SYSCTL_PPCAN 0x400FE334 // Controller Area Network // Peripheral Present #define SYSCTL_PPADC 0x400FE338 // Analog-to-Digital Converter // Peripheral Present #define SYSCTL_PPACMP 0x400FE33C // Analog Comparator Peripheral // Present #define SYSCTL_PPPWM 0x400FE340 // Pulse Width Modulator Peripheral // Present #define SYSCTL_PPQEI 0x400FE344 // Quadrature Encoder Interface // Peripheral Present #define SYSCTL_PPFAN 0x400FE354 // Fan Control Peripheral Present #define SYSCTL_PPEEPROM 0x400FE358 // EEPROM Peripheral Present #define SYSCTL_PPWTIMER 0x400FE35C // Wide Timer Peripheral Present #define SYSCTL_PPRTS 0x400FE370 // Remote Temperature Sensor // Peripheral Present -SCPL #define SYSCTL_PPCCM 0x400FE374 // CRC and Cryptographic Modules // Peripheral Present #define SYSCTL_PPLCD 0x400FE390 // LCD Peripheral Present - INIT // ROM #define SYSCTL_PPOWIRE 0x400FE398 // One-Wire Peripheral Present // -SCPL #define SYSCTL_PPEMAC 0x400FE39C // Ethernet MAC Peripheral Present #define SYSCTL_PPHIM 0x400FE3A4 // Human Interface Master // Peripheral Present -SCPL #define SYSCTL_SRWD 0x400FE500 // Watchdog Timer Software Reset #define SYSCTL_SRTIMER 0x400FE504 // Timer Software Reset #define SYSCTL_SRGPIO 0x400FE508 // General-Purpose Input/Output // Software Reset #define SYSCTL_SRDMA 0x400FE50C // Micro Direct Memory Access // Software Reset #define SYSCTL_SREPI 0x400FE510 // EPI Software Reset #define SYSCTL_SRHIB 0x400FE514 // Hibernation Software Reset #define SYSCTL_SRUART 0x400FE518 // Universal Asynchronous // Receiver/Transmitter Software // Reset #define SYSCTL_SRSSI 0x400FE51C // Synchronous Serial Interface // Software Reset #define SYSCTL_SRI2C 0x400FE520 // Inter-Integrated Circuit // Software Reset #define SYSCTL_SRUSB 0x400FE528 // Universal Serial Bus Software // Reset #define SYSCTL_SREPHY 0x400FE530 // Ethernet PHY Software Reset #define SYSCTL_SRCAN 0x400FE534 // Controller Area Network Software // Reset #define SYSCTL_SRADC 0x400FE538 // Analog-to-Digital Converter // Software Reset #define SYSCTL_SRACMP 0x400FE53C // Analog Comparator Software Reset #define SYSCTL_SRPWM 0x400FE540 // Pulse Width Modulator Software // Reset #define SYSCTL_SRQEI 0x400FE544 // Quadrature Encoder Interface // Software Reset #define SYSCTL_SRFAN 0x400FE554 // Fan Software Reset #define SYSCTL_SREEPROM 0x400FE558 // EEPROM Software Reset #define SYSCTL_SRWTIMER 0x400FE55C // Wide Timer Software Reset #define SYSCTL_SRCCM 0x400FE574 // CRC and Cryptographic Modules // Software Reset #define SYSCTL_SRLCD 0x400FE590 // LCD Controller Software Reset #define SYSCTL_SROWIRE 0x400FE598 // One-Wire Software Reset #define SYSCTL_SREMAC 0x400FE59C // Ethernet MAC Software Reset #define SYSCTL_SRHIM 0x400FE5A4 // Human Interface Master Software // Reset #define SYSCTL_RCGCWD 0x400FE600 // Watchdog Timer Run Mode Clock // Gating Control #define SYSCTL_RCGCTIMER 0x400FE604 // Timer Run Mode Clock Gating // Control #define SYSCTL_RCGCGPIO 0x400FE608 // General-Purpose Input/Output Run // Mode Clock Gating Control #define SYSCTL_RCGCDMA 0x400FE60C // Micro Direct Memory Access Run // Mode Clock Gating Control #define SYSCTL_RCGCEPI 0x400FE610 // EPI Run Mode Clock Gating // Control #define SYSCTL_RCGCHIB 0x400FE614 // Hibernation Run Mode Clock // Gating Control #define SYSCTL_RCGCUART 0x400FE618 // Universal Asynchronous // Receiver/Transmitter Run Mode // Clock Gating Control #define SYSCTL_RCGCSSI 0x400FE61C // Synchronous Serial Interface Run // Mode Clock Gating Control #define SYSCTL_RCGCI2C 0x400FE620 // Inter-Integrated Circuit Run // Mode Clock Gating Control #define SYSCTL_RCGCUSB 0x400FE628 // Universal Serial Bus Run Mode // Clock Gating Control #define SYSCTL_RCGCEPHY 0x400FE630 // Ethernet PHY Run Mode Clock // Gating Control #define SYSCTL_RCGCCAN 0x400FE634 // Controller Area Network Run Mode // Clock Gating Control #define SYSCTL_RCGCADC 0x400FE638 // Analog-to-Digital Converter Run // Mode Clock Gating Control #define SYSCTL_RCGCACMP 0x400FE63C // Analog Comparator Run Mode Clock // Gating Control #define SYSCTL_RCGCPWM 0x400FE640 // Pulse Width Modulator Run Mode // Clock Gating Control #define SYSCTL_RCGCQEI 0x400FE644 // Quadrature Encoder Interface Run // Mode Clock Gating Control #define SYSCTL_RCGCFAN 0x400FE654 // Fan Run Mode Clock Gating // Control #define SYSCTL_RCGCEEPROM 0x400FE658 // EEPROM Run Mode Clock Gating // Control #define SYSCTL_RCGCWTIMER 0x400FE65C // Wide Timer Run Mode Clock Gating // Control #define SYSCTL_RCGCCCM 0x400FE674 // CRC and Cryptographic Modules // Run Mode Clock Gating Control #define SYSCTL_RCGCLCD 0x400FE690 // LCD Controller Run Mode Clock // Gating Control #define SYSCTL_RCGCOWIRE 0x400FE698 // One-Wire Run Mode Clock Gating // Control #define SYSCTL_RCGCEMAC 0x400FE69C // Ethernet MAC Run Mode Clock // Gating Control #define SYSCTL_RCGCHIM 0x400FE6A4 // Human Interface Master Run Mode // Clock Gating Control #define SYSCTL_SCGCWD 0x400FE700 // Watchdog Timer Sleep Mode Clock // Gating Control #define SYSCTL_SCGCTIMER 0x400FE704 // Timer Sleep Mode Clock Gating // Control #define SYSCTL_SCGCGPIO 0x400FE708 // General-Purpose Input/Output // Sleep Mode Clock Gating Control #define SYSCTL_SCGCDMA 0x400FE70C // Micro Direct Memory Access Sleep // Mode Clock Gating Control #define SYSCTL_SCGCEPI 0x400FE710 // EPI Sleep Mode Clock Gating // Control #define SYSCTL_SCGCHIB 0x400FE714 // Hibernation Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART 0x400FE718 // Universal Asynchronous // Receiver/Transmitter Sleep Mode // Clock Gating Control #define SYSCTL_SCGCSSI 0x400FE71C // Synchronous Serial Interface // Sleep Mode Clock Gating Control #define SYSCTL_SCGCI2C 0x400FE720 // Inter-Integrated Circuit Sleep // Mode Clock Gating Control #define SYSCTL_SCGCUSB 0x400FE728 // Universal Serial Bus Sleep Mode // Clock Gating Control #define SYSCTL_SCGCEPHY 0x400FE730 // Ethernet PHY Sleep Mode Clock // Gating Control #define SYSCTL_SCGCCAN 0x400FE734 // Controller Area Network Sleep // Mode Clock Gating Control #define SYSCTL_SCGCADC 0x400FE738 // Analog-to-Digital Converter // Sleep Mode Clock Gating Control #define SYSCTL_SCGCACMP 0x400FE73C // Analog Comparator Sleep Mode // Clock Gating Control #define SYSCTL_SCGCPWM 0x400FE740 // Pulse Width Modulator Sleep Mode // Clock Gating Control #define SYSCTL_SCGCQEI 0x400FE744 // Quadrature Encoder Interface // Sleep Mode Clock Gating Control #define SYSCTL_SCGCFAN 0x400FE754 // Fan Sleep Mode Clock Gating // Control #define SYSCTL_SCGCEEPROM 0x400FE758 // EEPROM Sleep Mode Clock Gating // Control #define SYSCTL_SCGCWTIMER 0x400FE75C // Wide Timer Sleep Mode Clock // Gating Control #define SYSCTL_SCGCCCM 0x400FE774 // CRC and Cryptographic Modules // Sleep Mode Clock Gating Control #define SYSCTL_SCGCLCD 0x400FE790 // LCD Controller Sleep Mode Clock // Gating Control #define SYSCTL_SCGCOWIRE 0x400FE798 // One-Wire Sleep Mode Clock Gating // Control #define SYSCTL_SCGCEMAC 0x400FE79C // Ethernet MAC Sleep Mode Clock // Gating Control #define SYSCTL_SCGCHIM 0x400FE7A4 // Human Interface Master Sleep // Mode Clock Gating Control #define SYSCTL_DCGCWD 0x400FE800 // Watchdog Timer Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCTIMER 0x400FE804 // Timer Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCGPIO 0x400FE808 // General-Purpose Input/Output // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCDMA 0x400FE80C // Micro Direct Memory Access // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCEPI 0x400FE810 // EPI Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCHIB 0x400FE814 // Hibernation Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART 0x400FE818 // Universal Asynchronous // Receiver/Transmitter Deep-Sleep // Mode Clock Gating Control #define SYSCTL_DCGCSSI 0x400FE81C // Synchronous Serial Interface // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCI2C 0x400FE820 // Inter-Integrated Circuit // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCUSB 0x400FE828 // Universal Serial Bus Deep-Sleep // Mode Clock Gating Control #define SYSCTL_DCGCEPHY 0x400FE830 // Ethernet PHY Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCCAN 0x400FE834 // Controller Area Network // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCADC 0x400FE838 // Analog-to-Digital Converter // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCACMP 0x400FE83C // Analog Comparator Deep-Sleep // Mode Clock Gating Control #define SYSCTL_DCGCPWM 0x400FE840 // Pulse Width Modulator Deep-Sleep // Mode Clock Gating Control #define SYSCTL_DCGCQEI 0x400FE844 // Quadrature Encoder Interface // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCFAN 0x400FE854 // Fan Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCEEPROM 0x400FE858 // EEPROM Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCWTIMER 0x400FE85C // Wide Timer Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCCCM 0x400FE874 // CRC and Cryptographic Modules // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCLCD 0x400FE890 // LCD Controller Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCOWIRE 0x400FE898 // One-Wire Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCEMAC 0x400FE89C // Ethernet MAC Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCHIM 0x400FE8A4 // Human Interface Master // Deep-Sleep Mode Clock Gating // Control #define SYSCTL_PCWD 0x400FE900 // Watchdog Timer Power Control #define SYSCTL_PCTIMER 0x400FE904 // 16/32-Bit General-Purpose Timer // Power Control #define SYSCTL_PCGPIO 0x400FE908 // General-Purpose Input/Output // Power Control #define SYSCTL_PCDMA 0x400FE90C // Micro Direct Memory Access Power // Control #define SYSCTL_PCEPI 0x400FE910 // External Peripheral Interface // Power Control #define SYSCTL_PCHIB 0x400FE914 // Hibernation Power Control #define SYSCTL_PCUART 0x400FE918 // Universal Asynchronous // Receiver/Transmitter Power // Control #define SYSCTL_PCSSI 0x400FE91C // Synchronous Serial Interface // Power Control #define SYSCTL_PCI2C 0x400FE920 // Inter-Integrated Circuit Power // Control #define SYSCTL_PCUSB 0x400FE928 // Universal Serial Bus Power // Control #define SYSCTL_PCEPHY 0x400FE930 // Ethernet PHY Power Control #define SYSCTL_PCCAN 0x400FE934 // Controller Area Network Power // Control #define SYSCTL_PCADC 0x400FE938 // Analog-to-Digital Converter // Power Control #define SYSCTL_PCACMP 0x400FE93C // Analog Comparator Power Control #define SYSCTL_PCPWM 0x400FE940 // Pulse Width Modulator Power // Control #define SYSCTL_PCQEI 0x400FE944 // Quadrature Encoder Interface // Power Control #define SYSCTL_PCFAN 0x400FE954 // Fan Power Control #define SYSCTL_PCEEPROM 0x400FE958 // EEPROM Power Control #define SYSCTL_PCCCM 0x400FE974 // CRC and Cryptographic Modules // Power Control #define SYSCTL_PCLCD 0x400FE990 // LCD Controller Power Control #define SYSCTL_PCOWIRE 0x400FE998 // 1-Wire Power Control #define SYSCTL_PCEMAC 0x400FE99C // Ethernet MAC Power Control #define SYSCTL_PCHIM 0x400FE9A4 // Human Interface Master Power // Control #define SYSCTL_PRWD 0x400FEA00 // Watchdog Timer Peripheral Ready #define SYSCTL_PRTIMER 0x400FEA04 // Timer Peripheral Ready #define SYSCTL_PRGPIO 0x400FEA08 // General-Purpose Input/Output // Peripheral Ready #define SYSCTL_PRDMA 0x400FEA0C // Micro Direct Memory Access // Peripheral Ready #define SYSCTL_PREPI 0x400FEA10 // EPI Peripheral Ready #define SYSCTL_PRHIB 0x400FEA14 // Hibernation Peripheral Ready #define SYSCTL_PRUART 0x400FEA18 // Universal Asynchronous // Receiver/Transmitter Peripheral // Ready #define SYSCTL_PRSSI 0x400FEA1C // Synchronous Serial Interface // Peripheral Ready #define SYSCTL_PRI2C 0x400FEA20 // Inter-Integrated Circuit // Peripheral Ready #define SYSCTL_PRUSB 0x400FEA28 // Universal Serial Bus Peripheral // Ready #define SYSCTL_PREPHY 0x400FEA30 // Ethernet PHY Peripheral Ready #define SYSCTL_PRCAN 0x400FEA34 // Controller Area Network // Peripheral Ready #define SYSCTL_PRADC 0x400FEA38 // Analog-to-Digital Converter // Peripheral Ready #define SYSCTL_PRACMP 0x400FEA3C // Analog Comparator Peripheral // Ready #define SYSCTL_PRPWM 0x400FEA40 // Pulse Width Modulator Peripheral // Ready #define SYSCTL_PRQEI 0x400FEA44 // Quadrature Encoder Interface // Peripheral Ready #define SYSCTL_PRFAN 0x400FEA54 // Fan Peripheral Ready #define SYSCTL_PREEPROM 0x400FEA58 // EEPROM Peripheral Ready #define SYSCTL_PRWTIMER 0x400FEA5C // Wide Timer Peripheral Ready #define SYSCTL_PRCCM 0x400FEA74 // CRC and Cryptographic Modules // Peripheral Ready #define SYSCTL_PRLCD 0x400FEA90 // LCD Controller Peripheral Ready #define SYSCTL_PROWIRE 0x400FEA98 // One-Wire Peripheral Ready #define SYSCTL_PREMAC 0x400FEA9C // Ethernet MAC Peripheral Ready #define SYSCTL_PRHIM 0x400FEAA4 // Human Interface Master // Peripheral Ready #define SYSCTL_CCMCGREQ 0x44030204 // Cryptographic Modules Clock // Gating Request //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DID0 register. // //***************************************************************************** #define SYSCTL_DID0_VER_M 0x70000000 // DID0 Version #define SYSCTL_DID0_VER_1 0x10000000 // Second version of the DID0 // register format #define SYSCTL_DID0_CLASS_M 0x00FF0000 // Device Class #define SYSCTL_DID0_CLASS_BLIZZARD \ 0x00050000 // Tiva(TM) C Series Blizzard-class // microcontrollers #define SYSCTL_DID0_CLASS_SNOWFLAKE \ 0x000A0000 // Tiva(TM) C Series // Snowflake-class microcontrollers #define SYSCTL_DID0_MAJ_M 0x0000FF00 // Major Revision #define SYSCTL_DID0_MAJ_REVA 0x00000000 // Revision A (initial device) #define SYSCTL_DID0_MAJ_REVB 0x00000100 // Revision B (first base layer // revision) #define SYSCTL_DID0_MAJ_REVC 0x00000200 // Revision C (second base layer // revision) #define SYSCTL_DID0_MIN_M 0x000000FF // Minor Revision #define SYSCTL_DID0_MIN_0 0x00000000 // Initial device, or a major // revision update #define SYSCTL_DID0_MIN_1 0x00000001 // First metal layer change #define SYSCTL_DID0_MIN_2 0x00000002 // Second metal layer change //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DID1 register. // //***************************************************************************** #define SYSCTL_DID1_VER_M 0xF0000000 // DID1 Version #define SYSCTL_DID1_VER_1 0x10000000 // Second version of the DID1 // register format #define SYSCTL_DID1_FAM_M 0x0F000000 // Family #define SYSCTL_DID1_FAM_TIVA 0x00000000 // Tiva family of microcontollers #define SYSCTL_DID1_PRTNO_M 0x00FF0000 // Part Number #define SYSCTL_DID1_PRTNO_SC4CE290NCPZ \ 0x00C80000 // SC4CE290NCPZ #define SYSCTL_DID1_PRTNO_TM4C1230C3PM \ 0x00220000 // TM4C1230C3PM #define SYSCTL_DID1_PRTNO_TM4C1230D5PM \ 0x00230000 // TM4C1230D5PM #define SYSCTL_DID1_PRTNO_TM4C1230E6PM \ 0x00200000 // TM4C1230E6PM #define SYSCTL_DID1_PRTNO_TM4C1230H6PM \ 0x00210000 // TM4C1230H6PM #define SYSCTL_DID1_PRTNO_TM4C1231C3PM \ 0x00180000 // TM4C1231C3PM #define SYSCTL_DID1_PRTNO_TM4C1231D5PM \ 0x00190000 // TM4C1231D5PM #define SYSCTL_DID1_PRTNO_TM4C1231D5PZ \ 0x00360000 // TM4C1231D5PZ #define SYSCTL_DID1_PRTNO_TM4C1231E6PM \ 0x00100000 // TM4C1231E6PM #define SYSCTL_DID1_PRTNO_TM4C1231E6PZ \ 0x00300000 // TM4C1231E6PZ #define SYSCTL_DID1_PRTNO_TM4C1231H6PGE \ 0x00350000 // TM4C1231H6PGE #define SYSCTL_DID1_PRTNO_TM4C1231H6PM \ 0x00110000 // TM4C1231H6PM #define SYSCTL_DID1_PRTNO_TM4C1231H6PZ \ 0x00310000 // TM4C1231H6PZ #define SYSCTL_DID1_PRTNO_TM4C1232C3PM \ 0x00080000 // TM4C1232C3PM #define SYSCTL_DID1_PRTNO_TM4C1232D5PM \ 0x00090000 // TM4C1232D5PM #define SYSCTL_DID1_PRTNO_TM4C1232E6PM \ 0x000A0000 // TM4C1232E6PM #define SYSCTL_DID1_PRTNO_TM4C1232H6PM \ 0x000B0000 // TM4C1232H6PM #define SYSCTL_DID1_PRTNO_TM4C1233C3PM \ 0x00010000 // TM4C1233C3PM #define SYSCTL_DID1_PRTNO_TM4C1233D5PM \ 0x00020000 // TM4C1233D5PM #define SYSCTL_DID1_PRTNO_TM4C1233D5PZ \ 0x00D00000 // TM4C1233D5PZ #define SYSCTL_DID1_PRTNO_TM4C1233E6PM \ 0x00030000 // TM4C1233E6PM #define SYSCTL_DID1_PRTNO_TM4C1233E6PZ \ 0x00D10000 // TM4C1233E6PZ #define SYSCTL_DID1_PRTNO_TM4C1233H6PGE \ 0x00D60000 // TM4C1233H6PGE #define SYSCTL_DID1_PRTNO_TM4C1233H6PM \ 0x00040000 // TM4C1233H6PM #define SYSCTL_DID1_PRTNO_TM4C1233H6PZ \ 0x00D20000 // TM4C1233H6PZ #define SYSCTL_DID1_PRTNO_TM4C1236D5PM \ 0x00520000 // TM4C1236D5PM #define SYSCTL_DID1_PRTNO_TM4C1236E6PM \ 0x00500000 // TM4C1236E6PM #define SYSCTL_DID1_PRTNO_TM4C1236H6PM \ 0x00510000 // TM4C1236H6PM #define SYSCTL_DID1_PRTNO_TM4C1237D5PM \ 0x00480000 // TM4C1237D5PM #define SYSCTL_DID1_PRTNO_TM4C1237D5PZ \ 0x00660000 // TM4C1237D5PZ #define SYSCTL_DID1_PRTNO_TM4C1237E6PM \ 0x00400000 // TM4C1237E6PM #define SYSCTL_DID1_PRTNO_TM4C1237E6PZ \ 0x00600000 // TM4C1237E6PZ #define SYSCTL_DID1_PRTNO_TM4C1237H6PGE \ 0x00650000 // TM4C1237H6PGE #define SYSCTL_DID1_PRTNO_TM4C1237H6PM \ 0x00410000 // TM4C1237H6PM #define SYSCTL_DID1_PRTNO_TM4C1237H6PZ \ 0x00610000 // TM4C1237H6PZ #define SYSCTL_DID1_PRTNO_TM4C123AE6PM \ 0x00800000 // TM4C123AE6PM #define SYSCTL_DID1_PRTNO_TM4C123AH6PM \ 0x00830000 // TM4C123AH6PM #define SYSCTL_DID1_PRTNO_TM4C123BE6PM \ 0x00700000 // TM4C123BE6PM #define SYSCTL_DID1_PRTNO_TM4C123BE6PZ \ 0x00C30000 // TM4C123BE6PZ #define SYSCTL_DID1_PRTNO_TM4C123BH6PGE \ 0x00C60000 // TM4C123BH6PGE #define SYSCTL_DID1_PRTNO_TM4C123BH6PM \ 0x00730000 // TM4C123BH6PM #define SYSCTL_DID1_PRTNO_TM4C123BH6PZ \ 0x00C40000 // TM4C123BH6PZ #define SYSCTL_DID1_PRTNO_TM4C123BH6ZRB \ 0x00E90000 // TM4C123BH6ZRB #define SYSCTL_DID1_PRTNO_TM4C123FE6PM \ 0x00B00000 // TM4C123FE6PM #define SYSCTL_DID1_PRTNO_TM4C123FH6PM \ 0x00B10000 // TM4C123FH6PM #define SYSCTL_DID1_PRTNO_TM4C123GE6PM \ 0x00A00000 // TM4C123GE6PM #define SYSCTL_DID1_PRTNO_TM4C123GE6PZ \ 0x00C00000 // TM4C123GE6PZ #define SYSCTL_DID1_PRTNO_TM4C123GH6PGE \ 0x00C50000 // TM4C123GH6PGE #define SYSCTL_DID1_PRTNO_TM4C123GH6PM \ 0x00A10000 // TM4C123GH6PM #define SYSCTL_DID1_PRTNO_TM4C123GH6PZ \ 0x00C10000 // TM4C123GH6PZ #define SYSCTL_DID1_PRTNO_TM4C123GH6ZRB \ 0x00E30000 // TM4C123GH6ZRB #define SYSCTL_DID1_PRTNO_TM4C1290NCPDT \ 0x00190000 // TM4C1290NCPDT #define SYSCTL_DID1_PRTNO_TM4C1290NCZAD \ 0x001B0000 // TM4C1290NCZAD #define SYSCTL_DID1_PRTNO_TM4C1292NCPDT \ 0x001C0000 // TM4C1292NCPDT #define SYSCTL_DID1_PRTNO_TM4C1292NCZAD \ 0x001E0000 // TM4C1292NCZAD #define SYSCTL_DID1_PRTNO_TM4C1294NCPDT \ 0x001F0000 // TM4C1294NCPDT #define SYSCTL_DID1_PRTNO_TM4C1294NCZAD \ 0x00210000 // TM4C1294NCZAD #define SYSCTL_DID1_PRTNO_TM4C129CNCPDT \ 0x00240000 // TM4C129CNCPDT #define SYSCTL_DID1_PRTNO_TM4C129CNCZAD \ 0x00260000 // TM4C129CNCZAD #define SYSCTL_DID1_PRTNO_TM4C129DNCPDT \ 0x00270000 // TM4C129DNCPDT #define SYSCTL_DID1_PRTNO_TM4C129DNCZAD \ 0x00290000 // TM4C129DNCZAD #define SYSCTL_DID1_PRTNO_TM4C129ENCPDT \ 0x002D0000 // TM4C129ENCPDT #define SYSCTL_DID1_PRTNO_TM4C129ENCZAD \ 0x002F0000 // TM4C129ENCZAD #define SYSCTL_DID1_PRTNO_TM4C129XNCZAD \ 0x00320000 // TM4C129XNCZAD #define SYSCTL_DID1_PINCNT_M 0x0000E000 // Package Pin Count #define SYSCTL_DID1_PINCNT_28 0x00000000 // 28-pin package #define SYSCTL_DID1_PINCNT_48 0x00002000 // 48-pin package #define SYSCTL_DID1_PINCNT_100 0x00004000 // 100-pin package #define SYSCTL_DID1_PINCNT_64 0x00006000 // 64-pin package #define SYSCTL_DID1_PINCNT_144 0x00008000 // 144-pin package #define SYSCTL_DID1_PINCNT_157 0x0000A000 // 157-pin package #define SYSCTL_DID1_PINCNT_128 0x0000C000 // 128-pin package #define SYSCTL_DID1_TEMP_M 0x000000E0 // Temperature Range #define SYSCTL_DID1_TEMP_C 0x00000000 // Commercial temperature range (0C // to 70C) #define SYSCTL_DID1_TEMP_I 0x00000020 // Industrial temperature range // (-40C to 85C) #define SYSCTL_DID1_TEMP_E 0x00000040 // Extended temperature range (-40C // to 105C) #define SYSCTL_DID1_PKG_M 0x00000018 // Package Type #define SYSCTL_DID1_PKG_SOIC 0x00000000 // SOIC package #define SYSCTL_DID1_PKG_QFP 0x00000008 // LQFP package #define SYSCTL_DID1_PKG_BGA 0x00000010 // BGA package #define SYSCTL_DID1_PKG_TQFP 0x00000028 // TQFP package #define SYSCTL_DID1_ROHS 0x00000004 // RoHS-Compliance #define SYSCTL_DID1_QUAL_M 0x00000003 // Qualification Status #define SYSCTL_DID1_QUAL_ES 0x00000000 // Engineering Sample (unqualified) #define SYSCTL_DID1_QUAL_PP 0x00000001 // Pilot Production (unqualified) #define SYSCTL_DID1_QUAL_FQ 0x00000002 // Fully Qualified //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC0 register. // //***************************************************************************** #define SYSCTL_DC0_SRAMSZ_M 0xFFFF0000 // SRAM Size #define SYSCTL_DC0_SRAMSZ_2KB 0x00070000 // 2 KB of SRAM #define SYSCTL_DC0_SRAMSZ_4KB 0x000F0000 // 4 KB of SRAM #define SYSCTL_DC0_SRAMSZ_6KB 0x00170000 // 6 KB of SRAM #define SYSCTL_DC0_SRAMSZ_8KB 0x001F0000 // 8 KB of SRAM #define SYSCTL_DC0_SRAMSZ_12KB 0x002F0000 // 12 KB of SRAM #define SYSCTL_DC0_SRAMSZ_16KB 0x003F0000 // 16 KB of SRAM #define SYSCTL_DC0_SRAMSZ_20KB 0x004F0000 // 20 KB of SRAM #define SYSCTL_DC0_SRAMSZ_24KB 0x005F0000 // 24 KB of SRAM #define SYSCTL_DC0_SRAMSZ_32KB 0x007F0000 // 32 KB of SRAM #define SYSCTL_DC0_FLASHSZ_M 0x0000FFFF // Flash Size #define SYSCTL_DC0_FLASHSZ_8KB 0x00000003 // 8 KB of Flash #define SYSCTL_DC0_FLASHSZ_16KB 0x00000007 // 16 KB of Flash #define SYSCTL_DC0_FLASHSZ_32KB 0x0000000F // 32 KB of Flash #define SYSCTL_DC0_FLASHSZ_64KB 0x0000001F // 64 KB of Flash #define SYSCTL_DC0_FLASHSZ_96KB 0x0000002F // 96 KB of Flash #define SYSCTL_DC0_FLASHSZ_128K 0x0000003F // 128 KB of Flash #define SYSCTL_DC0_FLASHSZ_192K 0x0000005F // 192 KB of Flash #define SYSCTL_DC0_FLASHSZ_256K 0x0000007F // 256 KB of Flash //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC1 register. // //***************************************************************************** #define SYSCTL_DC1_WDT1 0x10000000 // Watchdog Timer1 Present #define SYSCTL_DC1_CAN1 0x02000000 // CAN Module 1 Present #define SYSCTL_DC1_CAN0 0x01000000 // CAN Module 0 Present #define SYSCTL_DC1_PWM1 0x00200000 // PWM Module 1 Present #define SYSCTL_DC1_PWM0 0x00100000 // PWM Module 0 Present #define SYSCTL_DC1_ADC1 0x00020000 // ADC Module 1 Present #define SYSCTL_DC1_ADC0 0x00010000 // ADC Module 0 Present #define SYSCTL_DC1_MINSYSDIV_M 0x0000F000 // System Clock Divider #define SYSCTL_DC1_MINSYSDIV_100 \ 0x00001000 // Divide VCO (400MHZ) by 5 minimum #define SYSCTL_DC1_MINSYSDIV_66 0x00002000 // Divide VCO (400MHZ) by 2*2 + 2 = // 6 minimum #define SYSCTL_DC1_MINSYSDIV_50 0x00003000 // Specifies a 50-MHz CPU clock // with a PLL divider of 4 #define SYSCTL_DC1_MINSYSDIV_40 0x00004000 // Specifies a 40-MHz CPU clock // with a PLL divider of 5 #define SYSCTL_DC1_MINSYSDIV_25 0x00007000 // Specifies a 25-MHz clock with a // PLL divider of 8 #define SYSCTL_DC1_MINSYSDIV_20 0x00009000 // Specifies a 20-MHz clock with a // PLL divider of 10 #define SYSCTL_DC1_ADC1SPD_M 0x00000C00 // Max ADC1 Speed #define SYSCTL_DC1_ADC1SPD_125K 0x00000000 // 125K samples/second #define SYSCTL_DC1_ADC1SPD_250K 0x00000400 // 250K samples/second #define SYSCTL_DC1_ADC1SPD_500K 0x00000800 // 500K samples/second #define SYSCTL_DC1_ADC1SPD_1M 0x00000C00 // 1M samples/second #define SYSCTL_DC1_ADC0SPD_M 0x00000300 // Max ADC0 Speed #define SYSCTL_DC1_ADC0SPD_125K 0x00000000 // 125K samples/second #define SYSCTL_DC1_ADC0SPD_250K 0x00000100 // 250K samples/second #define SYSCTL_DC1_ADC0SPD_500K 0x00000200 // 500K samples/second #define SYSCTL_DC1_ADC0SPD_1M 0x00000300 // 1M samples/second #define SYSCTL_DC1_MPU 0x00000080 // MPU Present #define SYSCTL_DC1_HIB 0x00000040 // Hibernation Module Present #define SYSCTL_DC1_TEMP 0x00000020 // Temp Sensor Present #define SYSCTL_DC1_PLL 0x00000010 // PLL Present #define SYSCTL_DC1_WDT0 0x00000008 // Watchdog Timer 0 Present #define SYSCTL_DC1_SWO 0x00000004 // SWO Trace Port Present #define SYSCTL_DC1_SWD 0x00000002 // SWD Present #define SYSCTL_DC1_JTAG 0x00000001 // JTAG Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC2 register. // //***************************************************************************** #define SYSCTL_DC2_EPI0 0x40000000 // EPI Module 0 Present #define SYSCTL_DC2_I2S0 0x10000000 // I2S Module 0 Present #define SYSCTL_DC2_COMP2 0x04000000 // Analog Comparator 2 Present #define SYSCTL_DC2_COMP1 0x02000000 // Analog Comparator 1 Present #define SYSCTL_DC2_COMP0 0x01000000 // Analog Comparator 0 Present #define SYSCTL_DC2_TIMER3 0x00080000 // Timer Module 3 Present #define SYSCTL_DC2_TIMER2 0x00040000 // Timer Module 2 Present #define SYSCTL_DC2_TIMER1 0x00020000 // Timer Module 1 Present #define SYSCTL_DC2_TIMER0 0x00010000 // Timer Module 0 Present #define SYSCTL_DC2_I2C1HS 0x00008000 // I2C Module 1 Speed #define SYSCTL_DC2_I2C1 0x00004000 // I2C Module 1 Present #define SYSCTL_DC2_I2C0HS 0x00002000 // I2C Module 0 Speed #define SYSCTL_DC2_I2C0 0x00001000 // I2C Module 0 Present #define SYSCTL_DC2_QEI1 0x00000200 // QEI Module 1 Present #define SYSCTL_DC2_QEI0 0x00000100 // QEI Module 0 Present #define SYSCTL_DC2_SSI1 0x00000020 // SSI Module 1 Present #define SYSCTL_DC2_SSI0 0x00000010 // SSI Module 0 Present #define SYSCTL_DC2_UART2 0x00000004 // UART Module 2 Present #define SYSCTL_DC2_UART1 0x00000002 // UART Module 1 Present #define SYSCTL_DC2_UART0 0x00000001 // UART Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC3 register. // //***************************************************************************** #define SYSCTL_DC3_32KHZ 0x80000000 // 32KHz Input Clock Available #define SYSCTL_DC3_CCP5 0x20000000 // CCP5 Pin Present #define SYSCTL_DC3_CCP4 0x10000000 // CCP4 Pin Present #define SYSCTL_DC3_CCP3 0x08000000 // CCP3 Pin Present #define SYSCTL_DC3_CCP2 0x04000000 // CCP2 Pin Present #define SYSCTL_DC3_CCP1 0x02000000 // CCP1 Pin Present #define SYSCTL_DC3_CCP0 0x01000000 // CCP0 Pin Present #define SYSCTL_DC3_ADC0AIN7 0x00800000 // ADC Module 0 AIN7 Pin Present #define SYSCTL_DC3_ADC0AIN6 0x00400000 // ADC Module 0 AIN6 Pin Present #define SYSCTL_DC3_ADC0AIN5 0x00200000 // ADC Module 0 AIN5 Pin Present #define SYSCTL_DC3_ADC0AIN4 0x00100000 // ADC Module 0 AIN4 Pin Present #define SYSCTL_DC3_ADC0AIN3 0x00080000 // ADC Module 0 AIN3 Pin Present #define SYSCTL_DC3_ADC0AIN2 0x00040000 // ADC Module 0 AIN2 Pin Present #define SYSCTL_DC3_ADC0AIN1 0x00020000 // ADC Module 0 AIN1 Pin Present #define SYSCTL_DC3_ADC0AIN0 0x00010000 // ADC Module 0 AIN0 Pin Present #define SYSCTL_DC3_PWMFAULT 0x00008000 // PWM Fault Pin Present #define SYSCTL_DC3_C2O 0x00004000 // C2o Pin Present #define SYSCTL_DC3_C2PLUS 0x00002000 // C2+ Pin Present #define SYSCTL_DC3_C2MINUS 0x00001000 // C2- Pin Present #define SYSCTL_DC3_C1O 0x00000800 // C1o Pin Present #define SYSCTL_DC3_C1PLUS 0x00000400 // C1+ Pin Present #define SYSCTL_DC3_C1MINUS 0x00000200 // C1- Pin Present #define SYSCTL_DC3_C0O 0x00000100 // C0o Pin Present #define SYSCTL_DC3_C0PLUS 0x00000080 // C0+ Pin Present #define SYSCTL_DC3_C0MINUS 0x00000040 // C0- Pin Present #define SYSCTL_DC3_PWM5 0x00000020 // PWM5 Pin Present #define SYSCTL_DC3_PWM4 0x00000010 // PWM4 Pin Present #define SYSCTL_DC3_PWM3 0x00000008 // PWM3 Pin Present #define SYSCTL_DC3_PWM2 0x00000004 // PWM2 Pin Present #define SYSCTL_DC3_PWM1 0x00000002 // PWM1 Pin Present #define SYSCTL_DC3_PWM0 0x00000001 // PWM0 Pin Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC4 register. // //***************************************************************************** #define SYSCTL_DC4_EPHY0 0x40000000 // Ethernet PHY Layer 0 Present #define SYSCTL_DC4_EMAC0 0x10000000 // Ethernet MAC Layer 0 Present #define SYSCTL_DC4_E1588 0x01000000 // 1588 Capable #define SYSCTL_DC4_PICAL 0x00040000 // PIOSC Calibrate #define SYSCTL_DC4_CCP7 0x00008000 // CCP7 Pin Present #define SYSCTL_DC4_CCP6 0x00004000 // CCP6 Pin Present #define SYSCTL_DC4_UDMA 0x00002000 // Micro-DMA Module Present #define SYSCTL_DC4_ROM 0x00001000 // Internal Code ROM Present #define SYSCTL_DC4_GPIOJ 0x00000100 // GPIO Port J Present #define SYSCTL_DC4_GPIOH 0x00000080 // GPIO Port H Present #define SYSCTL_DC4_GPIOG 0x00000040 // GPIO Port G Present #define SYSCTL_DC4_GPIOF 0x00000020 // GPIO Port F Present #define SYSCTL_DC4_GPIOE 0x00000010 // GPIO Port E Present #define SYSCTL_DC4_GPIOD 0x00000008 // GPIO Port D Present #define SYSCTL_DC4_GPIOC 0x00000004 // GPIO Port C Present #define SYSCTL_DC4_GPIOB 0x00000002 // GPIO Port B Present #define SYSCTL_DC4_GPIOA 0x00000001 // GPIO Port A Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC5 register. // //***************************************************************************** #define SYSCTL_DC5_PWMFAULT3 0x08000000 // PWM Fault 3 Pin Present #define SYSCTL_DC5_PWMFAULT2 0x04000000 // PWM Fault 2 Pin Present #define SYSCTL_DC5_PWMFAULT1 0x02000000 // PWM Fault 1 Pin Present #define SYSCTL_DC5_PWMFAULT0 0x01000000 // PWM Fault 0 Pin Present #define SYSCTL_DC5_PWMEFLT 0x00200000 // PWM Extended Fault Active #define SYSCTL_DC5_PWMESYNC 0x00100000 // PWM Extended SYNC Active #define SYSCTL_DC5_PWM7 0x00000080 // PWM7 Pin Present #define SYSCTL_DC5_PWM6 0x00000040 // PWM6 Pin Present #define SYSCTL_DC5_PWM5 0x00000020 // PWM5 Pin Present #define SYSCTL_DC5_PWM4 0x00000010 // PWM4 Pin Present #define SYSCTL_DC5_PWM3 0x00000008 // PWM3 Pin Present #define SYSCTL_DC5_PWM2 0x00000004 // PWM2 Pin Present #define SYSCTL_DC5_PWM1 0x00000002 // PWM1 Pin Present #define SYSCTL_DC5_PWM0 0x00000001 // PWM0 Pin Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC6 register. // //***************************************************************************** #define SYSCTL_DC6_USB0PHY 0x00000010 // USB Module 0 PHY Present #define SYSCTL_DC6_USB0_M 0x00000003 // USB Module 0 Present #define SYSCTL_DC6_USB0_DEV 0x00000001 // USB0 is Device Only #define SYSCTL_DC6_USB0_HOSTDEV 0x00000002 // USB is Device or Host #define SYSCTL_DC6_USB0_OTG 0x00000003 // USB0 is OTG //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC7 register. // //***************************************************************************** #define SYSCTL_DC7_DMACH30 0x40000000 // SW #define SYSCTL_DC7_DMACH29 0x20000000 // I2S0_TX / CAN1_TX #define SYSCTL_DC7_DMACH28 0x10000000 // I2S0_RX / CAN1_RX #define SYSCTL_DC7_DMACH27 0x08000000 // CAN1_TX / ADC1_SS3 #define SYSCTL_DC7_DMACH26 0x04000000 // CAN1_RX / ADC1_SS2 #define SYSCTL_DC7_DMACH25 0x02000000 // SSI1_TX / ADC1_SS1 #define SYSCTL_DC7_DMACH24 0x01000000 // SSI1_RX / ADC1_SS0 #define SYSCTL_DC7_DMACH23 0x00800000 // UART1_TX / CAN2_TX #define SYSCTL_DC7_DMACH22 0x00400000 // UART1_RX / CAN2_RX #define SYSCTL_DC7_DMACH21 0x00200000 // Timer1B / EPI0_WFIFO #define SYSCTL_DC7_DMACH20 0x00100000 // Timer1A / EPI0_NBRFIFO #define SYSCTL_DC7_DMACH19 0x00080000 // Timer0B / Timer1B #define SYSCTL_DC7_DMACH18 0x00040000 // Timer0A / Timer1A #define SYSCTL_DC7_DMACH17 0x00020000 // ADC0_SS3 #define SYSCTL_DC7_DMACH16 0x00010000 // ADC0_SS2 #define SYSCTL_DC7_DMACH15 0x00008000 // ADC0_SS1 / Timer2B #define SYSCTL_DC7_DMACH14 0x00004000 // ADC0_SS0 / Timer2A #define SYSCTL_DC7_DMACH13 0x00002000 // CAN0_TX / UART2_TX #define SYSCTL_DC7_DMACH12 0x00001000 // CAN0_RX / UART2_RX #define SYSCTL_DC7_DMACH11 0x00000800 // SSI0_TX / SSI1_TX #define SYSCTL_DC7_DMACH10 0x00000400 // SSI0_RX / SSI1_RX #define SYSCTL_DC7_DMACH9 0x00000200 // UART0_TX / UART1_TX #define SYSCTL_DC7_DMACH8 0x00000100 // UART0_RX / UART1_RX #define SYSCTL_DC7_DMACH7 0x00000080 // ETH_TX / Timer2B #define SYSCTL_DC7_DMACH6 0x00000040 // ETH_RX / Timer2A #define SYSCTL_DC7_DMACH5 0x00000020 // USB_EP3_TX / Timer2B #define SYSCTL_DC7_DMACH4 0x00000010 // USB_EP3_RX / Timer2A #define SYSCTL_DC7_DMACH3 0x00000008 // USB_EP2_TX / Timer3B #define SYSCTL_DC7_DMACH2 0x00000004 // USB_EP2_RX / Timer3A #define SYSCTL_DC7_DMACH1 0x00000002 // USB_EP1_TX / UART2_TX #define SYSCTL_DC7_DMACH0 0x00000001 // USB_EP1_RX / UART2_RX //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC8 register. // //***************************************************************************** #define SYSCTL_DC8_ADC1AIN15 0x80000000 // ADC Module 1 AIN15 Pin Present #define SYSCTL_DC8_ADC1AIN14 0x40000000 // ADC Module 1 AIN14 Pin Present #define SYSCTL_DC8_ADC1AIN13 0x20000000 // ADC Module 1 AIN13 Pin Present #define SYSCTL_DC8_ADC1AIN12 0x10000000 // ADC Module 1 AIN12 Pin Present #define SYSCTL_DC8_ADC1AIN11 0x08000000 // ADC Module 1 AIN11 Pin Present #define SYSCTL_DC8_ADC1AIN10 0x04000000 // ADC Module 1 AIN10 Pin Present #define SYSCTL_DC8_ADC1AIN9 0x02000000 // ADC Module 1 AIN9 Pin Present #define SYSCTL_DC8_ADC1AIN8 0x01000000 // ADC Module 1 AIN8 Pin Present #define SYSCTL_DC8_ADC1AIN7 0x00800000 // ADC Module 1 AIN7 Pin Present #define SYSCTL_DC8_ADC1AIN6 0x00400000 // ADC Module 1 AIN6 Pin Present #define SYSCTL_DC8_ADC1AIN5 0x00200000 // ADC Module 1 AIN5 Pin Present #define SYSCTL_DC8_ADC1AIN4 0x00100000 // ADC Module 1 AIN4 Pin Present #define SYSCTL_DC8_ADC1AIN3 0x00080000 // ADC Module 1 AIN3 Pin Present #define SYSCTL_DC8_ADC1AIN2 0x00040000 // ADC Module 1 AIN2 Pin Present #define SYSCTL_DC8_ADC1AIN1 0x00020000 // ADC Module 1 AIN1 Pin Present #define SYSCTL_DC8_ADC1AIN0 0x00010000 // ADC Module 1 AIN0 Pin Present #define SYSCTL_DC8_ADC0AIN15 0x00008000 // ADC Module 0 AIN15 Pin Present #define SYSCTL_DC8_ADC0AIN14 0x00004000 // ADC Module 0 AIN14 Pin Present #define SYSCTL_DC8_ADC0AIN13 0x00002000 // ADC Module 0 AIN13 Pin Present #define SYSCTL_DC8_ADC0AIN12 0x00001000 // ADC Module 0 AIN12 Pin Present #define SYSCTL_DC8_ADC0AIN11 0x00000800 // ADC Module 0 AIN11 Pin Present #define SYSCTL_DC8_ADC0AIN10 0x00000400 // ADC Module 0 AIN10 Pin Present #define SYSCTL_DC8_ADC0AIN9 0x00000200 // ADC Module 0 AIN9 Pin Present #define SYSCTL_DC8_ADC0AIN8 0x00000100 // ADC Module 0 AIN8 Pin Present #define SYSCTL_DC8_ADC0AIN7 0x00000080 // ADC Module 0 AIN7 Pin Present #define SYSCTL_DC8_ADC0AIN6 0x00000040 // ADC Module 0 AIN6 Pin Present #define SYSCTL_DC8_ADC0AIN5 0x00000020 // ADC Module 0 AIN5 Pin Present #define SYSCTL_DC8_ADC0AIN4 0x00000010 // ADC Module 0 AIN4 Pin Present #define SYSCTL_DC8_ADC0AIN3 0x00000008 // ADC Module 0 AIN3 Pin Present #define SYSCTL_DC8_ADC0AIN2 0x00000004 // ADC Module 0 AIN2 Pin Present #define SYSCTL_DC8_ADC0AIN1 0x00000002 // ADC Module 0 AIN1 Pin Present #define SYSCTL_DC8_ADC0AIN0 0x00000001 // ADC Module 0 AIN0 Pin Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PBORCTL register. // //***************************************************************************** #define SYSCTL_PBORCTL_BOR0 0x00000004 // VDD under BOR0 Event Action #define SYSCTL_PBORCTL_BOR1 0x00000002 // VDD under BOR1 Event Action //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PTBOCTL register. // //***************************************************************************** #define SYSCTL_PTBOCTL_VDDA_UBOR0_M \ 0x00000300 // VDDA under BOR0 Event Action #define SYSCTL_PTBOCTL_VDDA_UBOR0_NONE \ 0x00000000 // No Action #define SYSCTL_PTBOCTL_VDDA_UBOR0_SYSINT \ 0x00000100 // System control interrupt #define SYSCTL_PTBOCTL_VDDA_UBOR0_NMI \ 0x00000200 // NMI #define SYSCTL_PTBOCTL_VDDA_UBOR0_RST \ 0x00000300 // Reset #define SYSCTL_PTBOCTL_VDD_UBOR0_M \ 0x00000003 // VDD under BOR0 Event Action #define SYSCTL_PTBOCTL_VDD_UBOR0_NONE \ 0x00000000 // No Action #define SYSCTL_PTBOCTL_VDD_UBOR0_SYSINT \ 0x00000001 // System control interrupt #define SYSCTL_PTBOCTL_VDD_UBOR0_NMI \ 0x00000002 // NMI #define SYSCTL_PTBOCTL_VDD_UBOR0_RST \ 0x00000003 // Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR0 register. // //***************************************************************************** #define SYSCTL_SRCR0_WDT1 0x10000000 // WDT1 Reset Control #define SYSCTL_SRCR0_CAN1 0x02000000 // CAN1 Reset Control #define SYSCTL_SRCR0_CAN0 0x01000000 // CAN0 Reset Control #define SYSCTL_SRCR0_PWM0 0x00100000 // PWM Reset Control #define SYSCTL_SRCR0_ADC1 0x00020000 // ADC1 Reset Control #define SYSCTL_SRCR0_ADC0 0x00010000 // ADC0 Reset Control #define SYSCTL_SRCR0_HIB 0x00000040 // HIB Reset Control #define SYSCTL_SRCR0_WDT0 0x00000008 // WDT0 Reset Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR1 register. // //***************************************************************************** #define SYSCTL_SRCR1_COMP2 0x04000000 // Analog Comp 2 Reset Control #define SYSCTL_SRCR1_COMP1 0x02000000 // Analog Comp 1 Reset Control #define SYSCTL_SRCR1_COMP0 0x01000000 // Analog Comp 0 Reset Control #define SYSCTL_SRCR1_TIMER3 0x00080000 // Timer 3 Reset Control #define SYSCTL_SRCR1_TIMER2 0x00040000 // Timer 2 Reset Control #define SYSCTL_SRCR1_TIMER1 0x00020000 // Timer 1 Reset Control #define SYSCTL_SRCR1_TIMER0 0x00010000 // Timer 0 Reset Control #define SYSCTL_SRCR1_I2C1 0x00004000 // I2C1 Reset Control #define SYSCTL_SRCR1_I2C0 0x00001000 // I2C0 Reset Control #define SYSCTL_SRCR1_QEI1 0x00000200 // QEI1 Reset Control #define SYSCTL_SRCR1_QEI0 0x00000100 // QEI0 Reset Control #define SYSCTL_SRCR1_SSI1 0x00000020 // SSI1 Reset Control #define SYSCTL_SRCR1_SSI0 0x00000010 // SSI0 Reset Control #define SYSCTL_SRCR1_UART2 0x00000004 // UART2 Reset Control #define SYSCTL_SRCR1_UART1 0x00000002 // UART1 Reset Control #define SYSCTL_SRCR1_UART0 0x00000001 // UART0 Reset Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR2 register. // //***************************************************************************** #define SYSCTL_SRCR2_USB0 0x00010000 // USB0 Reset Control #define SYSCTL_SRCR2_UDMA 0x00002000 // Micro-DMA Reset Control #define SYSCTL_SRCR2_GPIOJ 0x00000100 // Port J Reset Control #define SYSCTL_SRCR2_GPIOH 0x00000080 // Port H Reset Control #define SYSCTL_SRCR2_GPIOG 0x00000040 // Port G Reset Control #define SYSCTL_SRCR2_GPIOF 0x00000020 // Port F Reset Control #define SYSCTL_SRCR2_GPIOE 0x00000010 // Port E Reset Control #define SYSCTL_SRCR2_GPIOD 0x00000008 // Port D Reset Control #define SYSCTL_SRCR2_GPIOC 0x00000004 // Port C Reset Control #define SYSCTL_SRCR2_GPIOB 0x00000002 // Port B Reset Control #define SYSCTL_SRCR2_GPIOA 0x00000001 // Port A Reset Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RIS register. // //***************************************************************************** #define SYSCTL_RIS_VDDARIS 0x00000400 // VDDA Power OK Event Raw // Interrupt Status #define SYSCTL_RIS_MOSCPUPRIS 0x00000100 // MOSC Power Up Raw Interrupt // Status #define SYSCTL_RIS_USBPLLLRIS 0x00000080 // USB PLL Lock Raw Interrupt // Status #define SYSCTL_RIS_PLLLRIS 0x00000040 // PLL Lock Raw Interrupt Status #define SYSCTL_RIS_MOFRIS 0x00000008 // Main Oscillator Fault Raw // Interrupt Status #define SYSCTL_RIS_BORRIS 0x00000002 // Brown-Out Reset Raw Interrupt // Status //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_IMC register. // //***************************************************************************** #define SYSCTL_IMC_VDDAIM 0x00000400 // VDDA Power OK Interrupt Mask #define SYSCTL_IMC_MOSCPUPIM 0x00000100 // MOSC Power Up Interrupt Mask #define SYSCTL_IMC_USBPLLLIM 0x00000080 // USB PLL Lock Interrupt Mask #define SYSCTL_IMC_PLLLIM 0x00000040 // PLL Lock Interrupt Mask #define SYSCTL_IMC_MOFIM 0x00000008 // Main Oscillator Fault Interrupt // Mask #define SYSCTL_IMC_BORIM 0x00000002 // Brown-Out Reset Interrupt Mask //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_MISC register. // //***************************************************************************** #define SYSCTL_MISC_VDDAMIS 0x00000400 // VDDA Power OK Masked Interrupt // Status #define SYSCTL_MISC_MOSCPUPMIS 0x00000100 // MOSC Power Up Masked Interrupt // Status #define SYSCTL_MISC_USBPLLLMIS 0x00000080 // USB PLL Lock Masked Interrupt // Status #define SYSCTL_MISC_PLLLMIS 0x00000040 // PLL Lock Masked Interrupt Status #define SYSCTL_MISC_MOFMIS 0x00000008 // Main Oscillator Fault Masked // Interrupt Status #define SYSCTL_MISC_BORMIS 0x00000002 // BOR Masked Interrupt Status //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RESC register. // //***************************************************************************** #define SYSCTL_RESC_MOSCFAIL 0x00010000 // MOSC Failure Reset #define SYSCTL_RESC_HSSR 0x00001000 // HSSR Reset #define SYSCTL_RESC_HIB 0x00000040 // HIB Reset #define SYSCTL_RESC_WDT1 0x00000020 // Watchdog Timer 1 Reset #define SYSCTL_RESC_SW 0x00000010 // Software Reset #define SYSCTL_RESC_WDT0 0x00000008 // Watchdog Timer 0 Reset #define SYSCTL_RESC_BOR 0x00000004 // Brown-Out Reset #define SYSCTL_RESC_POR 0x00000002 // Power-On Reset #define SYSCTL_RESC_EXT 0x00000001 // External Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PWRTC register. // //***************************************************************************** #define SYSCTL_PWRTC_VDDA_UBOR0 0x00000010 // VDDAUnder BOR0 Status #define SYSCTL_PWRTC_VDD_UBOR0 0x00000001 // VDDUnder BOR0 Status //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCC register. // //***************************************************************************** #define SYSCTL_RCC_ACG 0x08000000 // Auto Clock Gating #define SYSCTL_RCC_SYSDIV_M 0x07800000 // System Clock Divisor #define SYSCTL_RCC_USESYSDIV 0x00400000 // Enable System Clock Divider #define SYSCTL_RCC_USEPWMDIV 0x00100000 // Enable PWM Clock Divisor #define SYSCTL_RCC_PWMDIV_M 0x000E0000 // PWM Unit Clock Divisor #define SYSCTL_RCC_PWMDIV_2 0x00000000 // PWM clock /2 #define SYSCTL_RCC_PWMDIV_4 0x00020000 // PWM clock /4 #define SYSCTL_RCC_PWMDIV_8 0x00040000 // PWM clock /8 #define SYSCTL_RCC_PWMDIV_16 0x00060000 // PWM clock /16 #define SYSCTL_RCC_PWMDIV_32 0x00080000 // PWM clock /32 #define SYSCTL_RCC_PWMDIV_64 0x000A0000 // PWM clock /64 #define SYSCTL_RCC_PWRDN 0x00002000 // PLL Power Down #define SYSCTL_RCC_BYPASS 0x00000800 // PLL Bypass #define SYSCTL_RCC_XTAL_M 0x000007C0 // Crystal Value #define SYSCTL_RCC_XTAL_4MHZ 0x00000180 // 4 MHz #define SYSCTL_RCC_XTAL_4_09MHZ 0x000001C0 // 4.096 MHz #define SYSCTL_RCC_XTAL_4_91MHZ 0x00000200 // 4.9152 MHz #define SYSCTL_RCC_XTAL_5MHZ 0x00000240 // 5 MHz #define SYSCTL_RCC_XTAL_5_12MHZ 0x00000280 // 5.12 MHz #define SYSCTL_RCC_XTAL_6MHZ 0x000002C0 // 6 MHz #define SYSCTL_RCC_XTAL_6_14MHZ 0x00000300 // 6.144 MHz #define SYSCTL_RCC_XTAL_7_37MHZ 0x00000340 // 7.3728 MHz #define SYSCTL_RCC_XTAL_8MHZ 0x00000380 // 8 MHz #define SYSCTL_RCC_XTAL_8_19MHZ 0x000003C0 // 8.192 MHz #define SYSCTL_RCC_XTAL_10MHZ 0x00000400 // 10 MHz #define SYSCTL_RCC_XTAL_12MHZ 0x00000440 // 12 MHz #define SYSCTL_RCC_XTAL_12_2MHZ 0x00000480 // 12.288 MHz #define SYSCTL_RCC_XTAL_13_5MHZ 0x000004C0 // 13.56 MHz #define SYSCTL_RCC_XTAL_14_3MHZ 0x00000500 // 14.31818 MHz #define SYSCTL_RCC_XTAL_16MHZ 0x00000540 // 16 MHz #define SYSCTL_RCC_XTAL_16_3MHZ 0x00000580 // 16.384 MHz #define SYSCTL_RCC_XTAL_18MHZ 0x000005C0 // 18.0 MHz #define SYSCTL_RCC_XTAL_20MHZ 0x00000600 // 20.0 MHz #define SYSCTL_RCC_XTAL_24MHZ 0x00000640 // 24.0 MHz #define SYSCTL_RCC_XTAL_25MHZ 0x00000680 // 25.0 MHz #define SYSCTL_RCC_OSCSRC_M 0x00000030 // Oscillator Source #define SYSCTL_RCC_OSCSRC_MAIN 0x00000000 // MOSC #define SYSCTL_RCC_OSCSRC_INT 0x00000010 // IOSC #define SYSCTL_RCC_OSCSRC_INT4 0x00000020 // IOSC/4 #define SYSCTL_RCC_OSCSRC_30 0x00000030 // 30 kHz #define SYSCTL_RCC_MOSCDIS 0x00000001 // Main Oscillator Disable #define SYSCTL_RCC_SYSDIV_S 23 #define SYSCTL_RCC_XTAL_S 6 // Shift to the XTAL field //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_NMIC register. // //***************************************************************************** #define SYSCTL_NMIC_MOSCFAIL 0x00010000 // MOSC Failure NMI #define SYSCTL_NMIC_TAMPER 0x00000200 // Tamper Event NMI #define SYSCTL_NMIC_WDT1 0x00000020 // Watch Dog Timer (WDT) 1 NMI #define SYSCTL_NMIC_WDT0 0x00000008 // Watch Dog Timer (WDT) 0 NMI #define SYSCTL_NMIC_POWER 0x00000004 // Power/Brown Out Event NMI #define SYSCTL_NMIC_EXTERNAL 0x00000001 // External Pin NMI //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_GPIOHBCTL // register. // //***************************************************************************** #define SYSCTL_GPIOHBCTL_PORTJ 0x00000100 // Port J Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTH 0x00000080 // Port H Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTG 0x00000040 // Port G Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTF 0x00000020 // Port F Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTE 0x00000010 // Port E Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTD 0x00000008 // Port D Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTC 0x00000004 // Port C Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTB 0x00000002 // Port B Advanced High-Performance // Bus #define SYSCTL_GPIOHBCTL_PORTA 0x00000001 // Port A Advanced High-Performance // Bus //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCC2 register. // //***************************************************************************** #define SYSCTL_RCC2_USERCC2 0x80000000 // Use RCC2 #define SYSCTL_RCC2_DIV400 0x40000000 // Divide PLL as 400 MHz vs. 200 // MHz #define SYSCTL_RCC2_SYSDIV2_M 0x1F800000 // System Clock Divisor 2 #define SYSCTL_RCC2_SYSDIV2LSB 0x00400000 // Additional LSB for SYSDIV2 #define SYSCTL_RCC2_USBPWRDN 0x00004000 // Power-Down USB PLL #define SYSCTL_RCC2_PWRDN2 0x00002000 // Power-Down PLL 2 #define SYSCTL_RCC2_BYPASS2 0x00000800 // PLL Bypass 2 #define SYSCTL_RCC2_OSCSRC2_M 0x00000070 // Oscillator Source 2 #define SYSCTL_RCC2_OSCSRC2_MO 0x00000000 // MOSC #define SYSCTL_RCC2_OSCSRC2_IO 0x00000010 // PIOSC #define SYSCTL_RCC2_OSCSRC2_IO4 0x00000020 // PIOSC/4 #define SYSCTL_RCC2_OSCSRC2_30 0x00000030 // 30 kHz #define SYSCTL_RCC2_OSCSRC2_32 0x00000070 // 32.768 kHz #define SYSCTL_RCC2_SYSDIV2_S 23 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_MOSCCTL register. // //***************************************************************************** #define SYSCTL_MOSCCTL_SESRC 0x00000020 // Single-Ended Source #define SYSCTL_MOSCCTL_OSCRNG 0x00000010 // Oscillator Range #define SYSCTL_MOSCCTL_PWRDN 0x00000008 // Power Down #define SYSCTL_MOSCCTL_NOXTAL 0x00000004 // No Crystal Connected #define SYSCTL_MOSCCTL_MOSCIM 0x00000002 // MOSC Failure Action #define SYSCTL_MOSCCTL_CVAL 0x00000001 // Clock Validation for MOSC //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RSCLKCFG // register. // //***************************************************************************** #define SYSCTL_RSCLKCFG_MEMTIMU 0x80000000 // Memory Timing Register Update #define SYSCTL_RSCLKCFG_NEWFREQ 0x40000000 // New PLLFREQ Accept #define SYSCTL_RSCLKCFG_ACG 0x20000000 // Auto Clock Gating Enable #define SYSCTL_RSCLKCFG_USEPLL 0x10000000 // Use PLL #define SYSCTL_RSCLKCFG_PLLSRC_M \ 0x0F000000 // PLL Source #define SYSCTL_RSCLKCFG_PLLSRC_PIOSC \ 0x00000000 // PIOSC is PLL input clock source #define SYSCTL_RSCLKCFG_PLLSRC_MOSC \ 0x03000000 // MOSC is PLL input clock source #define SYSCTL_RSCLKCFG_OSCSRC_M \ 0x00F00000 // Oscillator Source #define SYSCTL_RSCLKCFG_OSCSRC_PIOSC \ 0x00000000 // PIOSC is oscillator source #define SYSCTL_RSCLKCFG_OSCSRC_LFIOSC \ 0x00200000 // LFIOSC is oscillator source #define SYSCTL_RSCLKCFG_OSCSRC_MOSC \ 0x00300000 // MOSC is oscillator source #define SYSCTL_RSCLKCFG_OSCSRC_RTC \ 0x00400000 // RTC is oscillator source #define SYSCTL_RSCLKCFG_OSYSDIV_M \ 0x000FFC00 // Oscillator System Clock Divisor #define SYSCTL_RSCLKCFG_PSYSDIV_M \ 0x000003FF // PLL System Clock Divisor #define SYSCTL_RSCLKCFG_OSYSDIV_S \ 10 #define SYSCTL_RSCLKCFG_PSYSDIV_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_MEMTIM0 register. // //***************************************************************************** #define SYSCTL_MEMTIM0_EBCHT_M 0x03C00000 // EEPROM Clock High Time #define SYSCTL_MEMTIM0_EBCHT_0_5 \ 0x00000000 // System clock high #define SYSCTL_MEMTIM0_EBCHT_1 0x00400000 // 1 system clock period #define SYSCTL_MEMTIM0_EBCHT_1_5 \ 0x00800000 // 1.5 system clock periods #define SYSCTL_MEMTIM0_EBCHT_2 0x00C00000 // 2 system clock periods #define SYSCTL_MEMTIM0_EBCHT_2_5 \ 0x01000000 // 2.5 system clock periods #define SYSCTL_MEMTIM0_EBCHT_3 0x01400000 // 3 system clock periods #define SYSCTL_MEMTIM0_EBCHT_3_5 \ 0x01800000 // 3.5 system clock periods #define SYSCTL_MEMTIM0_EBCHT_4 0x01C00000 // 4 system clock periods #define SYSCTL_MEMTIM0_EBCHT_4_5 \ 0x02000000 // 4.5 system clock periods #define SYSCTL_MEMTIM0_EBCE 0x00200000 // EEPROM Bank Clock Edge #define SYSCTL_MEMTIM0_MB1 0x00100010 // Must be one #define SYSCTL_MEMTIM0_EWS_M 0x000F0000 // EEPROM Wait State #define SYSCTL_MEMTIM0_FBCHT_M 0x000003C0 // Flash Bank Clock High Time #define SYSCTL_MEMTIM0_FBCHT_0_5 \ 0x00000000 // System clock high #define SYSCTL_MEMTIM0_FBCHT_1 0x00000040 // 1 system clock period #define SYSCTL_MEMTIM0_FBCHT_1_5 \ 0x00000080 // 1.5 system clock periods #define SYSCTL_MEMTIM0_FBCHT_2 0x000000C0 // 2 system clock periods #define SYSCTL_MEMTIM0_FBCHT_2_5 \ 0x00000100 // 2.5 system clock periods #define SYSCTL_MEMTIM0_FBCHT_3 0x00000140 // 3 system clock periods #define SYSCTL_MEMTIM0_FBCHT_3_5 \ 0x00000180 // 3.5 system clock periods #define SYSCTL_MEMTIM0_FBCHT_4 0x000001C0 // 4 system clock periods #define SYSCTL_MEMTIM0_FBCHT_4_5 \ 0x00000200 // 4.5 system clock periods #define SYSCTL_MEMTIM0_FBCE 0x00000020 // Flash Bank Clock Edge #define SYSCTL_MEMTIM0_FWS_M 0x0000000F // Flash Wait State #define SYSCTL_MEMTIM0_EWS_S 16 #define SYSCTL_MEMTIM0_FWS_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DSMEMTIM0 // register. // //***************************************************************************** #define SYSCTL_DSMEMTIM0_DSEBCHT_M \ 0x03C00000 // Deep Sleep EEPROM Clock High // Time #define SYSCTL_DSMEMTIM0_DSEBCHT_0_5 \ 0x00000000 // System clock high #define SYSCTL_DSMEMTIM0_DSEBCHT_1 \ 0x00400000 // 1 system clock period #define SYSCTL_DSMEMTIM0_DSEBCHT_1_5 \ 0x00800000 // 1.5 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_2 \ 0x00C00000 // 2 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_2_5 \ 0x01000000 // 2.5 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_3 \ 0x01400000 // 3 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_3_5 \ 0x01800000 // 3.5 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_4 \ 0x01C00000 // 4 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCHT_4_5 \ 0x02000000 // 4.5 system clock periods #define SYSCTL_DSMEMTIM0_DSEBCE 0x00200000 // Deep Sleep EEPROM Bank Clock // Edge #define SYSCTL_DSMEMTIM0_EBO 0x00100000 // Deep Sleep EEPROM Bank Output #define SYSCTL_DSMEMTIM0_EWS_M 0x000F0000 // Deep Sleep EEPROM Wait State #define SYSCTL_DSMEMTIM0_DSFBCHT_M \ 0x000003C0 // Deep Sleep Flash Bank Clock High // Time #define SYSCTL_DSMEMTIM0_DSFBCHT_0_5 \ 0x00000000 // System clock high #define SYSCTL_DSMEMTIM0_DSFBCHT_1 \ 0x00000040 // 1 system clock period #define SYSCTL_DSMEMTIM0_DSFBCHT_1_5 \ 0x00000080 // 1.5 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_2 \ 0x000000C0 // 2 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_2_5 \ 0x00000100 // 2.5 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_3 \ 0x00000140 // 3 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_3_5 \ 0x00000180 // 3.5 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_4 \ 0x000001C0 // 4 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCHT_4_5 \ 0x00000200 // 4.5 system clock periods #define SYSCTL_DSMEMTIM0_DSFBCE 0x00000020 // Deep Sleep Flash Bank Clock Edge #define SYSCTL_DSMEMTIM0_DSFBO 0x00000010 // Deep Sleep Flash Bank Output #define SYSCTL_DSMEMTIM0_DSFWS_M \ 0x0000000F // Deep Sleep Flash Wait State #define SYSCTL_DSMEMTIM0_EWS_S 16 #define SYSCTL_DSMEMTIM0_DSFWS_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC0 register. // //***************************************************************************** #define SYSCTL_RCGC0_WDT1 0x10000000 // WDT1 Clock Gating Control #define SYSCTL_RCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control #define SYSCTL_RCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control #define SYSCTL_RCGC0_PWM0 0x00100000 // PWM Clock Gating Control #define SYSCTL_RCGC0_ADC1 0x00020000 // ADC1 Clock Gating Control #define SYSCTL_RCGC0_ADC0 0x00010000 // ADC0 Clock Gating Control #define SYSCTL_RCGC0_ADC1SPD_M 0x00000C00 // ADC1 Sample Speed #define SYSCTL_RCGC0_ADC1SPD_125K \ 0x00000000 // 125K samples/second #define SYSCTL_RCGC0_ADC1SPD_250K \ 0x00000400 // 250K samples/second #define SYSCTL_RCGC0_ADC1SPD_500K \ 0x00000800 // 500K samples/second #define SYSCTL_RCGC0_ADC1SPD_1M 0x00000C00 // 1M samples/second #define SYSCTL_RCGC0_ADC0SPD_M 0x00000300 // ADC0 Sample Speed #define SYSCTL_RCGC0_ADC0SPD_125K \ 0x00000000 // 125K samples/second #define SYSCTL_RCGC0_ADC0SPD_250K \ 0x00000100 // 250K samples/second #define SYSCTL_RCGC0_ADC0SPD_500K \ 0x00000200 // 500K samples/second #define SYSCTL_RCGC0_ADC0SPD_1M 0x00000300 // 1M samples/second #define SYSCTL_RCGC0_HIB 0x00000040 // HIB Clock Gating Control #define SYSCTL_RCGC0_WDT0 0x00000008 // WDT0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC1 register. // //***************************************************************************** #define SYSCTL_RCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock Gating #define SYSCTL_RCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock Gating #define SYSCTL_RCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock Gating #define SYSCTL_RCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control #define SYSCTL_RCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control #define SYSCTL_RCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control #define SYSCTL_RCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control #define SYSCTL_RCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control #define SYSCTL_RCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control #define SYSCTL_RCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control #define SYSCTL_RCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control #define SYSCTL_RCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control #define SYSCTL_RCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control #define SYSCTL_RCGC1_UART2 0x00000004 // UART2 Clock Gating Control #define SYSCTL_RCGC1_UART1 0x00000002 // UART1 Clock Gating Control #define SYSCTL_RCGC1_UART0 0x00000001 // UART0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC2 register. // //***************************************************************************** #define SYSCTL_RCGC2_USB0 0x00010000 // USB0 Clock Gating Control #define SYSCTL_RCGC2_UDMA 0x00002000 // Micro-DMA Clock Gating Control #define SYSCTL_RCGC2_GPIOJ 0x00000100 // Port J Clock Gating Control #define SYSCTL_RCGC2_GPIOH 0x00000080 // Port H Clock Gating Control #define SYSCTL_RCGC2_GPIOG 0x00000040 // Port G Clock Gating Control #define SYSCTL_RCGC2_GPIOF 0x00000020 // Port F Clock Gating Control #define SYSCTL_RCGC2_GPIOE 0x00000010 // Port E Clock Gating Control #define SYSCTL_RCGC2_GPIOD 0x00000008 // Port D Clock Gating Control #define SYSCTL_RCGC2_GPIOC 0x00000004 // Port C Clock Gating Control #define SYSCTL_RCGC2_GPIOB 0x00000002 // Port B Clock Gating Control #define SYSCTL_RCGC2_GPIOA 0x00000001 // Port A Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC0 register. // //***************************************************************************** #define SYSCTL_SCGC0_WDT1 0x10000000 // WDT1 Clock Gating Control #define SYSCTL_SCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control #define SYSCTL_SCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control #define SYSCTL_SCGC0_PWM0 0x00100000 // PWM Clock Gating Control #define SYSCTL_SCGC0_ADC1 0x00020000 // ADC1 Clock Gating Control #define SYSCTL_SCGC0_ADC0 0x00010000 // ADC0 Clock Gating Control #define SYSCTL_SCGC0_ADCSPD_M 0x00000F00 // ADC Sample Speed #define SYSCTL_SCGC0_HIB 0x00000040 // HIB Clock Gating Control #define SYSCTL_SCGC0_WDT0 0x00000008 // WDT0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC1 register. // //***************************************************************************** #define SYSCTL_SCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock Gating #define SYSCTL_SCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock Gating #define SYSCTL_SCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock Gating #define SYSCTL_SCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control #define SYSCTL_SCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control #define SYSCTL_SCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control #define SYSCTL_SCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control #define SYSCTL_SCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control #define SYSCTL_SCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control #define SYSCTL_SCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control #define SYSCTL_SCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control #define SYSCTL_SCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control #define SYSCTL_SCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control #define SYSCTL_SCGC1_UART2 0x00000004 // UART2 Clock Gating Control #define SYSCTL_SCGC1_UART1 0x00000002 // UART1 Clock Gating Control #define SYSCTL_SCGC1_UART0 0x00000001 // UART0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC2 register. // //***************************************************************************** #define SYSCTL_SCGC2_USB0 0x00010000 // USB0 Clock Gating Control #define SYSCTL_SCGC2_UDMA 0x00002000 // Micro-DMA Clock Gating Control #define SYSCTL_SCGC2_GPIOJ 0x00000100 // Port J Clock Gating Control #define SYSCTL_SCGC2_GPIOH 0x00000080 // Port H Clock Gating Control #define SYSCTL_SCGC2_GPIOG 0x00000040 // Port G Clock Gating Control #define SYSCTL_SCGC2_GPIOF 0x00000020 // Port F Clock Gating Control #define SYSCTL_SCGC2_GPIOE 0x00000010 // Port E Clock Gating Control #define SYSCTL_SCGC2_GPIOD 0x00000008 // Port D Clock Gating Control #define SYSCTL_SCGC2_GPIOC 0x00000004 // Port C Clock Gating Control #define SYSCTL_SCGC2_GPIOB 0x00000002 // Port B Clock Gating Control #define SYSCTL_SCGC2_GPIOA 0x00000001 // Port A Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC0 register. // //***************************************************************************** #define SYSCTL_DCGC0_WDT1 0x10000000 // WDT1 Clock Gating Control #define SYSCTL_DCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control #define SYSCTL_DCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control #define SYSCTL_DCGC0_PWM0 0x00100000 // PWM Clock Gating Control #define SYSCTL_DCGC0_ADC1 0x00020000 // ADC1 Clock Gating Control #define SYSCTL_DCGC0_ADC0 0x00010000 // ADC0 Clock Gating Control #define SYSCTL_DCGC0_HIB 0x00000040 // HIB Clock Gating Control #define SYSCTL_DCGC0_WDT0 0x00000008 // WDT0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC1 register. // //***************************************************************************** #define SYSCTL_DCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock Gating #define SYSCTL_DCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock Gating #define SYSCTL_DCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock Gating #define SYSCTL_DCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control #define SYSCTL_DCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control #define SYSCTL_DCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control #define SYSCTL_DCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control #define SYSCTL_DCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control #define SYSCTL_DCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control #define SYSCTL_DCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control #define SYSCTL_DCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control #define SYSCTL_DCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control #define SYSCTL_DCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control #define SYSCTL_DCGC1_UART2 0x00000004 // UART2 Clock Gating Control #define SYSCTL_DCGC1_UART1 0x00000002 // UART1 Clock Gating Control #define SYSCTL_DCGC1_UART0 0x00000001 // UART0 Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC2 register. // //***************************************************************************** #define SYSCTL_DCGC2_USB0 0x00010000 // USB0 Clock Gating Control #define SYSCTL_DCGC2_UDMA 0x00002000 // Micro-DMA Clock Gating Control #define SYSCTL_DCGC2_GPIOJ 0x00000100 // Port J Clock Gating Control #define SYSCTL_DCGC2_GPIOH 0x00000080 // Port H Clock Gating Control #define SYSCTL_DCGC2_GPIOG 0x00000040 // Port G Clock Gating Control #define SYSCTL_DCGC2_GPIOF 0x00000020 // Port F Clock Gating Control #define SYSCTL_DCGC2_GPIOE 0x00000010 // Port E Clock Gating Control #define SYSCTL_DCGC2_GPIOD 0x00000008 // Port D Clock Gating Control #define SYSCTL_DCGC2_GPIOC 0x00000004 // Port C Clock Gating Control #define SYSCTL_DCGC2_GPIOB 0x00000002 // Port B Clock Gating Control #define SYSCTL_DCGC2_GPIOA 0x00000001 // Port A Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_ALTCLKCFG // register. // //***************************************************************************** #define SYSCTL_ALTCLKCFG_ALTCLK_M \ 0x0000000F // Alternate Clock Source #define SYSCTL_ALTCLKCFG_ALTCLK_PIOSC \ 0x00000000 // PIOSC #define SYSCTL_ALTCLKCFG_ALTCLK_PIOSC48 \ 0x00000001 // PIOSC48 #define SYSCTL_ALTCLKCFG_ALTCLK_LFIOSC \ 0x00000002 // LFIOSC #define SYSCTL_ALTCLKCFG_ALTCLK_RTCOSC \ 0x00000003 // Hibernation Module Real-time // clock output (RTCOSC) #define SYSCTL_ALTCLKCFG_ALTCLK_HIBRTC \ 0x00000004 // Hibernation Module RTCOSC //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DSLPCLKCFG // register. // //***************************************************************************** #define SYSCTL_DSLPCLKCFG_D_M 0x1F800000 // Divider Field Override #define SYSCTL_DSLPCLKCFG_O_M 0x00000070 // Clock Source #define SYSCTL_DSLPCLKCFG_O_IGN 0x00000000 // MOSC #define SYSCTL_DSLPCLKCFG_O_IO 0x00000010 // PIOSC #define SYSCTL_DSLPCLKCFG_O_30 0x00000030 // 30 kHz #define SYSCTL_DSLPCLKCFG_O_32 0x00000070 // 32.768 kHz #define SYSCTL_DSLPCLKCFG_D_S 23 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DSCLKCFG // register. // //***************************************************************************** #define SYSCTL_DSCLKCFG_PIOSCPD 0x80000000 // PIOSC Power Down #define SYSCTL_DSCLKCFG_MOSCDPD 0x40000000 // MOSC Disable Power Down #define SYSCTL_DSCLKCFG_DSOSCSRC_M \ 0x00F00000 // Deep Sleep #define SYSCTL_DSCLKCFG_DSOSCSRC_PIOSC \ 0x00000000 // PIOSC #define SYSCTL_DSCLKCFG_DSOSCSRC_LFIOSC \ 0x00200000 // LFIOSC #define SYSCTL_DSCLKCFG_DSOSCSRC_MOSC \ 0x00300000 // MOSC #define SYSCTL_DSCLKCFG_DSOSCSRC_RTC \ 0x00400000 // RTC #define SYSCTL_DSCLKCFG_DSSYSDIV_M \ 0x000003FF // Deep Sleep Clock Divisor #define SYSCTL_DSCLKCFG_DSSYSDIV_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DIVSCLK register. // //***************************************************************************** #define SYSCTL_DIVSCLK_EN 0x80000000 // Enable #define SYSCTL_DIVSCLK_SRC_M 0x00030000 // Clock Source #define SYSCTL_DIVSCLK_SRC_SYSCLK \ 0x00000000 // System Clock #define SYSCTL_DIVSCLK_SRC_PIOSC \ 0x00010000 // PIOSC #define SYSCTL_DIVSCLK_SRC_MOSC 0x00020000 // MOSC #define SYSCTL_DIVSCLK_DIV_M 0x000000FF // Divisor Value #define SYSCTL_DIVSCLK_DIV_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SYSPROP register. // //***************************************************************************** #define SYSCTL_SYSPROP_FPU 0x00000001 // FPU Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PIOSCCAL // register. // //***************************************************************************** #define SYSCTL_PIOSCCAL_UTEN 0x80000000 // Use User Trim Value #define SYSCTL_PIOSCCAL_CAL 0x00000200 // Start Calibration #define SYSCTL_PIOSCCAL_UPDATE 0x00000100 // Update Trim #define SYSCTL_PIOSCCAL_UT_M 0x0000007F // User Trim Value #define SYSCTL_PIOSCCAL_UT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PIOSCSTAT // register. // //***************************************************************************** #define SYSCTL_PIOSCSTAT_DT_M 0x007F0000 // Default Trim Value #define SYSCTL_PIOSCSTAT_CR_M 0x00000300 // Calibration Result #define SYSCTL_PIOSCSTAT_CRNONE 0x00000000 // Calibration has not been // attempted #define SYSCTL_PIOSCSTAT_CRPASS 0x00000100 // The last calibration operation // completed to meet 1% accuracy #define SYSCTL_PIOSCSTAT_CRFAIL 0x00000200 // The last calibration operation // failed to meet 1% accuracy #define SYSCTL_PIOSCSTAT_CT_M 0x0000007F // Calibration Trim Value #define SYSCTL_PIOSCSTAT_DT_S 16 #define SYSCTL_PIOSCSTAT_CT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PLLFREQ0 // register. // //***************************************************************************** #define SYSCTL_PLLFREQ0_PLLPWR 0x00800000 // PLL Power #define SYSCTL_PLLFREQ0_MFRAC_M 0x000FFC00 // PLL M Fractional Value #define SYSCTL_PLLFREQ0_MINT_M 0x000003FF // PLL M Integer Value #define SYSCTL_PLLFREQ0_MFRAC_S 10 #define SYSCTL_PLLFREQ0_MINT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PLLFREQ1 // register. // //***************************************************************************** #define SYSCTL_PLLFREQ1_Q_M 0x00001F00 // PLL Q Value #define SYSCTL_PLLFREQ1_N_M 0x0000001F // PLL N Value #define SYSCTL_PLLFREQ1_Q_S 8 #define SYSCTL_PLLFREQ1_N_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PLLSTAT register. // //***************************************************************************** #define SYSCTL_PLLSTAT_LOCK 0x00000001 // PLL Lock //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC9 register. // //***************************************************************************** #define SYSCTL_DC9_ADC1DC7 0x00800000 // ADC1 DC7 Present #define SYSCTL_DC9_ADC1DC6 0x00400000 // ADC1 DC6 Present #define SYSCTL_DC9_ADC1DC5 0x00200000 // ADC1 DC5 Present #define SYSCTL_DC9_ADC1DC4 0x00100000 // ADC1 DC4 Present #define SYSCTL_DC9_ADC1DC3 0x00080000 // ADC1 DC3 Present #define SYSCTL_DC9_ADC1DC2 0x00040000 // ADC1 DC2 Present #define SYSCTL_DC9_ADC1DC1 0x00020000 // ADC1 DC1 Present #define SYSCTL_DC9_ADC1DC0 0x00010000 // ADC1 DC0 Present #define SYSCTL_DC9_ADC0DC7 0x00000080 // ADC0 DC7 Present #define SYSCTL_DC9_ADC0DC6 0x00000040 // ADC0 DC6 Present #define SYSCTL_DC9_ADC0DC5 0x00000020 // ADC0 DC5 Present #define SYSCTL_DC9_ADC0DC4 0x00000010 // ADC0 DC4 Present #define SYSCTL_DC9_ADC0DC3 0x00000008 // ADC0 DC3 Present #define SYSCTL_DC9_ADC0DC2 0x00000004 // ADC0 DC2 Present #define SYSCTL_DC9_ADC0DC1 0x00000002 // ADC0 DC1 Present #define SYSCTL_DC9_ADC0DC0 0x00000001 // ADC0 DC0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_NVMSTAT register. // //***************************************************************************** #define SYSCTL_NVMSTAT_FWB 0x00000001 // 32 Word Flash Write Buffer // Active //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RESBEHAVCTL // register. // //***************************************************************************** #define SYSCTL_RESBEHAVCTL_WDOG1_M \ 0x000000C0 // Defines operation of Watchdog 1 // Reset #define SYSCTL_RESBEHAVCTL_WDOG1_SYSRST \ 0x00000080 // Watchdog 1 issues system reset. // Application starts within 10usec #define SYSCTL_RESBEHAVCTL_WDOG1_POR \ 0x000000C0 // Watchdog 1 issues full POR // sequence. Application starts < // 500us after deassertion // (Default) #define SYSCTL_RESBEHAVCTL_WDOG0_M \ 0x00000030 // Defines operation of Watchdog 0 // Reset #define SYSCTL_RESBEHAVCTL_WDOG0_SYSRST \ 0x00000020 // Watchdog 0 issues system reset. // Application starts within 10usec #define SYSCTL_RESBEHAVCTL_WDOG0_POR \ 0x00000030 // Watchdog 0 issues full POR // sequence. Application starts < // 500us after deassertion // (Default) #define SYSCTL_RESBEHAVCTL_BOR_M \ 0x0000000C // Defines operation of BOR when // USER has defined the BOR // operation to be a reset #define SYSCTL_RESBEHAVCTL_BOR_SYSRST \ 0x00000008 // Brown Out Reset issues system // reset. Application starts within // 10usec #define SYSCTL_RESBEHAVCTL_BOR_POR \ 0x0000000C // Brown Out Reset issues full POR // sequence. Application starts < // 500us after deassertion // (Default) #define SYSCTL_RESBEHAVCTL_EXTRES_M \ 0x00000003 // External Resetn Pin Operation #define SYSCTL_RESBEHAVCTL_EXTRES_SYSRST \ 0x00000002 // External Resetn issues system // reset. Application starts within // 10usec #define SYSCTL_RESBEHAVCTL_EXTRES_POR \ 0x00000003 // External Resetn issues full POR // sequence. Application starts < // 500us after deassertion // (Default) Application starts < // 500us after deassertion // (Default) //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_HSSR register. // //***************************************************************************** #define SYSCTL_HSSR_KEY_M 0xFF000000 // Write Key #define SYSCTL_HSSR_CDOFF_M 0x00FFFFFF // Command Descriptor Pointer #define SYSCTL_HSSR_KEY_S 24 #define SYSCTL_HSSR_CDOFF_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_USBPDS register. // //***************************************************************************** #define SYSCTL_USBPDS_MEMSTAT_M 0x0000000C // Memory Array Power Status #define SYSCTL_USBPDS_MEMSTAT_OFF \ 0x00000000 // Array OFF #define SYSCTL_USBPDS_MEMSTAT_RETAIN \ 0x00000004 // SRAM Retention #define SYSCTL_USBPDS_MEMSTAT_ON \ 0x0000000C // Array On #define SYSCTL_USBPDS_PWRSTAT_M 0x00000003 // Power Domain Status #define SYSCTL_USBPDS_PWRSTAT_OFF \ 0x00000000 // OFF #define SYSCTL_USBPDS_PWRSTAT_ON \ 0x00000003 // ON #define SYSCTL_USBPDS_PDCS_S 4 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_USBMPC register. // //***************************************************************************** #define SYSCTL_USBMPC_PWRCTL_M 0x00000003 // Memory Array Power Control #define SYSCTL_USBMPC_PWRCTL_OFF \ 0x00000000 // Array OFF #define SYSCTL_USBMPC_PWRCTL_RETAIN \ 0x00000001 // SRAM Retention #define SYSCTL_USBMPC_PWRCTL_ON 0x00000003 // Array On //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_EMACPDS register. // //***************************************************************************** #define SYSCTL_EMACPDS_MEMSTAT_M \ 0x0000000C // Memory Array Power Status #define SYSCTL_EMACPDS_MEMSTAT_OFF \ 0x00000000 // Array OFF #define SYSCTL_EMACPDS_MEMSTAT_ON \ 0x0000000C // Array On #define SYSCTL_EMACPDS_PWRSTAT_M \ 0x00000003 // Power Domain Status #define SYSCTL_EMACPDS_PWRSTAT_OFF \ 0x00000000 // OFF #define SYSCTL_EMACPDS_PWRSTAT_ON \ 0x00000003 // ON #define SYSCTL_EMACPDS_PDCS_S 4 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_EMACMPC register. // //***************************************************************************** #define SYSCTL_EMACMPC_PWRCTL_M 0x00000003 // Memory Array Power Control #define SYSCTL_EMACMPC_PWRCTL_OFF \ 0x00000000 // Array OFF #define SYSCTL_EMACMPC_PWRCTL_ON \ 0x00000003 // Array On //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_LCDMPC register. // //***************************************************************************** #define SYSCTL_LCDMPC_PWRCTL_M 0x00000003 // Memory Array Power Control #define SYSCTL_LCDMPC_PWRCTL_OFF \ 0x00000000 // Array OFF #define SYSCTL_LCDMPC_PWRCTL_ON 0x00000003 // Array On //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPWD register. // //***************************************************************************** #define SYSCTL_PPWD_P1 0x00000002 // Watchdog Timer 1 Present #define SYSCTL_PPWD_P0 0x00000001 // Watchdog Timer 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPTIMER register. // //***************************************************************************** #define SYSCTL_PPTIMER_P5 0x00000020 // Timer 5 Present #define SYSCTL_PPTIMER_P4 0x00000010 // Timer 4 Present #define SYSCTL_PPTIMER_P3 0x00000008 // Timer 3 Present #define SYSCTL_PPTIMER_P2 0x00000004 // Timer 2 Present #define SYSCTL_PPTIMER_P1 0x00000002 // Timer 1 Present #define SYSCTL_PPTIMER_P0 0x00000001 // Timer 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPGPIO register. // //***************************************************************************** #define SYSCTL_PPGPIO_P17 0x00020000 // GPIO Port T Present #define SYSCTL_PPGPIO_P16 0x00010000 // GPIO Port S Present #define SYSCTL_PPGPIO_P15 0x00008000 // GPIO Port R Present #define SYSCTL_PPGPIO_P14 0x00004000 // GPIO Port Q Present #define SYSCTL_PPGPIO_P13 0x00002000 // GPIO Port P Present #define SYSCTL_PPGPIO_P12 0x00001000 // GPIO Port N Present #define SYSCTL_PPGPIO_P11 0x00000800 // GPIO Port M Present #define SYSCTL_PPGPIO_P10 0x00000400 // GPIO Port L Present #define SYSCTL_PPGPIO_P9 0x00000200 // GPIO Port K Present #define SYSCTL_PPGPIO_P8 0x00000100 // GPIO Port J Present #define SYSCTL_PPGPIO_P7 0x00000080 // GPIO Port H Present #define SYSCTL_PPGPIO_P6 0x00000040 // GPIO Port G Present #define SYSCTL_PPGPIO_P5 0x00000020 // GPIO Port F Present #define SYSCTL_PPGPIO_P4 0x00000010 // GPIO Port E Present #define SYSCTL_PPGPIO_P3 0x00000008 // GPIO Port D Present #define SYSCTL_PPGPIO_P2 0x00000004 // GPIO Port C Present #define SYSCTL_PPGPIO_P1 0x00000002 // GPIO Port B Present #define SYSCTL_PPGPIO_P0 0x00000001 // GPIO Port A Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPDMA register. // //***************************************************************************** #define SYSCTL_PPDMA_P0 0x00000001 // uDMA Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPEPI register. // //***************************************************************************** #define SYSCTL_PPEPI_P0 0x00000001 // EPI Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPHIB register. // //***************************************************************************** #define SYSCTL_PPHIB_P0 0x00000001 // Hibernation Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPUART register. // //***************************************************************************** #define SYSCTL_PPUART_P7 0x00000080 // UART Module 7 Present #define SYSCTL_PPUART_P6 0x00000040 // UART Module 6 Present #define SYSCTL_PPUART_P5 0x00000020 // UART Module 5 Present #define SYSCTL_PPUART_P4 0x00000010 // UART Module 4 Present #define SYSCTL_PPUART_P3 0x00000008 // UART Module 3 Present #define SYSCTL_PPUART_P2 0x00000004 // UART Module 2 Present #define SYSCTL_PPUART_P1 0x00000002 // UART Module 1 Present #define SYSCTL_PPUART_P0 0x00000001 // UART Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPSSI register. // //***************************************************************************** #define SYSCTL_PPSSI_P3 0x00000008 // SSI Module 3 Present #define SYSCTL_PPSSI_P2 0x00000004 // SSI Module 2 Present #define SYSCTL_PPSSI_P1 0x00000002 // SSI Module 1 Present #define SYSCTL_PPSSI_P0 0x00000001 // SSI Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPI2C register. // //***************************************************************************** #define SYSCTL_PPI2C_P9 0x00000200 // I2C Module 9 Present #define SYSCTL_PPI2C_P8 0x00000100 // I2C Module 8 Present #define SYSCTL_PPI2C_P7 0x00000080 // I2C Module 7 Present #define SYSCTL_PPI2C_P6 0x00000040 // I2C Module 6 Present #define SYSCTL_PPI2C_P5 0x00000020 // I2C Module 5 Present #define SYSCTL_PPI2C_P4 0x00000010 // I2C Module 4 Present #define SYSCTL_PPI2C_P3 0x00000008 // I2C Module 3 Present #define SYSCTL_PPI2C_P2 0x00000004 // I2C Module 2 Present #define SYSCTL_PPI2C_P1 0x00000002 // I2C Module 1 Present #define SYSCTL_PPI2C_P0 0x00000001 // I2C Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPUSB register. // //***************************************************************************** #define SYSCTL_PPUSB_P0 0x00000001 // USB Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPEPHY register. // //***************************************************************************** #define SYSCTL_PPEPHY_P0 0x00000001 // Ethernet PHY Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPCAN register. // //***************************************************************************** #define SYSCTL_PPCAN_P1 0x00000002 // CAN Module 1 Present #define SYSCTL_PPCAN_P0 0x00000001 // CAN Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPADC register. // //***************************************************************************** #define SYSCTL_PPADC_P1 0x00000002 // ADC Module 1 Present #define SYSCTL_PPADC_P0 0x00000001 // ADC Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPACMP register. // //***************************************************************************** #define SYSCTL_PPACMP_P0 0x00000001 // Analog Comparator Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPPWM register. // //***************************************************************************** #define SYSCTL_PPPWM_P1 0x00000002 // PWM Module 1 Present #define SYSCTL_PPPWM_P0 0x00000001 // PWM Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPQEI register. // //***************************************************************************** #define SYSCTL_PPQEI_P1 0x00000002 // QEI Module 1 Present #define SYSCTL_PPQEI_P0 0x00000001 // QEI Module 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPFAN register. // //***************************************************************************** #define SYSCTL_PPFAN_P1 0x00000002 // FAN 1 Module Present #define SYSCTL_PPFAN_P0 0x00000001 // FAN Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPEEPROM // register. // //***************************************************************************** #define SYSCTL_PPEEPROM_P0 0x00000001 // EEPROM Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPWTIMER // register. // //***************************************************************************** #define SYSCTL_PPWTIMER_P5 0x00000020 // Wide Timer 5 Present #define SYSCTL_PPWTIMER_P4 0x00000010 // Wide Timer 4 Present #define SYSCTL_PPWTIMER_P3 0x00000008 // Wide Timer 3 Present #define SYSCTL_PPWTIMER_P2 0x00000004 // Wide Timer 2 Present #define SYSCTL_PPWTIMER_P1 0x00000002 // Wide Timer 1 Present #define SYSCTL_PPWTIMER_P0 0x00000001 // Wide Timer 0 Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPRTS register. // //***************************************************************************** #define SYSCTL_PPRTS_P0 0x00000001 // RTS Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPCCM register. // //***************************************************************************** #define SYSCTL_PPCCM_P0 0x00000001 // CRC and Cryptographic Modules // Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPLCD register. // //***************************************************************************** #define SYSCTL_PPLCD_P0 0x00000001 // LCD Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPOWIRE register. // //***************************************************************************** #define SYSCTL_PPOWIRE_P0 0x00000001 // One-Wire Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPEMAC register. // //***************************************************************************** #define SYSCTL_PPEMAC_P0 0x00000001 // Ethernet Controller Module // Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PPHIM register. // //***************************************************************************** #define SYSCTL_PPHIM_P0 0x00000001 // HIM Module Present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRWD register. // //***************************************************************************** #define SYSCTL_SRWD_R1 0x00000002 // Watchdog Timer 1 Software Reset #define SYSCTL_SRWD_R0 0x00000001 // Watchdog Timer 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRTIMER register. // //***************************************************************************** #define SYSCTL_SRTIMER_R7 0x00000080 // 16/32-Bit General-Purpose Timer // 7 Software Reset #define SYSCTL_SRTIMER_R6 0x00000040 // 16/32-Bit General-Purpose Timer // 6 Software Reset #define SYSCTL_SRTIMER_R5 0x00000020 // Timer 5 Software Reset #define SYSCTL_SRTIMER_R4 0x00000010 // Timer 4 Software Reset #define SYSCTL_SRTIMER_R3 0x00000008 // Timer 3 Software Reset #define SYSCTL_SRTIMER_R2 0x00000004 // Timer 2 Software Reset #define SYSCTL_SRTIMER_R1 0x00000002 // Timer 1 Software Reset #define SYSCTL_SRTIMER_R0 0x00000001 // Timer 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRGPIO register. // //***************************************************************************** #define SYSCTL_SRGPIO_R17 0x00020000 // GPIO Port T Software Reset #define SYSCTL_SRGPIO_R16 0x00010000 // GPIO Port S Software Reset #define SYSCTL_SRGPIO_R15 0x00008000 // GPIO Port R Software Reset #define SYSCTL_SRGPIO_R14 0x00004000 // GPIO Port Q Software Reset #define SYSCTL_SRGPIO_R13 0x00002000 // GPIO Port P Software Reset #define SYSCTL_SRGPIO_R12 0x00001000 // GPIO Port N Software Reset #define SYSCTL_SRGPIO_R11 0x00000800 // GPIO Port M Software Reset #define SYSCTL_SRGPIO_R10 0x00000400 // GPIO Port L Software Reset #define SYSCTL_SRGPIO_R9 0x00000200 // GPIO Port K Software Reset #define SYSCTL_SRGPIO_R8 0x00000100 // GPIO Port J Software Reset #define SYSCTL_SRGPIO_R7 0x00000080 // GPIO Port H Software Reset #define SYSCTL_SRGPIO_R6 0x00000040 // GPIO Port G Software Reset #define SYSCTL_SRGPIO_R5 0x00000020 // GPIO Port F Software Reset #define SYSCTL_SRGPIO_R4 0x00000010 // GPIO Port E Software Reset #define SYSCTL_SRGPIO_R3 0x00000008 // GPIO Port D Software Reset #define SYSCTL_SRGPIO_R2 0x00000004 // GPIO Port C Software Reset #define SYSCTL_SRGPIO_R1 0x00000002 // GPIO Port B Software Reset #define SYSCTL_SRGPIO_R0 0x00000001 // GPIO Port A Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRDMA register. // //***************************************************************************** #define SYSCTL_SRDMA_R0 0x00000001 // uDMA Module Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SREPI register. // //***************************************************************************** #define SYSCTL_SREPI_R0 0x00000001 // EPI Module Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRHIB register. // //***************************************************************************** #define SYSCTL_SRHIB_R0 0x00000001 // Hibernation Module Software // Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRUART register. // //***************************************************************************** #define SYSCTL_SRUART_R7 0x00000080 // UART Module 7 Software Reset #define SYSCTL_SRUART_R6 0x00000040 // UART Module 6 Software Reset #define SYSCTL_SRUART_R5 0x00000020 // UART Module 5 Software Reset #define SYSCTL_SRUART_R4 0x00000010 // UART Module 4 Software Reset #define SYSCTL_SRUART_R3 0x00000008 // UART Module 3 Software Reset #define SYSCTL_SRUART_R2 0x00000004 // UART Module 2 Software Reset #define SYSCTL_SRUART_R1 0x00000002 // UART Module 1 Software Reset #define SYSCTL_SRUART_R0 0x00000001 // UART Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRSSI register. // //***************************************************************************** #define SYSCTL_SRSSI_R3 0x00000008 // SSI Module 3 Software Reset #define SYSCTL_SRSSI_R2 0x00000004 // SSI Module 2 Software Reset #define SYSCTL_SRSSI_R1 0x00000002 // SSI Module 1 Software Reset #define SYSCTL_SRSSI_R0 0x00000001 // SSI Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRI2C register. // //***************************************************************************** #define SYSCTL_SRI2C_R9 0x00000200 // I2C Module 9 Software Reset #define SYSCTL_SRI2C_R8 0x00000100 // I2C Module 8 Software Reset #define SYSCTL_SRI2C_R7 0x00000080 // I2C Module 7 Software Reset #define SYSCTL_SRI2C_R6 0x00000040 // I2C Module 6 Software Reset #define SYSCTL_SRI2C_R5 0x00000020 // I2C Module 5 Software Reset #define SYSCTL_SRI2C_R4 0x00000010 // I2C Module 4 Software Reset #define SYSCTL_SRI2C_R3 0x00000008 // I2C Module 3 Software Reset #define SYSCTL_SRI2C_R2 0x00000004 // I2C Module 2 Software Reset #define SYSCTL_SRI2C_R1 0x00000002 // I2C Module 1 Software Reset #define SYSCTL_SRI2C_R0 0x00000001 // I2C Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRUSB register. // //***************************************************************************** #define SYSCTL_SRUSB_R0 0x00000001 // USB Module Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SREPHY register. // //***************************************************************************** #define SYSCTL_SREPHY_R0 0x00000001 // Ethernet PHY Module Software // Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCAN register. // //***************************************************************************** #define SYSCTL_SRCAN_R1 0x00000002 // CAN Module 1 Software Reset #define SYSCTL_SRCAN_R0 0x00000001 // CAN Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRADC register. // //***************************************************************************** #define SYSCTL_SRADC_R1 0x00000002 // ADC Module 1 Software Reset #define SYSCTL_SRADC_R0 0x00000001 // ADC Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRACMP register. // //***************************************************************************** #define SYSCTL_SRACMP_R0 0x00000001 // Analog Comparator Module 0 // Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRPWM register. // //***************************************************************************** #define SYSCTL_SRPWM_R1 0x00000002 // PWM Module 1 Software Reset #define SYSCTL_SRPWM_R0 0x00000001 // PWM Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRQEI register. // //***************************************************************************** #define SYSCTL_SRQEI_R1 0x00000002 // QEI Module 1 Software Reset #define SYSCTL_SRQEI_R0 0x00000001 // QEI Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRFAN register. // //***************************************************************************** #define SYSCTL_SRFAN_R1 0x00000002 // FAN 1 Module Software Reset #define SYSCTL_SRFAN_R0 0x00000001 // FAN Module Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SREEPROM // register. // //***************************************************************************** #define SYSCTL_SREEPROM_R0 0x00000001 // EEPROM Module Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRWTIMER // register. // //***************************************************************************** #define SYSCTL_SRWTIMER_R5 0x00000020 // Wide Timer 5 Software Reset #define SYSCTL_SRWTIMER_R4 0x00000010 // Wide Timer 4 Software Reset #define SYSCTL_SRWTIMER_R3 0x00000008 // Wide Timer 3 Software Reset #define SYSCTL_SRWTIMER_R2 0x00000004 // Wide Timer 2 Software Reset #define SYSCTL_SRWTIMER_R1 0x00000002 // Wide Timer 1 Software Reset #define SYSCTL_SRWTIMER_R0 0x00000001 // Wide Timer 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCCM register. // //***************************************************************************** #define SYSCTL_SRCCM_R0 0x00000001 // CRC and Cryptographic Modules // Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRLCD register. // //***************************************************************************** #define SYSCTL_SRLCD_R0 0x00000001 // LCD Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SROWIRE register. // //***************************************************************************** #define SYSCTL_SROWIRE_R0 0x00000001 // HIM Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SREMAC register. // //***************************************************************************** #define SYSCTL_SREMAC_R0 0x00000001 // Ethernet Controller MAC Module 0 // Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRHIM register. // //***************************************************************************** #define SYSCTL_SRHIM_R0 0x00000001 // HIM Module 0 Software Reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCWD register. // //***************************************************************************** #define SYSCTL_RCGCWD_R1 0x00000002 // Watchdog Timer 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCWD_R0 0x00000001 // Watchdog Timer 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCTIMER // register. // //***************************************************************************** #define SYSCTL_RCGCTIMER_R7 0x00000080 // 16/32-Bit General-Purpose Timer // 7 Run Mode Clock Gating Control #define SYSCTL_RCGCTIMER_R6 0x00000040 // 16/32-Bit General-Purpose Timer // 6 Run Mode Clock Gating Control #define SYSCTL_RCGCTIMER_R5 0x00000020 // Timer 5 Run Mode Clock Gating // Control #define SYSCTL_RCGCTIMER_R4 0x00000010 // Timer 4 Run Mode Clock Gating // Control #define SYSCTL_RCGCTIMER_R3 0x00000008 // Timer 3 Run Mode Clock Gating // Control #define SYSCTL_RCGCTIMER_R2 0x00000004 // Timer 2 Run Mode Clock Gating // Control #define SYSCTL_RCGCTIMER_R1 0x00000002 // Timer 1 Run Mode Clock Gating // Control #define SYSCTL_RCGCTIMER_R0 0x00000001 // Timer 0 Run Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCGPIO // register. // //***************************************************************************** #define SYSCTL_RCGCGPIO_R17 0x00020000 // GPIO Port T Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R16 0x00010000 // GPIO Port S Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R15 0x00008000 // GPIO Port R Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R14 0x00004000 // GPIO Port Q Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R13 0x00002000 // GPIO Port P Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R12 0x00001000 // GPIO Port N Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R11 0x00000800 // GPIO Port M Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R10 0x00000400 // GPIO Port L Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R9 0x00000200 // GPIO Port K Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R8 0x00000100 // GPIO Port J Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R7 0x00000080 // GPIO Port H Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R6 0x00000040 // GPIO Port G Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R5 0x00000020 // GPIO Port F Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R4 0x00000010 // GPIO Port E Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R3 0x00000008 // GPIO Port D Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R2 0x00000004 // GPIO Port C Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R1 0x00000002 // GPIO Port B Run Mode Clock // Gating Control #define SYSCTL_RCGCGPIO_R0 0x00000001 // GPIO Port A Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCDMA register. // //***************************************************************************** #define SYSCTL_RCGCDMA_R0 0x00000001 // uDMA Module Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCEPI register. // //***************************************************************************** #define SYSCTL_RCGCEPI_R0 0x00000001 // EPI Module Run Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCHIB register. // //***************************************************************************** #define SYSCTL_RCGCHIB_R0 0x00000001 // Hibernation Module Run Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCUART // register. // //***************************************************************************** #define SYSCTL_RCGCUART_R7 0x00000080 // UART Module 7 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R6 0x00000040 // UART Module 6 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R5 0x00000020 // UART Module 5 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R4 0x00000010 // UART Module 4 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R3 0x00000008 // UART Module 3 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R2 0x00000004 // UART Module 2 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R1 0x00000002 // UART Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCUART_R0 0x00000001 // UART Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCSSI register. // //***************************************************************************** #define SYSCTL_RCGCSSI_R3 0x00000008 // SSI Module 3 Run Mode Clock // Gating Control #define SYSCTL_RCGCSSI_R2 0x00000004 // SSI Module 2 Run Mode Clock // Gating Control #define SYSCTL_RCGCSSI_R1 0x00000002 // SSI Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCSSI_R0 0x00000001 // SSI Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCI2C register. // //***************************************************************************** #define SYSCTL_RCGCI2C_R9 0x00000200 // I2C Module 9 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R8 0x00000100 // I2C Module 8 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R7 0x00000080 // I2C Module 7 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R6 0x00000040 // I2C Module 6 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R5 0x00000020 // I2C Module 5 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R4 0x00000010 // I2C Module 4 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R3 0x00000008 // I2C Module 3 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R2 0x00000004 // I2C Module 2 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R1 0x00000002 // I2C Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCI2C_R0 0x00000001 // I2C Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCUSB register. // //***************************************************************************** #define SYSCTL_RCGCUSB_R0 0x00000001 // USB Module Run Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCEPHY // register. // //***************************************************************************** #define SYSCTL_RCGCEPHY_R0 0x00000001 // Ethernet PHY Module Run Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCCAN register. // //***************************************************************************** #define SYSCTL_RCGCCAN_R1 0x00000002 // CAN Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCCAN_R0 0x00000001 // CAN Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCADC register. // //***************************************************************************** #define SYSCTL_RCGCADC_R1 0x00000002 // ADC Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCADC_R0 0x00000001 // ADC Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCACMP // register. // //***************************************************************************** #define SYSCTL_RCGCACMP_R0 0x00000001 // Analog Comparator Module 0 Run // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCPWM register. // //***************************************************************************** #define SYSCTL_RCGCPWM_R1 0x00000002 // PWM Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCPWM_R0 0x00000001 // PWM Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCQEI register. // //***************************************************************************** #define SYSCTL_RCGCQEI_R1 0x00000002 // QEI Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCQEI_R0 0x00000001 // QEI Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCFAN register. // //***************************************************************************** #define SYSCTL_RCGCFAN_R1 0x00000002 // FAN Module 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCFAN_R0 0x00000001 // FAN Module Run Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCEEPROM // register. // //***************************************************************************** #define SYSCTL_RCGCEEPROM_R0 0x00000001 // EEPROM Module Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCWTIMER // register. // //***************************************************************************** #define SYSCTL_RCGCWTIMER_R5 0x00000020 // Wide Timer 5 Run Mode Clock // Gating Control #define SYSCTL_RCGCWTIMER_R4 0x00000010 // Wide Timer 4 Run Mode Clock // Gating Control #define SYSCTL_RCGCWTIMER_R3 0x00000008 // Wide Timer 3 Run Mode Clock // Gating Control #define SYSCTL_RCGCWTIMER_R2 0x00000004 // Wide Timer 2 Run Mode Clock // Gating Control #define SYSCTL_RCGCWTIMER_R1 0x00000002 // Wide Timer 1 Run Mode Clock // Gating Control #define SYSCTL_RCGCWTIMER_R0 0x00000001 // Wide Timer 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCCCM register. // //***************************************************************************** #define SYSCTL_RCGCCCM_R0 0x00000001 // CRC and Cryptographic Modules // Run Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCLCD register. // //***************************************************************************** #define SYSCTL_RCGCLCD_R0 0x00000001 // LCD Controller Module 0 Run Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCOWIRE // register. // //***************************************************************************** #define SYSCTL_RCGCOWIRE_R0 0x00000001 // One-Wire Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCEMAC // register. // //***************************************************************************** #define SYSCTL_RCGCEMAC_R0 0x00000001 // Ethernet MAC Module 0 Run Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGCHIM register. // //***************************************************************************** #define SYSCTL_RCGCHIM_R0 0x00000001 // HIM Module 0 Run Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCWD register. // //***************************************************************************** #define SYSCTL_SCGCWD_S1 0x00000002 // Watchdog Timer 1 Sleep Mode // Clock Gating Control #define SYSCTL_SCGCWD_S0 0x00000001 // Watchdog Timer 0 Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCTIMER // register. // //***************************************************************************** #define SYSCTL_SCGCTIMER_S7 0x00000080 // 16/32-Bit General-Purpose Timer // 7 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S6 0x00000040 // 16/32-Bit General-Purpose Timer // 6 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S5 0x00000020 // Timer 5 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S4 0x00000010 // Timer 4 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S3 0x00000008 // Timer 3 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S2 0x00000004 // Timer 2 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S1 0x00000002 // Timer 1 Sleep Mode Clock Gating // Control #define SYSCTL_SCGCTIMER_S0 0x00000001 // Timer 0 Sleep Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCGPIO // register. // //***************************************************************************** #define SYSCTL_SCGCGPIO_S17 0x00020000 // GPIO Port T Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S16 0x00010000 // GPIO Port S Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S15 0x00008000 // GPIO Port R Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S14 0x00004000 // GPIO Port Q Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S13 0x00002000 // GPIO Port P Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S12 0x00001000 // GPIO Port N Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S11 0x00000800 // GPIO Port M Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S10 0x00000400 // GPIO Port L Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S9 0x00000200 // GPIO Port K Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S8 0x00000100 // GPIO Port J Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S7 0x00000080 // GPIO Port H Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S6 0x00000040 // GPIO Port G Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S5 0x00000020 // GPIO Port F Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S4 0x00000010 // GPIO Port E Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S3 0x00000008 // GPIO Port D Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S2 0x00000004 // GPIO Port C Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S1 0x00000002 // GPIO Port B Sleep Mode Clock // Gating Control #define SYSCTL_SCGCGPIO_S0 0x00000001 // GPIO Port A Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCDMA register. // //***************************************************************************** #define SYSCTL_SCGCDMA_S0 0x00000001 // uDMA Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCEPI register. // //***************************************************************************** #define SYSCTL_SCGCEPI_S0 0x00000001 // EPI Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCHIB register. // //***************************************************************************** #define SYSCTL_SCGCHIB_S0 0x00000001 // Hibernation Module Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCUART // register. // //***************************************************************************** #define SYSCTL_SCGCUART_S7 0x00000080 // UART Module 7 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S6 0x00000040 // UART Module 6 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S5 0x00000020 // UART Module 5 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S4 0x00000010 // UART Module 4 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S3 0x00000008 // UART Module 3 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S2 0x00000004 // UART Module 2 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S1 0x00000002 // UART Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCUART_S0 0x00000001 // UART Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCSSI register. // //***************************************************************************** #define SYSCTL_SCGCSSI_S3 0x00000008 // SSI Module 3 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCSSI_S2 0x00000004 // SSI Module 2 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCSSI_S1 0x00000002 // SSI Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCSSI_S0 0x00000001 // SSI Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCI2C register. // //***************************************************************************** #define SYSCTL_SCGCI2C_S9 0x00000200 // I2C Module 9 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S8 0x00000100 // I2C Module 8 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S7 0x00000080 // I2C Module 7 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S6 0x00000040 // I2C Module 6 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S5 0x00000020 // I2C Module 5 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S4 0x00000010 // I2C Module 4 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S3 0x00000008 // I2C Module 3 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S2 0x00000004 // I2C Module 2 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S1 0x00000002 // I2C Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCI2C_S0 0x00000001 // I2C Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCUSB register. // //***************************************************************************** #define SYSCTL_SCGCUSB_S0 0x00000001 // USB Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCEPHY // register. // //***************************************************************************** #define SYSCTL_SCGCEPHY_S0 0x00000001 // PHY Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCCAN register. // //***************************************************************************** #define SYSCTL_SCGCCAN_S1 0x00000002 // CAN Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCCAN_S0 0x00000001 // CAN Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCADC register. // //***************************************************************************** #define SYSCTL_SCGCADC_S1 0x00000002 // ADC Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCADC_S0 0x00000001 // ADC Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCACMP // register. // //***************************************************************************** #define SYSCTL_SCGCACMP_S0 0x00000001 // Analog Comparator Module 0 Sleep // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCPWM register. // //***************************************************************************** #define SYSCTL_SCGCPWM_S1 0x00000002 // PWM Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCPWM_S0 0x00000001 // PWM Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCQEI register. // //***************************************************************************** #define SYSCTL_SCGCQEI_S1 0x00000002 // QEI Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCQEI_S0 0x00000001 // QEI Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCFAN register. // //***************************************************************************** #define SYSCTL_SCGCFAN_S1 0x00000002 // FAN Module 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCFAN_S0 0x00000001 // FAN Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCEEPROM // register. // //***************************************************************************** #define SYSCTL_SCGCEEPROM_S0 0x00000001 // EEPROM Module Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCWTIMER // register. // //***************************************************************************** #define SYSCTL_SCGCWTIMER_S5 0x00000020 // Wide Timer 5 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCWTIMER_S4 0x00000010 // Wide Timer 4 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCWTIMER_S3 0x00000008 // Wide Timer 3 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCWTIMER_S2 0x00000004 // Wide Timer 2 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCWTIMER_S1 0x00000002 // Wide Timer 1 Sleep Mode Clock // Gating Control #define SYSCTL_SCGCWTIMER_S0 0x00000001 // Wide Timer 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCCCM register. // //***************************************************************************** #define SYSCTL_SCGCCCM_S0 0x00000001 // CRC and Cryptographic Modules // Sleep Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCLCD register. // //***************************************************************************** #define SYSCTL_SCGCLCD_S0 0x00000001 // LCD Controller Module 0 Sleep // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCOWIRE // register. // //***************************************************************************** #define SYSCTL_SCGCOWIRE_S0 0x00000001 // One-Wire Module 0 Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCEMAC // register. // //***************************************************************************** #define SYSCTL_SCGCEMAC_S0 0x00000001 // Ethernet MAC Module 0 Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGCHIM register. // //***************************************************************************** #define SYSCTL_SCGCHIM_S0 0x00000001 // HIM Module 0 Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCWD register. // //***************************************************************************** #define SYSCTL_DCGCWD_D1 0x00000002 // Watchdog Timer 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWD_D0 0x00000001 // Watchdog Timer 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCTIMER // register. // //***************************************************************************** #define SYSCTL_DCGCTIMER_D7 0x00000080 // 16/32-Bit General-Purpose Timer // 7 Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCTIMER_D6 0x00000040 // 16/32-Bit General-Purpose Timer // 6 Deep-Sleep Mode Clock Gating // Control #define SYSCTL_DCGCTIMER_D5 0x00000020 // Timer 5 Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCTIMER_D4 0x00000010 // Timer 4 Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCTIMER_D3 0x00000008 // Timer 3 Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCTIMER_D2 0x00000004 // Timer 2 Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCTIMER_D1 0x00000002 // Timer 1 Deep-Sleep Mode Clock // Gating Control #define SYSCTL_DCGCTIMER_D0 0x00000001 // Timer 0 Deep-Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCGPIO // register. // //***************************************************************************** #define SYSCTL_DCGCGPIO_D17 0x00020000 // GPIO Port T Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D16 0x00010000 // GPIO Port S Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D15 0x00008000 // GPIO Port R Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D14 0x00004000 // GPIO Port Q Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D13 0x00002000 // GPIO Port P Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D12 0x00001000 // GPIO Port N Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D11 0x00000800 // GPIO Port M Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D10 0x00000400 // GPIO Port L Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D9 0x00000200 // GPIO Port K Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D8 0x00000100 // GPIO Port J Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D7 0x00000080 // GPIO Port H Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D6 0x00000040 // GPIO Port G Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D5 0x00000020 // GPIO Port F Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D4 0x00000010 // GPIO Port E Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D3 0x00000008 // GPIO Port D Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D2 0x00000004 // GPIO Port C Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D1 0x00000002 // GPIO Port B Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCGPIO_D0 0x00000001 // GPIO Port A Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCDMA register. // //***************************************************************************** #define SYSCTL_DCGCDMA_D0 0x00000001 // uDMA Module Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCEPI register. // //***************************************************************************** #define SYSCTL_DCGCEPI_D0 0x00000001 // EPI Module Deep-Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCHIB register. // //***************************************************************************** #define SYSCTL_DCGCHIB_D0 0x00000001 // Hibernation Module Deep-Sleep // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCUART // register. // //***************************************************************************** #define SYSCTL_DCGCUART_D7 0x00000080 // UART Module 7 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D6 0x00000040 // UART Module 6 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D5 0x00000020 // UART Module 5 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D4 0x00000010 // UART Module 4 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D3 0x00000008 // UART Module 3 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D2 0x00000004 // UART Module 2 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D1 0x00000002 // UART Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCUART_D0 0x00000001 // UART Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCSSI register. // //***************************************************************************** #define SYSCTL_DCGCSSI_D3 0x00000008 // SSI Module 3 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCSSI_D2 0x00000004 // SSI Module 2 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCSSI_D1 0x00000002 // SSI Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCSSI_D0 0x00000001 // SSI Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCI2C register. // //***************************************************************************** #define SYSCTL_DCGCI2C_D9 0x00000200 // I2C Module 9 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D8 0x00000100 // I2C Module 8 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D7 0x00000080 // I2C Module 7 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D6 0x00000040 // I2C Module 6 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D5 0x00000020 // I2C Module 5 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D4 0x00000010 // I2C Module 4 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D3 0x00000008 // I2C Module 3 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D2 0x00000004 // I2C Module 2 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D1 0x00000002 // I2C Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCI2C_D0 0x00000001 // I2C Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCUSB register. // //***************************************************************************** #define SYSCTL_DCGCUSB_D0 0x00000001 // USB Module Deep-Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCEPHY // register. // //***************************************************************************** #define SYSCTL_DCGCEPHY_D0 0x00000001 // PHY Module Deep-Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCCAN register. // //***************************************************************************** #define SYSCTL_DCGCCAN_D1 0x00000002 // CAN Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCCAN_D0 0x00000001 // CAN Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCADC register. // //***************************************************************************** #define SYSCTL_DCGCADC_D1 0x00000002 // ADC Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCADC_D0 0x00000001 // ADC Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCACMP // register. // //***************************************************************************** #define SYSCTL_DCGCACMP_D0 0x00000001 // Analog Comparator Module 0 // Deep-Sleep Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCPWM register. // //***************************************************************************** #define SYSCTL_DCGCPWM_D1 0x00000002 // PWM Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCPWM_D0 0x00000001 // PWM Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCQEI register. // //***************************************************************************** #define SYSCTL_DCGCQEI_D1 0x00000002 // QEI Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCQEI_D0 0x00000001 // QEI Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCFAN register. // //***************************************************************************** #define SYSCTL_DCGCFAN_D1 0x00000002 // FAN Module 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCFAN_D0 0x00000001 // FAN Module Deep-Sleep Mode Clock // Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCEEPROM // register. // //***************************************************************************** #define SYSCTL_DCGCEEPROM_D0 0x00000001 // EEPROM Module Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCWTIMER // register. // //***************************************************************************** #define SYSCTL_DCGCWTIMER_D5 0x00000020 // Wide Timer 5 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWTIMER_D4 0x00000010 // Wide Timer 4 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWTIMER_D3 0x00000008 // Wide Timer 3 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWTIMER_D2 0x00000004 // Wide Timer 2 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWTIMER_D1 0x00000002 // Wide Timer 1 Deep-Sleep Mode // Clock Gating Control #define SYSCTL_DCGCWTIMER_D0 0x00000001 // Wide Timer 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCCCM register. // //***************************************************************************** #define SYSCTL_DCGCCCM_D0 0x00000001 // CRC and Cryptographic Modules // Deep-Sleep Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCLCD register. // //***************************************************************************** #define SYSCTL_DCGCLCD_D0 0x00000001 // LCD Controller Module 0 // Deep-Sleep Mode Clock Gating // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCOWIRE // register. // //***************************************************************************** #define SYSCTL_DCGCOWIRE_D0 0x00000001 // One-Wire Module 0 Deep-Sleep // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCEMAC // register. // //***************************************************************************** #define SYSCTL_DCGCEMAC_D0 0x00000001 // Ethernet MAC Module 0 Deep-Sleep // Mode Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGCHIM register. // //***************************************************************************** #define SYSCTL_DCGCHIM_D0 0x00000001 // HIM Module 0 Deep-Sleep Mode // Clock Gating Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCWD register. // //***************************************************************************** #define SYSCTL_PCWD_P1 0x00000002 // Watchdog Timer 1 Power Control #define SYSCTL_PCWD_P0 0x00000001 // Watchdog Timer 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCTIMER register. // //***************************************************************************** #define SYSCTL_PCTIMER_P7 0x00000080 // General-Purpose Timer 7 Power // Control #define SYSCTL_PCTIMER_P6 0x00000040 // General-Purpose Timer 6 Power // Control #define SYSCTL_PCTIMER_P5 0x00000020 // 16/32-Bit General-Purpose Timer // 5 Power Control #define SYSCTL_PCTIMER_P4 0x00000010 // 16/32-Bit General-Purpose Timer // 4 Power Control #define SYSCTL_PCTIMER_P3 0x00000008 // 16/32-Bit General-Purpose Timer // 3 Power Control #define SYSCTL_PCTIMER_P2 0x00000004 // 16/32-Bit General-Purpose Timer // 2 Power Control #define SYSCTL_PCTIMER_P1 0x00000002 // 16/32-Bit General-Purpose Timer // 1 Power Control #define SYSCTL_PCTIMER_P0 0x00000001 // 16/32-Bit General-Purpose Timer // 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCGPIO register. // //***************************************************************************** #define SYSCTL_PCGPIO_P17 0x00020000 // GPIO Port T Power Control #define SYSCTL_PCGPIO_P16 0x00010000 // GPIO Port S Power Control #define SYSCTL_PCGPIO_P15 0x00008000 // GPIO Port R Power Control #define SYSCTL_PCGPIO_P14 0x00004000 // GPIO Port Q Power Control #define SYSCTL_PCGPIO_P13 0x00002000 // GPIO Port P Power Control #define SYSCTL_PCGPIO_P12 0x00001000 // GPIO Port N Power Control #define SYSCTL_PCGPIO_P11 0x00000800 // GPIO Port M Power Control #define SYSCTL_PCGPIO_P10 0x00000400 // GPIO Port L Power Control #define SYSCTL_PCGPIO_P9 0x00000200 // GPIO Port K Power Control #define SYSCTL_PCGPIO_P8 0x00000100 // GPIO Port J Power Control #define SYSCTL_PCGPIO_P7 0x00000080 // GPIO Port H Power Control #define SYSCTL_PCGPIO_P6 0x00000040 // GPIO Port G Power Control #define SYSCTL_PCGPIO_P5 0x00000020 // GPIO Port F Power Control #define SYSCTL_PCGPIO_P4 0x00000010 // GPIO Port E Power Control #define SYSCTL_PCGPIO_P3 0x00000008 // GPIO Port D Power Control #define SYSCTL_PCGPIO_P2 0x00000004 // GPIO Port C Power Control #define SYSCTL_PCGPIO_P1 0x00000002 // GPIO Port B Power Control #define SYSCTL_PCGPIO_P0 0x00000001 // GPIO Port A Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCDMA register. // //***************************************************************************** #define SYSCTL_PCDMA_P0 0x00000001 // uDMA Module Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCEPI register. // //***************************************************************************** #define SYSCTL_PCEPI_P0 0x00000001 // EPI Module Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCHIB register. // //***************************************************************************** #define SYSCTL_PCHIB_P0 0x00000001 // Hibernation Module Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCUART register. // //***************************************************************************** #define SYSCTL_PCUART_P7 0x00000080 // UART Module 7 Power Control #define SYSCTL_PCUART_P6 0x00000040 // UART Module 6 Power Control #define SYSCTL_PCUART_P5 0x00000020 // UART Module 5 Power Control #define SYSCTL_PCUART_P4 0x00000010 // UART Module 4 Power Control #define SYSCTL_PCUART_P3 0x00000008 // UART Module 3 Power Control #define SYSCTL_PCUART_P2 0x00000004 // UART Module 2 Power Control #define SYSCTL_PCUART_P1 0x00000002 // UART Module 1 Power Control #define SYSCTL_PCUART_P0 0x00000001 // UART Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCSSI register. // //***************************************************************************** #define SYSCTL_PCSSI_P3 0x00000008 // SSI Module 3 Power Control #define SYSCTL_PCSSI_P2 0x00000004 // SSI Module 2 Power Control #define SYSCTL_PCSSI_P1 0x00000002 // SSI Module 1 Power Control #define SYSCTL_PCSSI_P0 0x00000001 // SSI Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCI2C register. // //***************************************************************************** #define SYSCTL_PCI2C_P9 0x00000200 // I2C Module 9 Power Control #define SYSCTL_PCI2C_P8 0x00000100 // I2C Module 8 Power Control #define SYSCTL_PCI2C_P7 0x00000080 // I2C Module 7 Power Control #define SYSCTL_PCI2C_P6 0x00000040 // I2C Module 6 Power Control #define SYSCTL_PCI2C_P5 0x00000020 // I2C Module 5 Power Control #define SYSCTL_PCI2C_P4 0x00000010 // I2C Module 4 Power Control #define SYSCTL_PCI2C_P3 0x00000008 // I2C Module 3 Power Control #define SYSCTL_PCI2C_P2 0x00000004 // I2C Module 2 Power Control #define SYSCTL_PCI2C_P1 0x00000002 // I2C Module 1 Power Control #define SYSCTL_PCI2C_P0 0x00000001 // I2C Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCUSB register. // //***************************************************************************** #define SYSCTL_PCUSB_P0 0x00000001 // USB Module Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCEPHY register. // //***************************************************************************** #define SYSCTL_PCEPHY_P0 0x00000001 // Ethernet PHY Module Power // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCCAN register. // //***************************************************************************** #define SYSCTL_PCCAN_P1 0x00000002 // CAN Module 1 Power Control #define SYSCTL_PCCAN_P0 0x00000001 // CAN Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCADC register. // //***************************************************************************** #define SYSCTL_PCADC_P1 0x00000002 // ADC Module 1 Power Control #define SYSCTL_PCADC_P0 0x00000001 // ADC Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCACMP register. // //***************************************************************************** #define SYSCTL_PCACMP_P0 0x00000001 // Analog Comparator Module 0 Power // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCPWM register. // //***************************************************************************** #define SYSCTL_PCPWM_P0 0x00000001 // PWM Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCQEI register. // //***************************************************************************** #define SYSCTL_PCQEI_P0 0x00000001 // QEI Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCFAN register. // //***************************************************************************** #define SYSCTL_PCFAN_P1 0x00000002 // FAN Module 1 Power Control #define SYSCTL_PCFAN_P0 0x00000001 // FAN Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCEEPROM // register. // //***************************************************************************** #define SYSCTL_PCEEPROM_P0 0x00000001 // EEPROM Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCCCM register. // //***************************************************************************** #define SYSCTL_PCCCM_P0 0x00000001 // CRC and Cryptographic Modules // Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCLCD register. // //***************************************************************************** #define SYSCTL_PCLCD_P0 0x00000001 // LCD Controller Module 0 Power // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCOWIRE register. // //***************************************************************************** #define SYSCTL_PCOWIRE_P0 0x00000001 // 1-Wire Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCEMAC register. // //***************************************************************************** #define SYSCTL_PCEMAC_P0 0x00000001 // Ethernet MAC Module 0 Power // Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PCHIM register. // //***************************************************************************** #define SYSCTL_PCHIM_P0 0x00000001 // HIM Module 0 Power Control //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRWD register. // //***************************************************************************** #define SYSCTL_PRWD_R1 0x00000002 // Watchdog Timer 1 Peripheral // Ready #define SYSCTL_PRWD_R0 0x00000001 // Watchdog Timer 0 Peripheral // Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRTIMER register. // //***************************************************************************** #define SYSCTL_PRTIMER_R7 0x00000080 // 16/32-Bit General-Purpose Timer // 7 Peripheral Ready #define SYSCTL_PRTIMER_R6 0x00000040 // 16/32-Bit General-Purpose Timer // 6 Peripheral Ready #define SYSCTL_PRTIMER_R5 0x00000020 // Timer 5 Peripheral Ready #define SYSCTL_PRTIMER_R4 0x00000010 // Timer 4 Peripheral Ready #define SYSCTL_PRTIMER_R3 0x00000008 // Timer 3 Peripheral Ready #define SYSCTL_PRTIMER_R2 0x00000004 // Timer 2 Peripheral Ready #define SYSCTL_PRTIMER_R1 0x00000002 // Timer 1 Peripheral Ready #define SYSCTL_PRTIMER_R0 0x00000001 // Timer 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRGPIO register. // //***************************************************************************** #define SYSCTL_PRGPIO_R17 0x00020000 // GPIO Port T Peripheral Ready #define SYSCTL_PRGPIO_R16 0x00010000 // GPIO Port S Peripheral Ready #define SYSCTL_PRGPIO_R15 0x00008000 // GPIO Port R Peripheral Ready #define SYSCTL_PRGPIO_R14 0x00004000 // GPIO Port Q Peripheral Ready #define SYSCTL_PRGPIO_R13 0x00002000 // GPIO Port P Peripheral Ready #define SYSCTL_PRGPIO_R12 0x00001000 // GPIO Port N Peripheral Ready #define SYSCTL_PRGPIO_R11 0x00000800 // GPIO Port M Peripheral Ready #define SYSCTL_PRGPIO_R10 0x00000400 // GPIO Port L Peripheral Ready #define SYSCTL_PRGPIO_R9 0x00000200 // GPIO Port K Peripheral Ready #define SYSCTL_PRGPIO_R8 0x00000100 // GPIO Port J Peripheral Ready #define SYSCTL_PRGPIO_R7 0x00000080 // GPIO Port H Peripheral Ready #define SYSCTL_PRGPIO_R6 0x00000040 // GPIO Port G Peripheral Ready #define SYSCTL_PRGPIO_R5 0x00000020 // GPIO Port F Peripheral Ready #define SYSCTL_PRGPIO_R4 0x00000010 // GPIO Port E Peripheral Ready #define SYSCTL_PRGPIO_R3 0x00000008 // GPIO Port D Peripheral Ready #define SYSCTL_PRGPIO_R2 0x00000004 // GPIO Port C Peripheral Ready #define SYSCTL_PRGPIO_R1 0x00000002 // GPIO Port B Peripheral Ready #define SYSCTL_PRGPIO_R0 0x00000001 // GPIO Port A Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRDMA register. // //***************************************************************************** #define SYSCTL_PRDMA_R0 0x00000001 // uDMA Module Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PREPI register. // //***************************************************************************** #define SYSCTL_PREPI_R0 0x00000001 // EPI Module Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRHIB register. // //***************************************************************************** #define SYSCTL_PRHIB_R0 0x00000001 // Hibernation Module Peripheral // Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRUART register. // //***************************************************************************** #define SYSCTL_PRUART_R7 0x00000080 // UART Module 7 Peripheral Ready #define SYSCTL_PRUART_R6 0x00000040 // UART Module 6 Peripheral Ready #define SYSCTL_PRUART_R5 0x00000020 // UART Module 5 Peripheral Ready #define SYSCTL_PRUART_R4 0x00000010 // UART Module 4 Peripheral Ready #define SYSCTL_PRUART_R3 0x00000008 // UART Module 3 Peripheral Ready #define SYSCTL_PRUART_R2 0x00000004 // UART Module 2 Peripheral Ready #define SYSCTL_PRUART_R1 0x00000002 // UART Module 1 Peripheral Ready #define SYSCTL_PRUART_R0 0x00000001 // UART Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRSSI register. // //***************************************************************************** #define SYSCTL_PRSSI_R3 0x00000008 // SSI Module 3 Peripheral Ready #define SYSCTL_PRSSI_R2 0x00000004 // SSI Module 2 Peripheral Ready #define SYSCTL_PRSSI_R1 0x00000002 // SSI Module 1 Peripheral Ready #define SYSCTL_PRSSI_R0 0x00000001 // SSI Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRI2C register. // //***************************************************************************** #define SYSCTL_PRI2C_R9 0x00000200 // I2C Module 9 Peripheral Ready #define SYSCTL_PRI2C_R8 0x00000100 // I2C Module 8 Peripheral Ready #define SYSCTL_PRI2C_R7 0x00000080 // I2C Module 7 Peripheral Ready #define SYSCTL_PRI2C_R6 0x00000040 // I2C Module 6 Peripheral Ready #define SYSCTL_PRI2C_R5 0x00000020 // I2C Module 5 Peripheral Ready #define SYSCTL_PRI2C_R4 0x00000010 // I2C Module 4 Peripheral Ready #define SYSCTL_PRI2C_R3 0x00000008 // I2C Module 3 Peripheral Ready #define SYSCTL_PRI2C_R2 0x00000004 // I2C Module 2 Peripheral Ready #define SYSCTL_PRI2C_R1 0x00000002 // I2C Module 1 Peripheral Ready #define SYSCTL_PRI2C_R0 0x00000001 // I2C Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRUSB register. // //***************************************************************************** #define SYSCTL_PRUSB_R0 0x00000001 // USB Module Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PREPHY register. // //***************************************************************************** #define SYSCTL_PREPHY_R0 0x00000001 // Ethernet PHY Module Peripheral // Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRCAN register. // //***************************************************************************** #define SYSCTL_PRCAN_R1 0x00000002 // CAN Module 1 Peripheral Ready #define SYSCTL_PRCAN_R0 0x00000001 // CAN Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRADC register. // //***************************************************************************** #define SYSCTL_PRADC_R1 0x00000002 // ADC Module 1 Peripheral Ready #define SYSCTL_PRADC_R0 0x00000001 // ADC Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRACMP register. // //***************************************************************************** #define SYSCTL_PRACMP_R0 0x00000001 // Analog Comparator Module 0 // Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRPWM register. // //***************************************************************************** #define SYSCTL_PRPWM_R1 0x00000002 // PWM Module 1 Peripheral Ready #define SYSCTL_PRPWM_R0 0x00000001 // PWM Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRQEI register. // //***************************************************************************** #define SYSCTL_PRQEI_R1 0x00000002 // QEI Module 1 Peripheral Ready #define SYSCTL_PRQEI_R0 0x00000001 // QEI Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRFAN register. // //***************************************************************************** #define SYSCTL_PRFAN_R1 0x00000002 // FAN Module 1 Peripheral Ready #define SYSCTL_PRFAN_R0 0x00000001 // FAN Module Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PREEPROM // register. // //***************************************************************************** #define SYSCTL_PREEPROM_R0 0x00000001 // EEPROM Module Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRWTIMER // register. // //***************************************************************************** #define SYSCTL_PRWTIMER_R5 0x00000020 // Wide Timer 5 Peripheral Ready #define SYSCTL_PRWTIMER_R4 0x00000010 // Wide Timer 4 Peripheral Ready #define SYSCTL_PRWTIMER_R3 0x00000008 // Wide Timer 3 Peripheral Ready #define SYSCTL_PRWTIMER_R2 0x00000004 // Wide Timer 2 Peripheral Ready #define SYSCTL_PRWTIMER_R1 0x00000002 // Wide Timer 1 Peripheral Ready #define SYSCTL_PRWTIMER_R0 0x00000001 // Wide Timer 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRCCM register. // //***************************************************************************** #define SYSCTL_PRCCM_R0 0x00000001 // CRC and Cryptographic Modules // Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRLCD register. // //***************************************************************************** #define SYSCTL_PRLCD_R0 0x00000001 // LCD Controller Module 0 // Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PROWIRE register. // //***************************************************************************** #define SYSCTL_PROWIRE_R0 0x00000001 // One-Wire Module 0 Peripheral // Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PREMAC register. // //***************************************************************************** #define SYSCTL_PREMAC_R0 0x00000001 // Ethernet MAC Module 0 Peripheral // Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PRHIM register. // //***************************************************************************** #define SYSCTL_PRHIM_R0 0x00000001 // HIM Module 0 Peripheral Ready //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_CCMCGREQ // register. // //***************************************************************************** #define SYSCTL_CCMCGREQ_DESCFG 0x00000004 // DES Clock Gating Request #define SYSCTL_CCMCGREQ_AESCFG 0x00000002 // AES Clock Gating Request #define SYSCTL_CCMCGREQ_SHACFG 0x00000001 // SHA/MD5 Clock Gating Request #endif // __HW_SYSCTL_H__
[ "792692227@qq.com" ]
792692227@qq.com
bf0d5dfa7c7be697eb8c458f910ea850473f727b
47bc53f3934b3273fc36113930a1f109aae70534
/Components/Utilities/tea.h
9db48167294fb2eabd888cc5d54c083562feb2e6
[]
no_license
BobDeng1974/M26-DTU
c3cdd3c38c3ebc356c8cf98a043feb745a35f7a3
0f33b432a17c43d3f6e4d1439693a93b64d85d8d
refs/heads/master
2022-04-18T09:37:38.131016
2020-03-30T08:10:01
2020-03-30T08:10:01
262,751,653
0
1
null
2020-05-10T09:22:37
2020-05-10T09:22:36
null
UTF-8
C
false
false
1,136
h
/** ************************************************************************************************** * @file tea.h * @author * @version * @date 6/24/2016 * @brief ************************************************************************************************** * @attention * ************************************************************************************************** */ #ifndef _TEA_H_ #define _TEA_H_ /** * @addtogroup XXX * @{ */ /** * @addtogroup tea_Modules * @{ */ /** * @defgroup tea_Exported_Macros * @{ */ /** * @} */ /** * @defgroup tea_Exported_Constants * @{ */ /** * @} */ /** * @defgroup tea_Exported_Types * @{ */ /** * @} */ /** * @defgroup tea_Exported_Variables * @{ */ /** * @} */ /** * @defgroup tea_Exported_Functions * @{ */ void TEA_Encrypt(uint8_t *pPlain,uint8_t *pCipher,uint32_t *pKey); void TEA_Decrypt(uint8_t *pCipher,uint8_t *pPlain,uint32_t *pKey); /** * @} */ /** * @} */ /** * @} */ #endif
[ "neoxtl@outlook.com" ]
neoxtl@outlook.com
0186c46492b7dee202678f60704d1ff2a8942188
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE124_Buffer_Underwrite/s04/CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11.c
98dbb1961969e3a5e3cbbc265e0476c146add78f
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286555
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C
false
false
4,153
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11.c Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml Template File: sources-sink-11.tmpl.c */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sink: memcpy * BadSink : Copy string to data using memcpy * Flow Variant: 11 Control flow: if(globalReturnsTrue()) and if(globalReturnsFalse()) * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11_bad() { wchar_t * data; wchar_t dataBuffer[100]; wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; if(globalReturnsTrue()) { /* FLAW: Set data pointer to before the allocated memory buffer */ data = dataBuffer - 8; } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memcpy(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the globalReturnsTrue() to globalReturnsFalse() */ static void goodG2B1() { wchar_t * data; wchar_t dataBuffer[100]; wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; if(globalReturnsFalse()) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memcpy(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { wchar_t * data; wchar_t dataBuffer[100]; wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; if(globalReturnsTrue()) { /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; } { wchar_t source[100]; wmemset(source, L'C', 100-1); /* fill with 'C's */ source[100-1] = L'\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memcpy(data, source, 100*sizeof(wchar_t)); /* Ensure the destination buffer is null terminated */ data[100-1] = L'\0'; printWLine(data); } } void CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE124_Buffer_Underwrite__wchar_t_declare_memcpy_11_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "yzhang0701@gmail.com" ]
yzhang0701@gmail.com
0e877603209f2f68a1971c1ef766fb273177e608
71292db699be59bcaa1e185238fb0b7922e4e233
/src/errors/check_dup_bridges.c
b4b1ba7e91da86bdeb14fd16ab01cdf5509f5ba0
[]
no_license
fiestaua/Pathfinder
81ec2e7bd9ba5d3f8cf9f34129c09f472ccb57e4
a20946cc0c7eacb0b976a13693ecc1c71c96df3d
refs/heads/main
2023-02-12T12:00:08.297939
2021-01-13T23:27:15
2021-01-13T23:27:15
329,449,199
0
0
null
null
null
null
UTF-8
C
false
false
710
c
#include "pathfinder.h" void check_dup_bridges(t_island *isl) { for (int i = 0; i <= isl->numb_of_words - 3; i += 3) for (int j = i + 3; j <= isl->numb_of_words - 3; j += 3) if ((mx_strcmp(isl->all_info[i], isl->all_info[j]) == 0) && (mx_strcmp(isl->all_info[i + 1], isl->all_info[j + 1]) == 0)) { mx_printerr("error: duplicate bridges\n"); exit(1); } else if ((mx_strcmp(isl->all_info[i], isl->all_info[j + 1]) == 0) && (mx_strcmp(isl->all_info[i + 1], isl->all_info[j]) == 0)) { mx_printerr("error: duplicate bridges\n"); exit(1); } }
[ "carsgenius1@gmail.com" ]
carsgenius1@gmail.com
18a1fedeef7dcc5bd62a2fe03123c7b7b44645a6
f669f506777a011d78c7a0d9572864d02705aea4
/duplicate_symbols/duplicate_symbols_in_two_static_library/main.c
bf4689b9fa8682ea4a44305353d627fa729c4a52
[]
no_license
woyaozuomanong/ccompilertech
720651998cd02686c88c36d037d80b801222cc06
1f4f210e1b14759cf077ac060d7ef8152c20cb57
refs/heads/master
2020-03-31T09:31:00.812070
2019-03-14T01:43:45
2019-03-14T01:43:45
152,098,715
0
0
null
null
null
null
UTF-8
C
false
false
325
c
#include <stdio.h> #include "libFirst/staticlibfirstexports.h" #include "libSecond/staticlibsecondexports.h" int main() { int nRetValue=0; nRetValue+=staticlibfirst_function(1); nRetValue+=staticlibsecond_function(2); nRetValue+=static_duplicate_function(3); printf("nRetValue=%d\n",nRetValue); return nRetValue; }
[ "peikingren@sohu.com" ]
peikingren@sohu.com
8ea09e5a3453f99ce73dcc1b7af73a687a17ed13
4b307e76d4f36cdb1d0e69394ce7c4506ded3ef5
/src/MH/MinHook.h
fb262ae30045b4218eb1d7e9025d7ebe7012eb52
[]
no_license
Archie-osu/AUMI
625ae6490ebec266df073adb92488b9d6c7e6128
92665a0a031325d423dff8aa46f782978db72e16
refs/heads/main
2023-06-16T05:03:34.361142
2021-07-12T16:14:37
2021-07-12T16:14:37
377,577,061
1
1
null
null
null
null
UTF-8
C
false
false
7,559
h
/* * MinHook - The Minimalistic API Hooking Library for x64/x86 * Copyright (C) 2009-2017 Tsuda Kageyu. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE 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. */ #pragma once #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) #error MinHook supports only x86 and x64 systems. #endif #pragma comment(lib, "MinHook.lib") // Added by Archie #include <windows.h> // MinHook Error Codes. typedef enum MH_STATUS { // Unknown error. Should not be returned. MH_UNKNOWN = -1, // Successful. MH_OK = 0, // MinHook is already initialized. MH_ERROR_ALREADY_INITIALIZED, // MinHook is not initialized yet, or already uninitialized. MH_ERROR_NOT_INITIALIZED, // The hook for the specified target function is already created. MH_ERROR_ALREADY_CREATED, // The hook for the specified target function is not created yet. MH_ERROR_NOT_CREATED, // The hook for the specified target function is already enabled. MH_ERROR_ENABLED, // The hook for the specified target function is not enabled yet, or already // disabled. MH_ERROR_DISABLED, // The specified pointer is invalid. It points the address of non-allocated // and/or non-executable region. MH_ERROR_NOT_EXECUTABLE, // The specified target function cannot be hooked. MH_ERROR_UNSUPPORTED_FUNCTION, // Failed to allocate memory. MH_ERROR_MEMORY_ALLOC, // Failed to change the memory protection. MH_ERROR_MEMORY_PROTECT, // The specified module is not loaded. MH_ERROR_MODULE_NOT_FOUND, // The specified function is not found. MH_ERROR_FUNCTION_NOT_FOUND } MH_STATUS; // Can be passed as a parameter to MH_EnableHook, MH_DisableHook, // MH_QueueEnableHook or MH_QueueDisableHook. #define MH_ALL_HOOKS NULL #ifdef __cplusplus extern "C" { #endif // Initialize the MinHook library. You must call this function EXACTLY ONCE // at the beginning of your program. MH_STATUS WINAPI MH_Initialize(VOID); // Uninitialize the MinHook library. You must call this function EXACTLY // ONCE at the end of your program. MH_STATUS WINAPI MH_Uninitialize(VOID); // Creates a Hook for the specified target function, in disabled state. // Parameters: // pTarget [in] A pointer to the target function, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); // Creates a Hook for the specified API function, in disabled state. // Parameters: // pszModule [in] A pointer to the loaded module name which contains the // target function. // pszTarget [in] A pointer to the target function name, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApi( LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); // Creates a Hook for the specified API function, in disabled state. // Parameters: // pszModule [in] A pointer to the loaded module name which contains the // target function. // pszTarget [in] A pointer to the target function name, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. // ppTarget [out] A pointer to the target function, which will be used // with other functions. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApiEx( LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); // Removes an already created hook. // Parameters: // pTarget [in] A pointer to the target function. MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); // Enables an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // enabled in one go. MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); // Disables an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // disabled in one go. MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); // Queues to enable an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // queued to be enabled. MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); // Queues to disable an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // queued to be disabled. MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); // Applies all queued changes in one go. MH_STATUS WINAPI MH_ApplyQueued(VOID); // Translates the MH_STATUS to its name as a string. const char * WINAPI MH_StatusToString(MH_STATUS status); #ifdef __cplusplus } #endif
[ "pin979xp@gmail.com" ]
pin979xp@gmail.com
da4c73459d26a6ba4ba13696f59b64b634acd997
cf6ade3d144b00aefed370e63d87d10a0ef60dcd
/src/remoteRadioTask.h
8357d31ecc1c6b5d3d571bf616231d7cc3ee8206
[]
no_license
codeshelf/FlyWeight
b24156d286a331103dfd1700596daccf1c077588
b3d7c1dd7cdffb234fddcee78ca710c98cd677cd
refs/heads/master
2021-03-16T05:13:12.101134
2014-10-10T18:48:47
2014-10-10T18:48:47
14,611,266
0
0
null
null
null
null
WINDOWS-1252
C
false
false
800
h
/* FlyWeight © Copyright 2005, 2006 Jeffrey B. Williams All rights reserved $Id$ $Name$ */ #ifndef REMOTERADIOTASK_H #define REMOTERADIOTASK_H // Project includes #include "radioCommon.h" // -------------------------------------------------------------------------- // Externs // -------------------------------------------------------------------------- // Defines #define kAssocCheckTickCount 6000 // 6 seconds #define kNetCheckTickCount 5 * kAssocCheckTickCount // five ACK packets missed then reset - 30sec. // -------------------------------------------------------------------------- // Functions prototypes. void radioReceiveTask( void *pvParameters ); void radioTransmitTask( void *pvParameters ); #endif // REMOTERADIOTASK_H
[ "jeff.williams@codeshelf.com" ]
jeff.williams@codeshelf.com
df1d90e4ab8dde211c7ccf67bad1e8ca140005e5
8a4a69e5b39212b955eb52cc005311a440189c9b
/src/mame/drivers/liberatr.c
0ff32f2a95dd833416e0e7df4222b0dcc1a88579
[]
no_license
Ced2911/mame-lx
7d503b63eb5ae52f1e49763fc156dffa18517ec9
e58a80fefc46bdb879790c6bcfe882a9aff6f3ae
refs/heads/master
2021-01-01T17:37:22.723553
2012-02-04T10:05:52
2012-02-04T10:05:52
3,058,666
1
7
null
null
null
null
UTF-8
C
false
false
21,987
c
/*************************************************************************** Atari Liberator hardware Games supported: * Liberator Known bugs: * none at this time **************************************************************************** Liberator Memory Map (for the main set, the other one is rearranged) (from the schematics/manual) HEX R/W D7 D6 D5 D4 D3 D2 D2 D0 function ---------+-----+------------------------+------------------------ 0000 D D D D D D D D XCOORD 0001 D D D D D D D D YCOORD 0002 D D D BIT MODE DATA ---------+-----+------------------------+------------------------ 0003-033F D D D D D D D D Working RAM 0340-3D3F D D D D D D D D Screen RAM 3D40-3FFF D D D D D D D D Working RAM ---------+-----+------------------------+------------------------ 4000-403F R D D D D D D D D EARD* read from non-volatile memory ---------+-----+------------------------+------------------------ 5000 R D coin AUX (CTRLD* set low) 5000 R D coin LEFT (CTRLD* set low) 5000 R D coin RIGHT (CTRLD* set low) 5000 R D SLAM (CTRLD* set low) 5000 R D SPARE (CTRLD* set low) 5000 R D SPARE (CTRLD* set low) 5000 R D COCKTAIL (CTRLD* set low) 5000 R D SELF-TEST (CTRLD* set low) 5000 R D D D D HDIR (CTRLD* set high) 5000 R D D D D VDIR (CTRLD* set high) ---------+-----+------------------------+------------------------ 5001 R D SHIELD 2 5001 R D SHIELD 1 5001 R D FIRE 2 5001 R D FIRE 1 5001 R D SPARE (CTRLD* set low) 5001 R D START 2 5001 R D START 1 5001 R D VBLANK ---------+-----+------------------------+------------------------ 6000-600F W D D D D base_ram* 6200-621F W D D D D D D D D COLORAM* 6400 W INTACK* 6600 W D D D D EARCON 6800 W D D D D D D D D STARTLG (planet frame) 6A00 W WDOG* ---------+-----+------------------------+------------------------ 6C00 W D START LED 1 6C01 W D START LED 2 6C02 W D TBSWP* 6C03 W D SPARE 6C04 W D CTRLD* 6C05 W D COINCNTRR 6C06 W D COINCNTRL 6C07 W D PLANET ---------+-----+------------------------+------------------------ 6E00-6E3F W D D D D D D D D EARWR* 7000-701F D D D D D D D D IOS2* (Pokey 2) 7800-781F D D D D D D D D IOS1* (Pokey 1) 8000-EFFF R D D D D D D D D ROM ----------------------------------------------------------------- Dip switches at D4 on the PCB for play options: (IN2) LSB D1 D2 D3 D4 D5 D6 MSB SW8 SW7 SW6 SW5 SW4 SW3 SW2 SW1 Option ------------------------------------------------------------------------------------- Off Off 4 ships per game <- On Off 5 ships per game Off On 6 ships per game On On 8 ships per game ------------------------------------------------------------------------------------- Off Off Bonus ship every 15000 points On Off Bonus ship every 20000 points <- Off On Bonus ship every 25000 points On On Bonus ship every 30000 points ------------------------------------------------------------------------------------- On Off Easy game play Off Off Normal game play <- Off On Hard game play ------------------------------------------------------------------------------------- X X Not used ------------------------------------------------------------------------------------- Dip switches at A4 on the PCB for price options: (IN3) LSB D1 D2 D3 D4 D5 D6 MSB SW8 SW7 SW6 SW5 SW4 SW3 SW2 SW1 Option ------------------------------------------------------------------------------------- Off Off Free play On Off 1 coin for 2 credits Off On 1 coin for 1 credit <- On On 2 coins for 1 credit ------------------------------------------------------------------------------------- Off Off Right coin mech X 1 <- On Off Right coin mech X 4 Off On Right coin mech X 5 On On Right coin mech X 6 ------------------------------------------------------------------------------------- Off Left coin mech X 1 <- On Left coin mech X 2 ------------------------------------------------------------------------------------- Off Off Off No bonus coins <- Off On Off For every 4 coins inserted, game logic adds 1 more coin On On Off For every 4 coins inserted, game logic adds 2 more coin Off Off On For every 5 coins inserted, game logic adds 1 more coin On Off On For every 3 coins inserted, game logic adds 1 more coin X On On No bonus coins ------------------------------------------------------------------------------------- <- = Manufacturer's suggested settings Note: ---- The loop at $cf60 should count down from Y=0 instead of Y=0xff. Because of this the first four leftmost pixels of each row are not cleared. This bug is masked by the visible area covering up the offending pixels. ******************************************************************************************/ #define ADDRESS_MAP_MODERN #include "emu.h" #include "includes/liberatr.h" #define MASTER_CLOCK 20000000 /* 20Mhz Main Clock Xtal */ void liberatr_state::machine_start() { atarigen_state::machine_start(); save_item(NAME(m_trackball_offset)); save_item(NAME(m_ctrld)); save_item(NAME(m_videoram)); } /************************************* * * Output ports * *************************************/ WRITE8_MEMBER( liberatr_state::led_w ) { set_led_status(machine(), offset, ~data & 0x10); } WRITE8_MEMBER( liberatr_state::coin_counter_w ) { ::coin_counter_w(machine(), offset ^ 0x01, data & 0x10); } /************************************* * * Input ports * *************************************/ WRITE8_MEMBER( liberatr_state::trackball_reset_w ) { /* on the rising edge of /ctrld, the /ld signal on the LS191 is released and the value of the switches */ /* input becomes the starting point for the trackball counters */ if (((data ^ m_ctrld) & 0x10) && (data & 0x10)) { UINT8 trackball = input_port_read(machine(), "FAKE"); UINT8 switches = input_port_read(machine(), "IN0"); m_trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f); } m_ctrld = data & 0x10; } READ8_MEMBER( liberatr_state::port0_r ) { /* if ctrld is high, the /ld signal on the LS191 is NOT set, meaning that the trackball is counting */ if (m_ctrld) { UINT8 trackball = input_port_read(machine(), "FAKE"); return ((trackball & 0xf0) - (m_trackball_offset & 0xf0)) | ((trackball - m_trackball_offset) & 0x0f); } /* otherwise, the LS191 is simply passing through the raw switch inputs */ else return input_port_read(machine(), "IN0"); } /************************************* * * Main CPU memory handlers * *************************************/ static ADDRESS_MAP_START( liberatr_map, AS_PROGRAM, 8, liberatr_state ) AM_RANGE(0x0000, 0x0000) AM_RAM AM_SHARE("xcoord") AM_RANGE(0x0001, 0x0001) AM_RAM AM_SHARE("ycoord") AM_RANGE(0x0002, 0x0002) AM_READWRITE(bitmap_xy_r, bitmap_xy_w) AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(bitmap_w) AM_SHARE("bitmapram") /* overlapping for my convenience */ AM_RANGE(0x4000, 0x403f) AM_READ_BASE(atarigen_state, earom_r) AM_RANGE(0x5000, 0x5000) AM_READ(port0_r) AM_RANGE(0x5001, 0x5001) AM_READ_PORT("IN1") AM_RANGE(0x6000, 0x600f) AM_WRITEONLY AM_SHARE("base_ram") AM_RANGE(0x6200, 0x621f) AM_WRITEONLY AM_SHARE("colorram") AM_RANGE(0x6400, 0x6400) AM_WRITENOP AM_RANGE(0x6600, 0x6600) AM_WRITE_BASE(atarigen_state, earom_control_w) AM_RANGE(0x6800, 0x6800) AM_WRITEONLY AM_SHARE("planet_frame") AM_RANGE(0x6a00, 0x6a00) AM_WRITE_LEGACY(watchdog_reset_w) AM_RANGE(0x6c00, 0x6c01) AM_WRITE(led_w) AM_RANGE(0x6c04, 0x6c04) AM_WRITE(trackball_reset_w) AM_RANGE(0x6c05, 0x6c06) AM_WRITE(coin_counter_w) AM_RANGE(0x6c07, 0x6c07) AM_WRITEONLY AM_SHARE("planet_select") AM_RANGE(0x6e00, 0x6e3f) AM_WRITE_BASE(atarigen_state, earom_w) AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) AM_RANGE(0x8000, 0xefff) AM_ROM AM_RANGE(0xfffa, 0xffff) AM_ROM ADDRESS_MAP_END /************************************* * * Alternate main CPU memory handlers * *************************************/ static ADDRESS_MAP_START( liberat2_map, AS_PROGRAM, 8, liberatr_state ) AM_RANGE(0x0000, 0x0000) AM_RAM AM_SHARE("xcoord") AM_RANGE(0x0001, 0x0001) AM_RAM AM_SHARE("ycoord") AM_RANGE(0x0002, 0x0002) AM_READWRITE(bitmap_xy_r, bitmap_xy_w) AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(bitmap_w) AM_SHARE("bitmapram") /* overlapping for my convenience */ AM_RANGE(0x4000, 0x4000) AM_READ(port0_r) AM_RANGE(0x4001, 0x4001) AM_READ_PORT("IN1") AM_RANGE(0x4000, 0x400f) AM_WRITEONLY AM_SHARE("base_ram") AM_RANGE(0x4200, 0x421f) AM_WRITEONLY AM_SHARE("colorram") AM_RANGE(0x4400, 0x4400) AM_WRITENOP AM_RANGE(0x4600, 0x4600) AM_WRITE_BASE(atarigen_state, earom_control_w) AM_RANGE(0x4800, 0x483f) AM_READ_BASE(atarigen_state, earom_r) AM_RANGE(0x4800, 0x4800) AM_WRITEONLY AM_SHARE("planet_frame") AM_RANGE(0x4a00, 0x4a00) AM_WRITE_LEGACY(watchdog_reset_w) AM_RANGE(0x4c00, 0x4c01) AM_WRITE(led_w) AM_RANGE(0x4c04, 0x4c04) AM_WRITE(trackball_reset_w) AM_RANGE(0x4c05, 0x4c06) AM_WRITE(coin_counter_w) AM_RANGE(0x4c07, 0x4c07) AM_WRITEONLY AM_SHARE("planet_select") AM_RANGE(0x4e00, 0x4e3f) AM_WRITE_BASE(atarigen_state, earom_w) AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) //AM_RANGE(0x6000, 0x601f) AM_WRITE(pokey1_w) /* bug ??? */ AM_RANGE(0x6000, 0xbfff) AM_ROM AM_RANGE(0xfffa, 0xffff) AM_ROM ADDRESS_MAP_END /************************************* * * Port definitions * *************************************/ static INPUT_PORTS_START( liberatr ) PORT_START("IN0") /* IN0 - $5000 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_START("IN1") /* IN1 - $5001 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_VBLANK ) PORT_START("DSW1") /* IN2 - Game Option switches DSW @ D4 on PCB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPSETTING( 0x00, "4" ) PORT_DIPSETTING( 0x01, "5" ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x03, "8" ) PORT_DIPNAME( 0x0C, 0x04, DEF_STR( Bonus_Life ) ) PORT_DIPSETTING( 0x00, "15000" ) PORT_DIPSETTING( 0x04, "20000" ) PORT_DIPSETTING( 0x08, "25000" ) PORT_DIPSETTING( 0x0C, "30000" ) PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) ) PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x30, "???" ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW2") /* IN3 - Pricing Option switches DSW @ A4 on PCB */ PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_DIPNAME( 0x0c, 0x00, "Right Coin" ) PORT_DIPSETTING ( 0x00, "*1" ) PORT_DIPSETTING ( 0x04, "*4" ) PORT_DIPSETTING ( 0x08, "*5" ) PORT_DIPSETTING ( 0x0c, "*6" ) PORT_DIPNAME( 0x10, 0x00, "Left Coin" ) PORT_DIPSETTING ( 0x00, "*1" ) PORT_DIPSETTING ( 0x10, "*2" ) /* TODO: verify the following settings */ PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" ) PORT_DIPSETTING ( 0x00, DEF_STR( None ) ) PORT_DIPSETTING ( 0x80, "1 each 5" ) PORT_DIPSETTING ( 0x40, "1 each 4 (+Demo)" ) PORT_DIPSETTING ( 0xa0, "1 each 3" ) PORT_DIPSETTING ( 0x60, "2 each 4 (+Demo)" ) PORT_DIPSETTING ( 0x20, "1 each 2" ) PORT_DIPSETTING ( 0xc0, "Freeze Mode" ) PORT_DIPSETTING ( 0xe0, "Freeze Mode" ) PORT_START("FAKE") /* IN4 - FAKE - overlaps IN0 in the HW */ PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_BIT( 0xf0, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) INPUT_PORTS_END /************************************* * * Sound interfaces * *************************************/ static const pokey_interface pokey_interface_1 = { { DEVCB_NULL }, DEVCB_INPUT_PORT("DSW2") }; static const pokey_interface pokey_interface_2 = { { DEVCB_NULL }, DEVCB_INPUT_PORT("DSW1") }; /************************************* * * Machine driver * *************************************/ static MACHINE_CONFIG_START( liberatr, liberatr_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/16) /* 1.25Mhz divided from 20Mhz master clock */ MCFG_CPU_PROGRAM_MAP(liberatr_map) MCFG_CPU_PERIODIC_INT(irq0_line_hold,4*60) MCFG_ER2055_ADD("earom") /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_UPDATE_DRIVER(liberatr_state, screen_update) MCFG_SCREEN_SIZE(256,256) MCFG_SCREEN_VISIBLE_AREA(8, 247, 13, 244) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ MCFG_SOUND_CONFIG(pokey_interface_1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */ MCFG_SOUND_CONFIG(pokey_interface_2) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( liberat2, liberatr ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(liberat2_map) MACHINE_CONFIG_END /************************************* * * ROM definitions * *************************************/ ROM_START( liberatr ) ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code and data */ ROM_LOAD( "136012.206", 0x8000, 0x1000, CRC(1a0cb4a0) SHA1(595828a07af729a84aab4e0b51e873046b56b419) ) ROM_LOAD( "136012.205", 0x9000, 0x1000, CRC(2f071920) SHA1(8764f3e78451c4968bffb7c7f72d1ed862f4b185) ) ROM_LOAD( "136012.204", 0xa000, 0x1000, CRC(bcc91827) SHA1(3bfbe1f1db58437ccd204a857e58695f56819649) ) ROM_LOAD( "136012.203", 0xb000, 0x1000, CRC(b558c3d4) SHA1(0b09786d696e91b12435a9e76b127c004c32e59a) ) ROM_LOAD( "136012.202", 0xc000, 0x1000, CRC(569ba7ea) SHA1(4812b255886204192ab999d1370550d48438ea81) ) ROM_LOAD( "136012.201", 0xd000, 0x1000, CRC(d12cd6d0) SHA1(94474429cbcdbb406eb045152fb158e2a23cd26d) ) ROM_LOAD( "136012.200", 0xe000, 0x1000, CRC(1e98d21a) SHA1(92c7cc033c78ae0ce8127d49debe62263404feb1) ) ROM_RELOAD( 0xf000, 0x1000 ) /* for interrupt/reset vectors */ ROM_REGION( 0x4000, "gfx1", 0 ) /* planet image, used at runtime */ ROM_LOAD( "136012.110", 0x0000, 0x1000, CRC(6eb11221) SHA1(355b71812a18cbb2ee4dc20b3622fca1c96e4570) ) ROM_LOAD( "136012.107", 0x1000, 0x1000, CRC(8a616a63) SHA1(76794cc4e11048bb6f2628bd8b84c9a7e2e82551) ) ROM_LOAD( "136012.108", 0x2000, 0x1000, CRC(3f8e4cf6) SHA1(a9d0feb0892f343687e00b96f05adb423ee4d659) ) ROM_LOAD( "136012.109", 0x3000, 0x1000, CRC(dda0c0ef) SHA1(6e547c07c1abd17383a4389b0b4ced442ed65ce7) ) ROM_REGION( 0x100, "user1", 0 ) /* latitude scaler */ ROM_LOAD_NIB_LOW ( "136012.123", 0x0000, 0x0100, CRC(b8c806e0) SHA1(19b1b9796e1e9a42899a92ec53288d17d5d15fb3) ) ROM_LOAD_NIB_HIGH( "136012.124", 0x0000, 0x0100, CRC(e51ec78f) SHA1(224237370c418361a00d62a77d39fa494e7d8831) ) ROM_REGION( 0x100, "user2", 0 ) /* longitude scaler */ ROM_LOAD_NIB_LOW ( "136012.125", 0x0000, 0x0100, CRC(52ac8dd9) SHA1(125d54b562d079b974f2562e71ab7c7a0b97e709) ) ROM_LOAD_NIB_HIGH( "136012.126", 0x0000, 0x0100, CRC(2e670aa6) SHA1(a6bcc49d0948d2dfe497c5e3ad4a834fa78f779a) ) ROM_REGION( 0x200, "proms", 0 ) ROM_LOAD( "136012.021", 0x0000, 0x0100, CRC(ffdcd7bc) SHA1(2ce733203d628e299ec4fb93db8be1598b49142c) ) /* write protect PROM */ ROM_LOAD( "136012.022", 0x0100, 0x0100, CRC(3353edce) SHA1(915308b11096fc1d02acf9b4af806a2a935dd748) ) /* sync PROM */ ROM_END ROM_START( liberatr2 ) ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code and data */ ROM_LOAD( "l6.bin", 0x6000, 0x1000, CRC(78093d06) SHA1(0f6ca01e27b32aae384a6ab67a6f14eedd3f1d9c) ) ROM_LOAD( "l5.bin", 0x7000, 0x1000, CRC(988db636) SHA1(8fdd07b397d4bef108aafb10c06c2fd53fc1f99a) ) ROM_LOAD( "l4.bin", 0x8000, 0x1000, CRC(ec114540) SHA1(eb35510b59f5e9624c3d94fb16dacb4968349030) ) ROM_LOAD( "l3.bin", 0x9000, 0x1000, CRC(184c751f) SHA1(e020d2943be89f244c1aeeb34a28b7aa7dbc1454) ) ROM_LOAD( "l2.bin", 0xa000, 0x1000, CRC(c3f61f88) SHA1(a56ce094fe7374d3ac341d5eb9e06df083e16b1f) ) ROM_LOAD( "l1.bin", 0xb000, 0x1000, CRC(ef6e9f9e) SHA1(b1f7cc9e0a2ea08ec89428ad31161ac81e7faaaf) ) ROM_RELOAD( 0xf000, 0x1000 ) /* for interrupt/reset vectors */ ROM_REGION( 0x4000, "gfx1", 0 ) /* planet image, used at runtime */ ROM_LOAD( "136012.110", 0x0000, 0x1000, CRC(6eb11221) SHA1(355b71812a18cbb2ee4dc20b3622fca1c96e4570) ) ROM_LOAD( "136012.107", 0x1000, 0x1000, CRC(8a616a63) SHA1(76794cc4e11048bb6f2628bd8b84c9a7e2e82551) ) ROM_LOAD( "136012.108", 0x2000, 0x1000, CRC(3f8e4cf6) SHA1(a9d0feb0892f343687e00b96f05adb423ee4d659) ) ROM_LOAD( "136012.109", 0x3000, 0x1000, CRC(dda0c0ef) SHA1(6e547c07c1abd17383a4389b0b4ced442ed65ce7) ) ROM_REGION( 0x100, "user1", 0 ) /* latitude scaler */ ROM_LOAD_NIB_LOW ( "136012.123", 0x0000, 0x0100, CRC(b8c806e0) SHA1(19b1b9796e1e9a42899a92ec53288d17d5d15fb3) ) ROM_LOAD_NIB_HIGH( "136012.124", 0x0000, 0x0100, CRC(e51ec78f) SHA1(224237370c418361a00d62a77d39fa494e7d8831) ) ROM_REGION( 0x100, "user2", 0 ) /* longitude scaler */ ROM_LOAD_NIB_LOW ( "136012.125", 0x0000, 0x0100, CRC(52ac8dd9) SHA1(125d54b562d079b974f2562e71ab7c7a0b97e709) ) ROM_LOAD_NIB_HIGH( "136012.126", 0x0000, 0x0100, CRC(2e670aa6) SHA1(a6bcc49d0948d2dfe497c5e3ad4a834fa78f779a) ) ROM_REGION( 0x200, "proms", 0 ) ROM_LOAD( "136012.021", 0x0000, 0x0100, CRC(ffdcd7bc) SHA1(2ce733203d628e299ec4fb93db8be1598b49142c) ) /* write protect PROM */ ROM_LOAD( "136012.022", 0x0100, 0x0100, CRC(3353edce) SHA1(915308b11096fc1d02acf9b4af806a2a935dd748) ) /* sync PROM */ ROM_END /************************************* * * Game drivers * *************************************/ GAME( 1982, liberatr, 0, liberatr, liberatr, 0, ROT0, "Atari", "Liberator (set 1)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) GAME( 1982, liberatr2,liberatr, liberat2, liberatr, 0, ROT0, "Atari", "Liberator (set 2)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
[ "cc2911@facebook.com" ]
cc2911@facebook.com
bc8ae4f0ea16bcfbd9e25e0c042cb84fcd76f8ac
25e093b6fe52a63786592ab5641ad201c5e92c39
/src/consumer/lib/message_consumption.h
51e451025d8731e3d55afb4702c7ff789946396c
[]
no_license
mariors/SOA-P2
55c3e8eb513aa43276274ada82f693d19b29c771
bc67c08727d600abcb0acfed46ff9b146ac07038
refs/heads/master
2021-09-13T00:35:27.882970
2018-04-23T08:40:53
2018-04-23T08:40:53
125,139,413
0
0
null
null
null
null
UTF-8
C
false
false
224
h
// // Created by aleph on 4/21/18. // #ifndef SOA_P2_MESSAGE_CONSUMPTION_H #define SOA_P2_MESSAGE_CONSUMPTION_H void message_consumption_on_loop(GlobalState* global,double lambda); #endif //SOA_P2_MESSAGE_CONSUMPTION_H
[ "rodycamposgo@gmail.com" ]
rodycamposgo@gmail.com
5b5fc65b407abb4ba89a9c5121c52845cd9583ea
c7496ad13e769577ac79cf394c8d07f3075dc139
/model/Scade/System/ObuFunctions/ETCS_Messaging/TrackMessages/Simulation/TrackMessages_newinterface.c
5483295f4f20576ddb67ebb6950da8002d6bc424
[]
no_license
MatthieuPoirot/modeling
570ad97275c036ee5888a1da9ef8eb9870aa189f
499187547369dddade650ea6db2913c4f9b8271c
refs/heads/master
2021-01-17T22:36:46.853159
2015-07-09T13:50:54
2015-07-09T13:51:50
38,824,954
0
0
null
2015-07-09T14:23:07
2015-07-09T14:23:07
null
UTF-8
C
false
false
4,535
c
#include "TrackMessages_newinterface.h" const int rt_version = Srtv62; const char* _SCSIM_CheckSum = "bea6256d6d5299438554d67c3c9434b3"; const char* _SCSIM_SmuTypesCheckSum = "f79c40cc4a28a84eb05b013596813063"; /******************************* * Validity *******************************/ int valid(void * pHandle) { return 1; } int notvalid(void * pHandle) { return 0; } /******************************* * Simulation context *******************************/ inC_T_Decode_metadata_new_TM_lib_internal inputs_ctx; static inC_T_Decode_metadata_new_TM_lib_internal inputs_ctx_restore; static inC_T_Decode_metadata_new_TM_lib_internal inputs_ctx_execute; outC_T_Decode_metadata_new_TM_lib_internal outputs_ctx; static outC_T_Decode_metadata_new_TM_lib_internal outputs_ctx_restore; /* separate_io: inputs instanciation */ /* separate_io: outputs instanciation */ static void _SCSIM_RestoreInterface(void) { inputs_ctx.Metadata_in = inputs_ctx_restore.Metadata_in; outputs_ctx = outputs_ctx_restore; /* separate_io: outputs restore */ } static void _SCSIM_ExecuteInterface(void) { pSimulator->m_pfnAcquireValueMutex(pSimulator); inputs_ctx_execute.Metadata_in = inputs_ctx.Metadata_in; pSimulator->m_pfnReleaseValueMutex(pSimulator); } /******************************* * Init/Reset function encapsulation *******************************/ int SimInit(void) { int nRet=0; _SCSIM_RestoreInterface(); #ifdef EXTENDED_SIM BeforeSimInit(); #endif /* EXTENDED_SIM */ nRet=0; #ifdef EXTENDED_SIM AfterSimInit(); #endif /* EXTENDED_SIM */ return nRet; } int SimReset(void) { int nRet=0; _SCSIM_RestoreInterface(); #ifdef EXTENDED_SIM BeforeSimInit(); #endif /* EXTENDED_SIM */ #ifndef KCG_NO_EXTERN_CALL_TO_RESET T_Decode_metadata_new_reset_TM_lib_internal(&outputs_ctx); nRet=1; #else /* KCG_NO_EXTERN_CALL_TO_RESET */ nRet=0; #endif /* KCG_NO_EXTERN_CALL_TO_RESET */ #ifdef EXTENDED_SIM AfterSimInit(); #endif /* EXTENDED_SIM */ return nRet; } #ifdef EXTENDED_SIM int GraphicalInputsConnected = 1; #endif /* EXTENDED_SIM */ /******************************* * Cyclic function encapsulation *******************************/ int SimStep(void) { #ifdef EXTENDED_SIM if (GraphicalInputsConnected) BeforeSimStep(); #endif /* EXTENDED_SIM */ _SCSIM_ExecuteInterface(); T_Decode_metadata_new_TM_lib_internal(&inputs_ctx_execute, &outputs_ctx); #ifdef EXTENDED_SIM AfterSimStep(); #endif /* EXTENDED_SIM */ return 1; } int SimStop(void) { #ifdef EXTENDED_SIM ExtendedSimStop(); #endif /* EXTENDED_SIM */ return 1; } int SsmGetDumpSize(void) { int nSize = 0; nSize += sizeof(inC_T_Decode_metadata_new_TM_lib_internal); /* separate_io: add (not in ctx) inputs size */ /* separate_io: add (not in ctx) outputs size */ nSize += sizeof(outC_T_Decode_metadata_new_TM_lib_internal); #ifdef EXTENDED_SIM nSize += ExtendedGetDumpSize(); #endif /* EXTENDED_SIM */ return nSize; } void SsmGatherDumpData(char * pData) { char* pCurrent = pData; memcpy(pCurrent, &inputs_ctx, sizeof(inC_T_Decode_metadata_new_TM_lib_internal)); pCurrent += sizeof(inC_T_Decode_metadata_new_TM_lib_internal); /* separate_io: dump (not in ctx) inputs */ /* separate_io: dump (not in ctx) outputs */ memcpy(pCurrent, &outputs_ctx, sizeof(outC_T_Decode_metadata_new_TM_lib_internal)); pCurrent += sizeof(outC_T_Decode_metadata_new_TM_lib_internal); #ifdef EXTENDED_SIM ExtendedGatherDumpData(pCurrent); #endif /* EXTENDED_SIM */ } void SsmRestoreDumpData(const char * pData) { const char* pCurrent = pData; memcpy(&inputs_ctx, pCurrent, sizeof(inC_T_Decode_metadata_new_TM_lib_internal)); pCurrent += sizeof(inC_T_Decode_metadata_new_TM_lib_internal); /* separate_io: restore (not in ctx) inputs */ /* separate_io: restore (not in ctx) outputs */ memcpy(&outputs_ctx, pCurrent, sizeof(outC_T_Decode_metadata_new_TM_lib_internal)); pCurrent += sizeof(outC_T_Decode_metadata_new_TM_lib_internal); #ifdef EXTENDED_SIM ExtendedRestoreDumpData(pCurrent); #endif /* EXTENDED_SIM */ } const char * SsmGetCheckSum() { return _SCSIM_CheckSum; } const char * SsmGetSmuTypesCheckSum() { return _SCSIM_SmuTypesCheckSum; } void SsmUpdateValues(void) { #ifdef EXTENDED_SIM UpdateValues(); #endif /* EXTENDED_SIM */ } void SsmConnectExternalInputs(int bConnect) { #ifdef EXTENDED_SIM GraphicalInputsConnected = bConnect; #endif /* EXTENDED_SIM */ }
[ "j.gaertner@railergy.com" ]
j.gaertner@railergy.com
d86a1d4fc3616f5e4df04308498b031f306edb09
43260c9add09e83c4f36c694f473b79fdf60cf6b
/aubit4glsrc/tags/Aubit4gl-1_10RC-39/lib/liblex/lex_esqlc/cmds_funcs.c
df2af1d85d251e491e7748ad9ff96453721a9393
[]
no_license
tompipen/aubit4gl_code
63d31e10e329831f95f9e839a0f1bf312c056164
ea632477f2653dd97f024eb6a54abfdf5a892153
refs/heads/master
2020-04-11T14:52:49.192757
2018-11-12T10:21:42
2018-11-12T10:21:42
161,871,995
0
0
null
null
null
null
UTF-8
C
false
false
94,660
c
#include "a4gl_lib_lex_esqlc_int.h" #define ONE_NOT_ZERO(x) (x?x:1) #include "field_handling.h" #include "compile_c.h" #include "cmd_funcs.h" #define set_nonewlines() set_nonewlines_full(__LINE__) //char *generate_ispdf(void) ; //void remove_field_subscripts_from_field_list(struct fh_field_list *flist); static int idle_cnt = 0; extern int tmp_ccnt; extern int line_for_cmd; extern int parent_stack_cnt; extern command *parent_stack[]; static int rep_print_entry=0; static struct command *find_in_command_stack(enum cmd_type e) { int z; for (z = parent_stack_cnt-1; z>=0; z--) { if (parent_stack[z]->cmd_data.type==e) return parent_stack[z]; } return NULL; } int clr_rep_print_entry(void) { rep_print_entry=0; return 1; } char *local_field_name_list_as_char(struct fh_field_list *fl) { int a; char *ptr=0; char *ptr_field; A4GL_assertion(fl==0,"No field list..."); ptr=acl_malloc2(10); /* Set it up initially...*/ strcpy(ptr,""); for (a=0;a<fl->field_list_entries.field_list_entries_len;a++) { if (fl->field_list_entries.field_list_entries_val[a].fieldsub) { ptr_field=A4GL_field_name_as_char(local_ident_as_string(fl->field_list_entries.field_list_entries_val[a].field,1), local_expr_as_string(fl->field_list_entries.field_list_entries_val[a].fieldsub)); } else { ptr_field=A4GL_field_name_as_char(local_ident_as_string(fl->field_list_entries.field_list_entries_val[a].field,1), "1"); } ptr=acl_realloc(ptr,strlen(ptr)+strlen(ptr_field)+2); if (strlen(ptr)) strcat(ptr,","); strcat(ptr,ptr_field); } return ptr; } void print_cmd_start (void) { printc ("\n\naclfgli_clr_err_flg();"); } /******************************************************************************/ int print_stop_rpc_cmd (void) { print_cmd_start (); printc ("A4GL_stop_serving();"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_pause_screen_on_cmd (void) { print_cmd_start (); printc ("A4GL_screen_mode(0);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_pause_screen_off_cmd (void) { print_cmd_start (); printc ("A4GL_screen_mode(1);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_skip_to_top_cmd (void) { print_cmd_start (); printc ("A4GL_%sskip_top_of_page(&_rep,0);\n", generate_ispdf ()); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_start_rpc_cmd (struct_start_rpc_cmd * cmd_data) { int a; print_cmd_start (); for (a = 0; a < cmd_data->remote_func_list.name.name_len; a++) { char *identifier; char *namespace; identifier = cmd_data->remote_func_list.name.name_val[a]; namespace=cmd_data->remote_func_list.namespaces.namespaces_val[a]; add_function_to_header (identifier, namespace, 1, 0); printc ("A4GL_register_func(\"%s\",%s%s);if (a4gl_status<0) A4GL_chk_err(%d,_module_name);\n", identifier, namespace, identifier, line_for_cmd); } printc ("{"); printc("int _port; "); print_expr (cmd_data->valid_port); printc ("_port=A4GL_pop_long()+0x2000000;"); printc ("A4GL_server_run(_port);"); printc("}"); for (a = 0; a < cmd_data->remote_func_list.name.name_len; a++) { char *identifier; identifier = cmd_data->remote_func_list.name.name_val[a]; printc ("A4GL_unregister_func(\"%s\");\n", identifier); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_call_cmd (struct_call_cmd * cmd_data) { enum e_expr_type t; print_cmd_start (); t = cmd_data->fcall->expr_type; real_print_func_call (cmd_data->fcall); if (t == ET_EXPR_BOUND_FCALL) { print_returning_g (1, cmd_data->returning, 1); } else { print_returning_g (1, cmd_data->returning, 0); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_cancel_cmd (struct_cancel_cmd * cmd_data) { print_cmd_start (); A4GL_assertion (1, "CANCEL not implemented yet"); return 0; } /******************************************************************************/ int print_case_cmd (struct_case_cmd * cmd_data) { int a; print_cmd_start (); if (cmd_data->case_expr) { printc ("{char *_s=0;"); print_expr (cmd_data->case_expr); printc ("while (1==1) {if (_s==0) {_s=A4GL_char_pop();}\n"); } else { printc ("while (1==1) {\n"); } tmp_ccnt++; for (a = 0; a < cmd_data->whens->whens.whens_len; a++) { line_for_cmd=cmd_data->whens->whens.whens_val[a]->lineno; dump_comments (cmd_data->whens->whens.whens_val[a]->lineno); print_when (cmd_data->case_expr != 0, cmd_data->whens->whens.whens_val[a]->when_expr); dump_commands (cmd_data->whens->whens.whens_val[a]->when_commands); tmp_ccnt--; printc ("break;"); printc("}"); } printc("/* OTHERWISE... */"); dump_commands (cmd_data->otherwise); printc ("break;"); tmp_ccnt--; printc ("} /* end of the while for the case */"); printc ("END_BLOCK_%d: ;", cmd_data->block_id); if (cmd_data->case_expr) { printc ("if (_s) free(_s);"); printc ("}"); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_close_cmd (struct_close_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); switch (cmd_data->cl_type) { case E_CT_WINDOW: printc ("A4GL_remove_window(\n"); print_ident (cmd_data->ident); printc (");"); break; case E_CT_FORM: printc ("A4GL_close_form(\n"); print_ident (cmd_data->ident); printc (");"); break; case E_CT_STATUSBOX: printc ("A4GL_remove_window(\n"); print_ident (cmd_data->ident); printc (");"); break; } clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_code_cmd (struct_code_cmd * cmd_data) { printc ("%s", cmd_data->contents); return 1; } /******************************************************************************/ int print_defer_cmd (struct_defer_cmd * cmd_data) { switch (cmd_data->what) { case EDEFER_QUIT: printc ("A4GL_def_quit();"); break; case EDEFER_INTERRUPT: printc ("A4GL_def_int();"); break; } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_display_b_n_cmd (struct_display_b_n_cmd * cmd_data) { print_cmd_start (); A4GL_assertion (1, "Should be converted to a display"); return 1; } /******************************************************************************/ int print_display_cmd (struct_display_cmd * cmd_data) { print_cmd_start (); print_clr_status (); switch (cmd_data->where->dttype) { case DT_DISPLAY_TYPE_LINE: real_print_expr_list (cmd_data->exprs); printc ("A4GL_push_int(-1);"); printc ("A4GL_push_int(-1);"); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc ("A4GL_display_at(%d,_attr);", cmd_data->exprs->list.list_len); printc("}"); } else { printc ("A4GL_display_at(%d,0x%x);", cmd_data->exprs->list.list_len, attributes_as_int (cmd_data->attributes)); } break; case DT_DISPLAY_TYPE_AT: real_print_expr_list (cmd_data->exprs); set_nonewlines (); print_expr (cmd_data->where->dt_display_u.x_y.y); clr_nonewlines (); set_nonewlines (); print_expr (cmd_data->where->dt_display_u.x_y.x); clr_nonewlines (); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc ("A4GL_display_at(%d,_attr);", cmd_data->exprs->list.list_len); printc("}"); } else { printc ("A4GL_display_at(%d,0x%x);", cmd_data->exprs->list.list_len, attributes_as_int (cmd_data->attributes)); } break; case DT_DISPLAY_TYPE_FIELD_LIST: real_print_expr_list (cmd_data->exprs); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc ("A4GL_disp_fields(%d,_attr,%s,NULL);", cmd_data->exprs->list.list_len, local_field_name_list_as_char (cmd_data->where->dt_display_u.field_list)); printc("}"); } else { printc ("A4GL_disp_fields(%d,0x%x,%s,NULL);", cmd_data->exprs->list.list_len, attributes_as_int (cmd_data->attributes), local_field_name_list_as_char (cmd_data->where->dt_display_u.field_list)); } break; case DT_DISPLAY_TYPE_MENUITEM: A4GL_assertion (1, "Not implemented yet"); break; case DT_DISPLAY_TYPE_MAIN_CAPTION: A4GL_assertion (1, "Not implemented yet"); break; case DT_DISPLAY_TYPE_FORM_FIELD: A4GL_assertion (1, "Not implemented yet"); break; case DT_DISPLAY_TYPE_FORM_CAPTION: A4GL_assertion (1, "Not implemented yet"); break; case DT_DISPLAY_TYPE_STATUSBOX: A4GL_assertion (1, "Not implemented yet"); break; } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_display_form_cmd (struct_display_form_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc ("A4GL_disp_form("); print_ident (cmd_data->formname); printc (",_attr);\n"); printc("}"); } else { printc ("A4GL_disp_form("); print_ident (cmd_data->formname); printc (",%d);\n", attributes_as_int (cmd_data->attributes)); } clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_error_cmd (struct_error_cmd * cmd_data) { print_cmd_start (); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); A4GL_print_expr_list_concat (cmd_data->expr_list); printc ("A4GL_display_error(_attr,%d);\n", cmd_data->wait_for_key==EB_TRUE); printc("}"); } else { A4GL_print_expr_list_concat (cmd_data->expr_list); printc ("A4GL_display_error(%d,%d);\n", attributes_as_int (cmd_data->attributes), cmd_data->wait_for_key==EB_TRUE); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_ext_cmd (struct_ext_cmd * cmd_data) { if (cmd_data->what == EBC_MENU) { printc ("cmd_no_%d= -3;goto MENU_START_%d;\n", cmd_data->block_id, cmd_data->block_id); return 1; } if (cmd_data->what == EBC_PROMPT) { struct command *pcommand; pcommand=find_in_command_stack(E_CMD_PROMPT_CMD); if (pcommand==0) { a4gl_yyerror("Not in a PROMPT"); return 0; } printc ("SET(\"s_prompt\",_sio_%d,\"mode\",1);\n", pcommand->cmd_data.command_data_u.prompt_cmd.sio); printc ("goto END_BLOCK_%d;", cmd_data->block_id); return 1; } printc ("goto END_BLOCK_%d;", cmd_data->block_id); return 1; } /******************************************************************************/ int print_continue_cmd (struct_continue_cmd * cmd_data) { //enum e_block_cmd what; //int block_id; if (cmd_data->what == EBC_INPUT || cmd_data->what == EBC_CONSTRUCT) { printc ("if (_fld_dr==-95) {A4GL_req_field(&_sio_%d,_inp_io_type,'0',\"0\",NULL,0);} /* re-enter INPUT if we're in an AFTER INPUT */ \n", cmd_data->sio_id); printc ("_fld_dr= -1;_exec_block= -1;\n"); } printc ("goto CONTINUE_BLOCK_%d;", cmd_data->block_id); return 1; } /******************************************************************************/ int print_exit_prog_cmd (struct_exit_prog_cmd * cmd_data) { print_cmd_start (); if (cmd_data->exit_val) { print_expr (cmd_data->exit_val); } else { } if (doing_esql ()) { struct_close_sql_cmd cmd_data; printc ("if (A4GL_esql_db_open(-1,0,0,\"\")) {"); cmd_data.cl_type=E_CT_DATABASE; print_close_sql_cmd(&cmd_data,1); printc ("}"); } if (cmd_data->exit_val) printc ("A4GL_fgl_end();exit(A4GL_pop_long());"); else printc ("A4GL_fgl_end();exit(0);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_for_cmd (struct_for_cmd * cmd_data) { struct expr_str *from; struct expr_str *to; struct expr_str *step; int have_from = 0; int have_to = 0; int have_step = 0; int from_l = 0; int to_l = 0; int step_l = 0; print_cmd_start (); from = cmd_data->start; to = cmd_data->end; step = cmd_data->step; if (from->expr_type == ET_EXPR_LITERAL_LONG) { have_from = 1; from_l = from->expr_str_u.expr_long; } if (to->expr_type == ET_EXPR_LITERAL_LONG) { have_to = 1; to_l = to->expr_str_u.expr_long; } if (step) { if (step->expr_type == ET_EXPR_LITERAL_LONG) { have_step = 1; step_l = step->expr_str_u.expr_long; } } else { have_step = 1; step_l = 1; } printc ("{"); tmp_ccnt++; if (!have_from) printc ("int _s;"); else printc ("int _s=%ld;", from_l); if (!have_to) printc ("int _e;"); else printc ("int _e=%ld;", to_l); if (!have_step) printc ("int _step;"); else printc ("int _step=%ld;", step_l); if (!have_from) { print_expr (from); printc ("_s=A4GL_pop_long();"); } printc ("%s=_s;", local_expr_as_string (cmd_data->var)); printc ("while (1) {"); tmp_ccnt++; if (!have_to) { print_expr (to); printc ("_e=A4GL_pop_long();"); } if (have_step) { if (step_l >= 0) { printc (" if (%s>_e) break;", local_expr_as_string (cmd_data->var)); } else { printc (" if (%s<_e) break;", local_expr_as_string (cmd_data->var)); } } else { print_expr (step); printc (" _step=A4GL_pop_long();"); printc (" if (%s>_e && _step>=0) break;", local_expr_as_string (cmd_data->var)); printc (" if (%s<_e && _step<0) break;", local_expr_as_string (cmd_data->var)); } dump_commands (cmd_data->for_commands); printc("CONTINUE_BLOCK_%d: ; ", cmd_data->block_id); printc ("%s+=_step;", local_expr_as_string (cmd_data->var)); tmp_ccnt--; printc ("}"); tmp_ccnt--; printc ("}\n"); printc("END_BLOCK_%d: ; ", cmd_data->block_id); return 1; } /******************************************************************************/ int print_goto_cmd (struct_goto_cmd * cmd_data) { // 30% printc ("goto %s;\n", cmd_data->label); return 1; } /******************************************************************************/ int print_check_menu_cmd (struct_check_menu_cmd * cmd_data) { // str_list* strlist; print_cmd_start (); printc ("A4GL_check_menuitems("); print_str_list (cmd_data->strlist); printc (",NULL);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_uncheck_menu_cmd (struct_uncheck_menu_cmd * cmd_data) { print_cmd_start (); printc ("A4GL_uncheck_menuitems("); print_str_list (cmd_data->strlist); printc (",NULL);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_disable_menu_cmd (struct_disable_menu_cmd * cmd_data) { //str_list* strlist; print_cmd_start (); printc ("A4GL_endis_menuitems(0,"); print_str_list (cmd_data->strlist); printc (",NULL);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_enable_menu_cmd (struct_enable_menu_cmd * cmd_data) { print_cmd_start (); printc ("A4GL_endis_menuitems(1,"); print_str_list (cmd_data->strlist); printc (",NULL);"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_msg_box_cmd (struct_msg_box_cmd * cmd_data) { //struct expr_str_list *msg; //struct expr_str_list *caption; //int icon; //int buttons; //int default_button; //int disable; //struct expr_str *returning; A4GL_assertion (1, "Not implemented"); return 0; } /******************************************************************************/ int print_if_cmd (struct_if_cmd * cmd_data) { int uses_elif = 0; int a; print_cmd_start (); //if_conds truths; //int lineno; //int else_lineno; //commands *whenfalse; if (cmd_data->truths.conditions.conditions_len > 1) { uses_elif = 1; printc ("while (1) {"); // Give us something to break to.. } for (a = 0; a < cmd_data->truths.conditions.conditions_len; a++) { dump_comments (cmd_data->truths.conditions.conditions_val[a].lineno); print_expr (cmd_data->truths.conditions.conditions_val[a].test_expr); printc ("if (A4GL_pop_bool()) {\n"); tmp_ccnt++; dump_commands (cmd_data->truths.conditions.conditions_val[a].whentrue); if (uses_elif) { printc ("break;"); } tmp_ccnt--; printc ("}"); } if (uses_elif) { // If we get to here in the generated code - its failed all the previous tests.. if (cmd_data->whenfalse) { dump_commands (cmd_data->whenfalse); } printc ("break;"); printc("}"); } else { if (cmd_data->whenfalse) { dump_comments (cmd_data->else_lineno); printc (" else {\n"); tmp_ccnt++; dump_commands (cmd_data->whenfalse); tmp_ccnt--; printc ("}"); } } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_next_field_cmd (struct_next_field_cmd * cmd_data) { int z; print_cmd_start (); set_nonewlines (); if (cmd_data->rel == 1) { printc ("A4GL_req_field(&_sio_%d,_inp_io_type,'+',\"+\",NULL,0);\n", cmd_data->sio); } else { if (cmd_data->rel == -1) { printc ("A4GL_req_field(&_sio_%d,_inp_io_type,'-',\"-\",NULL,0);\n", cmd_data->sio); } else { printc ("A4GL_req_field(&_sio_%d,_inp_io_type,'!',", cmd_data->sio); print_field (cmd_data->nextfield); printc (",NULL,0);\n"); } } clr_nonewlines (); printc ("_fld_dr= -1;_exec_block= -1;\n"); for (z = parent_stack_cnt-1; z>=0; z--) { int done=0; // If we're returning - we need to close out any outstanding screen IO switch (parent_stack[z]->cmd_data.type) { case E_CMD_INPUT_ARRAY_CMD: printc ("goto CONTINUE_BLOCK_%d;", parent_stack[z]->cmd_data.command_data_u.input_array_cmd.blockid); done++; break; case E_CMD_INPUT_CMD: printc ("goto CONTINUE_BLOCK_%d;", parent_stack[z]->cmd_data.command_data_u.input_cmd.blockid); done++; break; case E_CMD_CONSTRUCT_CMD: printc ("goto CONTINUE_BLOCK_%d;", parent_stack[z]->cmd_data.command_data_u.construct_cmd.blockid); done++; break; default: // We dont care about other commands break; } if (done) { break; } } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_next_form_cmd (struct_next_form_cmd * cmd_data) { print_cmd_start (); //str form; //str field; print_niy ("NEXT FORM FIELD"); return 0; } /******************************************************************************/ int print_scroll_cmd (struct_scroll_cmd * cmd_data) { // 40% print_cmd_start (); //struct fh_field_list *srec; //struct expr_str* val; set_nonewlines (); printc("{int _scrollval;"); print_expr (cmd_data->val); printc("_scrollval=A4GL_pop_long();"); printc ("A4GL_acli_scroll(_scrollval,\n"); remove_field_subscripts_from_field_list(cmd_data->srec); print_field_list (cmd_data->srec); printc (",NULL,0);\n"); printc("}"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_label_cmd (struct_label_cmd * cmd_data) { printc ("%s: ;\n", cmd_data->label); print_cmd_start (); return 1; } /******************************************************************************/ int print_let_cmd (struct_let_cmd * cmd_data) { // 50% ! //struct expr_str_list* vars; print_cmd_start (); if (cmd_data->vars->list.list_len > 1) { struct expr_str_list *ptr; int from_exprs; int to_vars; ptr = A4GL_rationalize_list (cmd_data->vals); from_exprs = A4GL_new_list_get_count (ptr); real_print_expr_list (ptr); printc ("{"); to_vars = print_bind_dir_definition_g (cmd_data->vars, 1, 'o'); local_print_bind_set_value_g (cmd_data->vars, 1, 0, 'o'); if (to_vars != from_exprs) { A4GL_assertion (1, "Should be right by here..."); A4GL_debug ("to_Vars = %d from_Exprs = %d\n", to_vars, from_exprs); return 0; } printc ("A4GL_pop_params(obind,%d);", from_exprs); printc ("}"); } else { if (cmd_data->vals==NULL) { // LET x = NULL printc ("A4GL_push_null(2,0);\n"); print_pop_usage (cmd_data->vars->list.list_val[0]); } else { A4GL_print_expr_list_concat (cmd_data->vals); print_pop_usage (cmd_data->vars->list.list_val[0]); } } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_at_term_cmd (struct_at_term_cmd * cmd_data) { print_cmd_start (); print_niy ("AT TERMINATION"); return 0; } /******************************************************************************/ int print_return_cmd (struct_return_cmd * cmd_data) { struct expr_str_list *expr; int n; int z; print_cmd_start (); printPopFunction(); expr = A4GL_rationalize_list (cmd_data->retvals); n = A4GL_new_list_get_count (expr); real_print_expr_list (expr); for (z = 0; z < parent_stack_cnt; z++) { // If we're returning - we need to close out any outstanding screen IO switch (parent_stack[z]->cmd_data.type) { case E_CMD_INPUT_ARRAY_CMD: printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", parent_stack[z]->cmd_data.command_data_u.input_array_cmd.sio, parent_stack[z]->cmd_data.command_data_u.input_array_cmd.sio); break; case E_CMD_INPUT_CMD: printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", parent_stack[z]->cmd_data.command_data_u.input_cmd.sio, parent_stack[z]->cmd_data.command_data_u.input_cmd.sio); break; case E_CMD_CONSTRUCT_CMD: printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", parent_stack[z]->cmd_data.command_data_u.construct_cmd.sio, parent_stack[z]->cmd_data.command_data_u.construct_cmd.sio); break; case E_CMD_DISPLAY_ARRAY_CMD: printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", parent_stack[z]->cmd_data.command_data_u.display_array_cmd.sio, parent_stack[z]->cmd_data.command_data_u.display_array_cmd.sio); break; case E_CMD_PROMPT_CMD: printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", parent_stack[z]->cmd_data.command_data_u.prompt_cmd.sio, parent_stack[z]->cmd_data.command_data_u.prompt_cmd.sio); break; case E_CMD_MENU_CMD: printc ("A4GL_free_menu(m_%d);", parent_stack[z]->cmd_data.command_data_u.menu_cmd.blockid); break; default: // We dont care about other commands break; } } if (!is_in_report ()) printc ("return %d;", n); else printc ("return ;"); return 1; } /******************************************************************************/ static void print_menu_option (expr_str *s) { switch (s->expr_type) { case ET_EXPR_MENU_ALL: printc("MENU_ALL"); break; case ET_EXPR_LITERAL_STRING: printc("%s", s->expr_str_u.expr_string); break; default: printc("%s", local_expr_as_string(s)); break; } //A4GL_assertion(1,"Not implemented"); } static void print_menu_option_list(expr_str_list *slist ) { int a; for (a=0;a<slist->list.list_len;a++) { if (a) printc(","); print_menu_option(slist->list.list_val[a]); } } /******************************************************************************/ int print_next_option_cmd (struct_next_option_cmd * cmd_data) { int mn; print_cmd_start (); mn = get_last_menuid (); if (mn < 0) { a4gl_yyerror ("Not in a menu"); return 0; } set_nonewlines (); printc ("A4GL_next_option(m_%d, ", mn); print_menu_option (cmd_data->menuoption); printc (");"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_show_option_cmd (struct_show_option_cmd * cmd_data) { int mn; print_cmd_start (); mn = get_last_menuid (); if (mn < 0) { a4gl_yyerror ("Not in a menu"); return 0; } set_nonewlines (); printc ("A4GL_menu_show(m_%d,", mn); print_menu_option_list (cmd_data->menuoptions); printc (",NULL);"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_hide_option_cmd (struct_hide_option_cmd * cmd_data) { int mn; print_cmd_start (); mn = get_last_menuid (); if (mn < 0) { a4gl_yyerror ("Not in a menu"); return 0; } set_nonewlines (); printc ("A4GL_menu_hide(m_%d,", mn); print_menu_option_list (cmd_data->menuoptions); printc (",NULL);"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_message_cmd (struct_message_cmd * cmd_data) { struct expr_str_list *expr; int exprs; int wait; print_cmd_start (); expr = A4GL_rationalize_list (cmd_data->message_expr); exprs = A4GL_new_list_get_count (expr); real_print_expr_list (expr); if (cmd_data->wait==EB_TRUE) { wait=1; } else { wait=0; } if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{ int _attr;char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc ("aclfgli_pr_message(_attr,%d,%d);\n", wait, exprs); printc("}"); } else { printc ("aclfgli_pr_message(%d,%d,%d);\n", attributes_as_int (cmd_data->attributes), wait, exprs); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_open_window_cmd (struct_open_window_cmd * cmd_data) { print_cmd_start (); printc("{"); printc("int _attr=%d;", attributes_as_int(cmd_data->attributes)); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); } set_nonewlines (); if (cmd_data->wt.wintype == EWT_ROWSCOLS) { print_expr (cmd_data->y); print_expr (cmd_data->x); print_expr (cmd_data->wt.windowtype_u.rowscols.rows); print_expr (cmd_data->wt.windowtype_u.rowscols.columns); printc ("A4GL_cr_window("); print_ident (cmd_data->windowname); printc (","); } if (cmd_data->wt.wintype == EWT_FORM) { print_expr (cmd_data->y); print_expr (cmd_data->x); print_expr (cmd_data->wt.windowtype_u.formfilename); printc ("A4GL_cr_window_form("); print_ident (cmd_data->windowname); printc (","); } print_form_attrib_v2 (1, cmd_data->attributes); if (cmd_data->attributes && cmd_data->attributes->style && strlen(cmd_data->attributes->style)) { printc (",%s /* STYLE */", cmd_data->attributes->style); } else { printc (",0 /* STYLE */"); } if (cmd_data->attributes && cmd_data->attributes->text && strlen(cmd_data->attributes->text)) { printc (",%s /* TEXT */", cmd_data->attributes->text); } else { printc (",0 /* TEXT */"); } printc (");\n"); clr_nonewlines (); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_open_statusbox_cmd (struct_open_statusbox_cmd * cmd_data) { print_cmd_start (); print_niy ("OPEN_STATUSBOX"); return 0; } /******************************************************************************/ int print_open_form_cmd (struct_open_form_cmd * cmd_data) { //struct expr_str* formname; //struct expr_str* form_filename; print_cmd_start (); set_nonewlines (); print_expr (cmd_data->form_filename); printc ("A4GL_open_form("); print_ident (cmd_data->formname); printc (");"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_open_form_gui_cmd (struct_open_form_gui_cmd * cmd_data) { //struct expr_str *form; //struct expr_str *y; //struct expr_str *x; //struct expr_str *like; //int disable; //str formhandler; print_cmd_start (); set_nonewlines(); printc ("A4GL_open_gui_form(&"); printc("%s",A4GL_strip_quotes(get_ident_as_string (cmd_data->form))); printc (","); printc("%s",get_ident_as_string (cmd_data->form)); printc (","); if (cmd_data->x) { print_expr (cmd_data->x); } else { printc("0"); } printc (","); if (cmd_data->y) { print_expr (cmd_data->y); } else { printc("0"); } printc (","); if (cmd_data->like) { print_expr (cmd_data->like); } else { printc("0"); } printc (","); printc ("%d,hnd_e_%s,hnd_c_%s);", cmd_data->disable, cmd_data->formhandler, cmd_data->formhandler); clr_nonewlines(); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_start_cmd (struct_start_cmd * cmd_data) { expr_str *out; char where; print_cmd_start (); where = cmd_data->sc_c->towhat; out = cmd_data->sc_c->s1; add_function_to_header (cmd_data->repname, cmd_data->namespace, 2, 0); if (where==0) { printc ("A4GL_push_char(\"\");\n"); printc ("A4GL_push_char(\"\");\n"); } else { printc ("A4GL_push_char(\"%c\");\n", where); if (out) { print_expr (out); } else { printc ("A4GL_push_char(\"%c\");\n", where); } } printc ("A4GL_set_report_dim(%d,%d,%d,%d,%d,\"%s\");", cmd_data->sc_c->with_page_length, cmd_data->sc_c->with_left_margin, cmd_data->sc_c->with_right_margin, cmd_data->sc_c->with_top_margin, cmd_data->sc_c->with_bottom_margin, cmd_data->sc_c->with_top_of_page); printc ("%s%s(2,REPORT_START);", cmd_data->namespace, cmd_data->repname); print_copy_status_with_sql (0); /* Can have an ORDER BY which causes a series of SQL statements */ return 1; } /******************************************************************************/ int print_convert_cmd (struct_convert_cmd * cmd_data) { //str repname; //str namespace; //struct convert *conv_c; print_cmd_start (); if (cmd_data->conv_c->towhat == 'f') { char *str; // Convert via... // str=cmd_data->conv_c->s1->expr_str_u.expr_string; add_function_to_header(str,"",1,0); printc("A4GL_via_functionname(\"%s\",&%s%s,&%s);",cmd_data->repname,cmd_data->namespace,cmd_data->repname,str); // A4GL_via_functionname("r1",&aclfgl_r1,&aclfgl_test1); return 1; } if (cmd_data->conv_c->towhat == '@') { printc ("A4GL_push_int(2);"); } else { if (cmd_data->conv_c->towhat == '|' || cmd_data->conv_c->towhat == 'P') { // Pipe or Printer... printc ("A4GL_push_int(1);"); } else { printc ("A4GL_push_int(0);"); } } if (cmd_data->conv_c->s1) { print_expr (cmd_data->conv_c->s1); } else { printc ("A4GL_push_char(\"\");"); } if (cmd_data->conv_c->conv_type) { print_expr (cmd_data->conv_c->conv_type); } else { printc ("A4GL_push_char(\"\");"); } if (cmd_data->conv_c->filter) { print_expr (cmd_data->conv_c->filter); } else { printc ("A4GL_push_char(\"\");"); } printc ("%s%s(3,REPORT_CONVERT);", cmd_data->namespace, cmd_data->repname); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_free_rep_cmd (struct_free_rep_cmd * cmd_data) { print_cmd_start (); printc ("%s%s(3,REPORT_FREE);", cmd_data->namespace, cmd_data->repname); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_run_cmd (struct_run_cmd * cmd_data) { int type; print_cmd_start (); type = 0; if (cmd_data->returning) type += 1; if (cmd_data->wait == EB_FALSE) // Default is to wait... type += 2; if (cmd_data->run_mode == ERM_FORM_MODE) { type += 512; } if (cmd_data->run_mode == ERM_LINE_MODE) { type += 256; } print_expr (cmd_data->run_string); printc ("A4GL_system_run(%d);", type); if (cmd_data->returning) { print_pop_usage (cmd_data->returning); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_sleep_cmd (struct_sleep_cmd * cmd_data) { print_cmd_start (); print_expr (cmd_data->sleep_expr); printc ("A4GL_sleep_i();\n"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_validate_cmd (struct_validate_cmd * cmd_data) { int z; int a; int b; print_cmd_start (); z = cmd_data->list->list.list_len; for (a = 0; a < z; a++) { //char buff[256]; struct expr_str *e; struct expr_str_list *p = 0; e = cmd_data->validate_list->list.list_val[a]; if (e) { A4GL_assertion (e->expr_type != ET_EXPR_EXPR_LIST, "Expecting a list"); p = e->expr_str_u.expr_list; } if (p == 0) continue; print_push_variable_usage (cmd_data->list->list.list_val[a]); for (b = 0; b < p->list.list_len; b++) { print_expr (p->list.list_val[b]); } printc ("A4GL_push_int(%d);", p->list.list_len); printc ("A4GL_pushop(OP_IN);"); printc ("if (!A4GL_pop_bool()) {A4GLSQL_set_status(-1321,0);}"); } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_whenever_cmd (struct_whenever_cmd * cmd_data) { //set_whento (cmd_data->whencode); printc("/* WHENEVER..*/ "); set_whenever (cmd_data->whencode, cmd_data->whento); return 1; } /******************************************************************************/ int print_while_cmd (struct_while_cmd * cmd_data) { print_cmd_start (); printc ("while (1==1) {\n"); tmp_ccnt++; print_expr (cmd_data->while_expr); printc ("if (!(A4GL_pop_bool())) break;\n"); dump_commands (cmd_data->while_commands); printc("CONTINUE_BLOCK_%d: ;", cmd_data->block_id); tmp_ccnt--; printc ("}"); printc("END_BLOCK_%d: ;", cmd_data->block_id); return 1; } /******************************************************************************/ int print_options_cmd (struct_options_cmd * cmd_data) { int a; int i; print_cmd_start (); //options for (a = 0; a < cmd_data->options->options.options_len; a++) { struct single_option *o; o = cmd_data->options->options.options_val[a]; i = (int) o->option[0]; switch (i) { case 'A': // Accept key printc("A4GL_set_option_value('A',A4GL_key_val(\"%s\"));",o->value); break; case 'D': // Delete key printc("A4GL_set_option_value('D',A4GL_key_val(\"%s\"));",o->value); break; case 'I': // Insert Key printc("A4GL_set_option_value('I',A4GL_key_val(\"%s\"));",o->value); break; case 'N': // Next Key printc("A4GL_set_option_value('N',A4GL_key_val(\"%s\"));",o->value); break; case 'p': // Previous Key printc("A4GL_set_option_value('p',A4GL_key_val(\"%s\"));",o->value); break; case 'H': // Help Key printc("A4GL_set_option_value('D',A4GL_key_val(\"%s\"));",o->value); break; case 'd': printc ("A4GL_set_option_value('%s',%s);", o->option, o->value); printc("A4GL_set_option_value('Z',0);"); break; case 'i': printc ("A4GL_set_option_value('%s',%s);", o->option, o->value); printc("A4GL_set_option_value('Y',0);"); break; case 'C': //COMMENT_LINE case 'E': //ERROR_LINE case 'F': //FORM_LINE case 'M': //MENU_LINE case 'm': //MESSAGE_LINE case 'P': //PROMPT_LINE set_nonewlines(); printc ("{long _val;"); print_expr (o->expr); printc ("_val=A4GL_pop_long();"); printc ("A4GL_set_option_value('%c',_val);\n", i); printc ("}"); clr_nonewlines(); break; case 'h': // HELP_FILE case 'L': // LANG_FILE set_nonewlines(); printc ("{char *_val;"); print_expr (o->expr); printc ("_val=A4GL_char_pop();"); if (i == 'h') { printc ("A4GL_set_help_file(_val);"); } if (i == 'L') { printc ("A4GL_set_lang_file(_val);"); } printc ("free(_val);}"); clr_nonewlines(); break; default: printc ("A4GL_set_option_value('%s',%s);", o->option, o->value); } } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_clear_cmd (struct_clear_cmd * cmd_data) { print_cmd_start (); switch (cmd_data->clr_data.clr_type) { case E_CLR_SCREEN: printc ("A4GL_current_window(\"screen\");"); printc ("A4GL_clr_window(\"screen\");\n"); break; case E_CLR_FORM: printc ("A4GL_clr_form(0);"); break; case E_CLR_FORM_DEFAULTS: printc ("A4GL_clr_form(1);"); //printc ("A4GL_clr_form_fields(1,0);"); break; case E_CLR_WINDOW: set_nonewlines (); printc ("A4GL_clr_window("); print_ident (cmd_data->clr_data.clear_data_u.window); printc (");"); clr_nonewlines (); break; case E_CLR_STATUS: set_nonewlines (); printc ("A4GL_clr_window("); print_ident (cmd_data->clr_data.clear_data_u.statwindow); printc (");"); clr_nonewlines (); break; case E_CLR_FIELDS: { char *flds; flds = local_field_name_list_as_char (cmd_data->clr_data.clear_data_u.fields); printc ("A4GL_clr_fields(%d,%s,NULL,0);", cmd_data->todefaults==EB_TRUE, flds); } break; case E_CLR_FIELDS_TO_DEFAULT: A4GL_assertion (1, "Not used - marked for deletion"); break; } print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_current_win_cmd (struct_current_win_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); printc ("A4GL_current_window("); if (cmd_data->windowname) { print_ident (cmd_data->windowname); } else { printc("\"screen\""); } printc (");"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_show_cmd (struct_show_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); printc ("A4GL_show_window("); print_ident (cmd_data->windowname); printc (");"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_hide_cmd (struct_hide_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); printc ("A4GL_hide_window("); print_ident (cmd_data->windowname); printc (");"); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_move_cmd (struct_move_cmd * cmd_data) { // 90 % print_cmd_start (); print_expr (cmd_data->y); print_expr (cmd_data->x); set_nonewlines (); printc ("A4GL_movewin("); print_ident (cmd_data->windowname); printc (",%d);", cmd_data->relative == 0); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_show_menu_cmd (struct_show_menu_cmd * cmd_data) { print_cmd_start (); print_expr (cmd_data->mn_file); printh ("void aclfglmn_%s(char *);\n", cmd_data->menuhandler); printc ("A4GL_show_menu(\"%s\",aclfglmn_%s);\n", cmd_data->menuname, cmd_data->menuhandler); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_enable_cmd (struct_enable_cmd * cmd_data) { print_cmd_start (); printc ("A4GL_endis_fields(1,%s,NULL,0);\n", local_field_name_list_as_char (cmd_data->srec)); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_enable_form_cmd (struct_enable_form_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); printc ("A4GL_endis_form(1,"); print_ident (cmd_data->formname); printc (",%s,0);\n", local_field_name_list_as_char (cmd_data->srec)); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_disable_cmd (struct_disable_cmd * cmd_data) { print_cmd_start (); printc ("A4GL_endis_fields(0,%s,NULL,0);\n", local_field_name_list_as_char (cmd_data->srec)); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_disable_form_cmd (struct_disable_form_cmd * cmd_data) { print_cmd_start (); set_nonewlines (); printc ("A4GL_endis_form(1,"); print_ident (cmd_data->formname); printc (",%s,0);\n", local_field_name_list_as_char (cmd_data->srec)); clr_nonewlines (); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_pdf_call_cmd (struct_pdf_call_cmd * cmd_data) { struct s_expr_pdf_function_call *p; print_cmd_start (); A4GL_assertion (cmd_data->fcall->expr_type != ET_EXPR_PDF_FCALL, "Expected a ET_EXPR_PDF_FCALL"); p = cmd_data->fcall->expr_str_u.expr_pdf_function_call; real_print_expr_list (p->parameters); printc ("{int _retvars;A4GLSQL_set_status(0,0);\n"); if (is_in_report ()) { printc ("_retvars=A4GL_pdf_pdffunc(&_rep,%s,%d);\n", p->fname, p->parameters->list.list_len); } else { printc ("_retvars=A4GL_pdf_pdffunc(0,%s,%d);\n", p->fname, p->parameters->list.list_len); } print_returning_g (2, cmd_data->returning, 0); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_init_cmd (struct_init_cmd * cmd_data) { print_cmd_start (); int a; int printed=0; //struct expr_str_list* varlist; //str_list* tablist; for (a = 0; a < cmd_data->varlist->list.list_len; a++) { struct variable_usage *u; struct variable_usage *u_bottom; struct variable *v; printed=0; A4GL_assertion (cmd_data->varlist->list.list_val[a]->expr_type != ET_EXPR_VARIABLE_USAGE, "Expecting a variable usage"); u = cmd_data->varlist->list.list_val[a]->expr_str_u.expr_variable_usage; v = local_find_variable_from_usage (u); u_bottom = u; while (u_bottom->next) { u_bottom = u_bottom->next; } if (v->arr_subscripts.arr_subscripts_len) { // The variable is an array.. if (u_bottom->subscripts.subscripts_len == 0) { // We need to null the whole variable print_init_var (v, generation_get_variable_usage_as_string (u), 0, 1, 1,1); } else { struct variable v2; if (u_bottom->subscripts.subscripts_len != v->arr_subscripts.arr_subscripts_len) { a4gl_yyerror ("Subscript mismatch"); return 0; } // We need to null the this specific on.. memcpy (&v2, v, sizeof (v2)); v2.arr_subscripts.arr_subscripts_len = 0; v2.arr_subscripts.arr_subscripts_val = 0; if (cmd_data->tablist) { if (cmd_data->init_like_exprlist && cmd_data->init_like_exprlist->list.list_len<=a) { if ( cmd_data->init_like_exprlist->list.list_val[a]) { print_expr(cmd_data->init_like_exprlist->list.list_val[a]); print_pop_usage(cmd_data->varlist->list.list_val[a]); printed=1; } } } if (!printed) { print_init_var (v, generation_get_variable_usage_as_string (u), 0, 1, 1,0); } } } else { if (cmd_data->tablist) { if (cmd_data->init_like_exprlist && a<cmd_data->init_like_exprlist->list.list_len) { if ( cmd_data->init_like_exprlist->list.list_val[a]) { print_expr(cmd_data->init_like_exprlist->list.list_val[a]); print_pop_usage(cmd_data->varlist->list.list_val[a]); printed=1; } } } if (!printed) { char *s; s=generation_get_variable_usage_as_string(u); // Its not an array.. print_init_var (v, s, 0, 1, 1,1); } } } print_copy_status_not_sql (0); return 1; } static int encode_variable_datatype(int dtype, int size1,int size2) { A4GL_assertion(size2>0,"Expecting size2 to always be 0"); return dtype+(size1<<16); } /******************************************************************************/ int print_display_array_cmd (struct_display_array_cmd * cmd_data) { int cnt; int nevents; //int a; int sio_id; struct variable *v; //struct expr_str * srec; //struct expr_str * arrayname; //struct attrib *attributes; //struct on_events* events; //struct fh_field_entry* scroll_using; //int sio; //int blockid; //str slice; //int slice_start; //int slice_end; print_cmd_start (); sio_id=cmd_data->sio; nevents=0; if (cmd_data->events) { nevents=cmd_data->events->event.event_len; } // void LEXLIB_print_display_array_p1 (char *arrvar, char *srec, char *scroll, char *attr, void *v_input_attr,char *Style,t_binding_comp_list *bind,char *slice) { printcomment ("/* Display array */\n"); printc ("{"); tmp_ccnt++; printc("int _attr=%d;", attributes_as_int(cmd_data->attributes)); printc ("int _fld_dr; int _exec_block= 0;\nchar *_curr_win=0;char _sio_%d[%d];char *_sio_kw_%d=\"s_disp_arr\";\n",sio_id, sizeof (struct s_disp_arr) + 10,sio_id); print_event_list(cmd_data->events); A4GL_assertion(cmd_data->arrayname->expr_type!=ET_EXPR_VARIABLE_USAGE,"Expecting a variable usage"); /* We dont get passed in a real binding - just the variable * so we need to generate our own binding.... * * The array can be one of two types * 1) A simple array ( eg ARRAY OF char(20)) * 2) A record array ( eg ARRAY OF RECORD ... END RECORD ) * * So - lets first have a look and see which type we've got * */ v=local_find_variable_from_usage(cmd_data->arrayname->expr_str_u.expr_variable_usage); if (v->var_data.variable_type==VARIABLE_TYPE_RECORD) { int a; struct variable *v2; struct variable_usage *vu_top; struct variable_usage *vu_next; struct expr_str *vu_as_expr; /* Its an array of RECORD */ cnt=v->var_data.variable_data_u.v_record.variables.variables_len; printc("static struct BINDING obind[%d]={",cnt); /* First - we need to print the 'obind' - which has the types */ for (a=0;a<v->var_data.variable_data_u.v_record.variables.variables_len;a++) { int dtype; v2=v->var_data.variable_data_u.v_record.variables.variables_val[a]; if (v2->var_data.variable_type!=VARIABLE_TYPE_SIMPLE) { a4gl_yyerror("Expecting only simple types in the array"); return 0; } dtype=encode_variable_datatype(v2->var_data.variable_data_u.v_simple.datatype, v2->var_data.variable_data_u.v_simple.dimensions[0], v2->var_data.variable_data_u.v_simple.dimensions[1]); printc("{NULL,%d,%d,0,0,0}%s", dtype&DTYPE_MASK,DECODE_SIZE(dtype), (a==v->var_data.variable_data_u.v_record.variables.variables_len)?"":","); } printc("};"); /* Now - we need to print the array itself.. we could assume the array is a top level array and just display it directly but what I'm trying to do here is to generate a 'variable_usage' for each line so we can print that instead.. in theory - it means we can display array an array which is inside another record/array... */ for (a=0;a<v->var_data.variable_data_u.v_record.variables.variables_len;a++) { v2=v->var_data.variable_data_u.v_record.variables.variables_val[a]; vu_top=clone_variable_usage(cmd_data->arrayname->expr_str_u.expr_variable_usage); vu_next=vu_top; while (vu_next->next) { vu_next=vu_next->next; } vu_next->subscripts.subscripts_len=1; vu_next->subscripts.subscripts_val=malloc(sizeof(struct expr_str *)); vu_next->subscripts.subscripts_val[0]=A4GL_new_literal_long_long(1); vu_next->next=malloc(sizeof(struct variable_usage)); vu_next->next->variable_name=v->var_data.variable_data_u.v_record.variables.variables_val[a]->names.names.names_val[0].name; vu_next->next->subscripts.subscripts_len=0; vu_next->next->subscripts.subscripts_val=0; vu_next->next->substrings_start=0; vu_next->next->substrings_end=0; vu_next->next->next=0; vu_next->next->datatype=v2->var_data.variable_data_u.v_simple.datatype; vu_next->next->scope=cmd_data->arrayname->expr_str_u.expr_variable_usage->scope; vu_next->next->variable_id=a; vu_as_expr=A4GL_new_expr_push_variable(vu_top, is_in_report()); set_nonewlines(); printc("obind[%d].ptr= &",a); print_variable_usage(vu_as_expr); printc(";"); clr_nonewlines(); } } else { // Its a simple array of a single datatype // just a little easier than the record ! cnt = 1; printc("static struct BINDING obind[1]={ {NULL,%d,%d,0,0,0} };",v->var_data.variable_data_u.v_simple.datatype &DTYPE_MASK,DECODE_SIZE(v->var_data.variable_data_u.v_simple.datatype)); set_nonewlines(); printc("obind[0].ptr= &"); print_variable_usage(cmd_data->arrayname); printc("[0];"); clr_nonewlines(); } /* Now onto the rest of it... */ printc ("_curr_win=A4GL_get_currwin_name();\n"); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } printc ("SET(\"s_disp_arr\",_sio_%d,\"no_arr\",A4GL_get_count());\n",sio_id); printc ("SET(\"s_disp_arr\",_sio_%d,\"binding\",obind);\n",sio_id); printc ("SET(\"s_disp_arr\",_sio_%d,\"nbind\",%d);\n",sio_id, cnt); printc ("SET(\"s_disp_arr\",_sio_%d,\"srec\",0);\n",sio_id); printc ("SET(\"s_disp_arr\",_sio_%d,\"start_slice\",%d);\n",sio_id,cmd_data->slice_start); printc ("SET(\"s_disp_arr\",_sio_%d,\"end_slice\",%d);\n",sio_id,cmd_data->slice_end); if (cmd_data->attributes && cmd_data->attributes->currentrowdisplay && strlen(cmd_data->attributes->currentrowdisplay)) printc ("SET(\"s_disp_arr\",_sio_%d,\"curr_display\",%s);\n",sio_id, cmd_data->attributes->currentrowdisplay); else printc ("SET(\"s_disp_arr\",_sio_%d,\"curr_display\",0);\n",sio_id); set_nonewlines(); printc ("SET(\"s_disp_arr\",_sio_%d,\"arr_elemsize\",sizeof(",sio_id); print_variable_usage(cmd_data->arrayname); printc("[0]));\n"); clr_nonewlines(); printc ("_fld_dr= -1;_exec_block=0;\n"); printc ("while (1) {\n"); tmp_ccnt++; print_event_actions("_fld_dr",cmd_data->events); printc("CONTINUE_BLOCK_%d: ; ", cmd_data->blockid); if (cmd_data->events) { nevents=cmd_data->events->event.event_len; } else { nevents=0; } printc("if (_exec_block==%d) { break; } ",nevents+1); printc("A4GL_ensure_current_window_is(_curr_win);"); print_reset_state_after_call(0); set_nonewlines(); printc ("_exec_block=A4GL_disp_arr_v2(&_sio_%d,", sio_id); print_variable_usage(cmd_data->arrayname); printc(","); print_ident(cmd_data->srec); printc(",_attr,"); if (cmd_data->scroll_using) { print_field(cmd_data->scroll_using); } else { printc("NULL,0"); } printc(",_sio_evt);"); clr_nonewlines(); printc("if (_exec_block==-999) {break;}"); tmp_ccnt--; printc ("}\n"); tmp_ccnt--; printc ("}\n"); printc("END_BLOCK_%d:;", cmd_data->blockid); //print_reset_state_after_call(); printcomment ("/* end display */\n"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_construct_cmd (struct_construct_cmd * cmd_data) { int sio_id; int nevents; int ccc; int a; struct expr_str_list *li; //enum e_boolean by_name; //struct expr_str* constr_var; //cons_list* con_columns; //struct fh_field_list* list; //struct on_events* events; //struct attrib *attributes; //enum e_boolean without_defaults; //int helpno; //int sio; //int blockid; sio_id=cmd_data->sio; nevents=0; if (cmd_data->events) { nevents=cmd_data->events->event.event_len; } print_cmd_start (); printc("{"); tmp_ccnt++; /* print_bind_dir_definition_g expects a list of variables - not just a singleton * so we need to make it into a list before we pass it in */ li= A4GL_new_ptr_list (cmd_data->constr_var); print_bind_dir_definition_g(li,1,'i'); // LEXLIB_print_bind_definition_g (bind); // print_bind_dir_definition_g /* from print_constr */ printc ("struct s_constr_list constr_flds[%d]={\n", cmd_data->con_columns->list.list_len); for (a = 0; a < cmd_data->con_columns->list.list_len; a++) { if (a > 0) printc (",\n"); printc ("{\"%s\",\"%s\"}", cmd_data->con_columns->list.list_val[a]->tabname, cmd_data->con_columns->list.list_val[a]->colname); } printc ("\n};"); ccc = cmd_data->con_columns->list.list_len; sio_id=cmd_data->sio; printc("int _attr=%d;", attributes_as_int(cmd_data->attributes)); printc ("int _fld_dr= -100;int _exec_block= 0;char *_fldname;int _sf;"); printc("char _sio_%d[%d]; char *_curr_win=0; char _inp_io_type='C'; char *_sio_kw_%d=\"s_screenio\";\n", sio_id,sizeof (struct s_screenio) + 10,sio_id); printc("void *_filterfunc=NULL;"); printc ("int _forminit=1;\n"); print_event_list(cmd_data->events); local_print_bind_set_value_g (li,1,0,'i'); printc ("while(_fld_dr!=0){\n"); tmp_ccnt++; printc ("if (_exec_block == 0) {\n"); tmp_ccnt++; printc ("_curr_win=A4GL_get_currwin_name();\n"); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } printc ("SET(\"s_screenio\",_sio_%d,\"vars\",ibind);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"novars\",%d);\n", sio_id,ccc); printc ("SET(\"s_screenio\",_sio_%d,\"attrib\",_attr);\n", sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"currform\",A4GL_get_curr_form(1));\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"currentfield\",0);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"currentmetrics\",0);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"constr\",constr_flds);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"mode\",%d);\n",sio_id, MODE_CONSTRUCT); printc ("SET(\"s_screenio\",_sio_%d,\"processed_onkey\",0);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"field_list\",0);\n",sio_id); if (cmd_data->callback_function!=NULL) { add_function_to_header(cmd_data->callback_function->expr_str_u.expr_func.funcname,cmd_data->callback_function->expr_str_u.expr_func.namespace,1,0); printc("_filterfunc=%s%s;",cmd_data->callback_function->expr_str_u.expr_func.namespace,cmd_data->callback_function->expr_str_u.expr_func.funcname); } printc ("SET(\"s_screenio\",_sio_%d,\"callback_function\", _filterfunc);\n",sio_id); printc ("SET(\"s_screenio\",_sio_%d,\"nfields\",A4GL_gen_field_chars((void ***)GETPTR(\"s_screenio\",_sio_%d,\"field_list\"),(void *)GET(\"s_screenio\",_sio_%d,\"currform\"),%s,NULL));\n",sio_id,sio_id,sio_id, local_field_name_list_as_char(cmd_data->list )); printc ("_sf=A4GL_set_fields(&_sio_%d); A4GL_debug(\"_sf=%%d\",_sf);if(_sf==0) {_fld_dr=0;break;}\n",sio_id); printc ("_fld_dr= -1;\n"); tmp_ccnt--; printc ("} /* end of initialization */\n"); print_event_actions ("_exec_block", cmd_data->events); printc("if (_exec_block== %d) { break; } ",nevents+1); printc("A4GL_ensure_current_window_is(_curr_win);"); printc ("_exec_block = A4GL_form_loop_v2(&_sio_%d,_forminit,_sio_evt);_forminit=0;\n", sio_id); printc("if (_exec_block>0) _fld_dr=_sio_evt[_exec_block-1].event_type; else _fld_dr= -1;"); printc("CONTINUE_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); tmp_ccnt--; printc ("\n}\n"); printc("END_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); printc (" A4GL_push_constr(&_sio_%d); ",sio_id); printc (" A4GL_pop_params(ibind,1);"); printc ("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);", sio_id,sio_id); tmp_ccnt--; printc ("}\n"); print_reset_state_after_call(1); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_input_cmd (struct_input_cmd * cmd_data) { int sio_id; int nevents; int ccc; //struct expr_str_list* variables; //struct fh_field_list* field_list; //struct on_events* events; //struct attrib *attributes; //enum e_boolean by_name; //enum e_boolean without_defaults; //int helpno; //int sio; //int blockid; sio_id=cmd_data->sio; nevents=0; if (cmd_data->events) { nevents=cmd_data->events->event.event_len; } print_cmd_start (); printc ("{\nint _fld_dr= -100;\nint _exec_block= 0;\nchar *_fldname;char *_curr_win;int _sf;\n"); printc("int _attr=%d;", attributes_as_int(cmd_data->attributes)); ccc=cmd_data->variables->list.list_len; print_bind_dir_definition_g (cmd_data->variables,1,'i'); printc("char _sio_%d[%d];", sio_id,sizeof (struct s_screenio) + 10); printc("char _inp_io_type='I';"); printc("char *_sio_kw_%d=\"s_screenio\";", sio_id); printc ("int _forminit=1;\n"); print_event_list(cmd_data->events); printc ("while(_fld_dr!=0){\n"); tmp_ccnt++; printc ("if (_fld_dr== -100) {\n"); tmp_ccnt++; printc ("/* input by name */"); local_print_bind_set_value_g (cmd_data->variables,1,0,'i'); printc ("_curr_win=A4GL_get_currwin_name();\n"); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } printc ("SET(\"s_screenio\",&_sio_%d,\"currform\",A4GL_get_curr_form(1));\n",sio_id); printc ("if (GET_AS_INT(\"s_screenio\",&_sio_%d,\"currform\")==0) break;\n",sio_id); printc ("SET(\"s_screenio\",&_sio_%d,\"vars\",ibind);\n",sio_id); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } printc ("SET(\"s_screenio\",&_sio_%d,\"attrib\",_attr);\n",sio_id ); printc ("SET(\"s_screenio\",&_sio_%d,\"novars\",%d);\n",sio_id, ccc); printc ("SET(\"s_screenio\",&_sio_%d,\"help_no\",%d);\n",sio_id, cmd_data->helpno); printc ("SET(\"s_screenio\",&_sio_%d,\"processed_onkey\",0);\n",sio_id); printc ("SET(\"s_screenio\",&_sio_%d,\"field_list\",0);\n",sio_id); printc ("SET(\"s_screenio\",&_sio_%d,\"currentfield\",0);\n",sio_id); printc ("SET(\"s_screenio\",&_sio_%d,\"currentmetrics\",0);\n",sio_id); printc ("SET(\"s_screenio\",&_sio_%d,\"mode\",%d);\n",sio_id, MODE_INPUT + (cmd_data->without_defaults==EB_TRUE)); printc ("SET(\"s_screenio\",&_sio_%d,\"nfields\",A4GL_gen_field_chars((void ***)GETPTR(\"s_screenio\",&_sio_%d,\"field_list\"),(void *)GET(\"s_screenio\",&_sio_%d,\"currform\"),%s,NULL));\n", sio_id,sio_id,sio_id, local_field_name_list_as_char(cmd_data->field_list)); printc ("if (GET_AS_INT(\"s_screenio\",&_sio_%d,\"nfields\")==-1) break;\n",sio_id); printc ("_sf=A4GL_set_fields(&_sio_%d); A4GL_debug(\"_sf=%%d\",_sf);if(_sf==0) {_fld_dr=0;break;}\n",sio_id); printc ("_fld_dr= -1;_exec_block=0;\n"); tmp_ccnt--; printc ("} /* end of initialization */\n"); print_event_actions ("_exec_block", cmd_data->events); printc("if (_exec_block==%d) { break; } ",nevents+1); printc("A4GL_ensure_current_window_is(_curr_win);"); printc ("_exec_block=A4GL_form_loop_v2(&_sio_%d,_forminit,_sio_evt);_forminit=0;\n",sio_id); printc("if (_exec_block>0) _fld_dr=_sio_evt[_exec_block-1].event_type; else _fld_dr= -1;"); printc("CONTINUE_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); tmp_ccnt--; printc ("\n}\n"); printc("END_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); printc("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);",sio_id,sio_id); printc ("}\n"); // Construct has one of these - do we need one here too ? /* print_reset_state_after_call(); */ print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_input_array_cmd (struct_input_array_cmd * cmd_data) { int sio_id=-1; int nevents=-1; //int ccc=-1; int cnt=-1; int inp_flags=0; struct variable *v; //struct expr_str *srec; //struct expr_str *arrayname; //struct attrib *attrib; //struct on_events *events; //e_boolean without_defaults; //int helpno; //int sio; //int blk; //str slice; //int slice_start; //int slice_end; sio_id=cmd_data->sio; nevents=0; if (cmd_data->events) { nevents=cmd_data->events->event.event_len; } print_cmd_start (); A4GL_assertion(cmd_data->arrayname->expr_type!=ET_EXPR_VARIABLE_USAGE,"Expecting a variable usage"); printc ("{"); tmp_ccnt++; printc("int _attr=%d;", attributes_as_int(cmd_data->attributes)); printc("int _fld_dr= -100;int _exec_block= 0;\nchar *_fldname;char *_curr_win; \nint _forminit=1;int _tmp_int=0;"); printc ("char _sio_%d[%d];char _inp_io_type='A';char *_sio_kw_%d=\"s_inp_arr\";\n",sio_id, sizeof (struct s_inp_arr) + 10,sio_id); print_event_list(cmd_data->events); /* We dont get passed in a real binding - just the variable * so we need to generate our own binding.... * * The array can be one of two types * 1) A simple array ( eg ARRAY OF char(20)) * 2) A record array ( eg ARRAY OF RECORD ... END RECORD ) * * So - lets first have a look and see which type we've got * */ v=local_find_variable_from_usage(cmd_data->arrayname->expr_str_u.expr_variable_usage); if (v->var_data.variable_type==VARIABLE_TYPE_RECORD) { int a; struct variable *v2; struct variable_usage *vu_top; struct variable_usage *vu_next; struct expr_str *vu_as_expr; /* Its an array of RECORD */ cnt=v->var_data.variable_data_u.v_record.variables.variables_len; printc("static struct BINDING obind[%d]={",cnt); /* First - we need to print the 'obind' - which has the types */ for (a=0;a<v->var_data.variable_data_u.v_record.variables.variables_len;a++) { int dtype; v2=v->var_data.variable_data_u.v_record.variables.variables_val[a]; if (v2->var_data.variable_type!=VARIABLE_TYPE_SIMPLE) { a4gl_yyerror("Expecting only simple types in the array"); return 0; } dtype=encode_variable_datatype(v2->var_data.variable_data_u.v_simple.datatype, v2->var_data.variable_data_u.v_simple.dimensions[0], v2->var_data.variable_data_u.v_simple.dimensions[1]); printc("{NULL,%d,%d,0,0,0}%s /* 1 */", dtype&DTYPE_MASK,DECODE_SIZE(dtype), (a==v->var_data.variable_data_u.v_record.variables.variables_len)?"":","); } printc("};"); /* Now - we need to print the array itself.. we could assume the array is a top level array and just display it directly but what I'm trying to do here is to generate a 'variable_usage' for each line so we can print that instead.. in theory - it means we can display array an array which is inside another record/array... */ for (a=0;a<v->var_data.variable_data_u.v_record.variables.variables_len;a++) { v2=v->var_data.variable_data_u.v_record.variables.variables_val[a]; vu_top=clone_variable_usage(cmd_data->arrayname->expr_str_u.expr_variable_usage); vu_next=vu_top; while (vu_next->next) { vu_next=vu_next->next; } vu_next->subscripts.subscripts_len=1; vu_next->subscripts.subscripts_val=malloc(sizeof(struct expr_str *)); vu_next->subscripts.subscripts_val[0]=A4GL_new_literal_long_long(1); vu_next->next=malloc(sizeof(struct variable_usage)); vu_next->next->variable_name=v->var_data.variable_data_u.v_record.variables.variables_val[a]->names.names.names_val[0].name; vu_next->next->subscripts.subscripts_len=0; vu_next->next->subscripts.subscripts_val=0; vu_next->next->substrings_start=0; vu_next->next->substrings_end=0; vu_next->next->next=0; vu_next->next->datatype=v2->var_data.variable_data_u.v_simple.datatype; vu_next->next->scope=cmd_data->arrayname->expr_str_u.expr_variable_usage->scope; vu_next->next->variable_id=a; vu_as_expr=A4GL_new_expr_push_variable(vu_top, is_in_report()); set_nonewlines(); printc("obind[%d].ptr= &",a); print_variable_usage(vu_as_expr); printc(";"); clr_nonewlines(); } } else { // Its a simple array of a single datatype // just a little easier than the record ! cnt = 1; int dtype; dtype=encode_variable_datatype(v->var_data.variable_data_u.v_simple.datatype, v->var_data.variable_data_u.v_simple.dimensions[0], v->var_data.variable_data_u.v_simple.dimensions[1]); printc("static struct BINDING obind[1]={ {NULL,%d,%d,0,0,0} }; /* 2 */",dtype &DTYPE_MASK,DECODE_SIZE(dtype)); set_nonewlines(); printc("obind[0].ptr= &"); print_variable_usage(cmd_data->arrayname); printc("[0];"); clr_nonewlines(); } // cnt = print_arr_bind_g (bind); printc ("while (_fld_dr!=0) {\n"); tmp_ccnt++; printc ("if (_exec_block==0) {\n"); tmp_ccnt++; printc ("_curr_win=A4GL_get_currwin_name();\n"); if (cmd_data->without_defaults==EB_TRUE) { printc ("SET(\"s_inp_arr\",_sio_%d,\"no_arr\",A4GL_get_count());\n",sio_id); } else { printc ("SET(\"s_inp_arr\",_sio_%d,\"no_arr\",0);\n",sio_id); } printc ("SET(\"s_inp_arr\",_sio_%d,\"binding\",obind);\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"nbind\",%d);\n",sio_id, cnt); printc ("SET(\"s_inp_arr\",_sio_%d,\"srec\",0);\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"scr_dim\",0);\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"help_no\",%d);\n",sio_id, cmd_data->helpno); set_nonewlines(); printc ("SET(\"s_inp_arr\",_sio_%d,\"arr_elemsize\",sizeof(",sio_id); print_variable_usage(cmd_data->arrayname); printc("[0]));\n"); clr_nonewlines(); if ( cmd_data->attributes && (cmd_data->attributes->no_new_lines==EB_TRUE)) { inp_flags+=1; } set_nonewlines(); printc ("SET(\"s_inp_arr\",_sio_%d,\"arr_size\",sizeof(", sio_id); print_variable_usage(cmd_data->arrayname); printc(")/sizeof("); print_variable_usage(cmd_data->arrayname); printc("[0]));"); clr_nonewlines(); printc ("SET(\"s_inp_arr\",_sio_%d,\"currform\",A4GL_get_curr_form(1));\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"inp_flags\",%d);\n",sio_id, inp_flags); printc ("if (GET_AS_INT(\"s_inp_arr\",_sio_%d,\"currform\")==0) break;\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"currentfield\",0);\n",sio_id); printc ("SET(\"s_inp_arr\",_sio_%d,\"start_slice\",%d);\n",sio_id,cmd_data->slice_start); printc ("SET(\"s_inp_arr\",_sio_%d,\"end_slice\",%d);\n",sio_id,cmd_data->slice_end); printc ("SET(\"s_inp_arr\",_sio_%d,\"mode\",%d);\n",sio_id, MODE_INPUT+ (cmd_data->without_defaults==EB_TRUE)); if (cmd_data->attributes && cmd_data->attributes->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->attributes->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } if (cmd_data->attributes && cmd_data->attributes->currentrowdisplay && strlen(cmd_data->attributes->currentrowdisplay)) printc ("SET(\"s_inp_arr\",_sio_%d,\"curr_display\",%s);\n",sio_id, cmd_data->attributes->currentrowdisplay); else printc ("SET(\"s_inp_arr\",_sio_%d,\"curr_display\",0);\n",sio_id); if (cmd_data->attributes && cmd_data->attributes->count) { print_expr(cmd_data->attributes->count); printc("_tmp_int=A4GL_pop_long();"); printc ("SET(\"s_inp_arr\",_sio_%d,\"count\",_tmp_int);\n",sio_id); print_expr(cmd_data->attributes->count); printc ("aclfgl_set_count(1);\n"); } else { printc ("SET(\"s_inp_arr\",_sio_%d,\"count\",-1);\n",sio_id); } if (cmd_data->attributes && cmd_data->attributes->maxcount) { print_expr(cmd_data->attributes->maxcount); printc("_tmp_int=A4GL_pop_long();"); printc ("SET(\"s_inp_arr\",_sio_%d,\"maxcount\",_tmp_int);\n",sio_id); } else { printc ("SET(\"s_inp_arr\",_sio_%d,\"maxcount\",-1);\n",sio_id); } if (cmd_data->attributes) { printc ("SET(\"s_inp_arr\",_sio_%d,\"allow_insert\",%d);\n",sio_id, cmd_data->attributes->allow_insert!=EB_FALSE); } else { printc ("SET(\"s_inp_arr\",_sio_%d,\"allow_insert\",%d);\n",sio_id, 1); } if (cmd_data->attributes) { printc ("SET(\"s_inp_arr\",_sio_%d,\"allow_delete\",%d);\n",sio_id, cmd_data->attributes->allow_delete!=EB_FALSE); } else { printc ("SET(\"s_inp_arr\",_sio_%d,\"allow_delete\",%d);\n",sio_id, 1); } set_nonewlines(); printc ("SET(\"s_inp_arr\",_sio_%d,\"nfields\",A4GL_gen_field_chars((void ***)GETPTR(\"s_inp_arr\",_sio_%d,\"field_list\"),(void *)GET(\"s_inp_arr\",_sio_%d,\"currform\"),A4GL_add_dot_star(", sio_id, sio_id, sio_id ); print_ident(cmd_data->srec); printc("),NULL,0));\n"); clr_nonewlines(); printc ("_fld_dr= -1;"); printc("_exec_block=-1;"); printc("ERR_CHK_ERROR { break;} "); printc("continue;\n"); print_reset_state_after_call(0); tmp_ccnt--; printc ("} /* end of initialization */\n"); print_event_actions ("_exec_block", cmd_data->events); printc("if (_exec_block==%d) { break; } ",nevents+1); printc("A4GL_ensure_current_window_is(_curr_win);"); set_nonewlines(); printc ("_exec_block= A4GL_inp_arr_v2(&_sio_%d,%d,", sio_id, cmd_data->without_defaults==TRUE); print_ident(cmd_data->srec); printc(",_attr,_forminit,_sio_evt);_forminit=0;\n"); clr_nonewlines(); printc("if (_exec_block>0) _fld_dr=_sio_evt[_exec_block-1].event_type; else _fld_dr= -1;"); printc("CONTINUE_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); tmp_ccnt--; printc ("\n}\n"); printc("END_BLOCK_%d: ; /* add_continue */",cmd_data->blockid); printc("A4GL_finish_screenio(&_sio_%d,_sio_kw_%d);",sio_id,sio_id); tmp_ccnt--; printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_prompt_cmd (struct_prompt_cmd * cmd_data) { int timeout = 0; char *style; char *text; //struct expr_str_list*prompt_str; //struct attrib *prompt_str_attrib; //struct attrib *prompt_fld_attrib; //enum e_boolean for_char; //struct expr_str* promptvar; //int helpno; //struct on_events* events; //int sio; //int blockid; // // prattrib 4char hlp fldattr var /* print_prompt_1($<ptr_list>2, $<str>3, $<str>5, $<str>7, $<str>8, 0,last_style,$<str>6) ; */ //t_expr_str_list *expr, char *a1, char *a2, char *a3, char *a4, int timeout,char *Style,char *promptvar) print_cmd_start (); printc ("{"); tmp_ccnt++; printc("int _attr_prompt=%d;", attributes_as_int (cmd_data->prompt_str_attrib)); printc("int _attr_field=%d;", attributes_as_int (cmd_data->prompt_fld_attrib)); printc("char _sio_%d[%d];int _fld_dr= -9999;int _exec_block= 0;char *_sio_kw_%d=\"s_prompt\";int _acl_prompt_timeout=%d;\n", cmd_data->sio, sizeof (struct s_prompt), cmd_data->sio, timeout); print_event_list (cmd_data->events); A4GL_print_expr_list_concat (cmd_data->prompt_str); if (cmd_data->prompt_str_attrib && cmd_data->prompt_str_attrib->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->prompt_str_attrib->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr_prompt=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } if (cmd_data->prompt_fld_attrib && cmd_data->prompt_fld_attrib->var_attrib) { printc("{"); printc("char *_s;"); print_expr(cmd_data->prompt_fld_attrib->var_attrib); printc("_s=A4GL_char_pop();"); printc("_attr_field=A4GL_strattr_to_num(_s);"); printc("free(_s);"); printc("}"); } if (cmd_data->prompt_fld_attrib) { text=cmd_data->prompt_fld_attrib->text; if (strlen(text)==0) text="\"\""; style=cmd_data->prompt_fld_attrib->style; if (strlen(style)==0) style="\"\""; } else { text="\"\""; style="\"\""; } printc ("if (A4GL_start_prompt(&_sio_%d,_attr_prompt,%d,%d,_attr_field,%s,%s)) {\n", cmd_data->sio, cmd_data->for_char==EB_TRUE, cmd_data->helpno, text,style); tmp_ccnt++; printc ("while (1) {"); tmp_ccnt++; print_event_actions ("_exec_block", cmd_data->events); printc("CONTINUE_BLOCK_%d: ;", cmd_data->blockid); printc ("if (GET_AS_INT(\"s_prompt\",_sio_%d,\"mode\")==2) break;", cmd_data->sio); printc ("_exec_block=A4GL_prompt_loop_v2(&_sio_%d,_acl_prompt_timeout,_sio_evt);\n", cmd_data->sio); tmp_ccnt--; printc ("}"); print_pop_usage_prompt (cmd_data->promptvar); tmp_ccnt--; printc ("}\n"); tmp_ccnt--; printc ("}\n"); printc("END_BLOCK_%d: ;", cmd_data->blockid); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_menu_cmd (struct_menu_cmd * cmd_data) { //struct expr_str *menu_title; //struct attrib *menu_attrib; //struct on_events* events; //int sio; //int blockid; // struct expr_str *menu_attrib_comment; // struct expr_str *menu_attrib_style; // struct expr_str *menu_attrib_image; // // int menu_no; print_cmd_start (); menu_no = cmd_data->blockid; printc ("{\nvoid *m_%d=0;\n\nint cmd_no_%d= -1; /* n=%d */\n", menu_no, menu_no, menu_no); tmp_ccnt++; printc ("MENU_START_%d: ;", menu_no); printc ("while (cmd_no_%d!= -3) {\n", menu_no); tmp_ccnt++; if (cmd_data->events) // Should always be true though ! { int a; int opt_cnt = 0; for (a = 0; a < cmd_data->events->event.event_len; a++) { struct on_event *evt; evt = cmd_data->events->event.event_val[a]; if (evt->evt_data.event_type == EVENT_BEFORE_MENU) { dump_comments (evt->lineno); printc ("if (cmd_no_%d==-2) {", menu_no); tmp_ccnt++; printc ("A4GL_disp_h_menu(m_%d);", menu_no); dump_commands (evt->on_event_commands); printc ("/* FORCE AROUND MENU LOOP AGAIN */ cmd_no_%d= -4;goto MENU_START_%d; /* %d */", menu_no, menu_no, menu_no); tmp_ccnt--; printc ("}"); } else { dump_comments (evt->lineno); printc (" if (cmd_no_%d==%d) { \n", menu_no, opt_cnt++); tmp_ccnt++; dump_commands (evt->on_event_commands); printc ("/* FORCE AROUND MENU LOOP AGAIN */ cmd_no_%d= -4;goto MENU_START_%d; /* %d */", menu_no, menu_no, menu_no); tmp_ccnt--; printc ("}"); } } } printcomment (" /*end switch */\n"); printc ("if (cmd_no_%d== -1) {\n", menu_no); tmp_ccnt++; printc ("char *_mntitle;"); printc ("char *_mnoptiontitle;"); if (cmd_data->menu_title) { printc ("/* PRINT EXPR */"); print_expr (cmd_data->menu_title); printc ("/* END PRINT EXPR */"); } else { printc ("/* PUSH NOTHING */"); printc ("A4GL_push_char(\"\");"); } printc ("_mntitle=A4GL_char_pop(); /* ... */"); if (cmd_data->menu_attrib_comment || cmd_data->menu_attrib_style || cmd_data->menu_attrib_image) { printc ("{"); printc ("char *_comment;"); printc ("char *_style;"); printc ("char *_image;"); if (cmd_data->menu_attrib_comment) { print_expr (cmd_data->menu_attrib_comment); } else { printc ("A4GL_push_char(\"\");"); } printc ("_comment=A4GL_char_pop();"); if (cmd_data->menu_attrib_style) { print_expr (cmd_data->menu_attrib_style); } else { printc ("A4GL_push_char(\"\");"); } printc ("_style=A4GL_char_pop();"); if (cmd_data->menu_attrib_image) { print_expr (cmd_data->menu_attrib_image); } else { printc ("A4GL_push_char(\"\");"); } printc ("_image=A4GL_char_pop();"); printc ("m_%d=(void *)A4GL_new_menu_create_with_attr(_mntitle,1,1,%d,0,_comment, _style,_image);", menu_no, 2); printc ("free(_comment);"); printc ("free(_style);"); printc ("free(_image);"); printc ("free(_mntitle);"); printc ("}"); } else { printc ("m_%d=(void *)A4GL_new_menu_create_with_attr(_mntitle,1,1,%d,0,\"\",\"\",\"\");\n", menu_no, 2); printc ("free(_mntitle);"); } if (cmd_data->events) { int a; for (a = 0; a < cmd_data->events->event.event_len; a++) { struct on_event *evt; evt = cmd_data->events->event.event_val[a]; switch (evt->evt_data.event_type) { case EVENT_ON_ACTION: printc ("A4GL_add_menu_action(m_%d, \"%s\",%d);\n", menu_no, evt->evt_data.event_data_u.on_action, a); break; case EVENT_MENU_COMMAND: set_nonewlines (); printc ("A4GL_add_menu_option(m_%d, ", menu_no); if (evt->evt_data.event_data_u.mnoption->shortname) { printc ("%s", local_expr_as_string (evt->evt_data.event_data_u.mnoption->shortname)); } else { printc ("\"\""); } printc (","); if (evt->evt_data.event_data_u.mnoption->keys) { if (evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_len) { int b; printc ("\""); for (b = 0; b < evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_len; b++) { if (b) printc ("||"); printc ("%s", evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_val[b]); } printc ("\""); } else { printc ("\"EMPTY\""); } } else { printc ("\"EMPTY\""); } printc (","); if (evt->evt_data.event_data_u.mnoption->longname) { printc ("%s", local_expr_as_string (evt->evt_data.event_data_u.mnoption->longname)); } else { printc ("\"\""); } printc (",%d,0);", evt->evt_data.event_data_u.mnoption->helpno); clr_nonewlines (); break; case EVENT_ON_IDLE: printh ("static long a4gl_mn_idle%d=0;\n", idle_cnt); printc ("A4GL_add_menu_timeout(m_%d, 'D',%d,%d,&a4gl_mn_idle%d);a4gl_mn_idle%d=0;\n", menu_no, evt->evt_data.event_data_u.idle_n, a, idle_cnt, idle_cnt); idle_cnt++; break; case EVENT_ON_INTERVAL: printh ("static long a4gl_mn_idle%d=0;\n", idle_cnt); printc ("A4GL_add_menu_timeout(m_%d, 'V',%d,%d,&a4gl_mn_idle%d);a4gl_mn_idle%d=0;\n", menu_no, evt->evt_data.event_data_u.interval_n, a, idle_cnt, idle_cnt); idle_cnt++; break; case EVENT_BEFORE_MENU: // this one is handled implicitly - // the loop variable will be set to -2 during startup break; default: A4GL_assertion (1, "Unexpected event type in a menu"); } } } printc ("A4GL_finish_create_menu(m_%d); ", menu_no); //printc("A4GL_disp_h_menu(m_%d); ",n); printc ("cmd_no_%d= -2;", menu_no); printc ("continue;"); tmp_ccnt--; /* case EVENT_BEFORE_MENU: printc("if (cmd_no_%d==-2) {",n); printc("}"); break; */ printc ("}\n"); printc("CONTINUE_BLOCK_%d: ;", cmd_data->blockid); // -------------------------------------------- // Reset any menu items // they may have changed titles :-( // see build test 1688 // -------------------------------------------- if (cmd_data->events) { int a; int optno=0; for (a = 0; a < cmd_data->events->event.event_len; a++) { struct on_event *evt; evt = cmd_data->events->event.event_val[a]; switch (evt->evt_data.event_type) { case EVENT_MENU_COMMAND: set_nonewlines (); printc ("A4GL_ensure_menu_option(%d, m_%d, ", optno++, menu_no); if (evt->evt_data.event_data_u.mnoption->shortname) { printc ("%s", local_expr_as_string (evt->evt_data.event_data_u.mnoption->shortname)); } else { printc ("\"\""); } printc (","); if (evt->evt_data.event_data_u.mnoption->keys) { if (evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_len) { int b; printc ("\""); for (b = 0; b < evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_len; b++) { if (b) printc ("||"); printc ("%s", evt->evt_data.event_data_u.mnoption->keys->str_list_entry.str_list_entry_val[b]); } printc ("\""); } else { printc ("\"EMPTY\""); } } else { printc ("\"EMPTY\""); } printc (","); if (evt->evt_data.event_data_u.mnoption->longname) { printc ("%s", local_expr_as_string (evt->evt_data.event_data_u.mnoption->longname)); } else { printc ("\"\""); } printc (",%d,0);", evt->evt_data.event_data_u.mnoption->helpno); clr_nonewlines (); break; default: break; } } } printc ("cmd_no_%d=A4GL_menu_loop_v2(m_%d,0);\n", menu_no, menu_no); tmp_ccnt--; printc ("}\n"); printc ("A4GL_free_menu(m_%d);\n", menu_no); printcomment ("/* end cwhile */\n"); printcomment ("/* end menu */\n \n"); tmp_ccnt--; printc ("}"); printc("END_BLOCK_%d: ;", cmd_data->blockid); //print_end_menu_1(menu_blk[menu_cnt], menu_attrib_comment,menu_attrib_style, menu_attrib_image); //print_end_menu_2(menu_blk[menu_cnt]); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_output_cmd(struct_output_cmd *cmd_data) { int n; print_cmd_start (); if (cmd_data->expressions) { n=cmd_data->expressions->list.list_len; real_print_expr_list(cmd_data->expressions ); } else { n=0; } add_function_to_header (cmd_data->repname,cmd_data->namespace, 2,0); printc ("%s%s(%d,REPORT_SENDDATA);\n", cmd_data->namespace, cmd_data->repname, n); printc("if (aclfgli_get_err_flg()) {"); print_copy_status_with_sql (0); /* Can have an ORDER BY which causes a series of SQL statements */ printc("} else {"); print_copy_status_not_sql (0); /* Can have an ORDER BY which causes a series of SQL statements */ printc("}"); return 1; } /******************************************************************************/ int print_finish_cmd(struct_finish_cmd *cmd_data) { print_cmd_start (); add_function_to_header (cmd_data->repname,cmd_data->namespace, 2,0); printc("%s%s(0,REPORT_FINISH);\n", cmd_data->namespace, cmd_data->repname); printc("if (aclfgli_get_err_flg()) {"); print_copy_status_with_sql (0); /* Can have an ORDER BY which causes a series of SQL statements */ printc("} else {"); print_copy_status_not_sql (0); /* Can have an ORDER BY which causes a series of SQL statements */ printc("}"); if (cmd_data->conv_c) { if (cmd_data->conv_c->towhat=='M') { // ignore it - its a CONVERT TO MANY... } else { struct struct_convert_cmd cc; cc.namespace=cmd_data->namespace; cc.repname=cmd_data->repname; cc.conv_c=cmd_data->conv_c; print_convert_cmd (&cc); printc("%s%s(3,REPORT_FREE);", cmd_data->namespace, cmd_data->repname); } } return 1; } /******************************************************************************/ int print_term_rep_cmd(struct_term_rep_cmd *cmd_data) { print_cmd_start (); add_function_to_header (cmd_data->repname,cmd_data->namespace, 2,0); printc ("%s%s(0,REPORT_TERMINATE);\n", cmd_data->namespace, cmd_data->repname); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_need_cmd(struct_need_cmd *cmd_data) { print_cmd_start (); print_expr(cmd_data->expr); printc ("A4GL_%sneed_lines(&_rep);\n", generate_ispdf ()); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_skip_cmd(struct_skip_cmd *cmd_data) { print_cmd_start (); printc ("A4GL_push_int(%d);", cmd_data->lines ); printc ("A4GL_%saclfgli_skip_lines(&_rep);\n", generate_ispdf ()); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_skip_by_cmd(struct_skip_by_cmd *cmd_data) { print_cmd_start (); printc("{double _d;"); print_expr(cmd_data->skip_amt); printc("_d=A4GL_pop_double();"); printc ("A4GL_pdf_skip_by(&_rep,_d);\n"); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_skip_to_cmd(struct_skip_to_cmd *cmd_data) { print_cmd_start (); printc("{double _d;"); print_expr(cmd_data->skip_amt); printc("_d=A4GL_pop_double();"); printc ("A4GL_pdf_skip_to(&_rep,_d);\n"); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_print_cmd(struct_print_cmd *cmd_data) { int semi_i; char *wrap="0"; int a; print_cmd_start (); if (cmd_data->semi==EB_TRUE) semi_i=1; else semi_i=0; if (cmd_data->print_expr) { for (a=0;a<cmd_data->print_expr->list.list_len;a++) { struct expr_str *e; e=cmd_data->print_expr->list.list_val[a]; if (e->expr_type == ET_EXPR_WORDWRAP) { printc("{int _wordwrap;"); if (e->expr_str_u.expr_wordwrap->wrap_at->expr_type == ET_EXPR_LITERAL_LONG && e->expr_str_u.expr_wordwrap ->wrap_at->expr_str_u.expr_long == 0) { printc("_wordwrap=_rep.right_margin;"); } else { print_expr(e->expr_str_u.expr_wordwrap->wrap_at); printc("_wordwrap=A4GL_pop_int();"); } // We're not printing the WORDWRAP - we need to decode the // wordwrap and change our print accordingly... print_expr(e->expr_str_u.expr_wordwrap->expr); printc ("A4GL_%srep_print(&_rep,1,1,_wordwrap,%d);\n", generate_ispdf (),rep_print_entry++); printc("}"); } else { print_expr(e); printc ("A4GL_%srep_print(&_rep,1,1,%s,%d);\n", generate_ispdf (), wrap,rep_print_entry++); } } } printc ("A4GL_%srep_print(&_rep,0,%d,0,-1);\n", generate_ispdf (), cmd_data->semi==EB_TRUE); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_print_file_cmd(struct_print_file_cmd *cmd_data) { print_cmd_start (); printc("{"); printc("char *_r;"); print_expr(cmd_data->filename); printc("_r=A4GL_char_pop();"); printc ("%sA4GL_rep_file_print(&_rep,_r,%d);\n", generate_ispdf (), cmd_data->semi==EB_TRUE); printc("free(_r);"); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_print_img_cmd(struct_print_img_cmd *cmd_data) { print_cmd_start (); print_expr(cmd_data->scale_x); print_expr(cmd_data->scale_y); set_nonewlines(); printc ("A4GL_pdf_blob_print(&_rep,&"); print_variable_usage(cmd_data->var); printc(",\"%s\",%d);\n", cmd_data->img_type, cmd_data->semi==EB_TRUE); clr_nonewlines(); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_pause_cmd(struct_pause_cmd *cmd_data) { print_cmd_start (); printc("{"); printc("char *_r;"); print_expr(cmd_data->pause_msg); printc("_r=A4GL_char_pop();"); printc ("A4GL_pause(_r);\n"); printc("free(_r);"); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ /* SQL COMMANDS */ /* are in compile_c_sql.c AND compile_c_esqlc.c - depending on LEXTYPE */ /* being generated */ /******************************************************************************/ /*----------------------------------------------------------------------------*/ /* ADVANCED COMMANDS */ /*----------------------------------------------------------------------------*/ /******************************************************************************/ int print_alloc_arr_cmd (struct_alloc_arr_cmd * cmd_data) { struct variable_usage *u_bottom; struct variable_usage *u; struct expr_str **subs; int nsubs; char *ptr; //char *dim[5]; //struct expr_str *variable; print_cmd_start (); u=cmd_data->variable->expr_str_u.expr_variable_usage; u_bottom=u; while (u_bottom->next) { u_bottom = u_bottom->next; } nsubs=u_bottom->subscripts.subscripts_len; subs=u_bottom->subscripts.subscripts_val; u_bottom->subscripts.subscripts_len=0; u_bottom->subscripts.subscripts_val=0; ptr=generation_get_variable_usage_as_string(u); printc("{"); printc("int _d0=1;"); printc("int _d1=1;"); printc("int _d2=1;"); printc("int _d3=1;"); printc("int _d4=1;"); if(nsubs>=1) {print_expr(subs[0]);printc("_d0=A4GL_pop_long();");} if(nsubs>=2) {print_expr(subs[1]);printc("_d1=A4GL_pop_long();");} if(nsubs>=3) {print_expr(subs[2]);printc("_d2=A4GL_pop_long();");} if(nsubs>=4) {print_expr(subs[3]);printc("_d3=A4GL_pop_long();");} if(nsubs>=5) {print_expr(subs[4]);printc("_d4=A4GL_pop_long();");} printc ("%s=A4GL_alloc_dynarr(&%s,%s,_d0,_d1,_d2,_d3,_d4,(_d0*_d1*_d2*_d3*_d4) * sizeof(%s[0]),0);", ptr, ptr, ptr, ptr); printc("}"); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_dealloc_arr_cmd (struct_dealloc_arr_cmd * cmd_data) { struct variable_usage *u_bottom; struct variable_usage *u; //struct expr_str **subs; //int nsubs; char *ptr; //char *dim[5]; //struct expr_str *variable; print_cmd_start (); u=cmd_data->variable->expr_str_u.expr_variable_usage; u_bottom=u; while (u_bottom->next) { u_bottom = u_bottom->next; } ptr=generation_get_variable_usage_as_string(u); printc ("A4GL_dynarr_free(&%s,%s);", ptr,ptr); print_copy_status_not_sql (0); return 1; } /******************************************************************************/ int print_resize_arr_cmd (struct_resize_arr_cmd * cmd_data) { struct variable_usage *u_bottom; struct variable_usage *u; struct expr_str **subs; int nsubs; char *ptr; //char *dim[5]; //struct expr_str *variable; print_cmd_start (); u=cmd_data->variable->expr_str_u.expr_variable_usage; u_bottom=u; while (u_bottom->next) { u_bottom = u_bottom->next; } nsubs=u_bottom->subscripts.subscripts_len; subs=u_bottom->subscripts.subscripts_val; u_bottom->subscripts.subscripts_len=0; u_bottom->subscripts.subscripts_val=0; ptr=generation_get_variable_usage_as_string(u); printc("{"); printc("int _d0=1;"); printc("int _d1=1;"); printc("int _d2=1;"); printc("int _d3=1;"); printc("int _d4=1;"); if(nsubs>=1) {print_expr(subs[0]);printc("_d0=A4GL_pop_long();");} if(nsubs>=2) {print_expr(subs[1]);printc("_d1=A4GL_pop_long();");} if(nsubs>=3) {print_expr(subs[2]);printc("_d2=A4GL_pop_long();");} if(nsubs>=4) {print_expr(subs[3]);printc("_d3=A4GL_pop_long();");} if(nsubs>=5) {print_expr(subs[4]);printc("_d4=A4GL_pop_long();");} printc ("%s=A4GL_alloc_dynarr(&%s,%s,_d0,_d1,_d2,_d3,_d4,(_d0*_d1*_d2*_d3*_d4) * sizeof(%s[0]),1);", ptr, ptr, ptr, ptr); printc("}"); print_copy_status_not_sql (0); return 1; }
[ "nobody@ccff5c2d-aaaf-4f61-a5bd-d7f44fd75822" ]
nobody@ccff5c2d-aaaf-4f61-a5bd-d7f44fd75822
1c1a94c231e1a745f5c6d25f3d77acc57b825fd2
c2cedcf36667730f558ab354bea4505b616c90d2
/players/stark/druid/gob.c
92f33d22593b7cd35efb5b3095953b1bf122c80b
[]
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
4,184
c
#include "/players/stark/defs.h" #include "/players/stark/druid/defs.h" #include "/players/stark/druid/help.h" #include "/players/stark/druid/cmd/who.c" #include "/players/stark/druid/cmd/healing_rain.c" query_auto_load(){ save_object("players/stark/druid/player/"+TP->query_real_name()); return "/players/stark/druid/gob:"; } int baseglvl; int mana; int manalimit; int exp_weather; int exp_pet; int exp_aura; int exp_calls; int exp_vision; int exp_blessing; int exp_plague; int meditate_state; short() { return "A small stone"; } extra_look(){ return "~~Testing Guild~~"; } long(){ return write("Starks guild.\n\nd_help\nlist"); } id(string str) { return str == "stone"; } drop() { return 1; } get() { return 1; } reset(arg){ if(arg) return; } init(){ restore_object("players/stark/druid/player/"+TPRN); baseglvl=1; if(exp_plague>2 || exp_blessing>2 || exp_vision>2 || exp_calls>2 || exp_aura>2 || exp_weather>2){ baseglvl=2; } if(exp_plague>3 || exp_blessing>3 || exp_vision>3 || exp_calls>3 || exp_aura>3 || exp_weather>3){ baseglvl=3; } if(exp_plague>4 || exp_blessing>4 || exp_vision>4 || exp_calls>4 || exp_aura>4 || exp_weather>4){ baseglvl=4; } if(exp_plague>5 || exp_blessing>5 || exp_vision>5 || exp_calls>5 || exp_aura>5 || exp_weather>5){ baseglvl=5; } if(exp_plague>6 || exp_blessing>6 || exp_vision>6 || exp_calls>6 || exp_aura>6 || exp_weather>6){ baseglvl=6; } manalimit=baseglvl*150; add_action("list_int","list"); add_action("druid_help","d_help"); add_action("meditate","meditate"); add_action("sky_mana","s_mana"); add_action("light_of_sol","light_of_sol"); add_action("light_of_luna","light_of_luna"); add_action("wind_peace","winds_of_peace"); add_action("healing_rain","healing_r"); add_action("plague_one","plague_o"); add_action("call_faith","call_faith"); add_action("aura1","aura1"); add_action("aura2","aura2"); add_action("aura3","aura3"); add_action("aura4","aura4"); add_action("aura5","aura5"); add_action("aura6","aura6"); add_action("druid_who","dwho"); add_action("save_guild","save"); add_action("guild_tool","stark"); } list_int(){ write("baseglvl:"+baseglvl+" manalimit:"+manalimit+" mana:"+mana+" weather:"+exp_weather+" pet"+exp_pet+" aura:"+exp_aura+" calls:"+exp_calls+" vision:"+exp_vision+" blessing:"+exp_blessing+" plague:"+exp_plague+"\n"); return 1; } light_of_sol(){ int light_on; if(exp_weather){ if(light_on){ tell_object(USER,"Light of Sol off\n"); set_light(0); light_on=0; return 1; } else if(mana>39){ set_light(1); light_on=1; tell_object(USER,"Light of Sol on\n"); return 1; } else tell_object(USER,"You lack mana.\n"); } else tell_object(USER,"Your weather is too low\n"); return 1; } light_of_luna(){ int luna_on; if(exp_weather>1){ if(luna_on){ tell_object(USER,"Light of Luna off\n"); dark_sight_object(0); luna_on=0; return 1; } else if(mana>69){ dark_sight_object(1); luna_on=1; tell_object(USER,"Light of Luna on\n"); return 1; } else tell_object(USER,"You lack mana.\n"); } else tell_object(USER,"Your weather is too low\n"); return 1; } meditate(){ if(meditate_state){ meditate_state=0; write("You stop meditating\n"); return 1; } else if(USER->query_sp() < 50){ tell_object(USER,"You cannot concentrate\n"); return 1; } else /* Create object that stops all other cmds */ USER->add_sp(-50); meditate_state=1; write("you begin your meditations.\n"); manaloop(); return 1; } manaloop(){ if(!meditate_state){return 1;} if(USER->query_sp()<2 | USER->query_hp()<2 | mana>(manalimit-1)) { meditate_state=0; tell_object(USER,"You stop meditating\n"); return 1; } else USER->add_sp(-1); USER->add_hp(-1); add_mana(1); tell_object(USER,"mana convert\n"); call_out("manaloop",1); return 1; } add_mana(mi){mana=mana+mi;} add_exp_weather(wi){exp_weather+wi;} add_exp_pet(pi){exp_pet+pi;} add_exp_aura(ai){exp_aura+ai;} add_exp_calls(ci){exp_calls+ci;} add_exp_vision(vi){exp_vision+vi;} add_exp_blessing(bi){exp_blessing+bi;} add_exp_plague(pi){exp_plague+pi;} save_guild(){ save_object("players/stark/druid/player/"+TP->query_real_name()); write("Saving Druid GOB\n"); }
[ "rump.nirv@gmail.com" ]
rump.nirv@gmail.com
dd8f7b62f6f7d981598e254766107a627286cb4c
717fdec8101286724681f3d28ea70adee971321c
/shelper.c
ae106d73272d2a3a8c1ae95f895640e8b968e6ff
[]
no_license
kristianliscinsky/http_board
44d8560de2bfff7952e16e6caea071bf5d7a5a7a
f697bb3887527c6bd9146c722cea3ae21153d9ee
refs/heads/master
2022-11-11T05:49:26.733449
2020-07-06T02:36:04
2020-07-06T02:36:04
277,425,282
0
0
null
null
null
null
UTF-8
C
false
false
30,817
c
/** * ISA 2019 HTTP nastenka * Autro: Kristian Liscinsky * xlisci01 */ #include <stdio.h> #include <iostream> #include <string.h> #include <string> #include <bits/stdc++.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <list> #include <map> #include "shelper.h" //data structure for saving boards map <string, list <string>> zoznamNastenok; /** * Function for printing server help message */ void printHelpServer() { cout << "++----------------------------------------------------------------------------------------------++" << endl; cout << "++----------------------------------------------------------------------------------------------++" << endl; cout << "++ Launch server application ++" << endl; cout << "++----------------------------------------------------------------------------------------------++" << endl; cout << "++ ./isaserver -p <port> ++" << endl; cout << "++ server is listening to port number: <port> ++" << endl; cout << "++----------------------------------------------------------------------------------------------++" << endl; cout << "++----------------------------------------------------------------------------------------------++" << endl; } /******************************************************************************************************** * SENDIGN/READING DATA * * ******************************************************************************************************/ /** * Sending response to client */ void sendResponse(int socket, string response) { int read = 0; int length = response.size(); const char *data = response.data(); while (length > 0) { read = send(socket, data, length, 0); if (read < 0) { cerr << "Error while sending response to client" << endl; } data += read; length -= read; } } /** * Recieving data from cther side */ string recvMessage(int socket) { char buffer[ONE_CHAR + 1]; string result; //recieve header while(true) { memset(buffer, 0, ONE_CHAR + 1); int read = recv(socket, buffer, ONE_CHAR, 0); if (read == 0) break; //reading done if (read < 0) { cerr << "Error while reading header" << endl; break; } result += buffer; if (result.find("\r\n\r\n") != string::npos) break;//end of header } size_t delimitterPos; delimitterPos = result.find("\r\n\r\n"); //request contains \r\n\r\n if not, then we have whole request in result variable if (delimitterPos != string::npos) { string testContent = result.substr(0, delimitterPos); struct ParsedRequest testingRequest = parseHeaderAndRequestLine(testContent); //request contains Content-Length header an it is number (need to find out because stoi throw exception otherwise) if(!testingRequest.contentLength.empty() && is_number(testingRequest.contentLength)) { int contentLength = stoi(testingRequest.contentLength); char buffer[BUFFER_SIZE+1]; int total = 0; while (total < contentLength) { memset(buffer, 0, BUFFER_SIZE + 1); int read = recv(socket, buffer, BUFFER_SIZE, 0); if (!read) break;//reading done if (read < 0) { cerr << "Eror while reading content" << endl; break; } total += read; result += buffer; } //if request does not contain Content-Length header, we expect, there is no content } else { return result; } } return result; } /******************************************************************************************************** * PARSING SERVER ARGUMENTS * * ******************************************************************************************************/ /** * Parse argument of server * return port number if success * exit program is fail */ int parseArguments(int argc, char *argv[]) { if (argc == 2 && strcmp(argv[1], "-h") == 0) { printHelpServer(); exit(0); } else if (argc == 3 && strcmp(argv[1], "-p") == 0) { if (!is_number(argv[2])) { cerr << "Error: port is not a number" << endl; exit(-1); } int port = stoi(argv[2]); return port; } else { cerr << "Error, Wrong argument, try -h for help" << endl; exit(EXIT_FAILURE); } } /******************************************************************************************************** * CREATING HTTP RESPONSE * * ******************************************************************************************************/ /** * Create HTTP/1.1 response */ string createResponse(struct ResponseBuilder responseBuilder) { string response; response = "HTTP/1.1 " + to_string(responseBuilder.returnCode) + " " + responseBuilder.reasonPhrase + "\r\n"; char str[40]; time_t now = time(NULL); strftime(str, 40, "%a, %d %b %Y %H:%M:%S %Z", gmtime(&now)); string date = str; response += "Date: " + date + "\r\n"; response += "Content-Type: text/plain\r\n"; response += "Content-Length: " + to_string(responseBuilder.content.size()) + "\r\n"; response += "\r\n"; if (!responseBuilder.content.empty()) { response += responseBuilder.content; } return response; } /** * Add HTTP code to response according convention */ struct ResponseBuilder addReasonPhraseToResponse(struct ResponseBuilder responseBuilder) { if (responseBuilder.returnCode == 200) { responseBuilder.reasonPhrase = "OK"; return responseBuilder; } else if (responseBuilder.returnCode == 201) { responseBuilder.reasonPhrase = "Created"; return responseBuilder; } else if (responseBuilder.returnCode == 400) { responseBuilder.reasonPhrase = "Bad Request"; return responseBuilder; } else if (responseBuilder.returnCode == 404) { responseBuilder.reasonPhrase = "Not Found"; return responseBuilder; } else if (responseBuilder.returnCode == 409) { responseBuilder.reasonPhrase = "Conflict"; return responseBuilder; } else { return responseBuilder; } } /******************************************************************************************************** * HANDLING WITH BOARDS * * ******************************************************************************************************/ /** * GET method to get all available boards */ struct ResponseBuilder boards() { struct ResponseBuilder responseBuilder; if (zoznamNastenok.empty()){ responseBuilder.returnCode = 200; responseBuilder.content = ""; return responseBuilder; } for (auto i : zoznamNastenok) { responseBuilder.content += i.first + '\n'; } int lastIndex = responseBuilder.content.length() - 1; char lastChar = responseBuilder.content[lastIndex]; if (lastChar == '\n') { responseBuilder.content = responseBuilder.content.substr(0, responseBuilder.content.length() - 1); } responseBuilder.returnCode = 200; return responseBuilder; } /** * GET method for get content of board <name> */ struct ResponseBuilder board_list(string name) { struct ResponseBuilder responseBuilder; string content; map <string, list<string>>::iterator it; //if board <name> does not exist it = zoznamNastenok.find(name); if (it == zoznamNastenok.end()) { responseBuilder.returnCode = 404; responseBuilder.content = "Board named " + name + " does not exist"; return responseBuilder; } //if board is empty if (zoznamNastenok.find(name)->second.empty()) { responseBuilder.returnCode = 200; responseBuilder.content = ""; return responseBuilder; } int place = 1; for (auto i : zoznamNastenok.find(name)->second) { content += to_string(place) + ". " + i + '\n'; place++; } int lastIndex = content.length() - 1; char lastChar = content[lastIndex]; if (lastChar == '\n') { content = content.substr(0, content.length() - 1); } responseBuilder.returnCode = 200; responseBuilder.content = content; return responseBuilder; } /** * POST method for creat new board */ struct ResponseBuilder board_add(string name) { struct ResponseBuilder responseBuilder; list <string> newList; //if board with name <name> already exists if(zoznamNastenok.find(name) != zoznamNastenok.end()) { responseBuilder.returnCode = 409; responseBuilder.content = "Board named " + name + " already exists"; return responseBuilder; } zoznamNastenok.insert(pair<string, list<string>>(name, newList)); responseBuilder.returnCode = 201; responseBuilder.content = "Board " + name + " has been added"; return responseBuilder; } /** * POST method for add content to existing board */ struct ResponseBuilder item_add(string name, string content) { struct ResponseBuilder responseBuilder; //if board with name <name> does not exist if(zoznamNastenok.find(name) == zoznamNastenok.end()) { responseBuilder.returnCode = 404; responseBuilder.content = "Board named " + name + " does not exist"; return responseBuilder; } //no content if (content.empty()) { responseBuilder.returnCode = 400; responseBuilder.content = "Trying to add empty content"; return responseBuilder; } zoznamNastenok.find(name)->second.push_back(content); responseBuilder.returnCode = 201; responseBuilder.content = "Item has been added to the board " + name; return responseBuilder; } /** * PUT method for update content of board */ struct ResponseBuilder item_update(string name, string id, string content) { struct ResponseBuilder responseBuilder; if (!is_number(id)) { responseBuilder.returnCode = 404; responseBuilder.content = "Item with ID " + id + " does not exist in board " + name; return responseBuilder; } unsigned long idPrispevku = stoul(id); //if board with name <name> does not exist if(zoznamNastenok.find(name) == zoznamNastenok.end()) { responseBuilder.returnCode = 404; responseBuilder.content = "Board named " + name + " does not exist"; return responseBuilder; } //if item with id <id> does not exist if(zoznamNastenok.find(name)->second.size() < idPrispevku) { responseBuilder.returnCode = 404; responseBuilder.content = "Item with ID " + id + " does not exist in board " + name; return responseBuilder; } //no content if (content.empty()) { responseBuilder.returnCode = 400; responseBuilder.content = "Trying to update with empty content"; return responseBuilder; } //updating list<string>::iterator it = zoznamNastenok.find(name)->second.begin(); advance(it, idPrispevku - 1); it = zoznamNastenok.find(name)->second.erase(it); zoznamNastenok.find(name)->second.insert(it, content); responseBuilder.returnCode = 200; responseBuilder.content = "Item with ID " + id + " in board " + name + " has been changed"; return responseBuilder; } /** * DELETE method for deleting board with name <name> */ struct ResponseBuilder board_delete(string name) { struct ResponseBuilder responseBuilder; //if board with name <name> does not exist if (zoznamNastenok.find(name) == zoznamNastenok.end()) { responseBuilder.returnCode = 404; responseBuilder.content = "Board named " + name + " does not exist"; return responseBuilder; } map<string, list<string>>::iterator it; it = zoznamNastenok.find(name); zoznamNastenok.erase(it); responseBuilder.returnCode = 200; responseBuilder.content = "Board " + name + " has been deleted"; return responseBuilder; } /** * DELETE method for deleting item from board */ struct ResponseBuilder item_delete(string name, string id) { struct ResponseBuilder responseBuilder; if (!is_number(id)) { responseBuilder.returnCode = 404; responseBuilder.content = "Item with ID " + id + " does not exist in board " + name; return responseBuilder; } unsigned long idPrispevku = stoul(id); //if board with name <name> does not exist if (zoznamNastenok.find(name) == zoznamNastenok.end()) { responseBuilder.returnCode = 404; responseBuilder.content = "Board named " + name + " does not exist"; return responseBuilder; } //if item with id <id> does not exist if (zoznamNastenok.find(name)->second.size() < idPrispevku) { responseBuilder.returnCode = 404; responseBuilder.content = "Item with ID " + id + " does not exist in board " + name; return responseBuilder; } list<string>::iterator it = zoznamNastenok.find(name)->second.begin(); advance(it, idPrispevku - 1); zoznamNastenok.find(name)->second.erase(it); responseBuilder.returnCode = 200; responseBuilder.content = "Item with ID " + id + " has been deleted from board " + name; return responseBuilder; } /** * Find out if string is a number */ bool is_number(const std::string& s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end(); } /******************************************************************************************************** * PARSING REQUEST * * ******************************************************************************************************/ /** * Function for parsing request and processing information from request */ struct ResponseBuilder processRequest(struct ParsedRequest parsedRequest) { struct ResponseBuilder responseBuilder; if (parsedRequest.command == "GET") { struct UrlParse url = parseGETUrl(parsedRequest.url); if (url.isUrlOk) { if (url.board == "boards") { responseBuilder = boards(); return responseBuilder; } else if (url.board == "board") { responseBuilder = board_list(url.name); return responseBuilder; } else { responseBuilder.returnCode = 404; responseBuilder.content = "Url in request is unknown"; return responseBuilder; } } else { responseBuilder.returnCode = 404; responseBuilder.content = "Not found"; return responseBuilder; } } else if (parsedRequest.command == "POST") { struct UrlParse url = parsePOSTUrl(parsedRequest.url); if (url.isUrlOk) { if (url.board == "boards") { responseBuilder = board_add(url.name); return responseBuilder; } else if (url.board == "board") { //PUT or POST above item which has content-length = 0 returns 400 if (parsedRequest.content.empty()) { responseBuilder.returnCode = 400; responseBuilder.content = "Trying to add empty content"; return responseBuilder; } responseBuilder = item_add(url.name, parsedRequest.content); return responseBuilder; } else { responseBuilder.returnCode = 404; responseBuilder.content = "Url in request is unknown"; return responseBuilder; } } else { responseBuilder.returnCode = 404; responseBuilder.content = "Not found"; return responseBuilder; } } else if (parsedRequest.command == "DELETE") { struct UrlParse url = parseDELETEUrl(parsedRequest.url); if (url.isUrlOk) { if (url.board == "boards") { responseBuilder = board_delete(url.name); return responseBuilder; } else if (url.board == "board") { responseBuilder = item_delete(url.name, url.id); return responseBuilder; } else { responseBuilder.returnCode = 404; responseBuilder.content = "Url in request is unknown"; return responseBuilder; } } else { responseBuilder.returnCode = 404; responseBuilder.content = "Not found"; return responseBuilder; } } else if (parsedRequest.command == "PUT") { struct UrlParse url = parsePUTUrl(parsedRequest.url); if (url.isUrlOk) { ///PUT or POST above item which has content-length = 0 returns 400 if (parsedRequest.content.empty()) { responseBuilder.returnCode = 400; responseBuilder.content = "Trying to update with empty content"; return responseBuilder; } responseBuilder = item_update(url.name, url.id, parsedRequest.content); return responseBuilder; } else { responseBuilder.returnCode = 404; responseBuilder.content = "Not found"; return responseBuilder; } } else { responseBuilder.returnCode = 404; responseBuilder.content = "Not found"; return responseBuilder; } } /******************************************************************************************************** * PARSING URL FROM REQUEST * * ******************************************************************************************************/ /** * Parse url if command is GET */ struct UrlParse parseGETUrl(string url) { struct UrlParse urlStruct; //cant contains 1 or 2 slashes int slashOccurs = count(url.begin(), url.end(), '/'); if (slashOccurs != 1 && slashOccurs != 2) { urlStruct.isUrlOk = false; return urlStruct; } if (url == "/boards") { urlStruct.board = "boards"; return urlStruct; } else if (url.substr(0, 7) == "/board/") { string name = url.substr(7, url.length() - 1); //maybe it will be good to check, that name has not slash (it is forbidden) urlStruct.board = "board"; urlStruct.name = name; return urlStruct; } else { urlStruct.isUrlOk = false; return urlStruct; } } /** * Parse url if command is POST */ struct UrlParse parsePOSTUrl(string url) { struct UrlParse urlStruct; //must contains 2 slashes size_t slashOccurs = count(url.begin(), url.end(), '/'); if (slashOccurs != 2) { urlStruct.isUrlOk = false; return urlStruct; } if (url.substr(0, 8) == "/boards/") { string name = url.substr(8, url.length() - 1); //maybe it will be good to check, that name has not slash (it is forbidden) urlStruct.board = "boards"; urlStruct.name = name; return urlStruct; } else if (url.substr(0, 7) == "/board/") { string name = url.substr(7, url.length() - 1); urlStruct.board = "board"; urlStruct.name = name; return urlStruct; } else { urlStruct.isUrlOk = false; return urlStruct; } } /** * Parse url if command is DELETE */ struct UrlParse parseDELETEUrl(string url) { struct UrlParse urlStruct; //can have 2 or 3 slashes size_t slashOccurs = count(url.begin(), url.end(), '/'); if (slashOccurs != 2 && slashOccurs != 3) { urlStruct.isUrlOk = false; return urlStruct; } if (url.substr(0, 8) == "/boards/") { string name = url.substr(8, url.length() - 1); //maybe it will be good to check, that name has not slash (it is forbidden) urlStruct.board = "boards"; urlStruct.name = name; return urlStruct; } else if (url.substr(0, 7) == "/board/") { string zvysok = url.substr(7, url.length() - 1); size_t found = zvysok.find('/'); if (found != string::npos) { //til 1st slash urlStruct.name = zvysok.substr(0, found); //after 1st slash til end urlStruct.id = zvysok.substr(found + 1, zvysok.length() - 1); urlStruct.board = "board"; return urlStruct; } else { urlStruct.isUrlOk = false; return urlStruct; } } else { urlStruct.isUrlOk = false; return urlStruct; } } /** * Parse url if command is PUT */ struct UrlParse parsePUTUrl(string url) { struct UrlParse urlStruct; //must have 3 slashes size_t slashOccurs = count(url.begin(), url.end(), '/'); if (slashOccurs != 3) { urlStruct.isUrlOk = false; return urlStruct; } if (url.substr(0, 7) == "/board/") { string zvysok = url.substr(7, url.length() - 1); size_t found = zvysok.find('/'); if (found != string::npos) { //til 1st slash urlStruct.name = zvysok.substr(0, found); //after 1st slash til end urlStruct.id = zvysok.substr(found + 1, zvysok.length() - 1); urlStruct.board = "board"; return urlStruct; } else { urlStruct.isUrlOk = false; return urlStruct; } } else { urlStruct.isUrlOk = false; return urlStruct; } } /******************************************************************************************************** * PARSING REQUEST FROM CLIENT * * ******************************************************************************************************/ /** * Function for parsing whole request */ struct ParsedRequest parseWholeRequest(string request) { struct ParsedRequest parsedRequest; struct ParsedRequest headerAndRQLine; vector <string> bodyAndHead = bodyHeaderDelimiter(request); if (bodyAndHead.size() != 2) { //cerr << "Bad request from client" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } headerAndRQLine = parseHeaderAndRequestLine(bodyAndHead[0]); if (!headerAndRQLine.isRequestOk) { //cerr << "Bad request from client" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { parsedRequest.command = headerAndRQLine.command; parsedRequest.url = headerAndRQLine.url; parsedRequest.version = headerAndRQLine.version; parsedRequest.host = headerAndRQLine.host; parsedRequest.accept = headerAndRQLine.accept; parsedRequest.contentType = headerAndRQLine.contentType; parsedRequest.contentLength = headerAndRQLine.contentLength; } parsedRequest.content = bodyAndHead[1]; return parsedRequest; } /* * Function returns 2 strings (header and body) * In case of bad request, return one empty string */ vector <string> bodyHeaderDelimiter(string request) { size_t position; size_t requestLength = request.length(); vector <string> result; if (request.empty()) { //cerr << "Bad request, request is empty"; result.clear(); return result; } if ((position = request.find(MAIN_DELIMITER)) == string::npos) { //cerr << "Bad HTTP request from client" << endl; result.clear(); return result; } result.push_back(request.substr(0, position)); result.push_back(request.substr(position + strlen(MAIN_DELIMITER), requestLength- 1)); return result; } /** * Function for parsing Header and Request Line of request */ struct ParsedRequest parseHeaderAndRequestLine(string headerAndRQLine) { struct ParsedRequest parsedRequest; //string can not be empty if (headerAndRQLine.empty()) { //cerr << "Bad request, missing request line and header" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } vector <string> requestLineAndHeader = customGetLines(headerAndRQLine); //if Request has not headers if (requestLineAndHeader.size() == 1) { string requestLine = requestLineAndHeader[0]; requestLine.push_back('\r'); parsedRequest = parseRequestLine(requestLine); if (!parsedRequest.isRequestOk) { //cerr << "Bad request from client, invalid request line" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { return parsedRequest; } } //if there is any header, size must be greater than 2 (request line + header) //other wise it end with exception, becasue we are accessing second element of requestLineAndHeader if (requestLineAndHeader.size() < 2) { //cerr << "Bad request from client, minimum requires are Request Line and Host" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //processing request line (1st line of request) string requestLine = requestLineAndHeader[0]; if (requestLine.empty()){ //cerr << "Bad request from client, missing request line" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { struct ParsedRequest auxiliaryStruct = parseRequestLine(requestLine); if (!auxiliaryStruct.isRequestOk) { //cerr << "Bad request from client, invalid request line" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { parsedRequest.command = auxiliaryStruct.command; parsedRequest.url = auxiliaryStruct.url; parsedRequest.version = auxiliaryStruct.version; } } //last line of header is processing separate for (size_t i = 1; i < requestLineAndHeader.size() - 1; i++) { string header = requestLineAndHeader[i]; if (header.empty()) { //cerr << "Bad request from client, missing mandatory header host" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { struct ParsedRequest auxiliaryStruct = parseHeaderWithCRControl(header); if (!auxiliaryStruct.isRequestOk) { //cerr << "Bad request from client, invalid header" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { if (auxiliaryStruct.host != "") { parsedRequest.host = auxiliaryStruct.host; } else if (auxiliaryStruct.accept != ""){ parsedRequest.accept = auxiliaryStruct.accept; } else if (auxiliaryStruct.contentType != ""){ parsedRequest.contentType = auxiliaryStruct.contentType; } else if (auxiliaryStruct.contentLength != "") { parsedRequest.contentLength = auxiliaryStruct.contentLength; } } } } //in most header can be only one space (SP), but there are headers also with more spaces, for instance Date header //so it will be probably better without it /* if (count(requestLineAndHeader[requestLineAndHeader.size() - 1].begin(), requestLineAndHeader[requestLineAndHeader.size() - 1].end(), ' ') != 1) { //cerr << "Bad request, Header is invalid (contains more than 1 spaces)" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } */ struct ParsedRequest auxStructForLast = parseHeadersLines(requestLineAndHeader[requestLineAndHeader.size() - 1]); if (!auxStructForLast.isRequestOk) { //cerr << "Bad request" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //save required headers if (auxStructForLast.host != "") { parsedRequest.host = auxStructForLast.host; } else if (auxStructForLast.accept != ""){ parsedRequest.accept = auxStructForLast.accept; } else if (auxStructForLast.contentType != ""){ parsedRequest.contentType = auxStructForLast.contentType; } else if (auxStructForLast.contentLength != "") { parsedRequest.contentLength = auxStructForLast.contentLength; } return parsedRequest; } /** * Function for parsing headers, which end with \r character */ struct ParsedRequest parseHeaderWithCRControl(string header) { struct ParsedRequest parsedRequest; //header can not be empty if (header.empty()) { //cerr << "Bad request, header is empty" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //have to end with CR character if (header.at(header.length() - 1) != '\r'){ //cerr << "Bad request, No CR in header" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //remove CR for better handling header.erase(header.size() - 1); //only one space can be in header (SP character) /* if (count(header.begin(), header.end(), ' ') != 1) { //cerr << "Bad request, Header is invalid (contains more than 1 spaces)" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } */ //parsing line struct ParsedRequest auxiliaryStruct = parseHeadersLines(header); if (!auxiliaryStruct.isRequestOk) { //cerr << "Bad request" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //save required headers if (!auxiliaryStruct.host.empty()) { parsedRequest.host = auxiliaryStruct.host; } else if (!auxiliaryStruct.accept.empty()){ parsedRequest.accept = auxiliaryStruct.accept; } else if (!auxiliaryStruct.contentType.empty()){ parsedRequest.contentType = auxiliaryStruct.contentType; } else if (!auxiliaryStruct.contentLength.empty()) { parsedRequest.contentLength = auxiliaryStruct.contentLength; } return parsedRequest; } /* * Get one line of header * Split line according string ": " * return structure ParsedRequest with filled header * filled only selected headers **/ struct ParsedRequest parseHeadersLines(string headerLine){ struct ParsedRequest parsedRequest; //headers line can not be empty if (headerLine.empty()) { //cerr << "Bad request, header is empty" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } vector <string> parts; size_t position; if ((position = headerLine.find(": ")) == string::npos) { //cerr << "Bad HTTP request from client, bad structure of header" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } size_t headerLineLength = headerLine.length(); parts.push_back(headerLine.substr(0, position)); parts.push_back(headerLine.substr(position + 2, headerLineLength - 1)); //header must have name and value if (parts[0].empty() || parts[1].empty()) { //cerr << "Bad HTTP request from client, bad structure of header" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } if (parts[0].compare("Host") == 0) { parsedRequest.host = parts[1]; return parsedRequest; } else if (parts[0].compare("Accept") == 0) { parsedRequest.accept = parts[1]; return parsedRequest; } else if (parts[0].compare("Content-Type") == 0) { parsedRequest.contentType = parts[1]; return parsedRequest; } else if (parts[0].compare("Content-Length") == 0) { parsedRequest.contentLength = parts[1]; return parsedRequest; } else { return parsedRequest; } } /** * Function for parsing request line (first line of request) */ struct ParsedRequest parseRequestLine(string requestLine) { struct ParsedRequest parsedRequest; //can not be empty if (requestLine.empty()) { //cerr << "Bad request, Request Line is empty" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //must end with character CR if (requestLine.at(requestLine.length() - 1) != '\r'){ //cerr << "Bad request, No CR in request line" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } //can contains only 2 spaces int spaceOccurs = count(requestLine.begin(), requestLine.end(), ' '); if (spaceOccurs != 2) { parsedRequest.isRequestOk = false; return parsedRequest; } //delete CR character for better handling with string requestLine.erase(requestLine.size() - 1); vector <string> parts; stringstream stream(requestLine); string buffer; //empty string while(getline(stream, buffer, ' ')) { parts.push_back(buffer); buffer.clear(); } if (parts.size() != 3) { //cerr << "Bad request, Not all items in request line" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } string command, url, version; command = parts[0]; url = parts[1]; version = parts[2]; //check, if version is ok if (version.compare("HTTP/1.1") != 0) { //cerr << "Bad request, version is not match with HTTP/1.1" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } else { parsedRequest.version = version; } parsedRequest.url = url; if (command.compare("GET") == 0) { parsedRequest.command = command; return parsedRequest; } else if (command.compare("POST") == 0) { parsedRequest.command = command; return parsedRequest; } else if (command.compare("PUT") == 0) { parsedRequest.command = command; return parsedRequest; } else if (command.compare("DELETE") == 0) { parsedRequest.command = command; return parsedRequest; } else { //cerr << "Bad request, command is wrong" << endl; parsedRequest.isRequestOk = false; return parsedRequest; } } /* * Split string accoring new line character * Return vecor of strings */ vector <string> customGetLines(string request) { stringstream stream(request); vector <string> result; string buffer; //this creates empty string while(getline(stream, buffer, '\n')) { result.push_back(buffer); buffer.clear(); } return result; }
[ "kristian.liscinsky@gmail.com" ]
kristian.liscinsky@gmail.com
d585b9c8d9cd1e6b652ad8a104e6ec46edf8e2ff
4c88b25f075c489d17f94705b257edf7f52232a4
/C/QuotientRemainder.c
b13adb22d0770e9a93405f488ab474e07b9d6ef8
[]
no_license
mrhimanshukrsingh/Himanshu
19347af7e8ca1461c478fbcae8f8bb132085019b
3c28ce2712d544c7fb7bfc71cd45b6fb4cddf1ad
refs/heads/main
2023-06-09T23:20:55.172755
2021-07-07T11:41:14
2021-07-07T11:41:14
361,934,607
0
0
null
null
null
null
UTF-8
C
false
false
252
c
#include<stdio.h> int main() { int n1, n2, q, r; printf("Enter the first number:"); scanf("%d",&n1); printf("Enter the second number:"); scanf("%d",&n2); q=n1/n2; r=n1%n2; printf("Quotient: %d\n",q); printf("Remainder: %d\n" ,r); return 0; }
[ "mrhimanshukrsinsh@gmail.com" ]
mrhimanshukrsinsh@gmail.com
8b6493d4dec29a525eb875400d6a35263bac4918
4be6e569e449a394380fece760f8d6811bd59321
/28_arrays_loops.c
8c7310573a50998ba3fc1febbb7a2b8c77b0d486
[]
no_license
isabelyb/structured_programming
ce902038fda563fa212cf191a54ff058e4a4ae35
3fc1302eaecf384a420fae80f9db486f16791fdd
refs/heads/master
2022-12-17T04:50:59.698418
2020-09-26T17:22:36
2020-09-26T17:22:36
null
0
0
null
null
null
null
UTF-8
C
false
false
250
c
#include <stdio.h> #include <stdlib.h> int main() { printf("Arreglos e iteradores\n"); int integerArray[11]; for(int i = 0; i < 11; i++) { integerArray[i] = i * i; printf("Valor (%i): %i \n", i, integerArray[i]); } return 0; }
[ "noreply@github.com" ]
isabelyb.noreply@github.com
51b156fea4b1a61e18dcd10421179371e3bab400
b72830060331b594191dec76bed1ee12836db02e
/SJDExample/Code/8_Example/SJDApplicationFeatureWsp/JDPrdAppModelerFrm/ImportedInterfaces/intel_a/CATIPrtPart.h
03c6f8f30827131ac574356086b6d8f3eb6e7e6f
[]
no_license
Locke-Shi/CAAV5
287ed8349774ebd14c891534474e17acaf77cfe5
58001200081c58521ca05082a37b714e2c16c369
refs/heads/master
2023-03-05T07:14:53.849566
2021-02-20T02:45:57
2021-02-20T02:45:57
318,120,847
2
2
null
null
null
null
UTF-8
C
false
false
72
h
#include "D:\DS\B19\.\MecModInterfaces\PublicInterfaces\CATIPrtPart.h"
[ "think@DESKTOP-3CGJJ0U" ]
think@DESKTOP-3CGJJ0U
de5332a212aba894dc7c9fc581254a7e8bb2c733
1e35a577d780421082f827762f2cf72202ec0a94
/libs/libft/ft_lstnew.c
366f6bd92f490f1c883fb37ff058f9f5965d8123
[]
no_license
jwon42/42cursus_07_cub3d
b9ae780d60b806d7fb239e76de0a0a0386cf098c
017ba990cb7ed2403d7542338c45e8a773eb8444
refs/heads/master
2023-01-23T07:21:04.375776
2020-09-16T11:52:13
2020-11-17T11:11:52
313,260,347
3
1
null
null
null
null
UTF-8
C
false
false
1,088
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jwon <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/06 14:55:53 by jwon #+# #+# */ /* Updated: 2020/04/10 22:18:15 by jwon ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_list *ft_lstnew(void *content) { t_list *new; if (!(new = (t_list *)malloc(sizeof(t_list)))) return (NULL); new->content = content; new->next = NULL; return (new); }
[ "jwon@c2r8s1.42seoul.kr" ]
jwon@c2r8s1.42seoul.kr
38492a7254b03c0624bf792baada63a2c822fbec
82958982759b2b69091ab7d14299ca0b8cce5892
/APP/Display.h
adb3800a91e4cac6e146cf524bd6e770e3d9622e
[]
no_license
Mohamed-Eltyar/SmartHome
f36166d2d1c2aa89b417d51461371cecd890caa0
365aef925eeb16b4dad937f7d2059589c9baf33d
refs/heads/master
2022-12-13T08:11:51.384318
2020-08-28T04:17:04
2020-08-28T04:17:04
280,859,951
0
2
null
null
null
null
UTF-8
C
false
false
252
h
/* * Display.h * * Created on: Jul 21, 2020 * Author: PiLoT */ #ifndef SMARTHOME_APP_DISPLAY_H_ #define SMARTHOME_APP_DISPLAY_H_ void Position_Cursor(u8 LOC_u8ROW,u8 LOC_u8COL); void Display(void); #endif /* SMARTHOME_APP_DISPLAY_H_ */
[ "63203041+Mohamed-Eltyar@users.noreply.github.com" ]
63203041+Mohamed-Eltyar@users.noreply.github.com
bb5f63e5376d864a1b87eaa2cfdbe13992904201
4c56d0ea96b3c01dbfe53d92c4eb04a68142ce61
/Practical/P5Q6/P5Q6/P5Q6.c
95b049ceefdb934588bbe360d10d3dfcf4c97ae9
[]
no_license
Ooiyenchun/C-
80e5d0ef40e095e1814f8b22bfa8ab823f8d981a
ddce680a26aab58162701d10c514fa62f34f919f
refs/heads/master
2020-03-22T00:01:07.080119
2018-11-16T13:44:52
2018-11-16T13:44:52
139,219,500
0
0
null
null
null
null
UTF-8
C
false
false
711
c
/* Program Name : P5Q6 Name : Ooi Yen Chun Date : 25-6-2018 */ #include<stdlib.h> #include<stdio.h> #pragma warning(disable:4996) void myName(); void myAddress(); void nameCard(); char name1[30]; char address1[30], address2[30], address3[30]; void main() { myName(); myAddress(); nameCard(); system("pause"); } void myName() { printf("Enter your name : "); scanf("%[^\n]", &name1); rewind(stdin); } void myAddress() { printf("Enter your address in 3 row : \n"); scanf("%[^\n]",&address1); rewind(stdin); scanf("%[^\n]", &address2); rewind(stdin); scanf("%[^\n]", &address3); } void nameCard() { printf("\n\n\n%s\n\n%s\n%s\n%s\n\n\n", name1, address1,address2,address3); }
[ "33864420+Ooiyenchun@users.noreply.github.com" ]
33864420+Ooiyenchun@users.noreply.github.com
1d80270423ab4077999b04c0c63bc97d0362b9b5
c8bf36e69b6a4d5695184f470140f9f5203e5ff4
/PSoC Workspace/Controls.cydsn/Generated_Source/PSoC5/Enter_SW_aliases.h
fecee3c1dd0fd211b66ef4e631a088b880d260b2
[]
no_license
isengard412/freeDSP_6CHamp
c808f0ca6cc03d9d458bbb1f9afc02201646d149
8e8ed6edd4d7c3b882cacddc67767e3a8e805f39
refs/heads/master
2020-04-02T05:44:25.038093
2017-01-22T18:19:25
2017-01-22T18:19:25
62,238,750
0
0
null
null
null
null
UTF-8
C
false
false
1,267
h
/******************************************************************************* * File Name: Enter_SW.h * Version 2.20 * * Description: * This file contains the Alias definitions for Per-Pin APIs in cypins.h. * Information on using these APIs can be found in the System Reference Guide. * * Note: * ******************************************************************************** * Copyright 2008-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. *******************************************************************************/ #if !defined(CY_PINS_Enter_SW_ALIASES_H) /* Pins Enter_SW_ALIASES_H */ #define CY_PINS_Enter_SW_ALIASES_H #include "cytypes.h" #include "cyfitter.h" /*************************************** * Constants ***************************************/ #define Enter_SW_0 (Enter_SW__0__PC) #define Enter_SW_0_INTR ((uint16)((uint16)0x0001u << Enter_SW__0__SHIFT)) #define Enter_SW_INTR_ALL ((uint16)(Enter_SW_0_INTR)) #endif /* End Pins Enter_SW_ALIASES_H */ /* [] END OF FILE */
[ "lukas.creutzburg@gmail.com" ]
lukas.creutzburg@gmail.com
003ecdd7c30e77834cbf40887e057586c41a8d16
f88abdd8da576d9bcb88ca2062b98ca810b754c4
/include/mapinls.h
c89f58f93a2b5d6e2939d89c89c145860770e226
[]
no_license
tagillov/x86_64-w64-mingw32
a38ec3d5cf39a3f0ee544c3b178fa26d88107139
fab0778eb5fc34cdab273b99e4a0c8a326e04f31
refs/heads/master
2020-04-07T14:21:52.127685
2014-08-14T23:44:01
2014-08-14T23:44:01
158,444,027
0
0
null
2018-11-20T19:57:42
2018-11-20T19:57:42
null
UTF-8
C
false
false
39
h
../../share/mingw-w64/include/mapinls.h
[ "elombrozo@gmail.com" ]
elombrozo@gmail.com
2164243820a15374b843ef6ebcc7bf1afd31bba0
b224f655c17c0f359fd5b1d5bcd54d40edb2f913
/DataStructure/Maze/source_mac_osx_xcode_7_3_1/11/11_02/linkedlist.c
5e1e5a32cfee8069a87e72b4b1e949d03ac953ea
[]
no_license
2quokka/Study
9a7608c242b081acbe459736496d4dae55377776
359b3e388736665d9b8342db82df3adbef6f8216
refs/heads/master
2023-03-31T08:43:45.376405
2021-04-10T04:03:24
2021-04-10T04:03:24
93,051,194
1
0
null
null
null
null
UTF-8
C
false
false
1,920
c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "linkedlist.h" LinkedList *createLinkedList() { LinkedList *pReturn = (LinkedList *)malloc(sizeof(LinkedList)); memset(pReturn, 0, sizeof(LinkedList)); return pReturn; } int getLinkedListData(LinkedList* pList, int position) { int i = 0; LinkedListNode *pCurrentNode = &(pList->headerNode); for (i = 0; i <= position; i++) { pCurrentNode = pCurrentNode->pLink; } return pCurrentNode->data; } int addLinkedListData(LinkedList* pList, int position, int data) { int i = 0; LinkedListNode *pNewNode = NULL; LinkedListNode *pPreNode = NULL; pNewNode = (LinkedListNode*)malloc(sizeof(LinkedListNode)); pNewNode->data = data; pPreNode = &(pList->headerNode); for (i = 0; i < position; i++) { pPreNode = pPreNode->pLink; } pNewNode->pLink = pPreNode->pLink; pPreNode->pLink = pNewNode; pList->currentCount++; return 1; } int removeLinkedListData(LinkedList* pList, int position) { int i = 0; LinkedListNode *pDelNode = NULL; LinkedListNode *pPreNode = NULL; pPreNode = &(pList->headerNode); for (i = 0; i < position; i++) { pPreNode = pPreNode->pLink; } pDelNode = pPreNode->pLink; pPreNode->pLink = pDelNode->pLink; free(pDelNode); pList->currentCount--; return 1; } void deleteLinkedList(LinkedList* pList) { LinkedListNode *pDelNode = NULL; LinkedListNode *pPreNode = pList->headerNode.pLink; while(pPreNode != NULL) { pDelNode = pPreNode; pPreNode = pPreNode->pLink; free(pDelNode); } free(pList); } int getLinkedListLength(LinkedList* pList) { if (NULL != pList) { return pList->currentCount; } return 0; }
[ "lsc8772@naver.com" ]
lsc8772@naver.com
905b6b3308f3cf8e38f789097006272fd3e34c69
3ba8b4e7944f62e0b0e9245655e2c42afd51d8c4
/syscalls.c
8524e76998e8cdd70cc3e1a17c1bca7846fe3ec7
[ "BSD-3-Clause" ]
permissive
cirosantilli2/gem5-bare-metal-examples
f6043f5400ad3b3b3f3640e8ec7c089faae1ca6b
b89461a63794d8b481fa93883688e4b023e6ba46
refs/heads/master
2020-03-21T10:39:43.517046
2019-09-20T00:00:00
2019-09-20T08:34:39
138,463,861
0
0
null
null
null
null
UTF-8
C
false
false
1,433
c
#include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #define UNUSED __attribute__((unused)) volatile unsigned int *const UART0DR = (unsigned int *)0x10009000; register char *stack_ptr __asm ("sp"); /* TODO defined in some header? */ struct _reent; int _read_r(UNUSED struct _reent *r, UNUSED int file, UNUSED char *ptr, UNUSED int len) { errno = EINVAL; return -1; } int _lseek_r(UNUSED struct _reent *r, UNUSED int file, UNUSED int ptr, UNUSED int dir) { return 0; } void gem5_print(const char *s) { while (*s != '\0') { *UART0DR = (unsigned int)(*s); s++; } } int _write_r(UNUSED struct _reent *r, UNUSED int file, char *ptr, int len) { gem5_print(ptr); return len; } int _close_r (struct _reent *r, int file) { return 0; } caddr_t _sbrk_r(struct _reent *r, int incr) { extern char end __asm__ ("end"); static char *heap_end; char *prev_heap_end; if (heap_end == NULL) heap_end = & end; prev_heap_end = heap_end; if (heap_end + incr > stack_ptr) { errno = ENOMEM; return (caddr_t) -1; } heap_end += incr; return (caddr_t) prev_heap_end; } int _fstat_r(UNUSED struct _reent *r, UNUSED int file, struct stat *st) { memset(st, 0, sizeof (*st)); st->st_mode = S_IFCHR; return 0; } int _isatty_r(UNUSED struct _reent *r, UNUSED int fd) { return 1; }
[ "cirosantilli@outlook.com" ]
cirosantilli@outlook.com
50bfa94957c4af69d69227b7de2171bbb98dfacf
208f64052da638d3321dda37253297bb89ccaa34
/H-ound/Constants.h
d22dbae9b25bdc33914e68635443aa4f8f3b8d80
[]
no_license
mcomisso/F-ART
83ea571359b52db776ce6424574ff3668b351d7c
66a81d5e45eac9fe2c84e03760d15b3bec750b84
refs/heads/master
2021-01-18T01:11:15.173983
2016-01-16T14:36:55
2016-01-16T14:36:55
26,235,251
0
0
null
null
null
null
UTF-8
C
false
false
1,038
h
// // Constants.h // H-ound Fart Ed. // // Created by Matteo Comisso on 20/11/14. // Copyright (c) 2014 Blue-Mate. All rights reserved. // #ifndef H_ound_Fart_Ed__Constants_h #define H_ound_Fart_Ed__Constants_h #define IS_IPHONE4 (([[UIScreen mainScreen] bounds].size.height-480)?NO:YES) #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) #define IS_OS_5_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) #define IS_OS_6_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) #define IS_OS_7_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) #define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) #endif // Debug log #ifdef DEBUG # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) #else # define DLog(...) #endif // Always Log #define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
[ "teomatteo89@gmail.com" ]
teomatteo89@gmail.com
ccb54d1ff3857f4c7b89a4358b31df91cc5f473e
161f1a10f5d4f3aa741620adb9b12c62528274f3
/Problem_005/rg_005.c
c03f68883d77561e1a7ad011bf0ddfd178f5e62c
[]
no_license
ragunawan/project_euler
43acb6719138b6782656882389e9e7b6a68348a3
b867ed543c63fccc165418b0032b780cd313c1d9
refs/heads/master
2021-01-18T19:08:28.513964
2017-04-08T04:44:16
2017-04-08T04:44:16
86,890,461
0
0
null
2017-04-08T04:44:17
2017-04-01T06:38:40
C
UTF-8
C
false
false
846
c
// Project Euler - 005 /* 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? */ #include <stdio.h> long smallestMultiple(int num){ printf("number: %d\n", num); long multiple = 0; int cont = 1; while (cont){ multiple = multiple + num; for (int max = num; max > 0; max = max - 1){ if (multiple % max == 0 && max == 3){ printf("mult: %ld\n", multiple); return multiple; } else if (multiple % max != 0){ break; } } } return multiple; } int main() { long min; min = smallestMultiple(20); return 0; }
[ "ragunawan@cpp.edu" ]
ragunawan@cpp.edu
0a57313ecbcefc876c9870ef1ec41ead69072fda
8614ce2245d5edb2e64b0761fd9729aaff5ec1ea
/hanlib/hout.c
76b5ff3ade858ab413dae27fd9048aaf17cef467
[]
no_license
mete0r/hanedit2
90e4fce90b8d42eb1be43314216533ac49bef455
0cb69646a346c4489933cbdded6088e5bcf15384
refs/heads/master
2020-12-03T09:15:53.575360
2013-01-22T06:19:54
2013-01-22T06:34:54
null
0
0
null
null
null
null
UTF-8
C
false
false
14,825
c
#define INCL_PM #define INCL_GPIPRIMITIVES #include <os2.h> #include <stdio.h> #include <strings.h> #include "hch.h" #include "hout.h" #include "font.h" #define X32(x) (((ULONG)x)<<5) #define X16(x) (((ULONG)x)<<4) #define X8(x) (((ULONG)x)<<3) #define X4(x) (((ULONG)x)<<2) #define X2(x) (((ULONG)x)<<1) #define FST_BASE 0 #define MID_BASE 160 #define LST_BASE 248 #define SPEC_BASE 0 #define WITH_LST 1 #define WITHOUT_LST 0 static const BYTE idx_fromCode[3][32]={ {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,0,0,0,0,0,0,0,0,0,0,0}, // FST {0,0,0,1,2,3,4,5,0,0,6,7,8,9,10,11,0,0,12,13,14,15,16,17,0,0,18,19,20,21,0,0}, // MID {0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,17,18,19,20,21,22,23,24,25,26,27,0,0} // LST }; static const BYTE FST_fromMID[2][22] = { // determine FST-font from MID {0,0,0,0,0,0,0,0,0,1,3,3,3,1,2,4,4,4,2,1,3,0}, // without LST {0,5,5,5,5,5,5,5,5,6,7,7,7,6,6,7,7,7,6,6,7,5} // with LST }; static const BYTE MID_fromFST[2][20] = { // determine MID-font from FST {0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1}, // without LST {2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3} // with LST }; static const BYTE LST_fromMID[22] = // determine LST-font from MID {0,0,2,0,2,1,2,1,2,3,0,2,1,3,3,1,2,/*2*/1,3,3,1,1}; static const SHORT blank_font[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static PBYTE bits=NULL; // ---------------------------------------- static PBYTE pbits=NULL; // global variables : for output perfomance static ULONG line_len=0; // ---------------------------------------- static ULONG g_maxstrlen; BYTE *hout_internal_HanFont; BYTE *hout_internal_EngFont; BYTE *hout_internal_SpecFont; BYTE *hout_internal_HanjaFont; static void XferHanfont(BYTE *pch_head); static void XferHanfontHead(BYTE *pch_head); static void XferHanfontTail(BYTE *pch_head); int houtReadEngFont(const char *filename,BYTE *buf) { FILE *f; f = fopen(filename,"r"); if (f==NULL) return -1; if (fread(buf,HOUT_ENGFONTBUFSIZE,1,f)!=1) { fclose(f); return -1; } fclose(f); return 0; } int houtReadHanFont(const char *filename,BYTE *buf) { FILE *f; f = fopen(filename,"r"); if (f==NULL) return -1; if (fread(buf,HOUT_HANFONTBUFSIZE,1,f)!=1) { fclose(f); return -1; } fclose(f); return 0; } int houtReadSpecFont(const char *filename,BYTE *buf) { FILE *f; f = fopen(filename,"r"); if (f==NULL) return -1; if (fread(buf,HOUT_SPECFONTBUFSIZE,1,f)!=1) { fclose(f); return -1; } fclose(f); return 0; } int houtReadHanjaFont(const char *filename,BYTE *buf) { FILE *f; f = fopen(filename,"r"); if (f==NULL) return -1; if (fread(buf,HOUT_HANJAFONTBUFSIZE,1,f)!=1) { fclose(f); return -1; } fclose(f); return 0; } BYTE* houtSetEngFont(BYTE* fontbuf) { BYTE* oldbuf = hout_internal_EngFont; hout_internal_EngFont = fontbuf; return oldbuf; } BYTE* houtSetHanFont(BYTE* fontbuf) { BYTE* oldbuf = hout_internal_HanFont; hout_internal_HanFont = fontbuf; return oldbuf; } BYTE* houtSetSpecFont(BYTE* fontbuf) { BYTE* oldbuf = hout_internal_SpecFont; hout_internal_SpecFont = fontbuf; return oldbuf; } BYTE* houtSetHanjaFont(BYTE* fontbuf) { BYTE* oldbuf = hout_internal_HanjaFont; hout_internal_HanjaFont = fontbuf; return oldbuf; } BYTE* houtGetEngFont(void) { return hout_internal_EngFont; } BYTE* houtGetHanFont(void) { return hout_internal_HanFont; } BYTE* houtGetSpecFont(void) { return hout_internal_SpecFont; } BYTE* houtGetHanjaFont(void) { return hout_internal_HanjaFont; } ULONG houtInit(HAB hab,ULONG maxstrlen) { g_maxstrlen = maxstrlen; DosAllocMem((PPVOID)&bits,g_maxstrlen*16,fALLOC); if (bits == NULL) return FALSE; hout_internal_HanFont = DefaultHanFont; hout_internal_EngFont = DefaultEngFont; hout_internal_SpecFont = DefaultSpecFont; hout_internal_HanjaFont = NULL; return TRUE; } void houtClose() { DosFreeMem(bits); } void HanOut(HPS hps,LONG x,LONG y,PSZ str) { char *endStr = str + strlen(str) -1; register char *pstr = str; register int j; register PBYTE pfont; SIZEL sizl = {X8(strlen(str)),16}; POINTL ptl = {x,y+15}; pbits = bits; line_len = strlen(str); while (pstr<=endStr) { if ( (*pstr) & 0x80 ) { XferHanfont(pstr); pstr +=2; pbits +=2; } else { pfont = &hout_internal_EngFont[X16(*pstr)]; for (j=0;j<16;j++,pfont++,pbits+=line_len) (*pbits) = *(pfont); pbits -= X16(line_len); pstr++; pbits++; } } /* blitz */ GpiMove(hps,&ptl); GpiImage(hps,0L,&sizl,X2(sizl.cx),bits); } void HanOutOfs(HPS hps,LONG x,LONG y,PSZ str,ULONG ofs,ULONG len) { char *beginStr = str+ofs; char *endStr = beginStr + len -1; register char *pstr = str; register int j; register PBYTE pfont; SIZEL sizl = {X8(len),16}; POINTL ptl = {x,y+15}; pbits = bits; line_len = len; while (pstr<beginStr) if (*pstr&0x80) pstr+=2; else pstr++; if (pstr>beginStr) // *beginStr is hanTail { XferHanfontTail( beginStr-1); pbits ++; } while (pstr<endStr) { if ( (*pstr) & 0x80 ) { XferHanfont(pstr); pstr +=2; pbits +=2; } else { pfont = &hout_internal_EngFont[X16(*pstr)]; for (j=0;j<16;j++,pfont++,pbits+=line_len) (*pbits) = *(pfont); pbits -= X16(line_len); pstr++; pbits++; } } if (pstr == endStr) { if ( (*pstr) & 0x80 ) { XferHanfontHead(pstr); } else { pfont = &hout_internal_EngFont[X16(*pstr)]; for (j=0;j<16;j++,pfont++,pbits+=line_len) (*pbits) = *(pfont); pbits -= X16(line_len); } } /* blitz */ GpiMove(hps,&ptl); GpiImage(hps,0L,&sizl,X2(sizl.cx),bits); } void HanOutHch(HPS hps,LONG x,LONG y,HANCHAR hch) { register PBYTE pfont = NULL; register int j; SIZEL sizl = {16,16}; POINTL ptl = {x,y+15}; pbits = bits; line_len = 2; if ( hch & 0x8000 ) { BYTE pstr[2]={HIBYTE(hch),LOBYTE(hch)}; XferHanfont(pstr); } else { pfont = &hout_internal_EngFont[X16(hch)]; for (j=0;j<16;j++,pfont++,pbits+=2) (*pbits) = *(pfont); } /* blitz */ GpiMove(hps,&ptl); GpiImage(hps,0L,&sizl,X2(sizl.cx),bits); } void XferHanfont(BYTE *pch_head) { register ULONG i; register BYTE *pfont; register BYTE *pfont2,*pfont3; ULONG fst,mid,lst; ULONG idx1,idx2,idx3; BYTE *pch_tail = (pch_head+1); HANCHAR hch = HCHFROM2CH(*pch_head,*pch_tail); // special character if (((*pch_head) >= 0xd9) && ((*pch_head) <=0xde)) { if (((*pch_tail) >= 0x31) && ((*pch_tail) <= 0x7e)) idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x31); else idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x91+0x7f-0x31); pfont=&hout_internal_SpecFont[X32(idx1)]; for(i=0;i<16;i++,pbits+=line_len) *((USHORT*)(pbits)) = *(((USHORT*)pfont)++); pbits -= X16(line_len); return; } // hanja character if (*pch_head>=0xe0) { if (hout_internal_HanjaFont == NULL) hch = hch_hj2hg( hch ); else { idx1 = hch_sy2ks_hanja(hch); idx1=((idx1>>8)-0xca) * (0xff-0xa1) + ((idx1&0xff)-0xa1); #ifdef DEBUG if (X32(idx1)>HOUT_HANJAFONTBUFSIZE) { printf("hanja out of range! hch=%X \n",idx1); idx1 = 0; } #endif pfont=&hout_internal_HanjaFont[X32(idx1)]; for (i=0;i<16;i++,pbits+=line_len) *((USHORT*)(pbits)) = *(((USHORT*)pfont)++); pbits -= X16(line_len); return; } } fst = idx_fromCode[0][FSTFROMHCH(hch)]; mid = idx_fromCode[1][MIDFROMHCH(hch)]; lst = idx_fromCode[2][LSTFROMHCH(hch)]; if (lst) { idx1 = FST_BASE + FST_fromMID[WITH_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITH_LST][fst]*22 + mid; idx3 = LST_BASE + LST_fromMID [mid]*28 + lst; } else { idx1 = FST_BASE + FST_fromMID[WITHOUT_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITHOUT_LST][fst]*22 + mid; idx3 = 0; } pfont =&hout_internal_HanFont[X32(idx1)]; pfont2=&hout_internal_HanFont[X32(idx2)]; pfont3=&hout_internal_HanFont[X32(idx3)]; // if (!lst) pfont3=(PBYTE)blank_font; for(i=0;i<16;i++) { *((USHORT*)(pbits)) = *(((USHORT*)pfont )++); *((USHORT*)(pbits)) |= *(((USHORT*)pfont2)++); *((USHORT*)(pbits)) |= *(((USHORT*)pfont3)++); pbits+=line_len; } pbits -= X16(line_len); } void XferHanfontHead(BYTE *pch_head) { register ULONG i; register BYTE *pfont; register BYTE *pfont2,*pfont3; ULONG fst,mid,lst; ULONG idx1,idx2,idx3; BYTE *pch_tail = (pch_head+1); HANCHAR hch = HCHFROM2CH(*pch_head,*pch_tail); // special character if (((*pch_head) >= 0xd9) && ((*pch_head) <=0xde)) { if (((*pch_tail) >= 0x31) && ((*pch_tail) <= 0x7e)) idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x31); else idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x91+0x7f-0x31); pfont=&hout_internal_SpecFont[X32(idx1)]; for(i=0;i<16;i++,pbits+=line_len) { *pbits = *pfont; pfont+=2; } pbits -= X16(line_len); return; } // hanja character if (*pch_head>=0xe0) { if (hout_internal_HanjaFont == NULL) hch = hch_hj2hg( hch ); else { idx1 = hch_sy2ks_hanja(hch); idx1=((idx1>>8)-0xca) * (0xff-0xa1) + ((idx1&0xff)-0xa1); #ifdef DEBUG if (X32(idx1)>HOUT_HANJAFONTBUFSIZE) { printf("hanja out of range! hch=%X \n",idx1); idx1 = 0; } #endif pfont=&hout_internal_HanjaFont[X32(idx1)]; for (i=0;i<16;i++,pbits+=line_len) { *pbits = *pfont; pfont+=2; } pbits -= X16(line_len); return; } } fst = idx_fromCode[0][FSTFROMHCH(hch)]; mid = idx_fromCode[1][MIDFROMHCH(hch)]; lst = idx_fromCode[2][LSTFROMHCH(hch)]; if (lst) { idx1 = FST_BASE + FST_fromMID[WITH_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITH_LST][fst]*22 + mid; idx3 = LST_BASE + LST_fromMID [mid]*28 + lst; } else { idx1 = FST_BASE + FST_fromMID[WITHOUT_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITHOUT_LST][fst]*22 + mid; idx3 = 0; } pfont =&hout_internal_HanFont[X32(idx1)]; pfont2=&hout_internal_HanFont[X32(idx2)]; pfont3=&hout_internal_HanFont[X32(idx3)]; // if (!lst) pfont3=(PBYTE)blank_font; for(i=0;i<16;i++) { *pbits = *pfont; *pbits |= *pfont2; *pbits |= *pfont3; pfont += 2; pfont2 += 2; pfont3 += 2; pbits += line_len; } pbits -= X16(line_len); } void XferHanfontTail(BYTE *pch_head) { register ULONG i; register BYTE *pfont; register BYTE *pfont2,*pfont3; ULONG fst,mid,lst; ULONG idx1,idx2,idx3; BYTE *pch_tail = (pch_head+1); HANCHAR hch = HCHFROM2CH(*pch_head,*pch_tail); // special character if (((*pch_head) >= 0xd9) && ((*pch_head) <=0xde)) { if (((*pch_tail) >= 0x31) && ((*pch_tail) <= 0x7e)) idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x31); else idx1 = ((*pch_head) - 0xd9)*(0x5e*2) + ((*pch_tail)-0x91+0x7f-0x31); pfont=&hout_internal_SpecFont[X32(idx1)] +1; for(i=0;i<16;i++,pbits+=line_len) { *pbits = *pfont; pfont+=2; } pbits -= X16(line_len); return; } // hanja character if (*pch_head>=0xe0) { if (hout_internal_HanjaFont == NULL) hch = hch_hj2hg( hch ); else { idx1 = hch_sy2ks_hanja(hch); idx1=((idx1>>8)-0xca) * (0xff-0xa1) + ((idx1&0xff)-0xa1); #ifdef DEBUG if (X32(idx1)>HOUT_HANJAFONTBUFSIZE) { printf("hanja out of range! hch=%X \n",idx1); idx1 = 0; } #endif pfont=&hout_internal_HanjaFont[X32(idx1)] +1; for (i=0;i<16;i++,pbits+=line_len) { *pbits = *pfont; pfont+=2; } pbits -= X16(line_len); return; } } fst = idx_fromCode[0][FSTFROMHCH(hch)]; mid = idx_fromCode[1][MIDFROMHCH(hch)]; lst = idx_fromCode[2][LSTFROMHCH(hch)]; if (lst) { idx1 = FST_BASE + FST_fromMID[WITH_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITH_LST][fst]*22 + mid; idx3 = LST_BASE + LST_fromMID [mid]*28 + lst; } else { idx1 = FST_BASE + FST_fromMID[WITHOUT_LST][mid]*20 + fst; idx2 = MID_BASE + MID_fromFST[WITHOUT_LST][fst]*22 + mid; idx3 = 0; } pfont =&hout_internal_HanFont[X32(idx1)] +1; pfont2=&hout_internal_HanFont[X32(idx2)] +1; pfont3=&hout_internal_HanFont[X32(idx3)] +1; // if (!lst) pfont3=(PBYTE)blank_font; for(i=0;i<16;i++) { *pbits = *pfont; *pbits |= *pfont2; *pbits |= *pfont3; pfont += 2; pfont2 += 2; pfont3 += 2; pbits += line_len; } pbits -= X16(line_len); }
[ "komh@chollian.net" ]
komh@chollian.net
2cd61c1d63aa2676625fb8cd11efdcd1f09bb37b
58e95fe0d68d0e8a3c2a3eb295485b4a9ca53e68
/libSslSupport/fileIo.h
d978fae2ef450116244d1490acbd96008358ba6c
[]
no_license
fruitsamples/SSLSample
ad9eff92c3a32806c21bfb67edbe5fe4a73ad683
d036a9cc9ac4d8968f51b966f8ec033b58ca0c75
refs/heads/master
2021-01-10T11:06:20.288229
2015-11-25T20:54:38
2015-11-25T20:54:38
46,886,162
0
0
null
null
null
null
MacCentralEurope
C
false
false
3,538
h
/* File: fileIo.h Contains: simple file r/w routines. Copyright: © Copyright 2002 Apple Computer, Inc. All rights reserved. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple’s copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Change History (most recent first): 11/4/02 1.0d1 */ #ifdef __cplusplus extern "C" { #endif int readFile( const char *fileName, unsigned char **bytes, // mallocd and returned unsigned *numBytes); // returned int writeFile( const char *fileName, const unsigned char *bytes, unsigned numBytes); #ifdef __cplusplus } #endif
[ "contact@stevemoser.org" ]
contact@stevemoser.org
39e9def574310a9728b9227ff1798be160f3fafa
35e28d7705773eed54345af4440700522c9d1863
/deps/libproj/proj/src/pj_strtod.c
01ab01dac520aa51f5773eaa772e209a08653db4
[ "LicenseRef-scancode-us-govt-public-domain", "MIT", "Apache-2.0" ]
permissive
naturalatlas/node-gdal
0ee3447861bf2d1abc48d4fbdbcf15aba5473a27
c83e7858a9ec566cc91d65db74fd07b99789c0f0
refs/heads/master
2023-09-03T00:11:41.576937
2022-03-12T20:41:59
2022-03-12T20:41:59
19,504,824
522
122
Apache-2.0
2022-06-04T20:03:43
2014-05-06T18:02:34
C++
UTF-8
C
false
false
6,576
c
/****************************************************************************** * * Derived from GDAL port/cpl_strtod.cpp * Purpose: Functions to convert ASCII string to floating point number. * Author: Andrey Kiselev, dron@ak4719.spb.edu. * ****************************************************************************** * Copyright (c) 2006, Andrey Kiselev * Copyright (c) 2008-2012, Even Rouault <even dot rouault at mines-paris dot org> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "projects.h" /* Windows nmake build doesn't have a proj_config.h, but HAVE_LOCALECONV */ /* is defined in the compilation line */ #ifndef HAVE_LOCALECONV #include "proj_config.h" #endif #include <stdlib.h> #include <locale.h> #include <errno.h> #define PJ_STRTOD_WORK_BUFFER_SIZE 64 /************************************************************************/ /* pj_atof() */ /************************************************************************/ /** * Converts ASCII string to floating point number. * * This function converts the initial portion of the string pointed to * by nptr to double floating point representation. The behaviour is the * same as * * pj_strtod(nptr, (char **)NULL); * * This function does the same as standard atof(3), but does not take * locale in account. That means, the decimal delimiter is always '.' * (decimal point). * * @param nptr Pointer to string to convert. * * @return Converted value. */ double pj_atof( const char* nptr ) { return pj_strtod(nptr, NULL); } /************************************************************************/ /* pj_replace_point_by_locale_point() */ /************************************************************************/ static char* pj_replace_point_by_locale_point(const char* pszNumber, char point, char* pszWorkBuffer) { #if !defined(HAVE_LOCALECONV) || defined(_WIN32_WCE) static char byPoint = 0; if (byPoint == 0) { char szBuf[16]; sprintf(szBuf, "%.1f", 1.0); byPoint = szBuf[1]; } if (point != byPoint) { const char* pszPoint = strchr(pszNumber, point); if (pszPoint) { char* pszNew; if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE ) { strcpy(pszWorkBuffer, pszNumber); pszNew = pszWorkBuffer; } else pszNew = strdup(pszNumber); pszNew[pszPoint - pszNumber] = byPoint; return pszNew; } } #else struct lconv *poLconv = localeconv(); if ( poLconv && poLconv->decimal_point && poLconv->decimal_point[0] != '\0' ) { char byPoint = poLconv->decimal_point[0]; if (point != byPoint) { const char* pszLocalePoint = strchr(pszNumber, byPoint); const char* pszPoint = strchr(pszNumber, point); if (pszPoint || pszLocalePoint) { char* pszNew; if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE ) { strcpy(pszWorkBuffer, pszNumber); pszNew = pszWorkBuffer; } else pszNew = strdup(pszNumber); if( pszLocalePoint ) pszNew[pszLocalePoint - pszNumber] = ' '; if( pszPoint ) pszNew[pszPoint - pszNumber] = byPoint; return pszNew; } } } #endif return (char*) pszNumber; } /************************************************************************/ /* pj_strtod() */ /************************************************************************/ /** * Converts ASCII string to floating point number. * * This function converts the initial portion of the string pointed to * by nptr to double floating point representation. This function does the * same as standard strtod(3), but does not take locale in account and use * decimal point. * * @param nptr Pointer to string to convert. * @param endptr If is not NULL, a pointer to the character after the last * character used in the conversion is stored in the location referenced * by endptr. * @param point Decimal delimiter. * * @return Converted value. */ double pj_strtod( const char *nptr, char **endptr ) { /* -------------------------------------------------------------------- */ /* We are implementing a simple method here: copy the input string */ /* into the temporary buffer, replace the specified decimal delimiter */ /* with the one, taken from locale settings and use standard strtod() */ /* on that buffer. */ /* -------------------------------------------------------------------- */ double dfValue; int nError; char szWorkBuffer[PJ_STRTOD_WORK_BUFFER_SIZE]; char* pszNumber = pj_replace_point_by_locale_point(nptr, '.', szWorkBuffer); dfValue = strtod( pszNumber, endptr ); nError = errno; if ( endptr ) *endptr = (char *)nptr + (*endptr - pszNumber); if (pszNumber != (char*) nptr && pszNumber != szWorkBuffer ) free( pszNumber ); errno = nError; return dfValue; }
[ "dane@mapbox.com" ]
dane@mapbox.com
fbe6ba4630cbbdb277a4875ec9cabeb95eb1f219
fcdac2110a99762f5b7042205399277904e05a76
/mupq/pqclean/crypto_sign/sphincs-sha256-128f-robust/clean/sha256.h
86ee829d3abb94337b7fe7df958cf7b60202c8a6
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
denigreco/Kyber_RISC_V_Thesis
0e391a8a53cb57b19c6414df3b3289aeb497b62d
06ee55172dca5a98f6530888ffa869c2251d884c
refs/heads/master
2020-09-16T23:42:54.365175
2020-05-18T19:51:57
2020-05-18T19:51:57
223,923,060
5
0
null
null
null
null
UTF-8
C
false
false
681
h
#ifndef SPX_SHA256_H #define SPX_SHA256_H #define SPX_SHA256_BLOCK_BYTES 64 #define SPX_SHA256_OUTPUT_BYTES 32 /* This does not necessarily equal SPX_N */ #define SPX_SHA256_ADDR_BYTES 22 #include <stddef.h> #include <stdint.h> #include "sha2.h" void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_compress_address(unsigned char *out, const uint32_t addr[8]); void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_mgf1( unsigned char *out, unsigned long outlen, unsigned char *input_plus_four_bytes, unsigned long inlen); extern sha256ctx PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_state_seeded; void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_seed_state(const unsigned char *pub_seed); #endif
[ "¨denisa.greconici@gmail.com¨" ]
¨denisa.greconici@gmail.com¨
3e516b7538652fab20762beb242dec7bdb76b23f
ac48dc874f5550d03648c28b1eda5720202eb55c
/sensors/dsps/slang/src/smgr_service.c
c10b738a0cea732b8db111f01c6fde8774f95b1f
[]
no_license
difr/msm8937-8953_qcom_vendor
464e478cae4a89de34ac79f4d615e5141c40cbcb
6cafff53eca7f0c28fa9c470b5211423cf47fd40
refs/heads/master
2020-03-20T09:58:48.935110
2018-05-27T04:13:22
2018-05-27T04:13:22
137,355,108
0
1
null
null
null
null
UTF-8
C
false
false
44,482
c
/* =================================================================== ** Copyright (c) 2015 Qualcomm Technologies, Inc. ** All Rights Reserved. ** Confidential and Proprietary - Qualcomm Technologies, Inc. ** ** FILE: smgr_service.c ** DESC: sensor language - slang - smgr service support ** Revision History ** 11-09-2015 df Fix static analysis errors ** ================================================================ */ #include "sli.h" #include "diagnostics.h" #include "literals.h" #include "slcore.h" #include "slmalloc.h" #include "slnew_req.h" #include "sensor1.h" #include "sns_smgr_common_v01.h" #include "sns_smgr_api_v01.h" #include <stdio.h> // sprintf name2num sensorname2num[] = { { "accel", 0}, { "gyro", 10}, { "mag", 20}, { "pressure", 30}, { "prox_light", 40}, { "humidity", 50}, { "rgb_cct", 60}, { "sar", 70}, { "hall", 80}, { "heart_rate", 90}, { "object_temp", 100}, }; static int smgr_req_item = 0; void BadSensorName( const char *sensorname) { char errbuf[ 64]; snprintf( errbuf, sizeof(errbuf), "%s \'%s\'", get_literal( UNKNOWN_SENSOR), sensorname); RTErrorMsg( errbuf); } /** * @name get_sensor_id * @brief get sensor number from name * @param[i] char *lower case sensor name * @return UNKNOWN or int service_number */ int32_t get_sensor_id( const char *name) { unsigned int i; for ( i = 0; i < sizeof( sensorname2num) / sizeof( name2num); i++) { if ( strcasecmp( sensorname2num[ i].name, name) == 0) { return sensorname2num[ i].num; } } BadSensorName( name); return UNKNOWN; } /** * @name GetSensorId * @param[i] t_keyvalue * @return int32_t */ int32_t GetSensorId( const token *t_keyvalue) { int32_t sensor_id = UNKNOWN; if ( t_keyvalue->datatype == INTEGER) { sensor_id = t_keyvalue->data.i; } else if ( t_keyvalue->datatype == POINTER) { sensor_id = get_sensor_id( t_keyvalue->data.p); } else { char *fieldname = t_keyvalue->pSymbol; ErrReasonForField( BAD_VALUE, fieldname); } return sensor_id; } uint8_t GetDataType( const token *t_keyvalue) { uint8_t datatype = 0; if ( t_keyvalue->datatype == INTEGER) { datatype = t_keyvalue->data.i; } else if ( t_keyvalue->datatype == POINTER) { if ( strcasecmp( t_keyvalue->data.p, get_literal( PRIMARY)) == 0) { datatype = SNS_SMGR_DATA_TYPE_PRIMARY_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( SECONDARY)) == 0) { datatype = SNS_SMGR_DATA_TYPE_SECONDARY_V01; } else { char *fieldname = t_keyvalue->pSymbol; ErrReasonForField( BAD_VALUE, fieldname); } } return datatype; } /** === SETTERS === */ /** === SETTERS === */ /** === SETTERS === */ /** * @name SmgrSetSnglInfo * @param[io] req_msg * @param[i] t_keyvalue */ void SmgrSetSnglInfo( request *req_msg, const token *t_keyvalue) { char *fieldname = t_keyvalue->pSymbol; sns_smgr_single_sensor_info_req_msg_v01 *pMsg = req_msg->payload; if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { int32_t sensor_id = GetSensorId( t_keyvalue); pMsg->SensorID = (uint8_t)sensor_id; } else { BadFieldName( fieldname); } } /** * @name SmgrSetReport * @param[io] req_msg * @param[i] t_keyvalue * @brief requires fields to be presented using ascending * items numbers. for example * { "item" => 0, "sensor_id" => "accel", "item" => 1, * "sensor_id" => "gyro" */ void SmgrSetReport( request *req_msg, const token *t_keyvalue) { char *fieldname = t_keyvalue->pSymbol; sns_smgr_periodic_report_req_msg_v01 *pMsg = req_msg->payload; if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { pMsg->ReportId = (uint8_t)t_keyvalue->data.i; } else if ( strcasecmp( fieldname, get_literal( ACTION)) == 0) { if ( strcasecmp( t_keyvalue->data.p, get_literal( ADD)) == 0) { pMsg->Action = SNS_SMGR_REPORT_ACTION_ADD_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( DELETE)) == 0) { pMsg->Action = SNS_SMGR_REPORT_ACTION_DELETE_V01; pMsg->Item_len = 0; pMsg->cal_sel_valid = 0; pMsg->SampleQuality_valid = 0; pMsg->notify_suspend_valid = 0; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( REPORTRATE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->ReportRate = (uint16_t)t_keyvalue->data.i; } else if ( t_keyvalue->datatype == FLOAT) { pMsg->ReportRate = (uint16_t)((int)t_keyvalue->data.d); } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { if ( t_keyvalue->datatype != INTEGER) { ErrReasonForField( BAD_VALUE, fieldname); } int item_index = t_keyvalue->data.i; smgr_req_item = item_index; if ( item_index < 0 || item_index >= SNS_SMGR_MAX_ITEMS_PER_REPORT_V01 ) { ErrReasonForField( BAD_VALUE, fieldname); return; } smgr_req_item = item_index; pMsg->Item_len = item_index + 1; pMsg->Item[ item_index].Decimation = SNS_SMGR_DECIMATION_RECENT_SAMPLE_V01; } else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { pMsg->Item_len = smgr_req_item + 1; pMsg->Item[ smgr_req_item].SensorId = (uint8_t)GetSensorId( t_keyvalue); } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { pMsg->Item_len = smgr_req_item + 1; pMsg->Item[ smgr_req_item].DataType = GetDataType( t_keyvalue); } else if ( strcasecmp( fieldname, get_literal( DECIMATION)) == 0) { pMsg->Item_len = smgr_req_item + 1; if ( strcasecmp( t_keyvalue->data.p, get_literal( SAMPLE)) == 0) { pMsg->Item[ smgr_req_item].Decimation = SNS_SMGR_DECIMATION_RECENT_SAMPLE_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FILTER)) == 0) { pMsg->Item[ smgr_req_item].Decimation = SNS_SMGR_DECIMATION_FILTER_V01; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( CALIBRATION)) == 0) { pMsg->cal_sel_valid = true; pMsg->cal_sel_len = smgr_req_item + 1; if ( strcasecmp( t_keyvalue->data.p, get_literal( RAW)) == 0) { pMsg->cal_sel[ smgr_req_item] = SNS_SMGR_CAL_SEL_RAW_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FACTORY)) == 0) { pMsg->cal_sel[ smgr_req_item] = SNS_SMGR_CAL_SEL_FACTORY_CAL_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FULL)) == 0) { pMsg->cal_sel[ smgr_req_item] = SNS_SMGR_CAL_SEL_FULL_CAL_V01; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( SAMPLEQUALITY)) == 0) { pMsg->SampleQuality_valid = true; pMsg->SampleQuality_len = smgr_req_item + 1; if ( t_keyvalue->datatype == INTEGER) { pMsg->SampleQuality[ smgr_req_item] = (uint16_t)t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else { InvalidFieldName( fieldname); } } /** * @name SmgrSetSelfTest * @brief sets fields in the * sns_smgr_single_sensor_test_req_msg_v01 * @param[io] req_msg * @param[i] t_keyvalue */ void SmgrSetSelfTest( request *req_msg, const token *t_keyvalue) { char *fieldname = t_keyvalue->pSymbol; sns_smgr_single_sensor_test_req_msg_v01 *pMsg = req_msg->payload; if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { pMsg->SensorID = (uint8_t)GetSensorId( t_keyvalue); } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { pMsg->DataType = GetDataType( t_keyvalue); } else if ( strcasecmp( fieldname, get_literal( TESTTYPE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->TestType = ( sns_smgr_test_type_e_v01) t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( SAVE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->SaveToRegistry_valid = true; pMsg->SaveToRegistry = t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( APPLY)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->ApplyCalNow_valid = true; pMsg->ApplyCalNow = t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else { InvalidFieldName( fieldname); } } /** * @name SmgrSetBuffered * @brief req_msg intialized with keyvalue * requires setting items in ascending order * because item_len gets set per item. * @param[io] req_msg * @param[i] t_keyvalue */ void SmgrSetBuffered( request *req_msg, const token *t_keyvalue) { char *fieldname = t_keyvalue->pSymbol; sns_smgr_buffering_req_msg_v01 *pMsg = req_msg->payload; if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { pMsg->ReportId = (uint8_t)t_keyvalue->data.i; } else if ( strcasecmp( fieldname, get_literal( ACTION)) == 0) { if ( strcasecmp( t_keyvalue->data.p, get_literal( ADD)) == 0) { pMsg->Action = SNS_SMGR_BUFFERING_ACTION_ADD_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( DELETE)) == 0) { pMsg->Action = SNS_SMGR_BUFFERING_ACTION_DELETE_V01; pMsg->Item_len = 0; pMsg->notify_suspend_valid = 0; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( REPORTRATE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { uint32_t q16_value = (uint32_t)t_keyvalue->data.i * 65536; pMsg->ReportRate = q16_value; } else if ( t_keyvalue->datatype == FLOAT) { uint32_t q16_value = (uint32_t)( t_keyvalue->data.d * 65536); pMsg->ReportRate = q16_value; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { if ( t_keyvalue->datatype != INTEGER || t_keyvalue->data.i < 0 || t_keyvalue->data.i >= SNS_SMGR_BUFFERING_REQUEST_MAX_ITEMS_V01 ) { ErrReasonForField( BAD_VALUE, fieldname); } else { smgr_req_item = t_keyvalue->data.i; pMsg->Item[ smgr_req_item].Decimation = SNS_SMGR_DECIMATION_RECENT_SAMPLE_V01; pMsg->Item_len = smgr_req_item + 1; } } else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { pMsg->Item_len = smgr_req_item + 1; int32_t sensor_id = UNKNOWN; if ( t_keyvalue->datatype == INTEGER) { sensor_id = t_keyvalue->data.i; } else if ( t_keyvalue->datatype == POINTER) { sensor_id = get_sensor_id( t_keyvalue->data.p); } if ( sensor_id != UNKNOWN) { pMsg->Item[ smgr_req_item].SensorId = (uint8_t)sensor_id; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->Item[ smgr_req_item].DataType = t_keyvalue->data.i; } else if ( t_keyvalue->datatype == POINTER) { if ( strcasecmp( t_keyvalue->data.p, get_literal( PRIMARY)) == 0) { pMsg->Item[ smgr_req_item].DataType = SNS_SMGR_DATA_TYPE_PRIMARY_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( SECONDARY)) == 0) { pMsg->Item[ smgr_req_item].DataType = SNS_SMGR_DATA_TYPE_SECONDARY_V01; } else { ErrReasonValueForFieldName( BAD_VALUE, t_keyvalue->data.p, fieldname); // stub WANT slnew_req return NULL } } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( DECIMATION)) == 0) { if ( strcasecmp( t_keyvalue->data.p, get_literal( SAMPLE)) == 0) { pMsg->Item[ smgr_req_item].Decimation = SNS_SMGR_DECIMATION_RECENT_SAMPLE_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FILTER)) == 0) { pMsg->Item[ smgr_req_item].Decimation = SNS_SMGR_DECIMATION_FILTER_V01; } else { ErrReasonValueForFieldName( BAD_VALUE, t_keyvalue->data.p, fieldname); // stub WANT slnew_req return NULL } } else if ( strcasecmp( fieldname, get_literal( CALIBRATION)) == 0) { if ( strcasecmp( t_keyvalue->data.p, get_literal( RAW)) == 0) { pMsg->Item[ smgr_req_item].Calibration = SNS_SMGR_CAL_SEL_RAW_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FACTORY)) == 0) { pMsg->Item[ smgr_req_item].Calibration = SNS_SMGR_CAL_SEL_FACTORY_CAL_V01; } else if ( strcasecmp( t_keyvalue->data.p, get_literal( FULL)) == 0) { pMsg->Item[ smgr_req_item].Calibration = SNS_SMGR_CAL_SEL_FULL_CAL_V01; } else { ErrReasonValueForFieldName( BAD_VALUE, t_keyvalue->data.p, fieldname); // stub WANT slnew_req return NULL } } else if ( strcasecmp( fieldname, get_literal( SAMPLERATE)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->Item[ smgr_req_item].SamplingRate = (uint16_t)t_keyvalue->data.i; } else if ( t_keyvalue->datatype == FLOAT) { pMsg->Item[ smgr_req_item].SamplingRate = (uint16_t)t_keyvalue->data.d; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( SAMPLEQUALITY)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->Item[ smgr_req_item].SampleQuality = (uint16_t)t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } else if ( strcasecmp( fieldname, get_literal( NOTIFY_SUSPEND)) == 0) { if ( t_keyvalue->datatype == INTEGER) { pMsg->notify_suspend_valid = 1; pMsg->notify_suspend.send_indications_during_suspend = t_keyvalue->data.i; } else { ErrReasonForField( BAD_VALUE, fieldname); } } } /** * @name SmgrSetReq * @brief SmgrSetReq is invoked once per field name. * @param[io] req_msg * @param[i] t_keyvalue */ void SmgrSetReq( request *req_msg, const token *t_keyvalue) { void *body = req_msg->payload; int32_t msg_id = req_msg->header.msg_id; char *fieldname = t_keyvalue->pSymbol; if ( fieldname == NULL) { RTErrorMsg( "SmgrSetReq: pSymbol == NULL\n"); return; } if ( msg_id == SNS_SMGR_REPORT_REQ_V01) { SmgrSetReport( req_msg, t_keyvalue); } else if ( msg_id == SNS_SMGR_SINGLE_SENSOR_INFO_REQ_V01) { SmgrSetSnglInfo( req_msg, t_keyvalue); } else if ( msg_id == SNS_SMGR_SINGLE_SENSOR_TEST_REQ_V01) { SmgrSetSelfTest( req_msg, t_keyvalue); } else if ( msg_id == SNS_SMGR_BUFFERING_REQ_V01) { SmgrSetBuffered( req_msg, t_keyvalue); } // else if ( msg_id == SNS_SMGR_BUFFERING_QUERY_REQ_V01) { // SmgrSetBufQuery( req_msg, t_keyvalue); // } else { InvalidFieldName( fieldname); } } /** * @name SmgrNewReq * @brief SmgrSetReq is invoked to initialize optional * fields in a newly allocated req_msg * @param[io] req_msg * @param[i] fieldlist */ void SmgrNewReq( request *req_msg, const array *fieldlist) { if ( fieldlist) { if ( req_msg->header.service_number != SNS_SMGR_SVC_ID_V01) { RTErrorMsg( "invalid req_msg for smgr"); return; } /* ** populate periodic report payload with default values !! stub new - only binary zero defaults !! ** ------------------------------------------------- */ if ( req_msg->header.msg_id == SNS_SMGR_REPORT_REQ_V01) { sns_smgr_periodic_report_req_msg_v01 *pMsg = req_msg->payload; smgr_req_item = 0; // default item_index pMsg->Action = SNS_SMGR_REPORT_ACTION_ADD_V01; // default action } // note: arrays populate the high_water element !! thus using <= high_water int i; for ( i = 0; i <= fieldlist->high_water; ) { token *t_keyvalue = ( token *)get_array_element( fieldlist, i++); if ( t_keyvalue == NULL) { break; } if ( t_keyvalue->subtype != KEYVALUE) { RTErrorMsg( "invalid key => value argument"); // expecting field_name => value, ... break; } SmgrSetReq( req_msg, t_keyvalue); } } } /** === GETTERS === */ /** === GETTERS === */ /** === GETTERS === */ void SetTypes( token *t_value, uint16_t type, uint8_t subtype, uint8_t datatype) { t_value->type = type; t_value->subtype = subtype; t_value->datatype = datatype; } /** * @name SmgrGetReportResp * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetReportResp( const respind *p_respind, const token *t_field, token *t_value) { static int32_t reasonpair_index = 0; sns_smgr_periodic_report_resp_msg_v01 *pMsg = ( sns_smgr_periodic_report_resp_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( REASONPAIR)) == 0) { reasonpair_index = t_field->data.i; if ( reasonpair_index >= ( int32_t)pMsg->ReasonPair_len) { RTErrorMsg( get_literal( BAD_INDEX)); reasonpair_index = 0; } } else { RTErrorMsg( get_literal( BAD_FIELD)); } return; } if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { t_value->data.i = pMsg->ReportId; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( ACKNAK)) == 0) { t_value->data.i = pMsg->AckNak; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( REASONPAIR)) == 0) { t_value->data.i = pMsg->ReasonPair_len; // number of entries t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { t_value->data.i = pMsg->ReasonPair[ reasonpair_index].ItemNum; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( REASON)) == 0) { t_value->data.i = pMsg->ReasonPair[ reasonpair_index].Reason; t_value->datatype = INTEGER; } else { BadFieldName( fieldname); } } /** * @name SmgrGetAllSensorInfoResp * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetAllSensorInfoResp( const respind *p_respind, const token *t_field, token *t_value) { static int32_t info_index = 0; sns_smgr_all_sensor_info_resp_msg_v01 *pMsg = ( sns_smgr_all_sensor_info_resp_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( INFO)) == 0) { info_index = t_field->data.i; if ( info_index >= ( int32_t)pMsg->SensorInfo_len) { RTErrorMsg( get_literal( BAD_INDEX)); info_index = 0; } } else { BadFieldName( fieldname); } return; } if ( strcasecmp( fieldname, get_literal( INFO)) == 0) { t_value->data.i = pMsg->SensorInfo_len; // return number of entries t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->SensorInfo[info_index].SensorID; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SHORTNAME)) == 0) { uint32_t len = pMsg->SensorInfo[info_index].SensorShortName_len; void *p_from = pMsg->SensorInfo[info_index].SensorShortName; void *p_to = LatchLiteral( p_from, len); // SetTypes( t_value, VALUE, STRING, POINTER); t_value->data.p = p_to; t_value->subtype = STRING; t_value->datatype = POINTER; } else { BadFieldName( fieldname); } } /** * @name SmgrGetSnglSensorInfoResp * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetSnglSensorInfoResp( const respind *p_respind, const token *t_field, token *t_value) { static int32_t info_index = 0; static int32_t odr_index = 0; sns_smgr_single_sensor_info_resp_msg_v01 *pMsg = ( sns_smgr_single_sensor_info_resp_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( INFO)) == 0) { info_index = t_field->data.i; if ( info_index >= ( int32_t)pMsg->SensorInfo.data_type_info_len) { RTErrorMsg( get_literal( BAD_INDEX)); info_index = 0; } } else if ( strcmp( fieldname, get_literal( ODR_LIST)) == 0) { odr_index = t_field->data.i; if ( odr_index >= (int32_t)pMsg->supported_odr_list[ info_index].odrs_len) { RTErrorMsg( get_literal( BAD_INDEX)); odr_index = 0; } } else { BadFieldName( fieldname); } return; } if ( strcasecmp( fieldname, get_literal( INFO)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info_len; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info[info_index].SensorID; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info[info_index].DataType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SENSOR_NAME)) == 0) { uint32_t len = pMsg->SensorInfo.data_type_info[info_index].SensorName_len; void *p_from = pMsg->SensorInfo.data_type_info[info_index].SensorName; void *p_to = LatchLiteral( p_from, len ); t_value->data.p = p_to; t_value->subtype = STRING; t_value->datatype = POINTER; } else if ( strcasecmp( fieldname, get_literal( VENDOR)) == 0) { uint32_t len = pMsg->SensorInfo.data_type_info[info_index].VendorName_len; void *p_from = pMsg->SensorInfo.data_type_info[info_index].VendorName; void *p_to = LatchLiteral( p_from, len ); t_value->data.p = p_to; t_value->subtype = STRING; t_value->datatype = POINTER; } else if ( strcasecmp( fieldname, get_literal( MAX_RATE)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info[info_index].MaxSampleRate; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( IDLE_POWER)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info[info_index].IdlePower; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( MAX_POWER)) == 0) { t_value->data.i = pMsg->SensorInfo.data_type_info[info_index].MaxPower; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( MAX_RANGE)) == 0) { t_value->data.d = (double)pMsg->SensorInfo.data_type_info[info_index].MaxRange / 65536; t_value->datatype = FLOAT; } else if ( strcasecmp( fieldname, get_literal( RESOLUTION)) == 0) { t_value->data.d = (double)pMsg->SensorInfo.data_type_info[info_index].Resolution / 65536; t_value->datatype = FLOAT; } else if ( strcasecmp( fieldname, get_literal( MAX_REPORTS)) == 0) { if ( pMsg->num_buffered_reports_valid) { t_value->data.i = pMsg->num_buffered_reports[info_index]; t_value->datatype = INTEGER; } } else if ( strcasecmp( fieldname, get_literal( OP_MODE)) == 0) { if ( pMsg->op_mode_valid) { t_value->data.i = pMsg->op_mode; t_value->datatype = INTEGER; } } else if ( strcasecmp( fieldname, get_literal( SUID)) == 0) { if ( pMsg->suid_valid) { if ( info_index < (int32_t)pMsg->suid_len) { char lit_suid[ 20]; uint8_t *pHex = ( uint8_t *)&pMsg->suid[ info_index]; snprintf( lit_suid, sizeof( lit_suid), "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", pHex[0], pHex[1], pHex[2], pHex[3], pHex[4], pHex[5], pHex[6], pHex[7]); void *p_to = LatchLiteral( lit_suid, 16); t_value->data.p = p_to; t_value->datatype = POINTER; } else { RTErrorMsg( get_literal( BAD_INDEX)); } } } else if ( strcasecmp( fieldname, get_literal( ODR_LIST)) == 0) { if ( pMsg->supported_odr_list_valid) { uint32_t odr_count = pMsg->supported_odr_list[ info_index].odrs_len; t_value->data.i = odr_count; t_value->datatype = INTEGER; } } else if ( strcasecmp( fieldname, get_literal( ODR)) == 0) { if ( pMsg->supported_odr_list_valid) { uint32_t odr = pMsg->supported_odr_list[ info_index].odrs[ odr_index]; t_value->data.i = odr; t_value->datatype = INTEGER; } } else { BadFieldName( fieldname); } } /** * @name SmgrGetSelfTestResp * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetSelfTestResp( const respind *p_respind, const token *t_field, token *t_value) { static int32_t reasonpair_index = 0; sns_smgr_single_sensor_test_ind_msg_v01 *pMsg = ( sns_smgr_single_sensor_test_ind_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->SensorID; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { t_value->data.i = pMsg->DataType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( TESTTYPE)) == 0) { t_value->data.i = pMsg->TestType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( TESTRESULT)) == 0) { t_value->data.i = pMsg->TestResult; t_value->datatype = INTEGER; } else { BadFieldName( fieldname); } } /** * @name SmgrGetBufferedResp * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetBufferedResp( const respind *p_respind, const token *t_field, token *t_value) { static int32_t reasonpair_index = 0; sns_smgr_buffering_resp_msg_v01 *pMsg = ( sns_smgr_buffering_resp_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( REASONPAIR)) == 0) { reasonpair_index = t_field->data.i; if ( reasonpair_index >= ( int32_t)pMsg->ReasonPair_len) { RTErrorMsg( get_literal( BAD_INDEX)); reasonpair_index = 0; } } else { BadFieldName( fieldname); } return; } if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { if ( pMsg->ReportId_valid) { t_value->datatype = INTEGER; t_value->data.i = pMsg->ReportId; } } else if ( strcasecmp( fieldname, get_literal( ACKNAK)) == 0) { if ( pMsg->AckNak_valid) { t_value->datatype = INTEGER; t_value->data.i = pMsg->AckNak; } } else if ( strcasecmp( fieldname, get_literal( REASONPAIR)) == 0) { if ( pMsg->ReasonPair_valid) { t_value->datatype = INTEGER; t_value->data.i = pMsg->ReasonPair_len; // number of entries } } else if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { if ( pMsg->ReasonPair_valid) { t_value->datatype = INTEGER; t_value->data.i = pMsg->ReasonPair[ reasonpair_index].ItemNum; } } else if ( strcasecmp( fieldname, get_literal( REASON)) == 0) { if ( pMsg->ReasonPair_valid) { t_value->datatype = INTEGER; t_value->data.i = pMsg->ReasonPair[ reasonpair_index].Reason; } } else { BadFieldName( fieldname); } } /** * @name SmgrGetReportInd * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetReportInd( const respind *p_respind, const token *t_field, token *t_value) { static int32_t item_index = 0; sns_smgr_periodic_report_ind_msg_v01 *pMsg = ( sns_smgr_periodic_report_ind_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( ITEM)) == 0) { item_index = t_field->data.i; if ( item_index >= ( int32_t)pMsg->Item_len) { RTErrorMsg( get_literal( BAD_INDEX)); item_index = 0; } } else { RTErrorMsg( get_literal( BAD_FIELD)); } return; } if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { t_value->data.i = pMsg->ReportId; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( STATUS)) == 0) { t_value->data.i = pMsg->status; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( CURRENTRATE)) == 0) { t_value->data.i = pMsg->CurrentRate; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { t_value->data.i = pMsg->Item_len; // number of items t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->Item[ item_index].SensorId; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { t_value->data.i = pMsg->Item[ item_index].DataType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATAX)) == 0) { t_value->data.i = pMsg->Item[ item_index].ItemData[0]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATAY)) == 0) { t_value->data.i = pMsg->Item[ item_index].ItemData[1]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATAZ)) == 0) { t_value->data.i = pMsg->Item[ item_index].ItemData[2]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SSCTS)) == 0) { t_value->data.i = pMsg->Item[ item_index].TimeStamp; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( FLAGS)) == 0) { t_value->data.i = pMsg->Item[ item_index].ItemFlags; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( QUALITY)) == 0) { t_value->data.i = pMsg->Item[ item_index].ItemQuality; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SAMPLERATE)) == 0) { if ( pMsg->SamplingRate_valid && pMsg->SamplingRate_len >= (uint32_t)item_index) { t_value->data.i = pMsg->SamplingRate[ item_index]; t_value->datatype = INTEGER; } } else { BadFieldName( fieldname); } } /** * @name SmgrGetBufferedInd * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetBufferedInd( const respind *p_respind, const token *t_field, token *t_value) { static int32_t item_index = 0; static int32_t sample_index = 0; // absolute: FirstSampleIdx + relative sample index. sns_smgr_buffering_ind_msg_v01 *pMsg = ( sns_smgr_buffering_ind_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( t_field->subtype == KEYVALUE) { if ( strcmp( fieldname, get_literal( ITEM)) == 0) { if ( t_field->data.i >= pMsg->Indices_len) { RTErrorMsg( get_literal( BAD_INDEX)); } else { item_index = t_field->data.i; } } else if ( strcmp( fieldname, get_literal( SAMPLE)) == 0) { if ( t_field->data.i >= pMsg->Indices[ item_index].SampleCount) { RTErrorMsg( get_literal( BAD_INDEX)); } else { sample_index = (int32_t)pMsg->Indices[ item_index].FirstSampleIdx + t_field->data.i; } } else { BadFieldName( fieldname); } return; } if ( strcasecmp( fieldname, get_literal( ITEM)) == 0) { t_value->data.i = pMsg->Indices_len; // number of indices t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SAMPLE)) == 0) { t_value->data.i = pMsg->Indices[ item_index].SampleCount; // number of samples in item t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( REPORTID)) == 0) { t_value->data.i = pMsg->ReportId; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( INDTYPE)) == 0) { if ( pMsg->IndType_valid) { t_value->data.i = pMsg->IndType; t_value->datatype = INTEGER; } } /* ** sns_smgr_buffering_sample_index_s_v01 ** number of indices correspond to number of number of items. ** ------------------------------------------------------- */ else if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->Indices[ item_index].SensorId; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { t_value->data.i = pMsg->Indices[ item_index].DataType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SAMPLERATE)) == 0) { t_value->data.i = pMsg->Indices[ item_index].SamplingRate; t_value->datatype = INTEGER; } /* ** sns_smgr_buffering_sample_s_v01 ** ---------------------------- */ else if ( strcasecmp( fieldname, get_literal( DATAX)) == 0) { t_value->data.i = pMsg->Samples[ sample_index].Data[0]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATAY)) == 0) { t_value->data.i = pMsg->Samples[ sample_index].Data[1]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATAZ)) == 0) { t_value->data.i = pMsg->Samples[ sample_index].Data[2]; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( SSCTS)) == 0) { uint32_t sscts = pMsg->Indices[ item_index].FirstSampleTimestamp; uint32_t l_idx = pMsg->Indices[ item_index].FirstSampleIdx; while ( l_idx <= (uint32_t)sample_index) { sscts += pMsg->Samples[ l_idx].TimeStampOffset; l_idx++; } t_value->data.i = sscts; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( FLAGS)) == 0) { t_value->data.i = pMsg->Samples[ sample_index].Flags; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( QUALITY)) == 0) { t_value->data.i = pMsg->Samples[ sample_index].Quality; t_value->datatype = INTEGER; } else { BadFieldName( fieldname); } } /** * @name SmgrGetSelfTestInd * @brief get value of fieldname from the p_respind message * @param[i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[io] t_value - gets field value */ void SmgrGetSelfTestInd( const respind *p_respind, const token *t_field, token *t_value) { sns_smgr_single_sensor_test_ind_msg_v01 *pMsg = ( sns_smgr_single_sensor_test_ind_msg_v01 *) p_respind->msg_ptr; char *fieldname = t_field->pSymbol; if ( strcasecmp( fieldname, get_literal( SENSORID)) == 0) { t_value->data.i = pMsg->SensorID; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( DATATYPE)) == 0) { t_value->data.i = pMsg->DataType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( TESTTYPE)) == 0) { t_value->data.i = pMsg->TestType; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( TESTRESULT)) == 0) { t_value->data.i = pMsg->TestResult; t_value->datatype = INTEGER; } else if ( strcasecmp( fieldname, get_literal( ERRORCODE)) == 0) { if ( pMsg->ErrorCode_valid) { t_value->data.i = pMsg->ErrorCode; t_value->datatype = INTEGER; } } else { BadFieldName( fieldname); } } /* ** general form of getters are: ** get single value ** my ( $count) = slget( $all_resp, { info} ); ** get multiple values ** my ( $sensor_id, $sensor_name) = slget( $all_resp, { info.index, sensor_id, sensor_name}); */ /** * @name SmgrGetter * @brief get field values from the p_respind message * * @param[ i] p_respind * @param[i] t_field - KEYVALUE or fieldname SYMBOL * @param[ io] element */ void SmgrGetter( const respind *p_respind, const token *t_field, token *t_value) { // printf( "SmgrGetter\n"); SetTypes( t_value, VALUE, SCALAR, UNDEFINED); uint32_t service_number = p_respind->header.service_number; if ( service_number != SNS_SMGR_SVC_ID_V01) { FatalError( get_literal( BAD_SRVC_NUM)); } uint32_t msg_id = p_respind->header.msg_id; uint16_t msg_size = p_respind->header.msg_size; sensor1_msg_type_e msg_type = p_respind->msg_type; // printf( "SmgrGetter \'%s\'\n", fieldname); if ( msg_type == SENSOR1_MSG_TYPE_RESP) { if ( msg_id == SNS_SMGR_VERSION_RESP_V01) { ; } else if ( msg_id == SNS_SMGR_REPORT_RESP_V01) { SmgrGetReportResp( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_ALL_SENSOR_INFO_RESP_V01) { SmgrGetAllSensorInfoResp( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_SINGLE_SENSOR_INFO_RESP_V01) { SmgrGetSnglSensorInfoResp( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_SINGLE_SENSOR_TEST_RESP_V01) { SmgrGetSelfTestResp( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_BUFFERING_RESP_V01) { SmgrGetBufferedResp( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_BUFFERING_QUERY_RESP_V01) { ; } else { RTErrorMsg( get_literal( BAD_MSG_ID)); } } else if ( msg_type == SENSOR1_MSG_TYPE_IND) { if ( msg_id == SNS_SMGR_REPORT_IND_V01) { SmgrGetReportInd( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_BUFFERING_IND_V01) { SmgrGetBufferedInd( p_respind, t_field, t_value); } else if ( msg_id == SNS_SMGR_SINGLE_SENSOR_TEST_IND_V01) { SmgrGetSelfTestInd( p_respind, t_field, t_value); } else { RTErrorMsg( get_literal( BAD_MSG_ID)); } } } /** * @name SmgrInit */ void SmgrInit( void) { int svc_id = SNS_SMGR_SVC_ID_V01; service_toc[ svc_id].name = "smgr"; service_toc[ svc_id].new_req_func = (new_req)&SmgrNewReq; service_toc[ svc_id].set_req_func = (set_req)&SmgrSetReq; service_toc[ svc_id].getter_func = (get_func)&SmgrGetter; service_toc[ svc_id].req_msg[ SMGR_CANCEL].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_CANCEL].header.msg_id = SNS_SMGR_CANCEL_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_CANCEL].header.msg_size = 0; service_toc[ svc_id].req_msg[ SMGR_VERSION].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_VERSION].header.msg_id = SNS_SMGR_VERSION_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_VERSION].header.msg_size = 0; service_toc[ svc_id].req_msg[ SMGR_REPORT].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_REPORT].header.msg_id = SNS_SMGR_REPORT_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_REPORT].header.msg_size = sizeof( sns_smgr_periodic_report_ind_msg_v01); service_toc[ svc_id].req_msg[ SMGR_ALL_INFO].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_ALL_INFO].header.msg_id = SNS_SMGR_ALL_SENSOR_INFO_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_ALL_INFO].header.msg_size = 0; service_toc[ svc_id].req_msg[ SMGR_SNGL_INFO].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_SNGL_INFO].header.msg_id = SNS_SMGR_SINGLE_SENSOR_INFO_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_SNGL_INFO].header.msg_size = sizeof( sns_smgr_single_sensor_info_req_msg_v01); service_toc[ svc_id].req_msg[ SMGR_SELFTEST].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_SELFTEST].header.msg_id = SNS_SMGR_SINGLE_SENSOR_TEST_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_SELFTEST].header.msg_size = sizeof( sns_smgr_single_sensor_test_req_msg_v01); service_toc[ svc_id].req_msg[ SMGR_BUFFERED].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_BUFFERED].header.msg_id = SNS_SMGR_BUFFERING_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_BUFFERED].header.msg_size = sizeof( sns_smgr_buffering_req_msg_v01); service_toc[ svc_id].req_msg[ SMGR_BUF_QUERY].header.service_number = svc_id; service_toc[ svc_id].req_msg[ SMGR_BUF_QUERY].header.msg_id = SNS_SMGR_BUFFERING_QUERY_REQ_V01; service_toc[ svc_id].req_msg[ SMGR_BUF_QUERY].header.msg_size = sizeof( sns_smgr_buffering_query_req_msg_v01); }
[ "adithya.r02@outlook.com" ]
adithya.r02@outlook.com
49fb5ccb1db3e4955d0d14d243b9bfd3580fc6c5
97aab27d4410969e589ae408b2724d0faa5039e2
/SDK/EXES/INSTALL VISUAL 6 SDK/LEGACY/MSDN/SMPL/SMPL/MSDN/conf/4198/pop3/socket.c
7a10df48d342e8d26f88bdbf441c69b8e95d3819
[]
no_license
FutureWang123/dreamcast-docs
82e4226cb1915f8772418373d5cb517713f858e2
58027aeb669a80aa783a6d2cdcd2d161fd50d359
refs/heads/master
2021-10-26T00:04:25.414629
2018-08-10T21:20:37
2018-08-10T21:20:37
null
0
0
null
null
null
null
UTF-8
C
false
false
6,538
c
//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1993. // // File: pop3svr.c // // Contents: // // Classes: // // Functions: // // History: 1-9-95 DavidTr Created // //---------------------------------------------------------------------------- #include "pop3srvp.h" #pragma hdrstop extern BOOL bServiceTerminating; extern SOCKET sListener; #define POP3_PORT 110 PCHAR Welcome = "+OK Welcome to the NT Example POP3 Server (POP3SRV)\r\n"; BOOL AcceptClients ( HANDLE hCompletionPort ) /*++ Routine Description: This routine sets up a listening socket on the POP3 port, then loops accepting incoming connections from clients. Whenever it gets a connection, it sends the greeting message and starts a read on the newly connected socket. Arguments: hCompletionPort - the completion port that the POP3SRV worker threads are waiting on. Return Value: BOOL - FALSE if there was an error in starting the listening socket. --*/ { SOCKET s; SOCKADDR_IN sin; int err; BOOL bSuccess; PCLIENT_CONTEXT lpClientContext; DWORD dwBytesRead; int zero; // // Create a listening socket that we'll use to accept incoming // conections. // sListener = socket( AF_INET, SOCK_STREAM, 0 ); if ( sListener == INVALID_SOCKET ) { return FALSE; } // // Bind the socket to the POP3 well-known port. // sin.sin_family = AF_INET; sin.sin_port = htons( POP3_PORT ); sin.sin_addr.s_addr = INADDR_ANY; err = bind( sListener, (LPSOCKADDR)&sin, sizeof(sin) ); if ( err == SOCKET_ERROR ) { closesocket( sListener ); return FALSE; } // // Listen for incoming connections on the socket. // err = listen( sListener, 5 ); if ( err == SOCKET_ERROR ) { closesocket( sListener ); return FALSE; } // // Loop forever accepting connections from clients. // while ( TRUE ) { s = accept( sListener, NULL, NULL ); if ( s == INVALID_SOCKET ) { closesocket( sListener ); return FALSE; } // // If the service if terminating, exit this thread. // if ( bServiceTerminating ) { return FALSE; } // // Allocate a socket context for the new connection. We use // this context structure to track socket-level information // about the client. // lpClientContext = LocalAlloc( 0, sizeof(*lpClientContext) ); if ( lpClientContext == NULL ) { closesocket( s ); continue; } // // Initialize the context structure. // lpClientContext->Socket = s; lpClientContext->Context = CreatePop3Context( ); lpClientContext->Overlapped.Internal = 0; lpClientContext->Overlapped.InternalHigh = 0; lpClientContext->Overlapped.Offset = 0; lpClientContext->Overlapped.OffsetHigh = 0; lpClientContext->Overlapped.hEvent = NULL; // // Send the welcome banner. // err = send( s, Welcome, strlen(Welcome), 0 ); if ( err == SOCKET_ERROR ) { LocalFree( lpClientContext ); closesocket( s ); continue; } // --- DavidTr: Slide 14(a) ---------------------------------------- // // Associate the new socket with a completion port. // hCompletionPort = CreateIoCompletionPort( (HANDLE)s, hCompletionPort, (DWORD)lpClientContext, 0 ); if ( hCompletionPort == NULL ) { LocalFree( lpClientContext ); closesocket( s ); closesocket( sListener ); return FALSE; } // --- DavidTr: Slide 16 ------------------------------------------- // // Disable send bufferring on the socket. Setting SO_SNDBUF // to 0 causes winsock to stop bufferring sends and perform // sends directly from our buffers, thereby reducing CPU // usage. // zero = 0; err = setsockopt( s, SOL_SOCKET, SO_SNDBUF, (char *)&zero, sizeof(zero) ); if ( err == SOCKET_ERROR ) { LocalFree( lpClientContext ); closesocket( s ); closesocket( sListener ); return FALSE; } // // Start an overlapped read on the socket. This read will // complete in one of the worker threads, which will continue // processing of the client. // lpClientContext->LastClientIo = ClientIoRead; lpClientContext->BytesReadSoFar = 0; bSuccess = ReadFile( (HANDLE)s, lpClientContext->Buffer, sizeof(lpClientContext->Buffer), &dwBytesRead, &lpClientContext->Overlapped ); if ( !bSuccess && GetLastError( ) != ERROR_IO_PENDING ) { LocalFree( lpClientContext ); closesocket( s ); continue; } } } // AcceptClients VOID CloseClient ( PCLIENT_CONTEXT lpClientContext, BOOL bGraceful ) /*++ Routine Description: Terminates a connection with a client and frees up resources. Arguments: lpClientContext - a pointer to the context structure that contains information about this client. bGraceful - TRUE if the close should be graceful, FALSE otherwise. Return Value: None. --*/ { LINGER lingerStruct; // // If we're supposed to abort the connection, set the linger value // on the socket to 0. // if ( !bGraceful ) { lingerStruct.l_onoff = 1; lingerStruct.l_linger = 0; setsockopt( lpClientContext->Socket, SOL_SOCKET, SO_LINGER, (char *)&lingerStruct, sizeof(lingerStruct) ); } // // Now close the socket handle. This will do an abortive or // graceful close, as requested. // closesocket( lpClientContext->Socket ); // // Free context structuyres. // LocalFree( lpClientContext->Context ); LocalFree( lpClientContext ); return; } // CloseClient
[ "david.koch@9online.fr" ]
david.koch@9online.fr
f77fee9bd053d8c5395150d2a9cafaaf53c0512a
d0c79128bb131dd26741d87de29bf34d9c53384c
/libft/ft_lstpush.c
687fdbc2456f37c038292e2797ed8df83c404250
[]
no_license
Mhaddani/42
eb1bf4fe8ebe645300a7302be6e68efa66dfa469
d08cf6d453011c92af254c7034b07847064d7e29
refs/heads/master
2020-05-17T12:25:28.485981
2020-01-31T22:55:10
2020-01-31T22:55:10
183,709,871
0
0
null
null
null
null
UTF-8
C
false
false
1,226
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstpush.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: mhaddani <mhaddani@student.1337.ma> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/05/26 05:32:37 by mhaddani #+# #+# */ /* Updated: 2019/05/27 04:50:51 by mhaddani ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" size_t ft_lstpush(t_list **list, t_list *topush) { t_list *lst; size_t i; i = 1; if (topush) { if (!(*list)) { *list = topush; return (0); } else { lst = *list; while (lst->next) { lst = lst->next; i++; } lst->next = topush; } return (i); } else return (-1); }
[ "mouadhaddani@gmail.com" ]
mouadhaddani@gmail.com
05984bf9d2e5c872e2b98f0ff6991544024f0ad0
0b8672fb7e4d3f5ea97db939ad92fad6f9723d85
/libc/stdio/fgetpos.c
bfa78fe2aaae21bc547a35af761a658c667e7ad9
[ "BSD-2-Clause" ]
permissive
xinpengliu/firekylin
59034004cfe698ef0217e3bcb83fb9d087afff68
f3a140a807e9110bef81c744413da63d849dfe3b
refs/heads/master
2021-01-18T16:40:14.678440
2016-06-11T14:54:57
2016-06-11T14:54:57
null
0
0
null
null
null
null
UTF-8
C
false
false
196
c
/* * fgetpos.c - get the position in the file */ #include "stdio_loc.h" int fgetpos(FILE *stream, fpos_t *pos) { *pos = ftell(stream); if (*pos == -1) return -1; return 0; }
[ "ximoos@foxmail.com" ]
ximoos@foxmail.com
af1c922bec6f46d2782fe79af56c28614b16950e
6e32f5dde7906e3b60f46cf5818c6b839af15ce8
/Online Judge/SGU/ayq的sgu/SGU/393.c
8bd0a75ab23ea82e7070189eddc5e19b04122d4c
[]
no_license
mortal123/code-jam
4bbca2433d51218188435d2efbd21adfdd0903c8
403ae3caf35b1ef2bf93cccdfec0209a812cdf05
refs/heads/master
2021-01-23T13:57:36.364336
2014-11-28T10:41:47
2014-11-28T10:41:47
null
0
0
null
null
null
null
UTF-8
C
false
false
956
c
#include <stdio.h> long hash[500]={0},a[18]={0},rec[18]={0}; char str[51][5]={0}; long n,m,ans=14,flag=0; void dfs(long now,long max) { long i; if (max>=ans) return; if (now==m+1) { flag++; for (i=1;i<=n;i++) { if (hash[(a[str[i][0]]<<4)+a[str[i][1]]]==flag) return; hash[(a[str[i][0]]<<4)+a[str[i][1]]]=flag; } ans=max; for (i=1;i<=m;i++) rec[i]=a[i]; } else for (i=1;i<=max+1;i++) { a[now]=i; dfs(now+1,max+(i>max)); } } int main() { long i,j; scanf("%ld%ld\n",&m,&n); for (i=1;i<=n;i++) { scanf("%s",str[i]); str[i][0]-='a'-1; str[i][1]-='a'-1; } dfs(1,0); printf("%ld\n",ans); for (i=1;i<=ans;i++) { for (j=1;j<=m;j++) if (rec[j]==i) putchar(j+'a'-1); puts(""); } return 0; }
[ "lwhao2012@gmail.com" ]
lwhao2012@gmail.com
fa52b8145a5c61bb1246efac3c31033fc5dc39ad
d9db2195cf3f3f5090d3d9ee938e023ddd43b55d
/CadLib/Drawing/View/View.h
90aad1058a400ca184b729e8f8bc93801c264156
[]
no_license
radtek/AiPI
e3a31fbf34a695764a36855cb0fae1e9e48db9d8
732a21ba0707be1c01002dcbefba433c69d46e1b
refs/heads/master
2020-06-08T21:40:36.564225
2012-06-09T22:32:01
2012-06-09T22:32:01
null
0
0
null
null
null
null
WINDOWS-1252
C
false
false
2,407
h
/*-------------------------------------------------------------------*\ | CadLib Version 2.1 | | Written by Omid Shahabi <omid_shahabi@hotmail.com> | | Copyright © 2002-2004 | | Pars Technology Development Co. | | | | This software is distributed on an "AS IS" basis, WITHOUT WARRANTY | | OF ANY KIND, either express or implied. | | | | | | View.h | \*-------------------------------------------------------------------*/ #ifndef VIEW_H #define VIEW_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "..\MemDrw.h" // Definitions //--------------------------------------------------------------------------- // Structures //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Exported Functions //--------------------------------------------------------------------------- // Initialize Drawing BOOL drwInitView( HDRAWING hDrawing, // handle to the current DRAWING structure int x, // horizontal position of drawing window int y, // vertical position of drawing window int Width, // width of drawing window int Height // height of drawing window ); BOOL drwPaint( HDRAWING hDrawing, // handle to the current DRAWING structure HDC hdc // handle to view window DC ); // Functions for changing view properties BOOL drwGetViewProperties( HDRAWING hDrawing, // handle to the current DRAWING structure PVIEW pView // pointer to view properties structure ); BOOL drwSetViewProperties( HDRAWING hDrawing, // handle to the current DRAWING structure PVIEW pView // pointer to view properties structure ); // Zoom Functions BOOL drwGetDrawingBorder( HDRAWING hDrawing, // handle to the current DRAWING structure PREALRECT pRect // pointer to drawing boundary rect ); BOOL drwZoomExtents( HDRAWING hDrawing // handle to the current DRAWING structure ); #endif // VIEW_H
[ "malpharo1969" ]
malpharo1969
09cabd5df7ae1d279ade93a559377a83737b2439
14c728407561882aa2450938b2daf0fcb1e95d8e
/bsp-ti-omap-l137-std-platform/src/hardware/startup/lib/hw_ser8250.c
f2ff7df37a104227303c87b11620a7f8a5d37174
[]
no_license
Denis-chen/BSP_QNX
7020a9b08d5e519ef99399afa4e6f78aa4fe39e6
e5c0e2c7aa7f1fc98f831ad133bcfeec92bd58f2
refs/heads/master
2021-01-12T06:44:58.505893
2016-09-29T04:54:06
2016-09-29T04:54:06
null
0
0
null
null
null
null
UTF-8
C
false
false
2,753
c
/* * $QNXLicenseC: * Copyright 2008, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software 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 OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */ #include "startup.h" #include <hw/8250.h> /* * Drive an 8250 style serial chip. */ static void parse_line(unsigned channel, const char *line, unsigned long *baud, unsigned long *clk, unsigned long *div) { if(*line != '.' && *line != '\0') { dbg_device[channel].base = strtopaddr(line, (char **)&line, 16); if(*line == '^') dbg_device[channel].shift = strtoul(line+1, (char **)&line, 0); } if(*line == '.') ++line; if(*line != '.' && *line != '\0') *baud = strtoul(line, (char **)&line, 0); if(*line == '.') ++line; if(*line != '.' && *line != '\0') *clk = strtoul(line, (char **)&line, 0); if(*line == '.') ++line; if(*line != '.' && *line != '\0') *div = strtoul(line, (char **)&line, 0); } void init_8250(unsigned channel, const char *init, const char *defaults) { unsigned long baud; unsigned long div; unsigned long clk; paddr_t base; unsigned shift; baud = 0; parse_line(channel, defaults, &baud, &clk, &div); parse_line(channel, init, &baud, &clk, &div); base = dbg_device[channel].base; shift = dbg_device[channel].shift; chip_access(base, shift, 0, REG_MS); // Wait for all pending characters to be output... do { } while(!(chip_read8(REG_LS) & LSR_TSRE)); if(baud != 0) { unsigned count = clk / (baud * div); // Program divisor latch chip_write8(REG_LC, LCR_DLAB); chip_write8(REG_DL0, count & 0xff); chip_write8(REG_DL1, count >> 8); chip_write8(REG_LC, 0x03); } // 8 bits no parity chip_write8(REG_MC, (chip_read8(REG_MC) & 0xE4) | MCR_DTR|MCR_RTS|MCR_OUT2); chip_done(); } void put_8250(int c) { paddr_t base; unsigned shift; base = dbg_device[0].base; shift = dbg_device[0].shift; chip_access(base, shift, 0, REG_MS); do { } while(!(chip_read8(REG_LS) & LSR_TXRDY)); chip_write8(REG_TX, c); chip_done(); } __SRCVERSION("hw_ser8250.c $Rev: 392387 $");
[ "jiaweisun1976@gmail.com" ]
jiaweisun1976@gmail.com
7f3edcf9c66c96ea80dacbd2f8ae00813b2ffdd0
89286a75a0c7d8594ba28cf973295b4aa32c1793
/TestNDK/app/src/main/jni/jni_interface.h
bf29b5dd3dcd01e1e11c3735a1e04ee1085ee7f9
[]
no_license
penneyworth1/AndroidProjects
ebd6e044f4dfe4f06b1ac1da2daf16cbb1878c5f
249a0476b80d7ab36d45209751c2cf480e48e14e
refs/heads/master
2021-01-19T21:27:49.281365
2015-02-03T15:37:31
2015-02-03T15:37:31
28,069,885
0
0
null
null
null
null
UTF-8
C
false
false
146
h
#include <jni.h> #include <android/log.h> JNIEXPORT jstring JNICALL Java_com_dysonmobile_testndk_MainActivity_getNativeString(JNIEnv *, jobject);
[ "stevenstewart@Stevens-MacBook-Pro-3.local" ]
stevenstewart@Stevens-MacBook-Pro-3.local
23f23aa5d558035b96b21967a43afd7731aaa410
7c241eb1250ad2e979f75b09eb86a69fa0ba6031
/tags/release_2_3/src/ui/dialogs.c
fad5646fad7e6c8558a39e320649234f36bc647a
[]
no_license
mp-lee/pinmame
4e02b72691b6f8843e40ebedc1b7bf3a2049fd98
92f23ffdcb9f0b9c449c0f8ae8bf87f25101a877
refs/heads/master
2021-01-18T08:13:08.609969
2017-12-10T08:57:52
2017-12-10T08:57:52
52,010,521
0
0
null
null
null
null
UTF-8
C
false
false
16,218
c
/*************************************************************************** M.A.M.E.32 - Multiple Arcade Machine Emulator for Win32 Win32 Portions Copyright (C) 1997-2003 Michael Soderstrom and Chris Kirmse This file is part of MAME32, and may only be used, modified and distributed under the terms of the MAME license, in "readme.txt". By continuing to use, modify or distribute this file you indicate that you have read the license and understand and accept it fully. ***************************************************************************/ /*************************************************************************** dialogs.c Dialog box procedures go here ***************************************************************************/ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> #include <shellapi.h> #include <commctrl.h> #include <string.h> #include "bitmask.h" #include "TreeView.h" #include "M32Util.h" #include "resource.h" #include "directories.h" #include "options.h" #include "splitters.h" #include "help.h" #include "audit32.h" #include "screenshot.h" #include "mame32.h" #include "properties.h" #include "dialogs.h" #define FILTERTEXT_LEN 256 static char g_FilterText[FILTERTEXT_LEN]; #define NUM_EXCLUSIONS 9 /* Pairs of filters that exclude each other */ DWORD filterExclusion[NUM_EXCLUSIONS] = { IDC_FILTER_CLONES, IDC_FILTER_ORIGINALS, IDC_FILTER_NONWORKING, IDC_FILTER_WORKING, IDC_FILTER_UNAVAILABLE, IDC_FILTER_AVAILABLE, IDC_FILTER_RASTER, IDC_FILTER_VECTOR }; static void DisableFilterControls(HWND hWnd, LPFOLDERDATA lpFilterRecord, LPFILTER_ITEM lpFilterItem, DWORD dwFlags); static void EnableFilterExclusions(HWND hWnd, DWORD dwCtrlID); static DWORD ValidateFilters(LPFOLDERDATA lpFilterRecord, DWORD dwFlags); /***************************************************************************/ const char * GetFilterText(void) { return g_FilterText; } INT_PTR CALLBACK ResetDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { BOOL resetFilters = FALSE; BOOL resetGames = FALSE; BOOL resetUI = FALSE; BOOL resetDefaults = FALSE; switch (Msg) { case WM_INITDIALOG: return TRUE; case WM_HELP: /* User clicked the ? from the upper right on a control */ HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK : resetFilters = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_FILTERS)); resetGames = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_GAMES)); resetDefaults = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_DEFAULT)); resetUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_UI)); if (resetFilters || resetGames || resetUI || resetDefaults) { char temp[200]; strcpy(temp, MAME32NAME " will now reset the selected\n"); strcat(temp, "items to the original, installation\n"); strcat(temp, "settings then exit.\n\n"); strcat(temp, "The new settings will take effect\n"); strcat(temp, "the next time " MAME32NAME " is run.\n\n"); strcat(temp, "Do you wish to continue?"); if (MessageBox(hDlg, temp, "Restore Settings", IDOK) == IDOK) { if (resetFilters) ResetFilters(); if (resetUI) ResetGUI(); if (resetDefaults) ResetGameDefaults(); if (resetGames) ResetAllGameOptions(); EndDialog(hDlg, 1); return TRUE; } } /* Fall through if no options were selected * or the user hit cancel in the popup dialog. */ case IDCANCEL : EndDialog(hDlg, 0); return TRUE; } break; } return 0; } INT_PTR CALLBACK InterfaceDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { char pcscreenshot[100]; switch (Msg) { case WM_INITDIALOG: Button_SetCheck(GetDlgItem(hDlg,IDC_START_GAME_CHECK),GetGameCheck()); Button_SetCheck(GetDlgItem(hDlg,IDC_JOY_GUI),GetJoyGUI()); Button_SetCheck(GetDlgItem(hDlg,IDC_BROADCAST),GetBroadcast()); Button_SetCheck(GetDlgItem(hDlg,IDC_RANDOM_BG),GetRandomBackground()); Button_SetCheck(GetDlgItem(hDlg,IDC_SKIP_DISCLAIMER),GetSkipDisclaimer()); Button_SetCheck(GetDlgItem(hDlg,IDC_SKIP_GAME_INFO),GetSkipGameInfo()); Button_SetCheck(GetDlgItem(hDlg,IDC_HIGH_PRIORITY),GetHighPriority()); Button_SetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE),GetHideMouseOnStartup()); _itoa( GetCycleScreenshot(), pcscreenshot, 10); Edit_SetText(GetDlgItem(hDlg, IDC_CYCLETIMESEC), pcscreenshot); if( GetCycleScreenshot() <= 0 ) { Button_SetCheck(GetDlgItem(hDlg,IDC_CYCLE_SCREENSHOT),FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIME), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIMESEC), FALSE); } else { Button_SetCheck(GetDlgItem(hDlg,IDC_CYCLE_SCREENSHOT),TRUE); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIME), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TRUE); } Button_SetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger()); return TRUE; case WM_HELP: /* User clicked the ? from the upper right on a control */ HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_CYCLE_SCREENSHOT: { BOOL bCheck = Button_GetCheck(GetDlgItem(hDlg, IDC_CYCLE_SCREENSHOT)); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIME), bCheck); EnableWindow(GetDlgItem(hDlg, IDC_CYCLETIMESEC), bCheck); return TRUE; } case IDOK : { BOOL checked; SetGameCheck(Button_GetCheck(GetDlgItem(hDlg, IDC_START_GAME_CHECK))); SetJoyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_JOY_GUI))); SetBroadcast(Button_GetCheck(GetDlgItem(hDlg, IDC_BROADCAST))); SetRandomBackground(Button_GetCheck(GetDlgItem(hDlg, IDC_RANDOM_BG))); SetSkipDisclaimer(Button_GetCheck(GetDlgItem(hDlg, IDC_SKIP_DISCLAIMER))); SetSkipGameInfo(Button_GetCheck(GetDlgItem(hDlg, IDC_SKIP_GAME_INFO))); SetHighPriority(Button_GetCheck(GetDlgItem(hDlg, IDC_HIGH_PRIORITY))); SetHideMouseOnStartup(Button_GetCheck(GetDlgItem(hDlg,IDC_HIDE_MOUSE))); if (Button_GetCheck(GetDlgItem(hDlg,IDC_CYCLE_SCREENSHOT))) { Edit_GetText(GetDlgItem(hDlg, IDC_CYCLETIMESEC),pcscreenshot,sizeof(pcscreenshot)); SetCycleScreenshot(atoi(pcscreenshot)); } else { SetCycleScreenshot(0); } checked = Button_GetCheck(GetDlgItem(hDlg,IDC_STRETCH_SCREENSHOT_LARGER)); if (checked != GetStretchScreenShotLarger()) { SetStretchScreenShotLarger(checked); UpdateScreenShot(); } EndDialog(hDlg, 0); return TRUE; } case IDCANCEL : EndDialog(hDlg, 0); return TRUE; } break; } return 0; } INT_PTR CALLBACK FilterDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { static DWORD dwFilters; static LPFOLDERDATA lpFilterRecord; int i; switch (Msg) { case WM_INITDIALOG: { LPTREEFOLDER folder = GetCurrentFolder(); LPFILTER_ITEM g_lpFilterList = GetFilterList(); dwFilters = 0; if (folder != NULL) { char tmp[80]; Edit_SetText(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText); Edit_SetSel(GetDlgItem(hDlg, IDC_FILTER_EDIT), 0, -1); // Display current folder name in dialog titlebar _snprintf(tmp,sizeof(tmp),"Filters for %s Folder",folder->m_lpTitle); SetWindowText(hDlg, tmp); // Mask out non filter flags dwFilters = folder->m_dwFlags & F_MASK; // Find the matching filter record if it exists lpFilterRecord = FindFilter(folder->m_nFolderId); // initialize and disable appropriate controls for (i = 0; g_lpFilterList[i].m_dwFilterType; i++) { DisableFilterControls(hDlg, lpFilterRecord, &g_lpFilterList[i], dwFilters); } } SetFocus(GetDlgItem(hDlg, IDC_FILTER_EDIT)); return FALSE; } case WM_HELP: // User clicked the ? from the upper right on a control HelpFunction(((LPHELPINFO)lParam)->hItemHandle, MAME32CONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAME32CONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_COMMAND: { WORD wID = GET_WM_COMMAND_ID(wParam, lParam); WORD wNotifyCode = GET_WM_COMMAND_CMD(wParam, lParam); LPTREEFOLDER folder = GetCurrentFolder(); LPFILTER_ITEM g_lpFilterList = GetFilterList(); switch (wID) { case IDOK: dwFilters = 0; Edit_GetText(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText, FILTERTEXT_LEN); // see which buttons are checked for (i = 0; g_lpFilterList[i].m_dwFilterType; i++) { if (Button_GetCheck(GetDlgItem(hDlg, g_lpFilterList[i].m_dwCtrlID))) dwFilters |= g_lpFilterList[i].m_dwFilterType; } // Mask out invalid filters dwFilters = ValidateFilters(lpFilterRecord, dwFilters); // Keep non filter flags folder->m_dwFlags &= ~F_MASK; // put in the set filters folder->m_dwFlags |= dwFilters; EndDialog(hDlg, 1); return TRUE; case IDCANCEL: EndDialog(hDlg, 0); return TRUE; default: // Handle unchecking mutually exclusive filters if (wNotifyCode == BN_CLICKED) EnableFilterExclusions(hDlg, wID); } } break; } return 0; } INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_INITDIALOG: { HBITMAP hBmp; hBmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_ABOUT), IMAGE_BITMAP, 0, 0, LR_SHARED); SendMessage(GetDlgItem(hDlg, IDC_ABOUT), STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBmp); Static_SetText(GetDlgItem(hDlg, IDC_VERSION), GetVersionString()); } return 1; case WM_COMMAND: EndDialog(hDlg, 0); return 1; } return 0; } INT_PTR CALLBACK AddCustomFileDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { static LPTREEFOLDER default_selection = NULL; static int driver_index; switch (Msg) { case WM_INITDIALOG: { TREEFOLDER **folders; int num_folders; int i; TVINSERTSTRUCT tvis; TVITEM tvi; BOOL first_entry = TRUE; HIMAGELIST treeview_icons = GetTreeViewIconList(); HIMAGELIST hList; // current game passed in using DialogBoxParam() driver_index = lParam; hList = TreeView_SetImageList(GetDlgItem(hDlg,IDC_CUSTOM_TREE), treeview_icons, LVSIL_NORMAL); GetFolders(&folders,&num_folders); // should add "New..." // insert custom folders into our tree view for (i=0;i<num_folders;i++) { if (folders[i]->m_dwFlags & F_CUSTOM) { HTREEITEM hti; int jj; if (folders[i]->m_nParent == -1) { tvis.hParent = TVI_ROOT; tvis.hInsertAfter = TVI_SORT; tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.pszText = folders[i]->m_lpTitle; tvi.lParam = (LPARAM)folders[i]; tvi.iImage = GetTreeViewIconIndex(folders[i]->m_nIconId); tvi.iSelectedImage = 0; #if defined(__GNUC__) /* bug in commctrl.h */ tvis.item = tvi; #else tvis.DUMMYUNIONNAME.item = tvi; #endif hti = TreeView_InsertItem(GetDlgItem(hDlg,IDC_CUSTOM_TREE),&tvis); /* look for children of this custom folder */ for (jj=0;jj<num_folders;jj++) { if (folders[jj]->m_nParent == i) { HTREEITEM hti_child; tvis.hParent = hti; tvis.hInsertAfter = TVI_SORT; tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.pszText = folders[jj]->m_lpTitle; tvi.lParam = (LPARAM)folders[jj]; tvi.iImage = GetTreeViewIconIndex(folders[jj]->m_nIconId); tvi.iSelectedImage = 0; #if defined(__GNUC__) /* bug in commctrl.h */ tvis.item = tvi; #else tvis.DUMMYUNIONNAME.item = tvi; #endif hti_child = TreeView_InsertItem(GetDlgItem(hDlg,IDC_CUSTOM_TREE),&tvis); if (folders[jj] == default_selection) TreeView_SelectItem(GetDlgItem(hDlg,IDC_CUSTOM_TREE),hti_child); } } /*TreeView_Expand(GetDlgItem(hDlg,IDC_CUSTOM_TREE),hti,TVE_EXPAND);*/ if (first_entry || folders[i] == default_selection) { TreeView_SelectItem(GetDlgItem(hDlg,IDC_CUSTOM_TREE),hti); first_entry = FALSE; } } } } SetWindowText(GetDlgItem(hDlg,IDC_CUSTOMFILE_GAME), ModifyThe(drivers[driver_index]->description)); return TRUE; } case WM_COMMAND: switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK: { TVITEM tvi; tvi.hItem = TreeView_GetSelection(GetDlgItem(hDlg,IDC_CUSTOM_TREE)); tvi.mask = TVIF_PARAM; if (TreeView_GetItem(GetDlgItem(hDlg,IDC_CUSTOM_TREE),&tvi) == TRUE) { /* should look for New... */ default_selection = (LPTREEFOLDER)tvi.lParam; /* start here next time */ AddToCustomFolder((LPTREEFOLDER)tvi.lParam,driver_index); } EndDialog(hDlg, 0); return TRUE; break; } case IDCANCEL: EndDialog(hDlg, 0); return TRUE; } break; } return 0; } INT_PTR CALLBACK DirectXDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { HWND hEdit; const char *directx_help = MAME32NAME " requires DirectX version 3 or later, which is a set of operating\r\n" "system extensions by Microsoft for Windows 9x, NT and 2000.\r\n\r\n" "Visit Microsoft's DirectX web page at http://www.microsoft.com/directx\r\n" "download DirectX, install it, and then run " MAME32NAME " again.\r\n"; switch (Msg) { case WM_INITDIALOG: hEdit = GetDlgItem(hDlg, IDC_DIRECTX_HELP); Edit_SetSel(hEdit, Edit_GetTextLength(hEdit), Edit_GetTextLength(hEdit)); Edit_ReplaceSel(hEdit, directx_help); return 1; case WM_COMMAND: if (LOWORD(wParam) == IDB_WEB_PAGE) ShellExecute(GetMainWindow(), NULL, "http://www.microsoft.com/directx", NULL, NULL, SW_SHOWNORMAL); if (LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDB_WEB_PAGE) EndDialog(hDlg, 0); return 1; } return 0; } /*************************************************************************** private functions ***************************************************************************/ static void DisableFilterControls(HWND hWnd, LPFOLDERDATA lpFilterRecord, LPFILTER_ITEM lpFilterItem, DWORD dwFlags) { HWND hWndCtrl = GetDlgItem(hWnd, lpFilterItem->m_dwCtrlID); DWORD dwFilterType = lpFilterItem->m_dwFilterType; /* Check the appropriate control */ if (dwFilterType & dwFlags) Button_SetCheck(hWndCtrl, MF_CHECKED); /* No special rules for this folder? */ if (!lpFilterRecord) return; /* If this is an excluded filter */ if (lpFilterRecord->m_dwUnset & dwFilterType) { /* uncheck it and disable the control */ Button_SetCheck(hWndCtrl, MF_UNCHECKED); EnableWindow(hWndCtrl, FALSE); } /* If this is an implied filter, check it and disable the control */ if (lpFilterRecord->m_dwSet & dwFilterType) { Button_SetCheck(hWndCtrl, MF_CHECKED); EnableWindow(hWndCtrl, FALSE); } } // Handle disabling mutually exclusive controls static void EnableFilterExclusions(HWND hWnd, DWORD dwCtrlID) { int i; DWORD id; for (i = 0; i < NUM_EXCLUSIONS; i++) { // is this control in the list? if (filterExclusion[i] == dwCtrlID) { // found the control id break; } } // if the control was found if (i < NUM_EXCLUSIONS) { // find the opposing control id if (i % 2) id = filterExclusion[i - 1]; else id = filterExclusion[i + 1]; // Uncheck the other control Button_SetCheck(GetDlgItem(hWnd, id), MF_UNCHECKED); } } // Validate filter setting, mask out inappropriate filters for this folder static DWORD ValidateFilters(LPFOLDERDATA lpFilterRecord, DWORD dwFlags) { DWORD dwFilters; if (lpFilterRecord != (LPFOLDERDATA)0) { // Mask out implied and excluded filters dwFilters = lpFilterRecord->m_dwSet | lpFilterRecord->m_dwUnset; return dwFlags & ~dwFilters; } // No special cases - all filters apply return dwFlags; }
[ "maddes@6f51dfdd-75df-4273-8f3b-818b1e6aa8bf" ]
maddes@6f51dfdd-75df-4273-8f3b-818b1e6aa8bf
9043ed9506184ceb2d428df9f135041c4bb9fef4
77ab32239691c2f4ab6707cf1a62372cadd865bc
/task2_7/task2_7/task2_7.h
64b1a025f6e3af8f5f3f89972d539058bb1e4158
[]
no_license
Yuliia9/task2_7
acdd04d7bc7cacdbaf0510f59c3b47b0bad82754
ec201797c789fb850d2b59e3f78742bd42659a1a
refs/heads/master
2020-03-31T01:41:15.302295
2014-03-07T22:33:11
2014-03-07T22:33:11
null
0
0
null
null
null
null
UTF-8
C
false
false
2,208
h
/** * @file task2_7.h * @brief header file for task2_7.cpp defines data types and prototypes for functions used in task2_7.cpp */ #include "stdafx.h" const unsigned int LEN = 40; /*maximum length of characters for questions or answers*/ const unsigned int ANSWERS = 4; /*number of answers for question*/ /*defines data type for holding question, it's answers, number of correct answer and mark that shows if question was tested*/ struct test { char question[LEN]; char answers[ANSWERS][LEN]; unsigned int rigth_answer; unsigned int tested; }; /** * @brief This function displays general information about program to users * @param void * @return void */ void Interface(); /** * @brief Checking if data match requirements set to that data types or functions return values * @param [in] unsigned char retCode - return value of other functions for checking if functions ended properly [in] int val - number for checking if it's negative or zero * @return unsigned char Return ERROR if data doesn't match requirements Return SUCCESS if inputed data match requirements */ unsigned char Type_checking(unsigned char retCode, int val); /** * @brief Function for input questions and their answers in database * @param [in/out] struct test* tests - pointer to array of structures that holds questions and answers [in] unsigned int num - the number of questions in database * @return unsigned char Return ERROR if pointer to array of structures is NULL Return SUCCESS if data was inputed */ unsigned char Input(struct test* tests, unsigned int num); /** * @brief Function shows questions and their answers, checks user answer and if it's wrong, shows correct answer, after test shows the percentage of right answers * @param [in] struct test* tests - pointer to array of structures that holds questions and answers [in] unsigned int num - the number of questions in database * @return unsigned char Return ERROR if pointer to array of structures is NULL Return SUCCESS if test was conducted */ unsigned char Testing(struct test* tests, unsigned int num);
[ "ciopka9@gmail.com" ]
ciopka9@gmail.com
1ea1a7388d1a59ad21a7ca2e929f13cca59164f2
8b34ae5616f0c51399602399ce4a90a5ab6e6af6
/lab2-btree/src/random_tester_1.c
a0e8a4ee58c41295c10a7e96f4b97b91451d3f33
[]
no_license
rhymemime/Algorithms
9aa2a93bb29d11c6a9ad24365bb81119bfdce64e
f948906826a237ae5b81ab13d8208e291d504274
refs/heads/master
2022-04-11T03:02:18.811889
2020-03-26T19:27:19
2020-03-26T19:27:19
250,334,364
0
0
null
null
null
null
UTF-8
C
false
false
4,977
c
#include <stdio.h> #include <sys/stat.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include "b_tree.h" #include "jrb.h" void usage(char *s) { fprintf(stderr, "usage: random_tester_1 seed nevents key_size val_size tree_file input_file output_file\n"); if (s != NULL) fprintf(stderr, "%s\n", s); exit(1); } typedef struct { char *key; char *val; double rn; unsigned int lba; JRB dtree_ptr; } Entry; main(int argc, char **argv) { int nevents; int key_size; char *fn; long seed; struct stat sbuf; void *t; void *jd; char *ifn, *ofn; JRB random_tree, key_tree, tmp, tmp2; unsigned int lba; int ts; double d; int ks, vs, i, j, val_size; Entry *e, *e2; char val[JDISK_SECTOR_SIZE+1]; char buf[JDISK_SECTOR_SIZE*2]; char key[300]; FILE *f; if (argc != 8) usage(NULL); if (sscanf(argv[1], "%ld", &seed) == 0) usage("Bad Seed"); if (sscanf(argv[2], "%d", &nevents) == 0) usage("Bad Seed"); if (sscanf(argv[3], "%d", &key_size) == 0) usage("Bad Key Size"); if (sscanf(argv[4], "%d", &val_size) == 0) usage("Bad Val Size"); fn = argv[5]; ifn = argv[6]; ofn = argv[7]; srand48(seed); if (stat(fn, &sbuf) == 0) { t = b_tree_attach(fn); if (t == NULL) { perror(fn); exit(1); } if (b_tree_key_size(t) != key_size) { fprintf(stderr, "Error -- key_size (%d) doesn't match key_size in the file (%d)\n", key_size, b_tree_key_size(t)); exit(1); } } else { t = b_tree_create(fn, JDISK_SECTOR_SIZE * (nevents * 2), key_size); if (t == NULL) { perror(fn); exit(1); } } jd = b_tree_disk(t); random_tree = make_jrb(); key_tree = make_jrb(); ts = 0; if (strcmp(ifn, "-") != 0) { f = fopen(ifn, "r"); if (f == NULL) { perror(ifn); exit(1); } while (fgets(buf, JDISK_SECTOR_SIZE*2, f) != NULL) { if (sscanf(buf, "%lf %u %s %s", &d, &lba, key, val) != 4) { fprintf(stderr, "Bad input file format\n"); exit(1); } e = (Entry *) malloc(sizeof(Entry)); e->rn = d; e->key = (char *) calloc(key_size+1, sizeof(char)); e->lba = lba; strcpy(e->key, key); e->val = (char *) calloc(JDISK_SECTOR_SIZE+1, sizeof(char)); strcpy(e->val, val); e->dtree_ptr = jrb_insert_dbl(random_tree, e->rn, new_jval_v((void *) e)); jrb_insert_str(key_tree, e->key, new_jval_v((void *) e)); ts++; } fclose(f); } for (i = 0; i < nevents; i++) { if (ts == 0 || drand48() < .5) { e = (Entry *) malloc(sizeof(Entry)); e->rn = drand48(); e->key = (char *) calloc(key_size+1, sizeof(char)); e->val = (char *) calloc(JDISK_SECTOR_SIZE+1, sizeof(char)); ks = lrand48()%(key_size-1)+1; for (j = 0; j < ks; j++) e->key[j] = 'a' + (lrand48() %26); vs = lrand48()%(val_size)+1; for (j = 0; j < vs; j++) e->val[j] = 'a' + (lrand48() %26); e->lba = b_tree_insert(t, e->key, e->val); printf("I %s %s\n", e->key, e->val); fflush(stdout); tmp = jrb_find_str(key_tree, e->key); if (tmp != NULL) { e2 = tmp->val.v; if (e->lba != e2->lba) { printf("Problem at event %d.\n", i); printf(" Key %s already in tree.\n", e->key); printf(" Old lba: %d. Returned lba: %d\n", e2->lba, e->lba); } jrb_delete_node(e2->dtree_ptr); free(e2->key); free(e2->val); free(e2); jrb_delete_node(tmp); ts--; } jrb_insert_str(key_tree, e->key, new_jval_v((void *) e)); e->dtree_ptr = jrb_insert_dbl(random_tree, e->rn, new_jval_v((void *) e)); ts++; } else { tmp = jrb_find_gte_dbl(random_tree, drand48(), &j); if (tmp == random_tree) tmp = random_tree->flink; e = (Entry *) tmp->val.v; printf("F %s\n", e->key); fflush(stdout); j = b_tree_find(t, e->key); if (e->lba != j) { printf("Problem at event %d.\n", i); printf(" Key %s should have lba %d.\n", e->key, e->lba); printf(" However, b_tree_find() returned %d.\n", j); exit(1); } jdisk_read(jd, e->lba, val); val[JDISK_SECTOR_SIZE] = '\0'; if (strcmp(val, e->val) != 0) { printf("Problem at event %d.\n", i); printf(" Val should be %s\n", e->val); printf(" But it is %s\n", val); exit(1); } if (memcmp(val, e->val, JDISK_SECTOR_SIZE) != 0) { printf("Problem at event %d.\n", i); printf(" Bytes after the two val strings don't equal each other.\n"); exit(1); } } } if (strcmp(ofn, "-") != 0) { f = fopen(ofn, "w"); if (f == NULL) { perror(ofn); exit(1); } jrb_traverse(tmp, random_tree) { e = (Entry *) tmp->val.v; fprintf(f, "%.12lf %u %s %s\n", e->rn, e->lba, e->key, e->val); } fclose(f); } printf("Reads: %ld\n", jdisk_reads(jd)); printf("Writes: %ld\n", jdisk_writes(jd)); exit(0); }
[ "bramsey967@gmail.com" ]
bramsey967@gmail.com
89adb1f37c55d85f09fa3d43d7c08736feed8ae7
72f22d42439f1d863ec31854cb8003297b8b57de
/src/main/c/app.c
52c13f0c496383800b3151731abc0cc13f027289
[ "BSD-3-Clause" ]
permissive
wangbj/gradle-clib-test
08271e1f8f458207c7894d5c04eb25ce7b2bb4dd
f1fe32baa590bb945f90be52a8f2126058fa6af5
refs/heads/master
2020-03-18T07:26:59.587642
2018-05-23T00:30:58
2018-05-23T00:30:58
134,453,418
0
0
null
null
null
null
UTF-8
C
false
false
185
c
#include <time.h> #include <time.h> #include <stdio.h> int main(int argc, char* argv[]) { time_t t; memset(&t, 0, sizeof(t)); printf("%s\n", ctime(&t)); return 0; }
[ "wangbj@gmail.com" ]
wangbj@gmail.com
45554fce742566d4a565e9e0126c66f200cccf1c
dcf26a6bcf853a3f8f6f50f9379998ef4d8aad40
/foundation/appexecfwk/interfaces/kits/bundle_lite/bundle_status_callback.h
765779e1460965951236e64ccfc50b70222a5d30
[]
no_license
small-seven/testmem
c5f3202dce1c369e9d84cdaaccc2008b827c16d8
2771460c617439bd1be562ffdc94543ea170a736
refs/heads/main
2023-03-12T22:16:28.824577
2021-03-03T04:24:59
2021-03-03T04:24:59
343,847,762
1
0
null
null
null
null
UTF-8
C
false
false
2,205
h
/* * Copyright (c) 2020 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_BUNDLE_STATUS_CALLBACK_H #define OHOS_BUNDLE_STATUS_CALLBACK_H /** * @brief Called when the installation, update, or uninstallation state of an application changes. * * This callback can be registered or unregistered through {@link RegisterCallback} or * {@link UnregisterCallback} to monitor the installation, update, and uninstallation state changes of * applications in the system. * @param installType Indicates the installation, update, or uninstallation state. The value <b>0</b> indicates that * the application is being installed or updated, and <b>1</b> indicates that the application is * being uninstalled. * @param resultCode Indicates the status code returned for the application installation, update, or uninstallation * result. For details, see {@link AppexecfwkErrors}. * @param resultMessage Indicates the result message returned with the status code. * @param bundleName Indicates the name of the bundle whose state has changed. * * @since 1.0 * @version 1.0 */ typedef void (*BundleStateCallback)(const uint8_t installType, const uint8_t resultCode, const void *resultMessage, const char *bundleName, void *data); typedef struct { char *bundleName; void *data; BundleStateCallback callBack; } BundleStatusCallback; #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif // __cplusplus void ClearBundleStatusCallback(BundleStatusCallback *bundleStatusCallback); #ifdef __cplusplus #if __cplusplus } #endif #endif // __cplusplus #endif // OHOS_BUNDLE_STATUS_CALLBACK_H
[ "huihuigong@users.noreply.github.com" ]
huihuigong@users.noreply.github.com
85b51ef151263fcfd7f018aba0d1de55d2b96908
adec2b056d3c7b078eedabe3becc2a4c851407ad
/.svn/pristine/85/85b51ef151263fcfd7f018aba0d1de55d2b96908.svn-base
94194a60ca552d0b50d4baee1ae3621bc3de6882
[]
no_license
edithwuly/SJTU_ICSlab
a749ee5f424f4de1675bbdfa080b7b89c57e4d0d
a2e92b38c93d4fb4b09a0160989df963c5f65ca9
refs/heads/master
2020-04-10T21:09:58.844768
2018-12-11T06:41:59
2018-12-11T06:41:59
161,288,721
0
0
null
null
null
null
UTF-8
C
false
false
10,389
/* * CS:APP Data Lab * * bits.c - Source file with your solutions to the Lab. * This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header; it confuses the dlc * compiler. You can still use printf for debugging without including * <stdio.h>, although you might get a compiler warning. In general, * it's not good practice to ignore compiler warnings, but in this * case it's OK. */ #include "btest.h" #include <limits.h> /* * Instructions to Students: * * STEP 1: Fill in the following struct with your identifying info. */ team_struct team = { "516030910252", "WU Lianyi", "516030910252", "", "" }; #if 0 /* * STEP 2: Read the following instructions carefully. */ You will provide your solution to the Data Lab by editing the collection of functions in this source file. CODING RULES: Replace the "return" statement in each function with one or more lines of C code that implements the function. Your code must conform to the following style: int Funct(arg1, arg2, ...) { /* brief description of how your implementation works */ int var1 = Expr1; ... int varM = ExprM; varJ = ExprJ; ... varN = ExprN; return ExprR; } Each "Expr" is an expression using ONLY the following: 1. Integer constants 0 through 255 (0xFF), inclusive. You are not allowed to use big constants such as 0xffffffff. 2. Function arguments and local variables (no global variables). 3. Unary integer operations ! ~ 4. Binary integer operations & ^ | + << >> Some of the problems restrict the set of allowed operators even further. Each "Expr" may consist of multiple operators. You are not restricted to one operator per line. You are expressly forbidden to: 1. Use any control constructs such as if, do, while, for, switch, etc. 2. Define or use any macros. 3. Define any additional functions in this file. 4. Call any functions. 5. Use any other operations, such as &&, ||, -, or ?: 6. Use any form of casting. You may assume that your machine: 1. Uses 2s complement, 32-bit representations of integers. 2. Performs right shifts arithmetically. 3. Has unpredictable behavior when shifting an integer by more than the word size. EXAMPLES OF ACCEPTABLE CODING STYLE: /* * pow2plus1 - returns 2^x + 1, where 0 <= x <= 31 */ int pow2plus1(int x) { /* exploit ability of shifts to compute powers of 2 */ return (1 << x) + 1; } /* * pow2plus4 - returns 2^x + 4, where 0 <= x <= 31 */ int pow2plus4(int x) { /* exploit ability of shifts to compute powers of 2 */ int result = (1 << x); result += 4; return result; } NOTES: 1. Use the dlc (data lab checker) compiler (described in the handout) to check the legality of your solutions. 2. Each function has a maximum number of operators (! ~ & ^ | + << >>) that you are allowed to use for your implementation of the function. The max operator count is checked by dlc. Note that '=' is not counted; you may use as many of these as you want without penalty. 3. Use the btest test harness to check your functions for correctness. 4. The maximum number of ops for each function is given in the header comment for each function. If there are any inconsistencies between the maximum ops in the writeup and in this file, consider this file the authoritative source. #endif /* * STEP 3: Modify the following functions according the coding rules. * * IMPORTANT. TO AVOID GRADING SURPRISES: * 1. Use the dlc compiler to check that your solutions conform * to the coding rules. * 2. Use the btest test harness to check that your solutions produce * the correct answers. Watch out for corner cases around Tmin and Tmax. */ /* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header is separate from features.h so that the compiler can include it implicitly at the start of every compilation. It must not itself include <features.h> or any other header that includes <features.h> because the implicit include comes before any feature test macros that may be defined in a source file before it first explicitly includes a system header. GCC knows the name of this header in order to preinclude it. */ /* glibc's intent is to support the IEC 559 math functionality, real and complex. If the GCC (4.9 and later) predefined macros specifying compiler intent are available, use them to determine whether the overall intent is to support these features; otherwise, presume an older compiler has intent to support these features and define these macros by default. */ /* wchar_t uses Unicode 9.0.0. Version 9.0 of the Unicode Standard is synchronized with ISO/IEC 10646:2014, fourth edition, plus Amd. 1 and Amd. 2 and 273 characters from forthcoming 10646, fifth edition. (Amd. 2 was published 2016-05-01, see https://www.iso.org/obp/ui/#iso:std:iso-iec:10646:ed-4:v1:amd:2:v1:en) */ /* We do not support C11 <threads.h>. */ /* * bang - Compute !x without using ! * Examples: bang(3) = 0, bang(0) = 1 * Legal ops: ~ & ^ | + << >> * Max ops: 12 * Rating: 4 */ int bang(int x) { return (~((x|(~x+1))>>31))&0x1; } /* * bitCount - returns count of number of 1's in word * Examples: bitCount(5) = 2, bitCount(7) = 3 * Legal ops: ! ~ & ^ | + << >> * Max ops: 40 * Rating: 4 */ int bitCount(int x) { int mask=0x11|(0x11<<8)|(0x11<<16)|(0x11<<24); int sum=(x&mask)+((x>>1)&mask)+((x>>2)&mask)+((x>>3)&mask); sum=sum+(sum>>16); mask=0xF|(0xF<<8); sum=(sum&mask)+((sum>>4)&mask); return (sum+(sum>>8))&0x3F; } /* * copyLSB - set all bits of result to least significant bit of x * Example: copyLSB(5) = 0xFFFFFFFF, copyLSB(6) = 0x00000000 * Legal ops: ! ~ & ^ | + << >> * Max ops: 5 * Rating: 2 */ int copyLSB(int x) { return (x<<31)>>31; } /* * divpwr2 - Compute x/(2^n), for 0 <= n <= 30 * Round toward zero * Examples: divpwr2(15,1) = 7, divpwr2(-33,4) = -2 * Legal ops: ! ~ & ^ | + << >> * Max ops: 15 * Rating: 2 */ int divpwr2(int x, int n) { return (x+(((x>>31)&0x1)<<n)+~((x>>31)&0x1)+1)>>n; } /* * evenBits - return word with all even-numbered bits set to 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 8 * Rating: 2 */ int evenBits(void) { return (85<<24)+(85<<16)+(85<<8)+85; } /* * fitsBits - return 1 if x can be represented as an * n-bit, two's complement integer. * 1 <= n <= 32 * Examples: fitsBits(5,3) = 0, fitsBits(-4,3) = 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 15 * Rating: 2 */ int fitsBits(int x, int n) { return (!(x>>(n+~1+1)))|(!(~(x>>(n+~1+1)))); } /* * getByte - Extract byte n from word x * Bytes numbered from 0 (LSB) to 3 (MSB) * Examples: getByte(0x12345678,1) = 0x56 * Legal ops: ! ~ & ^ | + << >> * Max ops: 6 * Rating: 2 */ int getByte(int x, int n) { return (x>>(n<<3))&0xFF; } /* * isGreater - if x > y then return 1, else return 0 * Example: isGreater(4,5) = 0, isGreater(5,4) = 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 24 * Rating: 3 */ int isGreater(int x, int y) { return ((!((x>>31)^(y>>31)))&((y+~x+1)>>31))|((!(x>>31))&(y>>31)); } /* * isNonNegative - return 1 if x >= 0, return 0 otherwise * Example: isNonNegative(-1) = 0. isNonNegative(0) = 1. * Legal ops: ! ~ & ^ | + << >> * Max ops: 6 * Rating: 3 */ int isNonNegative(int x) { return !(x>>31); } /* * isNotEqual - return 0 if x == y, and 1 otherwise * Examples: isNotEqual(5,5) = 0, isNotEqual(4,5) = 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 6 * Rating: 2 */ int isNotEqual(int x, int y) { return !!(x^y); } /* * isPower2 - returns 1 if x is a power of 2, and 0 otherwise * Examples: isPower2(5) = 0, isPower2(8) = 1, isPower2(0) = 0 * Note that no negative number is a power of 2. * Legal ops: ! ~ & ^ | + << >> * Max ops: 60 * Rating: 4 */ int isPower2(int x) { return (!!x)&(!(x>>31))&(!(x&(x+~1+1))); } /* * leastBitPos - return a mask that marks the position of the * least significant 1 bit. If x == 0, return 0 * Example: leastBitPos(96) = 0x20 * Legal ops: ! ~ & ^ | + << >> * Max ops: 6 * Rating: 4 */ int leastBitPos(int x) { return (~x+1)&x; } /* * logicalShift - shift x to the right by n, using a logical shift * Can assume that 1 <= n <= 31 * Examples: logicalShift(0x87654321,4) = 0x08765432 * Legal ops: ~ & ^ | + << >> * Max ops: 16 * Rating: 3 */ int logicalShift(int x, int n) { return (x>>n)&((1<<(32+~n+1))+~0); } /* * satAdd - adds two numbers but when positive overflow occurs, returns * maximum possible value, and when negative overflow occurs, * it returns minimum positive value. * Examples: satAdd(0x40000000,0x40000000) = 0x7fffffff * satAdd(0x80000000,0xffffffff) = 0x80000000 * Legal ops: ! ~ & ^ | + << >> * Max ops: 30 * Rating: 4 */ int satAdd(int x, int y) { int signX=(x>>31)&0x1; int signY=(y>>31)&0x1; int z=x+y; int signZ=(z>>31)&0x1; int sign1=(!(signX^signY))&(signX^signZ); int sign=sign1<<31; int sign_=sign|(sign+~sign1+1); return (~sign_&z)|(sign_&(sign+~0+!signZ)); } /* * tc2sm - Convert from two's complement to sign-magnitude * where the MSB is the sign bit * You can assume that x > TMin * Example: tc2sm(-5) = 0x80000005. * Legal ops: ! ~ & ^ | + << >> * Max ops: 15 * Rating: 4 */ int tc2sm(int x) { return ((x>>31)<<31)|((x+(x>>31))^(x>>31)); }
[ "wulianyi1998@sjtu.edu.cn" ]
wulianyi1998@sjtu.edu.cn
e67c42c83ab2bc4fb6b290df81c742646b89d43b
ae6c5972728ccef49c28edb57fa81af940d4518b
/Project-Cheesecake/source/application/PWR/PWR.h
1088909f752faa605cbdcf88da4e385b8f03a009
[]
no_license
kaneofawesome/UMBUG
ed9024999f7cc3a18aa639edcbdf56988772b2f4
027c514df6c41fe72eddc3364deae44cbc4618bf
refs/heads/master
2021-01-13T01:31:23.765496
2017-12-13T15:36:50
2017-12-13T15:36:50
5,910,695
0
0
null
null
null
null
UTF-8
C
false
false
605
h
#ifndef PWR_H #define PWR_H #include <stdio.h> #include "../../system/System.h" #include "../CDH/CDHApplication.h" typedef enum{ COM, PLD1, PLD2 }SubsystemsToControlPowerTo; typedef enum{ subsON, subsOFF }SubsBool; void readbatterystate(Battery); void turn_on_off_subsystems(void); void voltage_comp(void); void current_comp(void); void initialize_pwr(void); void pwr_routine(void); void set_power_from_subsystem(SubsystemsToControlPowerTo, SubsBool); void cut_power_from_subsystem(SubsystemsToControlPowerTo); void add_power_to_subsystem(SubsystemsToControlPowerTo); #endif /*PWR_H*/
[ "kane.g.anderson@gmail.com" ]
kane.g.anderson@gmail.com
08e262ae605c541d31cd1d2863b793f988a2c99a
cfe59d8b6c4e989bbefb4a8629bed4c9a721fd99
/trunk/EZMacPRO_stack/timerInt.c
4bb0a6a8c5dc564825f10c5cf455d456dcee662f
[]
no_license
BGCX262/zsz-8051-freertos-svn-to-git
d645c027dbccd0db14eb50149a1ecd6a4a53596a
c12c4312581bde5f5e5a0524934753a362e28c50
refs/heads/master
2018-12-28T19:24:27.583820
2015-08-23T06:47:18
2015-08-23T06:47:18
41,253,353
0
0
null
null
null
null
UTF-8
C
false
false
53,891
c
//================================================================================================ // timerInt.c //================================================================================================ // Copyright 2010 Silicon Laboratories, Inc. // http://www.silabs.com // // C File Description: // // Target: // Any Silicon Labs C8051 MCU. // // IDE: // Silicon Laboratories IDE version 3.3 // // Tool Chains: // Keil // c51.exe version 8.0.8 // bl51.exe version 6.0.5 // SDCC // sdcc.exe version 2.8.0 // aslink.exe version 1.75 // // Project Name: // EZMacPro stack // // Release 2.0 // - Official release the new EZMacPro stack with Frequency Hopper extension // // This software must be used in accordance with the End User License Agreement. // //================================================================================================ //--------------------------------------------------------------------------------------------------- // Includes // // These includes must be in a specific order. Dependencies listed in comments. //--------------------------------------------------------------------------------------------------- #include "compiler_defs.h" #include "si4432_v2.h" // #include "hardware_defs.h" // requires compiler_defs.h #include "timerInt.h" // requires compiler_defs.h #include "EZMacPro_defs.h" #include "EZMacPro.h" // requires EZMacPro_defs.h #include "EZMacProCallBack.h" // requires compiler_defs.h //--------------------------------------------------------------------------------------------------- // // local function prototypes // //--------------------------------------------------------------------------------------------------- void timerIntTX_StateMachine (U8); void timerIntRX_StateMachine (U8); void timerIntWakeUp (void); void timerIntSpiWriteReg (U8, U8); U8 timerIntSpiReadReg (U8); void timerIntTimeout (U32); U8 timerIntRandom (void); void timerIntNextRX_Channel(void); #ifdef FOUR_CHANNEL_IS_USED void timerIntIncrementError (U8); #endif//FOUR_CHANNEL_IS_USED void timerIntGotoNextStateUsingSECR(U8); U8 timerIntHeaderError(void); U8 timerIntBadAddrError(void); U8 HopNextChannel(void); void timerIntSetEnable2(U8); void timerIntSetFunction1(U8); void timerIntTouch (void); // added for library support //--------------------------------------------------------------------------------------------------- // // local variables // //--------------------------------------------------------------------------------------------------- SEGMENT_VARIABLE(ChannelOccupiedInStartPeriod, U8, EZMAC_PRO_GLOBAL_MSPACE); SEGMENT_VARIABLE(ChannelOccupiedCounter, U8, EZMAC_PRO_GLOBAL_MSPACE); //------------------------------------------------------------------------------------------------ // Function Name // timerIntT0_ISR() // // Return Value : None // Parameters : None // // This is the Interrupt Service Routing for the T0 timer. The T0 timer is used for all MAC // time outs and MAC timing events. The T0 time base uses SYSCLK/4 for all supported SYSCLK // frequencies. The time outs are calculated using macros or calculated by the initialization // or register write API functions. Since some time outs require long periods a 24-bit timer // has been implemented using a global variable for the most significant byte. If the MSB of the // timer (EZMacProTimerMSB) is non-zero, it will be decrement and the ISR will be called again // when the timer overflows. // // This function disables the timer interrupts before executing the state machines. If a // timeout event is to initiate another timeout event, the timerIntTimeout() function should // be used. // // The Basic States (Wake-up, Receive, and Transmit) are implemented using if..else if bit // tests for the corresponding bit in the master control register. The detailed TX and RX // state machines are implemented in separate functions. // // Conditional compile time switches remove the TX or RX state machines for the RX only and // and TX only builds. // // The timer interrupt should not call functions from other modules. This would create cause // a multiple call to segment warning and result in poor RAM usage. // //----------------------------------------------------------------------------------------------- INTERRUPT(timerIntT0_ISR, INTERRUPT_TIMER0) { U8 state; if(EZMacProTimerMSB == 0) { DISABLE_MAC_TIMER_INTERRUPT(); STOP_MAC_TIMER(); CLEAR_MAC_TIMER_INTERRUPT(); state = EZMacProReg.name.MSR & 0x0F; if( EZMacProReg.name.MSR == EZMAC_PRO_WAKE_UP) {//if the MAC is in Wake up state call the WakeUp function timerIntWakeUp(); } #ifndef RECEIVER_ONLY_OPERATION else if((EZMacProReg.name.MSR & TX_STATE_BIT) == TX_STATE_BIT) {//if the MAC is in transmit state then call the transmit state machine timerIntTX_StateMachine(state); } #endif #ifndef TRANSMITTER_ONLY_OPERATION else if((EZMacProReg.name.MSR & RX_STATE_BIT) == RX_STATE_BIT) {//if the MAC is in receive state then call the receiver timerIntRX_StateMachine(state); } #endif else { } } else { EZMacProTimerMSB--; } } //------------------------------------------------------------------------------------------------ // Function Name // timerIntWakeUp() // // Return Value : None // Parameters : None // // The EZMAC_PRO_WAKE_UP state is used when starting the radio XTAL after sleep mode or when // resetting the radio using a SW Reset SPI command. // // If this function is called, the crystal has failed to start with the specified time. This // indicates are hardware problem. Either the crystal is not connect, the SDN/ is asserted, // or the radio is not powered. // //----------------------------------------------------------------------------------------------- void timerIntWakeUp (void) { // SWRESET timeout error DISABLE_MAC_INTERRUPTS(); //call the woke - up error callback function EZMacPRO_WokeUp_Error(); //go to WAKE UP ERROR state EZMacProReg.name.MSR = WAKE_UP_ERROR; } //------------------------------------------------------------------------------------------------ // Function Name // timerIntTX_StateMachine() // // Return Value : None // Parameters : U8 state - TX state, least significant nibble of MSR // // This function implements the detailed TX state machine. The state machine is implemented // using switch...case... statements. For efficient compilation, the states are a series // of sequential continuous integers (no missing values). The states are enumerated in the // EZMacPro.h header file. // // Conditional compile time switches remove the unused TX states if LBT of ACK is not supported. // These states are also removed from the enumeration at the begriming or end of the list. // // Conditional compile time switches remove this entire function for the Receiver only build. // //----------------------------------------------------------------------------------------------- #ifndef RECEIVER_ONLY_OPERATION void timerIntTX_StateMachine (U8 state) { #ifdef TRANSCIEVER_OPERATION U32 timeout; #endif//TRANSCIEVER_OPERATION #ifdef ANTENNA_DIVERSITY_ENABLED #ifndef B1_ONLY U8 temp8; #endif//B1_ONLY #endif//ANTENNA_DIVERSITY_ENABLED switch (state) { #ifdef TRANSCIEVER_OPERATION case TX_STATE_LBT_START_LISTEN: if(BusyLBT == 0) {//the channel was free during the first 0.5ms ChannelOccupiedInStartPeriod = 0; // start timer with fix 4.5ms timeout timerIntTimeout(LBT_FIXED_TIME_4500US); // go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_LISTEN; // disable the reciever timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channnel was busy during the first 0.5ms BusyLBT = 0; ChannelOccupiedInStartPeriod = 1; ChannelOccupiedCounter = 0; // start timer with fix 1ms timeout timerIntTimeout(LBT_FIXED_TIME_1000US); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_LISTEN; // disable the reciever timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } break; case TX_STATE_LBT_LISTEN: if (ChannelOccupiedInStartPeriod == 0) {//the channel was free during the 0.5ms start period if(BusyLBT == 0) {// LBT passed, channel should be clear in the fix 4.5ms period //disable the receiver timerIntSetFunction1(SI4432_XTON); // clear enable 2 interrupt timerIntSetEnable2(0x00); // enable ENPKSENT bit timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKSENT); // enable TX timerIntSetFunction1( SI4432_TXON|SI4432_XTON); // start timer with transmit packet timeout timerIntTimeout(TimeoutTX_Packet); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_WAIT_FOR_TX; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 4.5ms BusyLBT = 0; // multiple by fixed plus random number timeout = LBT_FIXED_TIME_5000US + TimeoutLBTI * (U32)(timerIntRandom()); // start timer with timeout timerIntTimeout(timeout); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_RANDOM_LISTEN; // disable the reciever timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } } else {//the channel was busy during the 0.5ms start period if(BusyLBT == 0) {// LBT passed, channel should be clear in the fix 1ms period // multiple by fixed plus random number timeout = LBT_FIXED_TIME_5000US + TimeoutLBTI * (U32)(timerIntRandom()); // start timer with timeout timerIntTimeout(timeout); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_RANDOM_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy in the fix 1ms period if (ChannelOccupiedCounter < 9) { BusyLBT = 0; ChannelOccupiedCounter++; // start timer with fix 1ms timeout timerIntTimeout(LBT_FIXED_TIME_1000US); // go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_LISTEN; // disable the reciever timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 10*1ms BusyLBT = 0; EZMacProLBT_Retrys++; if(EZMacProLBT_Retrys < MAX_LBT_RETRIES) {//the channel was busy and the retries didn't reach the maximum value // disable the reciever timerIntSetFunction1(SI4432_XTON); // start timer with fix ETSI timeout timerIntTimeout(TIMEOUT_LBTI_ETSI); // go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_START_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); } else {//the channel was busy and the retries reach the maximum value //disable the receiver timerIntSetFunction1(SI4432_XTON); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_ERROR_CHANNEL_BUSY; #ifdef FOUR_CHANNEL_IS_USED //increment error counter timerIntIncrementError(EZMAC_PRO_ERROR_CHANNEL_BUSY); #endif //FOUR_CHANNEL_IS_USED //call the LBT error callback function EZMacProTX_ErrorLBT_Timeout(); } } } } break; case TX_STATE_LBT_RANDOM_LISTEN: if(BusyLBT == 0) {// the channel was free during the 5ms + random period //disable the receiver timerIntSetFunction1(SI4432_XTON); // clear enable 2 interrupt timerIntSetEnable2(0x00); // enable ENPKSENT bit timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKSENT); // enable TX timerIntSetFunction1( SI4432_TXON|SI4432_XTON); // start timer with transmit packet timeout timerIntTimeout(TimeoutTX_Packet); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_WAIT_FOR_TX; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 5ms + random period BusyLBT = 0; EZMacProLBT_Retrys++; if(EZMacProLBT_Retrys < MAX_LBT_RETRIES) {//the channel was busy and the retries didn't reach the maximum value // disable the reciever timerIntSetFunction1(SI4432_XTON); // start timer with fix ETSI timeout timerIntTimeout(TIMEOUT_LBTI_ETSI); // go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_STATE_LBT_START_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); } else {//the channel was busy and the retries reach the maximum value //disable the receiver timerIntSetFunction1(SI4432_XTON); //go to the next state EZMacProReg.name.MSR = TX_STATE_BIT | TX_ERROR_CHANNEL_BUSY; #ifdef FOUR_CHANNEL_IS_USED //increment error counter timerIntIncrementError(EZMAC_PRO_ERROR_CHANNEL_BUSY); #endif //FOUR_CHANNEL_IS_USED //call LBT error callback function EZMacProTX_ErrorLBT_Timeout(); } } break; #endif//TRANSCIEVER_OPERATION case TX_STATE_WAIT_FOR_TX: // TX transmit error - no ipksent interrupt before timeout // This indicates a problem with the hardware or timeout //if there is a TX error then switch back the internal antenna diversity algorthm #ifdef ANTENNA_DIVERSITY_ENABLED #ifndef B1_ONLY //if revision V2 or A0 chip is used if ((EZMacProReg.name.DTR == 0x00) || (EZMacProReg.name.DTR == 0x01)) { //switch ON the internal algorithm temp8 = timerIntSpiReadReg(SI4432_OPERATING_AND_FUNCTION_CONTROL_2); timerIntSpiWriteReg (SI4432_OPERATING_AND_FUNCTION_CONTROL_2, temp8 | 0x80); //the gpios control the rf chip automatically timerIntSpiWriteReg(SI4432_GPIO1_CONFIGURATION, 0x17); timerIntSpiWriteReg(SI4432_GPIO2_CONFIGURATION, 0x18); } #endif//B1_ONLY #endif//ANTENNA_DIVERSITY_ENABLED //go to the TX ERROR STATE EZMacProReg.name.MSR = TX_STATE_BIT | TX_ERROR_STATE; break; #ifdef EXTENDED_PACKET_FORMAT #ifndef TRANSMITTER_ONLY_OPERATION case TX_STATE_WAIT_FOR_ACK: //call the no ack callback function EZMacProTX_ErrorNoAck(); //disbale the interrupts timerIntSpiWriteReg( SI4432_INTERRUPT_ENABLE_1, 0x00); timerIntSetEnable2(0x00); //disable the receiver timerIntSetFunction1(SI4432_XTON); //go to TX ERROR NO ACK state EZMacProReg.name.MSR = TX_STATE_BIT | TX_ERROR_NO_ACK; break; #endif//TRANSMITTER_ONLY_OPERATION #endif//EXTENDED_PACKET_FORMAT case TX_ERROR_STATE: DISABLE_MAC_INTERRUPTS(); // clear EX0 & ET0 // disable all Si443x interrupt sources timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, 0x00); timerIntSetEnable2(0x00); // clear interrupts timerIntSpiReadReg(SI4432_INTERRUPT_STATUS_1); timerIntSpiReadReg(SI4432_INTERRUPT_STATUS_2); STOP_MAC_TIMER(); // stop Timer CLEAR_MAC_TIMER_INTERRUPT(); // clear flag CLEAR_MAC_EXT_INTERRUPT(); #ifndef B1_ONLY if(EZMacProReg.name.DTR == 0)//if rev V2 chip is used // this register setting is need for good current consumption in Idle mode (only rev V2) timerIntSpiWriteReg (SI4432_CRYSTAL_OSCILLATOR_CONTROL_TEST, SI4432_BUFOVR); #endif break; #ifdef TRANSCIEVER_OPERATION case TX_ERROR_CHANNEL_BUSY: break; #endif //TRANSCIEVER_OPERATION } // end switch } #endif // RECEIVER_ONLY_OPERATION not defined //------------------------------------------------------------------------------------------------ // Function Name // timerIntRX_StateMachine() // // Return Value : None // Parameters : U8 state - RX state, least significant nibbble of MSR // // This function implements the detailed RX state machine. The state machine is implemented // using switch...case... statements. For efficient compilation, the states are a series // of sequential continuous integers (no missing values). The states are enumerated in the // EZMacPro.h header file. // // Conditional compile time switches remove the unused RX states if LBT, ACK, or packet // forwarding is not supported. These states are also removed from the enumeration at the // begriming or end of the list. // // Conditional compile time switches remove this entire function for the Transmitter only build. // //----------------------------------------------------------------------------------------------- #ifndef TRANSMITTER_ONLY_OPERATION void timerIntRX_StateMachine (U8 state) { U8 temp8; #ifdef PACKET_FORWARDING_SUPPORTED U32 timeout; #endif//PACKET_FORWARDING_SUPPORTED switch (state) { #ifdef FOUR_CHANNEL_IS_USED case RX_STATE_FREQUENCY_SEARCH: // jump to the next channel if search mechanism is enabled if((EZMacProReg.name.RCR & 0x04) == 0x04) { timerIntNextRX_Channel(); } // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); break; #endif //FOUR_CHANNEL_IS_USED #ifdef MORE_CHANNEL_IS_USED case RX_STATE_FREQUENCY_SEARCH: //check the channel number if (SelectedChannel < (maxChannelNumber - 1)) { //jump to the next channel SelectedChannel++; //switch off the receiver timerIntSetFunction1(SI4432_XTON); timerIntSpiWriteReg (SI4432_FREQUENCY_HOPPING_CHANNEL_SELECT,EZMacProReg.array[FR0+SelectedChannel]); //switch on the receiver timerIntSetFunction1(SI4432_XTON|SI4432_RXON); // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); } else { //jump to the first channel SelectedChannel = 0; //switch off the receiver timerIntSetFunction1(SI4432_XTON); timerIntSpiWriteReg (SI4432_FREQUENCY_HOPPING_CHANNEL_SELECT,EZMacProReg.array[FR0+SelectedChannel]); //switch on the receiver timerIntSetFunction1(SI4432_XTON|SI4432_RXON); // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); } break; #endif//MORE_CHANNEL_IS_USED case RX_STATE_WAIT_FOR_PACKET: //set the dinamic plength if it is needed otherwise set the fix length if ((EZMacProReg.name.MCR & 0x04) == 0x04) { temp8 = timerIntSpiReadReg(SI4432_HEADER_CONTROL_2); temp8 &= ~0x08; timerIntSpiWriteReg(SI4432_HEADER_CONTROL_2, temp8); } else { timerIntSpiWriteReg(SI4432_TRANSMIT_PACKET_LENGTH, EZMacProReg.name.PLEN); } #ifdef MORE_CHANNEL_IS_USED case RX_STATE_WAIT_FOR_PREAMBLE: #endif//MORE_CHANNEL_IS_USED case RX_STATE_WAIT_FOR_SYNC: // RX error - HW error or bad timeout calculation //switch off the receiver timerIntSetFunction1(SI4432_XTON); // clear interrupt enable 1 timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, 0x00); #ifdef FOUR_CHANNEL_IS_USED //Enable the Preamble valid interrupt timerIntSetEnable2(SI4432_ENPREAVAL); // jump to the next channel if search mechanism is enabled if((EZMacProReg.name.RCR & 0x04) == 0x04) { timerIntNextRX_Channel(); } // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); #endif//FOUR_CHANNEL_IS_USED #ifdef MORE_CHANNEL_IS_USED //enable the preamble valid interrupt timerIntSetEnable2(SI4432_ENPREAVAL); //determine the next channel number if (SelectedChannel < (maxChannelNumber - 1)) { SelectedChannel++; } else { SelectedChannel = 0; } //jump to the next channel timerIntSpiWriteReg (SI4432_FREQUENCY_HOPPING_CHANNEL_SELECT,EZMacProReg.array[FR0+SelectedChannel]); // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); #endif//MORE_CHANNEL_IS_USED //enable the receiver timerIntSetFunction1(SI4432_RXON|SI4432_XTON); //go to the next channel EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FREQUENCY_SEARCH; break; case RX_STATE_WAIT_FOR_HEADERS: if (timerIntHeaderError()) { /*#ifdef FOUR_CHANNEL_IS_USED //increment the error counter timerIntIncrementError(EZMAC_PRO_ERROR_BAD_ADDR); #endif //FOUR_CHANNEL_IS_USED // Disable the receiver timerIntSetFunction1(SI4432_XTON); #ifdef FOUR_CHANNEL_IS_USED // Enable the preamble valid interrupt timerIntSetEnable2(SI4432_ENPREAVAL); // jump to the next channel if search mechanism is enabled if((EZMacProReg.name.RCR & 0x04) == 0x04) { timerIntNextRX_Channel(); // start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); } #endif//FOUR_CHANNEL_IS_USED #ifdef MORE_CHANNEL_IS_USED //enable the preamble valid interrupt timerIntSetEnable2(SI4432_ENPREAVAL); //selected the next channel if (SelectedChannel < (maxChannelNumber - 1)) { SelectedChannel++; } else { SelectedChannel = 0; } //jump to the next channel timerIntSpiWriteReg (SI4432_FREQUENCY_HOPPING_CHANNEL_SELECT,EZMacProReg.array[FR0+SelectedChannel]); //start timer with channel search timeout timerIntTimeout(TimeoutChannelSearch); ENABLE_MAC_TIMER_INTERRUPT(); #endif//MORE_CHANNEL_IS_USED //Enable the receiver again timerIntSetFunction1(SI4432_RXON | SI4432_XTON); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FREQUENCY_SEARCH; ENABLE_MAC_EXT_INTERRUPT();*/ if ((EZMacProReg.name.MCR & 0x04) == 0x04) { temp8 = timerIntSpiReadReg(SI4432_HEADER_CONTROL_2); temp8 |= 0x08; timerIntSpiWriteReg(SI4432_HEADER_CONTROL_2, temp8); } timerIntSpiWriteReg(SI4432_TRANSMIT_PACKET_LENGTH, 5); timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKVALID|SI4432_ENCRCERROR); //set the rx packet time out timerIntTimeout(TimeoutRX_Packet); EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_WAIT_FOR_PACKET; ENABLE_MAC_INTERRUPTS(); } else { //Enable SI4432_ENPKVALID and SI4432_ENCRCERROR interrupts timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKVALID|SI4432_ENCRCERROR); // start timer with packet receive timeout timerIntTimeout(TimeoutRX_Packet); // go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_WAIT_FOR_PACKET; ENABLE_MAC_INTERRUPTS(); } break; #ifdef EXTENDED_PACKET_FORMAT #ifndef RECEIVER_ONLY_OPERATION case RX_STATE_WAIT_FOR_SEND_ACK: // SW error #ifdef ANTENNA_DIVERSITY_ENABLED #ifndef B1_ONLY //if revision V2 or A0 chip is used if ((EZMacProReg.name.DTR == 0x00) || (EZMacProReg.name.DTR == 0x01)) { //switch ON the internal algorithm temp8 = timerIntSpiReadReg(SI4432_OPERATING_AND_FUNCTION_CONTROL_2); timerIntSpiWriteReg (SI4432_OPERATING_AND_FUNCTION_CONTROL_2, temp8 | 0x80); //the gpios control the rf chip automatically timerIntSpiWriteReg(SI4432_GPIO1_CONFIGURATION, 0x17); timerIntSpiWriteReg(SI4432_GPIO2_CONFIGURATION, 0x18); } #endif//B1_ONLY #endif//ANTENNA_DIVERSITY_ENABLED #ifndef PACKET_FORWARDING_SUPPORTED //set back the preamble length #ifdef FOUR_CHANNEL_IS_USED timerIntSpiWriteReg(SI4432_PREAMBLE_LENGTH, PreamRegValue); #endif//FOUR_CHANNEL_IS_USED #ifdef MORE_CHANNEL_IS_USED temp8 = timerIntSpiReadReg(SI4432_HEADER_CONTROL_2); timerIntSpiWriteReg(SI4432_HEADER_CONTROL_2, (temp8 | 0x01)); timerIntSpiWriteReg(SI4432_PREAMBLE_LENGTH, PreamRegValue); #endif//MORE_CHANNEL_IS_USED #endif//PACKET_FORWARDING_SUPPORTED //go to the RX ERROR STATE EZMacProReg.name.MSR = RX_STATE_BIT | RX_ERROR_STATE; break; #endif//RECEIVER_ONLY_OPERATION #endif//EXTENDED_PACKET_FORMAT #ifdef PACKET_FORWARDING_SUPPORTED #ifdef TRANSCIEVER_OPERATION case RX_STATE_FORWARDING_LBT_START_LISTEN: if(BusyLBT == 0) {//the channel was free during the first 0.5ms ChannelOccupiedInStartPeriod = 0; // start timer with fix 4.5ms timeout timerIntTimeout(LBT_FIXED_TIME_4500US); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_LISTEN; // disable the receiver timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channnel was busy during the first 0.5ms BusyLBT = 0; ChannelOccupiedInStartPeriod = 1; ChannelOccupiedCounter = 0; // start timer with fix 1ms timeout timerIntTimeout(LBT_FIXED_TIME_1000US); // go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_LISTEN; // disable the receiver timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } break; case RX_STATE_FORWARDING_LBT_LISTEN: if (ChannelOccupiedInStartPeriod == 0) {//the channel was free during the 0.5ms start period if(BusyLBT == 0) {// LBT passed, channel should be clear in the fix 4.5ms period //disable the receiver timerIntSetFunction1(SI4432_XTON); // clear enable 2 interrupt timerIntSetEnable2(0x00); // enable ENPKSENT bit timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKSENT); // enable TX timerIntSetFunction1( SI4432_TXON|SI4432_XTON); // start timer with packet transmit timeout timerIntTimeout(TimeoutTX_Packet); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_WAIT_FOR_TX; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 4.5ms BusyLBT = 0; // multiple by fixed plus random number timeout = LBT_FIXED_TIME_5000US + TimeoutLBTI * (U32)(timerIntRandom()); // start timer with timeout timerIntTimeout(timeout); //got to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_RANDOM_LISTEN; // disable the receiver timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } } else {//the channel was busy during the 0.5ms start period if(BusyLBT == 0) {// LBT passed, channel should be clear in the fix 1ms period // multiple by fixed plus random number timeout = LBT_FIXED_TIME_5000US + TimeoutLBTI * (U32)(timerIntRandom()); // start timer with timeout timerIntTimeout(timeout); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_RANDOM_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy in the fix 1ms period if (ChannelOccupiedCounter < 9) { BusyLBT = 0; ChannelOccupiedCounter++; // start timer with fix 1ms timeout timerIntTimeout(LBT_FIXED_TIME_1000US); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_LISTEN; // disable the receiver timerIntSetFunction1(SI4432_XTON); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 10*1ms BusyLBT = 0; EZMacProLBT_Retrys++; if(EZMacProLBT_Retrys < MAX_LBT_RETRIES) {//the channel was busy and the retries didn't reach the maximum value // disable the reciever timerIntSetFunction1(SI4432_XTON); // start timer with fix ETSI timeout timerIntTimeout(TIMEOUT_LBTI_ETSI); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_START_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); } else {//the channel was busy and the retries reach the maximum value //disable the receiver timerIntSetFunction1(SI4432_XTON); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_ERROR_FORWARDING_WAIT_FOR_TX; #ifdef FOUR_CHANNEL_IS_USED //increment error counter timerIntIncrementError(EZMAC_PRO_ERROR_CHANNEL_BUSY); #endif//FOUR_CHANNEL_IS_USED //call the LBT error callback function EZMacProTX_ErrorLBT_Timeout(); } } } } break; case RX_STATE_FORWARDING_LBT_RANDOM_LISTEN: if(BusyLBT == 0) {// the channel was free during the 5ms + random period //disable the receiver timerIntSetFunction1(SI4432_XTON); // clear enable 2 interrupt timerIntSetEnable2(0x00); // enable ENPKSENT bit timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, SI4432_ENPKSENT); // enable TX timerIntSetFunction1( SI4432_TXON|SI4432_XTON); // start timer with fix transmit packet timeout timerIntTimeout(TimeoutTX_Packet); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_WAIT_FOR_TX; ENABLE_MAC_TIMER_INTERRUPT(); } else {//the channel was busy during the 5ms + random period BusyLBT = 0; EZMacProLBT_Retrys++; if(EZMacProLBT_Retrys < MAX_LBT_RETRIES) {//the channel was busy and the retries didn't reach the maximum value // disable the reciever timerIntSetFunction1(SI4432_XTON); // start timer with fix ETSI timeout timerIntTimeout(TIMEOUT_LBTI_ETSI); // go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_STATE_FORWARDING_LBT_START_LISTEN; ENABLE_MAC_TIMER_INTERRUPT(); // enable the receiver again timerIntSetFunction1( SI4432_RXON|SI4432_XTON); } else {//the channel was busy and the retries reach the maximum value //disable the receiver timerIntSetFunction1(SI4432_XTON); //go to the next state EZMacProReg.name.MSR = RX_STATE_BIT | RX_ERROR_FORWARDING_WAIT_FOR_TX; #ifdef FOUR_CHANNEL_IS_USED //increment the error counter timerIntIncrementError(EZMAC_PRO_ERROR_CHANNEL_BUSY); #endif//FOUR_CHANNEL_IS_USED //cll the LBT error callback function EZMacProTX_ErrorLBT_Timeout(); } } break; #endif // TRANSCIEVER_OPERATION case RX_STATE_FORWARDING_WAIT_FOR_TX: // TX timeout - HW error or bad timeout calculation //if there is a TX error then switch back the internal antenna diversity algorthm #ifdef ANTENNA_DIVERSITY_ENABLED #ifndef B1_ONLY //if revision V2 or A0 chip is used if ((EZMacProReg.name.DTR == 0x00) || (EZMacProReg.name.DTR == 0x01)) { //switch ON the internal algorithm temp8 = timerIntSpiReadReg(SI4432_OPERATING_AND_FUNCTION_CONTROL_2); timerIntSpiWriteReg (SI4432_OPERATING_AND_FUNCTION_CONTROL_2, temp8 | 0x80); //the gpios control the rf chip automatically timerIntSpiWriteReg(SI4432_GPIO1_CONFIGURATION, 0x17); timerIntSpiWriteReg(SI4432_GPIO2_CONFIGURATION, 0x18); } #endif//B1_ONLY #endif//ANTENNA_DIVERSITY_ENABLED EZMacProReg.name.MSR = TX_STATE_BIT | RX_ERROR_STATE; break; #endif // PACKET_FORWARDING_SUPPORTED case RX_ERROR_STATE: DISABLE_MAC_INTERRUPTS(); // clear EX0 & ET0 // disable all Si443x interrupt sources timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_1, 0x00); timerIntSetEnable2(0x00); // clear interrupts timerIntSpiReadReg(SI4432_INTERRUPT_STATUS_1); timerIntSpiReadReg(SI4432_INTERRUPT_STATUS_2); STOP_MAC_TIMER(); // stop Timer CLEAR_MAC_TIMER_INTERRUPT(); // clear flag CLEAR_MAC_EXT_INTERRUPT(); #ifndef B1_ONLY if(EZMacProReg.name.DTR == 0)//if rev V2 chip is used // this register setting is need for good current consumption in Idle mode (only rev V2) timerIntSpiWriteReg (SI4432_CRYSTAL_OSCILLATOR_CONTROL_TEST, SI4432_BUFOVR); #endif//B1_ONLY break; default: break; } // end switch } #endif // TRANSMITTER_ONLY_OPERATION not defined //================================================================================================ // // spi Functions for timerInt.c module // //================================================================================================ // // Notes: // // The spi functions in this module are for use in the timerInt thread. The SPI is used by the // main thread, as well as the external interrupt INT0 thread, and the T0 interrupt. The SPI // functions are duplicated for the timerInt module. If the same SPI functions were used, the // linker would generate a multiple call to segment warning. The linker would not be able to // overlay the threads separately, local data may be corrupted be a reentrant function call, // the SPI transfer may be corrupted. // // These SPI functions may be interrupted by a high priority interrupt, so the double buffered // transfers are managed with this in mind. // // The double buffered transfer maximizes the data throughput and eliminates any software // delay between bytes. The clock is continuous for the two byte transfer. Instead of using the // SPIF flag for each byte, the TXBMT is used to keep the transmit buffer full, then the SPIBSY // bit is used to determine when all bits have been transferred. The SPIF flag should not be // polled in double buffered transfers. // //------------------------------------------------------------------------------------------------ // Function Name // timerIntSpiWriteReg() // // Return Value : None // Parameters : // U8 reg - register address from the si4432.h file. // U8 value - value to write to register // // Notes: // Write uses a Double buffered transfer. // This function is not included in the Transmitter only configuration. // //----------------------------------------------------------------------------------------------- void timerIntSpiWriteReg (U8 macReg, U8 value) { NSS = 0; // drive NSS low SPIF = 0; // clear SPIF SPI_DAT = (macReg | 0x80); // write reg address while(!TXBMT); // wait on TXBMT SPI_DAT = value; // write value while(!TXBMT); // wait on TXBMT while((SPI_CFG & 0x80) == 0x80); // wait on SPIBSY SPIF = 0; // leave SPIF cleared NSS = 1; // drive NSS high } //------------------------------------------------------------------------------------------------ // Function Name // timerIntSpiReadReg() // // Return Value : U8 value - value returned from the si4432 register // Parameters : U8 reg - register address from the si4432.h file. // // Notes: // Read uses a Double buffered transfer. // This function is not included for the Transmitter only configuration. // //----------------------------------------------------------------------------------------------- U8 timerIntSpiReadReg (U8 macReg) { U8 value; NSS = 0; // drive NSS low SPIF = 0; // cleat SPIF SPI_DAT = ( macReg ); // write reg address while(!TXBMT); // wait on TXBMT SPI_DAT = 0x00; // write anything while(!TXBMT); // wait on TXBMT while((SPI_CFG & 0x80) == 0x80); // wait on SPIBSY value = SPI_DAT; // read value SPIF = 0; // leave SPIF cleared NSS = 1; // drive NSS low return value; } //================================================================================================ // // Timer Functions for timerInt.c module // //================================================================================================ //------------------------------------------------------------------------------------------------ // Function Name // timerIntTimeout() // // Return Value : None // Parameters : U32 longTime // // Notes: // // This function is called when a timeout event must initiate a subsequent timeout event. // A 32-bit union is used to provide word and byte access. The upper word is stored in // EZMacProTimerMSB. The The lower word is first negated then written to the TL0 and TH0 sfrs. // // This function is not included for the Transmitter only configuration. // //----------------------------------------------------------------------------------------------- #ifndef TRANSMITTER_ONLY_OPERATION void timerIntTimeout (U32 longTime) { UU32 time; ET0 = 0; // disable Timer interrupts TR0 = 0; // stop timer if already running time.U32 = longTime; EZMacProTimerMSB = time.U16[MSB]; time.U16[LSB] = - time.U16[LSB]; TL0 = time.U8[b0]; // write LSB first TH0 = time.U8[b1]; // write MSB last TF0 = 0; // clear flag TR0 = 1; // run timer } #endif//TRANSMITTER_ONLY_OPERATION //================================================================================================ //----------------------------------------------------------------------------------------------- // Function Name // timerIntRandom() // // Return Value : U8 4-bit random number // Parameters : None // // Notes: // // This function provides a pseudo random number. // It uses 8-bit multiply and shift to generate the next random number. // // The constants used are based on the largest possible primes that will // satisfy the linear congruent criteria. // // The pseudo random sequence will repeat every 256 times. // The sequence always starts at the same point. If the application // requires a different sequence each time on reset, a truly random // seed may be required. // // This function is only included if LISTEN_BEFORE_TALK_SUPPORTED is defined. // //----------------------------------------------------------------------------------------------- #ifdef TRANSCIEVER_OPERATION U8 timerIntRandom (void) { U8 temp8; // 61 is largest prime less than 256/4 EZMacProRandomNumber *= 245; // 4 * 61 + 1 = 245 EZMacProRandomNumber += 251; // 251 is the largest prime < 256 temp8 = EZMacProRandomNumber>>4; if (temp8 == 0) return 1; else return temp8; } #endif //TRANSCIEVER_OPERATION //------------------------------------------------------------------------------------------------ // Function Name // timerIntNextRX_Channel() // // Return Value : None // Parameters : None // // Notes: // // This function will advance to the next channel. The channel is incremented and then checked // against the frequency mask in the MAC RCR register. Setting all mask bits is not permitted. // // This function is not included for the Transmitter only configuration. // //----------------------------------------------------------------------------------------------- #ifndef TRANSMITTER_ONLY_OPERATION #ifndef MORE_CHANNEL_IS_USED void timerIntNextRX_Channel (void) { U8 mask; U8 n; n = EZMacProCurrentChannel; //initialize mask mask = 0x08; mask <<= n; do { n++; // increment n n &= 0x03; // wrap modulo 4 mask <<=1 ; // shift mask left if(mask == 0x80) mask = 0x08; // wrap mask to bits 3-6 // continue until unmasked bit is found } while ((EZMacProReg.name.RCR & mask) == mask); //switch off the receiver timerIntSetFunction1(SI4432_XTON); timerIntSpiWriteReg (SI4432_FREQUENCY_HOPPING_CHANNEL_SELECT,EZMacProReg.array[FR0+n]); //switch on the receiver timerIntSetFunction1(SI4432_XTON|SI4432_RXON); EZMacProCurrentChannel = n; } #endif//MORE_CHANNEL_IS_USED #endif // TRANSMITTER_ONLY_OPERATION not defined //------------------------------------------------------------------------------------------------ // Function Name // timerIntIncrementError() // // Return Value : None // Parameters : U8 mask - SECR error mask // // Notes: // // This function will increment the appropriate error counter register if the error type is // enabled in the MAC SECR register. The error codes for the SECR register are defined in the // EZMacPro.h header file. First the error code is compared to the error mask in the SECR // register. The counting is enabled for the particular type of error, the error count is // incremented. The error count corresponding to the current frequency is incremented. // // This function is not included for the Transmitter only configuration. // //------------------------------------------------------------------------------------------------ #ifdef FOUR_CHANNEL_IS_USED #ifndef TRANSMITTER_ONLY_OPERATION void timerIntIncrementError (U8 mask) { // mask is SECR error bit mask mask &= 0x0F; // ignore upper nibble if((EZMacProReg.name.SECR & mask) == mask ) { if(EZMacProReg.array[EC0+EZMacProCurrentChannel] < 255) EZMacProReg.array[EC0+EZMacProCurrentChannel]++; } } #endif // TRANSMITTER_ONLY_OPERATION not defined #endif //FOUR_CHANNEL_IS_USED //------------------------------------------------------------------------------------------------ // Function Name // timerIntHeaderError() // // Return Value : U8 error - (1 error, 0 no error) // Parameters : None // // Notes: // // This function provides SW header filtering for the received packet after receiving the header // bytes. The function will return a 1 (True) if there is a header error. So the function is // named for the error. // // The filters and error counters are enabled separately. So the filters are checked in the // order they are received and grouped according to the errors. This function calls the // BadAddrError function to test the address filters and increments the bad address if // there is an address error. // // Note that the Si4432 HW filters could be used only if the multi-cast filter is not used // and there is no mechanism to distinguish between CID, DID, and SID header errors. // // This function is not included for the Transmitter only configuration. // //------------------------------------------------------------------------------------------------ #ifndef TRANSMITTER_ONLY_OPERATION U8 timerIntHeaderError(void) { U8 rcid; U8 packetLength; if(EZMacProReg.name.PFCR & 0x02) // PFEN=1 - promiscuous mode return 0; if (( EZMacProReg.name.MCR & 0x80 ) == 0x80)//if CID is used { //if the Customer ID filter is enabled then CID will be checked if ((EZMacProReg.name.PFCR & 0x80) == 0x80) { #ifdef EXTENDED_PACKET_FORMAT rcid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_2); #else // STANDARD_EZMAC_PACKET_FORMAT rcid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_3); #endif//EXTENDED_PACKET_FORMAT if(rcid != EZMacProReg.name.SCID) { #ifdef FOUR_CHANNEL_IS_USED //increment error counter timerIntIncrementError(EZMAC_PRO_ERROR_BAD_CID); #endif //FOUR_CHANNEL_IS_USED return 1; } } } if(timerIntBadAddrError()) { #ifdef FOUR_CHANNEL_IS_USED //increment error counter timerIntIncrementError(EZMAC_PRO_ERROR_BAD_ADDR); #endif //FOUR_CHANNEL_IS_USED return 1; } //if the Packet Length filter is enabled then Received Packet length will be checked if((EZMacProReg.name.PFCR & 0x04) == 0x04) { packetLength = timerIntSpiReadReg(SI4432_RECEIVED_PACKET_LENGTH); if (packetLength > EZMacProReg.name.MPL) { return 1; // no error count } } return 0; } #endif // TRANSMITTER_ONLY_OPERATION not defined //------------------------------------------------------------------------------------------------ // Function Name // timerIntBadAddrError() // // Return Value : U8 error - (1 error, 0 no error) // Parameters : None // // Notes: // // This function applies the address (SID & DID) filters and returns a 1 (True) if there is a // address error. // // Note that if packed forwarding is enabled the DID filter is not applied until after the // packet is received and considered for forwarding, in the externalInt.c module. // // This function is not included for the Transmitter only configuration. // //------------------------------------------------------------------------------------------------ #ifndef TRANSMITTER_ONLY_OPERATION U8 timerIntBadAddrError(void) { U8 rsid; #ifndef PACKET_FORWARDING_SUPPORTED U8 rdid; #endif //if the Sender filter is enabled then SID will be checked if ((EZMacProReg.name.PFCR & 0x40) == 0x40) { #ifdef EXTENDED_PACKET_FORMAT if (( EZMacProReg.name.MCR & 0x80 ) == 0x80)//if CID is used rsid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_1); else rsid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_2); #else //STANDARD_EZMAC_PACKET_FORMAT if (( EZMacProReg.name.MCR & 0x80 ) == 0x80)//if CID is used rsid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_2); else rsid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_3); #endif //EXTENDED_PACKET_FORMAT if ((EZMacProReg.name.SFLT & EZMacProReg.name.SMSK) != (rsid & EZMacProReg.name.SMSK)) { return 1; } } #ifdef PACKET_FORWARDING_SUPPORTED // Don't check DID return 0; #else //if the Destination filter is enabled then DID will be checked if ((EZMacProReg.name.PFCR & 0x20) == 0x20) { //read DID from appropriate header byte #ifdef EXTENDED_PACKET_FORMAT if (( EZMacProReg.name.MCR & 0x80 ) == 0x80)//if CID is used rdid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_0); else rdid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_1); #else // STANDARD_EZMAC_PACKET_FORMAT if (( EZMacProReg.name.MCR & 0x80 ) == 0x80)//if CID is used rdid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_1); else rdid = timerIntSpiReadReg(SI4432_RECEIVED_HEADER_2); #endif//EXTENEDED_PACKET_FORMAT if (rdid == EZMacProReg.name.SFID) { EZMacProReceiveStatus |= 0x80; return 0; } //if the Broadcast filter is enabled then DID will be checked if((EZMacProReg.name.PFCR & 0x08) == 0x08) { if (rdid == 0xFF) { EZMacProReceiveStatus |= 0x20; return 0; } } //if the Multi-cast filter is enabled if((EZMacProReg.name.PFCR & 0x10) == 0x10) { // Multi-cast address mode if ((EZMacProReg.name.PFCR & 0x01) == 0x01) { if(rdid == EZMacProReg.name.MCA_MCM) { EZMacProReceiveStatus |= 0x40; return 0; } } else // multi-cast mask mode { if ((rdid & EZMacProReg.name.MCA_MCM) == (EZMacProReg.name.SFID & EZMacProReg.name.MCA_MCM)) { return 0; } } } return 1; // none of above } else { return 0; // no DID Error - passes everything else } #endif // PACKET_FORWARDING_SUPPORTED } #endif // TRANSMITTER_ONLY_OPERATION not defined //------------------------------------------------------------------------------------------------ // Function Name // timerIntSetEnable2() // // Return Value : None // Parameters : U8 value // // Notes: // // This function is used instead of timerIntSpiWriteReg() when writing to the // SI4432_INTERRUPT_ENABLE_2 register. This function adds support for the low frequency timer // and low battery detector, if the build options are defined. If not, the register is written // directly. // // This function is not included for the Transmitter only configuration. // //------------------------------------------------------------------------------------------------ void timerIntSetEnable2(U8 value) { if((EZMacProReg.name.LFTMR2 & 0x80)==0x80) { value |= SI4432_ENWUT; } if((EZMacProReg.name.LBDR & 0x80)==0x80) value |= SI4432_ENLBDI; timerIntSpiWriteReg(SI4432_INTERRUPT_ENABLE_2, value); } //------------------------------------------------------------------------------------------------ // Function Name // timerIntSetFunction1() // // Return Value : None // Parameters : U8 value // // This function is used instead of timerIntSpiWriteReg() when writing to the // SI4432_OPERATING_AND_FUNCTION_CONTROL_1 register. This function adds support for the // low frequency timer and low battery detector, if the build options are defined. If not, // the register is written directly. // // This function is not included for the Transmitter only configuration. // //------------------------------------------------------------------------------------------------ #ifndef TRANSMITTER_ONLY_OPERATION void timerIntSetFunction1(U8 value) { if((EZMacProReg.name.LFTMR2 & 0x80)==0x80) { value |= SI4432_ENWT; ENABLE_MAC_EXT_INTERRUPT(); } if((EZMacProReg.name.LFTMR2 & 0x40)==0x00) value |= SI4432_X32KSEL; if((EZMacProReg.name.LBDR & 0x80)==0x80) value |= SI4432_ENLBD; timerIntSpiWriteReg(SI4432_OPERATING_AND_FUNCTION_CONTROL_1, value); } #endif//TRANMITTER_ONLY_OPERATION //------------------------------------------------------------------------------------------------ // timerIntTouch() added for Keil library support //------------------------------------------------------------------------------------------------ void timerIntTouch (void) { } //================================================================================================ // end timerInt.c //================================================================================================
[ "you@example.com" ]
you@example.com
bd4aed128fa97abe993b249e6077ce8951051717
0b5537a479bd4c1dfaa032c4801191e4bca15504
/lib/exielcsfml/init_struct/init_parallax.c
b21cb6b120cdd62b1a024ffab11061e0d1da576c
[]
no_license
alexisepi/my_RPG
03bf4d6b4ccbbffecbdfee5eb197fdd1fbfcb2ed
c2dcc69164795179552431c1554ed1d1d0e57647
refs/heads/main
2023-06-29T12:22:14.737110
2021-07-25T02:35:53
2021-07-25T02:35:53
389,242,845
0
0
null
null
null
null
UTF-8
C
false
false
716
c
/* ** EPITECH PROJECT, 2021 ** init_parallax ** File description: ** init_parallax */ #include "exielcsfml.h" parallax_t *init_parallax(const char *spritesheet_path, sfVector2f pos, sfIntRect rect) { parallax_t *parallax = malloc(sizeof(parallax_t)); parallax->parallax = init_object(spritesheet_path, pos, rect); parallax->clock = sfClock_create(); return (parallax); } void destroy_parallax(parallax_t *parallax) { destroy_object(parallax->parallax); sfClock_destroy(parallax->clock); free(parallax); } void destroy_parallax_array(parallax_t **parallaxs, int nb_parallaxs) { for (int i = 0; i != nb_parallaxs; i++) destroy_parallax(parallaxs[i]); free(parallaxs); }
[ "alexis.camra@epitech.eu" ]
alexis.camra@epitech.eu
f4b65c9d610ee1bb25ea694b29ae352205435ff5
544bf6a75345116c1e9e570c7072ccdedfd3bc92
/Ryan/samd21_xplained_pro_serial_bridge/samd21_xplained_pro_serial_bridge/src/winc/spi_flash/spi_flash.c
a5ddd020301d6474109bbd845c430634d1631a4b
[]
no_license
nichins/SSS_ESE680
022af8319f1779306f15d96530cdfe480f3bbb5c
f69f95417fff335b64f00bc82a5ca7ca9eaf2315
refs/heads/master
2021-03-24T11:55:45.381357
2017-04-24T10:52:48
2017-04-24T10:52:48
85,633,041
0
0
null
null
null
null
UTF-8
C
false
false
15,640
c
#ifdef PROFILING #include "windows.h" #endif #include "spi_flash.h" #define DUMMY_REGISTER (0x1084) #define TIMEOUT 10000 /*MS*/ //#define DISABLE_UNSED_FLASH_FUNCTIONS #define HOST_SHARE_MEM_BASE (0xE0000) #define CORTUS_SHARE_MEM_BASE (0x60000000UL) #define SHARED_PKT_MEM_BASE (0xd0000UL) #define NMI_SPI_FLASH_ADDR (0x111c) /*********************************************************** SPI Flash DMA ***********************************************************/ #define GET_UINT32(X,Y) (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24)) #define SPI_FLASH_BASE (0x10200) #define SPI_FLASH_MODE (SPI_FLASH_BASE + 0x00) #define SPI_FLASH_CMD_CNT (SPI_FLASH_BASE + 0x04) #define SPI_FLASH_DATA_CNT (SPI_FLASH_BASE + 0x08) #define SPI_FLASH_BUF1 (SPI_FLASH_BASE + 0x0c) #define SPI_FLASH_BUF2 (SPI_FLASH_BASE + 0x10) #define SPI_FLASH_BUF_DIR (SPI_FLASH_BASE + 0x14) #define SPI_FLASH_TR_DONE (SPI_FLASH_BASE + 0x18) #define SPI_FLASH_DMA_ADDR (SPI_FLASH_BASE + 0x1c) #define SPI_FLASH_MSB_CTL (SPI_FLASH_BASE + 0x20) #define SPI_FLASH_TX_CTL (SPI_FLASH_BASE + 0x24) /*********************************************/ /* STATIC FUNCTIONS */ /*********************************************/ /** * @fn spi_flash_read_status_reg * @brief Read status register * @param[OUT] val value of status reg * @return Status of execution * @note Compatible with MX25L6465E * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_read_status_reg(uint8 * val) { uint8 cmd[1]; uint32 reg; sint8 ret = M2M_SUCCESS; uint16 u16timeout = TIMEOUT; cmd[0] = 0x05; nm_write_reg(SPI_FLASH_DATA_CNT, 1); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, HOST_SHARE_MEM_BASE); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&reg); u16timeout--; } while((reg != 1) && u16timeout); if(!u16timeout) { ret = M2M_ERR_BUS_FAIL; } *val = (uint8)reg & 0xFF; return ret; } #ifdef DISABLE_UNSED_FLASH_FUNCTIONS /** * @fn spi_flash_read_security_reg * @brief Read security register * @return Security register value * @note Compatible with MX25L6465E * @author M. Abdelmawla * @version 1.0 */ static uint8 spi_flash_read_security_reg(void) { uint8 cmd[1]; uint32 reg; sint8 ret = M2M_SUCCESS; cmd[0] = 0x2b; nm_write_reg(SPI_FLASH_DATA_CNT, 1); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, HOST_SHARE_MEM_BASE); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&reg); if(M2M_SUCCESS != ret) break; } while(reg != 1); reg = (M2M_SUCCESS == ret)?(nm_read_reg(HOST_SHARE_MEM_BASE)):((uint8)M2M_ERR_BUS_FAIL); return (sint8)reg & 0xff; } /** * @fn spi_flash_gang_unblock * @brief Unblock all flash area * @note Compatible with MX25L6465E * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_gang_unblock(void) { uint8 cmd[1]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x98; nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, 0); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_clear_security_flags * @brief Clear all security flags * @note Compatible with MX25L6465E * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_clear_security_flags(void) { uint8 cmd[1]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x30; nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, 0); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } #endif /** * @fn spi_flash_load_to_cortus_mem * @brief Load data from SPI flash into cortus memory * @param[IN] u32MemAdr * Cortus load address. It must be set to its AHB access address * @param[IN] u32FlashAdr * Address to read from at the SPI flash * @param[IN] u32Sz * Data size * @return Status of execution * @note Compatible with MX25L6465E and should be working with other types * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_load_to_cortus_mem(uint32 u32MemAdr, uint32 u32FlashAdr, uint32 u32Sz) { uint8 cmd[5]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x0b; cmd[1] = (uint8)(u32FlashAdr >> 16); cmd[2] = (uint8)(u32FlashAdr >> 8); cmd[3] = (uint8)(u32FlashAdr); cmd[4] = 0xA5; nm_write_reg(SPI_FLASH_DATA_CNT, u32Sz); nm_write_reg(SPI_FLASH_BUF1, cmd[0]|(cmd[1]<<8)|(cmd[2]<<16)|(cmd[3]<<24)); nm_write_reg(SPI_FLASH_BUF2, cmd[4]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x1f); nm_write_reg(SPI_FLASH_DMA_ADDR, u32MemAdr); nm_write_reg(SPI_FLASH_CMD_CNT, 5 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_sector_erase * @brief Erase sector (4KB) * @param[IN] u32FlashAdr * Any memory address within the sector * @return Status of execution * @note Compatible with MX25L6465E and should be working with other types * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_sector_erase(uint32 u32FlashAdr) { uint8 cmd[4]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x20; cmd[1] = (uint8)(u32FlashAdr >> 16); cmd[2] = (uint8)(u32FlashAdr >> 8); cmd[3] = (uint8)(u32FlashAdr); nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]|(cmd[1]<<8)|(cmd[2]<<16)|(cmd[3]<<24)); nm_write_reg(SPI_FLASH_BUF_DIR, 0x0f); nm_write_reg(SPI_FLASH_DMA_ADDR, 0); nm_write_reg(SPI_FLASH_CMD_CNT, 4 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_write_enable * @brief Send write enable command to SPI flash * @return Status of execution * @note Compatible with MX25L6465E and should be working with other types * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_write_enable(void) { uint8 cmd[1]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x06; nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, 0); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_write_disable * @brief Send write disable command to SPI flash * @note Compatible with MX25L6465E and should be working with other types * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_write_disable(void) { uint8 cmd[1]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x04; nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x01); nm_write_reg(SPI_FLASH_DMA_ADDR, 0); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_page_program * @brief Write data (less than page size) from cortus memory to SPI flash * @param[IN] u32MemAdr * Cortus data address. It must be set to its AHB access address * @param[IN] u32FlashAdr * Address to write to at the SPI flash * @param[IN] u32Sz * Data size * @note Compatible with MX25L6465E and should be working with other types * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_page_program(uint32 u32MemAdr, uint32 u32FlashAdr, uint32 u32Sz) { uint8 cmd[4]; uint32 val = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x02; cmd[1] = (uint8)(u32FlashAdr >> 16); cmd[2] = (uint8)(u32FlashAdr >> 8); cmd[3] = (uint8)(u32FlashAdr); nm_write_reg(SPI_FLASH_DATA_CNT, 0); nm_write_reg(SPI_FLASH_BUF1, cmd[0]|(cmd[1]<<8)|(cmd[2]<<16)|(cmd[3]<<24)); nm_write_reg(SPI_FLASH_BUF_DIR, 0x0f); nm_write_reg(SPI_FLASH_DMA_ADDR, u32MemAdr); nm_write_reg(SPI_FLASH_CMD_CNT, 4 | (1<<7) | ((u32Sz & 0xfffff) << 8)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&val); if(M2M_SUCCESS != ret) break; } while(val != 1); return ret; } /** * @fn spi_flash_read_internal * @brief Read from data from SPI flash * @param[OUT] pu8Buf * Pointer to data buffer * @param[IN] u32Addr * Address to read from at the SPI flash * @param[IN] u32Sz * Data size * @note Data size must be < 64KB (limitation imposed by the bus wrapper) * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_read_internal(uint8 *pu8Buf, uint32 u32Addr, uint32 u32Sz) { sint8 ret = M2M_SUCCESS; /* read size must be < 64KB */ ret = spi_flash_load_to_cortus_mem(HOST_SHARE_MEM_BASE, u32Addr, u32Sz); if(M2M_SUCCESS != ret) goto ERR; ret = nm_read_block(HOST_SHARE_MEM_BASE, pu8Buf, (uint16)u32Sz); ERR: return ret; } /** * @fn spi_flash_pp * @brief Program data of size less than a page (256 bytes) at the SPI flash * @param[IN] u32Offset * Address to write to at the SPI flash * @param[IN] pu8Buf * Pointer to data buffer * @param[IN] u32Sz * Data size * @return Status of execution * @author M. Abdelmawla * @version 1.0 */ static sint8 spi_flash_pp(uint32 u32Offset, uint8 *pu8Buf, uint16 u16Sz) { sint8 ret = M2M_SUCCESS; uint8 tmp; spi_flash_write_enable(); /* use shared packet memory as temp mem */ ret = nm_write_block(SHARED_PKT_MEM_BASE, pu8Buf, u16Sz); ret = spi_flash_page_program(SHARED_PKT_MEM_BASE, u32Offset, u16Sz); if(M2M_SUCCESS != ret) goto ERR; do { if(ret == M2M_ERR_BUS_FAIL) goto ERR; } while((ret = spi_flash_read_status_reg(&tmp))& 0x01); ret = spi_flash_write_disable(); ERR: return ret; } /** * @fn spi_flash_rdid * @brief Read SPI Flash ID * @return SPI FLash ID * @author M.S.M * @version 1.0 */ static uint32 spi_flash_rdid(void) { unsigned char cmd[1]; uint32 reg = 0; uint32 cnt = 0; sint8 ret = M2M_SUCCESS; cmd[0] = 0x9f; nm_write_reg(SPI_FLASH_DATA_CNT, 4); nm_write_reg(SPI_FLASH_BUF1, cmd[0]); nm_write_reg(SPI_FLASH_BUF_DIR, 0x1); nm_write_reg(SPI_FLASH_DMA_ADDR, DUMMY_REGISTER); nm_write_reg(SPI_FLASH_CMD_CNT, 1 | (1<<7)); do { ret = nm_read_reg_with_ret(SPI_FLASH_TR_DONE, (uint32 *)&reg); if(M2M_SUCCESS != ret) break; if(++cnt > 500) { ret = M2M_ERR_INIT; break; } } while(reg != 1); reg = (M2M_SUCCESS == ret)?(nm_read_reg(DUMMY_REGISTER)):(0); M2M_PRINT("Flash ID %x \n",(unsigned int)reg); return reg; } /** * @fn spi_flash_unlock * @brief Unlock SPI Flash * @author M.S.M * @version 1.0 */ #if 0 static void spi_flash_unlock(void) { uint8 tmp; tmp = spi_flash_read_security_reg(); spi_flash_clear_security_flags(); if(tmp & 0x80) { spi_flash_write_enable(); spi_flash_gang_unblock(); } } #endif /*********************************************/ /* GLOBAL FUNCTIONS */ /*********************************************/ /** * @fn spi_flash_read * @brief Read from data from SPI flash * @param[OUT] pu8Buf * Pointer to data buffer * @param[IN] u32offset * Address to read from at the SPI flash * @param[IN] u32Sz * Data size * @return Status of execution * @note Data size is limited by the SPI flash size only * @author M. Abdelmawla * @version 1.0 */ sint8 spi_flash_read(uint8 *pu8Buf, uint32 u32offset, uint32 u32Sz) { sint8 ret = M2M_SUCCESS; if(u32Sz > FLASH_BLOCK_SIZE) { do { ret = spi_flash_read_internal(pu8Buf, u32offset, FLASH_BLOCK_SIZE); if(M2M_SUCCESS != ret) goto ERR; u32Sz -= FLASH_BLOCK_SIZE; u32offset += FLASH_BLOCK_SIZE; pu8Buf += FLASH_BLOCK_SIZE; } while(u32Sz > FLASH_BLOCK_SIZE); } ret = spi_flash_read_internal(pu8Buf, u32offset, u32Sz); ERR: return ret; } /** * @fn spi_flash_write * @brief Proram SPI flash * @param[IN] pu8Buf * Pointer to data buffer * @param[IN] u32Offset * Address to write to at the SPI flash * @param[IN] u32Sz * Data size * @return Status of execution * @author M. Abdelmawla * @version 1.0 */ sint8 spi_flash_write(uint8* pu8Buf, uint32 u32Offset, uint32 u32Sz) { #ifdef PROFILING uint32 t1 = 0; uint32 percent =0; uint32 tpercent =0; #endif sint8 ret = M2M_SUCCESS; uint32 u32wsz; uint32 u32off; uint32 u32Blksz; u32Blksz = FLASH_PAGE_SZ; u32off = u32Offset % u32Blksz; #ifdef PROFILING tpercent = (u32Sz/u32Blksz)+((u32Sz%u32Blksz)>0); t1 = GetTickCount(); M2M_PRINT(">Start programming..\r\n"); #endif if(u32Sz<=0) { M2M_ERR("Data size = %d",(int)u32Sz); ret = M2M_ERR_FAIL; goto ERR; } if (u32off)/*first part of data in the address page*/ { u32wsz = u32Blksz - u32off; if(spi_flash_pp(u32Offset, pu8Buf, (uint16)BSP_MIN(u32Sz, u32wsz))!=M2M_SUCCESS) { ret = M2M_ERR_FAIL; goto ERR; } if (u32Sz < u32wsz) goto EXIT; pu8Buf += u32wsz; u32Offset += u32wsz; u32Sz -= u32wsz; } while (u32Sz > 0) { u32wsz = BSP_MIN(u32Sz, u32Blksz); /*write complete page or the remaining data*/ if(spi_flash_pp(u32Offset, pu8Buf, (uint16)u32wsz)!=M2M_SUCCESS) { ret = M2M_ERR_FAIL; goto ERR; } pu8Buf += u32wsz; u32Offset += u32wsz; u32Sz -= u32wsz; #ifdef PROFILING percent++; printf("\r>Complete Percentage = %d%%.\r",((percent*100)/tpercent)); #endif } EXIT: #ifdef PROFILING M2M_PRINT("\rDone\t\t\t\t\t\t"); M2M_PRINT("\n#Programming time =%f sec\n\r",(GetTickCount() - t1)/1000.0); #endif ERR: return ret; } /** * @fn spi_flash_erase * @brief Erase from data from SPI flash * @param[IN] u32Offset * Address to write to at the SPI flash * @param[IN] u32Sz * Data size * @return Status of execution * @note Data size is limited by the SPI flash size only * @author M. Abdelmawla * @version 1.0 */ sint8 spi_flash_erase(uint32 u32Offset, uint32 u32Sz) { uint32 i = 0; sint32 val = M2M_SUCCESS; uint8 tmp = 0; #ifdef PROFILING uint32 t; t = GetTickCount(); #endif M2M_PRINT("\r\n>Start erasing...\r\n"); for(i = u32Offset; i < (u32Sz +u32Offset); i += (16*FLASH_PAGE_SZ)) { val += spi_flash_write_enable(); val += spi_flash_read_status_reg(&tmp); val += spi_flash_sector_erase(i); val += spi_flash_read_status_reg(&tmp); do { if(val != M2M_SUCCESS) break; } while((val = spi_flash_read_status_reg(&tmp))& 0x01); if(val != M2M_SUCCESS) goto ERR; } M2M_PRINT("Done\r\n"); #ifdef PROFILING M2M_PRINT("#Erase time = %f sec\n", (GetTickCount()-t)/1000.0); #endif return M2M_SUCCESS; ERR: return M2M_ERR_BUS_FAIL; } /** * @fn spi_flash_get_size * @brief Get size of SPI Flash * @return Size of Flash * @author M.S.M * @version 1.0 */ uint32 spi_flash_get_size(void) { uint32 u32FlashId = 0, u32FlashPwr = 0; static uint32 gu32InernalFlashSize= 0; if(!gu32InernalFlashSize) { u32FlashId = spi_flash_rdid();//spi_flash_probe(); if(u32FlashId != 0xffffffff) { /*flash size is the third byte from the FLASH RDID*/ u32FlashPwr = ((u32FlashId>>16)&0xff) - 0x11; /*2MBIT is the min*/ /*That number power 2 to get the flash size*/ gu32InernalFlashSize = 1<<u32FlashPwr; M2M_INFO("Flash Size %lu Mb\n",gu32InernalFlashSize); } else { M2M_ERR("Cann't Detect Flash size\n"); } } return gu32InernalFlashSize; }
[ "rspicer@gmail.com" ]
rspicer@gmail.com
438374bca66821417c6ff5d8f90cb60f3e7d07c1
d8bdf389252d0699ae58d5e7eded8ee8cc2241bf
/firmwire/Learning.h
cf0bbe8a68cb406fba5059e63287a6ffb19ff334
[ "MIT" ]
permissive
LinaeSostra/ReinforcmentLearningRobot
b8a02f8e6891a52bcb0704eb37ba426076e7828b
a8d797bbb1fc5b93354b90e63bd38140a7bdd709
refs/heads/master
2020-03-18T02:39:23.847701
2018-10-31T18:51:46
2018-10-31T18:51:46
134,200,893
2
0
null
null
null
null
UTF-8
C
false
false
705
h
#ifndef LEARNING_H #define LEARNING_H #define DEFAULT_ALPHA 0.2 #define DEFAULT_EPSILON 10 #define NUM_ACTIONS 5 #define MIN_POSITION -10 #define MAX_POSITION 9 #define START_POSITION 0 #define END_POSITION 5 typedef enum Angle { North = 0, West = 90, South = 180, East = 270 } Angle; typedef struct State { int xPosition; int yPosition; Angle angle; } State; // The robot has 5 options: Move Forward, Move Backwards, Turn Left, Turn Right, Stay typedef enum Action { Stay, Forward, Backwards, Right, Left } Action; Action chooseRandomAction(); Action chooseAction(const State &state); void update(const State &state, const Action action, const State &statePrime); #endif
[ "rebecca@dun.org" ]
rebecca@dun.org
36e0d077db2b2dc970e8f951dd543e58bc55a3bb
c68c03151c383266c556a3f879a939ff2b21d20a
/src/structs.h
0e4f5aa97e7b81b2726bdbf46f379bc7bc0619fc
[]
no_license
SCMcLaughlin/wld2bmp
0c96c7825cfb886468e281fb9703e75bf4c5b6f8
f24ba00ad2931852ceaf8e726536b9080aa2d92c
refs/heads/master
2020-06-14T00:02:32.627694
2016-12-04T15:04:19
2016-12-04T15:04:19
75,542,557
0
0
null
null
null
null
UTF-8
C
false
false
1,438
h
#ifndef STRUCTS_H #define STRUCTS_H #include "define.h" #include "structs_wld_frag.h" typedef void(*ElemCallback)(void*); typedef int(*CmpCallback)(const void*, const void*); /* Low-level containers */ typedef struct SimpleBuffer SimpleBuffer; typedef struct SimpleBuffer SimpleString; typedef struct Array { uint32_t count; uint32_t capacity; uint32_t elemSize; byte* data; } Array; typedef struct String { uint32_t length; uint32_t capacity; char* data; } String; typedef struct HashTblEnt { union { SimpleString* keyStr; /* The hash table makes private copies of all string keys */ int64_t keyInt; }; uint32_t hash; uint32_t next; byte data[0]; } HashTblEnt; typedef void(*HashEntryCallback)(HashTblEnt* ent); typedef struct HashTbl { uint32_t capacity; uint32_t elemSize; uint32_t freeIndex; uint32_t entSize; /* Ensures each HashTblEnt will be a multiple of 8 bytes */ byte* data; } HashTbl; /* High-level containers */ typedef struct Pfs { Array entries; HashTbl byName; SimpleString* raw; SimpleString* path; } Pfs; typedef struct Wld { Array fragsByIndex; HashTbl fragsByNameRef; char* strings; int stringsLength; SimpleBuffer* data; } Wld; #endif/*STRUCTS_H*/
[ "scamclaughlin@gmail.com" ]
scamclaughlin@gmail.com
1630a64fa6bbdb42d12b6407354f8c12c4f17591
e25bae8359c5bdc4eb1854eec2c21bf22a19fb2e
/IPC_LIB/src/socket_udp/socket_udp.h
8a3c2f82b115925d2398489bb2e611738b1c5fd5
[]
no_license
kervias/os-ipc
6e2751596491c4884233d40906d98b2d7926282a
4aad6e2adcb757dd2e447fce06a64493a5d2cda3
refs/heads/master
2023-01-20T19:34:08.620080
2020-12-04T10:54:32
2020-12-04T10:54:32
318,485,682
2
0
null
null
null
null
UTF-8
C
false
false
814
h
// // Created by kervias on 20-8-17. // #ifndef SOCKET_UDP_SOCKET_UDP_H #define SOCKET_UDP_SOCKET_UDP_H #ifdef __cplusplus extern "C" { #endif #include "../common/model.h" bool init_socket_udp_cb( SOCKET_UDP_CB *socket_udp_cb, IPC_SEND_OR_RECEIVE type, char *ip_send, size_t ip_send_len, unsigned short port_send, char *ip_receive, size_t ip_receive_len, unsigned short port_receive ); bool close_socket_udp_cb(SOCKET_UDP_CB *socket_udp_cb); bool socket_udp_receive_msg(SOCKET_UDP_CB *socket_udp_cb, SOCKET_UDP_MSG *socket_udp_msg); bool socket_udp_send_msg(SOCKET_UDP_CB *socket_udp_cb, SOCKET_UDP_MSG *socket_udp_msg); int socket_udp_get_errcode(SOCKET_UDP_CB *socket_udp_cb); #ifdef __cplusplus } #endif #endif //SOCKET_UDP_SOCKET_UDP_H
[ "3032964558@qq.com" ]
3032964558@qq.com
9f73179a7104c6e267a0b9ae3320df1252dd4d5d
5fea83a36b057a38d78aa57040a29bba98f3ee6f
/AED 1 Lista 10/4-calculodeareadeumcirculo/main.c
5faaf6bb5bc8c69028db5e23c247b1c96f0e7373
[]
no_license
andrelucasrc/Aed-1
0f09b13d4a2e612a796467f8d3a07355fecf05b1
f5a2f52c84cbfa62b11bdaa180f8667ae4bb4253
refs/heads/master
2020-05-28T06:27:39.141199
2019-06-27T01:40:05
2019-06-27T01:40:05
188,908,730
1
1
null
2019-05-27T22:52:07
2019-05-27T21:01:56
C
UTF-8
C
false
false
752
c
#include<stdlib.h> #include<stdio.h> //prototipos de funcao void _apresentacao(); float _leraio(); float _calculodearea(float raio); int main() { float raio, area; _apresentacao(); raio=_leraio(); area=_calculodearea(raio); printf("\nA area deste circulo eh igual a %.2f",area); return 0; } //corpo das funcoes void _apresentacao() { printf("\nOla! O objetivo deste programa eh calcular a area de um circulo."); } float _leraio() { float raio; printf("\nDigite o valor do raio do circulo: "); scanf("%f",&raio); return raio; } float _calculodearea(float raio) { const float pi=3.14; float area; area=raio*raio*pi; return area; }
[ "andrelucassribeiro@gmail.com" ]
andrelucassribeiro@gmail.com
66215e8d5ecafb3ccdee12e137184992f3e85437
d6e76279ac701e53725a3e79ee91d875f4842b22
/Recursion/TaylorsSeriesIterative/main.c
50cec99bddef36a3b85e5b1afc1a6d4cd654db5d
[ "MIT" ]
permissive
XrossFox/DataStructuresC
1dc291c9e0306abb8ff35863f496619b0fa2c047
0be8c5cbbafbbb9dcaab38e9b256279ce41b0700
refs/heads/master
2023-03-18T00:14:46.233247
2021-03-09T21:20:47
2021-03-09T21:20:47
268,606,358
0
0
null
null
null
null
UTF-8
C
false
false
289
c
#include <stdio.h> double e(int x, int n){ double s = 1; int i; double num = 1; double den = 1; for (i = 1; i <= n; i++){ num *= x; den *= i; s += num / den; } return s; } int main(){ printf("%lf \n", e(1,10)); return 0; }
[ "warhead_1090@hotmail.com" ]
warhead_1090@hotmail.com
8f5c5a751a208b0f3e8f9faa152771d6a84a92fa
8f826d1a42795e3d612ecc2a5c6fc4019339c79c
/apps/queue_tester_example.c
25097eafaa37d5c23478bdc39ab5c9f2f01ed9ba
[]
no_license
hengzeforever/ECS150project2
a7a5c5f87a6710e7580837e4d4d725dfe59da0f1
4012cceff04038265944c63ffa946474504e8e99
refs/heads/main
2023-02-28T19:43:18.558853
2021-02-13T03:57:14
2021-02-13T03:57:14
338,236,317
0
0
null
2021-02-12T05:55:55
2021-02-12T05:55:55
null
UTF-8
C
false
false
527
c
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <queue.h> /* Create */ void test_create(void) { fprintf(stderr, "*** TEST create ***\n"); TEST_ASSERT(queue_create() != NULL); } /* Enqueue/Dequeue simple */ void test_queue_simple(void) { int data = 3, *ptr; queue_t q; fprintf(stderr, "*** TEST queue_simple ***\n"); q = queue_create(); queue_enqueue(q, &data); queue_dequeue(q, (void**)&ptr); TEST_ASSERT(ptr == &data); } int main(void) { test_create(); test_queue_simple(); return 0; }
[ "noreply@github.com" ]
hengzeforever.noreply@github.com
f76f188be213bcc094679897128e069b799ca198
6b812a634dbf7cf56d4b4f2e3b542e2121bd8379
/ft_ls/libft/srcs/ft_strchr.c
ece6ff6ce1e076da4a416e4aa3d314d36ea98f5d
[]
no_license
ElKite/42
f10ed7898f052973f26866d5d873350bb3105dce
a4fe9c5e4d53afab2f14e65070c214c519691fb3
refs/heads/master
2021-01-18T22:46:56.890323
2017-03-20T13:02:57
2017-03-20T13:02:57
49,452,976
0
0
null
null
null
null
UTF-8
C
false
false
1,080
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vtarreau <vtarreau@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2014/11/04 16:40:49 by vtarreau #+# #+# */ /* Updated: 2014/11/11 15:58:23 by vtarreau ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strchr(const char *s1, int c) { unsigned int i; i = 0; while (i <= ft_strlen(s1)) { if (s1[i] == c) return ((char*)&s1[i]); i++; } return (0); }
[ "vtarreau@e1r11p4.42.fr" ]
vtarreau@e1r11p4.42.fr
e4d8be4489d1e5504e9bf458170cfb692d5c61e4
9a47f58b06a18fc64333133e65a4b5c6f1b82a22
/vendors/andes/boards/corvette_f1_n25/aws_demos/application_code/main.c
489dd3d0b9ecf1499c530c8976cd49f1c76969f4
[ "MIT" ]
permissive
andestech/amazon-freertos
e3d38b199f1d707e282dd0f8aff5edeb8d7d3f2b
e7a096c68ad5c0dc5d8bd864cd3e197038edb398
refs/heads/master
2021-07-08T12:16:52.667073
2020-11-23T03:00:55
2020-11-23T03:00:55
212,726,360
4
4
MIT
2019-11-13T00:27:30
2019-10-04T03:06:57
C
UTF-8
C
false
false
10,779
c
/* * Amazon FreeRTOS V1.1.4 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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. * * http://aws.amazon.com/freertos * http://www.FreeRTOS.org */ #include <stdio.h> /* FreeRTOS includes. */ #include "FreeRTOS.h" #include "task.h" #include "FreeRTOS_IP.h" #include "FreeRTOS_Sockets.h" /* Platfrom includes. */ #include "uart.h" #include "platform.h" #include "mbedtls/platform.h" /* Demo includes */ #include "aws_demo.h" /* AWS library includes. */ #include "iot_system_init.h" #include "iot_logging_task.h" #include "iot_wifi.h" #include "aws_clientcredential.h" #include "aws_application_version.h" #include "aws_dev_mode_key_provisioning.h" /* Logging Task Defines. */ #define mainLOGGING_MESSAGE_QUEUE_LENGTH ( 15 ) #define mainLOGGING_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 8 ) /* Unit test defines. */ #define mainTEST_RUNNER_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 16 ) /* The task delay for allowing the lower priority logging task to print out Wi-Fi * failure status before blocking indefinitely. */ #define mainLOGGING_WIFI_STATUS_DELAY pdMS_TO_TICKS( 1000 ) /* The name of the devices for xApplicationDNSQueryHook. */ #define mainDEVICE_NICK_NAME "Corvette-F1 N25" /* Static arrays for FreeRTOS-Plus-TCP stack initialization for Ethernet network * connections are declared below. If you are using an Ethernet connection on your MCU * device it is recommended to use the FreeRTOS+TCP stack. The default values are * defined in FreeRTOSConfig.h. */ /* Default MAC address configuration. The application creates a virtual network * connection that uses this MAC address by accessing the raw Ethernet data * to and from a real network connection on the host PC. See the * configNETWORK_INTERFACE_TO_USE definition for information on how to configure * the real network connection to use. */ static uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 }; /* The default IP and MAC address used by the application. The address configuration * defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is * 1 but a DHCP server could not be contacted. See the online documentation for * more information. */ static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 }; static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 }; static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 }; static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 }; /** * @brief Application task startup hook for applications using Wi-Fi. If you are not * using Wi-Fi, then start network dependent applications in the vApplicationIPNetorkEventHook * function. If you are not using Wi-Fi, this hook can be disabled by setting * configUSE_DAEMON_TASK_STARTUP_HOOK to 0. */ void vApplicationDaemonTaskStartupHook( void ); /** * @brief Application IP network event hook called by the FreeRTOS+TCP stack for * applications using Ethernet. If you are not using Ethernet and the FreeRTOS+TCP stack, * start network dependent applications in vApplicationDaemonTaskStartupHook after the * network status is up. */ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ); /** * @brief Initializes the board. */ static void prvMiscInitialization( void ); static void prvSetupHardware( void ); /*-----------------------------------------------------------*/ /*NV seed function*/ extern int nv_seed_read_func( unsigned char *buf, size_t buf_len ); extern int nv_seed_write_func( unsigned char *buf, size_t buf_len ); extern void Init_PKCS11(); /** * @brief Application runtime entry point. */ int main( void ) { /* Perform any hardware initialization that does not require the RTOS to be * running. */ prvMiscInitialization(); /* Create tasks that are not dependent on the Wi-Fi being initialized. */ xLoggingTaskInitialize( mainLOGGING_TASK_STACK_SIZE, tskIDLE_PRIORITY, mainLOGGING_MESSAGE_QUEUE_LENGTH ); FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress ); /* Start the scheduler. Initialization that requires the OS to be running, * including the Wi-Fi initialization, is performed in the RTOS daemon task * startup hook. */ vTaskStartScheduler(); return 0; } /*-----------------------------------------------------------*/ static void prvMiscInitialization( void ) { prvSetupHardware(); configPRINT_STRING("Test Message"); } /*-----------------------------------------------------------*/ void vApplicationDaemonTaskStartupHook( void ) { Init_PKCS11(); mbedtls_platform_set_nv_seed( &nv_seed_read_func, &nv_seed_write_func); } /*-----------------------------------------------------------*/ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) { if (eNetworkEvent == eNetworkUp) { configPRINT("Network connection successful.\n\r"); } uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress; char cBuffer[ 16 ]; static BaseType_t xTasksAlreadyCreated = pdFALSE; /* If the network has just come up...*/ if( eNetworkEvent == eNetworkUp ) { if( SYSTEM_Init() == pdPASS && xTasksAlreadyCreated == pdFALSE ) { /* A simple example to demonstrate key and certificate provisioning in * microcontroller flash using PKCS#11 interface. This should be replaced * by production ready key provisioning mechanism. */ vDevModeKeyProvisioning(); /* Start the demo tasks. */ DEMO_RUNNER_RunDemos(); xTasksAlreadyCreated = pdTRUE; } /* Print out the network configuration, which may have come from a DHCP * server. */ FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress ); FreeRTOS_inet_ntoa( ulIPAddress, cBuffer ); FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) ); FreeRTOS_inet_ntoa( ulNetMask, cBuffer ); FreeRTOS_printf( ( "Subnet Mask: %s\r\n", cBuffer ) ); FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer ); FreeRTOS_printf( ( "Gateway Address: %s\r\n", cBuffer ) ); FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer ); FreeRTOS_printf( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) ); } } /*-----------------------------------------------------------*/ /** * @brief User defined Idle task function. * * @note Do not make any blocking operations in this function. */ void vApplicationIdleHook( void ) { static TickType_t xLastPrint = 0; TickType_t xTimeNow; const TickType_t xPrintFrequency = pdMS_TO_TICKS( 5000 ); xTimeNow = xTaskGetTickCount(); if( ( xTimeNow - xLastPrint ) > xPrintFrequency ) { configPRINT( "." ); xLastPrint = xTimeNow; } } /*-----------------------------------------------------------*/ /** * @brief User defined application hook to process names returned by the DNS server. */ #if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) BaseType_t xApplicationDNSQueryHook( const char * pcName ) { BaseType_t xReturn; /* Determine if a name lookup is for this node. Two names are given * to this node: that returned by pcApplicationHostnameHook() and that set * by mainDEVICE_NICK_NAME. */ if( strcmp( pcName, pcApplicationHostnameHook() ) == 0 ) { xReturn = pdPASS; } else if( strcmp( pcName, mainDEVICE_NICK_NAME ) == 0 ) { xReturn = pdPASS; } else { xReturn = pdFAIL; } return xReturn; } #endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */ /*-----------------------------------------------------------*/ /** * @brief User defined assertion call. This function is plugged into configASSERT. * See FreeRTOSConfig.h to define configASSERT to something different. */ void vAssertCalled(const char * pcFile, uint32_t ulLine) { const uint32_t ulLongSleep = 1000UL; volatile uint32_t ulBlockVariable = 0UL; volatile char * pcFileName = (volatile char *)pcFile; volatile uint32_t ulLineNumber = ulLine; (void)pcFileName; (void)ulLineNumber; printf("vAssertCalled %s, %ld\n", pcFile, (long)ulLine); fflush(stdout); /* Setting ulBlockVariable to a non-zero value in the debugger will allow * this function to be exited. */ taskDISABLE_INTERRUPTS(); { while (ulBlockVariable == 0UL) { vTaskDelay( pdMS_TO_TICKS( ulLongSleep ) ); } } taskENABLE_INTERRUPTS(); } /*-----------------------------------------------------------*/ /* * Platform dependent function */ static void prvSetupHardware( void ) { /* Ensure no interrupts execute while the scheduler is in an inconsistent * state. Interrupts are automatically enabled when the scheduler is * started. */ portDISABLE_INTERRUPTS(); /* Enable UART port to output messages. */ uart_init(DEV_UART2); }
[ "yunkai@andestech.com" ]
yunkai@andestech.com
ae269ea8c9b47a5f2035dd45361320be57d53ff9
94e8344ee420ae4d2eb1643e95973845f341a3d2
/gcc_4.3.0_mutants/mutant103664_c-typeck.c
38cca899fd2e172385ed30aecb2196b22b646564
[]
no_license
agroce/compilermutants
94f1e9ac5b43e1f8e5c2fdc17fa627d434e082f3
dc2f572c9bfe1eb7a38999aaf61d5e0a2bc98991
refs/heads/master
2022-02-26T21:19:35.873618
2019-09-24T15:30:14
2019-09-24T15:30:14
207,345,370
1
0
null
null
null
null
UTF-8
C
false
false
271,127
c
/* Build expressions with type checking for C compiler. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ /* This file is part of the C front end. It contains routines to build C expressions given their operands, including computing the types of the result, C-specific error checks, and some optimization. */ #include "config.h" #include "system.h" #include "coretypes.h" #include "tm.h" #include "rtl.h" #include "tree.h" #include "langhooks.h" #include "c-tree.h" #include "tm_p.h" #include "flags.h" #include "output.h" #include "expr.h" #include "toplev.h" #include "intl.h" #include "ggc.h" #include "target.h" #include "tree-iterator.h" #include "tree-gimple.h" #include "tree-flow.h" /* Possible cases of implicit bad conversions. Used to select diagnostic messages in convert_for_assignment. */ enum impl_conv { ic_argpass, ic_argpass_nonproto, ic_assign, ic_init, ic_return }; /* The level of nesting inside "__alignof__". */ int in_alignof; /* The level of nesting inside "sizeof". */ int in_sizeof; /* The level of nesting inside "typeof". */ int in_typeof; struct c_label_context_se *label_context_stack_se; struct c_label_context_vm *label_context_stack_vm; /* Nonzero if we've already printed a "missing braces around initializer" message within this initializer. */ static int missing_braces_mentioned; static int require_constant_value; static int require_constant_elements; static bool null_pointer_constant_p (const_tree); static tree qualify_type (tree, tree); static int tagged_types_tu_compatible_p (const_tree, const_tree); static int comp_target_types (tree, tree); static int function_types_compatible_p (const_tree, const_tree); static int type_lists_compatible_p (const_tree, const_tree); static tree decl_constant_value_for_broken_optimization (tree); static tree lookup_field (tree, tree); static int convert_arguments (int, tree *, tree, tree, tree, tree); static tree pointer_diff (tree, tree); static tree convert_for_assignment (tree, tree, enum impl_conv, tree, tree, int); static tree valid_compound_expr_initializer (tree, tree); static void push_string (const char *); static void push_member_name (tree); static int spelling_length (void); static char *print_spelling (char *); static void warning_init (const char *); static tree digest_init (tree, tree, bool, int); static void output_init_element (tree, bool, tree, tree, int); static void output_pending_init_elements (int); static int set_designator (int); static void push_range_stack (tree); static void add_pending_init (tree, tree); static void set_nonincremental_init (void); static void set_nonincremental_init_from_string (tree); static tree find_init_member (tree); static void readonly_error (tree, enum lvalue_use); static int lvalue_or_else (const_tree, enum lvalue_use); static int lvalue_p (const_tree); static void record_maybe_used_decl (tree); static int comptypes_internal (const_tree, const_tree); /* Return true if EXP is a null pointer constant, false otherwise. */ static bool null_pointer_constant_p (const_tree expr) { /* This should really operate on c_expr structures, but they aren't yet available everywhere required. */ tree type = TREE_TYPE (expr); return (TREE_CODE (expr) == INTEGER_CST && !TREE_OVERFLOW (expr) && integer_zerop (expr) && (INTEGRAL_TYPE_P (type) || (TREE_CODE (type) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type)) && TYPE_QUALS (TREE_TYPE (type)) == TYPE_UNQUALIFIED))); } /* This is a cache to hold if two types are compatible or not. */ struct tagged_tu_seen_cache { const struct tagged_tu_seen_cache * next; const_tree t1; const_tree t2; /* The return value of tagged_types_tu_compatible_p if we had seen these two types already. */ int val; }; static const struct tagged_tu_seen_cache * tagged_tu_seen_base; static void free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *); /* Do `exp = require_complete_type (exp);' to make sure exp does not have an incomplete type. (That includes void types.) */ tree require_complete_type (tree value) { tree type = TREE_TYPE (value); if (value == error_mark_node || type == error_mark_node) return error_mark_node; /* First, detect a valid value with a complete type. */ if (COMPLETE_TYPE_P (type)) return value; c_incomplete_type_error (value, type); return error_mark_node; } /* Print an error message for invalid use of an incomplete type. VALUE is the expression that was used (or 0 if that isn't known) and TYPE is the type that was invalid. */ void c_incomplete_type_error (const_tree value, const_tree type) { const char *type_code_string; /* Avoid duplicate error message. */ if (TREE_CODE (type) == ERROR_MARK) return; if (value != 0 && (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == PARM_DECL)) error ("%qD has an incomplete type", value); else { retry: /* We must print an error message. Be clever about what it says. */ switch (TREE_CODE (type)) { case RECORD_TYPE: type_code_string = "struct"; break; case UNION_TYPE: type_code_string = "union"; break; case ENUMERAL_TYPE: type_code_string = "enum"; break; case VOID_TYPE: error ("invalid use of void expression"); return; case ARRAY_TYPE: if (TYPE_DOMAIN (type)) { if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) == NULL) { error ("invalid use of flexible array member"); return; } type = TREE_TYPE (type); goto retry; } error ("invalid use of array with unspecified bounds"); return; default: gcc_unreachable (); } if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) error ("invalid use of undefined type %<%s %E%>", type_code_string, TYPE_NAME (type)); else /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ error ("invalid use of incomplete typedef %qD", TYPE_NAME (type)); } } /* Given a type, apply default promotions wrt unnamed function arguments and return the new type. */ tree c_type_promotes_to (tree type) { if (TYPE_MAIN_VARIANT (type) == float_type_node) return double_type_node; if (c_promoting_integer_type_p (type)) { /* Preserve unsignedness if not really getting any wider. */ if (TYPE_UNSIGNED (type) && (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) return unsigned_type_node; return integer_type_node; } return type; } /* Return a variant of TYPE which has all the type qualifiers of LIKE as well as those of TYPE. */ static tree qualify_type (tree type, tree like) { return c_build_qualified_type (type, TYPE_QUALS (type) | TYPE_QUALS (like)); } /* Return true iff the given tree T is a variable length array. */ bool c_vla_type_p (const_tree t) { if (TREE_CODE (t) == ARRAY_TYPE && C_TYPE_VARIABLE_SIZE (t)) return true; return false; } /* Return the composite type of two compatible types. We assume that comptypes has already been done and returned nonzero; if that isn't so, this may crash. In particular, we assume that qualifiers match. */ tree composite_type (tree t1, tree t2) { enum tree_code code1; enum tree_code code2; tree attributes; /* Save time if the two types are the same. */ if (t1 == t2) return t1; /* If one type is nonsense, use the other. */ if (t1 == error_mark_node) return t2; if (t2 == error_mark_node) return t1; code1 = TREE_CODE (t1); code2 = TREE_CODE (t2); /* Merge the attributes. */ attributes = targetm.merge_type_attributes (t1, t2); /* If one is an enumerated type and the other is the compatible integer type, the composite type might be either of the two (DR#013 question 3). For consistency, use the enumerated type as the composite type. */ if (code1 == ENUMERAL_TYPE && code2 == INTEGER_TYPE) return t1; if (code2 == ENUMERAL_TYPE && code1 == INTEGER_TYPE) return t2; gcc_assert (code1 == code2); switch (code1) { case POINTER_TYPE: /* For two pointers, do this recursively on the target type. */ { tree pointed_to_1 = TREE_TYPE (t1); tree pointed_to_2 = TREE_TYPE (t2); tree target = composite_type (pointed_to_1, pointed_to_2); t1 = build_pointer_type (target); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } case ARRAY_TYPE: { tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); int quals; tree unqual_elt; tree d1 = TYPE_DOMAIN (t1); tree d2 = TYPE_DOMAIN (t2); bool d1_variable, d2_variable; bool d1_zero, d2_zero; /* We should not have any type quals on arrays at all. */ gcc_assert (!TYPE_QUALS (t1) && !TYPE_QUALS (t2)); d1_zero = d1 == 0 || !TYPE_MAX_VALUE (d1); d2_zero = d2 == 0 || !TYPE_MAX_VALUE (d2); d1_variable = (!d1_zero && (TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST)); d2_variable = (!d2_zero && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); /* Save space: see if the result is identical to one of the args. */ if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1) && (d2_variable || d2_zero || !d1_variable)) return build_type_attribute_variant (t1, attributes); if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2) && (d1_variable || d1_zero || !d2_variable)) return build_type_attribute_variant (t2, attributes); if (elt == TREE_TYPE (t1) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) return build_type_attribute_variant (t1, attributes); if (elt == TREE_TYPE (t2) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) return build_type_attribute_variant (t2, attributes); /* Merge the element types, and have a size if either arg has one. We may have qualifiers on the element types. To set up TYPE_MAIN_VARIANT correctly, we need to form the composite of the unqualified types and add the qualifiers back at the end. */ quals = TYPE_QUALS (strip_array_types (elt)); unqual_elt = c_build_qualified_type (elt, TYPE_UNQUALIFIED); t1 = build_array_type (unqual_elt, TYPE_DOMAIN ((TYPE_DOMAIN (t1) && (d2_variable || d2_zero || !d1_variable)) ? t1 : t2)); t1 = c_build_qualified_type (t1, quals); return build_type_attribute_variant (t1, attributes); } case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: if (attributes != NULL) { /* Try harder not to create a new aggregate type. */ if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes)) return t1; if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes)) return t2; } return build_type_attribute_variant (t1, attributes); case FUNCTION_TYPE: /* Function types: prefer the one that specified arg types. If both do, merge the arg types. Also merge the return types. */ { tree valtype = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); tree p1 = TYPE_ARG_TYPES (t1); tree p2 = TYPE_ARG_TYPES (t2); int len; tree newargs, n; int i; /* Save space: see if the result is identical to one of the args. */ if (valtype == TREE_TYPE (t1) && !TYPE_ARG_TYPES (t2)) return build_type_attribute_variant (t1, attributes); if (valtype == TREE_TYPE (t2) && !TYPE_ARG_TYPES (t1)) return build_type_attribute_variant (t2, attributes); /* Simple way if one arg fails to specify argument types. */ if (TYPE_ARG_TYPES (t1) == 0) { t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } if (TYPE_ARG_TYPES (t2) == 0) { t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } /* If both args specify argument types, we must merge the two lists, argument by argument. */ /* Tell global_bindings_p to return false so that variable_size doesn't die on VLAs in parameter types. */ c_override_global_bindings_to_false = true; len = list_length (p1); newargs = 0; for (i = 0; i < len; i++) newargs = tree_cons (NULL_TREE, NULL_TREE, newargs); n = newargs; for (; p1; p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n)) { /* A null type means arg type is not specified. Take whatever the other function type has. */ if (TREE_VALUE (p1) == 0) { TREE_VALUE (n) = TREE_VALUE (p2); goto parm_done; } if (TREE_VALUE (p2) == 0) { TREE_VALUE (n) = TREE_VALUE (p1); goto parm_done; } /* Given wait (union {union wait *u; int *i} *) and wait (union wait *), prefer union wait * as type of parm. */ if (TREE_CODE (TREE_VALUE (p1)) == UNION_TYPE && TREE_VALUE (p1) != TREE_VALUE (p2)) { tree memb; tree mv2 = TREE_VALUE (p2); if (mv2 && mv2 != error_mark_node && TREE_CODE (mv2) != ARRAY_TYPE) mv2 = TYPE_MAIN_VARIANT (mv2); for (memb = TYPE_FIELDS (TREE_VALUE (p1)); memb; memb = TREE_CHAIN (memb)) { tree mv3 = TREE_TYPE (memb); if (mv3 && mv3 != error_mark_node && TREE_CODE (mv3) != ARRAY_TYPE) mv3 = TYPE_MAIN_VARIANT (mv3); if (comptypes (mv3, mv2)) { TREE_VALUE (n) = composite_type (TREE_TYPE (memb), TREE_VALUE (p2)); if (pedantic) pedwarn ("function types not truly compatible in ISO C"); goto parm_done; } } } if (TREE_CODE (TREE_VALUE (p2)) == UNION_TYPE && TREE_VALUE (p2) != TREE_VALUE (p1)) { tree memb; tree mv1 = TREE_VALUE (p1); if (mv1 && mv1 != error_mark_node && TREE_CODE (mv1) != ARRAY_TYPE) mv1 = TYPE_MAIN_VARIANT (mv1); for (memb = TYPE_FIELDS (TREE_VALUE (p2)); memb; memb = TREE_CHAIN (memb)) { tree mv3 = TREE_TYPE (memb); if (mv3 && mv3 != error_mark_node && TREE_CODE (mv3) != ARRAY_TYPE) mv3 = TYPE_MAIN_VARIANT (mv3); if (comptypes (mv3, mv1)) { TREE_VALUE (n) = composite_type (TREE_TYPE (memb), TREE_VALUE (p1)); if (pedantic) pedwarn ("function types not truly compatible in ISO C"); goto parm_done; } } } TREE_VALUE (n) = composite_type (TREE_VALUE (p1), TREE_VALUE (p2)); parm_done: ; } c_override_global_bindings_to_false = false; t1 = build_function_type (valtype, newargs); t1 = qualify_type (t1, t2); /* ... falls through ... */ } default: return build_type_attribute_variant (t1, attributes); } } /* Return the type of a conditional expression between pointers to possibly differently qualified versions of compatible types. We assume that comp_target_types has already been done and returned nonzero; if that isn't so, this may crash. */ static tree common_pointer_type (tree t1, tree t2) { tree attributes; tree pointed_to_1, mv1; tree pointed_to_2, mv2; tree target; unsigned target_quals; /* Save time if the two types are the same. */ if (t1 == t2) return t1; /* If one type is nonsense, use the other. */ if (t1 == error_mark_node) return t2; if (t2 == error_mark_node) return t1; gcc_assert (TREE_CODE (t1) == POINTER_TYPE && TREE_CODE (t2) == POINTER_TYPE); /* Merge the attributes. */ attributes = targetm.merge_type_attributes (t1, t2); /* Find the composite type of the target types, and combine the qualifiers of the two types' targets. Do not lose qualifiers on array element types by taking the TYPE_MAIN_VARIANT. */ mv1 = pointed_to_1 = TREE_TYPE (t1); mv2 = pointed_to_2 = TREE_TYPE (t2); if (TREE_CODE (mv1) != ARRAY_TYPE) mv1 = TYPE_MAIN_VARIANT (pointed_to_1); if (TREE_CODE (mv2) != ARRAY_TYPE) mv2 = TYPE_MAIN_VARIANT (pointed_to_2); target = composite_type (mv1, mv2); /* For function types do not merge const qualifiers, but drop them if used inconsistently. The middle-end uses these to mark const and noreturn functions. */ if (TREE_CODE (pointed_to_1) == FUNCTION_TYPE) target_quals = TYPE_QUALS (pointed_to_1) & TYPE_QUALS (pointed_to_2); else target_quals = TYPE_QUALS (pointed_to_1) | TYPE_QUALS (pointed_to_2); t1 = build_pointer_type (c_build_qualified_type (target, target_quals)); return build_type_attribute_variant (t1, attributes); } /* Return the common type for two arithmetic types under the usual arithmetic conversions. The default conversions have already been applied, and enumerated types converted to their compatible integer types. The resulting type is unqualified and has no attributes. This is the type for the result of most arithmetic operations if the operands have the given two types. */ static tree c_common_type (tree t1, tree t2) { enum tree_code code1; enum tree_code code2; /* If one type is nonsense, use the other. */ if (t1 == error_mark_node) return t2; if (t2 == error_mark_node) return t1; if (TYPE_QUALS (t1) != TYPE_UNQUALIFIED) t1 = TYPE_MAIN_VARIANT (t1); if (TYPE_QUALS (t2) != TYPE_UNQUALIFIED) t2 = TYPE_MAIN_VARIANT (t2); if (TYPE_ATTRIBUTES (t1) != NULL_TREE) t1 = build_type_attribute_variant (t1, NULL_TREE); if (TYPE_ATTRIBUTES (t2) != NULL_TREE) t2 = build_type_attribute_variant (t2, NULL_TREE); /* Save time if the two types are the same. */ if (t1 == t2) return t1; code1 = TREE_CODE (t1); code2 = TREE_CODE (t2); gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE); gcc_assert (code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE || code2 == INTEGER_TYPE); /* When one operand is a decimal float type, the other operand cannot be a generic float type or a complex type. We also disallow vector types here. */ if ((DECIMAL_FLOAT_TYPE_P (t1) || DECIMAL_FLOAT_TYPE_P (t2)) && !(DECIMAL_FLOAT_TYPE_P (t1) && DECIMAL_FLOAT_TYPE_P (t2))) { if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) { error ("can%'t mix operands of decimal float and vector types"); return error_mark_node; } if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) { error ("can%'t mix operands of decimal float and complex types"); return error_mark_node; } if (code1 == REAL_TYPE && code2 == REAL_TYPE) { error ("can%'t mix operands of decimal float and other float types"); return error_mark_node; } } /* If one type is a vector type, return that type. (How the usual arithmetic conversions apply to the vector types extension is not precisely specified.) */ if (code1 == VECTOR_TYPE) return t1; if (code2 == VECTOR_TYPE) return t2; /* If one type is complex, form the common type of the non-complex components, then make that complex. Use T1 or T2 if it is the required type. */ if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) { tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1; tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2; tree subtype = c_common_type (subtype1, subtype2); if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype) return t1; else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype) return t2; else return build_complex_type (subtype); } /* If only one is real, use it as the result. */ if (code1 == REAL_TYPE && code2 != REAL_TYPE) return t1; if (code2 == REAL_TYPE && code1 != REAL_TYPE) return t2; /* If both are real and either are decimal floating point types, use the decimal floating point type with the greater precision. */ if (code1 == REAL_TYPE && code2 == REAL_TYPE) { if (TYPE_MAIN_VARIANT (t1) == dfloat128_type_node || TYPE_MAIN_VARIANT (t2) == dfloat128_type_node) return dfloat128_type_node; else if (TYPE_MAIN_VARIANT (t1) == dfloat64_type_node || TYPE_MAIN_VARIANT (t2) == dfloat64_type_node) return dfloat64_type_node; else if (TYPE_MAIN_VARIANT (t1) == dfloat32_type_node || TYPE_MAIN_VARIANT (t2) == dfloat32_type_node) return dfloat32_type_node; } /* Deal with fixed-point types. */ if (code1 == FIXED_POINT_TYPE || code2 == FIXED_POINT_TYPE) { unsigned int unsignedp = 0, satp = 0; enum machine_mode m1, m2; unsigned int fbit1, ibit1, fbit2, ibit2, max_fbit, max_ibit; m1 = TYPE_MODE (t1); m2 = TYPE_MODE (t2); /* If one input type is saturating, the result type is saturating. */ if (TYPE_SATURATING (t1) || TYPE_SATURATING (t2)) satp = 1; /* If both fixed-point types are unsigned, the result type is unsigned. When mixing fixed-point and integer types, follow the sign of the fixed-point type. Otherwise, the result type is signed. */ if ((TYPE_UNSIGNED (t1) && TYPE_UNSIGNED (t2) && code1 == FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE) || (code1 == FIXED_POINT_TYPE && code2 != FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)) || (code1 != FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2))) unsignedp = 1; /* The result type is signed. */ if (unsignedp == 0) { /* If the input type is unsigned, we need to convert to the signed type. */ if (code1 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)) { unsigned char mclass = 0; if (GET_MODE_CLASS (m1) == MODE_UFRACT) mclass = MODE_FRACT; else if (GET_MODE_CLASS (m1) == MODE_UACCUM) mclass = MODE_ACCUM; else gcc_unreachable (); m1 = mode_for_size (GET_MODE_PRECISION (m1), mclass, 0); } if (code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2)) { unsigned char mclass = 0; if (GET_MODE_CLASS (m2) == MODE_UFRACT) mclass = MODE_FRACT; else if (GET_MODE_CLASS (m2) == MODE_UACCUM) mclass = MODE_ACCUM; else gcc_unreachable (); m2 = mode_for_size (GET_MODE_PRECISION (m2), mclass, 0); } } if (code1 == FIXED_POINT_TYPE) { fbit1 = GET_MODE_FBIT (m1); ibit1 = GET_MODE_IBIT (m1); } else { fbit1 = 0; /* Signed integers need to subtract one sign bit. */ ibit1 = TYPE_PRECISION (t1) - (!TYPE_UNSIGNED (t1)); } if (code2 == FIXED_POINT_TYPE) { fbit2 = GET_MODE_FBIT (m2); ibit2 = GET_MODE_IBIT (m2); } else { fbit2 = 0; /* Signed integers need to subtract one sign bit. */ ibit2 = TYPE_PRECISION (t2) - (!TYPE_UNSIGNED (t2)); } max_ibit = ibit1 >= ibit2 ? ibit1 : ibit2; max_fbit = fbit1 >= fbit2 ? fbit1 : fbit2; return c_common_fixed_point_type_for_size (max_ibit, max_fbit, unsignedp, satp); } /* Both real or both integers; use the one with greater precision. */ if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2)) return t1; else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1)) return t2; /* Same precision. Prefer long longs to longs to ints when the same precision, following the C99 rules on integer type rank (which are equivalent to the C90 rules for C90 types). */ if (TYPE_MAIN_VARIANT (t1) == long_long_unsigned_type_node || TYPE_MAIN_VARIANT (t2) == long_long_unsigned_type_node) return long_long_unsigned_type_node; if (TYPE_MAIN_VARIANT (t1) == long_long_integer_type_node || TYPE_MAIN_VARIANT (t2) == long_long_integer_type_node) { if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2)) return long_long_unsigned_type_node; else return long_long_integer_type_node; } if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node) return long_unsigned_type_node; if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node || TYPE_MAIN_VARIANT (t2) == long_integer_type_node) { /* But preserve unsignedness from the other type, since long cannot hold all the values of an unsigned int. */ if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2)) return long_unsigned_type_node; else return long_integer_type_node; } /* Likewise, prefer long double to double even if same size. */ if (TYPE_MAIN_VARIANT (t1) == long_double_type_node || TYPE_MAIN_VARIANT (t2) == long_double_type_node) return long_double_type_node; /* Otherwise prefer the unsigned one. */ if (TYPE_UNSIGNED (t1)) return t1; else return t2; } /* Wrapper around c_common_type that is used by c-common.c and other front end optimizations that remove promotions. ENUMERAL_TYPEs are allowed here and are converted to their compatible integer types. BOOLEAN_TYPEs are allowed here and return either boolean_type_node or preferably a non-Boolean type as the common type. */ tree common_type (tree t1, tree t2) { if (TREE_CODE (t1) == ENUMERAL_TYPE) t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1); if (TREE_CODE (t2) == ENUMERAL_TYPE) t2 = c_common_type_for_size (TYPE_PRECISION (t2), 1); /* If both types are BOOLEAN_TYPE, then return boolean_type_node. */ if (TREE_CODE (t1) == BOOLEAN_TYPE && TREE_CODE (t2) == BOOLEAN_TYPE) return boolean_type_node; /* If either type is BOOLEAN_TYPE, then return the other. */ if (TREE_CODE (t1) == BOOLEAN_TYPE) return t2; if (TREE_CODE (t2) == BOOLEAN_TYPE) return t1; return c_common_type (t1, t2); } /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment or various other operations. Return 2 if they are compatible but a warning may be needed if you use them together. */ int comptypes (tree type1, tree type2) { const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base; int val; val = comptypes_internal (type1, type2); free_all_tagged_tu_seen_up_to (tagged_tu_seen_base1); return val; } /* Return 1 if TYPE1 and TYPE2 are compatible types for assignment or various other operations. Return 2 if they are compatible but a warning may be needed if you use them together. This differs from comptypes, in that we don't free the seen types. */ static int comptypes_internal (const_tree type1, const_tree type2) { const_tree t1 = type1; const_tree t2 = type2; int attrval, val; /* Suppress errors caused by previously reported errors. */ if (t1 == t2 || !t1 || !t2 || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK) return 1; /* If either type is the internal version of sizetype, return the language version. */ if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1) && TYPE_ORIG_SIZE_TYPE (t1)) t1 = TYPE_ORIG_SIZE_TYPE (t1); if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2) && TYPE_ORIG_SIZE_TYPE (t2)) t2 = TYPE_ORIG_SIZE_TYPE (t2); /* Enumerated types are compatible with integer types, but this is not transitive: two enumerated types in the same translation unit are compatible with each other only if they are the same type. */ if (TREE_CODE (t1) == ENUMERAL_TYPE && TREE_CODE (t2) != ENUMERAL_TYPE) t1 = c_common_type_for_size (TYPE_PRECISION (t1), TYPE_UNSIGNED (t1)); else if (TREE_CODE (t2) == ENUMERAL_TYPE && TREE_CODE (t1) != ENUMERAL_TYPE) t2 = c_common_type_for_size (TYPE_PRECISION (t2), TYPE_UNSIGNED (t2)); if (t1 == t2) return 1; /* Different classes of types can't be compatible. */ if (TREE_CODE (t1) != TREE_CODE (t2)) return 0; /* Qualifiers must match. C99 6.7.3p9 */ if (TYPE_QUALS (t1) != TYPE_QUALS (t2)) return 0; /* Allow for two different type nodes which have essentially the same definition. Note that we already checked for equality of the type qualifiers (just above). */ if (TREE_CODE (t1) != ARRAY_TYPE && TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) return 1; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ if (!(attrval = targetm.comp_type_attributes (t1, t2))) return 0; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ val = 0; switch (TREE_CODE (t1)) { case POINTER_TYPE: /* Do not remove mode or aliasing information. */ if (TYPE_MODE (t1) != TYPE_MODE (t2) || TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2)) break; val = (TREE_TYPE (t1) == TREE_TYPE (t2) ? 1 : comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2))); break; case FUNCTION_TYPE: val = function_types_compatible_p (t1, t2); break; case ARRAY_TYPE: { tree d1 = TYPE_DOMAIN (t1); tree d2 = TYPE_DOMAIN (t2); bool d1_variable, d2_variable; bool d1_zero, d2_zero; val = 1; /* Target types must match incl. qualifiers. */ if (TREE_TYPE (t1) != TREE_TYPE (t2) && 0 == (val = comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2)))) return 0; /* Sizes must match unless one is missing or variable. */ if (d1 == 0 || d2 == 0 || d1 == d2) break; d1_zero = !TYPE_MAX_VALUE (d1); d2_zero = !TYPE_MAX_VALUE (d2); d1_variable = (!d1_zero && (TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST)); d2_variable = (!d2_zero && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); if (d1_variable || d2_variable) break; if (d1_zero && d2_zero) break; if (d1_zero || d2_zero || !tree_int_cst_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2)) || !tree_int_cst_equal (TYPE_MAX_VALUE (d1), TYPE_MAX_VALUE (d2))) val = 0; break; } case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: if (val != 1 && !same_translation_unit_p (t1, t2)) { tree a1 = TYPE_ATTRIBUTES (t1); tree a2 = TYPE_ATTRIBUTES (t2); if (! attribute_list_contained (a1, a2) && ! attribute_list_contained (a2, a1)) break; if (attrval != 2) return tagged_types_tu_compatible_p (t1, t2); val = tagged_types_tu_compatible_p (t1, t2); } break; case VECTOR_TYPE: val = TYPE_VECTOR_SUBPARTS (t1) == TYPE_VECTOR_SUBPARTS (t2) && comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2)); break; default: break; } return attrval == 2 && val == 1 ? 2 : val; } /* Return 1 if TTL and TTR are pointers to types that are equivalent, ignoring their qualifiers. */ static int comp_target_types (tree ttl, tree ttr) { int val; tree mvl, mvr; /* Do not lose qualifiers on element types of array types that are pointer targets by taking their TYPE_MAIN_VARIANT. */ mvl = TREE_TYPE (ttl); mvr = TREE_TYPE (ttr); if (TREE_CODE (mvl) != ARRAY_TYPE) mvl = TYPE_MAIN_VARIANT (mvl); if (TREE_CODE (mvr) != ARRAY_TYPE) mvr = TYPE_MAIN_VARIANT (mvr); val = comptypes (mvl, mvr); if (val == 2 && pedantic) pedwarn ("types are not quite compatible"); return val; } /* Subroutines of `comptypes'. */ /* Determine whether two trees derive from the same translation unit. If the CONTEXT chain ends in a null, that tree's context is still being parsed, so if two trees have context chains ending in null, they're in the same translation unit. */ int same_translation_unit_p (const_tree t1, const_tree t2) { while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL) switch (TREE_CODE_CLASS (TREE_CODE (t1))) { case tcc_declaration: t1 = DECL_CONTEXT (t1); break; case tcc_type: t1 = TYPE_CONTEXT (t1); break; case tcc_exceptional: t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */ default: gcc_unreachable (); } while (t2 && TREE_CODE (t2) != TRANSLATION_UNIT_DECL) switch (TREE_CODE_CLASS (TREE_CODE (t2))) { case tcc_declaration: t2 = DECL_CONTEXT (t2); break; case tcc_type: t2 = TYPE_CONTEXT (t2); break; case tcc_exceptional: t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */ default: gcc_unreachable (); } return t1 == t2; } /* Allocate the seen two types, assuming that they are compatible. */ static struct tagged_tu_seen_cache * alloc_tagged_tu_seen_cache (const_tree t1, const_tree t2) { struct tagged_tu_seen_cache *tu = XNEW (struct tagged_tu_seen_cache); tu->next = tagged_tu_seen_base; tu->t1 = t1; tu->t2 = t2; tagged_tu_seen_base = tu; /* The C standard says that two structures in different translation units are compatible with each other only if the types of their fields are compatible (among other things). We assume that they are compatible until proven otherwise when building the cache. An example where this can occur is: struct a { struct a *next; }; If we are comparing this against a similar struct in another TU, and did not assume they were compatible, we end up with an infinite loop. */ tu->val = 1; return tu; } /* Free the seen types until we get to TU_TIL. */ static void free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til) { const struct tagged_tu_seen_cache *tu = tagged_tu_seen_base; while (tu != tu_til) { const struct tagged_tu_seen_cache *const tu1 = (const struct tagged_tu_seen_cache *) tu; tu = tu1->next; free (CONST_CAST (struct tagged_tu_seen_cache *, tu1)); } tagged_tu_seen_base = tu_til; } /* Return 1 if two 'struct', 'union', or 'enum' types T1 and T2 are compatible. If the two types are not the same (which has been checked earlier), this can only happen when multiple translation units are being compiled. See C99 6.2.7 paragraph 1 for the exact rules. */ static int tagged_types_tu_compatible_p (const_tree t1, const_tree t2) { tree s1, s2; bool needs_warning = false; /* We have to verify that the tags of the types are the same. This is harder than it looks because this may be a typedef, so we have to go look at the original type. It may even be a typedef of a typedef... In the case of compiler-created builtin structs the TYPE_DECL may be a dummy, with no DECL_ORIGINAL_TYPE. Don't fault. */ while (TYPE_NAME (t1) && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL && DECL_ORIGINAL_TYPE (TYPE_NAME (t1))) t1 = DECL_ORIGINAL_TYPE (TYPE_NAME (t1)); while (TYPE_NAME (t2) && TREE_CODE (TYPE_NAME (t2)) == TYPE_DECL && DECL_ORIGINAL_TYPE (TYPE_NAME (t2))) t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2)); /* C90 didn't have the requirement that the two tags be the same. */ if (flag_isoc99 && TYPE_NAME (t1) != TYPE_NAME (t2)) return 0; /* C90 didn't say what happened if one or both of the types were incomplete; we choose to follow C99 rules here, which is that they are compatible. */ if (TYPE_SIZE (t1) == NULL || TYPE_SIZE (t2) == NULL) return 1; { const struct tagged_tu_seen_cache * tts_i; for (tts_i = tagged_tu_seen_base; tts_i != NULL; tts_i = tts_i->next) if (tts_i->t1 == t1 && tts_i->t2 == t2) return tts_i->val; } switch (TREE_CODE (t1)) { case ENUMERAL_TYPE: { struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); /* Speed up the case where the type values are in the same order. */ tree tv1 = TYPE_VALUES (t1); tree tv2 = TYPE_VALUES (t2); if (tv1 == tv2) { return 1; } for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1), tv2 = TREE_CHAIN (tv2)) { if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv2)) break; if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1) { tu->val = 0; return 0; } } if (tv1 == NULL_TREE && tv2 == NULL_TREE) { return 1; } if (tv1 == NULL_TREE || tv2 == NULL_TREE) { tu->val = 0; return 0; } if (list_length (TYPE_VALUES (t1)) != list_length (TYPE_VALUES (t2))) { tu->val = 0; return 0; } for (s1 = TYPE_VALUES (t1); s1; s1 = TREE_CHAIN (s1)) { s2 = purpose_member (TREE_PURPOSE (s1), TYPE_VALUES (t2)); if (s2 == NULL || simple_cst_equal (TREE_VALUE (s1), TREE_VALUE (s2)) != 1) { tu->val = 0; return 0; } } return 1; } case UNION_TYPE: { struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); if (list_length (TYPE_FIELDS (t1)) != list_length (TYPE_FIELDS (t2))) { tu->val = 0; return 0; } /* Speed up the common case where the fields are in the same order. */ for (s1 = TYPE_FIELDS (t1), s2 = TYPE_FIELDS (t2); s1 && s2; s1 = TREE_CHAIN (s1), s2 = TREE_CHAIN (s2)) { int result; if (DECL_NAME (s1) != DECL_NAME (s2)) break; result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); if (result != 1 && !DECL_NAME (s1)) break; if (result == 0) { tu->val = 0; return 0; } if (result == 2) needs_warning = true; if (TREE_CODE (s1) == FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), DECL_FIELD_BIT_OFFSET (s2)) != 1) { tu->val = 0; return 0; } } if (!s1 && !s2) { tu->val = needs_warning ? 2 : 1; return tu->val; } for (s1 = TYPE_FIELDS (t1); s1; s1 = TREE_CHAIN (s1)) { bool ok = false; for (s2 = TYPE_FIELDS (t2); s2; s2 = TREE_CHAIN (s2)) if (DECL_NAME (s1) == DECL_NAME (s2)) { int result; result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); if (result != 1 && !DECL_NAME (s1)) continue; if (result == 0) { tu->val = 0; return 0; } if (result == 2) needs_warning = true; if (TREE_CODE (s1) == FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), DECL_FIELD_BIT_OFFSET (s2)) != 1) break; ok = true; break; } if (!ok) { tu->val = 0; return 0; } } tu->val = needs_warning ? 2 : 10; return tu->val; } case RECORD_TYPE: { struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); for (s1 = TYPE_FIELDS (t1), s2 = TYPE_FIELDS (t2); s1 && s2; s1 = TREE_CHAIN (s1), s2 = TREE_CHAIN (s2)) { int result; if (TREE_CODE (s1) != TREE_CODE (s2) || DECL_NAME (s1) != DECL_NAME (s2)) break; result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); if (result == 0) break; if (result == 2) needs_warning = true; if (TREE_CODE (s1) == FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), DECL_FIELD_BIT_OFFSET (s2)) != 1) break; } if (s1 && s2) tu->val = 0; else tu->val = needs_warning ? 2 : 1; return tu->val; } default: gcc_unreachable (); } } /* Return 1 if two function types F1 and F2 are compatible. If either type specifies no argument types, the other must specify a fixed number of self-promoting arg types. Otherwise, if one type specifies only the number of arguments, the other must specify that number of self-promoting arg types. Otherwise, the argument types must match. */ static int function_types_compatible_p (const_tree f1, const_tree f2) { tree args1, args2; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ int val = 1; int val1; tree ret1, ret2; ret1 = TREE_TYPE (f1); ret2 = TREE_TYPE (f2); /* 'volatile' qualifiers on a function's return type used to mean the function is noreturn. */ if (TYPE_VOLATILE (ret1) != TYPE_VOLATILE (ret2)) pedwarn ("function return types not compatible due to %<volatile%>"); if (TYPE_VOLATILE (ret1)) ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1), TYPE_QUALS (ret1) & ~TYPE_QUAL_VOLATILE); if (TYPE_VOLATILE (ret2)) ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2), TYPE_QUALS (ret2) & ~TYPE_QUAL_VOLATILE); val = comptypes_internal (ret1, ret2); if (val == 0) return 0; args1 = TYPE_ARG_TYPES (f1); args2 = TYPE_ARG_TYPES (f2); /* An unspecified parmlist matches any specified parmlist whose argument types don't need default promotions. */ if (args1 == 0) { if (!self_promoting_args_p (args2)) return 0; /* If one of these types comes from a non-prototype fn definition, compare that with the other type's arglist. If they don't match, ask for a warning (but no error). */ if (TYPE_ACTUAL_ARG_TYPES (f1) && 1 != type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1))) val = 2; return val; } if (args2 == 0) { if (!self_promoting_args_p (args1)) return 0; if (TYPE_ACTUAL_ARG_TYPES (f2) && 1 != type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2))) val = 2; return val; } /* Both types have argument lists: compare them and propagate results. */ val1 = type_lists_compatible_p (args1, args2); return val1 != 1 ? val1 : val; } /* Check two lists of types for compatibility, returning 0 for incompatible, 1 for compatible, or 2 for compatible with warning. */ static int type_lists_compatible_p (const_tree args1, const_tree args2) { /* 1 if no need for warning yet, 2 if warning cause has been seen. */ int val = 1; int newval = 0; while (1) { tree a1, mv1, a2, mv2; if (args1 == 0 && args2 == 0) return val; /* If one list is shorter than the other, they fail to match. */ if (args1 == 0 || args2 == 0) return 0; mv1 = a1 = TREE_VALUE (args1); mv2 = a2 = TREE_VALUE (args2); if (mv1 && mv1 != error_mark_node && TREE_CODE (mv1) != ARRAY_TYPE) mv1 = TYPE_MAIN_VARIANT (mv1); if (mv2 && mv2 != error_mark_node && TREE_CODE (mv2) != ARRAY_TYPE) mv2 = TYPE_MAIN_VARIANT (mv2); /* A null pointer instead of a type means there is supposed to be an argument but nothing is specified about what type it has. So match anything that self-promotes. */ if (a1 == 0) { if (c_type_promotes_to (a2) != a2) return 0; } else if (a2 == 0) { if (c_type_promotes_to (a1) != a1) return 0; } /* If one of the lists has an error marker, ignore this arg. */ else if (TREE_CODE (a1) == ERROR_MARK || TREE_CODE (a2) == ERROR_MARK) ; else if (!(newval = comptypes_internal (mv1, mv2))) { /* Allow wait (union {union wait *u; int *i} *) and wait (union wait *) to be compatible. */ if (TREE_CODE (a1) == UNION_TYPE && (TYPE_NAME (a1) == 0 || TYPE_TRANSPARENT_UNION (a1)) && TREE_CODE (TYPE_SIZE (a1)) == INTEGER_CST && tree_int_cst_equal (TYPE_SIZE (a1), TYPE_SIZE (a2))) { tree memb; for (memb = TYPE_FIELDS (a1); memb; memb = TREE_CHAIN (memb)) { tree mv3 = TREE_TYPE (memb); if (mv3 && mv3 != error_mark_node && TREE_CODE (mv3) != ARRAY_TYPE) mv3 = TYPE_MAIN_VARIANT (mv3); if (comptypes_internal (mv3, mv2)) break; } if (memb == 0) return 0; } else if (TREE_CODE (a2) == UNION_TYPE && (TYPE_NAME (a2) == 0 || TYPE_TRANSPARENT_UNION (a2)) && TREE_CODE (TYPE_SIZE (a2)) == INTEGER_CST && tree_int_cst_equal (TYPE_SIZE (a2), TYPE_SIZE (a1))) { tree memb; for (memb = TYPE_FIELDS (a2); memb; memb = TREE_CHAIN (memb)) { tree mv3 = TREE_TYPE (memb); if (mv3 && mv3 != error_mark_node && TREE_CODE (mv3) != ARRAY_TYPE) mv3 = TYPE_MAIN_VARIANT (mv3); if (comptypes_internal (mv3, mv1)) break; } if (memb == 0) return 0; } else return 0; } /* comptypes said ok, but record if it said to warn. */ if (newval > val) val = newval; args1 = TREE_CHAIN (args1); args2 = TREE_CHAIN (args2); } } /* Compute the size to increment a pointer by. */ static tree c_size_in_bytes (const_tree type) { enum tree_code code = TREE_CODE (type); if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK) return size_one_node; if (!COMPLETE_OR_VOID_TYPE_P (type)) { error ("arithmetic on pointer to an incomplete type"); return size_one_node; } /* Convert in case a char is more than one unit. */ return size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type), size_int (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT)); } /* Return either DECL or its known constant value (if it has one). */ tree decl_constant_value (tree decl) { if (/* Don't change a variable array bound or initial value to a constant in a place where a variable is invalid. Note that DECL_INITIAL isn't valid for a PARM_DECL. */ current_function_decl != 0 && TREE_CODE (decl) != PARM_DECL && !TREE_THIS_VOLATILE (decl) && TREE_READONLY (decl) && DECL_INITIAL (decl) != 0 && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK /* This is invalid if initial value is not constant. If it has either a function call, a memory reference, or a variable, then re-evaluating it could give different results. */ && TREE_CONSTANT (DECL_INITIAL (decl)) /* Check for cases where this is sub-optimal, even though valid. */ && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR) return DECL_INITIAL (decl); return decl; } /* Return either DECL or its known constant value (if it has one), but return DECL if pedantic or DECL has mode BLKmode. This is for bug-compatibility with the old behavior of decl_constant_value (before GCC 3.0); every use of this function is a bug and it should be removed before GCC 3.1. It is not appropriate to use pedantic in a way that affects optimization, and BLKmode is probably not the right test for avoiding misoptimizations either. */ static tree decl_constant_value_for_broken_optimization (tree decl) { tree ret; if (pedantic || DECL_MODE (decl) == BLKmode) return decl; ret = decl_constant_value (decl); /* Avoid unwanted tree sharing between the initializer and current function's body where the tree can be modified e.g. by the gimplifier. */ if (ret != decl && TREE_STATIC (decl)) ret = unshare_expr (ret); return ret; } /* Convert the array expression EXP to a pointer. */ static tree array_to_pointer_conversion (tree exp) { tree orig_exp = exp; tree type = TREE_TYPE (exp); tree adr; tree restype = TREE_TYPE (type); tree ptrtype; gcc_assert (TREE_CODE (type) == ARRAY_TYPE); STRIP_TYPE_NOPS (exp); if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp) = 1; ptrtype = build_pointer_type (restype); if (TREE_CODE (exp) == INDIRECT_REF) return convert (ptrtype, TREE_OPERAND (exp, 0)); if (TREE_CODE (exp) == VAR_DECL) { /* We are making an ADDR_EXPR of ptrtype. This is a valid ADDR_EXPR because it's the best way of representing what happens in C when we take the address of an array and place it in a pointer to the element type. */ adr = build1 (ADDR_EXPR, ptrtype, exp); if (!c_mark_addressable (exp)) return error_mark_node; TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */ return adr; } /* This way is better for a COMPONENT_REF since it can simplify the offset for a component. */ adr = build_unary_op (ADDR_EXPR, exp, 1); return convert (ptrtype, adr); } /* Convert the function expression EXP to a pointer. */ static tree function_to_pointer_conversion (tree exp) { tree orig_exp = exp; gcc_assert (TREE_CODE (TREE_TYPE (exp)) == FUNCTION_TYPE); STRIP_TYPE_NOPS (exp); if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp) = 1; return build_unary_op (ADDR_EXPR, exp, 0); } /* Perform the default conversion of arrays and functions to pointers. Return the result of converting EXP. For any other expression, just return EXP after removing NOPs. */ struct c_expr default_function_array_conversion (struct c_expr exp) { tree orig_exp = exp.value; tree type = TREE_TYPE (exp.value); enum tree_code code = TREE_CODE (type); switch (code) { case ARRAY_TYPE: { bool not_lvalue = false; bool lvalue_array_p; while ((TREE_CODE (exp.value) == NON_LVALUE_EXPR || TREE_CODE (exp.value) == NOP_EXPR || TREE_CODE (exp.value) == CONVERT_EXPR) && TREE_TYPE (TREE_OPERAND (exp.value, 0)) == type) { if (TREE_CODE (exp.value) == NON_LVALUE_EXPR) not_lvalue = true; exp.value = TREE_OPERAND (exp.value, 0); } if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp.value) = 1; lvalue_array_p = !not_lvalue && lvalue_p (exp.value); if (!flag_isoc99 && !lvalue_array_p) { /* Before C99, non-lvalue arrays do not decay to pointers. Normally, using such an array would be invalid; but it can be used correctly inside sizeof or as a statement expression. Thus, do not give an error here; an error will result later. */ return exp; } exp.value = array_to_pointer_conversion (exp.value); } break; case FUNCTION_TYPE: exp.value = function_to_pointer_conversion (exp.value); break; default: STRIP_TYPE_NOPS (exp.value); if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp.value) = 1; break; } return exp; } /* EXP is an expression of integer type. Apply the integer promotions to it and return the promoted value. */ tree perform_integral_promotions (tree exp) { tree type = TREE_TYPE (exp); enum tree_code code = TREE_CODE (type); gcc_assert (INTEGRAL_TYPE_P (type)); /* Normally convert enums to int, but convert wide enums to something wider. */ if (code == ENUMERAL_TYPE) { type = c_common_type_for_size (MAX (TYPE_PRECISION (type), TYPE_PRECISION (integer_type_node)), ((TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node)) && TYPE_UNSIGNED (type))); return convert (type, exp); } /* ??? This should no longer be needed now bit-fields have their proper types. */ if (TREE_CODE (exp) == COMPONENT_REF && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1)) /* If it's thinner than an int, promote it like a c_promoting_integer_type_p, otherwise leave it alone. */ && 0 > compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)), TYPE_PRECISION (integer_type_node))) return convert (integer_type_node, exp); if (c_promoting_integer_type_p (type)) { /* Preserve unsignedness if not really getting any wider. */ if (TYPE_UNSIGNED (type) && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) return convert (unsigned_type_node, exp); return convert (integer_type_node, exp); } return exp; } /* Perform default promotions for C data used in expressions. Enumeral types or short or char are converted to int. In addition, manifest constants symbols are replaced by their values. */ tree default_conversion (tree exp) { tree orig_exp; tree type = TREE_TYPE (exp); enum tree_code code = TREE_CODE (type); /* Functions and arrays have been converted during parsing. */ gcc_assert (code != FUNCTION_TYPE); if (code == ARRAY_TYPE) return exp; /* Constants can be used directly unless they're not loadable. */ if (TREE_CODE (exp) == CONST_DECL) exp = DECL_INITIAL (exp); /* Replace a nonvolatile const static variable with its value unless it is an array, in which case we must be sure that taking the address of the array produces consistent results. */ else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE) { exp = decl_constant_value_for_broken_optimization (exp); type = TREE_TYPE (exp); } /* Strip no-op conversions. */ orig_exp = exp; STRIP_TYPE_NOPS (exp); if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp) = 1; if (code == VOID_TYPE) { error ("void value not ignored as it ought to be"); return error_mark_node; } exp = require_complete_type (exp); if (exp == error_mark_node) return error_mark_node; if (INTEGRAL_TYPE_P (type)) return perform_integral_promotions (exp); return exp; } /* Look up COMPONENT in a structure or union DECL. If the component name is not found, returns NULL_TREE. Otherwise, the return value is a TREE_LIST, with each TREE_VALUE a FIELD_DECL stepping down the chain to the component, which is in the last TREE_VALUE of the list. Normally the list is of length one, but if the component is embedded within (nested) anonymous structures or unions, the list steps down the chain to the component. */ static tree lookup_field (tree decl, tree component) { tree type = TREE_TYPE (decl); tree field; /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers to the field elements. Use a binary search on this array to quickly find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC will always be set for structures which have many elements. */ if (TYPE_LANG_SPECIFIC (type) && TYPE_LANG_SPECIFIC (type)->s) { int bot, top, half; tree *field_array = &TYPE_LANG_SPECIFIC (type)->s->elts[0]; field = TYPE_FIELDS (type); bot = 0; top = TYPE_LANG_SPECIFIC (type)->s->len; while (top - bot > 1) { half = (top - bot + 1) >> 1; field = field_array[bot+half]; if (DECL_NAME (field) == NULL_TREE) { /* Step through all anon unions in linear fashion. */ while (DECL_NAME (field_array[bot]) == NULL_TREE) { field = field_array[bot++]; if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) { tree anon = lookup_field (field, component); if (anon) return tree_cons (NULL_TREE, field, anon); } } /* Entire record is only anon unions. */ if (bot > top) return NULL_TREE; /* Restart the binary search, with new lower bound. */ continue; } if (DECL_NAME (field) == component) break; if (DECL_NAME (field) < component) bot += half; else top = bot + half; } if (DECL_NAME (field_array[bot]) == component) field = field_array[bot]; else if (DECL_NAME (field) != component) return NULL_TREE; } else { for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { if (DECL_NAME (field) == NULL_TREE && (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)) { tree anon = lookup_field (field, component); if (anon) return tree_cons (NULL_TREE, field, anon); } if (DECL_NAME (field) == component) break; } if (field == NULL_TREE) return NULL_TREE; } return tree_cons (NULL_TREE, field, NULL_TREE); } /* Make an expression to refer to the COMPONENT field of structure or union value DATUM. COMPONENT is an IDENTIFIER_NODE. */ tree build_component_ref (tree datum, tree component) { tree type = TREE_TYPE (datum); enum tree_code code = TREE_CODE (type); tree field = NULL; tree ref; if (!objc_is_public (datum, component)) return error_mark_node; /* See if there is a field or component with name COMPONENT. */ if (code == RECORD_TYPE || code == UNION_TYPE) { if (!COMPLETE_TYPE_P (type)) { c_incomplete_type_error (NULL_TREE, type); return error_mark_node; } field = lookup_field (datum, component); if (!field) { error ("%qT has no member named %qE", type, component); return error_mark_node; } /* Chain the COMPONENT_REFs if necessary down to the FIELD. This might be better solved in future the way the C++ front end does it - by giving the anonymous entities each a separate name and type, and then have build_component_ref recursively call itself. We can't do that here. */ do { tree subdatum = TREE_VALUE (field); int quals; tree subtype; if (TREE_TYPE (subdatum) == error_mark_node) return error_mark_node; quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum))); quals |= TYPE_QUALS (TREE_TYPE (datum)); subtype = c_build_qualified_type (TREE_TYPE (subdatum), quals); ref = build3 (COMPONENT_REF, subtype, datum, subdatum, NULL_TREE); if (TREE_READONLY (datum) || TREE_READONLY (subdatum)) TREE_READONLY (ref) = 1; if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (subdatum)) TREE_THIS_VOLATILE (ref) = 1; if (TREE_DEPRECATED (subdatum)) warn_deprecated_use (subdatum); datum = ref; field = TREE_CHAIN (field); } while (field); return ref; } else if (code != ERROR_MARK) error ("request for member %qE in something not a structure or union", component); return error_mark_node; } /* Given an expression PTR for a pointer, return an expression for the value pointed to. ERRORSTRING is the name of the operator to appear in error messages. */ tree build_indirect_ref (tree ptr, const char *errorstring) { tree pointer = default_conversion (ptr); tree type = TREE_TYPE (pointer); if (TREE_CODE (type) == POINTER_TYPE) { if (TREE_CODE (pointer) == CONVERT_EXPR || TREE_CODE (pointer) == NOP_EXPR || TREE_CODE (pointer) == VIEW_CONVERT_EXPR) { /* If a warning is issued, mark it to avoid duplicates from the backend. This only needs to be done at warn_strict_aliasing > 2. */ if (warn_strict_aliasing > 2) if (strict_aliasing_warning (TREE_TYPE (TREE_OPERAND (pointer, 0)), type, TREE_OPERAND (pointer, 0))) TREE_NO_WARNING (pointer) = 1; } if (TREE_CODE (pointer) == ADDR_EXPR && (TREE_TYPE (TREE_OPERAND (pointer, 0)) == TREE_TYPE (type))) return TREE_OPERAND (pointer, 0); else { tree t = TREE_TYPE (type); tree ref; ref = build1 (INDIRECT_REF, t, pointer); if (!COMPLETE_OR_VOID_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE) { error ("dereferencing pointer to incomplete type"); return error_mark_node; } if (VOID_TYPE_P (t) && skip_evaluation == 0) warning (0, "dereferencing %<void *%> pointer"); /* We *must* set TREE_READONLY when dereferencing a pointer to const, so that we get the proper error message if the result is used to assign to. Also, &* is supposed to be a no-op. And ANSI C seems to specify that the type of the result should be the const type. */ /* A de-reference of a pointer to const is not a const. It is valid to change it via some other pointer. */ TREE_READONLY (ref) = TYPE_READONLY (t); TREE_SIDE_EFFECTS (ref) = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer); TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t); return ref; } } else if (TREE_CODE (pointer) != ERROR_MARK) error ("invalid type argument of %qs (have %qT)", errorstring, type); return error_mark_node; } /* This handles expressions of the form "a[i]", which denotes an array reference. This is logically equivalent in C to *(a+i), but we may do it differently. If A is a variable or a member, we generate a primitive ARRAY_REF. This avoids forcing the array out of registers, and can work on arrays that are not lvalues (for example, members of structures returned by functions). */ tree build_array_ref (tree array, tree index) { bool swapped = false; if (TREE_TYPE (array) == error_mark_node || TREE_TYPE (index) == error_mark_node) return error_mark_node; if (TREE_CODE (TREE_TYPE (array)) != ARRAY_TYPE && TREE_CODE (TREE_TYPE (array)) != POINTER_TYPE) { tree temp; if (TREE_CODE (TREE_TYPE (index)) != ARRAY_TYPE && TREE_CODE (TREE_TYPE (index)) != POINTER_TYPE) { error ("subscripted value is neither array nor pointer"); return error_mark_node; } temp = array; array = index; index = temp; swapped = true; } if (!INTEGRAL_TYPE_P (TREE_TYPE (index))) { error ("array subscript is not an integer"); return error_mark_node; } if (TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == FUNCTION_TYPE) { error ("subscripted value is pointer to function"); return error_mark_node; } /* ??? Existing practice has been to warn only when the char index is syntactically the index, not for char[array]. */ if (!swapped) warn_array_subscript_with_type_char (index); /* Apply default promotions *after* noticing character types. */ index = default_conversion (index); gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE); if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE) { tree rval, type; /* An array that is indexed by a non-constant cannot be stored in a register; we must be able to do address arithmetic on its address. Likewise an array of elements of variable size. */ if (TREE_CODE (index) != INTEGER_CST || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array))) && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST)) { if (!c_mark_addressable (array)) return error_mark_node; } /* An array that is indexed by a constant value which is not within the array bounds cannot be stored in a register either; because we would get a crash in store_bit_field/extract_bit_field when trying to access a non-existent part of the register. */ if (TREE_CODE (index) == INTEGER_CST && TYPE_DOMAIN (TREE_TYPE (array)) && !int_fits_type_p (index, TYPE_DOMAIN (TREE_TYPE (array)))) { if (!c_mark_addressable (array)) return error_mark_node; } if (pedantic) { tree foo = array; while (TREE_CODE (foo) == COMPONENT_REF) foo = TREE_OPERAND (foo, 0); if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo)) pedwarn ("ISO C forbids subscripting %<register%> array"); else if (!flag_isoc99 && !lvalue_p (foo)) pedwarn ("ISO C90 forbids subscripting non-lvalue array"); } type = TREE_TYPE (TREE_TYPE (array)); rval = build4 (ARRAY_REF, type, array, index, NULL_TREE, NULL_TREE); /* Array ref is const/volatile if the array elements are or if the array is. */ TREE_READONLY (rval) |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array))) | TREE_READONLY (array)); TREE_SIDE_EFFECTS (rval) |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) | TREE_SIDE_EFFECTS (array)); TREE_THIS_VOLATILE (rval) |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) /* This was added by rms on 16 Nov 91. It fixes vol struct foo *a; a->elts[1] in an inline function. Hope it doesn't break something else. */ | TREE_THIS_VOLATILE (array)); return require_complete_type (fold (rval)); } else { tree ar = default_conversion (array); if (ar == error_mark_node) return ar; gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE); gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE); return build_indirect_ref (build_binary_op (PLUS_EXPR, ar, index, 0), "array indexing"); } } /* Build an external reference to identifier ID. FUN indicates whether this will be used for a function call. LOC is the source location of the identifier. */ tree build_external_ref (tree id, int fun, location_t loc) { tree ref; tree decl = lookup_name (id); /* In Objective-C, an instance variable (ivar) may be preferred to whatever lookup_name() found. */ decl = objc_lookup_ivar (decl, id); if (decl && decl != error_mark_node) ref = decl; else if (fun) /* Implicit function declaration. */ ref = implicitly_declare (id); else if (decl == error_mark_node) /* Don't complain about something that's already been complained about. */ return error_mark_node; else { undeclared_variable (id, loc); return error_mark_node; } if (TREE_TYPE (ref) == error_mark_node) return error_mark_node; if (TREE_DEPRECATED (ref)) warn_deprecated_use (ref); /* Recursive call does not count as usage. */ if (ref != current_function_decl) { if (!skip_evaluation) assemble_external (ref); TREE_USED (ref) = 1; } if (TREE_CODE (ref) == FUNCTION_DECL && !in_alignof) { if (!in_sizeof && !in_typeof) C_DECL_USED (ref) = 1; else if (DECL_INITIAL (ref) == 0 && DECL_EXTERNAL (ref) && !TREE_PUBLIC (ref)) record_maybe_used_decl (ref); } if (TREE_CODE (ref) == CONST_DECL) { used_types_insert (TREE_TYPE (ref)); ref = DECL_INITIAL (ref); TREE_CONSTANT (ref) = 1; TREE_INVARIANT (ref) = 1; } else if (current_function_decl != 0 && !DECL_FILE_SCOPE_P (current_function_decl) && (TREE_CODE (ref) == VAR_DECL || TREE_CODE (ref) == PARM_DECL || TREE_CODE (ref) == FUNCTION_DECL)) { tree context = decl_function_context (ref); if (context != 0 && context != current_function_decl) DECL_NONLOCAL (ref) = 1; } /* C99 6.7.4p3: An inline definition of a function with external linkage ... shall not contain a reference to an identifier with internal linkage. */ else if (current_function_decl != 0 && DECL_DECLARED_INLINE_P (current_function_decl) && DECL_EXTERNAL (current_function_decl) && VAR_OR_FUNCTION_DECL_P (ref) && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref)) && ! TREE_PUBLIC (ref) && DECL_CONTEXT (ref) != current_function_decl) pedwarn ("%H%qD is static but used in inline function %qD " "which is not static", &loc, ref, current_function_decl); return ref; } /* Record details of decls possibly used inside sizeof or typeof. */ struct maybe_used_decl { /* The decl. */ tree decl; /* The level seen at (in_sizeof + in_typeof). */ int level; /* The next one at this level or above, or NULL. */ struct maybe_used_decl *next; }; static struct maybe_used_decl *maybe_used_decls; /* Record that DECL, an undefined static function reference seen inside sizeof or typeof, might be used if the operand of sizeof is a VLA type or the operand of typeof is a variably modified type. */ static void record_maybe_used_decl (tree decl) { struct maybe_used_decl *t = XOBNEW (&parser_obstack, struct maybe_used_decl); t->decl = decl; t->level = in_sizeof + in_typeof; t->next = maybe_used_decls; maybe_used_decls = t; } /* Pop the stack of decls possibly used inside sizeof or typeof. If USED is false, just discard them. If it is true, mark them used (if no longer inside sizeof or typeof) or move them to the next level up (if still inside sizeof or typeof). */ void pop_maybe_used (bool used) { struct maybe_used_decl *p = maybe_used_decls; int cur_level = in_sizeof + in_typeof; while (p && p->level > cur_level) { if (used) { if (cur_level == 0) C_DECL_USED (p->decl) = 1; else p->level = cur_level; } p = p->next; } if (!used || cur_level == 0) maybe_used_decls = p; } /* Return the result of sizeof applied to EXPR. */ struct c_expr c_expr_sizeof_expr (struct c_expr expr) { struct c_expr ret; if (expr.value == error_mark_node) { ret.value = error_mark_node; ret.original_code = ERROR_MARK; pop_maybe_used (false); } else { ret.value = c_sizeof (TREE_TYPE (expr.value)); ret.original_code = ERROR_MARK; if (c_vla_type_p (TREE_TYPE (expr.value))) { /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ ret.value = build2 (COMPOUND_EXPR, TREE_TYPE (ret.value), expr.value, ret.value); } pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (expr.value))); } return ret; } /* Return the result of sizeof applied to T, a structure for the type name passed to sizeof (rather than the type itself). */ struct c_expr c_expr_sizeof_type (struct c_type_name *t) { tree type; struct c_expr ret; type = groktypename (t); ret.value = c_sizeof (type); ret.original_code = ERROR_MARK; pop_maybe_used (type != error_mark_node ? C_TYPE_VARIABLE_SIZE (type) : false); return ret; } /* Build a function call to function FUNCTION with parameters PARAMS. PARAMS is a list--a chain of TREE_LIST nodes--in which the TREE_VALUE of each node is a parameter-expression. FUNCTION's data type may be a function type or a pointer-to-function. */ tree build_function_call (tree function, tree params) { tree fntype, fundecl = 0; tree name = NULL_TREE, result; tree tem; int nargs; tree *argarray; /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ STRIP_TYPE_NOPS (function); /* Convert anything with function type to a pointer-to-function. */ if (TREE_CODE (function) == FUNCTION_DECL) { /* Implement type-directed function overloading for builtins. resolve_overloaded_builtin and targetm.resolve_overloaded_builtin handle all the type checking. The result is a complete expression that implements this function call. */ tem = resolve_overloaded_builtin (function, params); if (tem) return tem; name = DECL_NAME (function); fundecl = function; } if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE) function = function_to_pointer_conversion (function); /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF expressions, like those used for ObjC messenger dispatches. */ function = objc_rewrite_function_call (function, params); fntype = TREE_TYPE (function); if (TREE_CODE (fntype) == ERROR_MARK) return error_mark_node; if (!(TREE_CODE (fntype) == POINTER_TYPE && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)) { error ("called object %qE is not a function", function); return error_mark_node; } if (fundecl && TREE_THIS_VOLATILE (fundecl)) current_function_returns_abnormally = 1; /* fntype now gets the type of function pointed to. */ fntype = TREE_TYPE (fntype); /* Check that the function is called through a compatible prototype. If it is not, replace the call by a trap, wrapped up in a compound expression if necessary. This has the nice side-effect to prevent the tree-inliner from generating invalid assignment trees which may blow up in the RTL expander later. */ if ((TREE_CODE (function) == NOP_EXPR || TREE_CODE (function) == CONVERT_EXPR) && TREE_CODE (tem = TREE_OPERAND (function, 0)) == ADDR_EXPR && TREE_CODE (tem = TREE_OPERAND (tem, 0)) == FUNCTION_DECL && !comptypes (fntype, TREE_TYPE (tem))) { tree return_type = TREE_TYPE (fntype); tree trap = build_function_call (built_in_decls[BUILT_IN_TRAP], NULL_TREE); /* This situation leads to run-time undefined behavior. We can't, therefore, simply error unless we can prove that all possible executions of the program must execute the code. */ warning (0, "function called through a non-compatible type"); /* We can, however, treat "undefined" any way we please. Call abort to encourage the user to fix the program. */ inform ("if this code is reached, the program will abort"); if (VOID_TYPE_P (return_type)) return trap; else { tree rhs; if (AGGREGATE_TYPE_P (return_type)) rhs = build_compound_literal (return_type, build_constructor (return_type, 0)); else rhs = fold_convert (return_type, integer_zero_node); return build2 (COMPOUND_EXPR, return_type, trap, rhs); } } /* Convert the parameters to the types declared in the function prototype, or apply default promotions. */ nargs = list_length (params); argarray = (tree *) alloca (nargs * sizeof (tree)); nargs = convert_arguments (nargs, argarray, TYPE_ARG_TYPES (fntype), params, function, fundecl); if (nargs < 0) return error_mark_node; /* Check that the arguments to the function are valid. */ check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, TYPE_ARG_TYPES (fntype)); if (require_constant_value) { result = fold_build_call_array_initializer (TREE_TYPE (fntype), function, nargs, argarray); if (TREE_CONSTANT (result) && (name == NULL_TREE || strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10) != 0)) pedwarn_init ("initializer element is not constant"); } else result = fold_build_call_array (TREE_TYPE (fntype), function, nargs, argarray); if (VOID_TYPE_P (TREE_TYPE (result))) return result; return require_complete_type (result); } /* Convert the argument expressions in the list VALUES to the types in the list TYPELIST. The resulting arguments are stored in the array ARGARRAY which has size NARGS. If TYPELIST is exhausted, or when an element has NULL as its type, perform the default conversions. PARMLIST is the chain of parm decls for the function being called. It may be 0, if that info is not available. It is used only for generating error messages. FUNCTION is a tree for the called function. It is used only for error messages, where it is formatted with %qE. This is also where warnings about wrong number of args are generated. VALUES is a chain of TREE_LIST nodes with the elements of the list in the TREE_VALUE slots of those nodes. Returns the actual number of arguments processed (which may be less than NARGS in some error situations), or -1 on failure. */ static int convert_arguments (int nargs, tree *argarray, tree typelist, tree values, tree function, tree fundecl) { tree typetail, valtail; int parmnum; const bool type_generic = fundecl && lookup_attribute ("type generic", TYPE_ATTRIBUTES(TREE_TYPE (fundecl))); tree selector; /* Change pointer to function to the function itself for diagnostics. */ if (TREE_CODE (function) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL) function = TREE_OPERAND (function, 0); /* Handle an ObjC selector specially for diagnostics. */ selector = objc_message_selector (); /* Scan the given expressions and types, producing individual converted arguments and storing them in ARGARRAY. */ for (valtail = values, typetail = typelist, parmnum = 0; valtail; valtail = TREE_CHAIN (valtail), parmnum++) { tree type = typetail ? TREE_VALUE (typetail) : 0; tree val = TREE_VALUE (valtail); tree rname = function; int argnum = parmnum + 1; const char *invalid_func_diag; if (type == void_type_node) { error ("too many arguments to function %qE", function); return parmnum; } if (selector && argnum > 2) { rname = selector; argnum -= 2; } STRIP_TYPE_NOPS (val); val = require_complete_type (val); if (type != 0) { /* Formal parm type is specified by a function prototype. */ tree parmval; if (type == error_mark_node || !COMPLETE_TYPE_P (type)) { error ("type of formal parameter %d is incomplete", parmnum + 1); parmval = val; } else { /* Optionally warn about conversions that differ from the default conversions. */ if (warn_traditional_conversion || warn_traditional) { unsigned int formal_prec = TYPE_PRECISION (type); if (INTEGRAL_TYPE_P (type) && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) warning (0, "passing argument %d of %qE as integer " "rather than floating due to prototype", argnum, rname); if (INTEGRAL_TYPE_P (type) && TREE_CODE (TREE_TYPE (val)) == COMPLEX_TYPE) warning (0, "passing argument %d of %qE as integer " "rather than complex due to prototype", argnum, rname); else if (TREE_CODE (type) == COMPLEX_TYPE && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) warning (0, "passing argument %d of %qE as complex " "rather than floating due to prototype", argnum, rname); else if (TREE_CODE (type) == REAL_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (val))) warning (0, "passing argument %d of %qE as floating " "rather than integer due to prototype", argnum, rname); else if (TREE_CODE (type) == COMPLEX_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (val))) warning (0, "passing argument %d of %qE as complex " "rather than integer due to prototype", argnum, rname); else if (TREE_CODE (type) == REAL_TYPE && TREE_CODE (TREE_TYPE (val)) == COMPLEX_TYPE) warning (0, "passing argument %d of %qE as floating " "rather than complex due to prototype", argnum, rname); /* ??? At some point, messages should be written about conversions between complex types, but that's too messy to do now. */ else if (TREE_CODE (type) == REAL_TYPE && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) { /* Warn if any argument is passed as `float', since without a prototype it would be `double'. */ if (formal_prec == TYPE_PRECISION (float_type_node) && type != dfloat32_type_node) warning (0, "passing argument %d of %qE as %<float%> " "rather than %<double%> due to prototype", argnum, rname); /* Warn if mismatch between argument and prototype for decimal float types. Warn of conversions with binary float types and of precision narrowing due to prototype. */ else if (type != TREE_TYPE (val) && (type == dfloat32_type_node || type == dfloat64_type_node || type == dfloat128_type_node || TREE_TYPE (val) == dfloat32_type_node || TREE_TYPE (val) == dfloat64_type_node || TREE_TYPE (val) == dfloat128_type_node) && (formal_prec <= TYPE_PRECISION (TREE_TYPE (val)) || (type == dfloat128_type_node && (TREE_TYPE (val) != dfloat64_type_node && (TREE_TYPE (val) != dfloat32_type_node))) || (type == dfloat64_type_node && (TREE_TYPE (val) != dfloat32_type_node)))) warning (0, "passing argument %d of %qE as %qT " "rather than %qT due to prototype", argnum, rname, type, TREE_TYPE (val)); } /* Detect integer changing in width or signedness. These warnings are only activated with -Wtraditional-conversion, not with -Wtraditional. */ else if (warn_traditional_conversion && INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (val))) { tree would_have_been = default_conversion (val); tree type1 = TREE_TYPE (would_have_been); if (TREE_CODE (type) == ENUMERAL_TYPE && (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (val)))) /* No warning if function asks for enum and the actual arg is that enum type. */ ; else if (formal_prec != TYPE_PRECISION (type1)) warning (OPT_Wtraditional_conversion, "passing argument %d of %qE " "with different width due to prototype", argnum, rname); else if (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (type1)) ; /* Don't complain if the formal parameter type is an enum, because we can't tell now whether the value was an enum--even the same enum. */ else if (TREE_CODE (type) == ENUMERAL_TYPE) ; else if (TREE_CODE (val) == INTEGER_CST && int_fits_type_p (val, type)) /* Change in signedness doesn't matter if a constant value is unaffected. */ ; /* If the value is extended from a narrower unsigned type, it doesn't matter whether we pass it as signed or unsigned; the value certainly is the same either way. */ else if (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (type) && TYPE_UNSIGNED (TREE_TYPE (val))) ; else if (TYPE_UNSIGNED (type)) warning (OPT_Wtraditional_conversion, "passing argument %d of %qE " "as unsigned due to prototype", argnum, rname); else warning (OPT_Wtraditional_conversion, "passing argument %d of %qE " "as signed due to prototype", argnum, rname); } } parmval = convert_for_assignment (type, val, ic_argpass, fundecl, function, parmnum + 1); if (targetm.calls.promote_prototypes (fundecl ? TREE_TYPE (fundecl) : 0) && INTEGRAL_TYPE_P (type) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) parmval = default_conversion (parmval); } argarray[parmnum] = parmval; } else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE && (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (double_type_node)) && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (val)))) { if (type_generic) argarray[parmnum] = val; else /* Convert `float' to `double'. */ argarray[parmnum] = convert (double_type_node, val); } else if ((invalid_func_diag = targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) { error (invalid_func_diag); return -1; } else /* Convert `short' and `char' to full-size `int'. */ argarray[parmnum] = default_conversion (val); if (typetail) typetail = TREE_CHAIN (typetail); } gcc_assert (parmnum == nargs); if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) { error ("too few arguments to function %qE", function); return -1; } return parmnum; } /* This is the entry point used by the parser to build unary operators in the input. CODE, a tree_code, specifies the unary operator, and ARG is the operand. For unary plus, the C parser currently uses CONVERT_EXPR for code. */ struct c_expr parser_build_unary_op (enum tree_code code, struct c_expr arg) { struct c_expr result; result.original_code = ERROR_MARK; result.value = build_unary_op (code, arg.value, 0); if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg.value)) overflow_warning (result.value); return result; } /* This is the entry point used by the parser to build binary operators in the input. CODE, a tree_code, specifies the binary operator, and ARG1 and ARG2 are the operands. In addition to constructing the expression, we check for operands that were written with other binary operators in a way that is likely to confuse the user. */ struct c_expr parser_build_binary_op (enum tree_code code, struct c_expr arg1, struct c_expr arg2) { struct c_expr result; enum tree_code code1 = arg1.original_code; enum tree_code code2 = arg2.original_code; result.value = build_binary_op (code, arg1.value, arg2.value, 1); result.original_code = code; if (TREE_CODE (result.value) == ERROR_MARK) return result; /* Check for cases such as x+y<<z which users are likely to misinterpret. */ if (warn_parentheses) warn_about_parentheses (code, code1, code2); if (code1 != tcc_comparison) warn_logical_operator (code, arg1.value, arg2.value); /* Warn about comparisons against string literals, with the exception of testing for equality or inequality of a string literal with NULL. */ if (code == EQ_EXPR || code == NE_EXPR) { if ((code1 == STRING_CST && !integer_zerop (arg2.value)) || (code2 == STRING_CST && !integer_zerop (arg1.value))) warning (OPT_Waddress, "comparison with string literal results in unspecified behavior"); } else if (TREE_CODE_CLASS (code) == tcc_comparison && (code1 == STRING_CST || code2 == STRING_CST)) warning (OPT_Waddress, "comparison with string literal results in unspecified behavior"); if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg1.value) && !TREE_OVERFLOW_P (arg2.value)) overflow_warning (result.value); return result; } /* Return a tree for the difference of pointers OP0 and OP1. The resulting tree has type int. */ static tree pointer_diff (tree op0, tree op1) { tree restype = ptrdiff_type_node; tree target_type = TREE_TYPE (TREE_TYPE (op0)); tree con0, con1, lit0, lit1; tree orig_op1 = op1; if (pedantic || warn_pointer_arith) { if (TREE_CODE (target_type) == VOID_TYPE) pedwarn ("pointer of type %<void *%> used in subtraction"); if (TREE_CODE (target_type) == FUNCTION_TYPE) pedwarn ("pointer to a function used in subtraction"); } /* If the conversion to ptrdiff_type does anything like widening or converting a partial to an integral mode, we get a convert_expression that is in the way to do any simplifications. (fold-const.c doesn't know that the extra bits won't be needed. split_tree uses STRIP_SIGN_NOPS, which leaves conversions to a different mode in place.) So first try to find a common term here 'by hand'; we want to cover at least the cases that occur in legal static initializers. */ if ((TREE_CODE (op0) == NOP_EXPR || TREE_CODE (op0) == CONVERT_EXPR) && (TYPE_PRECISION (TREE_TYPE (op0)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0))))) con0 = TREE_OPERAND (op0, 0); else con0 = op0; if ((TREE_CODE (op1) == NOP_EXPR || TREE_CODE (op1) == CONVERT_EXPR) && (TYPE_PRECISION (TREE_TYPE (op1)) == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0))))) con1 = TREE_OPERAND (op1, 0); else con1 = op1; if (TREE_CODE (con0) == PLUS_EXPR) { lit0 = TREE_OPERAND (con0, 1); con0 = TREE_OPERAND (con0, 0); } else lit0 = integer_zero_node; if (TREE_CODE (con1) == PLUS_EXPR) { lit1 = TREE_OPERAND (con1, 1); con1 = TREE_OPERAND (con1, 0); } else lit1 = integer_zero_node; if (operand_equal_p (con0, con1, 0)) { op0 = lit0; op1 = lit1; } /* First do the subtraction as integers; then drop through to build the divide operator. Do not do default conversions on the minus operator in case restype is a short type. */ op0 = build_binary_op (MINUS_EXPR, convert (restype, op0), convert (restype, op1), 0); /* This generates an error if op1 is pointer to incomplete type. */ if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1)))) error ("arithmetic on pointer to an incomplete type"); /* This generates an error if op0 is pointer to incomplete type. */ op1 = c_size_in_bytes (target_type); /* Divide by the size, in easiest possible way. */ return fold_build2 (EXACT_DIV_EXPR, restype, op0, convert (restype, op1)); } /* Construct and perhaps optimize a tree representation for a unary operation. CODE, a tree_code, specifies the operation and XARG is the operand. For any CODE other than ADDR_EXPR, FLAG nonzero suppresses the default promotions (such as from short to int). For ADDR_EXPR, the default promotions are not applied; FLAG nonzero allows non-lvalues; this is only used to handle conversion of non-lvalue arrays to pointers in C99. */ tree build_unary_op (enum tree_code code, tree xarg, int flag) { /* No default_conversion here. It causes trouble for ADDR_EXPR. */ tree arg = xarg; tree argtype = 0; enum tree_code typecode; tree val; int noconvert = flag; const char *invalid_op_diag; if (code != ADDR_EXPR) arg = require_complete_type (arg); typecode = TREE_CODE (TREE_TYPE (arg)); if (typecode == ERROR_MARK) return error_mark_node; if (typecode == ENUMERAL_TYPE || typecode == BOOLEAN_TYPE) typecode = INTEGER_TYPE; if ((invalid_op_diag = targetm.invalid_unary_op (code, TREE_TYPE (xarg)))) { error (invalid_op_diag); return error_mark_node; } switch (code) { case CONVERT_EXPR: /* This is used for unary plus, because a CONVERT_EXPR is enough to prevent anybody from looking inside for associativity, but won't generate any code. */ if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE || typecode == VECTOR_TYPE)) { error ("wrong type argument to unary plus"); return error_mark_node; } else if (!noconvert) arg = default_conversion (arg); arg = non_lvalue (arg); break; case NEGATE_EXPR: if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE || typecode == VECTOR_TYPE)) { error ("wrong type argument to unary minus"); return error_mark_node; } else if (!noconvert) arg = default_conversion (arg); break; case BIT_NOT_EXPR: /* ~ works on integer types and non float vectors. */ if (typecode == INTEGER_TYPE || (typecode == VECTOR_TYPE && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg)))) { if (!noconvert) arg = default_conversion (arg); } else if (typecode == COMPLEX_TYPE) { code = CONJ_EXPR; if (pedantic) pedwarn ("ISO C does not support %<~%> for complex conjugation"); if (!noconvert) arg = default_conversion (arg); } else { error ("wrong type argument to bit-complement"); return error_mark_node; } break; case ABS_EXPR: if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE)) { error ("wrong type argument to abs"); return error_mark_node; } else if (!noconvert) arg = default_conversion (arg); break; case CONJ_EXPR: /* Conjugating a real value is a no-op, but allow it anyway. */ if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE || typecode == COMPLEX_TYPE)) { error ("wrong type argument to conjugation"); return error_mark_node; } else if (!noconvert) arg = default_conversion (arg); break; case TRUTH_NOT_EXPR: if (typecode != INTEGER_TYPE && typecode != FIXED_POINT_TYPE && typecode != REAL_TYPE && typecode != POINTER_TYPE && typecode != COMPLEX_TYPE) { error ("wrong type argument to unary exclamation mark"); return error_mark_node; } arg = c_objc_common_truthvalue_conversion (arg); return invert_truthvalue (arg); case REALPART_EXPR: if (TREE_CODE (arg) == COMPLEX_CST) return TREE_REALPART (arg); else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) return fold_build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg); else return arg; case IMAGPART_EXPR: if (TREE_CODE (arg) == COMPLEX_CST) return TREE_IMAGPART (arg); else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) return fold_build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg); else return convert (TREE_TYPE (arg), integer_zero_node); case PREINCREMENT_EXPR: case POSTINCREMENT_EXPR: case PREDECREMENT_EXPR: case POSTDECREMENT_EXPR: /* Increment or decrement the real part of the value, and don't change the imaginary part. */ if (typecode == COMPLEX_TYPE) { tree real, imag; if (pedantic) pedwarn ("ISO C does not support %<++%> and %<--%>" " on complex types"); arg = stabilize_reference (arg); real = build_unary_op (REALPART_EXPR, arg, 1); imag = build_unary_op (IMAGPART_EXPR, arg, 1); real = build_unary_op (code, real, 1); if (real == error_mark_node || imag == error_mark_node) return error_mark_node; return build2 (COMPLEX_EXPR, TREE_TYPE (arg), real, imag); } /* Report invalid types. */ if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE && typecode != INTEGER_TYPE && typecode != REAL_TYPE) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) error ("wrong type argument to increment"); else error ("wrong type argument to decrement"); return error_mark_node; } { tree inc; tree result_type = TREE_TYPE (arg); arg = get_unwidened (arg, 0); argtype = TREE_TYPE (arg); /* Compute the increment. */ if (typecode == POINTER_TYPE) { /* If pointer target is an undefined struct, we just cannot know how to do the arithmetic. */ if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (result_type))) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) error ("increment of pointer to unknown structure"); else error ("decrement of pointer to unknown structure"); } else if ((pedantic || warn_pointer_arith) && (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) pedwarn ("wrong type argument to increment"); else pedwarn ("wrong type argument to decrement"); } inc = c_size_in_bytes (TREE_TYPE (result_type)); inc = fold_convert (sizetype, inc); } else if (FRACT_MODE_P (TYPE_MODE (result_type))) { /* For signed fract types, we invert ++ to -- or -- to ++, and change inc from 1 to -1, because it is not possible to represent 1 in signed fract constants. For unsigned fract types, the result always overflows and we get an undefined (original) or the maximum value. */ if (code == PREINCREMENT_EXPR) code = PREDECREMENT_EXPR; else if (code == PREDECREMENT_EXPR) code = PREINCREMENT_EXPR; else if (code == POSTINCREMENT_EXPR) code = POSTDECREMENT_EXPR; else /* code == POSTDECREMENT_EXPR */ code = POSTINCREMENT_EXPR; inc = integer_minus_one_node; inc = convert (argtype, inc); } else { inc = integer_one_node; inc = convert (argtype, inc); } /* Complain about anything else that is not a true lvalue. */ if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) ? lv_increment : lv_decrement))) return error_mark_node; /* Report a read-only lvalue. */ if (TREE_READONLY (arg)) { readonly_error (arg, ((code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) ? lv_increment : lv_decrement)); return error_mark_node; } if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE) val = boolean_increment (code, arg); else val = build2 (code, TREE_TYPE (arg), arg, inc); TREE_SIDE_EFFECTS (val) = 1; val = convert (result_type, val); if (TREE_CODE (val) != code) TREE_NO_WARNING (val) = 1; return val; } case ADDR_EXPR: /* Note that this operation never does default_conversion. */ /* Let &* cancel out to simplify resulting code. */ if (TREE_CODE (arg) == INDIRECT_REF) { /* Don't let this be an lvalue. */ if (lvalue_p (TREE_OPERAND (arg, 0))) return non_lvalue (TREE_OPERAND (arg, 0)); return TREE_OPERAND (arg, 0); } /* For &x[y], return x+y */ if (TREE_CODE (arg) == ARRAY_REF) { tree op0 = TREE_OPERAND (arg, 0); if (!c_mark_addressable (op0)) return error_mark_node; return build_binary_op (PLUS_EXPR, (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE ? array_to_pointer_conversion (op0) : op0), TREE_OPERAND (arg, 1), 1); } /* Anything not already handled and not a true memory reference or a non-lvalue array is an error. */ else if (typecode != FUNCTION_TYPE && !flag && !lvalue_or_else (arg, lv_addressof)) return error_mark_node; /* Ordinary case; arg is a COMPONENT_REF or a decl. */ argtype = TREE_TYPE (arg); /* If the lvalue is const or volatile, merge that into the type to which the address will point. Note that you can't get a restricted pointer by taking the address of something, so we only have to deal with `const' and `volatile' here. */ if ((DECL_P (arg) || REFERENCE_CLASS_P (arg)) && (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))) argtype = c_build_type_variant (argtype, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg)); if (!c_mark_addressable (arg)) return error_mark_node; gcc_assert (TREE_CODE (arg) != COMPONENT_REF || !DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1))); argtype = build_pointer_type (argtype); /* ??? Cope with user tricks that amount to offsetof. Delete this when we have proper support for integer constant expressions. */ val = get_base_address (arg); if (val && TREE_CODE (val) == INDIRECT_REF && TREE_CONSTANT (TREE_OPERAND (val, 0))) { tree op0 = fold_convert (sizetype, fold_offsetof (arg, val)), op1; op1 = fold_convert (argtype, TREE_OPERAND (val, 0)); return fold_build2 (POINTER_PLUS_EXPR, argtype, op1, op0); } val = build1 (ADDR_EXPR, argtype, arg); return val; default: gcc_unreachable (); } if (argtype == 0) argtype = TREE_TYPE (arg); return require_constant_value ? fold_build1_initializer (code, argtype, arg) : fold_build1 (code, argtype, arg); } /* Return nonzero if REF is an lvalue valid for this language. Lvalues can be assigned, unless their type has TYPE_READONLY. Lvalues can have their address taken, unless they have C_DECL_REGISTER. */ static int lvalue_p (const_tree ref) { const enum tree_code code = TREE_CODE (ref); switch (code) { case REALPART_EXPR: case IMAGPART_EXPR: case COMPONENT_REF: return lvalue_p (TREE_OPERAND (ref, 0)); case COMPOUND_LITERAL_EXPR: case STRING_CST: return 1; case INDIRECT_REF: case ARRAY_REF: case VAR_DECL: case PARM_DECL: case RESULT_DECL: case ERROR_MARK: return (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE); case BIND_EXPR: return TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE; default: return 0; } } /* Give an error for storing in something that is 'const'. */ static void readonly_error (tree arg, enum lvalue_use use) { gcc_assert (use == lv_assign || use == lv_increment || use == lv_decrement || use == lv_asm); /* Using this macro rather than (for example) arrays of messages ensures that all the format strings are checked at compile time. */ #define READONLY_MSG(A, I, D, AS) (use == lv_assign ? (A) \ : (use == lv_increment ? (I) \ : (use == lv_decrement ? (D) : (AS)))) if (TREE_CODE (arg) == COMPONENT_REF) { if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0)))) readonly_error (TREE_OPERAND (arg, 0), use); else error (READONLY_MSG (G_("assignment of read-only member %qD"), G_("increment of read-only member %qD"), G_("decrement of read-only member %qD"), G_("read-only member %qD used as %<asm%> output")), TREE_OPERAND (arg, 1)); } else if (TREE_CODE (arg) == VAR_DECL) error (READONLY_MSG (G_("assignment of read-only variable %qD"), G_("increment of read-only variable %qD"), G_("decrement of read-only variable %qD"), G_("read-only variable %qD used as %<asm%> output")), arg); else error (READONLY_MSG (G_("assignment of read-only location %qE"), G_("increment of read-only location %qE"), G_("decrement of read-only location %qE"), G_("read-only location %qE used as %<asm%> output")), arg); } /* Return nonzero if REF is an lvalue valid for this language; otherwise, print an error message and return zero. USE says how the lvalue is being used and so selects the error message. */ static int lvalue_or_else (const_tree ref, enum lvalue_use use) { int win = lvalue_p (ref); if (!win) lvalue_error (use); return win; } /* Mark EXP saying that we need to be able to take the address of it; it should not be allocated in a register. Returns true if successful. */ bool c_mark_addressable (tree exp) { tree x = exp; while (1) switch (TREE_CODE (x)) { case COMPONENT_REF: if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) { error ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1)); return false; } /* ... fall through ... */ case ADDR_EXPR: case ARRAY_REF: case REALPART_EXPR: case IMAGPART_EXPR: x = TREE_OPERAND (x, 0); break; case COMPOUND_LITERAL_EXPR: case CONSTRUCTOR: TREE_ADDRESSABLE (x) = 1; return true; case VAR_DECL: case CONST_DECL: case PARM_DECL: case RESULT_DECL: if (C_DECL_REGISTER (x) && DECL_NONLOCAL (x)) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) { error ("global register variable %qD used in nested function", x); return false; } pedwarn ("register variable %qD used in nested function", x); } else if (C_DECL_REGISTER (x)) { if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) error ("address of global register variable %qD requested", x); else error ("address of register variable %qD requested", x); return false; } /* drops in */ case FUNCTION_DECL: TREE_ADDRESSABLE (x) = 1; /* drops out */ default: return true; } } /* Build and return a conditional expression IFEXP ? OP1 : OP2. */ tree build_conditional_expr (tree ifexp, tree op1, tree op2) { tree type1; tree type2; enum tree_code code1; enum tree_code code2; tree result_type = NULL; tree orig_op1 = op1, orig_op2 = op2; /* Promote both alternatives. */ if (TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE) op1 = default_conversion (op1); if (TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE) op2 = default_conversion (op2); if (TREE_CODE (ifexp) == ERROR_MARK || TREE_CODE (TREE_TYPE (op1)) == ERROR_MARK || TREE_CODE (TREE_TYPE (op2)) == ERROR_MARK) return error_mark_node; type1 = TREE_TYPE (op1); code1 = TREE_CODE (type1); type2 = TREE_TYPE (op2); code2 = TREE_CODE (type2); /* C90 does not permit non-lvalue arrays in conditional expressions. In C99 they will be pointers by now. */ if (code1 == ARRAY_TYPE || code2 == ARRAY_TYPE) { error ("non-lvalue array in conditional expression"); return error_mark_node; } /* Quickly detect the usual case where op1 and op2 have the same type after promotion. */ if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)) { if (type1 == type2) result_type = type1; else result_type = TYPE_MAIN_VARIANT (type1); } else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE) && (code2 == INTEGER_TYPE || code2 == REAL_TYPE || code2 == COMPLEX_TYPE)) { result_type = c_common_type (type1, type2); /* If -Wsign-compare, warn here if type1 and type2 have different signedness. We'll promote the signed to unsigned and later code won't know it used to be different. Do this check on the original types, so that explicit casts will be considered, but default promotions won't. */ if (warn_sign_compare && !skip_evaluation) { int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1)); int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2)); if (unsigned_op1 ^ unsigned_op2) { bool ovf; /* Do not warn if the result type is signed, since the signed type will only be chosen if it can represent all the values of the unsigned type. */ if (!TYPE_UNSIGNED (result_type)) /* OK */; /* Do not warn if the signed quantity is an unsuffixed integer literal (or some static constant expression involving such literals) and it is non-negative. */ else if ((unsigned_op2 && tree_expr_nonnegative_warnv_p (op1, &ovf)) || (unsigned_op1 && tree_expr_nonnegative_warnv_p (op2, &ovf))) /* OK */; else warning (OPT_Wsign_compare, "signed and unsigned type in conditional expression"); } } } else if (code1 == VOID_TYPE || code2 == VOID_TYPE) { if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE)) pedwarn ("ISO C forbids conditional expr with only one void side"); result_type = void_type_node; } else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE) { if (comp_target_types (type1, type2)) result_type = common_pointer_type (type1, type2); else if (null_pointer_constant_p (orig_op1)) result_type = qualify_type (type2, type1); else if (null_pointer_constant_p (orig_op2)) result_type = qualify_type (type1, type2); else if (VOID_TYPE_P (TREE_TYPE (type1))) { if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between " "%<void *%> and function pointer"); result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), TREE_TYPE (type2))); } else if (VOID_TYPE_P (TREE_TYPE (type2))) { if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) pedwarn ("ISO C forbids conditional expr between " "%<void *%> and function pointer"); result_type = build_pointer_type (qualify_type (TREE_TYPE (type2), TREE_TYPE (type1))); } else { pedwarn ("pointer type mismatch in conditional expression"); result_type = build_pointer_type (void_type_node); } } else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op2)) pedwarn ("pointer/integer type mismatch in conditional expression"); else { op2 = null_pointer_node; } result_type = type1; } else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op1)) pedwarn ("pointer/integer type mismatch in conditional expression"); else { op1 = null_pointer_node; } result_type = type2; } if (!result_type) { if (flag_cond_mismatch) result_type = void_type_node; else { error ("type mismatch in conditional expression"); return error_mark_node; } } /* Merge const and volatile flags of the incoming types. */ result_type = build_type_variant (result_type, TREE_READONLY (op1) || TREE_READONLY (op2), TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2)); if (result_type != TREE_TYPE (op1)) op1 = convert_and_check (result_type, op1); if (result_type != TREE_TYPE (op2)) op2 = convert_and_check (result_type, op2); return fold_build3 (COND_EXPR, result_type, ifexp, op1, op2); } /* Return a compound expression that performs two expressions and returns the value of the second of them. */ tree build_compound_expr (tree expr1, tree expr2) { if (!TREE_SIDE_EFFECTS (expr1)) { /* The left-hand operand of a comma expression is like an expression statement: with -Wunused, we should warn if it doesn't have any side-effects, unless it was explicitly cast to (void). */ if (warn_unused_value) { if (VOID_TYPE_P (TREE_TYPE (expr1)) && (TREE_CODE (expr1) == NOP_EXPR || TREE_CODE (expr1) == CONVERT_EXPR)) ; /* (void) a, b */ else if (VOID_TYPE_P (TREE_TYPE (expr1)) && TREE_CODE (expr1) == COMPOUND_EXPR && (TREE_CODE (TREE_OPERAND (expr1, 1)) == CONVERT_EXPR || TREE_CODE (TREE_OPERAND (expr1, 1)) == NOP_EXPR)) ; /* (void) a, (void) b, c */ else warning (OPT_Wunused_value, "left-hand operand of comma expression has no effect"); } } /* With -Wunused, we should also warn if the left-hand operand does have side-effects, but computes a value which is not used. For example, in `foo() + bar(), baz()' the result of the `+' operator is not used, so we should issue a warning. */ else if (warn_unused_value) warn_if_unused_value (expr1, input_location); if (expr2 == error_mark_node) return error_mark_node; return build2 (COMPOUND_EXPR, TREE_TYPE (expr2), expr1, expr2); } /* Build an expression representing a cast to type TYPE of expression EXPR. */ tree build_c_cast (tree type, tree expr) { tree value = expr; if (type == error_mark_node || expr == error_mark_node) return error_mark_node; /* The ObjC front-end uses TYPE_MAIN_VARIANT to tie together types differing only in <protocol> qualifications. But when constructing cast expressions, the protocols do matter and must be kept around. */ if (objc_is_object_ptr (type) && objc_is_object_ptr (TREE_TYPE (expr))) return build1 (NOP_EXPR, type, expr); type = TYPE_MAIN_VARIANT (type); if (TREE_CODE (type) == ARRAY_TYPE) { error ("cast specifies array type"); return error_mark_node; } if (TREE_CODE (type) == FUNCTION_TYPE) { error ("cast specifies function type"); return error_mark_node; } if (!VOID_TYPE_P (type)) { value = require_complete_type (value); if (value == error_mark_node) return error_mark_node; } if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value))) { if (pedantic) { if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE) pedwarn ("ISO C forbids casting nonscalar to the same type"); } } else if (TREE_CODE (type) == UNION_TYPE) { tree field; for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)), TYPE_MAIN_VARIANT (TREE_TYPE (value)))) break; if (field) { tree t; if (pedantic) pedwarn ("ISO C forbids casts to union type"); t = digest_init (type, build_constructor_single (type, field, value), true, 0); TREE_CONSTANT (t) = TREE_CONSTANT (value); TREE_INVARIANT (t) = TREE_INVARIANT (value); return t; } error ("cast to union type from type not present in union"); return error_mark_node; } else { tree otype, ovalue; if (type == void_type_node) return build1 (CONVERT_EXPR, type, value); otype = TREE_TYPE (value); /* Optionally warn about potentially worrisome casts. */ if (warn_cast_qual && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE) { tree in_type = type; tree in_otype = otype; int added = 0; int discarded = 0; /* Check that the qualifiers on IN_TYPE are a superset of the qualifiers of IN_OTYPE. The outermost level of POINTER_TYPE nodes is uninteresting and we stop as soon as we hit a non-POINTER_TYPE node on either type. */ do { in_otype = TREE_TYPE (in_otype); in_type = TREE_TYPE (in_type); /* GNU C allows cv-qualified function types. 'const' means the function is very pure, 'volatile' means it can't return. We need to warn when such qualifiers are added, not when they're taken away. */ if (TREE_CODE (in_otype) == FUNCTION_TYPE && TREE_CODE (in_type) == FUNCTION_TYPE) added |= (TYPE_QUALS (in_type) & ~TYPE_QUALS (in_otype)); else discarded |= (TYPE_QUALS (in_otype) & ~TYPE_QUALS (in_type)); } while (TREE_CODE (in_type) == POINTER_TYPE && TREE_CODE (in_otype) == POINTER_TYPE); if (added) warning (OPT_Wcast_qual, "cast adds new qualifiers to function type"); if (discarded) /* There are qualifiers present in IN_OTYPE that are not present in IN_TYPE. */ warning (OPT_Wcast_qual, "cast discards qualifiers from pointer target type"); } /* Warn about possible alignment problems. */ if (STRICT_ALIGNMENT && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE /* Don't warn about opaque types, where the actual alignment restriction is unknown. */ && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE) && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode) && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) warning (OPT_Wcast_align, "cast increases required alignment of target type"); if (TREE_CODE (type) == INTEGER_TYPE && TREE_CODE (otype) == POINTER_TYPE && TYPE_PRECISION (type) != TYPE_PRECISION (otype)) /* Unlike conversion of integers to pointers, where the warning is disabled for converting constants because of cases such as SIG_*, warn about converting constant pointers to integers. In some cases it may cause unwanted sign extension, and a warning is appropriate. */ warning (OPT_Wpointer_to_int_cast, "cast from pointer to integer of different size"); if (TREE_CODE (value) == CALL_EXPR && TREE_CODE (type) != TREE_CODE (otype)) warning (OPT_Wbad_function_cast, "cast from function call of type %qT " "to non-matching type %qT", otype, type); if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == INTEGER_TYPE && TYPE_PRECISION (type) != TYPE_PRECISION (otype) /* Don't warn about converting any constant. */ && !TREE_CONSTANT (value)) warning (OPT_Wint_to_pointer_cast, "cast to pointer from integer " "of different size"); if (warn_strict_aliasing <= 2) strict_aliasing_warning (otype, type, expr); /* If pedantic, warn for conversions between function and object pointer types, except for converting a null pointer constant to function pointer type. */ if (pedantic && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE && TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE) pedwarn ("ISO C forbids conversion of function pointer to object pointer type"); if (pedantic && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE && !null_pointer_constant_p (value)) pedwarn ("ISO C forbids conversion of object pointer to function pointer type"); ovalue = value; value = convert (type, value); /* Ignore any integer overflow caused by the cast. */ if (TREE_CODE (value) == INTEGER_CST) { if (CONSTANT_CLASS_P (ovalue) && TREE_OVERFLOW (ovalue)) { if (!TREE_OVERFLOW (value)) { /* Avoid clobbering a shared constant. */ value = copy_node (value); TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue); } } else if (TREE_OVERFLOW (value)) /* Reset VALUE's overflow flags, ensuring constant sharing. */ value = build_int_cst_wide (TREE_TYPE (value), TREE_INT_CST_LOW (value), TREE_INT_CST_HIGH (value)); } } /* Don't let a cast be an lvalue. */ if (value == expr) value = non_lvalue (value); return value; } /* Interpret a cast of expression EXPR to type TYPE. */ tree c_cast_expr (struct c_type_name *type_name, tree expr) { tree type; int saved_wsp = warn_strict_prototypes; /* This avoids warnings about unprototyped casts on integers. E.g. "#define SIG_DFL (void(*)())0". */ if (TREE_CODE (expr) == INTEGER_CST) warn_strict_prototypes = 0; type = groktypename (type_name); warn_strict_prototypes = saved_wsp; return build_c_cast (type, expr); } /* Build an assignment expression of lvalue LHS from value RHS. MODIFYCODE is the code for a binary operator that we use to combine the old value of LHS with RHS to get the new value. Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment. */ tree build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) { tree result; tree newrhs; tree lhstype = TREE_TYPE (lhs); tree olhstype = lhstype; /* Types that aren't fully specified cannot be used in assignments. */ lhs = require_complete_type (lhs); /* Avoid duplicate error messages from operands that had errors. */ if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK) return error_mark_node; if (!lvalue_or_else (lhs, lv_assign)) return error_mark_node; STRIP_TYPE_NOPS (rhs); newrhs = rhs; /* If a binary op has been requested, combine the old LHS value with the RHS producing the value we should actually store into the LHS. */ if (modifycode != NOP_EXPR) { lhs = stabilize_reference (lhs); newrhs = build_binary_op (modifycode, lhs, rhs, 1); } /* Give an error for storing in something that is 'const'. */ if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype) || ((TREE_CODE (lhstype) == RECORD_TYPE || TREE_CODE (lhstype) == UNION_TYPE) && C_TYPE_FIELDS_READONLY (lhstype))) { readonly_error (lhs, lv_assign); return error_mark_node; } /* If storing into a structure or union member, it has probably been given type `int'. Compute the type that would go with the actual amount of storage the member occupies. */ if (TREE_CODE (lhs) == COMPONENT_REF && (TREE_CODE (lhstype) == INTEGER_TYPE || TREE_CODE (lhstype) == BOOLEAN_TYPE || TREE_CODE (lhstype) == REAL_TYPE || TREE_CODE (lhstype) == ENUMERAL_TYPE)) lhstype = TREE_TYPE (get_unwidened (lhs, 0)); /* If storing in a field that is in actuality a short or narrower than one, we must store in the field in its actual type. */ if (lhstype != TREE_TYPE (lhs)) { lhs = copy_node (lhs); TREE_TYPE (lhs) = lhstype; } /* Convert new value to destination type. */ newrhs = convert_for_assignment (lhstype, newrhs, ic_assign, NULL_TREE, NULL_TREE, 0); if (TREE_CODE (newrhs) == ERROR_MARK) return error_mark_node; /* Emit ObjC write barrier, if necessary. */ if (c_dialect_objc () && flag_objc_gc) { result = objc_generate_write_barrier (lhs, modifycode, newrhs); if (result) return result; } /* Scan operands. */ result = build2 (MODIFY_EXPR, lhstype, lhs, newrhs); TREE_SIDE_EFFECTS (result) = 1; /* If we got the LHS in a different type for storing in, convert the result back to the nominal type of LHS so that the value we return always has the same type as the LHS argument. */ if (olhstype == TREE_TYPE (result)) return result; return convert_for_assignment (olhstype, result, ic_assign, NULL_TREE, NULL_TREE, 0); } /* Convert value RHS to type TYPE as preparation for an assignment to an lvalue of type TYPE. The real work of conversion is done by `convert'. The purpose of this function is to generate error messages for assignments that are not allowed in C. ERRTYPE says whether it is argument passing, assignment, initialization or return. FUNCTION is a tree for the function being called. PARMNUM is the number of the argument, for printing in error messages. */ static tree convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, tree fundecl, tree function, int parmnum) { enum tree_code codel = TREE_CODE (type); tree rhstype; enum tree_code coder; tree rname = NULL_TREE; bool objc_ok = false; if (errtype == ic_argpass || errtype == ic_argpass_nonproto) { tree selector; /* Change pointer to function to the function itself for diagnostics. */ if (TREE_CODE (function) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL) function = TREE_OPERAND (function, 0); /* Handle an ObjC selector specially for diagnostics. */ selector = objc_message_selector (); rname = function; if (selector && parmnum > 2) { rname = selector; parmnum -= 2; } } /* This macro is used to emit diagnostics to ensure that all format strings are complete sentences, visible to gettext and checked at compile time. */ #define WARN_FOR_ASSIGNMENT(AR, AS, IN, RE) \ do { \ switch (errtype) \ { \ case ic_argpass: \ pedwarn (AR, parmnum, rname); \ break; \ case ic_argpass_nonproto: \ warning (0, AR, parmnum, rname); \ break; \ case ic_assign: \ pedwarn (AS); \ break; \ case ic_init: \ pedwarn (IN); \ break; \ case ic_return: \ pedwarn (RE); \ break; \ default: \ gcc_unreachable (); \ } \ } while (0) STRIP_TYPE_NOPS (rhs); if (optimize && TREE_CODE (rhs) == VAR_DECL && TREE_CODE (TREE_TYPE (rhs)) != ARRAY_TYPE) rhs = decl_constant_value_for_broken_optimization (rhs); rhstype = TREE_TYPE (rhs); coder = TREE_CODE (rhstype); if (coder == ERROR_MARK) return error_mark_node; if (c_dialect_objc ()) { int parmno; switch (errtype) { case ic_return: parmno = 0; break; case ic_assign: parmno = -1; break; case ic_init: parmno = -2; break; default: parmno = parmnum; break; } objc_ok = objc_compare_types (type, rhstype, parmno, rname); } if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) return rhs; if (coder == VOID_TYPE) { /* Except for passing an argument to an unprototyped function, this is a constraint violation. When passing an argument to an unprototyped function, it is compile-time undefined; making it a constraint in that case was rejected in DR#252. */ error ("void value not ignored as it ought to be"); return error_mark_node; } rhs = require_complete_type (rhs); if (rhs == error_mark_node) return error_mark_node; /* A type converts to a reference to it. This code doesn't fully support references, it's just for the special case of va_start and va_copy. */ if (codel == REFERENCE_TYPE && comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1) { if (!lvalue_p (rhs)) { error ("cannot pass rvalue to reference parameter"); return error_mark_node; } if (!c_mark_addressable (rhs)) return error_mark_node; rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs); /* We already know that these two types are compatible, but they may not be exactly identical. In fact, `TREE_TYPE (type)' is likely to be __builtin_va_list and `TREE_TYPE (rhs)' is likely to be va_list, a typedef to __builtin_va_list, which is different enough that it will cause problems later. */ if (TREE_TYPE (TREE_TYPE (rhs)) != TREE_TYPE (type)) rhs = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), rhs); rhs = build1 (NOP_EXPR, type, rhs); return rhs; } /* Some types can interconvert without explicit casts. */ else if (codel == VECTOR_TYPE && coder == VECTOR_TYPE && vector_types_convertible_p (type, TREE_TYPE (rhs), true)) return convert (type, rhs); /* Arithmetic types all interconvert, and enum is treated like int. */ else if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == FIXED_POINT_TYPE || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE || codel == BOOLEAN_TYPE) && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == FIXED_POINT_TYPE || coder == ENUMERAL_TYPE || coder == COMPLEX_TYPE || coder == BOOLEAN_TYPE)) return convert_and_check (type, rhs); /* Aggregates in different TUs might need conversion. */ if ((codel == RECORD_TYPE || codel == UNION_TYPE) && codel == coder && comptypes (type, rhstype)) return convert_and_check (type, rhs); /* Conversion to a transparent union from its member types. This applies only to function arguments. */ if (codel == UNION_TYPE && TYPE_TRANSPARENT_UNION (type) && (errtype == ic_argpass || errtype == ic_argpass_nonproto)) { tree memb, marginal_memb = NULL_TREE; for (memb = TYPE_FIELDS (type); memb ; memb = TREE_CHAIN (memb)) { tree memb_type = TREE_TYPE (memb); if (comptypes (TYPE_MAIN_VARIANT (memb_type), TYPE_MAIN_VARIANT (rhstype))) break; if (TREE_CODE (memb_type) != POINTER_TYPE) continue; if (coder == POINTER_TYPE) { tree ttl = TREE_TYPE (memb_type); tree ttr = TREE_TYPE (rhstype); /* Any non-function converts to a [const][volatile] void * and vice versa; otherwise, targets must be the same. Meanwhile, the lhs target must have all the qualifiers of the rhs. */ if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) || comp_target_types (memb_type, rhstype)) { /* If this type won't generate any warnings, use it. */ if (TYPE_QUALS (ttl) == TYPE_QUALS (ttr) || ((TREE_CODE (ttr) == FUNCTION_TYPE && TREE_CODE (ttl) == FUNCTION_TYPE) ? ((TYPE_QUALS (ttl) | TYPE_QUALS (ttr)) == TYPE_QUALS (ttr)) : ((TYPE_QUALS (ttl) | TYPE_QUALS (ttr)) == TYPE_QUALS (ttl)))) break; /* Keep looking for a better type, but remember this one. */ if (!marginal_memb) marginal_memb = memb; } } /* Can convert integer zero to any pointer type. */ if (null_pointer_constant_p (rhs)) { rhs = null_pointer_node; break; } } if (memb || marginal_memb) { if (!memb) { /* We have only a marginally acceptable member type; it needs a warning. */ tree ttl = TREE_TYPE (TREE_TYPE (marginal_memb)); tree ttr = TREE_TYPE (rhstype); /* Const and volatile mean something different for function types, so the usual warnings are not appropriate. */ if (TREE_CODE (ttr) == FUNCTION_TYPE && TREE_CODE (ttl) == FUNCTION_TYPE) { /* Because const and volatile on functions are restrictions that say the function will not do certain things, it is okay to use a const or volatile function where an ordinary one is wanted, but not vice-versa. */ if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE " "makes qualified function " "pointer from unqualified"), G_("assignment makes qualified " "function pointer from " "unqualified"), G_("initialization makes qualified " "function pointer from " "unqualified"), G_("return makes qualified function " "pointer from unqualified")); } else if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE discards " "qualifiers from pointer target type"), G_("assignment discards qualifiers " "from pointer target type"), G_("initialization discards qualifiers " "from pointer target type"), G_("return discards qualifiers from " "pointer target type")); memb = marginal_memb; } if (pedantic && (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl))) pedwarn ("ISO C prohibits argument conversion to union type"); rhs = fold_convert (TREE_TYPE (memb), rhs); return build_constructor_single (type, memb, rhs); } } /* Conversions among pointers */ else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE) && (coder == codel)) { tree ttl = TREE_TYPE (type); tree ttr = TREE_TYPE (rhstype); tree mvl = ttl; tree mvr = ttr; bool is_opaque_pointer; int target_cmp = 0; /* Cache comp_target_types () result. */ if (TREE_CODE (mvl) != ARRAY_TYPE) mvl = TYPE_MAIN_VARIANT (mvl); if (TREE_CODE (mvr) != ARRAY_TYPE) mvr = TYPE_MAIN_VARIANT (mvr); /* Opaque pointers are treated like void pointers. */ is_opaque_pointer = (targetm.vector_opaque_p (type) || targetm.vector_opaque_p (rhstype)) && TREE_CODE (ttl) == VECTOR_TYPE && TREE_CODE (ttr) == VECTOR_TYPE; /* C++ does not allow the implicit conversion void* -> T*. However, for the purpose of reducing the number of false positives, we tolerate the special case of int *p = NULL; where NULL is typically defined in C to be '(void *) 0'. */ if (VOID_TYPE_P (ttr) && rhs != null_pointer_node && !VOID_TYPE_P (ttl)) warning (OPT_Wc___compat, "request for implicit conversion from " "%qT to %qT not permitted in C++", rhstype, type); /* Check if the right-hand side has a format attribute but the left-hand side doesn't. */ if (warn_missing_format_attribute && check_missing_format_attribute (type, rhstype)) { switch (errtype) { case ic_argpass: case ic_argpass_nonproto: warning (OPT_Wmissing_format_attribute, "argument %d of %qE might be " "a candidate for a format attribute", parmnum, rname); break; case ic_assign: warning (OPT_Wmissing_format_attribute, "assignment left-hand side might be " "a candidate for a format attribute"); break; case ic_init: warning (OPT_Wmissing_format_attribute, "initialization left-hand side might be " "a candidate for a format attribute"); break; case ic_return: warning (OPT_Wmissing_format_attribute, "return type might be " "a candidate for a format attribute"); break; default: gcc_unreachable (); } } /* Any non-function converts to a [const][volatile] void * and vice versa; otherwise, targets must be the same. Meanwhile, the lhs target must have all the qualifiers of the rhs. */ if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) || (target_cmp = comp_target_types (type, rhstype)) || is_opaque_pointer || (c_common_unsigned_type (mvl) == c_common_unsigned_type (mvr))) { if (pedantic && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE) || (VOID_TYPE_P (ttr) && !null_pointer_constant_p (rhs) && TREE_CODE (ttl) == FUNCTION_TYPE))) WARN_FOR_ASSIGNMENT (G_("ISO C forbids passing argument %d of " "%qE between function pointer " "and %<void *%>"), G_("ISO C forbids assignment between " "function pointer and %<void *%>"), G_("ISO C forbids initialization between " "function pointer and %<void *%>"), G_("ISO C forbids return between function " "pointer and %<void *%>")); /* Const and volatile mean something different for function types, so the usual warnings are not appropriate. */ else if (TREE_CODE (ttr) != FUNCTION_TYPE && TREE_CODE (ttl) != FUNCTION_TYPE) { if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)) { /* Types differing only by the presence of the 'volatile' qualifier are acceptable if the 'volatile' has been added in by the Objective-C EH machinery. */ if (!objc_type_quals_match (ttl, ttr)) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE discards " "qualifiers from pointer target type"), G_("assignment discards qualifiers " "from pointer target type"), G_("initialization discards qualifiers " "from pointer target type"), G_("return discards qualifiers from " "pointer target type")); } /* If this is not a case of ignoring a mismatch in signedness, no warning. */ else if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) || target_cmp) ; /* If there is a mismatch, do warn. */ else if (warn_pointer_sign) WARN_FOR_ASSIGNMENT (G_("pointer targets in passing argument " "%d of %qE differ in signedness"), G_("pointer targets in assignment " "differ in signedness"), G_("pointer targets in initialization " "differ in signedness"), G_("pointer targets in return differ " "in signedness")); } else if (TREE_CODE (ttl) == FUNCTION_TYPE && TREE_CODE (ttr) == FUNCTION_TYPE) { /* Because const and volatile on functions are restrictions that say the function will not do certain things, it is okay to use a const or volatile function where an ordinary one is wanted, but not vice-versa. */ if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes " "qualified function pointer " "from unqualified"), G_("assignment makes qualified function " "pointer from unqualified"), G_("initialization makes qualified " "function pointer from unqualified"), G_("return makes qualified function " "pointer from unqualified")); } } else /* Avoid warning about the volatile ObjC EH puts on decls. */ if (!objc_ok) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE from " "incompatible pointer type"), G_("assignment from incompatible pointer type"), G_("initialization from incompatible " "pointer type"), G_("return from incompatible pointer type")); return convert (type, rhs); } else if (codel == POINTER_TYPE && coder == ARRAY_TYPE) { /* ??? This should not be an error when inlining calls to unprototyped functions. */ error ("invalid use of non-lvalue array"); return error_mark_node; } else if (codel == POINTER_TYPE && coder == INTEGER_TYPE) { /* An explicit constant 0 can convert to a pointer, or one that results from arithmetic, even including a cast to integer type. */ if (!null_pointer_constant_p (rhs)) WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes " "pointer from integer without a cast"), G_("assignment makes pointer from integer " "without a cast"), G_("initialization makes pointer from " "integer without a cast"), G_("return makes pointer from integer " "without a cast")); return convert (type, rhs); } else if (codel == INTEGER_TYPE && coder == POINTER_TYPE) { WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes integer " "from pointer without a cast"), G_("assignment makes integer from pointer " "without a cast"), G_("initialization makes integer from pointer " "without a cast"), G_("return makes integer from pointer " "without a cast")); return convert (type, rhs); } else if (codel == BOOLEAN_TYPE && coder == POINTER_TYPE) return convert (type, rhs); switch (errtype) { case ic_argpass: case ic_argpass_nonproto: /* ??? This should not be an error when inlining calls to unprototyped functions. */ error ("incompatible type for argument %d of %qE", parmnum, rname); break; case ic_assign: error ("incompatible types in assignment"); break; case ic_init: error ("incompatible types in initialization"); break; case ic_return: error ("incompatible types in return"); break; default: gcc_unreachable (); } return error_mark_node; } /* If VALUE is a compound expr all of whose expressions are constant, then return its value. Otherwise, return error_mark_node. This is for handling COMPOUND_EXPRs as initializer elements which is allowed with a warning when -pedantic is specified. */ static tree valid_compound_expr_initializer (tree value, tree endtype) { if (TREE_CODE (value) == COMPOUND_EXPR) { if (valid_compound_expr_initializer (TREE_OPERAND (value, 0), endtype) == error_mark_node) return error_mark_node; return valid_compound_expr_initializer (TREE_OPERAND (value, 1), endtype); } else if (!initializer_constant_valid_p (value, endtype)) return error_mark_node; else return value; } /* Perform appropriate conversions on the initial value of a variable, store it in the declaration DECL, and print any error messages that are appropriate. If the init is invalid, store an ERROR_MARK. */ void store_init_value (tree decl, tree init) { tree value, type; /* If variable's type was invalidly declared, just ignore it. */ type = TREE_TYPE (decl); if (TREE_CODE (type) == ERROR_MARK) return; /* Digest the specified initializer into an expression. */ value = digest_init (type, init, true, TREE_STATIC (decl)); /* Store the expression if valid; else report error. */ if (!in_system_header && AGGREGATE_TYPE_P (TREE_TYPE (decl)) && !TREE_STATIC (decl)) warning (OPT_Wtraditional, "traditional C rejects automatic " "aggregate initialization"); DECL_INITIAL (decl) = value; /* ANSI wants warnings about out-of-range constant initializers. */ STRIP_TYPE_NOPS (value); if (TREE_STATIC (decl)) constant_expression_warning (value); /* Check if we need to set array size from compound literal size. */ if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0 && value != error_mark_node) { tree inside_init = init; STRIP_TYPE_NOPS (inside_init); inside_init = fold (inside_init); if (TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) { tree cldecl = COMPOUND_LITERAL_EXPR_DECL (inside_init); if (TYPE_DOMAIN (TREE_TYPE (cldecl))) { /* For int foo[] = (int [3]){1}; we need to set array size now since later on array initializer will be just the brace enclosed list of the compound literal. */ type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); TREE_TYPE (decl) = type; TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl)); layout_type (type); layout_decl (cldecl, 0); } } } } /* Methods for storing and printing names for error messages. */ /* Implement a spelling stack that allows components of a name to be pushed and popped. Each element on the stack is this structure. */ struct spelling { int kind; union { unsigned HOST_WIDE_INT i; const char *s; } u; }; #define SPELLING_STRING 1 #define SPELLING_MEMBER 2 #define SPELLING_BOUNDS 3 static struct spelling *spelling; /* Next stack element (unused). */ static struct spelling *spelling_base; /* Spelling stack base. */ static int spelling_size; /* Size of the spelling stack. */ /* Macros to save and restore the spelling stack around push_... functions. Alternative to SAVE_SPELLING_STACK. */ #define SPELLING_DEPTH() (spelling - spelling_base) #define RESTORE_SPELLING_DEPTH(DEPTH) (spelling = spelling_base + (DEPTH)) /* Push an element on the spelling stack with type KIND and assign VALUE to MEMBER. */ #define PUSH_SPELLING(KIND, VALUE, MEMBER) \ { \ int depth = SPELLING_DEPTH (); \ \ if (depth >= spelling_size) \ { \ spelling_size += 10; \ spelling_base = XRESIZEVEC (struct spelling, spelling_base, \ spelling_size); \ RESTORE_SPELLING_DEPTH (depth); \ } \ \ spelling->kind = (KIND); \ spelling->MEMBER = (VALUE); \ spelling++; \ } /* Push STRING on the stack. Printed literally. */ static void push_string (const char *string) { PUSH_SPELLING (SPELLING_STRING, string, u.s); } /* Push a member name on the stack. Printed as '.' STRING. */ static void push_member_name (tree decl) { const char *const string = DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>"; PUSH_SPELLING (SPELLING_MEMBER, string, u.s); } /* Push an array bounds on the stack. Printed as [BOUNDS]. */ static void push_array_bounds (unsigned HOST_WIDE_INT bounds) { PUSH_SPELLING (SPELLING_BOUNDS, bounds, u.i); } /* Compute the maximum size in bytes of the printed spelling. */ static int spelling_length (void) { int size = 0; struct spelling *p; for (p = spelling_base; p < spelling; p++) { if (p->kind == SPELLING_BOUNDS) size += 25; else size += strlen (p->u.s) + 1; } return size; } /* Print the spelling to BUFFER and return it. */ static char * print_spelling (char *buffer) { char *d = buffer; struct spelling *p; for (p = spelling_base; p < spelling; p++) if (p->kind == SPELLING_BOUNDS) { sprintf (d, "[" HOST_WIDE_INT_PRINT_UNSIGNED "]", p->u.i); d += strlen (d); } else { const char *s; if (p->kind == SPELLING_MEMBER) *d++ = '.'; for (s = p->u.s; (*d = *s++); d++) ; } *d++ = '\0'; return buffer; } /* Issue an error message for a bad initializer component. MSGID identifies the message. The component name is taken from the spelling stack. */ void error_init (const char *msgid) { char *ofwhat; error ("%s", _(msgid)); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); if (*ofwhat) error ("(near initialization for %qs)", ofwhat); } /* Issue a pedantic warning for a bad initializer component. MSGID identifies the message. The component name is taken from the spelling stack. */ void pedwarn_init (const char *msgid) { char *ofwhat; pedwarn ("%s", _(msgid)); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); if (*ofwhat) pedwarn ("(near initialization for %qs)", ofwhat); } /* Issue a warning for a bad initializer component. MSGID identifies the message. The component name is taken from the spelling stack. */ static void warning_init (const char *msgid) { char *ofwhat; warning (0, "%s", _(msgid)); ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); if (*ofwhat) warning (0, "(near initialization for %qs)", ofwhat); } /* If TYPE is an array type and EXPR is a parenthesized string constant, warn if pedantic that EXPR is being used to initialize an object of type TYPE. */ void maybe_warn_string_init (tree type, struct c_expr expr) { if (pedantic && TREE_CODE (type) == ARRAY_TYPE && TREE_CODE (expr.value) == STRING_CST && expr.original_code != STRING_CST) pedwarn_init ("array initialized from parenthesized string constant"); } /* Digest the parser output INIT as an initializer for type TYPE. Return a C expression of type TYPE to represent the initial value. If INIT is a string constant, STRICT_STRING is true if it is unparenthesized or we should not warn here for it being parenthesized. For other types of INIT, STRICT_STRING is not used. REQUIRE_CONSTANT requests an error if non-constant initializers or elements are seen. */ static tree digest_init (tree type, tree init, bool strict_string, int require_constant) { enum tree_code code = TREE_CODE (type); tree inside_init = init; if (type == error_mark_node || !init || init == error_mark_node || TREE_TYPE (init) == error_mark_node) return error_mark_node; STRIP_TYPE_NOPS (inside_init); inside_init = fold (inside_init); /* Initialization of an array of chars from a string constant optionally enclosed in braces. */ if (code == ARRAY_TYPE && inside_init && TREE_CODE (inside_init) == STRING_CST) { tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type)); /* Note that an array could be both an array of character type and an array of wchar_t if wchar_t is signed char or unsigned char. */ bool char_array = (typ1 == char_type_node || typ1 == signed_char_type_node || typ1 == unsigned_char_type_node); bool wchar_array = !!comptypes (typ1, wchar_type_node); if (char_array || wchar_array) { struct c_expr expr; bool char_string; expr.value = inside_init; expr.original_code = (strict_string ? STRING_CST : ERROR_MARK); maybe_warn_string_init (type, expr); char_string = (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init))) == char_type_node); if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), TYPE_MAIN_VARIANT (type))) return inside_init; if (!wchar_array && !char_string) { error_init ("char-array initialized from wide string"); return error_mark_node; } if (char_string && !char_array) { error_init ("wchar_t-array initialized from non-wide string"); return error_mark_node; } TREE_TYPE (inside_init) = type; if (TYPE_DOMAIN (type) != 0 && TYPE_SIZE (type) != 0 && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST /* Subtract 1 (or sizeof (wchar_t)) because it's ok to ignore the terminating null char that is counted in the length of the constant. */ && 0 > compare_tree_int (TYPE_SIZE_UNIT (type), TREE_STRING_LENGTH (inside_init) - ((TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node)) ? (TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT) : 1))) pedwarn_init ("initializer-string for array of chars is too long"); return inside_init; } else if (INTEGRAL_TYPE_P (typ1)) { error_init ("array of inappropriate type initialized " "from string constant"); return error_mark_node; } } /* Build a VECTOR_CST from a *constant* vector constructor. If the vector constructor is not constant (e.g. {1,2,3,foo()}) then punt below and handle as a constructor. */ if (code == VECTOR_TYPE && TREE_CODE (TREE_TYPE (inside_init)) == VECTOR_TYPE && vector_types_convertible_p (TREE_TYPE (inside_init), type, true) && TREE_CONSTANT (inside_init)) { if (TREE_CODE (inside_init) == VECTOR_CST && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), TYPE_MAIN_VARIANT (type))) return inside_init; if (TREE_CODE (inside_init) == CONSTRUCTOR) { unsigned HOST_WIDE_INT ix; tree value; bool constant_p = true; /* Iterate through elements and check if all constructor elements are *_CSTs. */ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (inside_init), ix, value) if (!CONSTANT_CLASS_P (value)) { constant_p = false; break; } if (constant_p) return build_vector_from_ctor (type, CONSTRUCTOR_ELTS (inside_init)); } } /* Any type can be initialized from an expression of the same type, optionally with braces. */ if (inside_init && TREE_TYPE (inside_init) != 0 && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), TYPE_MAIN_VARIANT (type)) || (code == ARRAY_TYPE && comptypes (TREE_TYPE (inside_init), type)) || (code == VECTOR_TYPE && comptypes (TREE_TYPE (inside_init), type)) || (code == POINTER_TYPE && TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE && comptypes (TREE_TYPE (TREE_TYPE (inside_init)), TREE_TYPE (type))))) { if (code == POINTER_TYPE) { if (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE) { if (TREE_CODE (inside_init) == STRING_CST || TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) inside_init = array_to_pointer_conversion (inside_init); else { error_init ("invalid use of non-lvalue array"); return error_mark_node; } } } if (code == VECTOR_TYPE) /* Although the types are compatible, we may require a conversion. */ inside_init = convert (type, inside_init); if (require_constant && (code == VECTOR_TYPE || !flag_isoc99) && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) { /* As an extension, allow initializing objects with static storage duration with compound literals (which are then treated just as the brace enclosed list they contain). Also allow this for vectors, as we can only assign them with compound literals. */ tree decl = COMPOUND_LITERAL_EXPR_DECL (inside_init); inside_init = DECL_INITIAL (decl); } if (code == ARRAY_TYPE && TREE_CODE (inside_init) != STRING_CST && TREE_CODE (inside_init) != CONSTRUCTOR) { error_init ("array initialized from non-constant array expression"); return error_mark_node; } if (optimize && TREE_CODE (inside_init) == VAR_DECL) inside_init = decl_constant_value_for_broken_optimization (inside_init); /* Compound expressions can only occur here if -pedantic or -pedantic-errors is specified. In the later case, we always want an error. In the former case, we simply want a warning. */ if (require_constant && pedantic && TREE_CODE (inside_init) == COMPOUND_EXPR) { inside_init = valid_compound_expr_initializer (inside_init, TREE_TYPE (inside_init)); if (inside_init == error_mark_node) error_init ("initializer element is not constant"); else pedwarn_init ("initializer element is not constant"); if (flag_pedantic_errors) inside_init = error_mark_node; } else if (require_constant && !initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init))) { error_init ("initializer element is not constant"); inside_init = error_mark_node; } /* Added to enable additional -Wmissing-format-attribute warnings. */ if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE) inside_init = convert_for_assignment (type, inside_init, ic_init, NULL_TREE, NULL_TREE, 0); return inside_init; } /* Handle scalar types, including conversions. */ if (code == INTEGER_TYPE || code == REAL_TYPE || code == FIXED_POINT_TYPE || code == POINTER_TYPE || code == ENUMERAL_TYPE || code == BOOLEAN_TYPE || code == COMPLEX_TYPE || code == VECTOR_TYPE) { if (TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE && (TREE_CODE (init) == STRING_CST || TREE_CODE (init) == COMPOUND_LITERAL_EXPR)) init = array_to_pointer_conversion (init); inside_init = convert_for_assignment (type, init, ic_init, NULL_TREE, NULL_TREE, 0); /* Check to see if we have already given an error message. */ if (inside_init == error_mark_node) ; else if (require_constant && !TREE_CONSTANT (inside_init)) { error_init ("initializer element is not constant"); inside_init = error_mark_node; } else if (require_constant && !initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init))) { error_init ("initializer element is not computable at load time"); inside_init = error_mark_node; } return inside_init; } /* Come here only for records and arrays. */ if (COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) { error_init ("variable-sized object may not be initialized"); return error_mark_node; } error_init ("invalid initializer"); return error_mark_node; } /* Handle initializers that use braces. */ /* Type of object we are accumulating a constructor for. This type is always a RECORD_TYPE, UNION_TYPE or ARRAY_TYPE. */ static tree constructor_type; /* For a RECORD_TYPE or UNION_TYPE, this is the chain of fields left to fill. */ static tree constructor_fields; /* For an ARRAY_TYPE, this is the specified index at which to store the next element we get. */ static tree constructor_index; /* For an ARRAY_TYPE, this is the maximum index. */ static tree constructor_max_index; /* For a RECORD_TYPE, this is the first field not yet written out. */ static tree constructor_unfilled_fields; /* For an ARRAY_TYPE, this is the index of the first element not yet written out. */ static tree constructor_unfilled_index; /* In a RECORD_TYPE, the byte index of the next consecutive field. This is so we can generate gaps between fields, when appropriate. */ static tree constructor_bit_index; /* If we are saving up the elements rather than allocating them, this is the list of elements so far (in reverse order, most recent first). */ static VEC(constructor_elt,gc) *constructor_elements; /* 1 if constructor should be incrementally stored into a constructor chain, 0 if all the elements should be kept in AVL tree. */ static int constructor_incremental; /* 1 if so far this constructor's elements are all compile-time constants. */ static int constructor_constant; /* 1 if so far this constructor's elements are all valid address constants. */ static int constructor_simple; /* 1 if this constructor is erroneous so far. */ static int constructor_erroneous; /* Structure for managing pending initializer elements, organized as an AVL tree. */ struct init_node { struct init_node *left, *right; struct init_node *parent; int balance; tree purpose; tree value; }; /* Tree of pending elements at this constructor level. These are elements encountered out of order which belong at places we haven't reached yet in actually writing the output. Will never hold tree nodes across GC runs. */ static struct init_node *constructor_pending_elts; /* The SPELLING_DEPTH of this constructor. */ static int constructor_depth; /* DECL node for which an initializer is being read. 0 means we are reading a constructor expression such as (struct foo) {...}. */ static tree constructor_decl; /* Nonzero if this is an initializer for a top-level decl. */ static int constructor_top_level; /* Nonzero if there were any member designators in this initializer. */ static int constructor_designated; /* Nesting depth of designator list. */ static int designator_depth; /* Nonzero if there were diagnosed errors in this designator list. */ static int designator_erroneous; /* This stack has a level for each implicit or explicit level of structuring in the initializer, including the outermost one. It saves the values of most of the variables above. */ struct constructor_range_stack; struct constructor_stack { struct constructor_stack *next; tree type; tree fields; tree index; tree max_index; tree unfilled_index; tree unfilled_fields; tree bit_index; VEC(constructor_elt,gc) *elements; struct init_node *pending_elts; int offset; int depth; /* If value nonzero, this value should replace the entire constructor at this level. */ struct c_expr replacement_value; struct constructor_range_stack *range_stack; char constant; char simple; char implicit; char erroneous; char outer; char incremental; char designated; }; static struct constructor_stack *constructor_stack; /* This stack represents designators from some range designator up to the last designator in the list. */ struct constructor_range_stack { struct constructor_range_stack *next, *prev; struct constructor_stack *stack; tree range_start; tree index; tree range_end; tree fields; }; static struct constructor_range_stack *constructor_range_stack; /* This stack records separate initializers that are nested. Nested initializers can't happen in ANSI C, but GNU C allows them in cases like { ... (struct foo) { ... } ... }. */ struct initializer_stack { struct initializer_stack *next; tree decl; struct constructor_stack *constructor_stack; struct constructor_range_stack *constructor_range_stack; VEC(constructor_elt,gc) *elements; struct spelling *spelling; struct spelling *spelling_base; int spelling_size; char top_level; char require_constant_value; char require_constant_elements; }; static struct initializer_stack *initializer_stack; /* Prepare to parse and output the initializer for variable DECL. */ void start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level) { const char *locus; struct initializer_stack *p = XNEW (struct initializer_stack); p->decl = constructor_decl; p->require_constant_value = require_constant_value; p->require_constant_elements = require_constant_elements; p->constructor_stack = constructor_stack; p->constructor_range_stack = constructor_range_stack; p->elements = constructor_elements; p->spelling = spelling; p->spelling_base = spelling_base; p->spelling_size = spelling_size; p->top_level = constructor_top_level; p->next = initializer_stack; initializer_stack = p; constructor_decl = decl; constructor_designated = 0; constructor_top_level = top_level; if (decl != 0 && decl != error_mark_node) { require_constant_value = TREE_STATIC (decl); require_constant_elements = ((TREE_STATIC (decl) || (pedantic && !flag_isoc99)) /* For a scalar, you can always use any value to initialize, even within braces. */ && (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE)); locus = IDENTIFIER_POINTER (DECL_NAME (decl)); } else { require_constant_value = 0; require_constant_elements = 0; locus = "(anonymous)"; } constructor_stack = 0; constructor_range_stack = 0; missing_braces_mentioned = 0; spelling_base = 0; spelling_size = 0; RESTORE_SPELLING_DEPTH (0); if (locus) push_string (locus); } void finish_init (void) { struct initializer_stack *p = initializer_stack; /* Free the whole constructor stack of this initializer. */ while (constructor_stack) { struct constructor_stack *q = constructor_stack; constructor_stack = q->next; free (q); } gcc_assert (!constructor_range_stack); /* Pop back to the data of the outer initializer (if any). */ free (spelling_base); constructor_decl = p->decl; require_constant_value = p->require_constant_value; require_constant_elements = p->require_constant_elements; constructor_stack = p->constructor_stack; constructor_range_stack = p->constructor_range_stack; constructor_elements = p->elements; spelling = p->spelling; spelling_base = p->spelling_base; spelling_size = p->spelling_size; constructor_top_level = p->top_level; initializer_stack = p->next; free (p); } /* Call here when we see the initializer is surrounded by braces. This is instead of a call to push_init_level; it is matched by a call to pop_init_level. TYPE is the type to initialize, for a constructor expression. For an initializer for a decl, TYPE is zero. */ void really_start_incremental_init (tree type) { struct constructor_stack *p = XNEW (struct constructor_stack); if (type == 0) type = TREE_TYPE (constructor_decl); if (targetm.vector_opaque_p (type)) error ("opaque vector types cannot be initialized"); p->type = constructor_type; p->fields = constructor_fields; p->index = constructor_index; p->max_index = constructor_max_index; p->unfilled_index = constructor_unfilled_index; p->unfilled_fields = constructor_unfilled_fields; p->bit_index = constructor_bit_index; p->elements = constructor_elements; p->constant = constructor_constant; p->simple = constructor_simple; p->erroneous = constructor_erroneous; p->pending_elts = constructor_pending_elts; p->depth = constructor_depth; p->replacement_value.value = 0; p->replacement_value.original_code = ERROR_MARK; p->implicit = 0; p->range_stack = 0; p->outer = 0; p->incremental = constructor_incremental; p->designated = constructor_designated; p->next = 0; constructor_stack = p; constructor_constant = 1; constructor_simple = 1; constructor_depth = SPELLING_DEPTH (); constructor_elements = 0; constructor_pending_elts = 0; constructor_type = type; constructor_incremental = 1; constructor_designated = 0; designator_depth = 0; designator_erroneous = 0; if (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) { constructor_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) && DECL_NAME (constructor_fields) == 0) constructor_fields = TREE_CHAIN (constructor_fields); constructor_unfilled_fields = constructor_fields; constructor_bit_index = bitsize_zero_node; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (TYPE_DOMAIN (constructor_type)) { constructor_max_index = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)); /* Detect non-empty initializations of zero-length arrays. */ if (constructor_max_index == NULL_TREE && TYPE_SIZE (constructor_type)) constructor_max_index = build_int_cst (NULL_TREE, -1); /* constructor_max_index needs to be an INTEGER_CST. Attempts to initialize VLAs will cause a proper error; avoid tree checking errors as well by setting a safe value. */ if (constructor_max_index && TREE_CODE (constructor_max_index) != INTEGER_CST) constructor_max_index = build_int_cst (NULL_TREE, -1); constructor_index = convert (bitsizetype, TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); } else { constructor_index = bitsize_zero_node; constructor_max_index = NULL_TREE; } constructor_unfilled_index = constructor_index; } else if (TREE_CODE (constructor_type) == VECTOR_TYPE) { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; } else { /* Handle the case of int x = {5}; */ constructor_fields = constructor_type; constructor_unfilled_fields = constructor_type; } } /* Push down into a subobject, for initialization. If this is for an explicit set of braces, IMPLICIT is 0. If it is because the next element belongs at a lower level, IMPLICIT is 1 (or 2 if the push is because of designator list). */ void push_init_level (int implicit) { struct constructor_stack *p; tree value = NULL_TREE; /* If we've exhausted any levels that didn't have braces, pop them now. If implicit == 1, this will have been done in process_init_element; do not repeat it here because in the case of excess initializers for an empty aggregate this leads to an infinite cycle of popping a level and immediately recreating it. */ if (implicit != 1) { while (constructor_stack->implicit) { if ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields == 0) process_init_element (pop_init_level (1)); else if (TREE_CODE (constructor_type) == ARRAY_TYPE && constructor_max_index && tree_int_cst_lt (constructor_max_index, constructor_index)) process_init_element (pop_init_level (1)); else break; } } /* Unless this is an explicit brace, we need to preserve previous content if any. */ if (implicit) { if ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields) value = find_init_member (constructor_fields); else if (TREE_CODE (constructor_type) == ARRAY_TYPE) value = find_init_member (constructor_index); } p = XNEW (struct constructor_stack); p->type = constructor_type; p->fields = constructor_fields; p->index = constructor_index; p->max_index = constructor_max_index; p->unfilled_index = constructor_unfilled_index; p->unfilled_fields = constructor_unfilled_fields; p->bit_index = constructor_bit_index; p->elements = constructor_elements; p->constant = constructor_constant; p->simple = constructor_simple; p->erroneous = constructor_erroneous; p->pending_elts = constructor_pending_elts; p->depth = constructor_depth; p->replacement_value.value = 0; p->replacement_value.original_code = ERROR_MARK; p->implicit = implicit; p->outer = 0; p->incremental = constructor_incremental; p->designated = constructor_designated; p->next = constructor_stack; p->range_stack = 0; constructor_stack = p; constructor_constant = 1; constructor_simple = 1; /* MUTANT (del_stmt) */ /* constructor_depth = SPELLING_DEPTH (); */ constructor_elements = 0; constructor_incremental = 1; constructor_designated = 0; constructor_pending_elts = 0; if (!implicit) { p->range_stack = constructor_range_stack; constructor_range_stack = 0; designator_depth = 0; designator_erroneous = 0; } /* Don't die if an entire brace-pair level is superfluous in the containing level. */ if (constructor_type == 0) ; else if (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) { /* Don't die if there are extra init elts at the end. */ if (constructor_fields == 0) constructor_type = 0; else { constructor_type = TREE_TYPE (constructor_fields); push_member_name (constructor_fields); constructor_depth++; } } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { constructor_type = TREE_TYPE (constructor_type); push_array_bounds (tree_low_cst (constructor_index, 1)); constructor_depth++; } if (constructor_type == 0) { error_init ("extra brace group at end of initializer"); constructor_fields = 0; constructor_unfilled_fields = 0; return; } if (value && TREE_CODE (value) == CONSTRUCTOR) { constructor_constant = TREE_CONSTANT (value); constructor_simple = TREE_STATIC (value); constructor_elements = CONSTRUCTOR_ELTS (value); if (!VEC_empty (constructor_elt, constructor_elements) && (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == ARRAY_TYPE)) set_nonincremental_init (); } if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned) { missing_braces_mentioned = 1; warning_init ("missing braces around initializer"); } if (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) { constructor_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) && DECL_NAME (constructor_fields) == 0) constructor_fields = TREE_CHAIN (constructor_fields); constructor_unfilled_fields = constructor_fields; constructor_bit_index = bitsize_zero_node; } else if (TREE_CODE (constructor_type) == VECTOR_TYPE) { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = convert (bitsizetype, integer_zero_node); constructor_unfilled_index = constructor_index; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (TYPE_DOMAIN (constructor_type)) { constructor_max_index = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)); /* Detect non-empty initializations of zero-length arrays. */ if (constructor_max_index == NULL_TREE && TYPE_SIZE (constructor_type)) constructor_max_index = build_int_cst (NULL_TREE, -1); /* constructor_max_index needs to be an INTEGER_CST. Attempts to initialize VLAs will cause a proper error; avoid tree checking errors as well by setting a safe value. */ if (constructor_max_index && TREE_CODE (constructor_max_index) != INTEGER_CST) constructor_max_index = build_int_cst (NULL_TREE, -1); constructor_index = convert (bitsizetype, TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); } else constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; if (value && TREE_CODE (value) == STRING_CST) { /* We need to split the char/wchar array into individual characters, so that we don't have to special case it everywhere. */ set_nonincremental_init_from_string (value); } } else { if (constructor_type != error_mark_node) warning_init ("braces around scalar initializer"); constructor_fields = constructor_type; constructor_unfilled_fields = constructor_type; } } /* At the end of an implicit or explicit brace level, finish up that level of constructor. If a single expression with redundant braces initialized that level, return the c_expr structure for that expression. Otherwise, the original_code element is set to ERROR_MARK. If we were outputting the elements as they are read, return 0 as the value from inner levels (process_init_element ignores that), but return error_mark_node as the value from the outermost level (that's what we want to put in DECL_INITIAL). Otherwise, return a CONSTRUCTOR expression as the value. */ struct c_expr pop_init_level (int implicit) { struct constructor_stack *p; struct c_expr ret; ret.value = 0; ret.original_code = ERROR_MARK; if (implicit == 0) { /* When we come to an explicit close brace, pop any inner levels that didn't have explicit braces. */ while (constructor_stack->implicit) process_init_element (pop_init_level (1)); gcc_assert (!constructor_range_stack); } /* Now output all pending elements. */ constructor_incremental = 1; output_pending_init_elements (1); p = constructor_stack; /* Error for initializing a flexible array member, or a zero-length array member in an inappropriate context. */ if (constructor_type && constructor_fields && TREE_CODE (constructor_type) == ARRAY_TYPE && TYPE_DOMAIN (constructor_type) && !TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type))) { /* Silently discard empty initializations. The parser will already have pedwarned for empty brackets. */ if (integer_zerop (constructor_unfilled_index)) constructor_type = NULL_TREE; else { gcc_assert (!TYPE_SIZE (constructor_type)); if (constructor_depth > 2) error_init ("initialization of flexible array member in a nested context"); else if (pedantic) pedwarn_init ("initialization of a flexible array member"); /* We have already issued an error message for the existence of a flexible array member not at the end of the structure. Discard the initializer so that we do not die later. */ if (TREE_CHAIN (constructor_fields) != NULL_TREE) constructor_type = NULL_TREE; } } /* Warn when some struct elements are implicitly initialized to zero. */ if (warn_missing_field_initializers && constructor_type && TREE_CODE (constructor_type) == RECORD_TYPE && constructor_unfilled_fields) { /* Do not warn for flexible array members or zero-length arrays. */ while (constructor_unfilled_fields && (!DECL_SIZE (constructor_unfilled_fields) || integer_zerop (DECL_SIZE (constructor_unfilled_fields)))) constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); /* Do not warn if this level of the initializer uses member designators; it is likely to be deliberate. */ if (constructor_unfilled_fields && !constructor_designated) { push_member_name (constructor_unfilled_fields); warning_init ("missing initializer"); RESTORE_SPELLING_DEPTH (constructor_depth); } } /* Pad out the end of the structure. */ if (p->replacement_value.value) /* If this closes a superfluous brace pair, just pass out the element between them. */ ret = p->replacement_value; else if (constructor_type == 0) ; else if (TREE_CODE (constructor_type) != RECORD_TYPE && TREE_CODE (constructor_type) != UNION_TYPE && TREE_CODE (constructor_type) != ARRAY_TYPE && TREE_CODE (constructor_type) != VECTOR_TYPE) { /* A nonincremental scalar initializer--just return the element, after verifying there is just one. */ if (VEC_empty (constructor_elt,constructor_elements)) { if (!constructor_erroneous) error_init ("empty scalar initializer"); ret.value = error_mark_node; } else if (VEC_length (constructor_elt,constructor_elements) != 1) { error_init ("extra elements in scalar initializer"); ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; } else ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; } else { if (constructor_erroneous) ret.value = error_mark_node; else { ret.value = build_constructor (constructor_type, constructor_elements); if (constructor_constant) TREE_CONSTANT (ret.value) = TREE_INVARIANT (ret.value) = 1; if (constructor_constant && constructor_simple) TREE_STATIC (ret.value) = 1; } } constructor_type = p->type; constructor_fields = p->fields; constructor_index = p->index; constructor_max_index = p->max_index; constructor_unfilled_index = p->unfilled_index; constructor_unfilled_fields = p->unfilled_fields; constructor_bit_index = p->bit_index; constructor_elements = p->elements; constructor_constant = p->constant; constructor_simple = p->simple; constructor_erroneous = p->erroneous; constructor_incremental = p->incremental; constructor_designated = p->designated; constructor_pending_elts = p->pending_elts; constructor_depth = p->depth; if (!p->implicit) constructor_range_stack = p->range_stack; RESTORE_SPELLING_DEPTH (constructor_depth); constructor_stack = p->next; free (p); if (ret.value == 0 && constructor_stack == 0) ret.value = error_mark_node; return ret; } /* Common handling for both array range and field name designators. ARRAY argument is nonzero for array ranges. Returns zero for success. */ static int set_designator (int array) { tree subtype; enum tree_code subcode; /* Don't die if an entire brace-pair level is superfluous in the containing level. */ if (constructor_type == 0) return 1; /* If there were errors in this designator list already, bail out silently. */ if (designator_erroneous) return 1; if (!designator_depth) { gcc_assert (!constructor_range_stack); /* Designator list starts at the level of closest explicit braces. */ while (constructor_stack->implicit) process_init_element (pop_init_level (1)); constructor_designated = 1; return 0; } switch (TREE_CODE (constructor_type)) { case RECORD_TYPE: case UNION_TYPE: subtype = TREE_TYPE (constructor_fields); if (subtype != error_mark_node) subtype = TYPE_MAIN_VARIANT (subtype); break; case ARRAY_TYPE: subtype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); break; default: gcc_unreachable (); } subcode = TREE_CODE (subtype); if (array && subcode != ARRAY_TYPE) { error_init ("array index in non-array initializer"); return 1; } else if (!array && subcode != RECORD_TYPE && subcode != UNION_TYPE) { error_init ("field name not in record or union initializer"); return 1; } constructor_designated = 1; push_init_level (2); return 0; } /* If there are range designators in designator list, push a new designator to constructor_range_stack. RANGE_END is end of such stack range or NULL_TREE if there is no range designator at this level. */ static void push_range_stack (tree range_end) { struct constructor_range_stack *p; p = GGC_NEW (struct constructor_range_stack); p->prev = constructor_range_stack; p->next = 0; p->fields = constructor_fields; p->range_start = constructor_index; p->index = constructor_index; p->stack = constructor_stack; p->range_end = range_end; if (constructor_range_stack) constructor_range_stack->next = p; constructor_range_stack = p; } /* Within an array initializer, specify the next index to be initialized. FIRST is that index. If LAST is nonzero, then initialize a range of indices, running from FIRST through LAST. */ void set_init_index (tree first, tree last) { if (set_designator (1)) return; designator_erroneous = 1; if (!INTEGRAL_TYPE_P (TREE_TYPE (first)) || (last && !INTEGRAL_TYPE_P (TREE_TYPE (last)))) { error_init ("array index in initializer not of integer type"); return; } if (TREE_CODE (first) != INTEGER_CST) error_init ("nonconstant array index in initializer"); else if (last != 0 && TREE_CODE (last) != INTEGER_CST) error_init ("nonconstant array index in initializer"); else if (TREE_CODE (constructor_type) != ARRAY_TYPE) error_init ("array index in non-array initializer"); else if (tree_int_cst_sgn (first) == -1) error_init ("array index in initializer exceeds array bounds"); else if (constructor_max_index && tree_int_cst_lt (constructor_max_index, first)) error_init ("array index in initializer exceeds array bounds"); else { constructor_index = convert (bitsizetype, first); if (last) { if (tree_int_cst_equal (first, last)) last = 0; else if (tree_int_cst_lt (last, first)) { error_init ("empty index range in initializer"); last = 0; } else { last = convert (bitsizetype, last); if (constructor_max_index != 0 && tree_int_cst_lt (constructor_max_index, last)) { error_init ("array index range in initializer exceeds array bounds"); last = 0; } } } designator_depth++; designator_erroneous = 0; if (constructor_range_stack || last) push_range_stack (last); } } /* Within a struct initializer, specify the next field to be initialized. */ void set_init_label (tree fieldname) { tree tail; if (set_designator (0)) return; designator_erroneous = 1; if (TREE_CODE (constructor_type) != RECORD_TYPE && TREE_CODE (constructor_type) != UNION_TYPE) { error_init ("field name not in record or union initializer"); return; } for (tail = TYPE_FIELDS (constructor_type); tail; tail = TREE_CHAIN (tail)) { if (DECL_NAME (tail) == fieldname) break; } if (tail == 0) error ("unknown field %qE specified in initializer", fieldname); else { constructor_fields = tail; designator_depth++; designator_erroneous = 0; if (constructor_range_stack) push_range_stack (NULL_TREE); } } /* Add a new initializer to the tree of pending initializers. PURPOSE identifies the initializer, either array index or field in a structure. VALUE is the value of that index or field. */ static void add_pending_init (tree purpose, tree value) { struct init_node *p, **q, *r; q = &constructor_pending_elts; p = 0; if (TREE_CODE (constructor_type) == ARRAY_TYPE) { while (*q != 0) { p = *q; if (tree_int_cst_lt (purpose, p->purpose)) q = &p->left; else if (tree_int_cst_lt (p->purpose, purpose)) q = &p->right; else { if (TREE_SIDE_EFFECTS (p->value)) warning_init ("initialized field with side-effects overwritten"); else if (warn_override_init) warning_init ("initialized field overwritten"); p->value = value; return; } } } else { tree bitpos; bitpos = bit_position (purpose); while (*q != NULL) { p = *q; if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) q = &p->left; else if (p->purpose != purpose) q = &p->right; else { if (TREE_SIDE_EFFECTS (p->value)) warning_init ("initialized field with side-effects overwritten"); else if (warn_override_init) warning_init ("initialized field overwritten"); p->value = value; return; } } } r = GGC_NEW (struct init_node); r->purpose = purpose; r->value = value; *q = r; r->parent = p; r->left = 0; r->right = 0; r->balance = 0; while (p) { struct init_node *s; if (r == p->left) { if (p->balance == 0) p->balance = -1; else if (p->balance < 0) { if (r->balance < 0) { /* L rotation. */ p->left = r->right; if (p->left) p->left->parent = p; r->right = p; p->balance = 0; r->balance = 0; s = p->parent; p->parent = r; r->parent = s; if (s) { if (s->left == p) s->left = r; else s->right = r; } else constructor_pending_elts = r; } else { /* LR rotation. */ struct init_node *t = r->right; r->right = t->left; if (r->right) r->right->parent = r; t->left = r; p->left = t->right; if (p->left) p->left->parent = p; t->right = p; p->balance = t->balance < 0; r->balance = -(t->balance > 0); t->balance = 0; s = p->parent; p->parent = t; r->parent = t; t->parent = s; if (s) { if (s->left == p) s->left = t; else s->right = t; } else constructor_pending_elts = t; } break; } else { /* p->balance == +1; growth of left side balances the node. */ p->balance = 0; break; } } else /* r == p->right */ { if (p->balance == 0) /* Growth propagation from right side. */ p->balance++; else if (p->balance > 0) { if (r->balance > 0) { /* R rotation. */ p->right = r->left; if (p->right) p->right->parent = p; r->left = p; p->balance = 0; r->balance = 0; s = p->parent; p->parent = r; r->parent = s; if (s) { if (s->left == p) s->left = r; else s->right = r; } else constructor_pending_elts = r; } else /* r->balance == -1 */ { /* RL rotation */ struct init_node *t = r->left; r->left = t->right; if (r->left) r->left->parent = r; t->right = r; p->right = t->left; if (p->right) p->right->parent = p; t->left = p; r->balance = (t->balance < 0); p->balance = -(t->balance > 0); t->balance = 0; s = p->parent; p->parent = t; r->parent = t; t->parent = s; if (s) { if (s->left == p) s->left = t; else s->right = t; } else constructor_pending_elts = t; } break; } else { /* p->balance == -1; growth of right side balances the node. */ p->balance = 0; break; } } r = p; p = p->parent; } } /* Build AVL tree from a sorted chain. */ static void set_nonincremental_init (void) { unsigned HOST_WIDE_INT ix; tree index, value; if (TREE_CODE (constructor_type) != RECORD_TYPE && TREE_CODE (constructor_type) != ARRAY_TYPE) return; FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value) add_pending_init (index, value); constructor_elements = 0; if (TREE_CODE (constructor_type) == RECORD_TYPE) { constructor_unfilled_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ while (constructor_unfilled_fields != 0 && DECL_C_BIT_FIELD (constructor_unfilled_fields) && DECL_NAME (constructor_unfilled_fields) == 0) constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (TYPE_DOMAIN (constructor_type)) constructor_unfilled_index = convert (bitsizetype, TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); else constructor_unfilled_index = bitsize_zero_node; } constructor_incremental = 0; } /* Build AVL tree from a string constant. */ static void set_nonincremental_init_from_string (tree str) { tree value, purpose, type; HOST_WIDE_INT val[2]; const char *p, *end; int byte, wchar_bytes, charwidth, bitpos; gcc_assert (TREE_CODE (constructor_type) == ARRAY_TYPE); if (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str))) == TYPE_PRECISION (char_type_node)) wchar_bytes = 1; else { gcc_assert (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str))) == TYPE_PRECISION (wchar_type_node)); wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT; } charwidth = TYPE_PRECISION (char_type_node); type = TREE_TYPE (constructor_type); p = TREE_STRING_POINTER (str); end = p + TREE_STRING_LENGTH (str); for (purpose = bitsize_zero_node; p < end && !tree_int_cst_lt (constructor_max_index, purpose); purpose = size_binop (PLUS_EXPR, purpose, bitsize_one_node)) { if (wchar_bytes == 1) { val[1] = (unsigned char) *p++; val[0] = 0; } else { val[0] = 0; val[1] = 0; for (byte = 0; byte < wchar_bytes; byte++) { if (BYTES_BIG_ENDIAN) bitpos = (wchar_bytes - byte - 1) * charwidth; else bitpos = byte * charwidth; val[bitpos < HOST_BITS_PER_WIDE_INT] |= ((unsigned HOST_WIDE_INT) ((unsigned char) *p++)) << (bitpos % HOST_BITS_PER_WIDE_INT); } } if (!TYPE_UNSIGNED (type)) { bitpos = ((wchar_bytes - 1) * charwidth) + HOST_BITS_PER_CHAR; if (bitpos < HOST_BITS_PER_WIDE_INT) { if (val[1] & (((HOST_WIDE_INT) 1) << (bitpos - 1))) { val[1] |= ((HOST_WIDE_INT) -1) << bitpos; val[0] = -1; } } else if (bitpos == HOST_BITS_PER_WIDE_INT) { if (val[1] < 0) val[0] = -1; } else if (val[0] & (((HOST_WIDE_INT) 1) << (bitpos - 1 - HOST_BITS_PER_WIDE_INT))) val[0] |= ((HOST_WIDE_INT) -1) << (bitpos - HOST_BITS_PER_WIDE_INT); } value = build_int_cst_wide (type, val[1], val[0]); add_pending_init (purpose, value); } constructor_incremental = 0; } /* Return value of FIELD in pending initializer or zero if the field was not initialized yet. */ static tree find_init_member (tree field) { struct init_node *p; if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (constructor_incremental && tree_int_cst_lt (field, constructor_unfilled_index)) set_nonincremental_init (); p = constructor_pending_elts; while (p) { if (tree_int_cst_lt (field, p->purpose)) p = p->left; else if (tree_int_cst_lt (p->purpose, field)) p = p->right; else return p->value; } } else if (TREE_CODE (constructor_type) == RECORD_TYPE) { tree bitpos = bit_position (field); if (constructor_incremental && (!constructor_unfilled_fields || tree_int_cst_lt (bitpos, bit_position (constructor_unfilled_fields)))) set_nonincremental_init (); p = constructor_pending_elts; while (p) { if (field == p->purpose) return p->value; else if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) p = p->left; else p = p->right; } } else if (TREE_CODE (constructor_type) == UNION_TYPE) { if (!VEC_empty (constructor_elt, constructor_elements) && (VEC_last (constructor_elt, constructor_elements)->index == field)) return VEC_last (constructor_elt, constructor_elements)->value; } return 0; } /* "Output" the next constructor element. At top level, really output it to assembler code now. Otherwise, collect it in a list from which we will make a CONSTRUCTOR. TYPE is the data type that the containing data type wants here. FIELD is the field (a FIELD_DECL) or the index that this element fills. If VALUE is a string constant, STRICT_STRING is true if it is unparenthesized or we should not warn here for it being parenthesized. For other types of VALUE, STRICT_STRING is not used. PENDING if non-nil means output pending elements that belong right after this element. (PENDING is normally 1; it is 0 while outputting pending elements, to avoid recursion.) */ static void output_init_element (tree value, bool strict_string, tree type, tree field, int pending) { constructor_elt *celt; if (type == error_mark_node || value == error_mark_node) { constructor_erroneous = 1; return; } if (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE && (TREE_CODE (value) == STRING_CST || TREE_CODE (value) == COMPOUND_LITERAL_EXPR) && !(TREE_CODE (value) == STRING_CST && TREE_CODE (type) == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (type))) && !comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (value)), TYPE_MAIN_VARIANT (type))) value = array_to_pointer_conversion (value); if (TREE_CODE (value) == COMPOUND_LITERAL_EXPR && require_constant_value && !flag_isoc99 && pending) { /* As an extension, allow initializing objects with static storage duration with compound literals (which are then treated just as the brace enclosed list they contain). */ tree decl = COMPOUND_LITERAL_EXPR_DECL (value); value = DECL_INITIAL (decl); } if (value == error_mark_node) constructor_erroneous = 1; else if (!TREE_CONSTANT (value)) constructor_constant = 0; else if (!initializer_constant_valid_p (value, TREE_TYPE (value)) || ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && DECL_C_BIT_FIELD (field) && TREE_CODE (value) != INTEGER_CST)) constructor_simple = 0; if (!initializer_constant_valid_p (value, TREE_TYPE (value))) { if (require_constant_value) { error_init ("initializer element is not constant"); value = error_mark_node; } else if (require_constant_elements) pedwarn ("initializer element is not computable at load time"); } /* If this field is empty (and not at the end of structure), don't do anything other than checking the initializer. */ if (field && (TREE_TYPE (field) == error_mark_node || (COMPLETE_TYPE_P (TREE_TYPE (field)) && integer_zerop (TYPE_SIZE (TREE_TYPE (field))) && (TREE_CODE (constructor_type) == ARRAY_TYPE || TREE_CHAIN (field))))) return; value = digest_init (type, value, strict_string, require_constant_value); if (value == error_mark_node) { constructor_erroneous = 1; return; } /* If this element doesn't come next in sequence, put it on constructor_pending_elts. */ if (TREE_CODE (constructor_type) == ARRAY_TYPE && (!constructor_incremental || !tree_int_cst_equal (field, constructor_unfilled_index))) { if (constructor_incremental && tree_int_cst_lt (field, constructor_unfilled_index)) set_nonincremental_init (); add_pending_init (field, value); return; } else if (TREE_CODE (constructor_type) == RECORD_TYPE && (!constructor_incremental || field != constructor_unfilled_fields)) { /* We do this for records but not for unions. In a union, no matter which field is specified, it can be initialized right away since it starts at the beginning of the union. */ if (constructor_incremental) { if (!constructor_unfilled_fields) set_nonincremental_init (); else { tree bitpos, unfillpos; bitpos = bit_position (field); unfillpos = bit_position (constructor_unfilled_fields); if (tree_int_cst_lt (bitpos, unfillpos)) set_nonincremental_init (); } } add_pending_init (field, value); return; } else if (TREE_CODE (constructor_type) == UNION_TYPE && !VEC_empty (constructor_elt, constructor_elements)) { if (TREE_SIDE_EFFECTS (VEC_last (constructor_elt, constructor_elements)->value)) warning_init ("initialized field with side-effects overwritten"); else if (warn_override_init) warning_init ("initialized field overwritten"); /* We can have just one union field set. */ constructor_elements = 0; } /* Otherwise, output this element either to constructor_elements or to the assembler file. */ celt = VEC_safe_push (constructor_elt, gc, constructor_elements, NULL); celt->index = field; celt->value = value; /* Advance the variable that indicates sequential elements output. */ if (TREE_CODE (constructor_type) == ARRAY_TYPE) constructor_unfilled_index = size_binop (PLUS_EXPR, constructor_unfilled_index, bitsize_one_node); else if (TREE_CODE (constructor_type) == RECORD_TYPE) { constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); /* Skip any nameless bit fields. */ while (constructor_unfilled_fields != 0 && DECL_C_BIT_FIELD (constructor_unfilled_fields) && DECL_NAME (constructor_unfilled_fields) == 0) constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); } else if (TREE_CODE (constructor_type) == UNION_TYPE) constructor_unfilled_fields = 0; /* Now output any pending elements which have become next. */ if (pending) output_pending_init_elements (0); } /* Output any pending elements which have become next. As we output elements, constructor_unfilled_{fields,index} advances, which may cause other elements to become next; if so, they too are output. If ALL is 0, we return when there are no more pending elements to output now. If ALL is 1, we output space as necessary so that we can output all the pending elements. */ static void output_pending_init_elements (int all) { struct init_node *elt = constructor_pending_elts; tree next; retry: /* Look through the whole pending tree. If we find an element that should be output now, output it. Otherwise, set NEXT to the element that comes first among those still pending. */ next = 0; while (elt) { if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (tree_int_cst_equal (elt->purpose, constructor_unfilled_index)) output_init_element (elt->value, true, TREE_TYPE (constructor_type), constructor_unfilled_index, 0); else if (tree_int_cst_lt (constructor_unfilled_index, elt->purpose)) { /* Advance to the next smaller node. */ if (elt->left) elt = elt->left; else { /* We have reached the smallest node bigger than the current unfilled index. Fill the space first. */ next = elt->purpose; break; } } else { /* Advance to the next bigger node. */ if (elt->right) elt = elt->right; else { /* We have reached the biggest node in a subtree. Find the parent of it, which is the next bigger node. */ while (elt->parent && elt->parent->right == elt) elt = elt->parent; elt = elt->parent; if (elt && tree_int_cst_lt (constructor_unfilled_index, elt->purpose)) { next = elt->purpose; break; } } } } else if (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) { tree ctor_unfilled_bitpos, elt_bitpos; /* If the current record is complete we are done. */ if (constructor_unfilled_fields == 0) break; ctor_unfilled_bitpos = bit_position (constructor_unfilled_fields); elt_bitpos = bit_position (elt->purpose); /* We can't compare fields here because there might be empty fields in between. */ if (tree_int_cst_equal (elt_bitpos, ctor_unfilled_bitpos)) { constructor_unfilled_fields = elt->purpose; output_init_element (elt->value, true, TREE_TYPE (elt->purpose), elt->purpose, 0); } else if (tree_int_cst_lt (ctor_unfilled_bitpos, elt_bitpos)) { /* Advance to the next smaller node. */ if (elt->left) elt = elt->left; else { /* We have reached the smallest node bigger than the current unfilled field. Fill the space first. */ next = elt->purpose; break; } } else { /* Advance to the next bigger node. */ if (elt->right) elt = elt->right; else { /* We have reached the biggest node in a subtree. Find the parent of it, which is the next bigger node. */ while (elt->parent && elt->parent->right == elt) elt = elt->parent; elt = elt->parent; if (elt && (tree_int_cst_lt (ctor_unfilled_bitpos, bit_position (elt->purpose)))) { next = elt->purpose; break; } } } } } /* Ordinarily return, but not if we want to output all and there are elements left. */ if (!(all && next != 0)) return; /* If it's not incremental, just skip over the gap, so that after jumping to retry we will output the next successive element. */ if (TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) constructor_unfilled_fields = next; else if (TREE_CODE (constructor_type) == ARRAY_TYPE) constructor_unfilled_index = next; /* ELT now points to the node in the pending tree with the next initializer to output. */ goto retry; } /* Add one non-braced element to the current constructor level. This adjusts the current position within the constructor's type. This may also start or terminate implicit levels to handle a partly-braced initializer. Once this has found the correct level for the new element, it calls output_init_element. */ void process_init_element (struct c_expr value) { tree orig_value = value.value; int string_flag = orig_value != 0 && TREE_CODE (orig_value) == STRING_CST; bool strict_string = value.original_code == STRING_CST; designator_depth = 0; designator_erroneous = 0; /* Handle superfluous braces around string cst as in char x[] = {"foo"}; */ if (string_flag && constructor_type && TREE_CODE (constructor_type) == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (constructor_type)) && integer_zerop (constructor_unfilled_index)) { if (constructor_stack->replacement_value.value) error_init ("excess elements in char array initializer"); constructor_stack->replacement_value = value; return; } if (constructor_stack->replacement_value.value != 0) { error_init ("excess elements in struct initializer"); return; } /* Ignore elements of a brace group if it is entirely superfluous and has already been diagnosed. */ if (constructor_type == 0) return; /* If we've exhausted any levels that didn't have braces, pop them now. */ while (constructor_stack->implicit) { if ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields == 0) process_init_element (pop_init_level (1)); else if (TREE_CODE (constructor_type) == ARRAY_TYPE && (constructor_max_index == 0 || tree_int_cst_lt (constructor_max_index, constructor_index))) process_init_element (pop_init_level (1)); else break; } /* In the case of [LO ... HI] = VALUE, only evaluate VALUE once. */ if (constructor_range_stack) { /* If value is a compound literal and we'll be just using its content, don't put it into a SAVE_EXPR. */ if (TREE_CODE (value.value) != COMPOUND_LITERAL_EXPR || !require_constant_value || flag_isoc99) value.value = save_expr (value.value); } while (1) { if (TREE_CODE (constructor_type) == RECORD_TYPE) { tree fieldtype; enum tree_code fieldcode; if (constructor_fields == 0) { pedwarn_init ("excess elements in struct initializer"); break; } fieldtype = TREE_TYPE (constructor_fields); if (fieldtype != error_mark_node) fieldtype = TYPE_MAIN_VARIANT (fieldtype); fieldcode = TREE_CODE (fieldtype); /* Error for non-static initialization of a flexible array member. */ if (fieldcode == ARRAY_TYPE && !require_constant_value && TYPE_SIZE (fieldtype) == NULL_TREE && TREE_CHAIN (constructor_fields) == NULL_TREE) { error_init ("non-static initialization of a flexible array member"); break; } /* Accept a string constant to initialize a subarray. */ if (value.value != 0 && fieldcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (fieldtype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ else if (value.value != 0 && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE || fieldcode == UNION_TYPE)) { push_init_level (1); continue; } if (value.value) { push_member_name (constructor_fields); output_init_element (value.value, strict_string, fieldtype, constructor_fields, 1); RESTORE_SPELLING_DEPTH (constructor_depth); } else /* Do the bookkeeping for an element that was directly output as a constructor. */ { /* For a record, keep track of end position of last field. */ if (DECL_SIZE (constructor_fields)) constructor_bit_index = size_binop (PLUS_EXPR, bit_position (constructor_fields), DECL_SIZE (constructor_fields)); /* If the current field was the first one not yet written out, it isn't now, so update. */ if (constructor_unfilled_fields == constructor_fields) { constructor_unfilled_fields = TREE_CHAIN (constructor_fields); /* Skip any nameless bit fields. */ while (constructor_unfilled_fields != 0 && DECL_C_BIT_FIELD (constructor_unfilled_fields) && DECL_NAME (constructor_unfilled_fields) == 0) constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); } } constructor_fields = TREE_CHAIN (constructor_fields); /* Skip any nameless bit fields at the beginning. */ while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) && DECL_NAME (constructor_fields) == 0) constructor_fields = TREE_CHAIN (constructor_fields); } else if (TREE_CODE (constructor_type) == UNION_TYPE) { tree fieldtype; enum tree_code fieldcode; if (constructor_fields == 0) { pedwarn_init ("excess elements in union initializer"); break; } fieldtype = TREE_TYPE (constructor_fields); if (fieldtype != error_mark_node) fieldtype = TYPE_MAIN_VARIANT (fieldtype); fieldcode = TREE_CODE (fieldtype); /* Warn that traditional C rejects initialization of unions. We skip the warning if the value is zero. This is done under the assumption that the zero initializer in user code appears conditioned on e.g. __STDC__ to avoid "missing initializer" warnings and relies on default initialization to zero in the traditional C case. We also skip the warning if the initializer is designated, again on the assumption that this must be conditional on __STDC__ anyway (and we've already complained about the member-designator already). */ if (!in_system_header && !constructor_designated && !(value.value && (integer_zerop (value.value) || real_zerop (value.value)))) warning (OPT_Wtraditional, "traditional C rejects initialization " "of unions"); /* Accept a string constant to initialize a subarray. */ if (value.value != 0 && fieldcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (fieldtype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ else if (value.value != 0 && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE || fieldcode == UNION_TYPE)) { push_init_level (1); continue; } if (value.value) { push_member_name (constructor_fields); output_init_element (value.value, strict_string, fieldtype, constructor_fields, 1); RESTORE_SPELLING_DEPTH (constructor_depth); } else /* Do the bookkeeping for an element that was directly output as a constructor. */ { constructor_bit_index = DECL_SIZE (constructor_fields); constructor_unfilled_fields = TREE_CHAIN (constructor_fields); } constructor_fields = 0; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); enum tree_code eltcode = TREE_CODE (elttype); /* Accept a string constant to initialize a subarray. */ if (value.value != 0 && eltcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (elttype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ else if (value.value != 0 && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != elttype && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE || eltcode == UNION_TYPE)) { push_init_level (1); continue; } if (constructor_max_index != 0 && (tree_int_cst_lt (constructor_max_index, constructor_index) || integer_all_onesp (constructor_max_index))) { pedwarn_init ("excess elements in array initializer"); break; } /* Now output the actual element. */ if (value.value) { push_array_bounds (tree_low_cst (constructor_index, 1)); output_init_element (value.value, strict_string, elttype, constructor_index, 1); RESTORE_SPELLING_DEPTH (constructor_depth); } constructor_index = size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); if (!value.value) /* If we are doing the bookkeeping for an element that was directly output as a constructor, we must update constructor_unfilled_index. */ constructor_unfilled_index = constructor_index; } else if (TREE_CODE (constructor_type) == VECTOR_TYPE) { tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); /* Do a basic check of initializer size. Note that vectors always have a fixed size derived from their type. */ if (tree_int_cst_lt (constructor_max_index, constructor_index)) { pedwarn_init ("excess elements in vector initializer"); break; } /* Now output the actual element. */ if (value.value) output_init_element (value.value, strict_string, elttype, constructor_index, 1); constructor_index = size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); if (!value.value) /* If we are doing the bookkeeping for an element that was directly output as a constructor, we must update constructor_unfilled_index. */ constructor_unfilled_index = constructor_index; } /* Handle the sole element allowed in a braced initializer for a scalar variable. */ else if (constructor_type != error_mark_node && constructor_fields == 0) { pedwarn_init ("excess elements in scalar initializer"); break; } else { if (value.value) output_init_element (value.value, strict_string, constructor_type, NULL_TREE, 1); constructor_fields = 0; } /* Handle range initializers either at this level or anywhere higher in the designator stack. */ if (constructor_range_stack) { struct constructor_range_stack *p, *range_stack; int finish = 0; range_stack = constructor_range_stack; constructor_range_stack = 0; while (constructor_stack != range_stack->stack) { gcc_assert (constructor_stack->implicit); process_init_element (pop_init_level (1)); } for (p = range_stack; !p->range_end || tree_int_cst_equal (p->index, p->range_end); p = p->prev) { gcc_assert (constructor_stack->implicit); process_init_element (pop_init_level (1)); } p->index = size_binop (PLUS_EXPR, p->index, bitsize_one_node); if (tree_int_cst_equal (p->index, p->range_end) && !p->prev) finish = 1; while (1) { constructor_index = p->index; constructor_fields = p->fields; if (finish && p->range_end && p->index == p->range_start) { finish = 0; p->prev = 0; } p = p->next; if (!p) break; push_init_level (2); p->stack = constructor_stack; if (p->range_end && tree_int_cst_equal (p->index, p->range_end)) p->index = p->range_start; } if (!finish) constructor_range_stack = range_stack; continue; } break; } constructor_range_stack = 0; } /* Build a complete asm-statement, whose components are a CV_QUALIFIER (guaranteed to be 'volatile' or null) and ARGS (represented using an ASM_EXPR node). */ tree build_asm_stmt (tree cv_qualifier, tree args) { if (!ASM_VOLATILE_P (args) && cv_qualifier) ASM_VOLATILE_P (args) = 1; return add_stmt (args); } /* Build an asm-expr, whose components are a STRING, some OUTPUTS, some INPUTS, and some CLOBBERS. The latter three may be NULL. SIMPLE indicates whether there was anything at all after the string in the asm expression -- asm("blah") and asm("blah" : ) are subtly different. We use a ASM_EXPR node to represent this. */ tree build_asm_expr (tree string, tree outputs, tree inputs, tree clobbers, bool simple) { tree tail; tree args; int i; const char *constraint; const char **oconstraints; bool allows_mem, allows_reg, is_inout; int ninputs, noutputs; ninputs = list_length (inputs); noutputs = list_length (outputs); oconstraints = (const char **) alloca (noutputs * sizeof (const char *)); string = resolve_asm_operand_names (string, outputs, inputs); /* Remove output conversions that change the type but not the mode. */ for (i = 0, tail = outputs; tail; ++i, tail = TREE_CHAIN (tail)) { tree output = TREE_VALUE (tail); /* ??? Really, this should not be here. Users should be using a proper lvalue, dammit. But there's a long history of using casts in the output operands. In cases like longlong.h, this becomes a primitive form of typechecking -- if the cast can be removed, then the output operand had a type of the proper width; otherwise we'll get an error. Gross, but ... */ STRIP_NOPS (output); if (!lvalue_or_else (output, lv_asm)) output = error_mark_node; if (output != error_mark_node && (TREE_READONLY (output) || TYPE_READONLY (TREE_TYPE (output)) || ((TREE_CODE (TREE_TYPE (output)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (output)) == UNION_TYPE) && C_TYPE_FIELDS_READONLY (TREE_TYPE (output))))) readonly_error (output, lv_asm); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail))); oconstraints[i] = constraint; if (parse_output_constraint (&constraint, i, ninputs, noutputs, &allows_mem, &allows_reg, &is_inout)) { /* If the operand is going to end up in memory, mark it addressable. */ if (!allows_reg && !c_mark_addressable (output)) output = error_mark_node; } else output = error_mark_node; TREE_VALUE (tail) = output; } for (i = 0, tail = inputs; tail; ++i, tail = TREE_CHAIN (tail)) { tree input; constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail))); input = TREE_VALUE (tail); if (parse_input_constraint (&constraint, i, ninputs, noutputs, 0, oconstraints, &allows_mem, &allows_reg)) { /* If the operand is going to end up in memory, mark it addressable. */ if (!allows_reg && allows_mem) { /* Strip the nops as we allow this case. FIXME, this really should be rejected or made deprecated. */ STRIP_NOPS (input); if (!c_mark_addressable (input)) input = error_mark_node; } } else input = error_mark_node; TREE_VALUE (tail) = input; } args = build_stmt (ASM_EXPR, string, outputs, inputs, clobbers); /* asm statements without outputs, including simple ones, are treated as volatile. */ ASM_INPUT_P (args) = simple; ASM_VOLATILE_P (args) = (noutputs == 0); return args; } /* Generate a goto statement to LABEL. */ tree c_finish_goto_label (tree label) { tree decl = lookup_label (label); if (!decl) return NULL_TREE; if (C_DECL_UNJUMPABLE_STMT_EXPR (decl)) { error ("jump into statement expression"); return NULL_TREE; } if (C_DECL_UNJUMPABLE_VM (decl)) { error ("jump into scope of identifier with variably modified type"); return NULL_TREE; } if (!C_DECL_UNDEFINABLE_STMT_EXPR (decl)) { /* No jump from outside this statement expression context, so record that there is a jump from within this context. */ struct c_label_list *nlist; nlist = XOBNEW (&parser_obstack, struct c_label_list); nlist->next = label_context_stack_se->labels_used; nlist->label = decl; label_context_stack_se->labels_used = nlist; } if (!C_DECL_UNDEFINABLE_VM (decl)) { /* No jump from outside this context context of identifiers with variably modified type, so record that there is a jump from within this context. */ struct c_label_list *nlist; nlist = XOBNEW (&parser_obstack, struct c_label_list); nlist->next = label_context_stack_vm->labels_used; nlist->label = decl; label_context_stack_vm->labels_used = nlist; } TREE_USED (decl) = 1; return add_stmt (build1 (GOTO_EXPR, void_type_node, decl)); } /* Generate a computed goto statement to EXPR. */ tree c_finish_goto_ptr (tree expr) { if (pedantic) pedwarn ("ISO C forbids %<goto *expr;%>"); expr = convert (ptr_type_node, expr); return add_stmt (build1 (GOTO_EXPR, void_type_node, expr)); } /* Generate a C `return' statement. RETVAL is the expression for what to return, or a null pointer for `return;' with no value. */ tree c_finish_return (tree retval) { tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)), ret_stmt; bool no_warning = false; if (TREE_THIS_VOLATILE (current_function_decl)) warning (0, "function declared %<noreturn%> has a %<return%> statement"); if (!retval) { current_function_returns_null = 1; if ((warn_return_type || flag_isoc99) && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE) { pedwarn_c99 ("%<return%> with no value, in " "function returning non-void"); no_warning = true; } } else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE) { current_function_returns_null = 1; if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE) pedwarn ("%<return%> with a value, in function returning void"); else if (pedantic) pedwarn ("ISO C forbids %<return%> with expression, in function returning void"); } else { tree t = convert_for_assignment (valtype, retval, ic_return, NULL_TREE, NULL_TREE, 0); tree res = DECL_RESULT (current_function_decl); tree inner; current_function_returns_value = 1; if (t == error_mark_node) return NULL_TREE; inner = t = convert (TREE_TYPE (res), t); /* Strip any conversions, additions, and subtractions, and see if we are returning the address of a local variable. Warn if so. */ while (1) { switch (TREE_CODE (inner)) { case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR: case PLUS_EXPR: inner = TREE_OPERAND (inner, 0); continue; case MINUS_EXPR: /* If the second operand of the MINUS_EXPR has a pointer type (or is converted from it), this may be valid, so don't give a warning. */ { tree op1 = TREE_OPERAND (inner, 1); while (!POINTER_TYPE_P (TREE_TYPE (op1)) && (TREE_CODE (op1) == NOP_EXPR || TREE_CODE (op1) == NON_LVALUE_EXPR || TREE_CODE (op1) == CONVERT_EXPR)) op1 = TREE_OPERAND (op1, 0); if (POINTER_TYPE_P (TREE_TYPE (op1))) break; inner = TREE_OPERAND (inner, 0); continue; } case ADDR_EXPR: inner = TREE_OPERAND (inner, 0); while (REFERENCE_CLASS_P (inner) && TREE_CODE (inner) != INDIRECT_REF) inner = TREE_OPERAND (inner, 0); if (DECL_P (inner) && !DECL_EXTERNAL (inner) && !TREE_STATIC (inner) && DECL_CONTEXT (inner) == current_function_decl) warning (0, "function returns address of local variable"); break; default: break; } break; } retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t); } ret_stmt = build_stmt (RETURN_EXPR, retval); TREE_NO_WARNING (ret_stmt) |= no_warning; return add_stmt (ret_stmt); } struct c_switch { /* The SWITCH_EXPR being built. */ tree switch_expr; /* The original type of the testing expression, i.e. before the default conversion is applied. */ tree orig_type; /* A splay-tree mapping the low element of a case range to the high element, or NULL_TREE if there is no high element. Used to determine whether or not a new case label duplicates an old case label. We need a tree, rather than simply a hash table, because of the GNU case range extension. */ splay_tree cases; /* Number of nested statement expressions within this switch statement; if nonzero, case and default labels may not appear. */ unsigned int blocked_stmt_expr; /* Scope of outermost declarations of identifiers with variably modified type within this switch statement; if nonzero, case and default labels may not appear. */ unsigned int blocked_vm; /* The next node on the stack. */ struct c_switch *next; }; /* A stack of the currently active switch statements. The innermost switch statement is on the top of the stack. There is no need to mark the stack for garbage collection because it is only active during the processing of the body of a function, and we never collect at that point. */ struct c_switch *c_switch_stack; /* Start a C switch statement, testing expression EXP. Return the new SWITCH_EXPR. */ tree c_start_case (tree exp) { tree orig_type = error_mark_node; struct c_switch *cs; if (exp != error_mark_node) { orig_type = TREE_TYPE (exp); if (!INTEGRAL_TYPE_P (orig_type)) { if (orig_type != error_mark_node) { error ("switch quantity not an integer"); orig_type = error_mark_node; } exp = integer_zero_node; } else { tree type = TYPE_MAIN_VARIANT (orig_type); if (!in_system_header && (type == long_integer_type_node || type == long_unsigned_type_node)) warning (OPT_Wtraditional, "%<long%> switch expression not " "converted to %<int%> in ISO C"); exp = default_conversion (exp); } } /* Add this new SWITCH_EXPR to the stack. */ cs = XNEW (struct c_switch); cs->switch_expr = build3 (SWITCH_EXPR, orig_type, exp, NULL_TREE, NULL_TREE); cs->orig_type = orig_type; cs->cases = splay_tree_new (case_compare, NULL, NULL); cs->blocked_stmt_expr = 0; cs->blocked_vm = 0; cs->next = c_switch_stack; c_switch_stack = cs; return add_stmt (cs->switch_expr); } /* Process a case label. */ tree do_case (tree low_value, tree high_value) { tree label = NULL_TREE; if (c_switch_stack && !c_switch_stack->blocked_stmt_expr && !c_switch_stack->blocked_vm) { label = c_add_case_label (c_switch_stack->cases, SWITCH_COND (c_switch_stack->switch_expr), c_switch_stack->orig_type, low_value, high_value); if (label == error_mark_node) label = NULL_TREE; } else if (c_switch_stack && c_switch_stack->blocked_stmt_expr) { if (low_value) error ("case label in statement expression not containing " "enclosing switch statement"); else error ("%<default%> label in statement expression not containing " "enclosing switch statement"); } else if (c_switch_stack && c_switch_stack->blocked_vm) { if (low_value) error ("case label in scope of identifier with variably modified " "type not containing enclosing switch statement"); else error ("%<default%> label in scope of identifier with variably " "modified type not containing enclosing switch statement"); } else if (low_value) error ("case label not within a switch statement"); else error ("%<default%> label not within a switch statement"); return label; } /* Finish the switch statement. */ void c_finish_case (tree body) { struct c_switch *cs = c_switch_stack; location_t switch_location; SWITCH_BODY (cs->switch_expr) = body; /* We must not be within a statement expression nested in the switch at this point; we might, however, be within the scope of an identifier with variably modified type nested in the switch. */ gcc_assert (!cs->blocked_stmt_expr); /* Emit warnings as needed. */ if (EXPR_HAS_LOCATION (cs->switch_expr)) switch_location = EXPR_LOCATION (cs->switch_expr); else switch_location = input_location; c_do_switch_warnings (cs->cases, switch_location, TREE_TYPE (cs->switch_expr), SWITCH_COND (cs->switch_expr)); /* Pop the stack. */ c_switch_stack = cs->next; splay_tree_delete (cs->cases); XDELETE (cs); } /* Emit an if statement. IF_LOCUS is the location of the 'if'. COND, THEN_BLOCK and ELSE_BLOCK are expressions to be used; ELSE_BLOCK may be null. NESTED_IF is true if THEN_BLOCK contains another IF statement, and was not surrounded with parenthesis. */ void c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, tree else_block, bool nested_if) { tree stmt; /* Diagnose an ambiguous else if if-then-else is nested inside if-then. */ if (warn_parentheses && nested_if && else_block == NULL) { tree inner_if = then_block; /* We know from the grammar productions that there is an IF nested within THEN_BLOCK. Due to labels and c99 conditional declarations, it might not be exactly THEN_BLOCK, but should be the last non-container statement within. */ while (1) switch (TREE_CODE (inner_if)) { case COND_EXPR: goto found; case BIND_EXPR: inner_if = BIND_EXPR_BODY (inner_if); break; case STATEMENT_LIST: inner_if = expr_last (then_block); break; case TRY_FINALLY_EXPR: case TRY_CATCH_EXPR: inner_if = TREE_OPERAND (inner_if, 0); break; default: gcc_unreachable (); } found: if (COND_EXPR_ELSE (inner_if)) warning (OPT_Wparentheses, "%Hsuggest explicit braces to avoid ambiguous %<else%>", &if_locus); } empty_if_body_warning (then_block, else_block); stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block); SET_EXPR_LOCATION (stmt, if_locus); add_stmt (stmt); } /* Emit a general-purpose loop construct. START_LOCUS is the location of the beginning of the loop. COND is the loop condition. COND_IS_FIRST is false for DO loops. INCR is the FOR increment expression. BODY is the statement controlled by the loop. BLAB is the break label. CLAB is the continue label. Everything is allowed to be NULL. */ void c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, tree blab, tree clab, bool cond_is_first) { tree entry = NULL, exit = NULL, t; /* If the condition is zero don't generate a loop construct. */ if (cond && integer_zerop (cond)) { if (cond_is_first) { t = build_and_jump (&blab); SET_EXPR_LOCATION (t, start_locus); add_stmt (t); } } else { tree top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); /* If we have an exit condition, then we build an IF with gotos either out of the loop, or to the top of it. If there's no exit condition, then we just build a jump back to the top. */ exit = build_and_jump (&LABEL_EXPR_LABEL (top)); if (cond && !integer_nonzerop (cond)) { /* Canonicalize the loop condition to the end. This means generating a branch to the loop condition. Reuse the continue label, if possible. */ if (cond_is_first) { if (incr || !clab) { entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE); t = build_and_jump (&LABEL_EXPR_LABEL (entry)); } else t = build1 (GOTO_EXPR, void_type_node, clab); SET_EXPR_LOCATION (t, start_locus); add_stmt (t); } t = build_and_jump (&blab); exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t); if (cond_is_first) SET_EXPR_LOCATION (exit, start_locus); else SET_EXPR_LOCATION (exit, input_location); } add_stmt (top); } if (body) add_stmt (body); if (clab) add_stmt (build1 (LABEL_EXPR, void_type_node, clab)); if (incr) add_stmt (incr); if (entry) add_stmt (entry); if (exit) add_stmt (exit); if (blab) add_stmt (build1 (LABEL_EXPR, void_type_node, blab)); } tree c_finish_bc_stmt (tree *label_p, bool is_break) { bool skip; tree label = *label_p; /* In switch statements break is sometimes stylistically used after a return statement. This can lead to spurious warnings about control reaching the end of a non-void function when it is inlined. Note that we are calling block_may_fallthru with language specific tree nodes; this works because block_may_fallthru returns true when given something it does not understand. */ skip = !block_may_fallthru (cur_stmt_list); if (!label) { if (!skip) *label_p = label = create_artificial_label (); } else if (TREE_CODE (label) == LABEL_DECL) ; else switch (TREE_INT_CST_LOW (label)) { case 0: if (is_break) error ("break statement not within loop or switch"); else error ("continue statement not within a loop"); return NULL_TREE; case 1: gcc_assert (is_break); error ("break statement used with OpenMP for loop"); return NULL_TREE; default: gcc_unreachable (); } if (skip) return NULL_TREE; return add_stmt (build1 (GOTO_EXPR, void_type_node, label)); } /* A helper routine for c_process_expr_stmt and c_finish_stmt_expr. */ static void emit_side_effect_warnings (tree expr) { if (expr == error_mark_node) ; else if (!TREE_SIDE_EFFECTS (expr)) { if (!VOID_TYPE_P (TREE_TYPE (expr)) && !TREE_NO_WARNING (expr)) warning (OPT_Wunused_value, "%Hstatement with no effect", EXPR_HAS_LOCATION (expr) ? EXPR_LOCUS (expr) : &input_location); } else warn_if_unused_value (expr, input_location); } /* Process an expression as if it were a complete statement. Emit diagnostics, but do not call ADD_STMT. */ tree c_process_expr_stmt (tree expr) { if (!expr) return NULL_TREE; if (warn_sequence_point) verify_sequence_points (expr); if (TREE_TYPE (expr) != error_mark_node && !COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (expr)) && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE) error ("expression statement has incomplete type"); /* If we're not processing a statement expression, warn about unused values. Warnings for statement expressions will be emitted later, once we figure out which is the result. */ if (!STATEMENT_LIST_STMT_EXPR (cur_stmt_list) && warn_unused_value) emit_side_effect_warnings (expr); /* If the expression is not of a type to which we cannot assign a line number, wrap the thing in a no-op NOP_EXPR. */ if (DECL_P (expr) || CONSTANT_CLASS_P (expr)) expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr); if (CAN_HAVE_LOCATION_P (expr)) SET_EXPR_LOCATION (expr, input_location); return expr; } /* Emit an expression as a statement. */ tree c_finish_expr_stmt (tree expr) { if (expr) return add_stmt (c_process_expr_stmt (expr)); else return NULL; } /* Do the opposite and emit a statement as an expression. To begin, create a new binding level and return it. */ tree c_begin_stmt_expr (void) { tree ret; struct c_label_context_se *nstack; struct c_label_list *glist; /* We must force a BLOCK for this level so that, if it is not expanded later, there is a way to turn off the entire subtree of blocks that are contained in it. */ keep_next_level (); ret = c_begin_compound_stmt (true); if (c_switch_stack) { c_switch_stack->blocked_stmt_expr++; gcc_assert (c_switch_stack->blocked_stmt_expr != 0); } for (glist = label_context_stack_se->labels_used; glist != NULL; glist = glist->next) { C_DECL_UNDEFINABLE_STMT_EXPR (glist->label) = 1; } nstack = XOBNEW (&parser_obstack, struct c_label_context_se); nstack->labels_def = NULL; nstack->labels_used = NULL; nstack->next = label_context_stack_se; label_context_stack_se = nstack; /* Mark the current statement list as belonging to a statement list. */ STATEMENT_LIST_STMT_EXPR (ret) = 1; return ret; } tree c_finish_stmt_expr (tree body) { tree last, type, tmp, val; tree *last_p; struct c_label_list *dlist, *glist, *glist_prev = NULL; body = c_end_compound_stmt (body, true); if (c_switch_stack) { gcc_assert (c_switch_stack->blocked_stmt_expr != 0); c_switch_stack->blocked_stmt_expr--; } /* It is no longer possible to jump to labels defined within this statement expression. */ for (dlist = label_context_stack_se->labels_def; dlist != NULL; dlist = dlist->next) { C_DECL_UNJUMPABLE_STMT_EXPR (dlist->label) = 1; } /* It is again possible to define labels with a goto just outside this statement expression. */ for (glist = label_context_stack_se->next->labels_used; glist != NULL; glist = glist->next) { C_DECL_UNDEFINABLE_STMT_EXPR (glist->label) = 0; glist_prev = glist; } if (glist_prev != NULL) glist_prev->next = label_context_stack_se->labels_used; else label_context_stack_se->next->labels_used = label_context_stack_se->labels_used; label_context_stack_se = label_context_stack_se->next; /* Locate the last statement in BODY. See c_end_compound_stmt about always returning a BIND_EXPR. */ last_p = &BIND_EXPR_BODY (body); last = BIND_EXPR_BODY (body); continue_searching: if (TREE_CODE (last) == STATEMENT_LIST) { tree_stmt_iterator i; /* This can happen with degenerate cases like ({ }). No value. */ if (!TREE_SIDE_EFFECTS (last)) return body; /* If we're supposed to generate side effects warnings, process all of the statements except the last. */ if (warn_unused_value) { for (i = tsi_start (last); !tsi_one_before_end_p (i); tsi_next (&i)) emit_side_effect_warnings (tsi_stmt (i)); } else i = tsi_last (last); last_p = tsi_stmt_ptr (i); last = *last_p; } /* If the end of the list is exception related, then the list was split by a call to push_cleanup. Continue searching. */ if (TREE_CODE (last) == TRY_FINALLY_EXPR || TREE_CODE (last) == TRY_CATCH_EXPR) { last_p = &TREE_OPERAND (last, 0); last = *last_p; goto continue_searching; } /* In the case that the BIND_EXPR is not necessary, return the expression out from inside it. */ if (last == error_mark_node || (last == BIND_EXPR_BODY (body) && BIND_EXPR_VARS (body) == NULL)) { /* Do not warn if the return value of a statement expression is unused. */ if (CAN_HAVE_LOCATION_P (last)) TREE_NO_WARNING (last) = 1; return last; } /* Extract the type of said expression. */ type = TREE_TYPE (last); /* If we're not returning a value at all, then the BIND_EXPR that we already have is a fine expression to return. */ if (!type || VOID_TYPE_P (type)) return body; /* Now that we've located the expression containing the value, it seems silly to make voidify_wrapper_expr repeat the process. Create a temporary of the appropriate type and stick it in a TARGET_EXPR. */ tmp = create_tmp_var_raw (type, NULL); /* Unwrap a no-op NOP_EXPR as added by c_finish_expr_stmt. This avoids tree_expr_nonnegative_p giving up immediately. */ val = last; if (TREE_CODE (val) == NOP_EXPR && TREE_TYPE (val) == TREE_TYPE (TREE_OPERAND (val, 0))) val = TREE_OPERAND (val, 0); *last_p = build2 (MODIFY_EXPR, void_type_node, tmp, val); SET_EXPR_LOCUS (*last_p, EXPR_LOCUS (last)); return build4 (TARGET_EXPR, type, tmp, body, NULL_TREE, NULL_TREE); } /* Begin the scope of an identifier of variably modified type, scope number SCOPE. Jumping from outside this scope to inside it is not permitted. */ void c_begin_vm_scope (unsigned int scope) { struct c_label_context_vm *nstack; struct c_label_list *glist; gcc_assert (scope > 0); /* At file_scope, we don't have to do any processing. */ if (label_context_stack_vm == NULL) return; if (c_switch_stack && !c_switch_stack->blocked_vm) c_switch_stack->blocked_vm = scope; for (glist = label_context_stack_vm->labels_used; glist != NULL; glist = glist->next) { C_DECL_UNDEFINABLE_VM (glist->label) = 1; } nstack = XOBNEW (&parser_obstack, struct c_label_context_vm); nstack->labels_def = NULL; nstack->labels_used = NULL; nstack->scope = scope; nstack->next = label_context_stack_vm; label_context_stack_vm = nstack; } /* End a scope which may contain identifiers of variably modified type, scope number SCOPE. */ void c_end_vm_scope (unsigned int scope) { if (label_context_stack_vm == NULL) return; if (c_switch_stack && c_switch_stack->blocked_vm == scope) c_switch_stack->blocked_vm = 0; /* We may have a number of nested scopes of identifiers with variably modified type, all at this depth. Pop each in turn. */ while (label_context_stack_vm->scope == scope) { struct c_label_list *dlist, *glist, *glist_prev = NULL; /* It is no longer possible to jump to labels defined within this scope. */ for (dlist = label_context_stack_vm->labels_def; dlist != NULL; dlist = dlist->next) { C_DECL_UNJUMPABLE_VM (dlist->label) = 1; } /* It is again possible to define labels with a goto just outside this scope. */ for (glist = label_context_stack_vm->next->labels_used; glist != NULL; glist = glist->next) { C_DECL_UNDEFINABLE_VM (glist->label) = 0; glist_prev = glist; } if (glist_prev != NULL) glist_prev->next = label_context_stack_vm->labels_used; else label_context_stack_vm->next->labels_used = label_context_stack_vm->labels_used; label_context_stack_vm = label_context_stack_vm->next; } } /* Begin and end compound statements. This is as simple as pushing and popping new statement lists from the tree. */ tree c_begin_compound_stmt (bool do_scope) { tree stmt = push_stmt_list (); if (do_scope) push_scope (); return stmt; } tree c_end_compound_stmt (tree stmt, bool do_scope) { tree block = NULL; if (do_scope) { if (c_dialect_objc ()) objc_clear_super_receiver (); block = pop_scope (); } stmt = pop_stmt_list (stmt); stmt = c_build_bind_expr (block, stmt); /* If this compound statement is nested immediately inside a statement expression, then force a BIND_EXPR to be created. Otherwise we'll do the wrong thing for ({ { 1; } }) or ({ 1; { } }). In particular, STATEMENT_LISTs merge, and thus we can lose track of what statement was really last. */ if (cur_stmt_list && STATEMENT_LIST_STMT_EXPR (cur_stmt_list) && TREE_CODE (stmt) != BIND_EXPR) { stmt = build3 (BIND_EXPR, void_type_node, NULL, stmt, NULL); TREE_SIDE_EFFECTS (stmt) = 1; } return stmt; } /* Queue a cleanup. CLEANUP is an expression/statement to be executed when the current scope is exited. EH_ONLY is true when this is not meant to apply to normal control flow transfer. */ void push_cleanup (tree ARG_UNUSED (decl), tree cleanup, bool eh_only) { enum tree_code code; tree stmt, list; bool stmt_expr; code = eh_only ? TRY_CATCH_EXPR : TRY_FINALLY_EXPR; stmt = build_stmt (code, NULL, cleanup); add_stmt (stmt); stmt_expr = STATEMENT_LIST_STMT_EXPR (cur_stmt_list); list = push_stmt_list (); TREE_OPERAND (stmt, 0) = list; STATEMENT_LIST_STMT_EXPR (list) = stmt_expr; } /* Build a binary-operation expression without default conversions. CODE is the kind of expression to build. This function differs from `build' in several ways: the data type of the result is computed and recorded in it, warnings are generated if arg data types are invalid, special handling for addition and subtraction of pointers is known, and some optimization is done (operations on narrow ints are done in the narrower type when that gives the same result). Constant folding is also done before the result is returned. Note that the operands will never have enumeral types, or function or array types, because either they will have the default conversions performed or they have both just been converted to some other type in which the arithmetic is to be done. */ tree build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, int convert_p) { tree type0, type1; enum tree_code code0, code1; tree op0, op1; const char *invalid_op_diag; /* Expression code to give to the expression when it is built. Normally this is CODE, which is what the caller asked for, but in some special cases we change it. */ enum tree_code resultcode = code; /* Data type in which the computation is to be performed. In the simplest cases this is the common type of the arguments. */ tree result_type = NULL; /* Nonzero means operands have already been type-converted in whatever way is necessary. Zero means they need to be converted to RESULT_TYPE. */ int converted = 0; /* Nonzero means create the expression with this type, rather than RESULT_TYPE. */ tree build_type = 0; /* Nonzero means after finally constructing the expression convert it to this type. */ tree final_type = 0; /* Nonzero if this is an operation like MIN or MAX which can safely be computed in short if both args are promoted shorts. Also implies COMMON. -1 indicates a bitwise operation; this makes a difference in the exact conditions for when it is safe to do the operation in a narrower mode. */ int shorten = 0; /* Nonzero if this is a comparison operation; if both args are promoted shorts, compare the original shorts. Also implies COMMON. */ int short_compare = 0; /* Nonzero if this is a right-shift operation, which can be computed on the original short and then promoted if the operand is a promoted short. */ int short_shift = 0; /* Nonzero means set RESULT_TYPE to the common type of the args. */ int common = 0; /* True means types are compatible as far as ObjC is concerned. */ bool objc_ok; if (convert_p) { op0 = default_conversion (orig_op0); op1 = default_conversion (orig_op1); } else { op0 = orig_op0; op1 = orig_op1; } type0 = TREE_TYPE (op0); type1 = TREE_TYPE (op1); /* The expression codes of the data types of the arguments tell us whether the arguments are integers, floating, pointers, etc. */ code0 = TREE_CODE (type0); code1 = TREE_CODE (type1); /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ STRIP_TYPE_NOPS (op0); STRIP_TYPE_NOPS (op1); /* If an error was already reported for one of the arguments, avoid reporting another error. */ if (code0 == ERROR_MARK || code1 == ERROR_MARK) return error_mark_node; if ((invalid_op_diag = targetm.invalid_binary_op (code, type0, type1))) { error (invalid_op_diag); return error_mark_node; } objc_ok = objc_compare_types (type0, type1, -3, NULL_TREE); switch (code) { case PLUS_EXPR: /* Handle the pointer + int case. */ if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) return pointer_int_sum (PLUS_EXPR, op0, op1); else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE) return pointer_int_sum (PLUS_EXPR, op1, op0); else common = 1; break; case MINUS_EXPR: /* Subtraction of two similar pointers. We must subtract them as integers, then divide by object size. */ if (code0 == POINTER_TYPE && code1 == POINTER_TYPE && comp_target_types (type0, type1)) return pointer_diff (op0, op1); /* Handle pointer minus int. Just like pointer plus int. */ else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) return pointer_int_sum (MINUS_EXPR, op0, op1); else common = 1; break; case MULT_EXPR: common = 1; break; case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case EXACT_DIV_EXPR: warn_for_div_by_zero (op1); if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == FIXED_POINT_TYPE || code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == FIXED_POINT_TYPE || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) { enum tree_code tcode0 = code0, tcode1 = code1; if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); if (code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE) tcode1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1))); if (!((tcode0 == INTEGER_TYPE && tcode1 == INTEGER_TYPE) || (tcode0 == FIXED_POINT_TYPE && tcode1 == FIXED_POINT_TYPE))) resultcode = RDIV_EXPR; else /* Although it would be tempting to shorten always here, that loses on some targets, since the modulo instruction is undefined if the quotient can't be represented in the computation mode. We shorten only if unsigned or if dividing by something we know != -1. */ shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) || (TREE_CODE (op1) == INTEGER_CST && !integer_all_onesp (op1))); common = 1; } break; case BIT_AND_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) shorten = -1; /* Allow vector types which are not floating point types. */ else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE && !VECTOR_FLOAT_TYPE_P (type0) && !VECTOR_FLOAT_TYPE_P (type1)) common = 1; break; case TRUNC_MOD_EXPR: case FLOOR_MOD_EXPR: warn_for_div_by_zero (op1); if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) { /* Although it would be tempting to shorten always here, that loses on some targets, since the modulo instruction is undefined if the quotient can't be represented in the computation mode. We shorten only if unsigned or if dividing by something we know != -1. */ shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) || (TREE_CODE (op1) == INTEGER_CST && !integer_all_onesp (op1))); common = 1; } break; case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: if ((code0 == INTEGER_TYPE || code0 == POINTER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE || code0 == FIXED_POINT_TYPE) && (code1 == INTEGER_TYPE || code1 == POINTER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE)) { /* Result of these operations is always an int, but that does not mean the operands should be converted to ints! */ result_type = integer_type_node; op0 = c_common_truthvalue_conversion (op0); op1 = c_common_truthvalue_conversion (op1); converted = 1; } break; /* Shift operations: result has same type as first operand; always convert second operand to int. Also set SHORT_SHIFT if shifting rightward. */ case RSHIFT_EXPR: if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE) && code1 == INTEGER_TYPE) { if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) { if (tree_int_cst_sgn (op1) < 0) warning (0, "right shift count is negative"); else { if (!integer_zerop (op1)) short_shift = 1; if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) warning (0, "right shift count >= width of type"); } } /* Use the type of the value to be shifted. */ result_type = type0; /* Convert the shift-count to an integer, regardless of size of value being shifted. */ if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) op1 = convert (integer_type_node, op1); /* Avoid converting op1 to result_type later. */ converted = 1; } break; case LSHIFT_EXPR: if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE) && code1 == INTEGER_TYPE) { if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) { if (tree_int_cst_sgn (op1) < 0) warning (0, "left shift count is negative"); else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0) warning (0, "left shift count >= width of type"); } /* Use the type of the value to be shifted. */ result_type = type0; /* Convert the shift-count to an integer, regardless of size of value being shifted. */ if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) op1 = convert (integer_type_node, op1); /* Avoid converting op1 to result_type later. */ converted = 1; } break; case EQ_EXPR: case NE_EXPR: if (code0 == REAL_TYPE || code1 == REAL_TYPE) warning (OPT_Wfloat_equal, "comparing floating point with == or != is unsafe"); /* Result of comparison is always int, but don't convert the args to int! */ build_type = integer_type_node; if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == FIXED_POINT_TYPE || code0 == COMPLEX_TYPE) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == FIXED_POINT_TYPE || code1 == COMPLEX_TYPE)) short_compare = 1; else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) { tree tt0 = TREE_TYPE (type0); tree tt1 = TREE_TYPE (type1); /* Anything compares with void *. void * compares with anything. Otherwise, the targets must be compatible and both must be object or both incomplete. */ if (comp_target_types (type0, type1)) result_type = common_pointer_type (type0, type1); else if (VOID_TYPE_P (tt0)) { /* op0 != orig_op0 detects the case of something whose value is 0 but which isn't a valid null ptr const. */ if (pedantic && !null_pointer_constant_p (orig_op0) && TREE_CODE (tt1) == FUNCTION_TYPE) pedwarn ("ISO C forbids comparison of %<void *%>" " with function pointer"); } else if (VOID_TYPE_P (tt1)) { if (pedantic && !null_pointer_constant_p (orig_op1) && TREE_CODE (tt0) == FUNCTION_TYPE) pedwarn ("ISO C forbids comparison of %<void *%>" " with function pointer"); } else /* Avoid warning about the volatile ObjC EH puts on decls. */ if (!objc_ok) pedwarn ("comparison of distinct pointer types lacks a cast"); if (result_type == NULL_TREE) result_type = ptr_type_node; } else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1)) { if (TREE_CODE (op0) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))) warning (OPT_Waddress, "the address of %qD will never be NULL", TREE_OPERAND (op0, 0)); result_type = type0; } else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0)) { if (TREE_CODE (op1) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0))) warning (OPT_Waddress, "the address of %qD will never be NULL", TREE_OPERAND (op1, 0)); result_type = type1; } else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) { result_type = type0; pedwarn ("comparison between pointer and integer"); } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) { result_type = type1; pedwarn ("comparison between pointer and integer"); } break; case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR: build_type = integer_type_node; if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == FIXED_POINT_TYPE) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == FIXED_POINT_TYPE)) short_compare = 1; else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) { if (comp_target_types (type0, type1)) { result_type = common_pointer_type (type0, type1); if (!COMPLETE_TYPE_P (TREE_TYPE (type0)) != !COMPLETE_TYPE_P (TREE_TYPE (type1))) pedwarn ("comparison of complete and incomplete pointers"); else if (pedantic && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) pedwarn ("ISO C forbids ordered comparisons of pointers to functions"); } else { result_type = ptr_type_node; pedwarn ("comparison of distinct pointer types lacks a cast"); } } else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1)) { result_type = type0; if (pedantic || extra_warnings) pedwarn ("ordered comparison of pointer with integer zero"); } else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0)) { result_type = type1; if (pedantic) pedwarn ("ordered comparison of pointer with integer zero"); } else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) { result_type = type0; pedwarn ("comparison between pointer and integer"); } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) { result_type = type1; pedwarn ("comparison between pointer and integer"); } break; default: gcc_unreachable (); } if (code0 == ERROR_MARK || code1 == ERROR_MARK) return error_mark_node; if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE && (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1)) || !same_scalar_type_ignoring_signedness (TREE_TYPE (type0), TREE_TYPE (type1)))) { binary_op_error (code, type0, type1); return error_mark_node; } if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE || code0 == FIXED_POINT_TYPE || code0 == VECTOR_TYPE) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == VECTOR_TYPE)) { int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE); if (shorten || common || short_compare) { result_type = c_common_type (type0, type1); if (result_type == error_mark_node) return error_mark_node; } /* For certain operations (which identify themselves by shorten != 0) if both args were extended from the same smaller type, do the arithmetic in that type and then extend. shorten !=0 and !=1 indicates a bitwise operation. For them, this optimization is safe only if both args are zero-extended or both are sign-extended. Otherwise, we might change the result. Eg, (short)-1 | (unsigned short)-1 is (int)-1 but calculated in (unsigned short) it would be (unsigned short)-1. */ if (shorten && none_complex) { int unsigned0, unsigned1; tree arg0, arg1; int uns; tree type; /* Cast OP0 and OP1 to RESULT_TYPE. Doing so prevents excessive narrowing when we call get_narrower below. For example, suppose that OP0 is of unsigned int extended from signed char and that RESULT_TYPE is long long int. If we explicitly cast OP0 to RESULT_TYPE, OP0 would look like (long long int) (unsigned int) signed_char which get_narrower would narrow down to (unsigned int) signed char If we do not cast OP0 first, get_narrower would return signed_char, which is inconsistent with the case of the explicit cast. */ op0 = convert (result_type, op0); op1 = convert (result_type, op1); arg0 = get_narrower (op0, &unsigned0); arg1 = get_narrower (op1, &unsigned1); /* UNS is 1 if the operation to be done is an unsigned one. */ uns = TYPE_UNSIGNED (result_type); final_type = result_type; /* Handle the case that OP0 (or OP1) does not *contain* a conversion but it *requires* conversion to FINAL_TYPE. */ if ((TYPE_PRECISION (TREE_TYPE (op0)) == TYPE_PRECISION (TREE_TYPE (arg0))) && TREE_TYPE (op0) != final_type) unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0)); if ((TYPE_PRECISION (TREE_TYPE (op1)) == TYPE_PRECISION (TREE_TYPE (arg1))) && TREE_TYPE (op1) != final_type) unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1)); /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */ /* For bitwise operations, signedness of nominal type does not matter. Consider only how operands were extended. */ if (shorten == -1) uns = unsigned0; /* Note that in all three cases below we refrain from optimizing an unsigned operation on sign-extended args. That would not be valid. */ /* Both args variable: if both extended in same way from same width, do it in that width. Do it unsigned if args were zero-extended. */ if ((TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)) && (TYPE_PRECISION (TREE_TYPE (arg1)) == TYPE_PRECISION (TREE_TYPE (arg0))) && unsigned0 == unsigned1 && (unsigned0 || !uns)) result_type = c_common_signed_or_unsigned_type (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1))); else if (TREE_CODE (arg0) == INTEGER_CST && (unsigned1 || !uns) && (TYPE_PRECISION (TREE_TYPE (arg1)) < TYPE_PRECISION (result_type)) && (type = c_common_signed_or_unsigned_type (unsigned1, TREE_TYPE (arg1))) && !POINTER_TYPE_P (type) && int_fits_type_p (arg0, type)) result_type = type; else if (TREE_CODE (arg1) == INTEGER_CST && (unsigned0 || !uns) && (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)) && (type = c_common_signed_or_unsigned_type (unsigned0, TREE_TYPE (arg0))) && !POINTER_TYPE_P (type) && int_fits_type_p (arg1, type)) result_type = type; } /* Shifts can be shortened if shifting right. */ if (short_shift) { int unsigned_arg; tree arg0 = get_narrower (op0, &unsigned_arg); final_type = result_type; if (arg0 == op0 && final_type == TREE_TYPE (op0)) unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0)); if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) /* We can shorten only if the shift count is less than the number of bits in the smaller type size. */ && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0 /* We cannot drop an unsigned shift after sign-extension. */ && (!TYPE_UNSIGNED (final_type) || unsigned_arg)) { /* Do an unsigned shift if the operand was zero-extended. */ result_type = c_common_signed_or_unsigned_type (unsigned_arg, TREE_TYPE (arg0)); /* Convert value-to-be-shifted to that type. */ if (TREE_TYPE (op0) != result_type) op0 = convert (result_type, op0); converted = 1; } } /* Comparison operations are shortened too but differently. They identify themselves by setting short_compare = 1. */ if (short_compare) { /* Don't write &op0, etc., because that would prevent op0 from being kept in a register. Instead, make copies of the our local variables and pass the copies by reference, then copy them back afterward. */ tree xop0 = op0, xop1 = op1, xresult_type = result_type; enum tree_code xresultcode = resultcode; tree val = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode); if (val != 0) return val; op0 = xop0, op1 = xop1; converted = 1; resultcode = xresultcode; if (warn_sign_compare && skip_evaluation == 0) { int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0)); int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1)); int unsignedp0, unsignedp1; tree primop0 = get_narrower (op0, &unsignedp0); tree primop1 = get_narrower (op1, &unsignedp1); xop0 = orig_op0; xop1 = orig_op1; STRIP_TYPE_NOPS (xop0); STRIP_TYPE_NOPS (xop1); /* Give warnings for comparisons between signed and unsigned quantities that may fail. Do the checking based on the original operand trees, so that casts will be considered, but default promotions won't be. Do not warn if the comparison is being done in a signed type, since the signed type will only be chosen if it can represent all the values of the unsigned type. */ if (!TYPE_UNSIGNED (result_type)) /* OK */; /* Do not warn if both operands are the same signedness. */ else if (op0_signed == op1_signed) /* OK */; else { tree sop, uop; bool ovf; if (op0_signed) sop = xop0, uop = xop1; else sop = xop1, uop = xop0; /* Do not warn if the signed quantity is an unsuffixed integer literal (or some static constant expression involving such literals or a conditional expression involving such literals) and it is non-negative. */ if (tree_expr_nonnegative_warnv_p (sop, &ovf)) /* OK */; /* Do not warn if the comparison is an equality operation, the unsigned quantity is an integral constant, and it would fit in the result if the result were signed. */ else if (TREE_CODE (uop) == INTEGER_CST && (resultcode == EQ_EXPR || resultcode == NE_EXPR) && int_fits_type_p (uop, c_common_signed_type (result_type))) /* OK */; /* Do not warn if the unsigned quantity is an enumeration constant and its maximum value would fit in the result if the result were signed. */ else if (TREE_CODE (uop) == INTEGER_CST && TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE && int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE (uop)), c_common_signed_type (result_type))) /* OK */; else warning (OPT_Wsign_compare, "comparison between signed and unsigned"); } /* Warn if two unsigned values are being compared in a size larger than their original size, and one (and only one) is the result of a `~' operator. This comparison will always fail. Also warn if one operand is a constant, and the constant does not have all bits set that are set in the ~ operand when it is extended. */ if ((TREE_CODE (primop0) == BIT_NOT_EXPR) != (TREE_CODE (primop1) == BIT_NOT_EXPR)) { if (TREE_CODE (primop0) == BIT_NOT_EXPR) primop0 = get_narrower (TREE_OPERAND (primop0, 0), &unsignedp0); else primop1 = get_narrower (TREE_OPERAND (primop1, 0), &unsignedp1); if (host_integerp (primop0, 0) || host_integerp (primop1, 0)) { tree primop; HOST_WIDE_INT constant, mask; int unsignedp, bits; if (host_integerp (primop0, 0)) { primop = primop1; unsignedp = unsignedp1; constant = tree_low_cst (primop0, 0); } else { primop = primop0; unsignedp = unsignedp0; constant = tree_low_cst (primop1, 0); } bits = TYPE_PRECISION (TREE_TYPE (primop)); if (bits < TYPE_PRECISION (result_type) && bits < HOST_BITS_PER_WIDE_INT && unsignedp) { mask = (~(HOST_WIDE_INT) 0) << bits; if ((mask & constant) != mask) warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with constant"); } } else if (unsignedp0 && unsignedp1 && (TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (result_type)) && (TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (result_type))) warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned"); } } } } /* At this point, RESULT_TYPE must be nonzero to avoid an error message. If CONVERTED is zero, both args will be converted to type RESULT_TYPE. Then the expression will be built. It will be given type FINAL_TYPE if that is nonzero; otherwise, it will be given type RESULT_TYPE. */ if (!result_type) { binary_op_error (code, TREE_TYPE (op0), TREE_TYPE (op1)); return error_mark_node; } if (!converted) { if (TREE_TYPE (op0) != result_type) op0 = convert_and_check (result_type, op0); if (TREE_TYPE (op1) != result_type) op1 = convert_and_check (result_type, op1); /* This can happen if one operand has a vector type, and the other has a different type. */ if (TREE_CODE (op0) == ERROR_MARK || TREE_CODE (op1) == ERROR_MARK) return error_mark_node; } if (build_type == NULL_TREE) build_type = result_type; { /* Treat expressions in initializers specially as they can't trap. */ tree result = require_constant_value ? fold_build2_initializer (resultcode, build_type, op0, op1) : fold_build2 (resultcode, build_type, op0, op1); if (final_type != 0) result = convert (final_type, result); return result; } } /* Convert EXPR to be a truth-value, validating its type for this purpose. */ tree c_objc_common_truthvalue_conversion (tree expr) { switch (TREE_CODE (TREE_TYPE (expr))) { case ARRAY_TYPE: error ("used array that cannot be converted to pointer where scalar is required"); return error_mark_node; case RECORD_TYPE: error ("used struct type value where scalar is required"); return error_mark_node; case UNION_TYPE: error ("used union type value where scalar is required"); return error_mark_node; case FUNCTION_TYPE: gcc_unreachable (); default: break; } /* ??? Should we also give an error for void and vectors rather than leaving those to give errors later? */ return c_common_truthvalue_conversion (expr); } /* Convert EXPR to a contained DECL, updating *TC, *TI and *SE as required. */ tree c_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED, bool *ti ATTRIBUTE_UNUSED, bool *se) { if (TREE_CODE (expr) == COMPOUND_LITERAL_EXPR) { tree decl = COMPOUND_LITERAL_EXPR_DECL (expr); /* Executing a compound literal inside a function reinitializes it. */ if (!TREE_STATIC (decl)) *se = true; return decl; } else return expr; } /* Like c_begin_compound_stmt, except force the retention of the BLOCK. */ tree c_begin_omp_parallel (void) { tree block; keep_next_level (); block = c_begin_compound_stmt (true); return block; } tree c_finish_omp_parallel (tree clauses, tree block) { tree stmt; block = c_end_compound_stmt (block, true); stmt = make_node (OMP_PARALLEL); TREE_TYPE (stmt) = void_type_node; OMP_PARALLEL_CLAUSES (stmt) = clauses; OMP_PARALLEL_BODY (stmt) = block; return add_stmt (stmt); } /* For all elements of CLAUSES, validate them vs OpenMP constraints. Remove any elements from the list that are invalid. */ tree c_finish_omp_clauses (tree clauses) { bitmap_head generic_head, firstprivate_head, lastprivate_head; tree c, t, *pc = &clauses; const char *name; bitmap_obstack_initialize (NULL); bitmap_initialize (&generic_head, &bitmap_default_obstack); bitmap_initialize (&firstprivate_head, &bitmap_default_obstack); bitmap_initialize (&lastprivate_head, &bitmap_default_obstack); for (pc = &clauses, c = clauses; c ; c = *pc) { bool remove = false; bool need_complete = false; bool need_implicitly_determined = false; switch (OMP_CLAUSE_CODE (c)) { case OMP_CLAUSE_SHARED: name = "shared"; need_implicitly_determined = true; goto check_dup_generic; case OMP_CLAUSE_PRIVATE: name = "private"; need_complete = true; need_implicitly_determined = true; goto check_dup_generic; case OMP_CLAUSE_REDUCTION: name = "reduction"; need_implicitly_determined = true; t = OMP_CLAUSE_DECL (c); if (AGGREGATE_TYPE_P (TREE_TYPE (t)) || POINTER_TYPE_P (TREE_TYPE (t))) { error ("%qE has invalid type for %<reduction%>", t); remove = true; } else if (FLOAT_TYPE_P (TREE_TYPE (t))) { enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); const char *r_name = NULL; switch (r_code) { case PLUS_EXPR: case MULT_EXPR: case MINUS_EXPR: break; case BIT_AND_EXPR: r_name = "&"; break; case BIT_XOR_EXPR: r_name = "^"; break; case BIT_IOR_EXPR: r_name = "|"; break; case TRUTH_ANDIF_EXPR: r_name = "&&"; break; case TRUTH_ORIF_EXPR: r_name = "||"; break; default: gcc_unreachable (); } if (r_name) { error ("%qE has invalid type for %<reduction(%s)%>", t, r_name); remove = true; } } goto check_dup_generic; case OMP_CLAUSE_COPYPRIVATE: name = "copyprivate"; goto check_dup_generic; case OMP_CLAUSE_COPYIN: name = "copyin"; t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t)) { error ("%qE must be %<threadprivate%> for %<copyin%>", t); remove = true; } goto check_dup_generic; check_dup_generic: t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) { error ("%qE is not a variable in clause %qs", t, name); remove = true; } else if (bitmap_bit_p (&generic_head, DECL_UID (t)) || bitmap_bit_p (&firstprivate_head, DECL_UID (t)) || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) { error ("%qE appears more than once in data clauses", t); remove = true; } else bitmap_set_bit (&generic_head, DECL_UID (t)); break; case OMP_CLAUSE_FIRSTPRIVATE: name = "firstprivate"; t = OMP_CLAUSE_DECL (c); need_complete = true; need_implicitly_determined = true; if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) { error ("%qE is not a variable in clause %<firstprivate%>", t); remove = true; } else if (bitmap_bit_p (&generic_head, DECL_UID (t)) || bitmap_bit_p (&firstprivate_head, DECL_UID (t))) { error ("%qE appears more than once in data clauses", t); remove = true; } else bitmap_set_bit (&firstprivate_head, DECL_UID (t)); break; case OMP_CLAUSE_LASTPRIVATE: name = "lastprivate"; t = OMP_CLAUSE_DECL (c); need_complete = true; need_implicitly_determined = true; if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) { error ("%qE is not a variable in clause %<lastprivate%>", t); remove = true; } else if (bitmap_bit_p (&generic_head, DECL_UID (t)) || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) { error ("%qE appears more than once in data clauses", t); remove = true; } else bitmap_set_bit (&lastprivate_head, DECL_UID (t)); break; case OMP_CLAUSE_IF: case OMP_CLAUSE_NUM_THREADS: case OMP_CLAUSE_SCHEDULE: case OMP_CLAUSE_NOWAIT: case OMP_CLAUSE_ORDERED: case OMP_CLAUSE_DEFAULT: pc = &OMP_CLAUSE_CHAIN (c); continue; default: gcc_unreachable (); } if (!remove) { t = OMP_CLAUSE_DECL (c); if (need_complete) { t = require_complete_type (t); if (t == error_mark_node) remove = true; } if (need_implicitly_determined) { const char *share_name = NULL; if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t)) share_name = "threadprivate"; else switch (c_omp_predetermined_sharing (t)) { case OMP_CLAUSE_DEFAULT_UNSPECIFIED: break; case OMP_CLAUSE_DEFAULT_SHARED: share_name = "shared"; break; case OMP_CLAUSE_DEFAULT_PRIVATE: share_name = "private"; break; default: gcc_unreachable (); } if (share_name) { error ("%qE is predetermined %qs for %qs", t, share_name, name); remove = true; } } } if (remove) *pc = OMP_CLAUSE_CHAIN (c); else pc = &OMP_CLAUSE_CHAIN (c); } bitmap_obstack_release (NULL); return clauses; } /* Make a variant type in the proper way for C/C++, propagating qualifiers down to the element type of an array. */ tree c_build_qualified_type (tree type, int type_quals) { if (type == error_mark_node) return type; if (TREE_CODE (type) == ARRAY_TYPE) { tree t; tree element_type = c_build_qualified_type (TREE_TYPE (type), type_quals); /* See if we already have an identically qualified type. */ for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) { if (TYPE_QUALS (strip_array_types (t)) == type_quals && TYPE_NAME (t) == TYPE_NAME (type) && TYPE_CONTEXT (t) == TYPE_CONTEXT (type) && attribute_list_equal (TYPE_ATTRIBUTES (t), TYPE_ATTRIBUTES (type))) break; } if (!t) { tree domain = TYPE_DOMAIN (type); t = build_variant_type_copy (type); TREE_TYPE (t) = element_type; if (TYPE_STRUCTURAL_EQUALITY_P (element_type) || (domain && TYPE_STRUCTURAL_EQUALITY_P (domain))) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (element_type) != element_type || (domain && TYPE_CANONICAL (domain) != domain)) { tree unqualified_canon = build_array_type (TYPE_CANONICAL (element_type), domain? TYPE_CANONICAL (domain) : NULL_TREE); TYPE_CANONICAL (t) = c_build_qualified_type (unqualified_canon, type_quals); } else TYPE_CANONICAL (t) = t; } return t; } /* A restrict-qualified pointer type must be a pointer to object or incomplete type. Note that the use of POINTER_TYPE_P also allows REFERENCE_TYPEs, which is appropriate for C++. */ if ((type_quals & TYPE_QUAL_RESTRICT) && (!POINTER_TYPE_P (type) || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))) { error ("invalid use of %<restrict%>"); type_quals &= ~TYPE_QUAL_RESTRICT; } return build_qualified_type (type, type_quals); }
[ "agroce@gmail.com" ]
agroce@gmail.com
ab0f950db7cf200efd26673c4d97569c2f34cecf
c2ffdc932bddb7eacbf26d2825f2a6b63066fc55
/Divisible_8_11.c
a33e3251da858582e29a819b2bd58023e08053a7
[]
no_license
SagarAlwani/C-Programming-Questions
59f9f4c4bfa3d0a6310d4b2877433a18017d3028
6816cc77da8f7c1bbcfd9f03eb08cc283b003644
refs/heads/main
2023-02-03T04:06:08.673211
2020-12-27T16:02:27
2020-12-27T16:02:27
324,746,592
0
0
null
null
null
null
UTF-8
C
false
false
275
c
#include<conio.h> #include<stdio.h> void main() { int a; printf("Enter a Number\n"); scanf("%d",&a); a%8==0?printf("%d is Divisible by 8",a):(a%11==0?printf("%d is Divisible by 11",a) :printf("%d is not divisible by 8 as well as 11",a)); getch(); }
[ "noreply@github.com" ]
SagarAlwani.noreply@github.com
d841f72a97d51f47f97a94775415dc505696a5f4
5669f1a305e7cfc555e551f4df8661ad57f65c49
/user_program.c
66e10291f7337ec2fe14d9ed221c1d2253d15f38
[]
no_license
Snehaa-0106/Tracking-page-faults-for-process-master
9775ac75242ef611c5730d3d7a308eab0f2abb04
a9ab424ff2890e4b95a5302d94fe2969e4b21816
refs/heads/master
2022-10-04T20:28:37.487857
2020-06-08T05:50:46
2020-06-08T05:50:46
270,544,853
0
0
null
null
null
null
UTF-8
C
false
false
912
c
#include<stdio.h> #include<stdlib.h> #include<errno.h> #include<fcntl.h> #include<string.h> #include<unistd.h> #include <sys/types.h> #define BUFFER_LENGTH 10000 static char buffer[BUFFER_LENGTH]; int main(){ int ret_val, fd; /* allocate memory for character buffers HERE before you use them */ fd = open("/dev/process_list", O_RDONLY); // Open the device with read only access ret_val = read(fd, buffer, BUFFER_LENGTH); // Read the response /* check for errors HERE */ if (fd < 0){ perror("Failed to open the device process_list!"); return errno; } else { printf("Device process_list has opened"); } /* check for errors HERE */ if (ret_val < 0){ perror("Failed to read the message from the process_list"); return errno; } else { printf("Message read from the process_list"); } printf("\n%s\n", buffer); // display the buffer contents close(fd); return 0; }
[ "52913391+Snehaa-0106@users.noreply.github.com" ]
52913391+Snehaa-0106@users.noreply.github.com
ce4070041a38a382372233a59414bf866a25cc5f
fe39967861adb17302bc699f29e47751061c169a
/nemu/src/cpu/decode/decode.c
9417faa53677f7ef08d49df5e77c3f5a809b437a
[]
no_license
TheWinds/ics
06b292ee66d9bd657d8ba7132255a513c5be2605
bed1bd9f66c5211f080d63ce5c5c3924e6e62751
refs/heads/master
2021-05-15T03:39:56.816792
2017-12-10T09:02:55
2017-12-10T09:02:55
109,715,577
1
0
null
null
null
null
UTF-8
C
false
false
7,149
c
#include "cpu/exec.h" #include "cpu/rtl.h" /* shared by all helper functions */ DecodeInfo decoding; rtlreg_t t0, t1, t2, t3; const rtlreg_t tzero = 0; #define make_DopHelper(name) void concat(decode_op_, name) (vaddr_t *eip, Operand *op, bool load_val) /* Refer to Appendix A in i386 manual for the explanations of these abbreviations */ /* Ib, Iv */ static inline make_DopHelper(I) { /* eip here is pointing to the immediate */ op->type = OP_TYPE_IMM; op->imm = instr_fetch(eip, op->width); rtl_li(&op->val, op->imm); #ifdef DEBUG snprintf(op->str, OP_STR_SIZE, "$0x%x", op->imm); #endif } /* I386 manual does not contain this abbreviation, but it is different from * the one above from the view of implementation. So we use another helper * function to decode it. */ /* sign immediate */ static inline make_DopHelper(SI) { assert(op->width == 1 || op->width == 4); op->type = OP_TYPE_IMM; if(op->width==1){ op->simm = (int8_t)instr_fetch(eip,op->width); }else{ op->simm = (int)instr_fetch(eip,op->width); } /* TODO: Use instr_fetch() to read `op->width' bytes of memory * pointed by `eip'. Interpret the result as a signed immediate, * and assign it to op->simm. * * 111 * 101 * 111 => -1 || 7 * 001 +1 op->simm = ??? */ // TODO(); rtl_li(&op->val, op->simm); #ifdef DEBUG snprintf(op->str, OP_STR_SIZE, "$0x%x", op->simm); #endif } /* I386 manual does not contain this abbreviation. * It is convenient to merge them into a single helper function. */ /* AL/eAX */ static inline make_DopHelper(a) { op->type = OP_TYPE_REG; op->reg = R_EAX; if (load_val) { rtl_lr(&op->val, R_EAX, op->width); } #ifdef DEBUG snprintf(op->str, OP_STR_SIZE, "%%%s", reg_name(R_EAX, op->width)); #endif } /* This helper function is use to decode register encoded in the opcode. */ /* XX: AL, AH, BL, BH, CL, CH, DL, DH * eXX: eAX, eCX, eDX, eBX, eSP, eBP, eSI, eDI */ static inline make_DopHelper(r) { op->type = OP_TYPE_REG; op->reg = decoding.opcode & 0x7; if (load_val) { rtl_lr(&op->val, op->reg, op->width); } #ifdef DEBUG snprintf(op->str, OP_STR_SIZE, "%%%s", reg_name(op->reg, op->width)); #endif } /* I386 manual does not contain this abbreviation. * We decode everything of modR/M byte by one time. */ /* Eb, Ew, Ev * Gb, Gv * Cd, * M * Rd * Sw */ static inline void decode_op_rm(vaddr_t *eip, Operand *rm, bool load_rm_val, Operand *reg, bool load_reg_val) { read_ModR_M(eip, rm, load_rm_val, reg, load_reg_val); } /* Ob, Ov */ static inline make_DopHelper(O) { op->type = OP_TYPE_MEM; op->addr = instr_fetch(eip, 4); if (load_val) { rtl_lm(&op->val, &op->addr, op->width); } #ifdef DEBUG snprintf(op->str, OP_STR_SIZE, "0x%x", op->addr); #endif } /* Eb <- Gb * Ev <- Gv */ make_DHelper(G2E) { decode_op_rm(eip, id_dest, true, id_src, true); } make_DHelper(mov_G2E) { decode_op_rm(eip, id_dest, false, id_src, true); } /* Gb <- Eb * Gv <- Ev */ make_DHelper(E2G) { decode_op_rm(eip, id_src, true, id_dest, true); } make_DHelper(mov_E2G) { decode_op_rm(eip, id_src, true, id_dest, false); } make_DHelper(lea_M2G) { decode_op_rm(eip, id_src, false, id_dest, false); } /* AL <- Ib * eAX <- Iv */ make_DHelper(I2a) { decode_op_a(eip, id_dest, true); decode_op_I(eip, id_src, true); } /* Gv <- EvIb * Gv <- EvIv * use for imul */ make_DHelper(I_E2G) { decode_op_rm(eip, id_src2, true, id_dest, false); decode_op_I(eip, id_src, true); } /* Eb <- Ib * Ev <- Iv */ make_DHelper(I2E) { decode_op_rm(eip, id_dest, true, NULL, false); decode_op_I(eip, id_src, true); } make_DHelper(mov_I2E) { decode_op_rm(eip, id_dest, false, NULL, false); decode_op_I(eip, id_src, true); } /* XX <- Ib * eXX <- Iv */ make_DHelper(I2r) { decode_op_r(eip, id_dest, true); decode_op_I(eip, id_src, true); } make_DHelper(mov_I2r) { decode_op_r(eip, id_dest, false); decode_op_I(eip, id_src, true); } /* used by unary operations */ make_DHelper(I) { decode_op_I(eip, id_dest, true); } make_DHelper(r) { decode_op_r(eip, id_dest, true); } make_DHelper(E) { decode_op_rm(eip, id_dest, true, NULL, false); } make_DHelper(gp7_E) { decode_op_rm(eip, id_dest, false, NULL, false); } /* used by test in group3 */ make_DHelper(test_I) { decode_op_I(eip, id_src, true); } make_DHelper(SI2E) { assert(id_dest->width == 2 || id_dest->width == 4); decode_op_rm(eip, id_dest, true, NULL, false); id_src->width = 1; decode_op_SI(eip, id_src, true); if (id_dest->width == 2) { id_src->val &= 0xffff; } } make_DHelper(SI_E2G) { assert(id_dest->width == 2 || id_dest->width == 4); decode_op_rm(eip, id_src2, true, id_dest, false); id_src->width = 1; decode_op_SI(eip, id_src, true); if (id_dest->width == 2) { id_src->val &= 0xffff; } } make_DHelper(gp2_1_E) { decode_op_rm(eip, id_dest, true, NULL, false); id_src->type = OP_TYPE_IMM; id_src->imm = 1; rtl_li(&id_src->val, 1); #ifdef DEBUG sprintf(id_src->str, "$1"); #endif } make_DHelper(gp2_cl2E) { decode_op_rm(eip, id_dest, true, NULL, false); id_src->type = OP_TYPE_REG; id_src->reg = R_CL; rtl_lr_b(&id_src->val, R_CL); #ifdef DEBUG sprintf(id_src->str, "%%cl"); #endif } make_DHelper(gp2_Ib2E) { decode_op_rm(eip, id_dest, true, NULL, false); id_src->width = 1; decode_op_I(eip, id_src, true); } /* Ev <- GvIb * use for shld/shrd */ make_DHelper(Ib_G2E) { decode_op_rm(eip, id_dest, true, id_src2, true); id_src->width = 1; decode_op_I(eip, id_src, true); } make_DHelper(O2a) { decode_op_O(eip, id_src, true); decode_op_a(eip, id_dest, false); } make_DHelper(a2O) { decode_op_a(eip, id_src, true); decode_op_O(eip, id_dest, false); } make_DHelper(J) { decode_op_SI(eip, id_dest, false); // the target address can be computed in the decode stage decoding.jmp_eip = id_dest->simm + *eip; } make_DHelper(push_SI) { decode_op_SI(eip, id_dest, true); } make_DHelper(in_I2a) { id_src->width = 1; decode_op_I(eip, id_src, true); decode_op_a(eip, id_dest, false); } make_DHelper(in_dx2a) { id_src->type = OP_TYPE_REG; id_src->reg = R_DX; rtl_lr_w(&id_src->val, R_DX); #ifdef DEBUG sprintf(id_src->str, "(%%dx)"); #endif decode_op_a(eip, id_dest, false); } make_DHelper(out_a2I) { decode_op_a(eip, id_src, true); id_dest->width = 1; decode_op_I(eip, id_dest, true); } make_DHelper(out_a2dx) { decode_op_a(eip, id_src, true); id_dest->type = OP_TYPE_REG; id_dest->reg = R_DX; rtl_lr_w(&id_dest->val, R_DX); #ifdef DEBUG sprintf(id_dest->str, "(%%dx)"); #endif } make_DHelper(call_I) { decode_op_I(eip,id_dest,false); } make_DHelper(push_R2s){ // read reg index from opcode then read reg value decode_op_r(eip,id_src,true); } make_DHelper(pop_S2r){ // read reg index from opcode decode_op_r(eip,id_dest,false); } make_DHelper(xor_RM_r){ decode_op_rm(eip,id_dest,true,id_src,true); } void operand_write(Operand *op, rtlreg_t* src) { if (op->type == OP_TYPE_REG) { rtl_sr(op->reg, op->width, src); } else if (op->type == OP_TYPE_MEM) { rtl_sm(&op->addr, op->width, src); } else { assert(0); } }
[ "wind_ns@163.com" ]
wind_ns@163.com
3508565f0a93b462b2e3e89e010f6ea98ab9abbf
3f713aed2756c7b6dc090dc0a69b9d1fd592da12
/src/script/bitcoinconsensus.h
3c4e13a13ab1bb1ba8d6b02d8a7389ff6d4632fe
[ "MIT" ]
permissive
anyagixx/xorx
ba1a64fdf799c2b74a4b35aefa57ab630e8a0e6b
974709b63c6233a37d08f914b723e513e0ef5e44
refs/heads/master
2020-03-27T00:55:44.889288
2019-05-15T09:51:43
2019-05-15T09:51:43
145,667,570
0
0
null
null
null
null
UTF-8
C
false
false
2,257
h
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BITCOINCONSENSUS_H #define BITCOIN_BITCOINCONSENSUS_H #if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H) #include "config/xorx-config.h" #if defined(_WIN32) #if defined(DLL_EXPORT) #if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT) #define EXPORT_SYMBOL __declspec(dllexport) #else #define EXPORT_SYMBOL #endif #endif #elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY) #define EXPORT_SYMBOL __attribute__ ((visibility ("default"))) #endif #elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINCONSENSUS) #define EXPORT_SYMBOL __declspec(dllimport) #endif #ifndef EXPORT_SYMBOL #define EXPORT_SYMBOL #endif #ifdef __cplusplus extern "C" { #endif #define BITCOINCONSENSUS_API_VER 0 typedef enum bitcoinconsensus_error_t { bitcoinconsensus_ERR_OK = 0, bitcoinconsensus_ERR_TX_INDEX, bitcoinconsensus_ERR_TX_SIZE_MISMATCH, bitcoinconsensus_ERR_TX_DESERIALIZE, } bitcoinconsensus_error; /** Script verification flags */ enum { bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance }; /// Returns 1 if the input nIn of the serialized transaction pointed to by /// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under /// the additional constraints specified by flags. /// If not NULL, err will contain an error/success code for the operation EXPORT_SYMBOL int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, const unsigned char *txTo , unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err); EXPORT_SYMBOL unsigned int bitcoinconsensus_version(); #ifdef __cplusplus } // extern "C" #endif #undef EXPORT_SYMBOL #endif // BITCOIN_BITCOINCONSENSUS_H
[ "anyagixx@yandex.ru" ]
anyagixx@yandex.ru
83476e3446f629f0d192f3750d6b6d9943932114
4bb665d20f3e39decf84e08feba5027a67a218f1
/examples/tutorial/custom-object/multi-instance-resources-dynamic/src/test_object.c
4e0ac5a54caf16d7d8ae10de22c3b9e191d22da9
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
tenderitaf/Anjay
ba23179d1a25d3ac8f70199d0015360f15af922b
90390061cbf30fe9b17889bbd1db8c37d98a6eb6
refs/heads/master
2021-01-23T17:55:45.861656
2017-02-22T15:24:52
2017-02-22T15:42:24
null
0
0
null
null
null
null
UTF-8
C
false
false
15,266
c
#include "test_object.h" #include <assert.h> #include <stdlib.h> #include <string.h> #include <avsystem/commons/list.h> typedef struct test_value_instance { anjay_riid_t index; int32_t value; } test_value_instance_t; typedef struct test_instance { anjay_iid_t iid; bool has_label; char label[32]; bool has_values; AVS_LIST(test_value_instance_t) values; } test_instance_t; typedef struct test_object { // handlers const anjay_dm_object_def_t *obj_def; // object state AVS_LIST(test_instance_t) instances; AVS_LIST(test_instance_t) backup_instances; } test_object_t; static test_object_t * get_test_object(const anjay_dm_object_def_t *const *obj) { assert(obj); // use the container_of pattern to retrieve test_object_t pointer // AVS_CONTAINER_OF macro provided by avsystem/commons/defs.h return AVS_CONTAINER_OF(obj, test_object_t, obj_def); } static AVS_LIST(test_instance_t) get_instance(test_object_t *repr, anjay_iid_t iid) { AVS_LIST(test_instance_t) it; AVS_LIST_FOREACH(it, repr->instances) { if (it->iid == iid) { return it; } else if (it->iid > iid) { // Since list of instances is sorted by Instance Id // there is no way to find Instance with given iid. break; } } // Instance was not found. return NULL; } static int assign_new_iid(test_object_t *repr, anjay_iid_t *out_iid) { anjay_iid_t preferred_iid = 0; AVS_LIST(test_instance_t) it; AVS_LIST_FOREACH(it, repr->instances) { if (it->iid == preferred_iid) { ++preferred_iid; } else if (it->iid > preferred_iid) { // found a hole break; } } // all valid Instance Ids are already reserved if (preferred_iid == ANJAY_IID_INVALID) { return -1; } *out_iid = preferred_iid; return 0; } static int test_instance_present(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) { (void) anjay; // unused return get_instance(get_test_object(obj_ptr), iid) != NULL; } static int test_instance_it(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t *out, void **cookie) { (void) anjay; // unused AVS_LIST(test_instance_t) curr = NULL; // if `*cookie == NULL`, then the iteration has just started, // otherwise `*cookie` contains iterator value saved below if (*cookie) { curr = (AVS_LIST(test_instance_t)) (intptr_t) *cookie; // get the next element curr = AVS_LIST_NEXT(curr); } else { // first instance is also a list head curr = get_test_object(obj_ptr)->instances; } if (curr) { *out = curr->iid; } else { // when last element is reached curr is NULL *out = ANJAY_IID_INVALID; } // use `*cookie` to store the iterator *cookie = (void *) (intptr_t) curr; return 0; } static int test_instance_create(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t *inout_iid, anjay_ssid_t ssid) { (void) anjay; // unused (void) ssid; // unused test_object_t *repr = get_test_object(obj_ptr); if (*inout_iid == ANJAY_IID_INVALID) { // Create request did not contain preferred Instance Id, // therefore we assign one on our own if possible if (assign_new_iid(repr, inout_iid)) { // unfortunately assigning new iid failed, nothing // we can do about it return -1; } } AVS_LIST(test_instance_t) new_instance = AVS_LIST_NEW_ELEMENT(test_instance_t); if (!new_instance) { // out of memory return ANJAY_ERR_INTERNAL; } new_instance->iid = *inout_iid; // find a place where instance should be inserted, // insert it and claim a victory AVS_LIST(test_instance_t) *insert_ptr; AVS_LIST_FOREACH_PTR(insert_ptr, &repr->instances) { if ((*insert_ptr)->iid > new_instance->iid) { break; } } AVS_LIST_INSERT(insert_ptr, new_instance); return 0; } static int test_instance_remove(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) { (void) anjay; // unused test_object_t *repr = get_test_object(obj_ptr); AVS_LIST(test_instance_t) *it; AVS_LIST_FOREACH_PTR(it, &repr->instances) { if ((*it)->iid == iid) { AVS_LIST_CLEAR(&(*it)->values); AVS_LIST_DELETE(it); return 0; } } // should never happen as Anjay checks whether instance is present // prior to issuing instance_remove return ANJAY_ERR_INTERNAL; } static int test_instance_reset(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid) { (void) anjay; // unused test_instance_t *instance = get_instance(get_test_object(obj_ptr), iid); // mark all Resource values for Object Instance `iid` as unset instance->has_label = false; instance->has_values = false; AVS_LIST_CLEAR(&instance->values); return 0; } static int test_resource_read(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_output_ctx_t *ctx) { (void) anjay; // unused const test_instance_t *current_instance = (const test_instance_t *) get_instance(get_test_object(obj_ptr), iid); switch (rid) { case 0: return anjay_ret_string(ctx, current_instance->label); case 1: { anjay_output_ctx_t *array_output = anjay_ret_array_start(ctx); if (!array_output) { // cannot instantiate array output context return ANJAY_ERR_INTERNAL; } AVS_LIST(const test_value_instance_t) it; AVS_LIST_FOREACH(it, current_instance->values) { int result = anjay_ret_array_index(array_output, it->index); if (result) { // failed to return an index return result; } result = anjay_ret_i32(array_output, it->value); if (result) { // failed to return value return result; } } return anjay_ret_array_finish(array_output); } default: // control will never reach this part due to object's rid_bound return ANJAY_ERR_INTERNAL; } } static int test_array_write(AVS_LIST(test_value_instance_t) *out_instances, anjay_input_ctx_t *input_array) { int result; test_value_instance_t instance; assert(*out_instances == NULL && "Nonempty list provided"); while ((result = anjay_get_array_index(input_array, &instance.index)) == 0) { if (anjay_get_i32(input_array, &instance.value)) { // An error occurred during the read. result = ANJAY_ERR_INTERNAL; goto failure; } AVS_LIST(test_value_instance_t) *insert_it; // Duplicate detection, and searching for the place to insert // note that it makes the whole function O(n^2). AVS_LIST_FOREACH_PTR(insert_it, out_instances) { if ((*insert_it)->index == instance.index) { // duplicate result = ANJAY_ERR_BAD_REQUEST; goto failure; } else if ((*insert_it)->index > instance.index) { break; } } AVS_LIST(test_value_instance_t) new_element = AVS_LIST_NEW_ELEMENT(test_value_instance_t); if (!new_element) { // out of memory result = ANJAY_ERR_INTERNAL; goto failure; } *new_element = instance; AVS_LIST_INSERT(insert_it, new_element); } if (result && result != ANJAY_GET_INDEX_END) { // malformed request result = ANJAY_ERR_BAD_REQUEST; goto failure; } return 0; failure: AVS_LIST_CLEAR(out_instances); return result; } static int test_resource_write(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr, anjay_iid_t iid, anjay_rid_t rid, anjay_input_ctx_t *ctx) { (void) anjay; // unused test_instance_t *current_instance = (test_instance_t *) get_instance(get_test_object(obj_ptr), iid); switch (rid) { case 0: { // `anjay_get_string` may return a chunk of data instead of the // whole value - we need to make sure the client is able to hold // the entire value char buffer[sizeof(current_instance->label)]; int result = anjay_get_string(ctx, buffer, sizeof(buffer)); if (result == 0) { // value OK - save it memcpy(current_instance->label, buffer, sizeof(buffer)); current_instance->has_label = true; } else if (result == ANJAY_BUFFER_TOO_SHORT) { // the value is too long to store in the buffer result = ANJAY_ERR_BAD_REQUEST; } return result; } case 1: { anjay_input_ctx_t *input_array = anjay_get_array(ctx); if (!input_array) { // could not create input context for some reason return ANJAY_ERR_INTERNAL; } // free memory associated with old values AVS_LIST_CLEAR(&current_instance->values); // try to read new values from an RPC int result = test_array_write(&current_instance->values, input_array); if (!result) { current_instance->has_values = true; } // either test_array_write succeeded and result is 0, or not // in which case result contains appropriate error code. return result; } default: // control will never reach this part due to object's rid_bound return ANJAY_ERR_INTERNAL; } } static void clear_instances(AVS_LIST(test_instance_t) *instances) { AVS_LIST_CLEAR(instances) { AVS_LIST_CLEAR(&(*instances)->values); } } static int clone_instances(AVS_LIST(test_instance_t) *cloned_instances, AVS_LIST(const test_instance_t) instances) { assert(*cloned_instances == NULL); AVS_LIST(test_instance_t) *end_ptr = cloned_instances; AVS_LIST(const test_instance_t) it; AVS_LIST_FOREACH(it, instances) { AVS_LIST(test_instance_t) cloned_instance = AVS_LIST_NEW_ELEMENT(test_instance_t); if (!cloned_instance) { goto failure; } // copy all fields cloned_instance->iid = it->iid; cloned_instance->has_label = it->has_label; memcpy(cloned_instance->label, it->label, sizeof(it->label)); cloned_instance->has_values = it->has_values; cloned_instance->values = AVS_LIST_SIMPLE_CLONE(it->values); if (it->values && !cloned_instance->values) { // cloning failed, probably due to out of memory goto failure; } // everything went just right, append AVS_LIST_INSERT(end_ptr, cloned_instance); // align the end_ptr to point at the next feasible // insertion point end_ptr = AVS_LIST_NEXT_PTR(end_ptr); } return 0; failure: clear_instances(cloned_instances); return -1; } static int test_transaction_begin(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) { (void) anjay; // unused test_object_t *test = get_test_object(obj_ptr); assert(test->backup_instances == NULL); // store a snapshot of object state if (clone_instances(&test->backup_instances, test->instances)) { return ANJAY_ERR_INTERNAL; } return 0; } static int test_transaction_validate(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) { (void) anjay; // unused test_object_t *test = get_test_object(obj_ptr); AVS_LIST(test_instance_t) it; // ensure all Object Instances contain all Mandatory Resources AVS_LIST_FOREACH(it, test->instances) { if (!it->has_label || !it->has_values) { // validation failed: Object state invalid, rollback required return ANJAY_ERR_BAD_REQUEST; } } // validation successful, can commit return 0; } static int test_transaction_commit(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) { (void) anjay; // unused (void) obj_ptr; // unused test_object_t *test = get_test_object(obj_ptr); // we free backup instances now, as current instance set is valid clear_instances(&test->backup_instances); return 0; } static int test_transaction_rollback(anjay_t *anjay, const anjay_dm_object_def_t *const *obj_ptr) { (void) anjay; // unused test_object_t *test = get_test_object(obj_ptr); // restore saved object state clear_instances(&test->instances); test->instances = test->backup_instances; test->backup_instances = NULL; return 0; } static const anjay_dm_object_def_t OBJECT_DEF = { // Object ID .oid = 1234, // Object does not contain any Resources with IDs >= 2 .rid_bound = 2, .instance_it = test_instance_it, .instance_present = test_instance_present, .instance_create = test_instance_create, .instance_remove = test_instance_remove, .instance_reset = test_instance_reset, // if the Object implements all Resources from ID 0 up to its // `rid_bound`, it can use this predefined `resource_supported` handler: .resource_supported = anjay_dm_resource_supported_TRUE, // if all supported Resources are always available, one can use // a pre-implemented `resource_present` handler too: .resource_present = anjay_dm_resource_present_TRUE, .resource_read = test_resource_read, .resource_write = test_resource_write, .transaction_begin = test_transaction_begin, .transaction_validate = test_transaction_validate, .transaction_commit = test_transaction_commit, .transaction_rollback = test_transaction_rollback }; const anjay_dm_object_def_t **create_test_object() { test_object_t *repr = (test_object_t *) calloc(1, sizeof(test_object_t)); if (repr) { repr->obj_def = &OBJECT_DEF; return &repr->obj_def; } return NULL; } void delete_test_object(const anjay_dm_object_def_t **obj) { test_object_t *repr = get_test_object(obj); clear_instances(&repr->instances); clear_instances(&repr->backup_instances); free(repr); }
[ "m.radomski@avsystem.com" ]
m.radomski@avsystem.com
4ec214679351daf30e43438c882178dd83ac70e3
657ad5526b2ee7af2138b079cb151bd2a8deeaca
/20. Enumerators/20210222_12.c
9a338407e75cef847effc669ac639f4a3993126a
[]
no_license
sasho231/Code-Academy
475c8d7b0a8c14fb5738c6119c03482b348f6670
7ba418314e4d5f0ddd0f6e02687dc508a2ffbc7b
refs/heads/main
2023-04-14T10:14:52.490118
2021-04-30T19:22:58
2021-04-30T19:22:58
326,676,283
0
0
null
2021-01-10T15:17:09
2021-01-04T12:26:43
null
UTF-8
C
false
false
895
c
/* Напишете програма, която използва битови полета. Битовите полета да са членове на структура и да са от следните типове: unsigned int и char. Задайте им размер short int 3 бита, char 6 бита. */ #include <stdio.h> #pragma pack(1) struct test{ char character1 : 8; char charc : 8; /* kato zadam 6 ne mi raboti */ unsigned short int number : 3; unsigned short int number1 : 3; }; int main(void){ struct test val; val.number = 7; val.charc = 'c'; printf("Number= %d, character= %c\n", val.number, val.charc); printf("Size of struct= %d\n", sizeof(val)); val.character1 = 'b'; val.number1 = 3; printf("Number= %d, character= %c\n", val.number1, val.character1); printf("Size of struct= %d\n", sizeof(val)); return 0; }
[ "atishevlol@gmail.com" ]
atishevlol@gmail.com
22af5c493c60f171ffe5ac09c112796968e1b01b
6a477e7ebf9b6cd5c89ffeaef2e4cccb1fa5022b
/音视频编解码详解源码/chapter12/MMX/MMX32/Resource.h
84b82f9351051de0b874857cd8b0d357bc70e4dc
[]
no_license
wudping/misc_starting
a86df399bba4c97e77b987c45c20c52397637674
bfed68b25b5751ec4e2c6a146df315e7e136db82
refs/heads/master
2020-04-25T15:05:45.073045
2014-07-29T01:21:04
2014-07-29T01:21:04
null
0
0
null
null
null
null
UTF-8
C
false
false
1,022
h
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by MMX32.rc // #define IDD_ABOUTBOX 100 #define IDP_OLE_INIT_FAILED 100 #define IDR_MAINFRAME 128 #define IDR_MMX32TYPE 129 #define IDB_BITMAP_SAMPLE 130 #define ID_OPERATIONS_GRAYSCALE 32771 #define ID_COLORS_C 32777 #define ID_COLORS_C_MMX 32778 #define ID_COLORS_ASSEMBLY_MMX 32779 #define ID_OPERATIONS_INVERTCOLORS 32780 #define ID_INVERTCOLORS_C 32781 #define ID_INVERTCOLORS_ASSEMBLY_MMX 32783 #define ID_INVERTCOLORS_C_MMX 32786 #define ID_OPERATIONS_RESET 32787 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 32788 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
[ "hiccupzhu@gmail.com" ]
hiccupzhu@gmail.com
712090fbef2a99c4150f4e1d5fb8ca632f9c0a56
c544945251f86a13a86c92be3f4e0dec6151a4c7
/espProto_eclipse/components/utils/include/utils.h
15d563d1699384c036f617e53545f8a24ab48ab6
[]
no_license
winkste/esp32_proto
0f10661980e954381fceda0783f239e72e47077a
73c1b7718231faaf97e98e6e084f968b8e5173d2
refs/heads/master
2021-08-07T13:16:16.105707
2020-05-07T04:36:18
2020-05-07T04:36:18
170,912,915
0
0
null
2020-05-06T03:59:39
2019-02-15T18:51:32
C
UTF-8
C
false
false
9,589
h
/***************************************************************************************** * FILENAME : utils.h * * DESCRIPTION : * Header file for * * Date: 24. January 2019 * * NOTES : * * Copyright (c) [2019] [Stephan Wink] * * 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 vAUTHORS 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 UTILS_H #define UTILS_H /****************************************************************************************/ /* Imported header files: */ #include "stdint.h" #include "stdbool.h" #include "esp_err.h" /****************************************************************************************/ /* Global constant defines: */ /****************************************************************************************/ /* Global function like macro defines (to be avoided): */ #define utils_MIN(x, y) (((x) < (y)) ? (x) : (y)) /****************************************************************************************/ /* Global type definitions (enum (en), struct (st), union (un), typedef (tx): */ /****************************************************************************************/ /* Global function definitions: */ /**--------------------------------------------------------------------------------------- * @brief Copies a float value to a character buffer * @author winkste * @date 20 Okt. 2017 * @param data value as float representation * @param buffer_p pointer to result buffer string * @return pointer to char buffer *//*-----------------------------------------------------------------------------------*/ extern char* utils_FloatToString_chp(float value_f32, char* buffer_chp); /**--------------------------------------------------------------------------------------- * @brief Copies a integer value to decimal representive in a character buffer * @author winkste * @date 20 Okt. 2017 * @param data value as integer representation * @param buffer_p pointer to result buffer string * @return pointer to char buffer *//*-----------------------------------------------------------------------------------*/ extern char* utils_IntegerToDecString_chp(int32_t value_s32, char* buffer_chp); /**--------------------------------------------------------------------------------------- * @brief Copies a integer value to decimal representive in a character buffer * @author winkste * @date 20 Okt. 2017 * @param red_u8 decimal red value * @param green_u8 decimal green value * @param blue_u8 decimal blue value * @param buffer_p pointer to result buffer string * @return pointer to char buffer *//*-----------------------------------------------------------------------------------*/ extern char* utils_RGBToString_chp(uint8_t red_u8, uint8_t green_u8, uint8_t blue_u8, char* pBuffer_p); /**--------------------------------------------------------------------------------------- * @brief This function helps to build the complete topic including the * custom device. * @author winkste * @date 20 Okt. 2017 * @param dev_p pointer to device string * @param channel_p pointer to channel string * @param topic_p pointer to topic string * @param buffer_p pointer to result buffer string * @return combined topic as char pointer, it uses buffer_p to store the topic *//*-----------------------------------------------------------------------------------*/ extern char* utils_BuildSendTopicWChan_chp(const char *dev_p, const char *channel_p, const char *topic_p, char *buffer_p); /**--------------------------------------------------------------------------------------- * @brief This function helps to build the complete topic including the * custom device. * @author winkste * @date 20 Okt. 2017 * @param dev_cchp pointer to device string * @param channel_cchp pointer to channel string * @param topic_cchp pointer to topic string * @param buffer_chp pointer to result buffer string * @return combined topic as char pointer, it uses buffer_p to store the topic *//*-----------------------------------------------------------------------------------*/ extern const char* utils_BuildSendTopic_chp(const char *dev_cchp, const char *channel_cchp, const char *topic_chp, char *buffer_chp); /**--------------------------------------------------------------------------------------- * @brief This function helps to build the complete topic including the * custom device. * @author winkste * @date 20 Okt. 2017 * @param dev_p pointer to device string * @param channel_p pointer to channel string * @param topic_p pointer to topic string * @param buffer_p pointer to result buffer string * @return combined topic as char pointer, it uses buffer_p to store the topic *//*-----------------------------------------------------------------------------------*/ extern char* utils_BuildReceiveTopic_chp(const char *dev_p, const char *channel_p, const char *topic_p, char *buffer_p); /**--------------------------------------------------------------------------------------- * @brief This function helps to build the complete topic for broadcast * subscriptions. * @author winkste * @date 21 May. 2019 * @param topic_p pointer to topic string * @param buffer_p pointer to result buffer string * @return combined topic as char pointer, it uses buffer_p to store the topic *//*-----------------------------------------------------------------------------------*/ extern char* utils_BuildReceiveTopicBCast_chp(const char *topic_p, char *buffer_p); /**--------------------------------------------------------------------------------------- * @brief This function calculates the logarithm digits value (0-1023) based on the * linear input percentage (0-100%). * @author winkste * @date 24 Oct. 2018 * @param percent_u8 percentage value 0-100 * @return N/A *//*-----------------------------------------------------------------------------------*/ extern uint16_t utils_CalcLogDigitsFromPercent_u16(uint8_t percent_u8); /**--------------------------------------------------------------------------------------- * @brief This function calculates the logarithm digits value (0-1023) based on the * linear input percentage (0-100%). * @author winkste * @date 24 Oct. 2018 * @param percent_u8 percentage value 0-100 * @param maxVal_u16 maximum digit value * @return N/A *//*-----------------------------------------------------------------------------------*/ extern uint16_t utils_CalcLogDigitsFromPercentWMax_u16(uint8_t percent_u8, uint16_t maxVal_u16); /**-------------------------------------------------------------------------------------- * @brief Change the state of the internal object based on the wifi state * @author S. Wink * @date 28. Aug. 2019 * @param file_ccp name of the file where the check is executed * @param exeCode_st the returned standard execution code * @param line_u32 the line of code where the execution was done * @return true if error code is ESP_OK, else false *//*-----------------------------------------------------------------------------------*/ extern bool utils_CheckAndLogExecution_bol(const char *file_ccp, esp_err_t exeCode_st, uint32_t line_u32); /**-------------------------------------------------------------------------------------- * @brief Change the state of the internal object based on the wifi state * @author S. Wink * @date 28. Aug. 2019 * @param file_ccp name of the file where the check is executed * @param exeCode_st the returned standard execution code * @param line_u32 the line of code where the execution was done *//*-----------------------------------------------------------------------------------*/ extern void utils_CheckAndLogExecution_vd(const char *file_ccp, esp_err_t exeCode_st, uint32_t line_u32); /****************************************************************************************/ /* Global data definitions: */ #endif
[ "stephan_wink@web.de" ]
stephan_wink@web.de
88d56ec9ce9fd10af59271de1ba5836576108d80
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/net/tcpip/tpipv6/tcpip6/inc/select.h
6009fe2f75725b89998b70e84312776275090712
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C
false
false
1,925
h
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs) // // Copyright (c) 2000 Microsoft Corporation // // This file is part of the Microsoft Research IPv6 Network Protocol Stack. // You should have received a copy of the Microsoft End-User License Agreement // for this software along with this release; see the file "license.txt". // If not, please see http://www.research.microsoft.com/msripv6/license.htm, // or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399. // // Abstract: // // Declarations and definitions for source address selection // and destination address ordering. // #ifndef SELECT_INCLUDED #define SELECT_INCLUDED 1 #include <tdi.h> extern void InitSelect(void); extern void UnloadSelect(void); typedef struct PrefixPolicyEntry { struct PrefixPolicyEntry *Next; IPv6Addr Prefix; uint PrefixLength; uint Precedence; uint SrcLabel; uint DstLabel; } PrefixPolicyEntry; // // SelectLock protects PrefixPolicyTable. // extern KSPIN_LOCK SelectLock; extern PrefixPolicyEntry *PrefixPolicyTable; extern void PrefixPolicyReset(void); extern void PrefixPolicyUpdate(const IPv6Addr *PolicyPrefix, uint PrefixLength, uint Precedence, uint SrcLabel, uint DstLabel); extern void PrefixPolicyDelete(const IPv6Addr *PolicyPrefix, uint PrefixLength); extern void PrefixPolicyLookup(const IPv6Addr *Addr, uint *Precedence, uint *SrcLabel, uint *DstLabel); extern NetTableEntry * FindBestSourceAddress(Interface *IF, const IPv6Addr *Dest); extern void ProcessSiteLocalAddresses(TDI_ADDRESS_IP6 *Addrs, uint *Key, uint *pNumAddrs); extern void SortDestAddresses(const TDI_ADDRESS_IP6 *Addrs, uint *Key, uint NumAddrs); #endif // SELECT_INCLUDED
[ "seta7D5@protonmail.com" ]
seta7D5@protonmail.com
bd058abe42e9ea76f63813b811ce642089363cc9
52bdd009ff67930af683477a69915b0c72f1be69
/网络编程功能实现/tcp_带外数据/s_TCP带外数据_服务器.c
44bbae2e29837eed3d99a525e975d408ffbad940
[]
no_license
code-159/code-string
5a77501d87bde489d21f263dd3c04e4e45c56626
a7725774ce5ad0a3991445a3ba1c06429eb0c6af
refs/heads/master
2021-01-26T01:26:38.210856
2020-03-26T09:32:37
2020-03-26T09:32:37
243,257,017
4
0
null
2020-02-26T12:44:29
2020-02-26T12:27:18
C
UTF-8
C
false
false
3,552
c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/time.h> #include <signal.h> #include <assert.h> int g_temp_fd1 = -1; int g_client_fd = -1; // 如果收到带外数据,进程就会收到SIGURG信号,表示收到了带外数据,所有该函数应该接收带外数据 void handler(int signo) { char rbuffer[100] = {0}; int ret = recv(g_client_fd, rbuffer, sizeof(rbuffer), MSG_OOB); printf("收到 【%d】 字节,rbuffer = %s\n", ret, rbuffer); printf("收到了信号:%d\n", signo); return; } // 任意信号捕捉 void addsig(int sig, void (*handler)(int) ) { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = handler; // 设置如果收到了SIGALRM信号,就执行handler函数 act.sa_flags |= SA_RESTART; // 被信号中断的系统调用自动启动 sigfillset(&act.sa_mask); // 设置全部信号为进程信号的掩码 assert(sigaction(sig, &act, NULL) != -1); // 信号处理 // 其作用是如果它的条件返回错误,则终止程序执行 } int main(void) { int listen_fd = -1; pthread_t tid = 0; char rbuff[100] = {0}; int ret = -1; struct sockaddr_in my_addr; // 绑定本机的IP和端口 struct sockaddr_in src_addr; // 存放客户端的IP地址 // 1.创建套接字 AF_INET 和 PF_INET 是一样的 listen_fd = socket(AF_INET, SOCK_STREAM, 0); if(listen_fd < 0) { printf("socket create fail!\n"); return -1; } //2.设置(初始化)本机的IP和端口、协议 memset(&my_addr, 0, sizeof(my_addr)); my_addr.sin_family = AF_INET; /*协议地址*/ my_addr.sin_port = htons(50004); /*将端口号转换为网络字节序*/ my_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); /* 绑定的本机IP,0.0.0.0代表本机所有IP INADDR_ANY 代表本机所有IP*/ // 设置端口允许重复绑定 int opt = 0; // sockfd为需要端口复用的套接字 setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&opt, sizeof(opt)); // 3.绑定本机端口和IP地址、协议 int status = bind (listen_fd, (struct sockaddr *) &my_addr, sizeof(my_addr)); // 判断绑定是否成功 if(status < 0) { perror("band"); return -2; } printf("绑定成功\n"); // 4. 设置监听 DDOS listen(listen_fd, 5); // 同时可以接收5个连接请求 socklen_t addrlen = sizeof(src_addr); //5.开始监听,等待客户端链接 阻塞函数 memset(&src_addr, 0, sizeof(src_addr)); g_client_fd = accept(listen_fd, (struct sockaddr *)&src_addr, &addrlen); if(g_client_fd < 0) { perror("accept"); return -2; } printf("客户端连接成功\n"); printf("客户端的地址:%s\n", inet_ntoa(src_addr.sin_addr)); printf("客户端的端口:%d\n", ntohs(src_addr.sin_port)); addsig(SIGURG, handler); // 调用函数,将SIGURG信号加入捕获,如果收到了SIGURG信号,就会执行handler // 前提条件是进程号必须拿到接收数据的文件描述符 fcntl(g_client_fd, F_SETOWN, getpid()); while(1) { ret = recv(g_client_fd, rbuff, sizeof(rbuff), 0); printf("recv接收了%d字节\n", ret); printf("rbuff = %s\n", rbuff); if(ret <= 0) { printf("客户端已退出!\n"); break; } } close(listen_fd); //close(g_temp_fd); return 0; }
[ "noreply@github.com" ]
code-159.noreply@github.com
44a8908c8f1ea80f3620821a1be41df0396de38d
8fe07cf177969a9d1b43f1c462ba5e3007259de6
/ABC4/ch08/exer_16.c
a951833a6c4a560c501b0abee0a7014a4ddd8b31
[ "BSD-2-Clause" ]
permissive
ethanqtle/C_4_Everyone_Fund
2504e0f546b13250a1c406c439ec96a8a3fac6a7
4f5fca4493b25d7ebaed430fb1147024c4e6eb1f
refs/heads/main
2023-02-17T04:05:42.643409
2021-01-18T04:11:43
2021-01-18T04:11:43
328,441,639
0
0
null
null
null
null
UTF-8
C
false
false
113
c
#define NDEBUG #include <assert.h> int main(void) { int a = 1, b = 2; assert(a > b); return 0; }
[ "ethanqtle@gmail.com" ]
ethanqtle@gmail.com
f725fea967f61d1bf6aa3a0f25c465f8f05d8d67
1d6e402d3a74a547271655f9e46a7a47dd780d18
/day09/ex07/main.c
365714085436ec0e7cdc2f99b69174056ec23da6
[]
no_license
gyesayan/42_piscine
211a98c0af85dc102f245fa2b19c1860c00d6b92
7004f0b453633a829edda7a5fa7c6d0dfa749dd5
refs/heads/master
2022-04-01T12:20:35.644659
2020-02-08T16:47:40
2020-02-08T16:47:40
null
0
0
null
null
null
null
UTF-8
C
false
false
147
c
#include <stdio.h> unsigned int ft_collatz_conjecture(unsigned int base); int main() { printf("%u\n", ft_collatz_conjecture(9232)); return 0; }
[ "rariosa-@e1z1r6p18.42.us.org" ]
rariosa-@e1z1r6p18.42.us.org
c73fc14e1800db40d9ca1d830e6ceb7080e97144
7a8d4dc069fa23a5bfb731bca982f750c7c7f224
/Devices/Wemos/MQTTMini/menu.h
1552f40a3759a3e80677082692acb11c2bb2fce0
[]
no_license
CrazyRobMiles/AirQuality
83f28fbc6045c944aa6285d88f55f74f5849eb9f
f6a4a7075dac8887beab3450bea3d54034ec6b1f
refs/heads/master
2021-06-25T00:06:12.451471
2019-07-04T15:09:13
2019-07-04T15:09:13
142,553,566
8
1
null
2018-12-19T18:05:23
2018-07-27T08:58:09
Makefile
UTF-8
C
false
false
288
h
#pragma once void start_action(String title, String text) { Serial.print(title); Serial.print(" "); Serial.println(text); } void update_action(String title, String text) { Serial.print(title); Serial.print(" "); Serial.println(text); } void end_action() { TRACE("End action"); }
[ "rob@robmiles.com" ]
rob@robmiles.com
0f3bf28cb108560e7635ed986158a82cc3a4dd35
7812bdc391a6f863339da5069d93cd2f22e46174
/sdc_test/inc/gmac.h
159dfc43750d34f24511efcb5e20c44b5b258946
[]
no_license
QZehao/rtl8189
11f0a17854db59cdb30b9e763c7324dfdc31c7cb
51a6b8ab47ff1121513e55629d46b67b4b8ec4ea
refs/heads/master
2023-03-17T17:13:31.792782
2014-10-21T01:05:55
2014-10-21T01:05:55
null
0
0
null
null
null
null
UTF-8
C
false
false
1,527
h
#ifndef GMAC_H_ #define GMAC_H_ #include "chip.h" #include "chip_reg.h" #include "pre_define.h" #include "gmac_phyt.h" #include "gmac_dma.h" //#define MULT_DESC enum { gmac_gmii_clock_60_100, gmac_gmii_clock_100_150, gmac_gmii_clock_20_35, gmac_gmii_clock_35_60, gmac_gmii_clock_150_250, gmac_gmii_clock_250_300 }; enum { gmac_interrupt_all = 0x0001ffff, gmac_interrupt_none = 0x0 }; #pragma pack(1) //gmac would insert preamble, pad bytes, sfd & crc typedef struct Gmac_Frame { //preamble //start frame delimiter UINT8 des_address[6]; UINT8 src_address[6]; UINT16 length_type; UINT8* data; //pointer to data, 46~1500 bytes //padding bytes //crc }Gmac_Frame; #ifdef MULT_DESC typedef struct Gmac_Object { UINT8 local_mac_address[6]; int full_duplex; //read only int speed_100m; //read only volatile Gmac_Rx_DMA_Descriptors* rx_dma_descriptors0; volatile Gmac_Rx_DMA_Descriptors* rx_dma_descriptors1; volatile Gmac_Tx_DMA_Descriptors* tx_dma_descriptors; }Gmac_Object; #else typedef struct Gmac_Object { UINT8 local_mac_address[6]; int full_duplex; //read only int speed_100m; //read only volatile Gmac_Rx_DMA_Descriptors* rx_dma_descriptors; volatile Gmac_Tx_DMA_Descriptors* tx_dma_descriptors; }Gmac_Object; #endif #pragma pack() //Gmac_Frame* frame_array[8]; void GMAC_Init(Gmac_Object* gmac_obj); //void GMAC_StartReceiving(Gmac_Frame* frame); void GMAC_SendOneFrame(Gmac_Frame* frame, int size); void GMAC_ReceiveOneFrame(volatile Gmac_Frame* frame); #endif /*GMAC_H_*/
[ "356636122@qq.com" ]
356636122@qq.com
fdeabbd4b8d56738cf649b4723f79482aa5487b9
3827f9fa0b0603e8534c4cc867dcb9fbe4f9b082
/QeoRasPi/QtTestPi1/dds/dds_dcps.h
fd2b87a85f7a72f28e85c3b2c6d09a66b8f353cc
[]
no_license
vas85/QeoProject
52111875404c794f1da2f30887da013838c4ac72
1e843bb79aa4dc40b9bd0e19d5100148abf95452
refs/heads/master
2021-01-01T16:00:36.678179
2013-12-09T01:09:24
2013-12-09T01:09:24
null
0
0
null
null
null
null
UTF-8
C
false
false
64,411
h
/************* COPYRIGHT AND CONFIDENTIALITY INFORMATION ********************* ** ** ** Copyright (c) 2010 Technicolor ** ** All Rights Reserved ** ** ** ** This program contains proprietary information which is a trade ** ** secret of TECHNICOLOR and/or its affiliates and also is protected as ** ** an unpublished work under applicable Copyright laws. Recipient is ** ** to retain this program in confidence and is not permitted to use or ** ** make copies thereof other than as permitted in a written agreement ** ** with TECHNICOLOR, UNLESS OTHERWISE EXPRESSLY ALLOWED BY APPLICABLE LAWS. ** ** ** ******************************************************************************/ #ifndef DDS_DCPS_H_ #define DDS_DCPS_H_ #include <stdint.h> #include "dds/dds_types.h" #include "dds/dds_tsm.h" #ifdef __cplusplus extern "C" { #endif /* === Generic ============================================================== */ typedef enum { DDS_INCONSISTENT_TOPIC_STATUS = (0x00000001UL << 0), DDS_OFFERED_DEADLINE_MISSED_STATUS = (0x00000001UL << 1), DDS_REQUESTED_DEADLINE_MISSED_STATUS = (0x00000001UL << 2), DDS_OFFERED_INCOMPATIBLE_QOS_STATUS = (0x00000001UL << 5), DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS = (0x00000001UL << 6), DDS_SAMPLE_LOST_STATUS = (0x00000001UL << 7), DDS_SAMPLE_REJECTED_STATUS = (0x00000001UL << 8), DDS_DATA_ON_READERS_STATUS = (0x00000001UL << 9), DDS_DATA_AVAILABLE_STATUS = (0x00000001UL << 10), DDS_LIVELINESS_LOST_STATUS = (0x00000001UL << 11), DDS_LIVELINESS_CHANGED_STATUS = (0x00000001UL << 12), DDS_PUBLICATION_MATCHED_STATUS = (0x00000001UL << 13), DDS_SUBSCRIPTION_MATCHED_STATUS = (0x00000001UL << 14) } DDS_StatusMask; #define DDS_ALL_STATUS 0x0000ffffU typedef unsigned DDS_DomainId_t; typedef DDS_HANDLE DDS_InstanceHandle_t; typedef uint32_t DDS_SampleStateKind; #define DDS_READ_SAMPLE_STATE (0x00000001U << 0) #define DDS_NOT_READ_SAMPLE_STATE (0x00000001U << 1) typedef uint32_t DDS_SampleStateMask; #define DDS_ANY_SAMPLE_STATE 0x0000ffffU typedef uint32_t DDS_ViewStateKind; #define DDS_NEW_VIEW_STATE (0x00000001U << 0) #define DDS_NOT_NEW_VIEW_STATE (0x00000001U << 1) typedef uint32_t DDS_ViewStateMask; #define DDS_ANY_VIEW_STATE 0x0000ffffU typedef uint32_t DDS_InstanceStateKind; #define DDS_ALIVE_INSTANCE_STATE (0x00000001U << 0) #define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE (0x00000001U << 1) #define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE (0x00000001U << 2) typedef uint32_t DDS_InstanceStateMask; #define DDS_ANY_INSTANCE_STATE 0x0000ffffU #define DDS_NOT_ALIVE_INSTANCE_STATE 0x00000006U /* === Generic types ======================================================== */ typedef struct { int sec; unsigned nanosec; } DDS_Duration_t; #define DDS_DURATION_INFINITE_SEC 0x7fffffff #define DDS_DURATION_INFINITE_NSEC 0x7fffffffU #define DDS_DURATION_ZERO_SEC 0L #define DDS_DURATION_ZERO_NSEC 0UL typedef struct { int sec; unsigned nanosec; } DDS_Time_t; #define DDS_TIME_INVALID_SEC -1L #define DDS_TIME_INVALID_NSEC 0xffffffffU typedef struct { DDS_SampleStateKind sample_state; DDS_ViewStateKind view_state; DDS_InstanceStateKind instance_state; DDS_Time_t source_timestamp; DDS_InstanceHandle_t instance_handle; DDS_InstanceHandle_t publication_handle; int disposed_generation_count; int no_writers_generation_count; int sample_rank; int generation_rank; int absolute_generation_rank; int valid_data; } DDS_SampleInfo; #define DDS_LENGTH_UNLIMITED -1 /* === Standard DDS objects ================================================= */ typedef struct DDS_DomainParticipant_st *DDS_DomainParticipant; typedef struct DDS_Listener_st *DDS_Listener; typedef void *DDS_Entity; typedef struct DDS_TopicDescription_st *DDS_TopicDescription; typedef struct DDS_Topic_st *DDS_Topic; typedef struct DDS_ContentFilteredTopic_st *DDS_ContentFilteredTopic; typedef struct DDS_MultiTopic_st *DDS_MultiTopic; typedef struct DDS_DataWriter_st *DDS_DataWriter; typedef struct DDS_DataReader_st *DDS_DataReader; typedef struct DDS_Subscriber_st *DDS_Subscriber; typedef struct DDS_Publisher_st *DDS_Publisher; typedef struct DDS_WaitSet_st *DDS_WaitSet; typedef void *DDS_Condition; typedef struct DDS_StatusCondition_st *DDS_StatusCondition; typedef struct DDS_ReadCondition_st *DDS_ReadCondition; typedef struct DDS_QueryCondition_st *DDS_QueryCondition; typedef struct DDS_GuardCondition_st *DDS_GuardCondition; DDS_SEQUENCE(unsigned char, DDS_OctetSeq); DDS_EXPORT DDS_OctetSeq *DDS_OctetSeq__alloc (void); DDS_EXPORT void DDS_OctetSeq__free (DDS_OctetSeq *octets); DDS_EXPORT void DDS_OctetSeq__init (DDS_OctetSeq *octets); DDS_EXPORT void DDS_OctetSeq__clear (DDS_OctetSeq *octets); DDS_SEQUENCE(char*, DDS_StringSeq); DDS_EXPORT DDS_StringSeq *DDS_StringSeq__alloc (void); DDS_EXPORT void DDS_StringSeq__free (DDS_StringSeq *strings); DDS_EXPORT void DDS_StringSeq__init (DDS_StringSeq *strings); DDS_EXPORT void DDS_StringSeq__clear (DDS_StringSeq *strings); DDS_SEQUENCE(void *, DDS_DataSeq); DDS_EXPORT DDS_DataSeq *DDS_DataSeq__alloc (void); DDS_EXPORT void DDS_DataSeq__free (DDS_DataSeq *data); DDS_EXPORT void DDS_DataSeq__init (DDS_DataSeq *data); DDS_EXPORT void DDS_DataSeq__clear (DDS_DataSeq *data); DDS_SEQUENCE(DDS_SampleInfo*, DDS_SampleInfoSeq); DDS_EXPORT DDS_SampleInfoSeq *DDS_SampleInfoSeq__alloc (void); DDS_EXPORT void DDS_SampleInfoSeq__free (DDS_SampleInfoSeq *samples); DDS_EXPORT void DDS_SampleInfoSeq__init (DDS_SampleInfoSeq *samples); DDS_EXPORT void DDS_SampleInfoSeq__clear (DDS_SampleInfoSeq *samples); DDS_SEQUENCE(DDS_InstanceHandle_t, DDS_InstanceHandleSeq); DDS_EXPORT DDS_InstanceHandleSeq *DDS_InstanceHandleSeq__alloc (void); DDS_EXPORT void DDS_InstanceHandleSeq__free (DDS_InstanceHandleSeq *handles); DDS_EXPORT void DDS_InstanceHandleSeq__init (DDS_InstanceHandleSeq *handles); DDS_EXPORT void DDS_InstanceHandleSeq__clear (DDS_InstanceHandleSeq *handles); DDS_SEQUENCE(DDS_DataReader, DDS_DataReaderSeq); DDS_EXPORT DDS_DataReaderSeq *DDS_DataReaderSeq__alloc (void); DDS_EXPORT void DDS_DataReaderSeq__free (DDS_DataReaderSeq *readers); DDS_EXPORT void DDS_DataReaderSeq__init (DDS_DataReaderSeq *readers); DDS_EXPORT void DDS_DataReaderSeq__clear (DDS_DataReaderSeq *readers); /* === Generic QoS (alphabetic) ============================================= */ /* QoS policy names: */ #define DDS_USERDATA_QOS_POLICY_NAME "UserData" #define DDS_DURABILITY_QOS_POLICY_NAME "Durability" #define DDS_PRESENTATION_QOS_POLICY_NAME "Presentation" #define DDS_DEADLINE_QOS_POLICY_NAME "Deadline" #define DDS_LATENCYBUDGET_QOS_POLICY_NAME "LatencyBudget" #define DDS_OWNERSHIP_QOS_POLICY_NAME "Ownership" #define DDS_OWNERSHIPSTRENGTH_QOS_POLICY_NAME "OwnershipStrength" #define DDS_LIVELINESS_QOS_POLICY_NAME "Liveliness" #define DDS_TIMEBASEDFILTER_QOS_POLICY_NAME "TimeBasedFilter" #define DDS_PARTITION_QOS_POLICY_NAME "Partition" #define DDS_RELIABILITY_QOS_POLICY_NAME "Reliability" #define DDS_DESTINATIONORDER_QOS_POLICY_NAME "DestinationOrder" #define DDS_HISTORY_QOS_POLICY_NAME "History" #define DDS_RESOURCELIMITS_QOS_POLICY_NAME "ResourceLimits" #define DDS_ENTITYFACTORY_QOS_POLICY_NAME "EntityFactory" #define DDS_WRITERDATALIFECYCLE_QOS_POLICY_NAME "WriterDataLifecycle" #define DDS_READERDATALIFECYCLE_QOS_POLICY_NAME "ReaderDataLifecycle" #define DDS_TOPICDATA_QOS_POLICY_NAME "TopicData" #define DDS_GROUPDATA_QOS_POLICY_NAME "GroupData" #define DDS_TRANSPORTPRIORITY_QOS_POLICY_NAME "TransportPriority" #define DDS_LIFESPAN_QOS_POLICY_NAME "Lifespan" #define DDS_DURABILITYSERVICE_POLICY_NAME "DurabilityService" /* QoS policy ids: */ typedef enum { DDS_INVALID_QOS_POLICY_ID, DDS_USERDATA_QOS_POLICY_ID, DDS_DURABILITY_QOS_POLICY_ID, DDS_PRESENTATION_QOS_POLICY_ID, DDS_DEADLINE_QOS_POLICY_ID, DDS_LATENCYBUDGET_QOS_POLICY_ID, DDS_OWNERSHIP_QOS_POLICY_ID, DDS_OWNERSHIPSTRENGTH_QOS_POLICY_ID, DDS_LIVELINESS_QOS_POLICY_ID, DDS_TIMEBASEDFILTER_QOS_POLICY_ID, DDS_PARTITION_QOS_POLICY_ID, DDS_RELIABILITY_QOS_POLICY_ID, DDS_DESTINATIONORDER_QOS_POLICY_ID, DDS_HISTORY_QOS_POLICY_ID, DDS_RESOURCELIMITS_QOS_POLICY_ID, DDS_ENTITYFACTORY_QOS_POLICY_ID, DDS_WRITERDATALIFECYCLE_QOS_POLICY_ID, DDS_READERDATALIFECYCLE_QOS_POLICY_ID, DDS_TOPICDATA_QOS_POLICY_ID, DDS_GROUPDATA_QOS_POLICY_ID, DDS_TRANSPORTPRIORITY_QOS_POLICY_ID, DDS_LIFESPAN_QOS_POLICY_ID, DDS_DURABILITYSERVICE_QOS_POLICY_ID } DDS_QOS_POLICY_ID; typedef enum { DDS_BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS, DDS_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS } DDS_DestinationOrderQosPolicyKind; typedef enum { DDS_VOLATILE_DURABILITY_QOS, DDS_TRANSIENT_LOCAL_DURABILITY_QOS, DDS_TRANSIENT_DURABILITY_QOS, DDS_PERSISTENT_DURABILITY_QOS } DDS_DurabilityQosPolicyKind; typedef enum { DDS_KEEP_LAST_HISTORY_QOS, DDS_KEEP_ALL_HISTORY_QOS } DDS_HistoryQosPolicyKind; typedef enum { DDS_AUTOMATIC_LIVELINESS_QOS, DDS_MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, DDS_MANUAL_BY_TOPIC_LIVELINESS_QOS } DDS_LivelinessQosPolicyKind; typedef enum { DDS_SHARED_OWNERSHIP_QOS, DDS_EXCLUSIVE_OWNERSHIP_QOS } DDS_OwnershipQosPolicyKind; typedef enum { DDS_INSTANCE_PRESENTATION_QOS, DDS_TOPIC_PRESENTATION_QOS, DDS_GROUP_PRESENTATION_QOS } DDS_PresentationQosPolicyAccessScopeKind; typedef enum { DDS_BEST_EFFORT_RELIABILITY_QOS, DDS_RELIABLE_RELIABILITY_QOS } DDS_ReliabilityQosPolicyKind; typedef struct { DDS_Duration_t service_cleanup_delay; DDS_HistoryQosPolicyKind history_kind; int history_depth; int max_samples; int max_instances; int max_samples_per_instance; } DDS_DurabilityServiceQosPolicy; typedef struct { DDS_Duration_t period; } DDS_DeadlineQosPolicy; typedef struct { DDS_DestinationOrderQosPolicyKind kind; } DDS_DestinationOrderQosPolicy; typedef struct { DDS_DurabilityQosPolicyKind kind; } DDS_DurabilityQosPolicy; typedef struct { int autoenable_created_entities; } DDS_EntityFactoryQosPolicy; typedef struct { DDS_OctetSeq value; } DDS_GroupDataQosPolicy; DDS_EXPORT DDS_GroupDataQosPolicy *DDS_GroupDataQosPolicy__alloc (void); DDS_EXPORT void DDS_GroupDataQosPolicy__free (DDS_GroupDataQosPolicy *data); DDS_EXPORT void DDS_GroupDataQosPolicy__init (DDS_GroupDataQosPolicy *data); DDS_EXPORT void DDS_GroupDataQosPolicy__clear (DDS_GroupDataQosPolicy *data); typedef struct { DDS_HistoryQosPolicyKind kind; int depth; } DDS_HistoryQosPolicy; typedef struct { DDS_Duration_t duration; } DDS_LatencyBudgetQosPolicy; typedef struct { DDS_Duration_t duration; } DDS_LifespanQosPolicy; typedef struct { DDS_LivelinessQosPolicyKind kind; DDS_Duration_t lease_duration; } DDS_LivelinessQosPolicy; typedef struct { DDS_OwnershipQosPolicyKind kind; } DDS_OwnershipQosPolicy; typedef struct { int value; } DDS_OwnershipStrengthQosPolicy; typedef struct { DDS_StringSeq name; } DDS_PartitionQosPolicy; DDS_EXPORT DDS_PartitionQosPolicy *DDS_PartitionQosPolicy__alloc (void); DDS_EXPORT void DDS_PartitionQosPolicy__free (DDS_PartitionQosPolicy *part); DDS_EXPORT void DDS_PartitionQosPolicy__init (DDS_PartitionQosPolicy *part); DDS_EXPORT void DDS_PartitionQosPolicy__clear (DDS_PartitionQosPolicy *part); typedef struct { DDS_PresentationQosPolicyAccessScopeKind access_scope; int coherent_access; int ordered_access; } DDS_PresentationQosPolicy; typedef struct { DDS_Duration_t autopurge_nowriter_samples_delay; DDS_Duration_t autopurge_disposed_samples_delay; } DDS_ReaderDataLifecycleQosPolicy; typedef struct { DDS_ReliabilityQosPolicyKind kind; DDS_Duration_t max_blocking_time; } DDS_ReliabilityQosPolicy; typedef struct { int max_samples; int max_instances; int max_samples_per_instance; } DDS_ResourceLimitsQosPolicy; typedef struct { DDS_Duration_t minimum_separation; } DDS_TimeBasedFilterQosPolicy; typedef struct { DDS_OctetSeq value; } DDS_TopicDataQosPolicy; DDS_EXPORT DDS_TopicDataQosPolicy *DDS_TopicDataQosPolicy__alloc (void); DDS_EXPORT void DDS_TopicDataQosPolicy__free (DDS_TopicDataQosPolicy *data); DDS_EXPORT void DDS_TopicDataQosPolicy__init (DDS_TopicDataQosPolicy *data); DDS_EXPORT void DDS_TopicDataQosPolicy__clear (DDS_TopicDataQosPolicy *data); typedef struct { int value; } DDS_TransportPriorityQosPolicy; typedef struct { DDS_OctetSeq value; } DDS_UserDataQosPolicy; DDS_EXPORT DDS_UserDataQosPolicy *DDS_UserDataQosPolicy__alloc (void); DDS_EXPORT void DDS_UserDataQosPolicy__free (DDS_UserDataQosPolicy *data); DDS_EXPORT void DDS_UserDataQosPolicy__init (DDS_UserDataQosPolicy *data); DDS_EXPORT void DDS_UserDataQosPolicy__clear (DDS_UserDataQosPolicy *data); typedef struct { int autodispose_unregistered_instances; } DDS_WriterDataLifecycleQosPolicy; typedef int DDS_QosPolicyId_t; DDS_EXPORT const char *DDS_qos_policy (DDS_QosPolicyId_t id); typedef struct { DDS_QosPolicyId_t policy_id; int count; } DDS_QosPolicyCount; DDS_SEQUENCE(DDS_QosPolicyCount, DDS_QosPolicyCountSeq); /* === Builtin Topics ======================================================= */ typedef struct { DDS_BUILTIN_TOPIC_TYPE value [3]; } DDS_BuiltinTopicKey_t; typedef struct { DDS_BuiltinTopicKey_t key; DDS_UserDataQosPolicy user_data; } DDS_ParticipantBuiltinTopicData; DDS_EXPORT DDS_ParticipantBuiltinTopicData *DDS_ParticipantBuiltinTopicData__alloc (void); DDS_EXPORT void DDS_ParticipantBuiltinTopicData__free (DDS_ParticipantBuiltinTopicData *data); DDS_EXPORT void DDS_ParticipantBuiltinTopicData__init (DDS_ParticipantBuiltinTopicData *data); DDS_EXPORT void DDS_ParticipantBuiltinTopicData__clear (DDS_ParticipantBuiltinTopicData *data); typedef struct { DDS_BuiltinTopicKey_t key; char *name; char *type_name; DDS_DurabilityQosPolicy durability; DDS_DurabilityServiceQosPolicy durability_service; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_TransportPriorityQosPolicy transport_priority; DDS_LifespanQosPolicy lifespan; DDS_DestinationOrderQosPolicy destination_order; DDS_HistoryQosPolicy history; DDS_ResourceLimitsQosPolicy resource_limits; DDS_OwnershipQosPolicy ownership; DDS_TopicDataQosPolicy topic_data; } DDS_TopicBuiltinTopicData; DDS_EXPORT DDS_TopicBuiltinTopicData *DDS_TopicBuiltinTopicData__alloc (void); DDS_EXPORT void DDS_TopicBuiltinTopicData__free (DDS_TopicBuiltinTopicData *data); DDS_EXPORT void DDS_TopicBuiltinTopicData__init (DDS_TopicBuiltinTopicData *data); DDS_EXPORT void DDS_TopicBuiltinTopicData__clear (DDS_TopicBuiltinTopicData *data); typedef struct { DDS_BuiltinTopicKey_t key; DDS_BuiltinTopicKey_t participant_key; char *topic_name; char *type_name; DDS_DurabilityQosPolicy durability; DDS_DurabilityServiceQosPolicy durability_service; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_LifespanQosPolicy lifespan; DDS_UserDataQosPolicy user_data; DDS_OwnershipQosPolicy ownership; DDS_OwnershipStrengthQosPolicy ownership_strength; DDS_DestinationOrderQosPolicy destination_order; DDS_PresentationQosPolicy presentation; DDS_PartitionQosPolicy partition; DDS_TopicDataQosPolicy topic_data; DDS_GroupDataQosPolicy group_data; } DDS_PublicationBuiltinTopicData; DDS_EXPORT DDS_PublicationBuiltinTopicData *DDS_PublicationBuiltinTopicData__alloc (void); DDS_EXPORT void DDS_PublicationBuiltinTopicData__free (DDS_PublicationBuiltinTopicData *data); DDS_EXPORT void DDS_PublicationBuiltinTopicData__init (DDS_PublicationBuiltinTopicData *data); DDS_EXPORT void DDS_PublicationBuiltinTopicData__clear (DDS_PublicationBuiltinTopicData *data); typedef struct { DDS_BuiltinTopicKey_t key; DDS_BuiltinTopicKey_t participant_key; char *topic_name; char *type_name; DDS_DurabilityQosPolicy durability; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_OwnershipQosPolicy ownership; DDS_DestinationOrderQosPolicy destination_order; DDS_UserDataQosPolicy user_data; DDS_TimeBasedFilterQosPolicy time_based_filter; DDS_PresentationQosPolicy presentation; DDS_PartitionQosPolicy partition; DDS_TopicDataQosPolicy topic_data; DDS_GroupDataQosPolicy group_data; } DDS_SubscriptionBuiltinTopicData; DDS_EXPORT DDS_SubscriptionBuiltinTopicData *DDS_SubscriptionBuiltinTopicData__alloc (void); DDS_EXPORT void DDS_SubscriptionBuiltinTopicData__free (DDS_SubscriptionBuiltinTopicData *data); DDS_EXPORT void DDS_SubscriptionBuiltinTopicData__init (DDS_SubscriptionBuiltinTopicData *data); DDS_EXPORT void DDS_SubscriptionBuiltinTopicData__clear (DDS_SubscriptionBuiltinTopicData *data); /* === DomainParticipantFactory ============================================= */ typedef struct { DDS_EntityFactoryQosPolicy entity_factory; } DDS_DomainParticipantFactoryQos; /* === DomainParticipant ==================================================== */ typedef struct { DDS_UserDataQosPolicy user_data; DDS_EntityFactoryQosPolicy entity_factory; } DDS_DomainParticipantQos; #define DDS_PARTICIPANT_QOS_DEFAULT NULL DDS_EXPORT DDS_DomainParticipantQos *DDS_DomainParticipantQos__alloc (void); DDS_EXPORT void DDS_DomainParticipantQos__free (DDS_DomainParticipantQos *qos); DDS_EXPORT void DDS_DomainParticipantQos__init (DDS_DomainParticipantQos *qos); DDS_EXPORT void DDS_DomainParticipantQos__clear (DDS_DomainParticipantQos *qos); /* === DomainParticipantListener ============================================ */ typedef struct { int total_count; int total_count_change; } DDS_InconsistentTopicStatus; typedef enum { DDS_NOT_REJECTED, DDS_REJECTED_BY_INSTANCES_LIMIT, DDS_REJECTED_BY_SAMPLES_LIMIT, DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT } DDS_SampleRejectedStatusKind; typedef struct { int total_count; int total_count_change; DDS_SampleRejectedStatusKind last_reason; DDS_InstanceHandle_t last_instance_handle; } DDS_SampleRejectedStatus; typedef struct { int total_count; int total_count_change; DDS_QosPolicyId_t last_policy_id; DDS_QosPolicyCountSeq policies; } DDS_IncompatibleQosStatus; typedef DDS_IncompatibleQosStatus DDS_RequestedIncompatibleQosStatus; typedef DDS_IncompatibleQosStatus DDS_OfferedIncompatibleQosStatus; typedef struct { int total_count; int total_count_change; } DDS_SampleLostStatus; typedef struct { int total_count; int total_count_change; DDS_InstanceHandle_t last_instance_handle; } DDS_OfferedDeadlineMissedStatus; typedef struct { int total_count; int total_count_change; DDS_InstanceHandle_t last_instance_handle; } DDS_RequestedDeadlineMissedStatus; typedef struct { int total_count; int total_count_change; int current_count; int current_count_change; DDS_InstanceHandle_t last_publication_handle; } DDS_SubscriptionMatchedStatus; typedef struct { int total_count; int total_count_change; int current_count; int current_count_change; DDS_InstanceHandle_t last_subscription_handle; } DDS_PublicationMatchedStatus; typedef struct { int total_count; int total_count_change; } DDS_LivelinessLostStatus; typedef struct { int alive_count; int not_alive_count; int alive_count_change; int not_alive_count_change; DDS_InstanceHandle_t last_publication_handle; } DDS_LivelinessChangedStatus; typedef struct DDS_DomainParticipantListener DDS_DomainParticipantListener; typedef void (*DDS_DomainParticipantListener_on_sample_rejected)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleRejectedStatus * status ); typedef void (*DDS_DomainParticipantListener_on_requested_incompatible_qos)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedIncompatibleQosStatus * status ); typedef void (*DDS_DomainParticipantListener_on_offered_incompatible_qos)( DDS_DomainParticipantListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedIncompatibleQosStatus * status ); typedef void (*DDS_DomainParticipantListener_on_sample_lost)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleLostStatus * status ); typedef void (*DDS_DomainParticipantListener_on_offered_deadline_missed)( DDS_DomainParticipantListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedDeadlineMissedStatus * status ); typedef void (*DDS_DomainParticipantListener_on_subscription_matched)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SubscriptionMatchedStatus * status ); typedef void (*DDS_DomainParticipantListener_on_publication_matched)( DDS_DomainParticipantListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_PublicationMatchedStatus * status ); typedef void (*DDS_DomainParticipantListener_on_data_on_readers)( DDS_DomainParticipantListener *self, DDS_Subscriber the_subscriber ); typedef void (*DDS_DomainParticipantListener_on_liveliness_changed)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_LivelinessChangedStatus * status ); typedef void (*DDS_DomainParticipantListener_on_data_available)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader ); typedef void (*DDS_DomainParticipantListener_on_liveliness_lost)( DDS_DomainParticipantListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_LivelinessLostStatus * status ); typedef void (*DDS_DomainParticipantListener_on_inconsistent_topic)( DDS_DomainParticipantListener *self, DDS_Topic the_topic, /* in (variable length) */ DDS_InconsistentTopicStatus * status ); typedef void (*DDS_DomainParticipantListener_on_requested_deadline_missed)( DDS_DomainParticipantListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedDeadlineMissedStatus * status ); struct DDS_DomainParticipantListener { DDS_DomainParticipantListener_on_sample_rejected on_sample_rejected; DDS_DomainParticipantListener_on_requested_incompatible_qos on_requested_incompatible_qos; DDS_DomainParticipantListener_on_offered_incompatible_qos on_offered_incompatible_qos; DDS_DomainParticipantListener_on_sample_lost on_sample_lost; DDS_DomainParticipantListener_on_offered_deadline_missed on_offered_deadline_missed; DDS_DomainParticipantListener_on_subscription_matched on_subscription_matched; DDS_DomainParticipantListener_on_publication_matched on_publication_matched; DDS_DomainParticipantListener_on_data_on_readers on_data_on_readers; DDS_DomainParticipantListener_on_liveliness_changed on_liveliness_changed; DDS_DomainParticipantListener_on_data_available on_data_available; DDS_DomainParticipantListener_on_liveliness_lost on_liveliness_lost; DDS_DomainParticipantListener_on_inconsistent_topic on_inconsistent_topic; DDS_DomainParticipantListener_on_requested_deadline_missed on_requested_deadline_missed; }; /* === Topic ================================================================ */ typedef struct { DDS_TopicDataQosPolicy topic_data; DDS_DurabilityQosPolicy durability; DDS_DurabilityServiceQosPolicy durability_service; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_DestinationOrderQosPolicy destination_order; DDS_HistoryQosPolicy history; DDS_ResourceLimitsQosPolicy resource_limits; DDS_TransportPriorityQosPolicy transport_priority; DDS_LifespanQosPolicy lifespan; DDS_OwnershipQosPolicy ownership; } DDS_TopicQos; #define DDS_TOPIC_QOS_DEFAULT NULL DDS_EXPORT DDS_TopicQos *DDS_TopicQos__alloc (void); DDS_EXPORT void DDS_TopicQos__free (DDS_TopicQos *qos); DDS_EXPORT void DDS_TopicQos__init (DDS_TopicQos *qos); DDS_EXPORT void DDS_TopicQos__clear (DDS_TopicQos *qos); /* === TopicListener ======================================================== */ typedef struct DDS_TopicListener DDS_TopicListener; typedef void (*DDS_TopicListener_on_inconsistent_topic) ( DDS_TopicListener *self, DDS_Topic the_topic, /* in (variable length) */ DDS_InconsistentTopicStatus *status ); struct DDS_TopicListener { DDS_TopicListener_on_inconsistent_topic on_inconsistent_topic; }; /* === Subscriber =========================================================== */ typedef struct { DDS_PresentationQosPolicy presentation; DDS_PartitionQosPolicy partition; DDS_GroupDataQosPolicy group_data; DDS_EntityFactoryQosPolicy entity_factory; } DDS_SubscriberQos; #define DDS_SUBSCRIBER_QOS_DEFAULT NULL DDS_EXPORT DDS_SubscriberQos *DDS_SubscriberQos__alloc (void); DDS_EXPORT void DDS_SubscriberQos__free (DDS_SubscriberQos *qos); DDS_EXPORT void DDS_SubscriberQos__init (DDS_SubscriberQos *qos); DDS_EXPORT void DDS_SubscriberQos__clear (DDS_SubscriberQos *qos); /* === SubscriberListener -------============================================ */ typedef struct DDS_SubscriberListener DDS_SubscriberListener; typedef void (*DDS_SubscriberListener_on_sample_rejected) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleRejectedStatus *status ); typedef void (*DDS_SubscriberListener_on_requested_incompatible_qos) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedIncompatibleQosStatus *status ); typedef void (*DDS_SubscriberListener_on_sample_lost) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleLostStatus *status ); typedef void (*DDS_SubscriberListener_on_subscription_matched) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SubscriptionMatchedStatus *status ); typedef void (*DDS_SubscriberListener_on_data_available) ( DDS_SubscriberListener *self, DDS_DataReader the_reader ); typedef void (*DDS_SubscriberListener_on_liveliness_changed) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_LivelinessChangedStatus *status ); typedef void (*DDS_SubscriberListener_on_data_on_readers) ( DDS_SubscriberListener *self, DDS_Subscriber the_subscriber ); typedef void (*DDS_SubscriberListener_on_requested_deadline_missed) ( DDS_SubscriberListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedDeadlineMissedStatus *status ); struct DDS_SubscriberListener { DDS_SubscriberListener_on_sample_rejected on_sample_rejected; DDS_SubscriberListener_on_requested_incompatible_qos on_requested_incompatible_qos; DDS_SubscriberListener_on_sample_lost on_sample_lost; DDS_SubscriberListener_on_subscription_matched on_subscription_matched; DDS_SubscriberListener_on_data_available on_data_available; DDS_SubscriberListener_on_liveliness_changed on_liveliness_changed; DDS_SubscriberListener_on_data_on_readers on_data_on_readers; DDS_SubscriberListener_on_requested_deadline_missed on_requested_deadline_missed; }; /* === Publisher ============================================================ */ typedef struct { DDS_PresentationQosPolicy presentation; DDS_PartitionQosPolicy partition; DDS_GroupDataQosPolicy group_data; DDS_EntityFactoryQosPolicy entity_factory; } DDS_PublisherQos; #define DDS_PUBLISHER_QOS_DEFAULT NULL DDS_EXPORT DDS_PublisherQos *DDS_PublisherQos__alloc (void); DDS_EXPORT void DDS_PublisherQos__free (DDS_PublisherQos *qos); DDS_EXPORT void DDS_PublisherQos__init (DDS_PublisherQos *qos); DDS_EXPORT void DDS_PublisherQos__clear (DDS_PublisherQos *qos); /* === PublisherListener ==================================================== */ typedef struct DDS_PublisherListener DDS_PublisherListener; typedef void (*DDS_PublisherListener_on_offered_deadline_missed) ( DDS_PublisherListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedDeadlineMissedStatus *status ); typedef void (*DDS_PublisherListener_on_publication_matched) ( DDS_PublisherListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_PublicationMatchedStatus *status ); typedef void (*DDS_PublisherListener_on_liveliness_lost) ( DDS_PublisherListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_LivelinessLostStatus *status ); typedef void (*DDS_PublisherListener_on_offered_incompatible_qos) ( DDS_PublisherListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedIncompatibleQosStatus *status ); struct DDS_PublisherListener { DDS_PublisherListener_on_offered_deadline_missed on_offered_deadline_missed; DDS_PublisherListener_on_publication_matched on_publication_matched; DDS_PublisherListener_on_liveliness_lost on_liveliness_lost; DDS_PublisherListener_on_offered_incompatible_qos on_offered_incompatible_qos; }; /* === DataReader =========================================================== */ typedef struct { DDS_DurabilityQosPolicy durability; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_DestinationOrderQosPolicy destination_order; DDS_HistoryQosPolicy history; DDS_ResourceLimitsQosPolicy resource_limits; DDS_UserDataQosPolicy user_data; DDS_OwnershipQosPolicy ownership; DDS_TimeBasedFilterQosPolicy time_based_filter; DDS_ReaderDataLifecycleQosPolicy reader_data_lifecycle; } DDS_DataReaderQos; #define DDS_DATAREADER_QOS_DEFAULT NULL #define DDS_DATAREADER_QOS_USE_TOPIC_QOS ((DDS_DataReaderQos *) 1UL) DDS_EXPORT DDS_DataReaderQos *DDS_DataReaderQos__alloc (void); DDS_EXPORT void DDS_DataReaderQos__free (DDS_DataReaderQos *qos); DDS_EXPORT void DDS_DataReaderQos__init (DDS_DataReaderQos *qos); DDS_EXPORT void DDS_DataReaderQos__clear (DDS_DataReaderQos *qos); /* === DataReaderListener =================================================== */ typedef struct DDS_DataReaderListener DDS_DataReaderListener; typedef void (*DDS_DataReaderListener_on_subscription_matched)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SubscriptionMatchedStatus *status ); typedef void (*DDS_DataReaderListener_on_sample_rejected)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleRejectedStatus *status ); typedef void (*DDS_DataReaderListener_on_data_available)( DDS_DataReaderListener *self, DDS_DataReader the_reader ); typedef void (*DDS_DataReaderListener_on_liveliness_changed)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_LivelinessChangedStatus *status ); typedef void (*DDS_DataReaderListener_on_requested_incompatible_qos)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedIncompatibleQosStatus *status ); typedef void (*DDS_DataReaderListener_on_sample_lost)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_SampleLostStatus *status ); typedef void (*DDS_DataReaderListener_on_requested_deadline_missed)( DDS_DataReaderListener *self, DDS_DataReader the_reader, /* in (variable length) */ DDS_RequestedDeadlineMissedStatus *status ); struct DDS_DataReaderListener { DDS_DataReaderListener_on_sample_rejected on_sample_rejected; DDS_DataReaderListener_on_liveliness_changed on_liveliness_changed; DDS_DataReaderListener_on_requested_deadline_missed on_requested_deadline_missed; DDS_DataReaderListener_on_requested_incompatible_qos on_requested_incompatible_qos; DDS_DataReaderListener_on_data_available on_data_available; DDS_DataReaderListener_on_subscription_matched on_subscription_matched; DDS_DataReaderListener_on_sample_lost on_sample_lost; void *cookie; }; /* === DataWriter =========================================================== */ typedef struct { DDS_DurabilityQosPolicy durability; DDS_DurabilityServiceQosPolicy durability_service; DDS_DeadlineQosPolicy deadline; DDS_LatencyBudgetQosPolicy latency_budget; DDS_LivelinessQosPolicy liveliness; DDS_ReliabilityQosPolicy reliability; DDS_DestinationOrderQosPolicy destination_order; DDS_HistoryQosPolicy history; DDS_ResourceLimitsQosPolicy resource_limits; DDS_TransportPriorityQosPolicy transport_priority; DDS_LifespanQosPolicy lifespan; DDS_UserDataQosPolicy user_data; DDS_OwnershipQosPolicy ownership; DDS_OwnershipStrengthQosPolicy ownership_strength; DDS_WriterDataLifecycleQosPolicy writer_data_lifecycle; } DDS_DataWriterQos; #define DDS_DATAWRITER_QOS_DEFAULT NULL #define DDS_DATAWRITER_QOS_USE_TOPIC_QOS ((DDS_DataWriterQos *) 1UL) DDS_EXPORT DDS_DataWriterQos *DDS_DataWriterQos__alloc (void); DDS_EXPORT void DDS_DataWriterQos__free (DDS_DataWriterQos *qos); DDS_EXPORT void DDS_DataWriterQos__init (DDS_DataWriterQos *qos); DDS_EXPORT void DDS_DataWriterQos__clear (DDS_DataWriterQos *qos); /* === DataWriterListener =================================================== */ typedef struct DDS_DataWriterListener DDS_DataWriterListener; typedef void (*DDS_DataWriterListener_on_offered_deadline_missed) ( DDS_DataWriterListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedDeadlineMissedStatus *status ); typedef void (*DDS_DataWriterListener_on_publication_matched) ( DDS_DataWriterListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_PublicationMatchedStatus *status ); typedef void (*DDS_DataWriterListener_on_liveliness_lost) ( DDS_DataWriterListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_LivelinessLostStatus *status ); typedef void (*DDS_DataWriterListener_on_offered_incompatible_qos) ( DDS_DataWriterListener *self, DDS_DataWriter writer, /* in (variable length) */ DDS_OfferedIncompatibleQosStatus *status ); struct DDS_DataWriterListener { DDS_DataWriterListener_on_offered_deadline_missed on_offered_deadline_missed; DDS_DataWriterListener_on_publication_matched on_publication_matched; DDS_DataWriterListener_on_liveliness_lost on_liveliness_lost; DDS_DataWriterListener_on_offered_incompatible_qos on_offered_incompatible_qos; void *cookie; }; /* === Entity methods ====================================================== */ DDS_EXPORT DDS_StatusCondition DDS_Entity_get_statuscondition( DDS_Entity self ); DDS_EXPORT DDS_StatusMask DDS_Entity_get_status_changes( DDS_Entity self ); DDS_EXPORT DDS_ReturnCode_t DDS_Entity_enable( DDS_Entity self ); DDS_EXPORT DDS_InstanceHandle_t DDS_Entity_get_instance_handle( DDS_Entity self ); /* === WaitSet ============================================================== */ DDS_SEQUENCE (DDS_Condition, DDS_ConditionSeq); DDS_EXPORT DDS_ConditionSeq *DDS_ConditionSeq__alloc (void); DDS_EXPORT void DDS_ConditionSeq__free (DDS_ConditionSeq *conditions); DDS_EXPORT void DDS_ConditionSeq__init (DDS_ConditionSeq *conditions); DDS_EXPORT void DDS_ConditionSeq__clear (DDS_ConditionSeq *conditions); DDS_EXPORT DDS_WaitSet DDS_WaitSet__alloc (void); DDS_EXPORT void DDS_WaitSet__free ( DDS_WaitSet ws ); DDS_EXPORT DDS_ReturnCode_t DDS_WaitSet_attach_condition ( DDS_WaitSet ws, DDS_Condition c ); DDS_EXPORT DDS_ReturnCode_t DDS_WaitSet_detach_condition ( DDS_WaitSet ws, DDS_Condition c ); DDS_EXPORT DDS_ReturnCode_t DDS_WaitSet_wait ( DDS_WaitSet ws, DDS_ConditionSeq *conditions, DDS_Duration_t *timeout ); DDS_EXPORT DDS_ReturnCode_t DDS_WaitSet_get_conditions ( DDS_WaitSet ws, DDS_ConditionSeq *conditions ); /* === Conditions =========================================================== */ DDS_EXPORT int DDS_Condition_get_trigger_value ( DDS_Condition c ); DDS_EXPORT DDS_GuardCondition DDS_GuardCondition__alloc (void); DDS_EXPORT void DDS_GuardCondition__free( DDS_GuardCondition gc ); DDS_EXPORT int DDS_GuardCondition_get_trigger_value( DDS_GuardCondition gc ); DDS_EXPORT DDS_ReturnCode_t DDS_GuardCondition_set_trigger_value( DDS_GuardCondition gc, int value ); DDS_EXPORT int DDS_StatusCondition_get_trigger_value( DDS_StatusCondition self ); DDS_EXPORT DDS_ReturnCode_t DDS_StatusCondition_set_enabled_statuses( DDS_StatusCondition self, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusMask DDS_StatusCondition_get_enabled_statuses( DDS_StatusCondition self ); DDS_EXPORT DDS_Entity DDS_StatusCondition_get_entity( DDS_StatusCondition self ); DDS_EXPORT int DDS_ReadCondition_get_trigger_value( DDS_ReadCondition self ); DDS_EXPORT DDS_DataReader DDS_ReadCondition_get_datareader( DDS_ReadCondition self ); DDS_EXPORT DDS_ViewStateMask DDS_ReadCondition_get_view_state_mask( DDS_ReadCondition self ); DDS_EXPORT DDS_InstanceStateMask DDS_ReadCondition_get_instance_state_mask( DDS_ReadCondition self ); DDS_EXPORT DDS_SampleStateMask DDS_ReadCondition_get_sample_state_mask( DDS_ReadCondition self ); DDS_EXPORT int DDS_QueryCondition_get_trigger_value( DDS_QueryCondition self ); DDS_EXPORT DDS_ReturnCode_t DDS_QueryCondition_set_query_parameters( DDS_QueryCondition self, DDS_StringSeq *query_parameters ); DDS_EXPORT DDS_ReturnCode_t DDS_QueryCondition_get_query_parameters( DDS_QueryCondition self, DDS_StringSeq *query_parameters ); DDS_EXPORT const char *DDS_QueryCondition_get_query_expression( DDS_QueryCondition self ); DDS_EXPORT DDS_ViewStateMask DDS_QueryCondition_get_view_state_mask( DDS_QueryCondition self ); DDS_EXPORT DDS_DataReader DDS_QueryCondition_get_datareader( DDS_QueryCondition self ); DDS_EXPORT DDS_SampleStateMask DDS_QueryCondition_get_sample_state_mask( DDS_QueryCondition self ); DDS_EXPORT DDS_InstanceStateMask DDS_QueryCondition_get_instance_state_mask( DDS_QueryCondition self ); /* === DomainParticipantFactory methods ===================================== */ DDS_EXPORT DDS_DomainParticipant DDS_DomainParticipantFactory_create_participant( DDS_DomainId_t domain_id, const DDS_DomainParticipantQos *qos, const DDS_DomainParticipantListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipantFactory_delete_participant( DDS_DomainParticipant a_participant ); DDS_EXPORT DDS_DomainParticipant DDS_DomainParticipantFactory_lookup_participant( DDS_DomainId_t domain_id ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipantFactory_set_default_participant_qos( DDS_DomainParticipantQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipantFactory_get_default_participant_qos( DDS_DomainParticipantQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipantFactory_get_qos( DDS_DomainParticipantFactoryQos * qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipantFactory_set_qos( DDS_DomainParticipantFactoryQos * qos ); /* === TypeSupport methods ================================================== */ DDS_EXPORT const char *DDS_TypeSupport_get_type_name ( const DDS_TypeSupport ts ); DDS_EXPORT void DDS_TypeSupport_data_free ( const DDS_TypeSupport ts, void *data, int full ); DDS_EXPORT void *DDS_TypeSupport_data_copy ( const DDS_TypeSupport ts, const void *data ); DDS_EXPORT int DDS_TypeSupport_data_equals ( DDS_TypeSupport ts, const void *data, const void *other ); /* === DomainParticipant methods ============================================ */ DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_register_type( DDS_DomainParticipant self, DDS_TypeSupport ts, const char *type_name ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_unregister_type( DDS_DomainParticipant self, DDS_TypeSupport ts, const char *type_name ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_typesupport( DDS_DomainParticipant self, DDS_TypeSupport ts ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_qos( DDS_DomainParticipant self, DDS_DomainParticipantQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_set_qos( DDS_DomainParticipant self, DDS_DomainParticipantQos *qos ); DDS_EXPORT DDS_DomainParticipantListener *DDS_DomainParticipant_get_listener( DDS_DomainParticipant self ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_set_listener( DDS_DomainParticipant self, DDS_DomainParticipantListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_DomainParticipant_get_statuscondition( DDS_DomainParticipant self ); DDS_EXPORT DDS_StatusMask DDS_DomainParticipant_get_status_changes( DDS_DomainParticipant self ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_enable( DDS_DomainParticipant self ); DDS_EXPORT DDS_InstanceHandle_t DDS_DomainParticipant_get_instance_handle( DDS_DomainParticipant a_participant ); DDS_EXPORT DDS_Publisher DDS_DomainParticipant_create_publisher( DDS_DomainParticipant self, const DDS_PublisherQos *qos, const DDS_PublisherListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_publisher( DDS_DomainParticipant self, DDS_Publisher a_publisher ); DDS_EXPORT DDS_Subscriber DDS_DomainParticipant_create_subscriber( DDS_DomainParticipant self, const DDS_SubscriberQos *qos, const DDS_SubscriberListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_subscriber( DDS_DomainParticipant self, DDS_Subscriber a_subscriber ); DDS_EXPORT DDS_Topic DDS_DomainParticipant_create_topic( DDS_DomainParticipant self, const char *topic_name, const char *type_name, const DDS_TopicQos *qos, const DDS_TopicListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_topic( DDS_DomainParticipant self, DDS_Topic a_topic ); DDS_EXPORT DDS_ContentFilteredTopic DDS_DomainParticipant_create_contentfilteredtopic( DDS_DomainParticipant self, const char *name, DDS_Topic related_topic, const char *filter_expression, DDS_StringSeq *expression_parameters ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_contentfilteredtopic( DDS_DomainParticipant self, DDS_ContentFilteredTopic contentfilteredtopic ); DDS_EXPORT DDS_MultiTopic DDS_DomainParticipant_create_multitopic( DDS_DomainParticipant self, const char *name, const char *type_name, const char *subscription_expression, DDS_StringSeq *expression_parameters ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_multitopic( DDS_DomainParticipant self, DDS_MultiTopic topic ); DDS_EXPORT DDS_Topic DDS_DomainParticipant_find_topic( DDS_DomainParticipant self, const char *topic_name, DDS_Duration_t *timeout ); DDS_EXPORT DDS_TopicDescription DDS_DomainParticipant_lookup_topicdescription( DDS_DomainParticipant self, const char *topic_name ); DDS_EXPORT DDS_Subscriber DDS_DomainParticipant_get_builtin_subscriber( DDS_DomainParticipant self ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_ignore_participant( DDS_DomainParticipant self, DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_ignore_topic( DDS_DomainParticipant self, DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_ignore_publication( DDS_DomainParticipant self, DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_ignore_subscription( DDS_DomainParticipant self, DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_DomainId_t DDS_DomainParticipant_get_domain_id( DDS_DomainParticipant self ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_delete_contained_entities( DDS_DomainParticipant a_participant ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_assert_liveliness( DDS_DomainParticipant self ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_set_default_publisher_qos( DDS_DomainParticipant self, DDS_PublisherQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_default_publisher_qos( DDS_DomainParticipant self, DDS_PublisherQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_set_default_subscriber_qos( DDS_DomainParticipant self, DDS_SubscriberQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_default_subscriber_qos( DDS_DomainParticipant self, DDS_SubscriberQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_set_default_topic_qos( DDS_DomainParticipant self, DDS_TopicQos * qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_default_topic_qos( DDS_DomainParticipant self, DDS_TopicQos * qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_participants( DDS_DomainParticipant self, DDS_InstanceHandleSeq *participant_handles ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_participant_data( DDS_DomainParticipant self, DDS_ParticipantBuiltinTopicData *participant_data, DDS_InstanceHandle_t participant_handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_topics( DDS_DomainParticipant self, DDS_InstanceHandleSeq *topic_handles ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_discovered_topic_data( DDS_DomainParticipant self, DDS_TopicBuiltinTopicData *topic_data, DDS_InstanceHandle_t topic_handle ); DDS_EXPORT int DDS_DomainParticipant_contains_entity( DDS_DomainParticipant _o, DDS_InstanceHandle_t a_handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DomainParticipant_get_current_time( DDS_DomainParticipant self, DDS_Time_t *current_time ); /* === Topic Description methods ============================================ */ DDS_EXPORT DDS_DomainParticipant DDS_TopicDescription_get_participant( DDS_TopicDescription self ); DDS_EXPORT const char *DDS_TopicDescription_get_type_name( DDS_TopicDescription self ); DDS_EXPORT const char *DDS_TopicDescription_get_name( DDS_TopicDescription self ); /* === Topic methods ======================================================== */ DDS_EXPORT DDS_ReturnCode_t DDS_Topic_get_qos( DDS_Topic self, DDS_TopicQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Topic_set_qos( DDS_Topic self, DDS_TopicQos *qos ); DDS_EXPORT DDS_TopicListener *DDS_Topic_get_listener( DDS_Topic self ); DDS_EXPORT DDS_ReturnCode_t DDS_Topic_set_listener( DDS_Topic self, DDS_TopicListener *listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_Topic_get_statuscondition( DDS_Topic self ); DDS_EXPORT DDS_StatusMask DDS_Topic_get_status_changes( DDS_Topic self ); DDS_EXPORT DDS_ReturnCode_t DDS_Topic_enable( DDS_Topic self ); DDS_EXPORT DDS_InstanceHandle_t DDS_Topic_get_instance_handle( DDS_Topic self ); DDS_EXPORT DDS_DomainParticipant DDS_Topic_get_participant( DDS_Topic self ); DDS_EXPORT const char *DDS_Topic_get_type_name( DDS_Topic self ); DDS_EXPORT const char *DDS_Topic_get_name( DDS_Topic self ); DDS_EXPORT DDS_ReturnCode_t DDS_Topic_get_inconsistent_topic_status( DDS_Topic self, DDS_InconsistentTopicStatus *a_status ); DDS_EXPORT DDS_TopicDescription DDS_Topic_get_topicdescription ( DDS_Topic self ); /* === ContentFilteredTopic methods ========================================= */ DDS_EXPORT DDS_Topic DDS_ContentFilteredTopic_get_related_topic( DDS_ContentFilteredTopic self ); DDS_EXPORT DDS_ReturnCode_t DDS_ContentFilteredTopic_get_expression_parameters( DDS_ContentFilteredTopic self, DDS_StringSeq * expression_parameters ); DDS_EXPORT DDS_ReturnCode_t DDS_ContentFilteredTopic_set_expression_parameters( DDS_ContentFilteredTopic self, DDS_StringSeq *expression_parameters ); DDS_EXPORT const char *DDS_ContentFilteredTopic_get_filter_expression( DDS_ContentFilteredTopic self ); DDS_EXPORT DDS_DomainParticipant DDS_ContentFilteredTopic_get_participant( DDS_ContentFilteredTopic self ); DDS_EXPORT const char *DDS_ContentFilteredTopic_get_type_name( DDS_ContentFilteredTopic self ); DDS_EXPORT const char *DDS_ContentFilteredTopic_get_name( DDS_ContentFilteredTopic self ); DDS_EXPORT DDS_TopicDescription DDS_ContentFilteredTopic_get_topicdescription ( DDS_ContentFilteredTopic self ); /* === Publisher methods ==================================================== */ DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_get_qos( DDS_Publisher self, DDS_PublisherQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_set_qos( DDS_Publisher self, DDS_PublisherQos *qos ); DDS_EXPORT DDS_PublisherListener *DDS_Publisher_get_listener( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_set_listener( DDS_Publisher self, DDS_PublisherListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_Publisher_get_statuscondition( DDS_Publisher self ); DDS_EXPORT DDS_StatusMask DDS_Publisher_get_status_changes( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_enable( DDS_Publisher self ); DDS_EXPORT DDS_InstanceHandle_t DDS_Publisher_get_instance_handle( DDS_Publisher self ); DDS_EXPORT DDS_DataWriter DDS_Publisher_create_datawriter( DDS_Publisher self, DDS_Topic a_topic, const DDS_DataWriterQos *qos, const DDS_DataWriterListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_delete_datawriter( DDS_Publisher self, DDS_DataWriter a_datawriter ); DDS_EXPORT DDS_DataWriter DDS_Publisher_lookup_datawriter( DDS_Publisher self, const char *topic_name ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_suspend_publications( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_resume_publications( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_begin_coherent_changes( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_end_coherent_changes( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_wait_for_acknowledgments( DDS_Publisher self, DDS_Duration_t *max_wait ); DDS_EXPORT DDS_DomainParticipant DDS_Publisher_get_participant( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_delete_contained_entities( DDS_Publisher self ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_set_default_datawriter_qos( DDS_Publisher self, DDS_DataWriterQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_get_default_datawriter_qos( DDS_Publisher self, DDS_DataWriterQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Publisher_copy_from_topic_qos( DDS_Publisher self, DDS_DataWriterQos *datawriter_qos, DDS_TopicQos *topic_qos ); /* === DataWriter methods =================================================== */ DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_qos( DDS_DataWriter self, DDS_DataWriterQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_set_qos( DDS_DataWriter self, DDS_DataWriterQos *qos ); DDS_EXPORT DDS_DataWriterListener *DDS_DataWriter_get_listener( DDS_DataWriter self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_set_listener( DDS_DataWriter self, DDS_DataWriterListener *listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_DataWriter_get_statuscondition( DDS_DataWriter self ); DDS_EXPORT DDS_StatusMask DDS_DataWriter_get_status_changes( DDS_DataWriter self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_enable( DDS_DataWriter self ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataWriter_get_instance_handle( DDS_DataWriter self ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataWriter_register_instance( DDS_DataWriter self, const void *instance_data ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataWriter_register_instance_w_timestamp( DDS_DataWriter self, const void *instance_data, const DDS_Time_t *timestamp ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_unregister_instance( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_unregister_instance_w_timestamp( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_unregister_instance_directed( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_unregister_instance_w_timestamp_directed( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_key_value( DDS_DataWriter self, void *key_data, const DDS_InstanceHandle_t h ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataWriter_lookup_instance( DDS_DataWriter self, const void *key_data ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_write( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_write_w_timestamp( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_write_directed ( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_write_w_timestamp_directed ( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_dispose( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_dispose_w_timestamp( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_dispose_directed( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_dispose_w_timestamp_directed( DDS_DataWriter self, const void *instance_data, const DDS_InstanceHandle_t handle, const DDS_Time_t *timestamp, DDS_InstanceHandleSeq *destinations ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_wait_for_acknowledgments( DDS_DataWriter self, const DDS_Duration_t *max_wait ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_liveliness_lost_status( DDS_DataWriter self, DDS_LivelinessLostStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_offered_deadline_missed_status( DDS_DataWriter self, DDS_OfferedDeadlineMissedStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_offered_incompatible_qos_status( DDS_DataWriter self, DDS_OfferedIncompatibleQosStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_publication_matched_status( DDS_DataWriter self, DDS_PublicationMatchedStatus *status ); DDS_EXPORT DDS_Topic DDS_DataWriter_get_topic( DDS_DataWriter self ); DDS_EXPORT DDS_Publisher DDS_DataWriter_get_publisher( DDS_DataWriter self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_assert_liveliness ( DDS_DataWriter self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_matched_subscription_data( DDS_DataWriter self, DDS_SubscriptionBuiltinTopicData *subscription_data, DDS_InstanceHandle_t subscription_handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_matched_subscriptions( DDS_DataWriter self, DDS_InstanceHandleSeq *subscription_handles ); DDS_EXPORT DDS_ReturnCode_t DDS_DataWriter_get_reply_subscriptions( DDS_DataWriter self, DDS_InstanceHandle_t publication_handle, DDS_InstanceHandleSeq *subscription_handles ); /* === Subscriber methods =================================================== */ DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_get_qos( DDS_Subscriber self, DDS_SubscriberQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_set_qos( DDS_Subscriber self, DDS_SubscriberQos *qos ); DDS_EXPORT DDS_SubscriberListener *DDS_Subscriber_get_listener( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_set_listener( DDS_Subscriber self, DDS_SubscriberListener *listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_Subscriber_get_statuscondition( DDS_Subscriber self ); DDS_EXPORT DDS_StatusMask DDS_Subscriber_get_status_changes( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_enable( DDS_Subscriber self ); DDS_EXPORT DDS_InstanceHandle_t DDS_Subscriber_get_instance_handle( DDS_Subscriber self ); DDS_EXPORT DDS_DataReader DDS_Subscriber_create_datareader( DDS_Subscriber self, DDS_TopicDescription a_topic, const DDS_DataReaderQos *qos, const DDS_DataReaderListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_delete_datareader( DDS_Subscriber self, DDS_DataReader a_datareader ); DDS_EXPORT DDS_DataReader DDS_Subscriber_lookup_datareader( DDS_Subscriber self, const char *topic_name ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_begin_access ( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_end_access ( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_get_datareaders( DDS_Subscriber self, DDS_DataReaderSeq *readers, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_notify_datareaders( DDS_Subscriber self ); DDS_EXPORT DDS_DomainParticipant DDS_Subscriber_get_participant( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_delete_contained_entities( DDS_Subscriber self ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_set_default_datareader_qos( DDS_Subscriber self, DDS_DataReaderQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_get_default_datareader_qos( DDS_Subscriber self, DDS_DataReaderQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_Subscriber_copy_from_topic_qos( DDS_Subscriber self, DDS_DataReaderQos *datareader_qos, DDS_TopicQos *topic_qos ); /* === DataReader methods =================================================== */ DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_qos( DDS_DataReader self, DDS_DataReaderQos *qos ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_set_qos( DDS_DataReader self, DDS_DataReaderQos *qos ); DDS_EXPORT DDS_DataReaderListener *DDS_DataReader_get_listener( DDS_DataReader self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_set_listener( DDS_DataReader self, const DDS_DataReaderListener *a_listener, DDS_StatusMask mask ); DDS_EXPORT DDS_StatusCondition DDS_DataReader_get_statuscondition( DDS_DataReader self ); DDS_EXPORT DDS_StatusMask DDS_DataReader_get_status_changes( DDS_DataReader self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_enable( DDS_DataReader self ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataReader_get_instance_handle( DDS_DataReader self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read_w_condition ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_Condition condition ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take_w_condition ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_Condition condition ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read_next_sample ( DDS_DataReader self, void *data_value, DDS_SampleInfo *sample_info ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take_next_sample ( DDS_DataReader self, void *data_value, DDS_SampleInfo *sample_info ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read_instance ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take_instance ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read_next_instance ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take_next_instance ( DDS_DataReader r, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_read_next_instance_w_condition ( DDS_DataReader r, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_Condition condition ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_take_next_instance_w_condition ( DDS_DataReader r, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq, unsigned max_samples, DDS_InstanceHandle_t handle, DDS_Condition condition ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_return_loan ( DDS_DataReader self, DDS_DataSeq *received_data, DDS_SampleInfoSeq *info_seq ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_key_value ( DDS_DataReader self, void *data, DDS_InstanceHandle_t handle ); DDS_EXPORT DDS_InstanceHandle_t DDS_DataReader_lookup_instance ( DDS_DataReader self, const void *key_data ); DDS_EXPORT DDS_ReadCondition DDS_DataReader_create_readcondition ( DDS_DataReader self, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states ); DDS_EXPORT DDS_QueryCondition DDS_DataReader_create_querycondition ( DDS_DataReader self, DDS_SampleStateMask sample_states, DDS_ViewStateMask view_states, DDS_InstanceStateMask instance_states, const char *query_expression, DDS_StringSeq *query_parameters ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_delete_readcondition ( DDS_DataReader self, DDS_Condition cond ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_liveliness_changed_status( DDS_DataReader self, DDS_LivelinessChangedStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_requested_deadline_missed_status( DDS_DataReader self, DDS_RequestedDeadlineMissedStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_requested_incompatible_qos_status( DDS_DataReader self, DDS_RequestedIncompatibleQosStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_sample_lost_status( DDS_DataReader self, DDS_SampleLostStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_sample_rejected_status( DDS_DataReader self, DDS_SampleRejectedStatus *status ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_subscription_matched_status( DDS_DataReader self, DDS_SubscriptionMatchedStatus *status ); DDS_EXPORT DDS_TopicDescription DDS_DataReader_get_topicdescription ( DDS_DataReader self ); DDS_EXPORT DDS_Subscriber DDS_DataReader_get_subscriber ( DDS_DataReader self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_delete_contained_entities( DDS_DataReader self ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_wait_for_historical_data( DDS_DataReader self, DDS_Duration_t *max_wait ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_matched_publication_data( DDS_DataReader self, DDS_PublicationBuiltinTopicData *publication_data, DDS_InstanceHandle_t publication_handle ); DDS_EXPORT DDS_ReturnCode_t DDS_DataReader_get_matched_publications( DDS_DataReader self, DDS_InstanceHandleSeq *publication_handles ); #ifdef __cplusplus } #endif #endif /* DDS_DCPS_H_ */
[ "svasanth@gmail.com" ]
svasanth@gmail.com
7105afedc5789c6f155c9d796870829283f00a5b
e79b4ff9463870c716f338b7b3395259639698d3
/sort.c
853bef831586ccd05fd836aaa4e60e07c3d0d46a
[]
no_license
skarunak/c
f11442228fe048073ed7faa4dbf1beadccf0b05d
dc7540d7f715585654355785091cd8d86a6664e8
refs/heads/master
2021-01-10T03:21:19.860666
2017-05-24T15:38:42
2017-05-24T15:38:42
44,928,327
0
0
null
null
null
null
UTF-8
C
false
false
1,645
c
#include <stdio.h> int q_partition(int *arr, int start, int end) { int pivot = arr[end]; int partition_idx = start; int i, temp; if (start < end) { // Leave out pivot idx, reassemble all others for (i=start; i<end-1;i++) { if (arr[i] <= pivot) { temp = arr[i]; arr[i] = arr[partition_idx]; arr[partition_idx++] = temp; } } // Swap the pivot in place of the partition completes.. if (arr[partition_idx] > pivot) { temp = arr[partition_idx]; arr[partition_idx] = arr[end]; arr[end] = temp; }} return partition_idx; } void quicksort(int *arr, int start, int end) { if (start < end) { int pivot_idx = q_partition(arr, start, end); quicksort(arr, start, pivot_idx-1); quicksort(arr, pivot_idx+1, end); } } // Find kth smallest element int quickselect(int *arr, int start, int end, int k) { if (start < end) { int pivot_idx = q_partition(arr, start, end); if (k == pivot_idx) { return arr[k]; } else if (k > pivot_idx) { return quickselect(arr, pivot_idx+1, end, k); } else { return quickselect(arr, start, pivot_idx-1, k); } } else if (start == end) { return arr[start]; } return -1; } int merge_sort(int *arr, int low, int high) { } int main(void) { int arr[8] = { 7,2,6,3,5,6,8,4}; int len = (sizeof(arr)/sizeof(int)) - 1; int i; int k = 0; printf(" Quickselect %dth pos %d \n", k, quickselect(arr, 0, len, k)); quicksort(arr, 0, len); printf("\nQ-sort: "); for (i=0; i<=len;i++) { printf("%d ", arr[i]); } }
[ "senthilkumar.karunakaran@gmail.com" ]
senthilkumar.karunakaran@gmail.com
13e17556892bc0d8b26c6b36cea7e940288c93d1
182abda90df373bc08a86612e5b7befbb70d3821
/src/lmmap.h
5b8cc22f2b0496be18425e26ddf437923cc0d5d2
[]
no_license
edisenwang/libmm
f7b5b56ee144eea7859a47c61adcf2b8fd7c573a
87e40436a50159a45ffea2ade8c043f88cfd019e
refs/heads/master
2021-01-23T22:06:04.324805
2013-04-29T16:06:15
2013-04-29T16:06:15
null
0
0
null
null
null
null
UTF-8
C
false
false
161
h
#ifndef _L_MMAP_H_ #define _L_MMAP_H_ #include <sys/mman.h> #define __mmap mmap extern void * lmmap(size_t length, int prot, int flags); #endif
[ "kangsun@kangsun-dev.(none)" ]
kangsun@kangsun-dev.(none)
3671e13181739badcefed7849288267d7d5bcc00
75859787b3eb1fc054b5df82c26bc261421d47e0
/3rdparty/genFiles/RF-Parameters-v1090.c
0b212fd5eeb91ab3fec9de02009a10bd011bf533
[]
no_license
aa7133/RRC
e118b3d769abff4b0b42d7511530f7b1cc29d09e
955c1ceadebf97d21306f3c083b5f38a24838da4
refs/heads/master
2020-12-10T10:45:56.892861
2020-01-26T13:02:20
2020-01-26T13:02:20
233,563,734
0
1
null
null
null
null
UTF-8
C
false
false
1,975
c
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "EUTRA-RRC-Definitions" * found in "../asnFiles/36331-f60-ASNfunctions.asn" * `asn1c -fcompound-names -findirect-choice -fincludes-quoted -fno-include-deps -gen-PER -no-gen-OER -D.` */ #include "RF-Parameters-v1090.h" #include "SupportedBandCombination-v1090.h" asn_TYPE_member_t asn_MBR_RF_Parameters_v1090_1[] = { { ATF_POINTER, 1, offsetof(struct RF_Parameters_v1090, supportedBandCombination_v1090), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_SupportedBandCombination_v1090, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "supportedBandCombination-v1090" }, }; static const int asn_MAP_RF_Parameters_v1090_oms_1[] = { 0 }; static const ber_tlv_tag_t asn_DEF_RF_Parameters_v1090_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_RF_Parameters_v1090_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* supportedBandCombination-v1090 */ }; asn_SEQUENCE_specifics_t asn_SPC_RF_Parameters_v1090_specs_1 = { sizeof(struct RF_Parameters_v1090), offsetof(struct RF_Parameters_v1090, _asn_ctx), asn_MAP_RF_Parameters_v1090_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_RF_Parameters_v1090_oms_1, /* Optional members */ 1, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_RF_Parameters_v1090 = { "RF-Parameters-v1090", "RF-Parameters-v1090", &asn_OP_SEQUENCE, asn_DEF_RF_Parameters_v1090_tags_1, sizeof(asn_DEF_RF_Parameters_v1090_tags_1) /sizeof(asn_DEF_RF_Parameters_v1090_tags_1[0]), /* 1 */ asn_DEF_RF_Parameters_v1090_tags_1, /* Same as above */ sizeof(asn_DEF_RF_Parameters_v1090_tags_1) /sizeof(asn_DEF_RF_Parameters_v1090_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, asn_MBR_RF_Parameters_v1090_1, 1, /* Elements count */ &asn_SPC_RF_Parameters_v1090_specs_1 /* Additional specs */ };
[ "aa7133@att.com" ]
aa7133@att.com
096a5c9d26dc62ee211cc442e47e48b3172291e8
febf4d15f95e133882b5e08fc9a62ae96d22aeca
/libft/src/fork_macro.c
efb775f2d0ab92e80aa19cbf6859eb8300b14944
[]
no_license
kbensado/ft_p
6ca9fabb38260a0b9150eaa35265dbfbb973c393
b265567b210c7f67ad91950c69ca49499076b450
refs/heads/master
2021-09-02T09:38:20.445563
2018-01-01T14:28:25
2018-01-01T14:28:25
113,640,011
0
0
null
null
null
null
UTF-8
C
false
false
1,313
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fork_macro.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: kbensado <kbensado@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/08/13 20:46:18 by kbensado #+# #+# */ /* Updated: 2017/08/25 20:08:54 by kbensado ### ########.fr */ /* */ /* ************************************************************************** */ #include "../inc/libft.h" #include "../inc/libft_file.h" /* ** "in" le fd dans lequel rediriger le fork (see bool fd) */ bool execv_it(int in, bool fd, t_char av) { pid_t daddy; int status; daddy = fork(); if (daddy > 0) wait4(daddy, &status, 0, 0); else if (daddy == 0) { if (fd == true) dup2(in, 1); execv(av.array[0], av.array); } if (av.array) ft_del_tab(av.array, av.size); return (true); }
[ "kbensado@e3r2p22.42.fr" ]
kbensado@e3r2p22.42.fr
f49f42f600755daabf7ef698de37053bcd5f264c
98c8d3c5d1d3e61b254d539d7ed67fa694312c73
/src/dev/pca9548a.h
6b4ad32546895e00c9b6794988096aaf7c22f03e
[]
no_license
lawrencejones/raspi-gpio
cc9df948bfcfbc2d5baa98be6b3ac24f0c8cd011
89f9def01f4d09505807b477a0000781277f3b35
refs/heads/master
2020-04-15T11:13:14.211989
2013-10-25T02:30:18
2013-10-25T02:30:18
11,237,973
1
0
null
null
null
null
UTF-8
C
false
false
2,117
h
/////////////////////////////////////////////////////////////////////////////// // Raspberry Pi GPIO Interface // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // File: pca9548a.h // PA Consulting - Lawrence Jones /////////////////////////////////////////////////////////////////////////////// #ifndef PCA9548A_HEADER_INC #define PCA9548A_HEADER_INC #include "dev/shared.h" #include "i2c/i2c_err.h" #include "dev/shared/dev_mux.h" /////////////////////////////////////////////////////////////////////////////// // DEFINE CHANNEL CODES /////////////////////////////////////////////////////////////////////////////// // Defines the channel enable codes // To generate a channel code, or the channels you desire // to become active. The pca supports multiple channels // simulataneously. // Ex - { Mux *m->set_channel(m, PCA_C0|PCA_C2) } for channel 0+2 // PCA_CD is ChannelDisabled #define PCA_CD -1 #define PCA_C0 0x00 #define PCA_C1 0x01 #define PCA_C2 0x02 #define PCA_C3 0x03 /////////////////////////////////////////////////////////////////////////////// // INTERFACE - FUNCTION STUBS /////////////////////////////////////////////////////////////////////////////// // Malloc and initialise a mux struct, return the pointer Mux *pca_init ( i2c_bus *i2c, // INIT short i2c_addr ); // Fetches the current channel code (raw reg val) and updates // the channel field inside the mux struct uint8_t pca_get_channel ( Mux *m ); // GET CHANNEL // Sets the mux channel value with a given short // Also runs a write test to verify success (updates channel field) int pca_set_channel ( Mux *m, // SET CHANNEL short c ); // Generates a mux network from all the devices visible on the buses MuxNetwork *pca_get_devs ( Mux *m ); // GET DEVS // Dealloc an pca mux struct, watch for any memory leaks void pca_dealloc ( Mux** m ); // DEALLOC #endif
[ "lawrence.jones12@imperial.ac.uk" ]
lawrence.jones12@imperial.ac.uk
c4ac4a406ced9379084f2ebebeab4f554e531046
44d05587f8578ee645ee572dff25a2496b865aac
/stm32cubeide/AuCAR_slave/Src/main.c
5112896c987ec7886de611f6042f46f158d01f55
[ "Apache-2.0" ]
permissive
YeongJunKim/AuCAR
3b1eb4c06b3c5533a45272f69f323019ea920f34
c2abb1ecbab2a25b1dd896ddbea50ac76fa4478d
refs/heads/master
2021-07-16T11:09:50.274652
2020-08-13T04:32:35
2020-08-13T04:32:35
188,990,518
2
1
Apache-2.0
2020-06-17T18:24:59
2019-05-28T08:48:04
C
UTF-8
C
false
false
6,683
c
/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "dma.h" #include "tim.h" #include "usart.h" #include "gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "slave_main.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ int __io_putchar(int ch) { //__usart2.write((uint8_t*)ch, 1); __printf__io__putchar(ch); return ch; } /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_TIM1_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_TIM5_Init(); MX_TIM8_Init(); MX_UART4_Init(); MX_UART5_Init(); MX_USART2_UART_Init(); MX_TIM6_Init(); MX_TIM7_Init(); MX_TIM14_Init(); MX_TIM10_Init(); /* USER CODE BEGIN 2 */ HAL_TIM_Base_Start_IT(&htim6); HAL_TIM_Base_Start_IT(&htim7); HAL_TIM_Base_Start_IT(&htim14); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_3); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_4); HAL_TIM_Encoder_Start(&htim3,TIM_CHANNEL_ALL); HAL_TIM_Encoder_Start(&htim4,TIM_CHANNEL_ALL); HAL_TIM_Encoder_Start(&htim5,TIM_CHANNEL_ALL); HAL_TIM_Encoder_Start(&htim8,TIM_CHANNEL_ALL); TIM1->CCR1 = 0; TIM1->CCR2 = 0; TIM1->CCR3 = 0; TIM1->CCR4 = 0; init(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ // HAL_UART_Receive_IT(&huart2, rxData, 1); // // current_tick = HAL_GetTick(); // // if(current_tick - past_tick >= 2) // { // HAL_UART_Transmit(&huart2, sendData, sizeof(sendData), 0xFFFF); // past_tick = current_tick; // } run(); //uart rx tx callback check; } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = 8; RCC_OscInitStruct.PLL.PLLN = 180; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 2; RCC_OscInitStruct.PLL.PLLR = 2; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) { Error_Handler(); } } /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
[ "dud3722000@naver.com" ]
dud3722000@naver.com
f1f235339fee581b77878c76828187daddeb6e0d
277e143975d67165d761fe0f5c329d0af7e8fb4e
/TI/msp430/projects/thermostat/duothermo/74hc595.h
6884e2cf56121e57ac50b38b0d448db2ebce2f29
[]
no_license
vhulagov/electronics
43c8bd64578ae717d5997cdba3177bbd65c29ca1
ede547c2613720b27e90012b0c4ae743489312e1
refs/heads/master
2021-10-10T21:19:02.698994
2021-09-28T10:44:29
2021-09-28T10:44:29
20,236,554
0
0
null
null
null
null
UTF-8
C
false
false
377
h
#ifndef _74HC595_H_ #define _74HC595_H_ #include <sys/types.h> #define SHIFT_STORAGE_CLEAR 0 #define SHIFT_STORAGE_CLOCK 1 void shift_setup(volatile uint16_t *PORT_DIR_REG, volatile uint16_t *PORT_OUT_REG, uint8_t PIN_SCK, uint8_t PIN_RCK, uint8_t PIN_SCLR, uint8_t PIN_SI); void shift_clear(); void shift_byte(uint8_t byte); void shift_end(); #endif /* _74HC595_H_ */
[ "lacitis@yandex-team.ru" ]
lacitis@yandex-team.ru
90da34e0bde5a20bba19a5ef88aeaf5f9fe42210
598737b786a20889dc6acd468478baf4972535b3
/src/crypto/dist/heimdal/appl/telnet/telnet/ring.h
34f3032fd5992fb9c01656fbda7178c5397b8dbc
[ "BSD-3-Clause" ]
permissive
shisa/shisa-netbsd
5c8e289de2a48b6d8f39bd3add9ca4ea48fec1da
28d999d1c25107c126e0a458a97b9397aae592ef
refs/heads/master
2021-01-01T05:33:32.619808
2008-05-26T04:27:54
2008-05-26T04:27:54
32,793,680
1
2
null
null
null
null
UTF-8
C
false
false
3,401
h
/* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ring.h 8.1 (Berkeley) 6/6/93 */ /* $Heimdal: ring.h,v 1.4 2000/02/06 05:15:47 assar Exp $ $NetBSD: ring.h,v 1.2 2003/08/07 09:15:27 agc Exp $ */ /* * This defines a structure for a ring buffer. * * The circular buffer has two parts: *((( * full: [consume, supply) * empty: [supply, consume) *]]] * */ typedef struct { unsigned char *consume, /* where data comes out of */ *supply, /* where data comes in to */ *bottom, /* lowest address in buffer */ *top, /* highest address+1 in buffer */ *mark; /* marker (user defined) */ #if defined(ENCRYPTION) unsigned char *clearto; /* Data to this point is clear text */ unsigned char *encryyptedto; /* Data is encrypted to here */ #endif int size; /* size in bytes of buffer */ u_long consumetime, /* help us keep straight full, empty, etc. */ supplytime; } Ring; /* Here are some functions and macros to deal with the ring buffer */ /* Initialization routine */ extern int ring_init (Ring *ring, unsigned char *buffer, int count); /* Data movement routines */ extern void ring_supply_data (Ring *ring, unsigned char *buffer, int count); #ifdef notdef extern void ring_consume_data (Ring *ring, unsigned char *buffer, int count); #endif /* Buffer state transition routines */ extern void ring_supplied (Ring *ring, int count), ring_consumed (Ring *ring, int count); /* Buffer state query routines */ extern int ring_empty_count (Ring *ring), ring_empty_consecutive (Ring *ring), ring_full_count (Ring *ring), ring_full_consecutive (Ring *ring); #if defined(ENCRYPTION) extern void ring_encrypt (Ring *ring, void (*func)(unsigned char *, int)), ring_clearto (Ring *ring); #endif extern int ring_at_mark(Ring *ring); extern void ring_clear_mark(Ring *ring), ring_mark(Ring *ring);
[ "keiichi@mobilegravity.sfc.wide.ad.jp" ]
keiichi@mobilegravity.sfc.wide.ad.jp
32c4977205939a74d72fddfe26d5f5eefd47f961
79a2f911e3c575eac65bb628eabe05bd3485493f
/C/Structemployye.c
9d67f387d9acff1f473a15580ed33127bd50d270
[]
no_license
ayshik-halder/archives-C-CPlusPlus
75608a4430c8290f18b7f1b7060ad297b79e30cd
058be8142f1ef15e4f99b429f3f577b02f716d6b
refs/heads/master
2023-07-02T22:07:45.987557
2021-07-22T04:32:06
2021-07-22T04:32:06
268,704,844
3
0
null
null
null
null
UTF-8
C
false
false
991
c
//write a c prog to create the structure of 1 employee and calculate their total monthly salary of user given n inputs. #include<stdio.h> #include<stdlib.h> typedef struct employee { char Name[20]; int da; //dearnessallowance int ns; //netsalary int gross; //grosssalary }employee; void main() { employee x[20]; int i=0,total=0,n; printf("\n Enter no. of employees \n "); scanf(" %d",&n); printf("\n\n ENTER DETAILS \n\n"); for( i=0;i<n;i++) { printf("\n Enter name of Employee %d \n ",i+1); //gets(x[i].Name); fflush(stdin); fgets(x[i].Name,sizeof(x[i].Name),stdin); //scanf("%s",&x[i].Name); printf("\n Enter DA = "); scanf(" %d",&x[i].da); printf("\n Enter NS ="); scanf(" %d",&x[i].ns); x[i].gross=x[i].da + x[i].ns; printf("\n Gross Salary = %d",x[i].gross); total+=x[i].gross; } printf("\n\n\n-----------------\n\n\n"); printf("\n\n\nTOTAL SALARY = %d",total); }
[ "halderayshik@gmail.com" ]
halderayshik@gmail.com
b3436d81ee1b860aa1da1d2bf996d81877a19db1
303e4b1abb0b41f5689346bdebbc19000092c8e6
/src/resolv.c
56bbe41d5cd207d903a2d286628b7de329d7722c
[ "BSD-2-Clause" ]
permissive
surereddy/sniproxy
d87db7a7ae059563c6ee340d76684335a895cb67
5ab681d2918ae19491e2f9ec4dacf98cda727571
refs/heads/master
2021-05-16T14:25:59.182094
2018-01-06T19:39:04
2018-01-06T19:39:04
null
0
0
null
null
null
null
UTF-8
C
false
false
13,009
c
/* * Copyright (c) 2014, Dustin Lundquist <dustin@null-ptr.net> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/socket.h> #include <netinet/in.h> #include <ev.h> #include <errno.h> #ifdef HAVE_LIBUDNS #include <udns.h> #endif #include "resolv.h" #include "address.h" #include "logger.h" #ifndef HAVE_LIBUDNS /* * If we do not have a DNS resolution library stub out module as no ops */ int resolv_init(struct ev_loop *loop, char **nameservers, char **search_domains, int mode) { return 0; } void resolv_shutdown(struct ev_loop *loop) { } struct ResolvQuery * resolv_query(const char *hostname, int mode, void (*client_cb)(struct Address *, void *), void (*client_free_cb)(void *), void *client_cb_data) { return NULL; } void resolv_cancel(struct ResolvQuery *query_handle) { } #else /* * Implement DNS resolution interface using libudns */ struct ResolvQuery { void (*client_cb)(struct Address *, void *); void (*client_free_cb)(void *); void *client_cb_data; int resolv_mode; struct dns_query *queries[2]; size_t response_count; struct Address **responses; }; static int default_resolv_mode = 0 /* RESOLV_MODE_IPV4_ONLY */; static struct ev_io resolv_io_watcher; static struct ev_timer resolv_timeout_watcher; static void resolv_sock_cb(struct ev_loop *, struct ev_io *, int); static void resolv_timeout_cb(struct ev_loop *, struct ev_timer *, int); static void dns_query_v4_cb(struct dns_ctx *, struct dns_rr_a4 *, void *); static void dns_query_v6_cb(struct dns_ctx *, struct dns_rr_a6 *, void *); static void dns_timer_setup_cb(struct dns_ctx *, int, void *); static void process_client_callback(struct ResolvQuery *); static inline int all_queries_are_null(struct ResolvQuery *); static struct Address *choose_ipv4_first(struct ResolvQuery *); static struct Address *choose_ipv6_first(struct ResolvQuery *); static struct Address *choose_any(struct ResolvQuery *); int resolv_init(struct ev_loop *loop, char **nameservers, char **search, int mode) { struct dns_ctx *ctx = &dns_defctx; if (nameservers == NULL) { /* Nameservers not specified, use system resolver config */ dns_init(ctx, 0); } else { dns_reset(ctx); for (int i = 0; nameservers[i] != NULL; i++) dns_add_serv(ctx, nameservers[i]); if (search != NULL) for (int i = 0; search[i] != NULL; i++) dns_add_srch(ctx, search[i]); } default_resolv_mode = mode; int sockfd = dns_open(ctx); if (sockfd < 0) fatal("Failed to open DNS resolver socket: %s", strerror(errno)); int flags = fcntl(sockfd, F_GETFL, 0); fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); ev_io_init(&resolv_io_watcher, resolv_sock_cb, sockfd, EV_READ); resolv_io_watcher.data = ctx; ev_io_start(loop, &resolv_io_watcher); ev_timer_init(&resolv_timeout_watcher, resolv_timeout_cb, 0.0, 0.0); resolv_timeout_watcher.data = ctx; dns_set_tmcbck(ctx, dns_timer_setup_cb, loop); return sockfd; } void resolv_shutdown(struct ev_loop * loop) { struct dns_ctx *ctx = (struct dns_ctx *)resolv_io_watcher.data; ev_io_stop(loop, &resolv_io_watcher); if (ev_is_active(&resolv_timeout_watcher)) ev_timer_stop(loop, &resolv_timeout_watcher); dns_close(ctx); } struct ResolvQuery * resolv_query(const char *hostname, int mode, void (*client_cb)(struct Address *, void *), void (*client_free_cb)(void *), void *client_cb_data) { struct dns_ctx *ctx = (struct dns_ctx *)resolv_io_watcher.data; /* * Wrap udns's call back in our own */ struct ResolvQuery *cb_data = malloc(sizeof(struct ResolvQuery)); if (cb_data == NULL) { err("Failed to allocate memory for DNS query callback data."); return NULL; } cb_data->client_cb = client_cb; cb_data->client_free_cb = client_free_cb; cb_data->client_cb_data = client_cb_data; cb_data->resolv_mode = mode != RESOLV_MODE_DEFAULT ? mode : default_resolv_mode; memset(cb_data->queries, 0, sizeof(cb_data->queries)); cb_data->response_count = 0; cb_data->responses = NULL; /* Submit A and AAAA queries */ if (cb_data->resolv_mode != RESOLV_MODE_IPV6_ONLY) { cb_data->queries[0] = dns_submit_a4(ctx, hostname, 0, dns_query_v4_cb, cb_data); if (cb_data->queries[0] == NULL) err("Failed to submit DNS query: %s", dns_strerror(dns_status(ctx))); }; if (cb_data->resolv_mode != RESOLV_MODE_IPV4_ONLY) { cb_data->queries[1] = dns_submit_a6(ctx, hostname, 0, dns_query_v6_cb, cb_data); if (cb_data->queries[1] == NULL) err("Failed to submit DNS query: %s", dns_strerror(dns_status(ctx))); } if (all_queries_are_null(cb_data)) { if (cb_data->client_free_cb != NULL) cb_data->client_free_cb(cb_data->client_cb_data); free(cb_data); cb_data = NULL; } return cb_data; } void resolv_cancel(struct ResolvQuery *query_handle) { struct ResolvQuery *cb_data = (struct ResolvQuery *)query_handle; struct dns_ctx *ctx = (struct dns_ctx *)resolv_io_watcher.data; for (size_t i = 0; i < sizeof(cb_data->queries) / sizeof(cb_data->queries[0]); i++) { if (cb_data->queries[i] != NULL) { dns_cancel(ctx, cb_data->queries[i]); free(cb_data->queries[i]); cb_data->queries[i] = NULL; } } if (cb_data->client_free_cb != NULL) cb_data->client_free_cb(cb_data->client_cb_data); free(cb_data); } /* * DNS UDP socket activity callback */ static void resolv_sock_cb(struct ev_loop *loop, struct ev_io *w, int revents) { struct dns_ctx *ctx = (struct dns_ctx *)w->data; if (revents & EV_READ) dns_ioevent(ctx, ev_now(loop)); } /* * Wrapper for client callback we provide to udns */ static void dns_query_v4_cb(struct dns_ctx *ctx, struct dns_rr_a4 *result, void *data) { struct ResolvQuery *cb_data = (struct ResolvQuery *)data; if (result == NULL) { info("resolv: %s\n", dns_strerror(dns_status(ctx))); } else if (result->dnsa4_nrr > 0) { struct Address **new_responses = realloc(cb_data->responses, (cb_data->response_count + (size_t)result->dnsa4_nrr) * sizeof(struct Address *)); if (new_responses == NULL) { err("Failed to allocate memory for additional DNS responses"); } else { cb_data->responses = new_responses; for (int i = 0; i < result->dnsa4_nrr; i++) { struct sockaddr_in sa = { .sin_family = AF_INET, .sin_port = 0, .sin_addr = result->dnsa4_addr[i], }; cb_data->responses[cb_data->response_count] = new_address_sa((struct sockaddr *)&sa, sizeof(sa)); if (cb_data->responses[cb_data->response_count] == NULL) err("Failed to allocate memory for DNS query result address"); else cb_data->response_count++; } } } free(result); cb_data->queries[0] = NULL; /* mark A query as being completed */ /* Once all queries have completed, call client callback */ if (all_queries_are_null(cb_data)) process_client_callback(cb_data); } static void dns_query_v6_cb(struct dns_ctx *ctx, struct dns_rr_a6 *result, void *data) { struct ResolvQuery *cb_data = (struct ResolvQuery *)data; if (result == NULL) { info("resolv: %s\n", dns_strerror(dns_status(ctx))); } else if (result->dnsa6_nrr > 0) { struct Address **new_responses = realloc(cb_data->responses, (cb_data->response_count + (size_t)result->dnsa6_nrr) * sizeof(struct Address *)); if (new_responses == NULL) { err("Failed to allocate memory for additional DNS responses"); } else { cb_data->responses = new_responses; for (int i = 0; i < result->dnsa6_nrr; i++) { struct sockaddr_in6 sa = { .sin6_family = AF_INET6, .sin6_port = 0, .sin6_addr = result->dnsa6_addr[i], }; cb_data->responses[cb_data->response_count] = new_address_sa((struct sockaddr *)&sa, sizeof(sa)); if (cb_data->responses[cb_data->response_count] == NULL) err("Failed to allocate memory for DNS query result address"); else cb_data->response_count++; } } } free(result); cb_data->queries[1] = NULL; /* mark AAAA query as being completed */ /* Once all queries have completed, call client callback */ if (all_queries_are_null(cb_data)) process_client_callback(cb_data); } /* * Called once all queries have been completed */ static void process_client_callback(struct ResolvQuery *cb_data) { struct Address *best_address = NULL; if (cb_data->resolv_mode == RESOLV_MODE_IPV4_FIRST) best_address = choose_ipv4_first(cb_data); else if (cb_data->resolv_mode == RESOLV_MODE_IPV6_FIRST) best_address = choose_ipv6_first(cb_data); else best_address = choose_any(cb_data); cb_data->client_cb(best_address, cb_data->client_cb_data); for (size_t i = 0; i < cb_data->response_count; i++) free(cb_data->responses[i]); free(cb_data->responses); if (cb_data->client_free_cb != NULL) cb_data->client_free_cb(cb_data->client_cb_data); free(cb_data); } static struct Address * choose_ipv4_first(struct ResolvQuery *cb_data) { for (size_t i = 0; i < cb_data->response_count; i++) if (address_is_sockaddr(cb_data->responses[i]) && address_sa(cb_data->responses[i])->sa_family == AF_INET) return cb_data->responses[i]; return choose_any(cb_data);; } static struct Address * choose_ipv6_first(struct ResolvQuery *cb_data) { for (size_t i = 0; i < cb_data->response_count; i++) if (address_is_sockaddr(cb_data->responses[i]) && address_sa(cb_data->responses[i])->sa_family == AF_INET6) return cb_data->responses[i]; return choose_any(cb_data);; } static struct Address * choose_any(struct ResolvQuery *cb_data) { if (cb_data->response_count >= 1) return cb_data->responses[0]; return NULL; } /* * DNS timeout callback */ static void resolv_timeout_cb(struct ev_loop *loop, struct ev_timer *w, int revents) { struct dns_ctx *ctx = (struct dns_ctx *)w->data; if (revents & EV_TIMER) dns_timeouts(ctx, 30, ev_now(loop)); } /* * Callback to setup DNS timeout callback */ static void dns_timer_setup_cb(struct dns_ctx *ctx, int timeout, void *data) { struct ev_loop *loop = (struct ev_loop *)data; if (ev_is_active(&resolv_timeout_watcher)) ev_timer_stop(loop, &resolv_timeout_watcher); if (ctx != NULL && timeout >= 0) { ev_timer_set(&resolv_timeout_watcher, timeout, 0.0); ev_timer_start(loop, &resolv_timeout_watcher); } } static inline int all_queries_are_null(struct ResolvQuery *cb_data) { int result = 1; for (size_t i = 0; i < sizeof(cb_data->queries) / sizeof(cb_data->queries[0]); i++) result = result && cb_data->queries[i] == NULL; return result; } #endif
[ "dustin@null-ptr.net" ]
dustin@null-ptr.net
19fb88784f8423b5f6ec77ccf95d95383b3101fe
0120689e74d6289a91eb5ba0bd07dbac73797d31
/CMSIS/Device/ATMEL/sam4s/include/instance/hsmci.h
9d7f9826ac3611ff6f2a66a1bc8a79162b8f9bc5
[]
no_license
Sweet-Peas/samdxx-sam-ba-bootloader
4b65dab07900148a1ee9fb13471eeed57f5cac48
eb1d99d193c3db6d6d61e14962a1f193c2ef50ca
refs/heads/master
2021-01-10T15:06:51.596237
2015-10-21T14:09:09
2015-10-21T14:09:09
44,663,762
2
0
null
null
null
null
UTF-8
C
false
false
8,669
h
/* ---------------------------------------------------------------------------- */ /* Atmel Microcontroller Software Support */ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2014, Atmel Corporation */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following condition is met: */ /* */ /* - Redistributions of source code must retain the above copyright notice, */ /* this list of conditions and the disclaimer below. */ /* */ /* Atmel's name may not be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* DISCLAIMER: 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 */ /* 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. */ /* ---------------------------------------------------------------------------- */ #ifndef _SAM4S_HSMCI_INSTANCE_ #define _SAM4S_HSMCI_INSTANCE_ /* ========== Register definition for HSMCI peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_HSMCI_CR (0x40000000U) /**< \brief (HSMCI) Control Register */ #define REG_HSMCI_MR (0x40000004U) /**< \brief (HSMCI) Mode Register */ #define REG_HSMCI_DTOR (0x40000008U) /**< \brief (HSMCI) Data Timeout Register */ #define REG_HSMCI_SDCR (0x4000000CU) /**< \brief (HSMCI) SD/SDIO Card Register */ #define REG_HSMCI_ARGR (0x40000010U) /**< \brief (HSMCI) Argument Register */ #define REG_HSMCI_CMDR (0x40000014U) /**< \brief (HSMCI) Command Register */ #define REG_HSMCI_BLKR (0x40000018U) /**< \brief (HSMCI) Block Register */ #define REG_HSMCI_CSTOR (0x4000001CU) /**< \brief (HSMCI) Completion Signal Timeout Register */ #define REG_HSMCI_RSPR (0x40000020U) /**< \brief (HSMCI) Response Register */ #define REG_HSMCI_RDR (0x40000030U) /**< \brief (HSMCI) Receive Data Register */ #define REG_HSMCI_TDR (0x40000034U) /**< \brief (HSMCI) Transmit Data Register */ #define REG_HSMCI_SR (0x40000040U) /**< \brief (HSMCI) Status Register */ #define REG_HSMCI_IER (0x40000044U) /**< \brief (HSMCI) Interrupt Enable Register */ #define REG_HSMCI_IDR (0x40000048U) /**< \brief (HSMCI) Interrupt Disable Register */ #define REG_HSMCI_IMR (0x4000004CU) /**< \brief (HSMCI) Interrupt Mask Register */ #define REG_HSMCI_CFG (0x40000054U) /**< \brief (HSMCI) Configuration Register */ #define REG_HSMCI_WPMR (0x400000E4U) /**< \brief (HSMCI) Write Protection Mode Register */ #define REG_HSMCI_WPSR (0x400000E8U) /**< \brief (HSMCI) Write Protection Status Register */ #define REG_HSMCI_RPR (0x40000100U) /**< \brief (HSMCI) Receive Pointer Register */ #define REG_HSMCI_RCR (0x40000104U) /**< \brief (HSMCI) Receive Counter Register */ #define REG_HSMCI_TPR (0x40000108U) /**< \brief (HSMCI) Transmit Pointer Register */ #define REG_HSMCI_TCR (0x4000010CU) /**< \brief (HSMCI) Transmit Counter Register */ #define REG_HSMCI_RNPR (0x40000110U) /**< \brief (HSMCI) Receive Next Pointer Register */ #define REG_HSMCI_RNCR (0x40000114U) /**< \brief (HSMCI) Receive Next Counter Register */ #define REG_HSMCI_TNPR (0x40000118U) /**< \brief (HSMCI) Transmit Next Pointer Register */ #define REG_HSMCI_TNCR (0x4000011CU) /**< \brief (HSMCI) Transmit Next Counter Register */ #define REG_HSMCI_PTCR (0x40000120U) /**< \brief (HSMCI) Transfer Control Register */ #define REG_HSMCI_PTSR (0x40000124U) /**< \brief (HSMCI) Transfer Status Register */ #define REG_HSMCI_FIFO (0x40000200U) /**< \brief (HSMCI) FIFO Memory Aperture0 */ #else #define REG_HSMCI_CR (*(__O uint32_t*)0x40000000U) /**< \brief (HSMCI) Control Register */ #define REG_HSMCI_MR (*(__IO uint32_t*)0x40000004U) /**< \brief (HSMCI) Mode Register */ #define REG_HSMCI_DTOR (*(__IO uint32_t*)0x40000008U) /**< \brief (HSMCI) Data Timeout Register */ #define REG_HSMCI_SDCR (*(__IO uint32_t*)0x4000000CU) /**< \brief (HSMCI) SD/SDIO Card Register */ #define REG_HSMCI_ARGR (*(__IO uint32_t*)0x40000010U) /**< \brief (HSMCI) Argument Register */ #define REG_HSMCI_CMDR (*(__O uint32_t*)0x40000014U) /**< \brief (HSMCI) Command Register */ #define REG_HSMCI_BLKR (*(__IO uint32_t*)0x40000018U) /**< \brief (HSMCI) Block Register */ #define REG_HSMCI_CSTOR (*(__IO uint32_t*)0x4000001CU) /**< \brief (HSMCI) Completion Signal Timeout Register */ #define REG_HSMCI_RSPR (*(__I uint32_t*)0x40000020U) /**< \brief (HSMCI) Response Register */ #define REG_HSMCI_RDR (*(__I uint32_t*)0x40000030U) /**< \brief (HSMCI) Receive Data Register */ #define REG_HSMCI_TDR (*(__O uint32_t*)0x40000034U) /**< \brief (HSMCI) Transmit Data Register */ #define REG_HSMCI_SR (*(__I uint32_t*)0x40000040U) /**< \brief (HSMCI) Status Register */ #define REG_HSMCI_IER (*(__O uint32_t*)0x40000044U) /**< \brief (HSMCI) Interrupt Enable Register */ #define REG_HSMCI_IDR (*(__O uint32_t*)0x40000048U) /**< \brief (HSMCI) Interrupt Disable Register */ #define REG_HSMCI_IMR (*(__I uint32_t*)0x4000004CU) /**< \brief (HSMCI) Interrupt Mask Register */ #define REG_HSMCI_CFG (*(__IO uint32_t*)0x40000054U) /**< \brief (HSMCI) Configuration Register */ #define REG_HSMCI_WPMR (*(__IO uint32_t*)0x400000E4U) /**< \brief (HSMCI) Write Protection Mode Register */ #define REG_HSMCI_WPSR (*(__I uint32_t*)0x400000E8U) /**< \brief (HSMCI) Write Protection Status Register */ #define REG_HSMCI_RPR (*(__IO uint32_t*)0x40000100U) /**< \brief (HSMCI) Receive Pointer Register */ #define REG_HSMCI_RCR (*(__IO uint32_t*)0x40000104U) /**< \brief (HSMCI) Receive Counter Register */ #define REG_HSMCI_TPR (*(__IO uint32_t*)0x40000108U) /**< \brief (HSMCI) Transmit Pointer Register */ #define REG_HSMCI_TCR (*(__IO uint32_t*)0x4000010CU) /**< \brief (HSMCI) Transmit Counter Register */ #define REG_HSMCI_RNPR (*(__IO uint32_t*)0x40000110U) /**< \brief (HSMCI) Receive Next Pointer Register */ #define REG_HSMCI_RNCR (*(__IO uint32_t*)0x40000114U) /**< \brief (HSMCI) Receive Next Counter Register */ #define REG_HSMCI_TNPR (*(__IO uint32_t*)0x40000118U) /**< \brief (HSMCI) Transmit Next Pointer Register */ #define REG_HSMCI_TNCR (*(__IO uint32_t*)0x4000011CU) /**< \brief (HSMCI) Transmit Next Counter Register */ #define REG_HSMCI_PTCR (*(__O uint32_t*)0x40000120U) /**< \brief (HSMCI) Transfer Control Register */ #define REG_HSMCI_PTSR (*(__I uint32_t*)0x40000124U) /**< \brief (HSMCI) Transfer Status Register */ #define REG_HSMCI_FIFO (*(__IO uint32_t*)0x40000200U) /**< \brief (HSMCI) FIFO Memory Aperture0 */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #endif /* _SAM4S_HSMCI_INSTANCE_ */
[ "pontus.oldberg@sonymobile.com" ]
pontus.oldberg@sonymobile.com
dca00cc2fdb4cfbdb4950f47ae3812195713d2b4
ed4482a048c3bb29c8b02d5a1349ff68df807a79
/src/bbs/callbk_uls/AM_proc.c
b179668756bb6529b6c8630c02ed862f8d8de305
[]
no_license
cbracken/n0ary-bbs
2c7cd8ff4e5f1612f4baac4acbc17ea606567be1
777ce328b1265ac7ac00bcfeeb897fde70cf3335
refs/heads/master
2022-02-26T00:51:36.723164
2019-10-02T04:53:49
2019-10-02T04:53:49
null
0
0
null
null
null
null
UTF-8
C
false
false
2,426
c
/* * Copyright 2017, Jeremy Cooper. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jeremy Cooper. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <string.h> #include <stdlib.h> #include "AM_proc.h" #include "common_proc.h" FPStatus AM_proc_header(void *_ctx, const char *field_contents) { AM_process_ctx *ctx = (AM_process_ctx *)_ctx; if (strcmp(field_contents, "AM") != 0) return FP_Skip_Record_Warn_Ex; return FP_OK; } FPStatus AM_proc_uls_id(void *_ctx, const char *field_contents) { AM_process_ctx *ctx = (AM_process_ctx *)_ctx; return common_proc_uls_id(&ctx->AM_uls_id, field_contents); } FPStatus AM_proc_op_class(void *_ctx, const char *field_contents) { AM_process_ctx *ctx = (AM_process_ctx *)_ctx; if (field_contents[0] == '\0') { /* Empty class usually means a club call */ ctx->AM_op_class = 'C'; } else { ctx->AM_op_class = field_contents[0]; } return FP_OK; }
[ "jeremy@X.local" ]
jeremy@X.local
930ea0a7e039b91f15785611cab6a9d4538c8a07
71e5f96a29f5d643ab888b37677d38c33f8d765d
/d/deku/monster/ca_skeleton.c
3377cea9025ed90f870de53734df5f3901f355f8
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Cherno-SuS/SunderingShadows
5f755fbebb79dc0b9d1c2a0541408be4afeb8b67
c3b4370beb2c4351ecc60826850c94892a42b685
refs/heads/main
2023-04-21T09:52:14.580024
2021-03-23T12:09:55
2021-03-23T12:09:55
349,490,686
0
0
NOASSERTION
2021-03-23T12:09:56
2021-03-19T16:40:12
null
UTF-8
C
false
false
497
c
#include <std.h> inherit "/d/deku/monster/skeleton.c"; void create() { ::create(); set_hp(query_hp() * 2); set_guild_level("fighter", 30); set_mlevel("fighter", 30); set_exp(5000); set_hp(320 + random(100)); if(!random(5)) { if(present("sword", TO)) { present("sword", TO)->set_property("enchantment", 3); } } if(!random(5)) { if(present("sword 2", TO)) { present("sword 2", TO)->set_property("enchantment", 3); } } set_overall_ac(-8); set_max_level(40); }
[ "law@shadowgate.org" ]
law@shadowgate.org
31609caae20a5e1b7990a6c09591214642f18519
19e356aa308d3adef259a912b29950a3af37a2e2
/Temp/il2cppOutput/il2cppOutput/mscorlib_System_Collections_Generic_Dictionary_2_ValueCollec_114.h
b2f2f0c14a7d450ccb80fc78ac39e8623cca7463
[]
no_license
minuJeong/AcocGame
87314d914b72290fff347cc590ae03669d10d6ba
24eeaba66393890998d55a633fcbd17d984549b4
refs/heads/master
2021-03-12T23:51:57.818655
2015-03-29T12:44:58
2015-03-29T12:44:58
32,936,460
1
0
null
null
null
null
UTF-8
C
false
false
622
h
#pragma once #include <stdint.h> // System.ValueType #include "mscorlib_System_ValueType.h" // System.Collections.Generic.Dictionary`2/Enumerator<System.String,Parse.ParseGeoPoint> #include "mscorlib_System_Collections_Generic_Dictionary_2_Enumerator__53.h" // System.Collections.Generic.Dictionary`2/ValueCollection/Enumerator<System.String,Parse.ParseGeoPoint> struct Enumerator_t8834 { // System.Collections.Generic.Dictionary`2/Enumerator<TKey,TValue> System.Collections.Generic.Dictionary`2/ValueCollection/Enumerator<System.String,Parse.ParseGeoPoint>::host_enumerator Enumerator_t8831 ___host_enumerator; };
[ "minu.hanwool@gmail.com" ]
minu.hanwool@gmail.com
7a56171267a091dfeadc14a5c9dbefb8d4bd3ec7
81ebca945a8f073b09ba380f90c7befc5d5de319
/apache-gci/include/ap_release.h
56cf52aa61c4d2aef31f1eec3a9d1d9167d013e7
[ "Apache-2.0" ]
permissive
reaganiwadha/custom-httpd
47807525405a30dcdddc83f1bc3c355108630a3b
e9361493b127091ba7f2c33b4dc9db6de59891bf
refs/heads/master
2020-12-08T17:02:33.271037
2020-01-10T13:34:28
2020-01-10T13:34:28
233,041,629
0
0
null
2020-01-10T12:32:09
2020-01-10T12:23:22
JavaScript
UTF-8
C
false
false
3,148
h
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file ap_release.h * @brief Version Release defines */ #ifndef AP_RELEASE_H #define AP_RELEASE_H #define AP_SERVER_COPYRIGHT \ "Copyright 2019 The Apache Software Foundation." /* * The below defines the base string of the Server: header. Additional * tokens can be added via the ap_add_version_component() API call. * * The tokens are listed in order of their significance for identifying the * application. * * "Product tokens should be short and to the point -- use of them for * advertizing or other non-essential information is explicitly forbidden." * * Example: "Apache/1.1.0 MrWidget/0.1-alpha" */ #define AP_SERVER_BASEVENDOR "Apache Software Foundation" #define AP_SERVER_BASEPROJECT "Apache HTTP Server" #define AP_SERVER_BASEPRODUCT "Apache" #define AP_SERVER_MAJORVERSION_NUMBER 2 #define AP_SERVER_MINORVERSION_NUMBER 4 #define AP_SERVER_PATCHLEVEL_NUMBER 41 #define AP_SERVER_DEVBUILD_BOOLEAN 0 /* Synchronize the above with docs/manual/style/version.ent */ #if !AP_SERVER_DEVBUILD_BOOLEAN #define AP_SERVER_ADD_STRING "-gci" #else #ifndef AP_SERVER_ADD_STRING #define AP_SERVER_ADD_STRING "-dev" #endif #endif /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */ #ifndef APR_STRINGIFY /** Properly quote a value as a string in the C preprocessor */ #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n) /** Helper macro for APR_STRINGIFY */ #define APR_STRINGIFY_HELPER(n) #n #endif /* keep old macros as well */ #define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER) #define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER) #define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \ AP_SERVER_ADD_STRING #define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION #define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL #define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION #define AP_SERVER_VERSION AP_SERVER_BASEVERSION /* macro for Win32 .rc files using numeric csv representation */ #define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER, \ AP_SERVER_MINORVERSION_NUMBER, \ AP_SERVER_PATCHLEVEL_NUMBER #endif
[ "reaganiwadha@protonmail.com" ]
reaganiwadha@protonmail.com
971d6d91f5815468d46b9c3e2b8510a6fbfa91b3
15d61d34ce32f101f40091d4941fe22610b31115
/libft/ft_isdigit.c
db7df4d9c7ff942b879045c83a8ec380ae3a9bdb
[]
no_license
ygarrot/get_next_line
225bf914e69574b5626f97cc282aa124ba17eb06
5fbf7a71dceed05eff4b04b4f46d5af006d74e6e
refs/heads/master
2021-10-22T11:22:56.614768
2019-03-10T07:42:20
2019-03-10T07:42:20
125,748,993
0
0
null
null
null
null
UTF-8
C
false
false
973
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_isdigit.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ygarrot <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/08 19:43:12 by ygarrot #+# #+# */ /* Updated: 2017/11/11 16:08:38 by ygarrot ### ########.fr */ /* */ /* ************************************************************************** */ int ft_isdigit(int c) { if (c >= '0' && c <= '9') return (1); return (0); }
[ "ygarrot@e2r9p3.42.fr" ]
ygarrot@e2r9p3.42.fr
cace1a2f91a55013019ee7f7980ff514bdac3a23
eb98fe3335329aeba5b2881260a5a5f971d24e23
/libft/ft_strjoinfree.c
1155a10f15b12fbae30d1487c0f0274c1aca2115
[]
no_license
Gufortel/fractol
ebd20b71f3e4184969fcc05fbb35662a5c8f2930
4ce67a332daca9ee76b1faf7058be4c86e8d623c
refs/heads/master
2022-02-04T22:45:13.533489
2019-08-03T17:45:13
2019-08-03T17:45:13
198,070,550
0
0
null
null
null
null
UTF-8
C
false
false
1,272
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strjoinfree.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: abossard <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/03/20 16:23:51 by abossard #+# #+# */ /* Updated: 2018/07/03 03:40:38 by gufortel ### ########.fr */ /* */ /* ************************************************************************** */ #include "./includes/libft.h" char *ft_strjoinfree(char *s1, char *s2, int opt) { char *str; str = NULL; if (!s1 && s2) str = ft_strdup(s2); else if (s1 && !s2) str = ft_strdup(s1); else if (s1 && s2) str = ft_strjoin(s1, s2); if (opt == 1) ft_strdel(&s1); if (opt == 2) ft_strdel(&s2); if (opt == 3) { ft_strdel(&s1); ft_strdel(&s2); } return (str); }
[ "gufortel@student.42.fr" ]
gufortel@student.42.fr
82519730bca6df178cb5546e4628946ba09be259
7b45dae8b9fa22d065c31cc0fea619f82bcbd89f
/ch8/dojun3.c
8e25e5132b19214672bbdaa39320bc303535fa24
[]
no_license
sUpniverse/algorithm
a702aab36c0cc6993c4554bdab9ef03dc9969e67
ad3536fc5f2609665f2690192acc8d4dddef43ab
refs/heads/master
2021-05-16T14:09:04.945466
2018-01-19T04:18:17
2018-01-19T04:18:17
118,075,279
1
1
null
null
null
null
UTF-8
C
false
false
519
c
#include<stdio.h> int main() { int i,j,input; int lotto[6]; for(i = 0; i < 6; i++) { printf("로또번호 입력:"); scanf("%d",&input); j = 0; while(1) { if(input == lotto[j]) { printf("같은 번호가 있습니다\n"); printf("로또번호 입력:"); scanf("%d",&input); }else if(j == i) { lotto[i] = input; break; }else j++; } } printf("입력된 로또 번호 : "); for(i = 0; i <6; i++) printf(" %d ",lotto[i]); printf("\n"); return 0; }
[ "kmsup2@gmail.com" ]
kmsup2@gmail.com
72ea16f5b0f7e3720c03e25428abee7f9b8e7147
f27bcc75fa7ff6f230cf58fd49beac274bb92afc
/ACMICPC/ACMICPC/02000-03000/02592.c
bd8de20ca99711ddee2c9fc01dbb4fce7406853d
[]
no_license
developerTUNA/Algorithm
8b543d2f41a3c8949ca6807e703d2afe7594da79
235c9a2cd2acce318f8addcd8970ece92f4f71a7
refs/heads/master
2021-04-09T17:06:42.489956
2017-09-23T11:26:28
2017-09-23T11:26:28
55,936,827
0
0
null
null
null
null
UTF-8
C
false
false
700
c
#pragma warning (disable:4996) #include <stdio.h> int Problem02592(void) { int p_nNum[10] = {0,}; int p_nNumCount[10] = {0,}; int nAvg = 0; int nMany = 0; int nManyPoz = 0; for(int i = 0; i<10; i++) { scanf("%d", &p_nNum[i]); nAvg += p_nNum[i]; for(int j = 0; j<=i; j++) { if(p_nNum[i] == p_nNum[j]) { p_nNumCount[i] ++; } } } nAvg /= 10; for(int i = 0; i < 10; i++) { if(nMany < p_nNumCount[i]) { nMany = p_nNumCount[i]; nManyPoz = i; } } printf("%d %d", nAvg, p_nNum[nManyPoz]); return 0; }
[ "developertuna@gmail.com" ]
developertuna@gmail.com
88eacf9ce037c144f587b4b131aba3a118409551
6432ffa0649947cdb0c2045a3a7b2b2bee27e8c2
/d/emei/fhs.c
5642410292ec98f4b1c1937be8f14b799be9f806
[]
no_license
MudRen/xkx100
f2e314a542e459502e28f311cd9f20ee7f7c6f43
dfca57e056460d7c0532a6e19a5e4add94a5588d
refs/heads/main
2022-03-05T00:08:01.398338
2022-01-25T09:00:27
2022-01-25T09:00:27
313,971,845
6
3
null
null
null
null
UTF-8
C
false
false
845
c
//Room: fhs.c 伏虎寺 //Date: Oct. 2 1997 by That inherit ROOM; void create() { set("short","伏虎寺"); set("long",@LONG 伏虎寺是入山第一大宝刹,隐伏在高大的乔木林间,四周楠木参天,多达 十万余株。伏虎寺气象庄严,规模宏盛,殿堂宽敞,势度巍峨。寺刹虽掩覆于 翠绿浓黛之中,但屋瓦却无一片落叶。出寺西上解脱坡便是观音堂。 LONG); set("objects", ([ __DIR__"npc/boydizi" : 1, __DIR__"npc/girldizi" : 1, ])); set("exits",([ /* sizeof() == 1 */ "east" : __DIR__"milin1", "westup" : __DIR__"milin2", ])); set("outdoors", "emei"); // set("no_clean_up", 0); set("coor/x", -6040); set("coor/y", -1040); set("coor/z", 10); setup(); replace_program(ROOM); }
[ "freddy.chua@ey.com" ]
freddy.chua@ey.com
d217e4eda41c5a4c316cd0ac102049915de90f78
627bf41a5f382ed4000d400d05ba3bbac5be6325
/server/logout_s.c
259a2f294cfa748df0d839d201228c45a83ff35d
[]
no_license
fuzzmaker/uChat
46f0c1926baedfc7d663f49155c9d52130f06557
5705b2ed50a2aadea15d9505ed1cfe551888b6b2
refs/heads/master
2020-07-17T22:02:26.284654
2019-10-04T09:31:14
2019-10-04T09:31:14
206,108,738
0
0
null
null
null
null
UTF-8
C
false
false
407
c
#include "../base/config.h" void logout_s(Message *msg,int fd){ User user; Message rectMsg; char buf[MAX_BUFSIZE]; memset(&rectMsg,0,sizeof(rectMsg)); memset(buf,0,sizeof(buf)); strcpy(user.name,msg->sendName); rectMsg.msgType=LOGOUT; rectMsg.state=SUCCESS; strcpy(rectMsg.content,"登出成功"); memcpy(buf,&rectMsg,sizeof(rectMsg)); send(fd,buf,sizeof(buf),0); rmClient(fd,1); return; }
[ "lajilongba7@gmail.com" ]
lajilongba7@gmail.com
da60af9cb3efc766bcea4c2721497e85bf178954
b42ef4fb0a106d3cc212a12b96af5666fda7c126
/sample/server/server.c
68f591a75e74eb67cdad2c736071dba6234f68b0
[ "BSD-3-Clause" ]
permissive
PalmaITEM/FreeCoAP
1530205d28d8827972ed31f9c98f5b97d7083861
18e6999a735eea883cc39c0163eb77bcf0bc8448
refs/heads/master
2021-08-22T21:45:22.480718
2017-11-16T22:23:26
2017-11-16T22:23:26
111,446,977
0
0
null
2017-11-20T18:23:28
2017-11-20T18:23:27
null
UTF-8
C
false
false
5,994
c
/* * Copyright (c) 2017 Keith Cullen. * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <string.h> #include <errno.h> #include <gnutls/gnutls.h> #include <time.h> #include "server.h" #include "coap_msg.h" #include "coap_log.h" #define SERVER_URI_PATH_BUF_LEN 32 #define SERVER_PAYLOAD_BUF_LEN 32 /* ctime_r writes to a buffer which must be at least 26 bytes */ static int server_handle_time(coap_server_t *coap_server, coap_msg_t *req, coap_msg_t *resp) { unsigned code_detail = 0; time_t t = 0; char payload_buf[SERVER_PAYLOAD_BUF_LEN] = {0}; char *p = NULL; int ret = 0; code_detail = coap_msg_get_code_detail(req); if (code_detail == COAP_MSG_GET) { /* process request */ coap_log_info("Received request method: GET"); if (coap_msg_get_payload_len(req) != 0) { coap_log_warn("Received request message with payload"); } /* perform action */ time(&t); ctime_r(&t, payload_buf); p = strchr(payload_buf, '\n'); if (p != NULL) *p = '\0'; /* generate response */ coap_msg_set_code(resp, COAP_MSG_SUCCESS, COAP_MSG_CONTENT); ret = coap_msg_add_op(resp, COAP_MSG_URI_PATH, 4, "time"); if (ret < 0) { coap_log_error("Failed to set URI path in response message"); return ret; } ret = coap_msg_set_payload(resp, payload_buf, strlen(payload_buf)); if (ret < 0) { coap_log_error("Failed to set payload in response message"); return ret; } coap_log_info("Sent response with payload: '%s'", payload_buf); return 0; } coap_log_warn("Received request message with unsupported code detail: %d", code_detail); return coap_msg_set_code(resp, COAP_MSG_SERVER_ERR, COAP_MSG_NOT_IMPL); } static int server_handle(coap_server_t *coap_server, coap_msg_t *req, coap_msg_t *resp) { size_t n = 0; char uri_path_buf[SERVER_URI_PATH_BUF_LEN] = {0}; if (coap_msg_get_ver(req) != COAP_MSG_VER) { coap_log_error("Received request message with invalid version: %d", coap_msg_get_ver(req)); return -EBADMSG; } n = coap_msg_uri_path_to_str(req, uri_path_buf, sizeof(uri_path_buf)); if ((n + 1) > sizeof(uri_path_buf)) { coap_log_error("URI path buffer too small by %zd bytes", (n + 1) - sizeof(uri_path_buf)); return -ENOSPC; } coap_log_info("Received request URI path: '%s'", uri_path_buf); if (strcmp(uri_path_buf, "/time") == 0) { return server_handle_time(coap_server, req, resp); } coap_log_warn("URI path not recognised"); return coap_msg_set_code(resp, COAP_MSG_CLIENT_ERR, COAP_MSG_NOT_FOUND); } /* one-time initialisation */ int server_init(void) { const char *gnutls_ver = NULL; coap_log_set_level(COAP_LOG_DEBUG); gnutls_ver = gnutls_check_version(NULL); if (gnutls_ver == NULL) { coap_log_error("Unable to determine GnuTLS version"); return -1; } coap_log_info("GnuTLS version: %s", gnutls_ver); return 0; } int server_create(server_t *server, const char *host, const char *port, const char *key_file_name, const char *cert_file_name, const char *trust_file_name, const char *crl_file_name) { int ret = 0; memset(server, 0, sizeof(server_t)); ret = coap_server_create(&server->coap_server, server_handle, host, port, key_file_name, cert_file_name, trust_file_name, crl_file_name); if (ret < 0) { if (ret != -1) { /* a return value of -1 indicates a DTLS failure which has already been logged */ coap_log_error("%s", strerror(-ret)); } memset(server, 0, sizeof(server_t)); return ret; } return ret; } void server_destroy(server_t *server) { coap_server_destroy(&server->coap_server); memset(server, 0, sizeof(server_t)); } int server_run(server_t *server) { int ret = 0; ret = coap_server_run(&server->coap_server); if (ret < 0) { if (ret != -1) { /* a return value of -1 indicates a DTLS failure which has already been logged */ coap_log_error("%s", strerror(-ret)); } } return ret; }
[ "keithcullen77@gmail.com" ]
keithcullen77@gmail.com
66b79ecf9397f27467c2d50eeb7aedcd62b79418
10e64f8dca0b596b339169f80c8706edb51eed9f
/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi/usr/share/ti/ti-edma3lld-tree/packages/ti/sdo/edma3/rm/src/configs/edma3_tda2xx_cfg.c
7565c065e9f4ad652e6576b683d0876d826b15df
[ "BSD-3-Clause" ]
permissive
wangy2000/LeezBoard_TI5708
264cea03d04402cf14714e35f1ca9efd4a1ef7cb
1c0e92c5b61de16f8d8aeb86852c9d53ed99ac58
refs/heads/master
2020-06-16T22:01:26.340391
2019-04-23T13:21:54
2019-04-23T13:21:54
null
0
0
null
null
null
null
UTF-8
C
false
false
89,900
c
/* * edma3_tda2xx_cfg.c * * EDMA3 Driver Adaptation Configuration File (Soc Specific) for OMAPL138. * * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated 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 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include <ti/sdo/edma3/rm/edma3_rm.h> #ifdef BUILD_TDA2XX_IPU #include <ti/sysbios/family/arm/ducati/Core.h> #endif #define NUM_SHADOW_REGIONS (8U) /* Number of EDMA3 controllers present in the system */ #define NUM_EDMA3_INSTANCES 3U /** Number of PaRAM Sets available */ #define EDMA3_NUM_PARAMSET (512U) /** Number of TCCS available */ #define EDMA3_NUM_TCC (64U) /** Number of DMA Channels available */ #define EDMA3_NUM_DMA_CHANNELS (64U) /** Number of QDMA Channels available */ #define EDMA3_NUM_QDMA_CHANNELS (8U) /** Number of Event Queues available */ #define EDMA3_NUM_EVTQUE (4U) /** Number of Transfer Controllers available */ #define EDMA3_NUM_TC (2U) /** Number of Regions */ #define EDMA3_NUM_REGIONS (8U) /* EDMA3 configuaration for EVE */ /** Number of PaRAM Sets available */ #define EDMA3_NUM_PARAMSET_EVE (64U) /** Number of TCCS available */ #define EDMA3_NUM_TCC_EVE (16U) /** Number of DMA Channels available */ #define EDMA3_NUM_DMA_CHANNELS_EVE (16U) /** Number of QDMA Channels available */ #define EDMA3_NUM_QDMA_CHANNELS_EVE (8U) /** Number of Event Queues available */ #define EDMA3_NUM_EVTQUE_EVE (2U) /** Number of Transfer Controllers available */ #define EDMA3_NUM_TC_EVE (2U) /** Number of Regions */ #define EDMA3_NUM_REGIONS_EVE (8U) /** Interrupt no. for Transfer Completion */ #define EDMA3_CC_XFER_COMPLETION_INT_A15 (66U) #define EDMA3_CC_XFER_COMPLETION_INT_DSP (38U) #define EDMA3_CC_XFER_COMPLETION_INT_IPU_C0 (34U) #define EDMA3_CC_XFER_COMPLETION_INT_IPU_C1 (33U) #define EDMA3_CC_XFER_COMPLETION_INT_EVE (8U) /** Based on the interrupt number to be mapped define the XBAR instance number */ #define COMPLETION_INT_A15_XBAR_INST_NO (29U) #define COMPLETION_INT_DSP_XBAR_INST_NO (7U) #define COMPLETION_INT_IPU_C0_XBAR_INST_NO (12U) #define COMPLETION_INT_IPU_C1_XBAR_INST_NO (11U) /** Interrupt no. for CC Error */ #define EDMA3_CC_ERROR_INT_A15 (67U) #define EDMA3_CC_ERROR_INT_DSP (39U) #define EDMA3_CC_ERROR_INT_IPU (35U) #define EDMA3_CC_ERROR_INT_EVE (23U) /** Based on the interrupt number to be mapped define the XBAR instance number */ #define CC_ERROR_INT_A15_XBAR_INST_NO (30U) #define CC_ERROR_INT_DSP_XBAR_INST_NO (8U) #define CC_ERROR_INT_IPU_XBAR_INST_NO (13U) /** Interrupt no. for TCs Error */ #define EDMA3_TC0_ERROR_INT_A15 (68U) #define EDMA3_TC0_ERROR_INT_DSP (40U) #define EDMA3_TC0_ERROR_INT_IPU (36U) #define EDMA3_TC0_ERROR_INT_EVE (24U) #define EDMA3_TC1_ERROR_INT_A15 (69U) #define EDMA3_TC1_ERROR_INT_DSP (41U) #define EDMA3_TC1_ERROR_INT_IPU (37U) #define EDMA3_TC1_ERROR_INT_EVE (25U) /** Based on the interrupt number to be mapped define the XBAR instance number */ #define TC0_ERROR_INT_A15_XBAR_INST_NO (31U) #define TC0_ERROR_INT_DSP_XBAR_INST_NO (9U) #define TC0_ERROR_INT_IPU_XBAR_INST_NO (14U) #define TC1_ERROR_INT_A15_XBAR_INST_NO (32U) #define TC1_ERROR_INT_DSP_XBAR_INST_NO (10U) #define TC1_ERROR_INT_IPU_XBAR_INST_NO (15U) #ifdef BUILD_TDA2XX_MPU #define EDMA3_CC_XFER_COMPLETION_INT (EDMA3_CC_XFER_COMPLETION_INT_A15) #define EDMA3_CC_ERROR_INT (EDMA3_CC_ERROR_INT_A15) #define CC_ERROR_INT_XBAR_INST_NO (CC_ERROR_INT_A15_XBAR_INST_NO) #define EDMA3_TC0_ERROR_INT (EDMA3_TC0_ERROR_INT_A15) #define EDMA3_TC1_ERROR_INT (EDMA3_TC1_ERROR_INT_A15) #define TC0_ERROR_INT_XBAR_INST_NO (TC0_ERROR_INT_A15_XBAR_INST_NO) #define TC1_ERROR_INT_XBAR_INST_NO (TC1_ERROR_INT_A15_XBAR_INST_NO) #elif defined BUILD_TDA2XX_DSP #define EDMA3_CC_XFER_COMPLETION_INT (EDMA3_CC_XFER_COMPLETION_INT_DSP) #define EDMA3_CC_ERROR_INT (EDMA3_CC_ERROR_INT_DSP) #define CC_ERROR_INT_XBAR_INST_NO (CC_ERROR_INT_DSP_XBAR_INST_NO) #define EDMA3_TC0_ERROR_INT (EDMA3_TC0_ERROR_INT_DSP) #define EDMA3_TC1_ERROR_INT (EDMA3_TC1_ERROR_INT_DSP) #define TC0_ERROR_INT_XBAR_INST_NO (TC0_ERROR_INT_DSP_XBAR_INST_NO) #define TC1_ERROR_INT_XBAR_INST_NO (TC1_ERROR_INT_DSP_XBAR_INST_NO) #elif defined BUILD_TDA2XX_IPU #define EDMA3_CC_XFER_COMPLETION_INT (EDMA3_CC_XFER_COMPLETION_INT_IPU_C0) #define EDMA3_CC_ERROR_INT (EDMA3_CC_ERROR_INT_IPU) #define CC_ERROR_INT_XBAR_INST_NO (CC_ERROR_INT_IPU_XBAR_INST_NO) #define EDMA3_TC0_ERROR_INT (EDMA3_TC0_ERROR_INT_IPU) #define EDMA3_TC1_ERROR_INT (EDMA3_TC1_ERROR_INT_IPU) #define TC0_ERROR_INT_XBAR_INST_NO (TC0_ERROR_INT_IPU_XBAR_INST_NO) #define TC1_ERROR_INT_XBAR_INST_NO (TC1_ERROR_INT_IPU_XBAR_INST_NO) #elif defined BUILD_TDA2XX_EVE #define EDMA3_CC_XFER_COMPLETION_INT (EDMA3_CC_XFER_COMPLETION_INT_EVE) #define EDMA3_CC_ERROR_INT (EDMA3_CC_ERROR_INT_EVE) #define EDMA3_TC0_ERROR_INT (EDMA3_TC0_ERROR_INT_EVE) #define EDMA3_TC1_ERROR_INT (EDMA3_TC1_ERROR_INT_EVE) /* For accessing EVE internal edma, there is no need to configure Xbar */ #define CC_ERROR_INT_XBAR_INST_NO (0U) #define TC0_ERROR_INT_XBAR_INST_NO (0U) #define TC1_ERROR_INT_XBAR_INST_NO (0U) #else #define EDMA3_CC_XFER_COMPLETION_INT (0U) #define EDMA3_CC_ERROR_INT (0U) #define CC_ERROR_INT_XBAR_INST_NO (0U) #define EDMA3_TC0_ERROR_INT (0U) #define EDMA3_TC1_ERROR_INT (0U) #define TC0_ERROR_INT_XBAR_INST_NO (TC0_ERROR_INT_A15_XBAR_INST_NO) #define TC1_ERROR_INT_XBAR_INST_NO (TC1_ERROR_INT_A15_XBAR_INST_NO) #endif #define EDMA3_TC2_ERROR_INT (0U) #define EDMA3_TC3_ERROR_INT (0U) #define EDMA3_TC4_ERROR_INT (0U) #define EDMA3_TC5_ERROR_INT (0U) #define EDMA3_TC6_ERROR_INT (0U) #define EDMA3_TC7_ERROR_INT (0U) #define DSP1_EDMA3_CC_XFER_COMPLETION_INT (19U) #define DSP2_EDMA3_CC_XFER_COMPLETION_INT (20U) #define DSP1_EDMA3_CC_ERROR_INT (27U) #define DSP1_EDMA3_TC0_ERROR_INT (28U) #define DSP1_EDMA3_TC1_ERROR_INT (29U) /** XBAR interrupt source index numbers for EDMA interrupts */ #define XBAR_EDMA_TPCC_IRQ_REGION0 (361U) #define XBAR_EDMA_TPCC_IRQ_REGION1 (362U) #define XBAR_EDMA_TPCC_IRQ_REGION2 (363U) #define XBAR_EDMA_TPCC_IRQ_REGION3 (364U) #define XBAR_EDMA_TPCC_IRQ_REGION4 (365U) #define XBAR_EDMA_TPCC_IRQ_REGION5 (366U) #define XBAR_EDMA_TPCC_IRQ_REGION6 (367U) #define XBAR_EDMA_TPCC_IRQ_REGION7 (368U) #define XBAR_EDMA_TPCC_IRQ_ERR (359U) #define XBAR_EDMA_TC0_IRQ_ERR (370U) #define XBAR_EDMA_TC1_IRQ_ERR (371U) /** * EDMA3 interrupts (transfer completion, CC error etc.) correspond to different * ECM events (SoC specific). These ECM events come * under ECM block XXX (handling those specific ECM events). Normally, block * 0 handles events 4-31 (events 0-3 are reserved), block 1 handles events * 32-63 and so on. This ECM block XXX (or interrupt selection number XXX) * is mapped to a specific HWI_INT YYY in the tcf file. * Define EDMA3_HWI_INT_XFER_COMP to specific HWI_INT, corresponding * to transfer completion interrupt. * Define EDMA3_HWI_INT_CC_ERR to specific HWI_INT, corresponding * to CC error interrupts. * Define EDMA3_HWI_INT_TC_ERR to specific HWI_INT, corresponding * to TC error interrupts. */ /* EDMA 0 */ #define EDMA3_HWI_INT_XFER_COMP (7U) #define EDMA3_HWI_INT_CC_ERR (7U) #define EDMA3_HWI_INT_TC0_ERR (10U) #define EDMA3_HWI_INT_TC1_ERR (10U) #define EDMA3_HWI_INT_TC2_ERR (10U) #define EDMA3_HWI_INT_TC3_ERR (10U) /** * \brief Mapping of DMA channels 0-31 to Hardware Events from * various peripherals, which use EDMA for data transfer. * All channels need not be mapped, some can be free also. * 1: Mapped * 0: Not mapped (channel available) * * This mapping will be used to allocate DMA channels when user passes * EDMA3_RM_DMA_CHANNEL_ANY as dma channel id (for eg to do memory-to-memory * copy). The same mapping is used to allocate the TCC when user passes * EDMA3_RM_TCC_ANY as tcc id (for eg to do memory-to-memory copy). * * To allocate more DMA channels or TCCs, one has to modify the event mapping. */ /* 31 0 */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA (0x3FC0C06EU) /* TBD */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_DSPEDMA (0x000FFFFFU) /* TBD */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_EVEEDMA (0x00000000U) /* TBD */ /** * \brief Mapping of DMA channels 32-63 to Hardware Events from * various peripherals, which use EDMA for data transfer. * All channels need not be mapped, some can be free also. * 1: Mapped * 0: Not mapped (channel available) * * This mapping will be used to allocate DMA channels when user passes * EDMA3_RM_DMA_CHANNEL_ANY as dma channel id (for eg to do memory-to-memory * copy). The same mapping is used to allocate the TCC when user passes * EDMA3_RM_TCC_ANY as tcc id (for eg to do memory-to-memory copy). * * To allocate more DMA channels or TCCs, one has to modify the event mapping. */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA (0xF3FFFFFCU) /* TBD */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_DSPEDMA (0x00000000U) /* TBD */ #define EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_EVEEDMA (0x00000000U) /* TBD */ /** * \brief Base address as seen from the different cores may be different * And is defined based on the core */ #if ((defined BUILD_TDA2XX_MPU) || (defined BUILD_TDA2XX_DSP)) #define EDMA3_CC_BASE_ADDR ((void *)(0x43300000)) #define EDMA3_TC0_BASE_ADDR ((void *)(0x43400000)) #define EDMA3_TC1_BASE_ADDR ((void *)(0x43500000)) #elif (defined BUILD_TDA2XX_IPU) #define EDMA3_CC_BASE_ADDR ((void *)(0x63300000)) #define EDMA3_TC0_BASE_ADDR ((void *)(0x63400000)) #define EDMA3_TC1_BASE_ADDR ((void *)(0x63500000)) #elif (defined BUILD_TDA2XX_EVE) #define EDMA3_CC_BASE_ADDR ((void *)(0x400A0000)) #define EDMA3_TC0_BASE_ADDR ((void *)(0x40086000)) #define EDMA3_TC1_BASE_ADDR ((void *)(0x40087000)) #else #define EDMA3_CC_BASE_ADDR ((void *)(0x0)) #define EDMA3_TC0_BASE_ADDR ((void *)(0x0)) #define EDMA3_TC1_BASE_ADDR ((void *)(0x0)) #endif #define DSP1_EDMA3_CC_BASE_ADDR ((void *)(0x01D10000)) #define DSP1_EDMA3_TC0_BASE_ADDR ((void *)(0x01D05000)) #define DSP1_EDMA3_TC1_BASE_ADDR ((void *)(0x01D06000)) /* Driver Object Initialization Configuration */ EDMA3_RM_GblConfigParams edma3GblCfgParams [NUM_EDMA3_INSTANCES] = { { /* EDMA3 INSTANCE# 0 */ /** Total number of DMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_DMA_CHANNELS, /** Total number of QDMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_QDMA_CHANNELS, /** Total number of TCCs supported by the EDMA3 Controller */ EDMA3_NUM_TCC, /** Total number of PaRAM Sets supported by the EDMA3 Controller */ EDMA3_NUM_PARAMSET, /** Total number of Event Queues in the EDMA3 Controller */ EDMA3_NUM_EVTQUE, /** Total number of Transfer Controllers (TCs) in the EDMA3 Controller*/ EDMA3_NUM_TC, /** Number of Regions on this EDMA3 controller */ EDMA3_NUM_REGIONS, /** * \brief Channel mapping existence * A value of 0 (No channel mapping) implies that there is fixed association * for a channel number to a parameter entry number or, in other words, * PaRAM entry n corresponds to channel n. */ 1U, /** Existence of memory protection feature */ 0U, /** Global Register Region of CC Registers */ EDMA3_CC_BASE_ADDR, /** Transfer Controller (TC) Registers */ { EDMA3_TC0_BASE_ADDR, EDMA3_TC1_BASE_ADDR, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL }, /** Interrupt no. for Transfer Completion */ EDMA3_CC_XFER_COMPLETION_INT, /** Interrupt no. for CC Error */ EDMA3_CC_ERROR_INT, /** Interrupt no. for TCs Error */ { EDMA3_TC0_ERROR_INT, EDMA3_TC1_ERROR_INT, EDMA3_TC2_ERROR_INT, EDMA3_TC3_ERROR_INT, EDMA3_TC4_ERROR_INT, EDMA3_TC5_ERROR_INT, EDMA3_TC6_ERROR_INT, EDMA3_TC7_ERROR_INT }, /** * \brief EDMA3 TC priority setting * * User can program the priority of the Event Queues * at a system-wide level. This means that the user can set the * priority of an IO initiated by either of the TCs (Transfer Controllers) * relative to IO initiated by the other bus masters on the * device (ARM, DSP, USB, etc) */ { 0U, 1U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Threshold level of number of events * that can be queued up in the Event queues. EDMA3CC error register * (CCERR) will indicate whether or not at any instant of time the * number of events queued up in any of the event queues exceeds * or equals the threshold/watermark value that is set * in the queue watermark threshold register (QWMTHRA). */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Default Burst Size (DBS) of TCs. * An optimally-sized command is defined by the transfer controller * default burst size (DBS). Different TCs can have different * DBS values. It is defined in Bytes. */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief Mapping from each DMA channel to a Parameter RAM set, * if it exists, otherwise of no use. */ { EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP }, /** * \brief Mapping from each DMA channel to a TCC. This specific * TCC code will be returned when the transfer is completed * on the mapped channel. */ { EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, }, /** * \brief Mapping of DMA channels to Hardware Events from * various peripherals, which use EDMA for data transfer. * All channels need not be mapped, some can be free also. */ { EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA } }, { /* EDMA3 INSTANCE# 1 */ /** Total number of DMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_DMA_CHANNELS, /** Total number of QDMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_QDMA_CHANNELS, /** Total number of TCCs supported by the EDMA3 Controller */ EDMA3_NUM_TCC, /** Total number of PaRAM Sets supported by the EDMA3 Controller */ EDMA3_NUM_PARAMSET, /** Total number of Event Queues in the EDMA3 Controller */ EDMA3_NUM_EVTQUE, /** Total number of Transfer Controllers (TCs) in the EDMA3 Controller*/ EDMA3_NUM_TC, /** Number of Regions on this EDMA3 controller */ EDMA3_NUM_REGIONS, /** * \brief Channel mapping existence * A value of 0 (No channel mapping) implies that there is fixed association * for a channel number to a parameter entry number or, in other words, * PaRAM entry n corresponds to channel n. */ 1U, /** Existence of memory protection feature */ 0U, /** Global Register Region of CC Registers */ DSP1_EDMA3_CC_BASE_ADDR, /** Transfer Controller (TC) Registers */ { DSP1_EDMA3_TC0_BASE_ADDR, DSP1_EDMA3_TC1_BASE_ADDR, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL }, /** Interrupt no. for Transfer Completion */ DSP1_EDMA3_CC_XFER_COMPLETION_INT, /** Interrupt no. for CC Error */ DSP1_EDMA3_CC_ERROR_INT, /** Interrupt no. for TCs Error */ { DSP1_EDMA3_TC0_ERROR_INT, DSP1_EDMA3_TC1_ERROR_INT, EDMA3_TC2_ERROR_INT, EDMA3_TC3_ERROR_INT, EDMA3_TC4_ERROR_INT, EDMA3_TC5_ERROR_INT, EDMA3_TC6_ERROR_INT, EDMA3_TC7_ERROR_INT }, /** * \brief EDMA3 TC priority setting * * User can program the priority of the Event Queues * at a system-wide level. This means that the user can set the * priority of an IO initiated by either of the TCs (Transfer Controllers) * relative to IO initiated by the other bus masters on the * device (ARM, DSP, USB, etc) */ { 0U, 1U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Threshold level of number of events * that can be queued up in the Event queues. EDMA3CC error register * (CCERR) will indicate whether or not at any instant of time the * number of events queued up in any of the event queues exceeds * or equals the threshold/watermark value that is set * in the queue watermark threshold register (QWMTHRA). */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Default Burst Size (DBS) of TCs. * An optimally-sized command is defined by the transfer controller * default burst size (DBS). Different TCs can have different * DBS values. It is defined in Bytes. */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief Mapping from each DMA channel to a Parameter RAM set, * if it exists, otherwise of no use. */ { EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP }, /** * \brief Mapping from each DMA channel to a TCC. This specific * TCC code will be returned when the transfer is completed * on the mapped channel. */ { EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, }, /** * \brief Mapping of DMA channels to Hardware Events from * various peripherals, which use EDMA for data transfer. * All channels need not be mapped, some can be free also. */ { EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_DSPEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_DSPEDMA } }, { /* EDMA3 INSTANCE# 2 */ /** Total number of DMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_DMA_CHANNELS_EVE, /** Total number of QDMA Channels supported by the EDMA3 Controller */ EDMA3_NUM_QDMA_CHANNELS_EVE, /** Total number of TCCs supported by the EDMA3 Controller */ EDMA3_NUM_TCC_EVE, /** Total number of PaRAM Sets supported by the EDMA3 Controller */ EDMA3_NUM_PARAMSET_EVE, /** Total number of Event Queues in the EDMA3 Controller */ EDMA3_NUM_EVTQUE_EVE, /** Total number of Transfer Controllers (TCs) in the EDMA3 Controller*/ EDMA3_NUM_TC_EVE, /** Number of Regions on this EDMA3 controller */ EDMA3_NUM_REGIONS_EVE, /** * \brief Channel mapping existence * A value of 0 (No channel mapping) implies that there is fixed association * for a channel number to a parameter entry number or, in other words, * PaRAM entry n corresponds to channel n. */ 1U, /** Existence of memory protection feature */ 0U, /** Global Register Region of CC Registers */ EDMA3_CC_BASE_ADDR, /** Transfer Controller (TC) Registers */ { EDMA3_TC0_BASE_ADDR, EDMA3_TC1_BASE_ADDR, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL }, /** Interrupt no. for Transfer Completion */ EDMA3_CC_XFER_COMPLETION_INT, /** Interrupt no. for CC Error */ EDMA3_CC_ERROR_INT, /** Interrupt no. for TCs Error */ { EDMA3_TC0_ERROR_INT, EDMA3_TC1_ERROR_INT, EDMA3_TC2_ERROR_INT, EDMA3_TC3_ERROR_INT, EDMA3_TC4_ERROR_INT, EDMA3_TC5_ERROR_INT, EDMA3_TC6_ERROR_INT, EDMA3_TC7_ERROR_INT }, /** * \brief EDMA3 TC priority setting * * User can program the priority of the Event Queues * at a system-wide level. This means that the user can set the * priority of an IO initiated by either of the TCs (Transfer Controllers) * relative to IO initiated by the other bus masters on the * device (ARM, DSP, USB, etc) */ { 0U, 1U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Threshold level of number of events * that can be queued up in the Event queues. EDMA3CC error register * (CCERR) will indicate whether or not at any instant of time the * number of events queued up in any of the event queues exceeds * or equals the threshold/watermark value that is set * in the queue watermark threshold register (QWMTHRA). */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief To Configure the Default Burst Size (DBS) of TCs. * An optimally-sized command is defined by the transfer controller * default burst size (DBS). Different TCs can have different * DBS values. It is defined in Bytes. */ { 16U, 16U, 0U, 0U, 0U, 0U, 0U, 0U }, /** * \brief Mapping from each DMA channel to a Parameter RAM set, * if it exists, otherwise of no use. */ { EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP, EDMA3_RM_CH_NO_PARAM_MAP }, /** * \brief Mapping from each DMA channel to a TCC. This specific * TCC code will be returned when the transfer is completed * on the mapped channel. */ { EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, EDMA3_RM_CH_NO_TCC_MAP, }, /** * \brief Mapping of DMA channels to Hardware Events from * various peripherals, which use EDMA for data transfer. * All channels need not be mapped, some can be free also. */ { EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_EVEEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_EVEEDMA } }, }; /** * \brief Resource splitting defines for Own/Reserved DMA/QDMA channels and TCCs * For PaRAMs explicit defines are not present but should be replaced in the structure sampleInstInitConfig * Default configuration has all resources owned by all cores and none reserved except for first 64 PaRAMs corrosponding to DMA channels * Resources to be Split properly by application and rebuild the sample library to avoid resource conflict * * Only Resources owned by a perticular core are allocated by Driver * Reserved resources are not allocated if requested for any available resource */ /* Default RM Instance Initialization Configuration */ EDMA3_RM_InstanceInitConfig defInstInitConfig [NUM_EDMA3_INSTANCES][NUM_SHADOW_REGIONS] = { /* EDMA3 INSTANCE# 0 */ { /* Resources owned/reserved by region 0 (Associated to MPU core 0)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 1 (Associated to MPU core 1) */ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* * This instance 0 and region 1 is only accessible to MPU core 1. * So other cores should not be access. */ #ifdef BUILD_TDA2XX_MPU /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, #else /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, #endif /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 2 (Associated to any DSP1)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 3 (Associated to any DSP2)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 4 (Associated to any IPU1 core 0)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 5 (Associated to any IPU1 core 1)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 6 (Associated to any IPU2 core 0)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 7 (Associated to any IPU2 core 1)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_SYSTEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_SYSTEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, }, /* EDMA3 INSTANCE# 1 DSP1 EDMA*/ { /* Resources owned/reserved by region 0 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 1 (Not Associated to any core supported) */ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 2 (Associated to any DSP core 0)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_DSPEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_DSPEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 3 (Associated to any DSP core 1)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 287 256 319 288 351 320 383 352 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 415 384 447 416 479 448 511 480 */ 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_DSPEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_DSPEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 4 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 5 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 6 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 7 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, }, /* EDMA3 INSTANCE# 2 EVE EDMA*/ { /* Resources owned/reserved by region 0 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 1 (Associated to any EVE core)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,}, /* ownDmaChannels */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* ownQdmaChannels */ /* 31 0 */ {0x000000FFU}, /* ownTccs */ /* 31 0 63 32 */ {0xFFFFFFFFU, 0xFFFFFFFFU}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_0_EVEEDMA, EDMA3_DMA_CHANNEL_TO_EVENT_MAPPING_1_EVEEDMA}, /* resvdQdmaChannels */ /* 31 0 */ {0x00U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00U, 0x00U}, }, /* Resources owned/reserved by region 2 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 3 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 4 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 5 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 6 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, /* Resources owned/reserved by region 7 (Not Associated to any core supported)*/ { /* ownPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* ownDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* ownQdmaChannels */ /* 31 0 */ {0x00000000U}, /* ownTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdPaRAMSets */ /* 31 0 63 32 95 64 127 96 */ {0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 159 128 191 160 223 192 255 224 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 287 256 319 288 351 320 383 352 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U, /* 415 384 447 416 479 448 511 480 */ 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}, /* resvdDmaChannels */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, /* resvdQdmaChannels */ /* 31 0 */ {0x00000000U}, /* resvdTccs */ /* 31 0 63 32 */ {0x00000000U, 0x00000000U}, }, }, }; /* Driver Instance Cross bar event to channel map Initialization Configuration */ EDMA3_RM_GblXbarToChanConfigParams defXbarChanInitConfig[NUM_EDMA3_INSTANCES][EDMA3_MAX_REGIONS] = { /* EDMA3 INSTANCE# 0 */ { /* Event to channel map for region 0 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 1 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 2 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 3 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 4 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 5 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 6 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 7 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, }, /* EDMA3 INSTANCE# 1 */ { /* Event to channel map for region 0 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 1 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 2 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 3 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 4 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 5 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 6 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 7 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, }, /* EDMA3 INSTANCE# 2 */ { /* Event to channel map for region 0 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 1 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 2 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 3 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 4 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 5 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 6 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, /* Event to channel map for region 7 */ { {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, } }; /* End of File */
[ "82796620@qq.com" ]
82796620@qq.com
08ffd258d80f51720a1b9d99e3b0a90ad9b61d3f
9e7fdb299d93fb4160126a0e1dd1f7ec83edc3aa
/bison.c
1d66034dec6ae3a7fc6f0ca9e9f5e2616da6e7f7
[]
no_license
lorglas/yab_1.7.6
a9b7b8bc0ed616dd31ddd928b39870d096695d66
deb31de785b822aac0b4859065608d2611547717
refs/heads/master
2021-10-08T04:35:23.361137
2018-11-21T20:52:14
2018-11-21T20:52:14
null
0
0
null
null
null
null
UTF-8
C
false
false
341,523
c
/* A Bison parser, made by GNU Bison 3.0.5. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.0.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ /* YABASIC --- a simple Basic Interpreter written by Marc-Oliver Ihm 1995-2004 homepage: www.yabasic.de BISON part This file is part of yabasic and may be copied only under the terms of either the Artistic License or the GNU General Public License (GPL), both of which can be found at www.yabasic.de */ #ifndef YABASIC_INCLUDED #include "yabasic.h" /* definitions of yabasic */ #endif #include <malloc.h> #if HAVE_ALLOCA_H #ifndef WINDOWS #include <alloca.h> #endif #endif void __yy_bcopy(char *,char *,int); /* prototype missing */ int tileol; /* true, read should go to eon of line */ int mylineno=1; /* line number; counts fresh in every new file */ int main_lineno=1; /* line number of main */ int function_type=ftNONE; /* contains function type while parsing function */ char *current_function=NULL; /* name of currently parsed function */ int exported=FALSE; /* true, if function is exported */ int yylex(void); extern struct libfile_name *current_libfile; /* defined in main.c: name of currently parsed file */ int missing_endif=0; int missing_endif_line=0; int missing_endsub=0; int missing_endsub_line=0; int missing_next=0; int missing_next_line=0; int missing_wend=0; int missing_wend_line=0; int missing_until=0; int missing_until_line=0; int missing_loop=0; int missing_loop_line=0; int in_loop=0; void report_missing(int severity,char *text) { if (missing_loop || missing_endif || missing_next || missing_until || missing_wend) { error(severity,text); string[0]='\0'; if (missing_endif) sprintf(string,"if statement starting at line %d has seen no 'endif' yet",missing_endif_line); else if (missing_next) sprintf(string,"for-loop starting at line %d has seen no 'next' yet",missing_next_line); else if (missing_wend) sprintf(string,"while-loop starting at line %d has seen no 'wend' yet",missing_wend_line); else if (missing_until) sprintf(string,"repeat-loop starting at line %d has seen no 'until' yet",missing_until_line); else if (missing_loop) sprintf(string,"do-loop starting at line %d has seen no 'loop' yet",missing_wend_line); if (string[0]) error(severity,string); } } # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "bison.h". */ #ifndef YY_YY_BISON_H_INCLUDED # define YY_YY_BISON_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { tFNUM = 258, tSYMBOL = 259, tSTRSYM = 260, tDOCU = 261, tDIGITS = 262, tSTRING = 263, tFOR = 264, tTO = 265, tSTEP = 266, tNEXT = 267, tWHILE = 268, tWEND = 269, tREPEAT = 270, tUNTIL = 271, tIMPORT = 272, tGOTO = 273, tGOSUB = 274, tLABEL = 275, tON = 276, tSUB = 277, tENDSUB = 278, tLOCAL = 279, tSTATIC = 280, tEXPORT = 281, tERROR = 282, tEXECUTE = 283, tEXECUTE2 = 284, tCOMPILE = 285, tRUNTIME_CREATED_SUB = 286, tINTERRUPT = 287, tBREAK = 288, tCONTINUE = 289, tSWITCH = 290, tSEND = 291, tCASE = 292, tDEFAULT = 293, tLOOP = 294, tDO = 295, tSEP = 296, tEOPROG = 297, tIF = 298, tTHEN = 299, tELSE = 300, tELSIF = 301, tENDIF = 302, tUSING = 303, tPRINT = 304, tINPUT = 305, tLINE = 306, tRETURN = 307, tDIM = 308, tEND = 309, tEXIT = 310, tAT = 311, tSCREEN = 312, tSCREENSHOT = 313, tREVERSE = 314, tCOLOUR = 315, tAND = 316, tOR = 317, tNOT = 318, tEOR = 319, tNEQ = 320, tLEQ = 321, tGEQ = 322, tLTN = 323, tGTN = 324, tEQU = 325, tPOW = 326, tREAD = 327, tDATA = 328, tRESTORE = 329, tOPEN = 330, tCLOSE = 331, tSEEK = 332, tTELL = 333, tAS = 334, tREADING = 335, tWRITING = 336, tWAIT = 337, tBELL = 338, tLET = 339, tARDIM = 340, tARSIZE = 341, tBIND = 342, tWINDOW = 343, tDOT = 344, tCIRCLE = 345, tCLEAR = 346, tFILL = 347, tPRINTER = 348, tSETUP = 349, tBUTTON = 350, tALERT = 351, tMENU = 352, tCHECKBOX = 353, tRADIOBUTTON = 354, tTEXTCONTROL = 355, tLISTBOX = 356, tDROPBOX = 357, tADD = 358, tREMOVE = 359, tLOCALIZE = 360, tFILEPANEL = 361, tSLIDER = 362, tSTATUSBAR = 363, tLAYOUT = 364, tSET = 365, tTEXTEDIT = 366, tCOUNT = 367, tVIEW = 368, tBOXVIEW = 369, tTABVIEW = 370, tTEXTURL = 371, tBITMAP = 372, tCANVAS = 373, tOPTION = 374, tDROPZONE = 375, tCOLORCONTROL = 376, tTREEBOX = 377, tCOLUMNBOX = 378, tCOLUMN = 379, tSORT = 380, tTOOLTIP = 381, tCALENDAR = 382, tCLIPBOARD = 383, tCOPY = 384, tSUBMENU = 385, tSELECT = 386, tSCROLLBAR = 387, tEXPAND = 388, tCOLLAPSE = 389, tSPLITVIEW = 390, tSTACKVIEW = 391, tPOPUPMENU = 392, tSPINCONTROL = 393, tMSEND = 394, tNUMMESSAGE = 395, tTHREAD = 396, tSOUND = 397, tPLAY = 398, tSTOP = 399, tSHORTCUT = 400, tISCOMPUTERON = 401, tDRAW = 402, tTEXT = 403, tFLUSH = 404, tELLIPSE = 405, tSAVE = 406, tRECT = 407, tGETCHAR = 408, tPUTCHAR = 409, tNEW = 410, tCURVE = 411, tLAUNCH = 412, tATTRIBUTE = 413, tSIN = 414, tASIN = 415, tCOS = 416, tACOS = 417, tTAN = 418, tATAN = 419, tEXP = 420, tLOG = 421, tSQRT = 422, tSQR = 423, tMYEOF = 424, tABS = 425, tSIG = 426, tINT = 427, tFRAC = 428, tMOD = 429, tRAN = 430, tLEN = 431, tVAL = 432, tLEFT = 433, tRIGHT = 434, tMID = 435, tMIN = 436, tMAX = 437, tSTR = 438, tINKEY = 439, tCHR = 440, tASC = 441, tHEX = 442, tDEC = 443, tBIN = 444, tUPPER = 445, tLOWER = 446, tTRIM = 447, tLTRIM = 448, tRTRIM = 449, tINSTR = 450, tRINSTR = 451, tSYSTEM = 452, tSYSTEM2 = 453, tPEEK = 454, tPEEK2 = 455, tPOKE = 456, tDATE = 457, tTIME = 458, tTOKEN = 459, tTOKENALT = 460, tSPLIT = 461, tSPLITALT = 462, tGLOB = 463, tMESSAGE = 464, tIMAGE = 465, tSVG = 466, tTRANSLATE = 467, tGET = 468, tMOUSE = 469, tISMOUSEIN = 470, tKEYBOARD = 471, tPASTE = 472, tGETNUM = 473, UMINUS = 474 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { double fnum; /* double number */ int inum; /* integer number */ int token; /* token of command */ int sep; /* number of newlines */ char *string; /* quoted string */ char *symbol; /* general symbol */ char *digits; /* string of digits */ char *docu; /* embedded documentation */ }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_BISON_H_INCLUDED */ /* Copy the second part of user declarations. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 407 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 12987 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 229 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 109 /* YYNRULES -- Number of rules. */ #define YYNRULES 588 /* YYNSTATES -- Number of states. */ #define YYNSTATES 1933 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 474 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 228, 2, 2, 2, 2, 224, 225, 221, 220, 227, 219, 2, 222, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 226, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 223 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 148, 148, 151, 152, 153, 152, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 173, 174, 174, 175, 176, 177, 178, 179, 180, 181, 181, 183, 183, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 195, 196, 196, 197, 198, 199, 200, 201, 202, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 290, 291, 292, 293, 294, 295, 296, 297, 298, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 401, 402, 403, 404, 405, 406, 409, 410, 413, 414, 416, 417, 420, 421, 424, 425, 428, 429, 430, 431, 432, 433, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 481, 483, 484, 485, 486, 487, 488, 489, 490, 491, 494, 495, 498, 498, 499, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 532, 535, 538, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 644, 645, 646, 649, 650, 653, 654, 657, 658, 659, 660, 663, 666, 669, 669, 672, 673, 674, 677, 678, 681, 682, 685, 681, 690, 691, 694, 695, 698, 699, 700, 701, 704, 705, 708, 709, 710, 711, 714, 715, 718, 719, 720, 721, 724, 725, 726, 729, 730, 731, 732, 735, 736, 740, 753, 735, 758, 759, 762, 763, 766, 767, 772, 772, 777, 778, 781, 782, 786, 787, 788, 787, 792, 793, 793, 797, 797, 803, 804, 808, 809, 808, 815, 816, 820, 820, 825, 826, 830, 831, 831, 833, 830, 837, 838, 841, 841, 845, 846, 849, 851, 853, 850, 857, 858, 861, 862, 862, 865, 866, 868, 869, 873, 874, 877, 878, 880, 881, 885, 886, 887, 888, 891, 892, 893, 894, 895, 898, 899, 900, 903, 903, 904, 904, 905, 905, 906, 906, 907, 907, 910, 911, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 930, 931, 933, 934, 937, 938 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "tFNUM", "tSYMBOL", "tSTRSYM", "tDOCU", "tDIGITS", "tSTRING", "tFOR", "tTO", "tSTEP", "tNEXT", "tWHILE", "tWEND", "tREPEAT", "tUNTIL", "tIMPORT", "tGOTO", "tGOSUB", "tLABEL", "tON", "tSUB", "tENDSUB", "tLOCAL", "tSTATIC", "tEXPORT", "tERROR", "tEXECUTE", "tEXECUTE2", "tCOMPILE", "tRUNTIME_CREATED_SUB", "tINTERRUPT", "tBREAK", "tCONTINUE", "tSWITCH", "tSEND", "tCASE", "tDEFAULT", "tLOOP", "tDO", "tSEP", "tEOPROG", "tIF", "tTHEN", "tELSE", "tELSIF", "tENDIF", "tUSING", "tPRINT", "tINPUT", "tLINE", "tRETURN", "tDIM", "tEND", "tEXIT", "tAT", "tSCREEN", "tSCREENSHOT", "tREVERSE", "tCOLOUR", "tAND", "tOR", "tNOT", "tEOR", "tNEQ", "tLEQ", "tGEQ", "tLTN", "tGTN", "tEQU", "tPOW", "tREAD", "tDATA", "tRESTORE", "tOPEN", "tCLOSE", "tSEEK", "tTELL", "tAS", "tREADING", "tWRITING", "tWAIT", "tBELL", "tLET", "tARDIM", "tARSIZE", "tBIND", "tWINDOW", "tDOT", "tCIRCLE", "tCLEAR", "tFILL", "tPRINTER", "tSETUP", "tBUTTON", "tALERT", "tMENU", "tCHECKBOX", "tRADIOBUTTON", "tTEXTCONTROL", "tLISTBOX", "tDROPBOX", "tADD", "tREMOVE", "tLOCALIZE", "tFILEPANEL", "tSLIDER", "tSTATUSBAR", "tLAYOUT", "tSET", "tTEXTEDIT", "tCOUNT", "tVIEW", "tBOXVIEW", "tTABVIEW", "tTEXTURL", "tBITMAP", "tCANVAS", "tOPTION", "tDROPZONE", "tCOLORCONTROL", "tTREEBOX", "tCOLUMNBOX", "tCOLUMN", "tSORT", "tTOOLTIP", "tCALENDAR", "tCLIPBOARD", "tCOPY", "tSUBMENU", "tSELECT", "tSCROLLBAR", "tEXPAND", "tCOLLAPSE", "tSPLITVIEW", "tSTACKVIEW", "tPOPUPMENU", "tSPINCONTROL", "tMSEND", "tNUMMESSAGE", "tTHREAD", "tSOUND", "tPLAY", "tSTOP", "tSHORTCUT", "tISCOMPUTERON", "tDRAW", "tTEXT", "tFLUSH", "tELLIPSE", "tSAVE", "tRECT", "tGETCHAR", "tPUTCHAR", "tNEW", "tCURVE", "tLAUNCH", "tATTRIBUTE", "tSIN", "tASIN", "tCOS", "tACOS", "tTAN", "tATAN", "tEXP", "tLOG", "tSQRT", "tSQR", "tMYEOF", "tABS", "tSIG", "tINT", "tFRAC", "tMOD", "tRAN", "tLEN", "tVAL", "tLEFT", "tRIGHT", "tMID", "tMIN", "tMAX", "tSTR", "tINKEY", "tCHR", "tASC", "tHEX", "tDEC", "tBIN", "tUPPER", "tLOWER", "tTRIM", "tLTRIM", "tRTRIM", "tINSTR", "tRINSTR", "tSYSTEM", "tSYSTEM2", "tPEEK", "tPEEK2", "tPOKE", "tDATE", "tTIME", "tTOKEN", "tTOKENALT", "tSPLIT", "tSPLITALT", "tGLOB", "tMESSAGE", "tIMAGE", "tSVG", "tTRANSLATE", "tGET", "tMOUSE", "tISMOUSEIN", "tKEYBOARD", "tPASTE", "tGETNUM", "'-'", "'+'", "'*'", "'/'", "UMINUS", "'('", "')'", "';'", "','", "'#'", "$accept", "program", "statement_list", "$@1", "$@2", "statement", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "string_assignment", "to", "open_clause", "seek_clause", "string_scalar_or_array", "string_expression", "string_function", "assignment", "expression", "$@9", "$@10", "arrayref", "string_arrayref", "coordinates", "function", "const", "number", "symbol_or_lineno", "dimlist", "function_or_array", "stringfunction_or_array", "call_list", "$@11", "calls", "call_item", "function_definition", "$@12", "$@13", "$@14", "endsub", "function_name", "export", "local_list", "local_item", "static_list", "static_item", "paramlist", "paramitem", "for_loop", "$@15", "$@16", "$@17", "$@18", "next", "step_part", "next_symbol", "switch_number_or_string", "$@19", "sep_list", "number_or_string", "case_list", "$@20", "$@21", "default", "$@22", "do_loop", "$@23", "loop", "while_loop", "$@24", "$@25", "wend", "repeat_loop", "$@26", "until", "if_clause", "$@27", "$@28", "$@29", "$@30", "endif", "short_if", "$@31", "else_part", "elsif_part", "$@32", "$@33", "maybe_then", "inputlist", "$@34", "input", "readlist", "readitem", "datalist", "printlist", "using", "inputbody", "$@35", "$@36", "$@37", "$@38", "$@39", "prompt", "printintro", "hashed_number", "goto_list", "gosub_list", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 45, 43, 42, 47, 474, 40, 41, 59, 44, 35 }; # endif #define YYPACT_NINF -1168 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-1168))) #define YYTABLE_NINF -516 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 10801, -62, -54, -1168, -1168, -1168, -1168, -1168, 118, 118, 118, 6568, -1168, -1168, -1168, 10346, -195, -126, 10346, 56, -1168, -1168, -1168, -1168, 9184, -10, -1168, 100, 9184, 180, -1168, 9184, 9184, 262, 28, 604, 2146, 2146, 2146, 9184, -1168, 20, 10346, -23, 45, 67, 6786, 10346, 9741, 5696, 7004, 5914, 4606, 4824, 9862, 5260, 7222, 10346, 5042, 6132, 7440, 5478, 7658, 6350, 9184, -22, 7876, 4170, 4388, 9983, 8094, 36, 10104, 10225, 8312, 8530, 8748, -31, 10346, 1555, 8966, 10346, 10346, -27, -51, -20, 2, 35, 96, 2146, 216, 177, 234, -1168, -1168, -1168, -1168, -1168, 260, 264, -1168, 340, -1168, -1168, -1168, -1168, -1168, -1168, -1168, 9184, -1168, 10346, -1168, 391, 151, 10801, -1168, -1168, -1168, -1168, -1168, -1168, 184, 188, -1168, -1168, 197, 206, 162, 212, 224, 9184, 228, 243, 270, 293, 317, -71, 10346, 10346, 246, 330, -86, -64, 10346, 335, -65, 363, 398, -42, 406, -47, -12, 354, 376, 435, 470, 474, 9184, 489, 545, -67, 587, -1168, -46, 520, 19, 524, 526, 540, 553, 557, 566, 578, 601, 603, 618, 677, 680, 681, 691, 704, 712, 720, 726, 728, 743, 755, 757, 765, 773, 781, 783, 785, 797, 806, 809, 819, 854, 857, 876, 880, 897, 913, 914, 924, 948, 953, 956, 970, 974, 987, 1003, 1007, 1035, 1062, 1076, 9184, 1082, 649, 10346, 725, 9184, 9184, 70, -1168, 804, -1168, -1168, -1168, -1168, 280, 602, 745, 790, 818, 911, 937, 972, 1048, 10346, 906, -1168, -1168, 906, -1168, 9184, 10801, 336, 1091, 1214, 1093, 5, 9184, -41, -1168, 70, 1926, 1094, 1095, 1061, 1926, 1243, 9, 1097, 1106, 1071, -1168, -1168, 69, 69, -1168, -1168, 1104, 906, -1168, 9184, 38, 1926, 1116, -1168, 1117, 1926, -1168, -1168, 260, 264, 906, 9184, 10346, 10346, -1168, 10346, 9184, 9, 0, 10346, 52, 10346, 9184, 1119, 10346, 1120, 10346, 10346, 9, 10346, 10346, 10346, 10346, 10346, 9, 10346, 10346, 10346, 10346, 9, -1168, 906, 10346, 10346, 10346, 9, 10346, 9, 82, 10346, 10346, 10346, 10346, 9, 10346, 10346, 9, 10346, 9, 10346, 10346, 10346, 9, 10346, 1121, 10346, 9184, 1142, 9, 10346, 10346, 10346, 1143, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 9, 10346, 10346, 10346, 10346, 10346, 10346, 9, 10346, 122, 10346, 1145, 10346, 10346, 133, 10346, 166, 10346, 9, 10346, 9, 10346, 1159, 9402, 9620, 189, 9184, 9184, 9184, 9184, 9184, 9184, 10346, 9184, 9184, 9184, 10346, 12, -3, 906, 10346, 10346, 1284, 1284, 1284, 3450, 10346, 195, 1164, 10346, -1168, -1168, 1279, 9184, 10346, -1168, 1926, 1187, 9184, 906, 1196, 1329, 9184, 39, -1168, -1168, -1168, -1168, 9184, 9184, 610, 9184, 2146, 2146, 660, 660, -1168, 10346, 190, 191, 1184, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 193, 10346, 10346, 10346, 10346, 10346, 9184, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, -1168, 10346, 10346, 10346, 1198, 10346, 10346, 10346, 10346, 10346, 9184, 10346, 9184, 9184, 10346, 10346, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 2146, 9184, 9184, 9184, 9184, 9184, 3724, 10346, 10346, 10346, 10346, 10346, 9184, 9184, 9184, 3947, 9184, 10346, 9184, 10346, 9184, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 10346, 2146, 10346, 1201, 1202, 10346, 1284, 10346, 1284, 10346, 1205, 9, 10346, 10467, 906, 10346, -1168, 90, 3653, 10346, 10346, 10346, 10346, 10346, 10346, 10346, -1168, -1168, -1168, -1168, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 9184, 1215, 1219, 1220, -1168, 1225, 1228, 1234, -1168, 29, 1242, 1244, 70, 1926, 1431, 92, 1441, 10801, 9184, 1264, 10346, -1168, -1168, 9184, 70, 49, 294, 1275, 10, -1168, 1494, -41, -1168, -1168, 663, 9184, -1168, -1168, 9184, -1168, -1168, 262, -1168, -1168, 37, 1926, 639, 10346, 9184, 9, 906, 286, 906, 1273, 9184, 10346, 287, 10346, 319, 1274, 10346, 344, 10346, 906, 345, 9184, 906, 348, 349, 906, 372, 9184, 906, 374, 375, 377, 9184, 405, 416, 421, 9184, 424, 9184, 10346, 443, 906, 446, 496, 9184, 906, 906, 9184, 497, 9184, 498, 501, 502, 9184, 515, 10346, 906, 407, 1271, 9, 10346, 9184, 516, 529, 532, 10346, 906, 533, 534, 906, 558, 559, 572, 9184, 583, 906, 588, 594, 597, 606, 9184, 616, 10346, 619, 10346, 906, 624, 10346, 632, 9184, 633, 9184, 634, 9184, 635, 10346, 9184, 1926, 9184, 1926, 10346, 9, 1278, 1286, 482, 1288, 13, 1287, 906, 1289, 9, 1292, 636, 10346, 9184, 9184, 637, 686, 1327, 1306, 1315, 1325, -1168, 9814, 30, 9184, 9184, 906, -1168, 1926, 906, 729, -1168, 70, 1926, 1340, -1168, -1168, -1168, 10056, 1330, -1168, -1168, 1347, 1356, 1367, 1389, 1456, 76, 1341, 1370, 1372, 1383, 1388, 1399, 1402, 1413, 694, 10346, 10346, 10346, 906, 906, 696, 906, 906, 697, 906, 10346, 906, 706, 710, 718, 906, 1668, 722, 734, 735, 736, 906, 746, 758, 906, 760, 906, 906, 763, 779, 906, 10346, 906, 802, 821, 825, 906, 1756, 9, 906, 592, 1415, 1780, 826, 844, 10177, 10298, 10419, 10540, 11853, 815, 11876, 949, 11887, 11898, 1401, 11909, 11920, 11931, 11942, 1993, -1168, 11953, 62, 104, 855, 870, 882, 2006, 2315, 1018, -1168, 11998, 12015, 156, 12115, -150, 12126, 164, 174, 244, 334, 353, 900, 902, 357, 371, 466, 1433, -99, -1168, -1168, 903, -44, 927, 241, 929, -1168, 9184, 390, 2566, 906, 906, -1168, -1168, 906, 906, 906, 906, 906, 906, -1168, 118, 118, 9184, 9184, 1830, 418, 1309, 409, -9, 145, -1168, -43, -43, 1575, 1575, -1168, -1168, 280, -1168, -1168, 602, -1168, -1168, -1168, 1470, -1168, -1168, -1168, -1168, 1615, 2327, 9184, -18, 12137, 10588, -1168, -1168, 9184, 9184, -1168, -1168, 9184, -1168, 836, -1168, 1443, 1445, 1442, 1447, 1926, 1453, 1484, 1489, -1168, -1168, -1168, 1605, 1611, 931, 2340, 9184, 10346, 10346, 1468, 932, 9184, 940, 9184, 10346, 955, 9184, 961, 9184, 1496, 9184, 9184, 9184, 1498, 10346, 9184, 9184, 1499, 10346, 10346, 9184, 1500, 9184, 1501, 906, 10346, 10346, 10346, 1514, 1524, 10346, 1526, 10346, 9184, 9184, 1537, 10346, 966, 10346, 9184, 9184, 906, 1540, 10346, 10346, 9184, 969, 10346, 9184, 9184, 10346, 10346, 1550, 10346, 9184, 9184, 10346, 9184, 1568, 9184, 906, 10346, 977, 10346, 979, 10346, 2356, 10346, 1571, 9184, 1574, 9184, 980, 12160, 12177, 982, 9184, 10346, 9184, 9184, 10346, 10346, 9184, 10346, 9184, 9184, 9184, 10346, 988, 1576, 2392, 10346, 10346, -1168, 9184, 9184, 9184, -1168, -1168, 70, 1926, 70, 1926, 10801, -1168, -1168, -1168, 9184, 9184, -1168, 9184, -1168, -1168, 9184, 9184, 9184, -1168, 10346, 10346, -1168, 1557, 1581, -1168, -1168, 9184, 9184, 10346, 992, 994, 425, 9184, 9184, 996, 9184, 10346, 10346, 9184, 10346, 10346, 10346, 10346, 9184, 10346, 9184, 10346, 10346, 1002, 10346, 9184, 10346, 9184, 9184, 10346, 10346, 9184, 10346, 10346, -1168, -1168, -1168, -1168, -1168, -1168, 9184, -1168, -1168, 9184, -1168, -1168, -1168, -1168, -1168, -1168, -1168, 9184, -1168, -1168, -1168, 9184, 9184, 9184, 9184, 9184, -1168, 10346, -1168, -1168, -1168, -1168, -1168, 9184, -1168, -1168, -1168, -1168, -1168, -1168, 10346, 10346, -1168, -1168, -1168, -1168, -1168, 10346, 1804, -1168, 10346, 1804, -1168, 10346, 10346, 1588, -1168, -1168, -1168, 1593, -1168, 1604, 610, 1860, 1607, 1609, -1168, 1618, 1619, -1168, -1168, 841, 10801, -1168, 9184, 2565, 1797, 10346, -1168, 10346, 906, 70, 49, 2614, 836, 836, 12188, 1612, 1630, -1168, 1628, -1168, -1168, -1168, -1168, 10346, -1168, -1168, 2146, 2146, 10346, 10346, 1629, 1008, 1022, 10346, 10346, 700, 2666, 10346, 1926, 1024, 10346, 1926, 10346, 830, 1926, 10346, 70, 2741, 70, 1926, 1926, 10346, 906, 1926, 1926, 10346, 1028, 1037, 842, 1926, 10346, 926, 2813, 10346, 1042, 906, 1052, 10346, 10346, 1054, 10346, 906, 1926, 1926, 10346, 1055, 10346, 1056, 1026, 1632, 10346, 1060, 1064, 2835, 10346, 1065, 1096, 1926, 1926, 906, 906, 10346, 1070, 2857, 1926, 1125, 1926, 10346, 2877, 906, 10346, 1140, 10346, 1141, 10346, 1144, 10346, 1926, 10346, 1926, 10346, 2953, 2953, 10346, 1633, 906, 2936, 1259, 3054, 906, 1146, 1635, 1154, 3099, 1637, 1639, 906, 10346, 10346, 9184, 906, 1165, 1642, 12199, 12210, 1046, -1168, 1645, -1168, 552, 10801, 12221, 12232, 12243, 12254, 429, -6, -1168, -1168, 12299, 12322, 906, 10346, 10346, -1168, 1926, 1926, 10346, 70, 1926, 1169, 906, 3125, 1174, 906, 906, 906, 1926, 1177, 3139, 906, 906, 10346, 906, 1926, 906, 3190, 1644, 1180, 1183, 24, 906, 906, 12416, 12427, 12438, 12461, 12484, 1074, 12495, 12506, 3, 12517, 53, 131, 483, 265, 538, 284, 555, 580, 10346, 118, 118, -1168, -1168, -1168, -1168, -1168, 1816, 1837, 1833, 12528, 9184, 1651, 667, 152, -1168, 9184, -1168, -1168, -1168, -1168, -1168, -1168, 1652, 1653, 906, -1168, -1168, 906, 906, 10346, 9184, 10346, 1191, 906, 10346, 10346, 1193, 10346, 1197, 1246, 10346, 1251, 10346, 1257, 1267, 10346, 9184, 9184, 1269, 10346, 9184, 1277, 9184, 9184, 1314, 1317, 10346, 1318, 1319, 9184, 1328, 10346, 10346, 10346, 1333, 9184, 9184, 9184, 906, 9184, 10346, 1337, 9184, 9184, 9184, 1343, 9184, 1351, 9184, 1353, 9184, 906, 9184, 1363, 1364, 1365, 906, 10346, 10346, 10346, 9184, 10346, 10346, 10346, 9184, 10346, 9184, 1373, 1377, 1926, 10346, -1168, 1810, 1812, 1813, 9184, 885, 9184, 42, -1168, -1168, -1168, -1168, -1168, -1168, 10346, -1168, -1168, 906, 1385, 1403, 9184, 10346, 10346, 9184, 9184, 906, 10346, 10346, 10346, 10346, 9184, -1168, -1168, -1168, -1168, -1168, -1168, 9184, -1168, -1168, -1168, 10346, -1168, -1168, 9184, -1168, 9184, -1168, -1168, 10346, -1168, -1168, 10346, -1168, -1168, 1405, -1168, -1168, 9184, -1168, -1168, 1840, 843, 12539, 9184, 1835, 10346, 12550, 836, 1667, 1669, 836, -1168, -1168, 1421, 70, 3244, 1423, 10346, 1432, 906, 10346, 1434, 9184, 9184, 906, 10346, 906, 9184, 10346, 906, 3272, 1926, 10346, 1436, 10799, 10346, 70, 10895, 70, 1926, 9184, 10346, 906, 10346, 10346, 10906, 10346, 906, 906, 1437, 10346, 10921, 70, 10939, 10962, 1552, 10973, 906, 9184, 10984, 10995, 11006, 9184, 11017, 10346, 1569, 11028, 10346, 11039, 11084, 9184, 9184, 9184, 906, 906, 906, 11102, 1440, 1454, 906, 11202, 906, 1666, 10346, 10346, 1459, 10346, 10346, 10346, 12561, 1679, 1681, 315, -1168, 518, -1168, -1168, -1168, 668, 10346, 10346, 70, 1926, 1462, 906, 1926, 1926, 1465, 1473, 906, 906, 11213, 12600, 750, 12623, 12723, 807, 824, 10346, -1168, 10801, 9184, 1861, -1168, 1683, -1168, 11224, 1684, 847, -1168, -1168, -1168, -1168, -1168, 10346, 9184, 10346, 1479, 10346, 906, 10346, 11247, 11265, 1481, 11276, 1492, 9184, 1493, 9184, 9184, 1495, 9184, 11287, 906, 1504, 1522, 9184, 1530, 10346, 906, 9184, 9184, 9184, 9184, 9184, 11298, 9184, 9184, 9184, 11309, 9184, 1535, 10346, 10346, 1539, 9184, 9184, 11320, 11331, 11342, 9184, 10346, 10346, 10346, 9184, 906, 1543, 10346, 906, 906, 906, 1839, 1686, 1687, -1168, 885, 9184, -1168, -1168, 1548, 906, 10346, 10346, 10346, 9184, -1168, -1168, -1168, -1168, -1168, -1168, 906, 10801, 1878, 628, 10801, -1168, 10346, 9184, 9184, -1168, 1494, 906, 1926, 1553, 10346, 906, 1556, 10346, 10346, 10346, 10346, 10346, 11387, 9184, 1926, 1926, 10346, 11410, 10346, 9184, 10346, 11505, 10346, 906, 11516, 1926, 1926, 1926, 11527, 10346, 11550, 11573, 11584, 10346, 1926, 10346, 1561, 906, 10346, 1926, 1926, 9184, 10346, 9184, 11595, 906, 1566, 906, 1689, 10346, 906, 10346, -1168, -1168, 10801, -1168, 1926, 10801, 10346, 906, 906, 906, 12734, 1833, -1168, -1168, 1833, 1059, 165, 12745, 11606, 836, 10346, 906, 10346, 906, 906, 1570, 906, 906, 9184, 11617, 1572, 9184, 906, 11628, 906, 9184, 906, 9184, 9184, 906, 9184, 10346, 9184, 1580, 906, 10346, 906, 11639, 906, 11650, 10346, 10346, 10346, 906, 906, 57, 1833, 906, -1168, 10801, -1168, -1168, -1168, -1168, 10346, -1168, 9184, -1168, 1584, 1592, 10346, 1926, 9184, 10346, 1926, 10346, 1926, 1926, 1926, 1926, 906, 11690, 10346, 906, 10346, 9184, 906, 906, 906, -1168, -1168, -1168, 31, 1833, 878, 12762, 10346, 10346, 906, 11713, 906, 906, 9184, 906, 906, 11813, -1168, -1168, 1913, 1840, -1168, -1168, 906, 1608, 10346, 11824, 10346, -1168, -1168, -1168, 9184, 1610, 10346, 906, 11835, 10346, 906, 10346, 906, 906 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 7, 0, 0, 223, 478, 506, 511, 12, 0, 0, 0, 0, 24, 26, 456, 0, 0, 0, 0, 457, 19, 20, 489, 502, 0, 569, 48, 0, 57, 0, 220, 221, 0, 0, 0, 54, 0, 0, 0, 0, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, 0, 0, 0, 0, 4, 3, 8, 39, 41, 10, 22, 23, 21, 0, 14, 15, 18, 17, 16, 28, 29, 0, 440, 0, 440, 0, 0, 7, 433, 432, 30, 31, 38, 430, 322, 241, 431, 244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 416, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 264, 266, 0, 0, 0, 0, 0, 278, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 335, 316, 321, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 440, 440, 42, 458, 0, 7, 522, 0, 573, 0, 0, 549, 565, 50, 59, 58, 0, 0, 60, 222, 0, 0, 541, 543, 52, 539, 545, 0, 0, 546, 427, 53, 56, 55, 0, 0, 584, 0, 40, 0, 210, 9, 11, 0, 0, 224, 0, 0, 0, 209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 447, 301, 0, 442, 225, 0, 0, 0, 4, 440, 440, 32, 33, 0, 0, 307, 0, 0, 0, 0, 0, 389, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 280, 390, 0, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 36, 305, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 461, 462, 25, 459, 467, 468, 27, 465, 0, 0, 0, 494, 493, 0, 4, 0, 7, 0, 0, 0, 570, 571, 0, 552, 554, 45, 0, 0, 49, 567, 565, 440, 440, 0, 0, 232, 231, 0, 440, 440, 0, 429, 428, 0, 583, 0, 0, 0, 0, 88, 0, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 147, 0, 0, 68, 0, 0, 166, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 108, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 167, 0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 197, 0, 195, 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 231, 0, 0, 0, 0, 239, 0, 0, 0, 213, 0, 0, 0, 0, 194, 5, 302, 230, 0, 438, 445, 446, 441, 443, 439, 479, 0, 0, 513, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 287, 395, 0, 417, 402, 0, 418, 0, 403, 284, 0, 0, 400, 0, 0, 0, 0, 0, 396, 0, 419, 391, 0, 420, 294, 0, 0, 399, 0, 401, 0, 0, 0, 415, 0, 0, 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 265, 267, 0, 0, 0, 0, 0, 279, 0, 0, 0, 290, 291, 246, 336, 330, 332, 334, 331, 333, 329, 245, 0, 0, 0, 0, 309, 311, 313, 310, 312, 308, 327, 324, 323, 325, 326, 440, 440, 0, 440, 440, 0, 43, 44, 491, 495, 505, 504, 503, 516, 4, 0, 0, 0, 0, 0, 550, 46, 47, 0, 557, 559, 0, 568, 0, 51, 0, 0, 0, 0, 339, 0, 0, 0, 540, 547, 548, 0, 0, 234, 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 440, 0, 0, 0, 214, 215, 216, 217, 218, 219, 7, 453, 454, 448, 0, 0, 507, 0, 381, 277, 0, 0, 0, 382, 0, 0, 376, 0, 0, 317, 318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 340, 341, 342, 343, 344, 345, 0, 347, 348, 0, 350, 351, 314, 354, 355, 352, 353, 0, 357, 361, 362, 0, 0, 0, 0, 0, 251, 0, 256, 257, 363, 275, 364, 0, 276, 258, 259, 262, 260, 261, 0, 0, 263, 370, 372, 371, 268, 0, 0, 271, 0, 0, 273, 0, 0, 0, 282, 281, 585, 35, 587, 37, 306, 304, 0, 0, 460, 0, 0, 466, 492, 499, 7, 523, 0, 0, 574, 0, 572, 0, 555, 553, 554, 0, 0, 0, 0, 535, 537, 566, 532, 434, 436, 440, 440, 0, 542, 544, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 162, 0, 0, 163, 0, 144, 145, 0, 69, 0, 75, 76, 77, 0, 72, 74, 181, 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, 95, 96, 0, 0, 0, 0, 113, 114, 112, 0, 0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 149, 154, 156, 155, 158, 159, 0, 0, 0, 172, 0, 173, 0, 0, 176, 0, 0, 0, 180, 0, 0, 0, 203, 0, 191, 0, 198, 196, 0, 0, 115, 0, 102, 105, 103, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 207, 0, 0, 0, 0, 0, 6, 0, 444, 0, 7, 0, 0, 0, 0, 0, 0, 337, 338, 0, 0, 392, 0, 0, 283, 295, 298, 0, 286, 285, 405, 393, 0, 0, 423, 424, 404, 296, 0, 0, 397, 398, 0, 411, 412, 413, 339, 0, 409, 0, 0, 300, 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 463, 464, 469, 470, 496, 0, 0, 517, 0, 0, 0, 0, 0, 551, 0, 558, 560, 561, 440, 440, 533, 0, 0, 139, 235, 236, 233, 238, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 0, 240, 0, 0, 0, 0, 471, 0, 4, 514, 373, 374, 375, 383, 384, 0, 319, 320, 414, 0, 288, 0, 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 346, 349, 356, 247, 248, 250, 0, 359, 360, 252, 0, 365, 366, 0, 368, 0, 269, 378, 0, 270, 380, 0, 272, 315, 0, 586, 588, 0, 500, 490, 526, 576, 0, 0, 575, 0, 0, 0, 0, 0, 0, 435, 437, 0, 91, 0, 0, 0, 0, 182, 0, 0, 0, 0, 146, 0, 70, 0, 0, 122, 0, 123, 0, 0, 0, 0, 99, 0, 98, 97, 0, 0, 110, 0, 0, 0, 0, 135, 134, 0, 0, 0, 127, 130, 0, 0, 152, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 200, 0, 0, 0, 116, 117, 106, 0, 0, 0, 85, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 474, 475, 0, 472, 485, 510, 509, 508, 0, 0, 0, 407, 406, 0, 422, 421, 293, 0, 0, 408, 410, 0, 0, 0, 0, 0, 0, 0, 0, 497, 7, 0, 524, 580, 0, 577, 0, 0, 0, 563, 562, 536, 538, 534, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 0, 0, 0, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 228, 229, 227, 0, 0, 0, 449, 0, 0, 480, 385, 0, 289, 0, 0, 0, 0, 249, 253, 367, 369, 377, 379, 388, 7, 4, 530, 7, 518, 0, 0, 0, 556, 567, 61, 92, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 0, 188, 189, 0, 0, 0, 0, 0, 0, 0, 133, 0, 131, 143, 150, 0, 0, 0, 0, 0, 0, 165, 0, 0, 185, 0, 179, 201, 0, 0, 0, 0, 136, 0, 118, 0, 0, 206, 0, 476, 477, 7, 473, 486, 7, 0, 425, 386, 387, 0, 498, 531, 527, 525, 0, 0, 0, 0, 0, 0, 62, 0, 64, 65, 0, 67, 71, 0, 0, 0, 0, 94, 0, 111, 0, 204, 0, 0, 148, 0, 0, 0, 0, 175, 0, 184, 0, 202, 0, 0, 0, 0, 80, 226, 4, 481, 394, 274, 7, 520, 521, 519, 581, 0, 578, 0, 564, 0, 0, 0, 124, 0, 0, 100, 0, 205, 128, 151, 174, 169, 0, 0, 186, 0, 0, 104, 137, 119, 452, 451, 450, 0, 528, 0, 0, 0, 0, 66, 0, 187, 109, 0, 168, 199, 0, 484, 483, 487, 526, 582, 579, 160, 0, 0, 0, 0, 488, 482, 529, 0, 120, 0, 190, 0, 0, 170, 0, 121, 161 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -1168, -1168, -114, -1168, -1168, 881, -1168, -1168, -1168, -1168, -1168, -1168, 1882, -142, -1168, -1168, -332, -15, -1168, 1891, 1538, -1168, -1168, 1502, -430, 2793, -1168, 1334, -28, -5, -1168, 60, 71, -53, -1168, -1168, 892, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, 1049, -1168, 1045, -1168, 214, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, 414, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, -1168, 32, -1168, -1168, -1168, -1167, -1168, -1168, -1168, 1344, -1168, -1168, 767, 1357, -1168, -1168, -1168, -1168, -1168, 194, -1168, 41, -1168, -1168 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 91, 92, 409, 1039, 93, 231, 232, 872, 873, 254, 589, 94, 596, 95, 96, 721, 224, 225, 97, 262, 875, 874, 755, 756, 263, 227, 271, 228, 118, 260, 229, 230, 414, 415, 737, 738, 100, 733, 1302, 1805, 1894, 1042, 101, 561, 562, 565, 566, 1622, 1623, 102, 113, 1044, 1808, 1895, 1911, 1727, 1921, 103, 246, 896, 572, 1164, 1527, 1742, 1375, 1650, 104, 247, 899, 105, 114, 1305, 1627, 106, 115, 744, 107, 574, 1165, 1530, 1818, 1865, 108, 575, 1746, 1652, 1862, 1912, 1816, 1182, 1540, 1183, 266, 267, 273, 584, 907, 587, 1177, 1178, 1537, 1751, 588, 915, 253, 279, 1152, 1154 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 241, 420, 758, 244, 119, 120, 272, 594, 109, 579, 1384, 1385, 580, 256, 911, 585, 111, 912, 451, 594, 274, 277, 594, 594, 1, 2, 439, 287, 554, 242, 275, 121, 295, 297, 594, 124, 268, 470, 346, 318, 121, 433, 325, 1909, 124, 926, 249, 604, 442, 250, 251, 380, 288, 289, 366, 742, 1625, 371, 373, 417, 98, 553, 554, 382, 397, 456, 395, 396, 722, 723, 543, 99, 121, 1910, 404, 1125, 124, 1126, 280, 281, 1892, 743, 245, 398, 1626, 546, 547, 290, 347, 548, 549, 550, 551, 552, 553, 554, 416, 906, 243, 1893, 459, 285, 291, 537, 538, 539, 540, 541, 542, 452, 546, 547, 286, 381, 548, 549, 550, 551, 552, 553, 554, 543, 116, 435, 436, 117, 1139, 440, 1140, 445, 405, 897, 441, 573, 898, 537, 538, 539, 540, 541, 542, 537, 538, 539, 540, 541, 542, 434, 447, 443, 255, 471, 612, 448, 444, 537, 538, 539, 540, 541, 542, 292, 110, 623, 473, 369, 457, 474, 453, 629, 112, 458, 475, 399, 634, 98, 454, 407, 557, 558, 638, 1142, 640, 1143, 258, 259, 99, 586, 646, 568, 569, 649, 853, 651, 855, 423, 424, 655, 84, 85, 86, 460, 543, 663, 400, 532, 461, 1169, 535, 1170, 555, 556, 557, 558, 543, 675, 554, 543, 252, 1482, 543, 1483, 682, 543, 595, 567, 401, 613, 1509, 581, 1510, 570, 477, 693, 913, 695, 595, 478, 582, 715, 1017, 600, 601, 555, 556, 557, 558, 269, 270, 543, 543, 595, 716, 717, 863, 1034, 269, 270, 543, 402, 537, 538, 539, 540, 541, 542, 264, 265, 555, 556, 557, 558, 543, 543, 608, 609, 408, 610, 1512, 615, 1513, 614, 543, 616, 559, 560, 619, 1112, 621, 622, 543, 624, 625, 626, 627, 628, 543, 630, 631, 632, 633, 1052, 543, 1053, 635, 636, 637, 98, 639, 641, 543, 642, 643, 644, 645, 863, 647, 648, 99, 650, 403, 652, 653, 654, 543, 656, 406, 658, 659, 1113, 410, 664, 665, 666, 411, 668, 669, 670, 671, 672, 673, 674, 543, 676, 677, 678, 679, 680, 681, 684, 683, 543, 685, 543, 687, 688, 1514, 690, 1515, 692, 689, 694, 412, 696, 555, 556, 557, 558, 745, 746, 1660, 706, 543, 1663, 710, 419, 543, 863, 714, 1535, -515, 1123, 718, 719, 543, 543, 543, 858, 726, 1128, 1866, 729, 1867, 691, 543, 418, 732, 546, 547, 1129, 735, 548, 549, 550, 551, 552, 553, 554, 110, 543, 543, 543, 112, 543, 750, 543, 702, 760, 761, 759, 770, 421, 727, 763, 764, 765, 766, 767, 768, 769, 422, 771, 772, 773, 774, 775, 425, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 426, 788, 789, 790, 428, 792, 793, 794, 795, 796, 437, 799, 800, 901, 803, 804, 543, 932, 1145, 429, 1146, 1130, 751, 752, 537, 538, 539, 540, 541, 542, 552, 553, 554, 823, 824, 825, 826, 827, 551, 552, 553, 554, 1517, 834, 1518, 836, 430, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 849, 543, 543, 852, 1520, 854, 1521, 856, 933, 937, 859, 861, 431, 862, 976, 908, 909, 865, 866, 867, 868, 869, 870, 871, 1726, 815, 537, 538, 539, 540, 541, 542, 917, 918, 543, 1724, 432, 1725, 438, 923, 924, 939, 537, 538, 539, 540, 541, 542, 446, 543, 555, 556, 557, 558, 1131, 848, 1012, 1475, 904, 543, 543, 1018, 462, 543, 543, 1021, 942, 944, 543, 272, 946, 947, 543, 1132, 546, 547, 449, 1135, 548, 549, 550, 551, 552, 553, 554, 930, 543, 543, 463, 543, 543, 1136, 543, 936, 948, 938, 950, 951, 941, 952, 943, 563, 564, 116, 123, 543, 117, 125, 546, 547, 1149, 450, 548, 549, 550, 551, 552, 553, 554, 455, 543, 960, 543, 555, 556, 557, 558, 954, 127, 974, 98, 543, 555, 556, 557, 558, 543, 973, 955, 543, 543, 99, 977, 956, 543, 1319, 958, 982, 464, 1481, 1870, 1087, 537, 538, 539, 540, 541, 542, 543, 753, 754, 543, 919, 920, 996, 961, 998, 1815, 962, 1000, 548, 549, 550, 551, 552, 553, 554, 1008, 535, 469, 535, 543, 1011, 465, 546, 547, 1137, 466, 548, 549, 550, 551, 552, 553, 554, 1024, 140, 543, 543, 141, 233, 234, 468, 1516, 1015, 144, 1361, 1035, 1037, 1363, 235, 543, 543, 543, 928, 929, 543, 543, 963, 966, 968, 236, 237, 969, 970, 472, 153, 154, 1040, 1041, 543, 543, 555, 556, 557, 558, 158, 972, 979, 476, 1063, 1064, 1065, 479, 543, 480, 238, 543, 543, 543, 1068, 980, 165, 543, 981, 983, 984, 239, 1519, 481, 537, 538, 539, 540, 541, 542, 555, 556, 557, 558, 543, 1082, 482, 543, 543, 1522, 483, 186, 187, 188, 985, 986, 191, 192, 193, 484, 195, 543, 197, 198, 199, 200, 201, 202, 987, 543, 205, 485, 543, 208, 1523, 209, 210, 543, 212, 989, 214, 543, 216, 543, 990, 218, 543, 219, 1088, 221, 991, 544, 545, 992, 486, 543, 487, 240, 555, 556, 557, 558, 993, 1157, 1158, 543, 1160, 1161, 543, 1180, 1181, 488, 995, 543, 567, 997, 555, 556, 557, 558, 999, 543, 543, 543, 543, 543, 543, 531, 1001, 1003, 1005, 1007, 1023, 1027, 546, 547, 1151, 1153, 548, 549, 550, 551, 552, 553, 554, 546, 547, 1373, 1374, 548, 549, 550, 551, 552, 553, 554, 543, 543, 1620, 1621, 1173, 1534, 1728, 1174, 537, 538, 539, 540, 541, 542, 489, 1653, 1654, 490, 491, 543, 537, 538, 539, 540, 541, 542, 1028, 543, 492, 543, 543, 1196, 1197, 543, 1062, 1200, 1066, 1067, 1204, 543, 1402, 493, 1208, 543, 1211, 1213, 1069, 533, 1217, 494, 1070, 543, 1221, 1222, 1223, 543, 1226, 495, 1071, 1229, 1230, 1231, 1073, 496, 1234, 497, 1236, 543, 543, 543, 1240, 440, 1242, 1243, 1074, 1075, 1076, 1246, 1247, 543, 498, 1250, 1251, 543, 1254, 1255, 1077, 1257, 1736, 1297, 1260, 543, 499, 543, 500, 1264, 543, 1266, 1078, 1268, 1079, 1270, 501, 1080, 537, 538, 539, 540, 541, 542, 502, 1280, 543, 1282, 1284, 1285, 443, 1287, 503, 1081, 504, 1291, 505, 546, 547, 1295, 1296, 548, 549, 550, 551, 552, 553, 554, 506, 543, 555, 556, 557, 558, 543, 735, 1083, 507, 447, 1739, 508, 555, 556, 557, 558, 1310, 1311, 1098, 543, 1099, 509, 543, 543, 543, 1316, 1084, 1740, 543, 1376, 1085, 1091, 1323, 1325, 1326, 1408, 1328, 1329, 1330, 1331, 543, 1333, 543, 1335, 1336, 543, 1338, 1415, 1340, 1092, 1750, 1343, 1344, 543, 1346, 1347, 510, 546, 547, 511, 1114, 548, 549, 550, 551, 552, 553, 554, 543, 537, 538, 539, 540, 541, 542, 1115, 543, 98, 512, 1863, 543, 1913, 513, 1356, 1864, 546, 547, 1116, 99, 548, 549, 550, 551, 552, 553, 554, 1358, 1359, 543, 514, 543, 543, 457, 1360, 543, 1133, 1362, 1134, 1141, 1364, 1365, 1390, 1391, 546, 547, 515, 516, 548, 549, 550, 551, 552, 553, 554, 543, 543, 517, 543, 460, 543, 543, 1417, 1144, 1380, 1147, 1381, 1193, 1199, 543, 537, 538, 539, 540, 541, 542, 1202, 555, 556, 557, 558, 518, 1392, 1101, 543, 1102, 519, 1395, 1396, 520, 543, 1205, 1400, 1401, 474, 543, 1404, 1207, 543, 1406, 1476, 1407, 1241, 521, 1409, 1249, 543, 522, 543, 543, 1411, 543, 1499, 1265, 1412, 1267, 1275, 543, 1278, 1416, 523, 543, 1419, 543, 1292, 543, 1422, 1423, 1317, 1425, 1318, 543, 1322, 1426, 98, 1428, 524, 543, 1337, 1432, 525, 1393, 1394, 1436, 1398, 99, 555, 556, 557, 558, 1439, 543, 1119, 543, 1120, 543, 1443, 543, 1399, 1445, 1405, 1447, 1430, 1449, 1413, 1451, 543, 1452, 526, 1453, 477, 543, 1454, 1414, 555, 556, 557, 558, 1420, 577, 1472, 543, 1473, 543, 543, 543, 1465, 1466, 1421, 543, 1424, 1427, 1429, 543, 543, 527, 1433, 592, 720, 543, 1434, 1437, 555, 556, 557, 558, 1440, 599, 1505, 528, 1506, 1486, 1487, 546, 547, 530, 1488, 548, 549, 550, 551, 552, 553, 554, 576, 543, 578, 590, 591, 730, 597, 1494, 1438, 537, 538, 539, 540, 541, 542, 598, 602, 546, 547, 1538, 1539, 548, 549, 550, 551, 552, 553, 554, 605, 606, 543, 618, 620, 657, 546, 547, 1524, 1442, 548, 549, 550, 551, 552, 553, 554, 543, 543, 1525, 1526, 543, 98, 543, 1446, 1448, 662, 667, 1450, 686, 1459, 543, 549, 99, 551, 552, 553, 554, 1461, 1543, 1544, 1546, 543, 697, 1548, 1549, 543, 1551, 728, 1468, 1554, 543, 1556, 1489, 543, 1559, 740, 543, 1491, 1563, 543, 1492, 1566, 1568, 1497, 762, 1572, 1498, 543, 734, 543, 1577, 1578, 1579, 543, 1547, 1582, 1550, 739, 1585, 1587, 1552, 791, 850, 851, 546, 547, 857, 1595, 548, 549, 550, 551, 552, 553, 554, 887, 1603, 1604, 1605, 888, 1607, 1608, 1609, 889, 1611, 890, 546, 547, 891, 1615, 548, 549, 550, 551, 552, 553, 554, 892, 555, 556, 557, 558, 543, 893, 1628, 894, 593, 543, 895, 1553, 1631, 1633, 1634, 543, 1555, 543, 1637, 1638, 1639, 1640, 1557, 900, 1457, 543, 903, 543, 555, 556, 557, 558, 1558, 1643, 1562, 543, 975, 910, 934, 940, 914, 1646, 1565, 1013, 1647, 555, 556, 557, 558, 1163, 570, 1014, 1019, 1016, 1020, 546, 547, 1022, 1658, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 1667, 1030, 543, 1669, 1743, 543, 543, 543, 1673, 1570, 1031, 1675, 1571, 1573, 1574, 1677, 543, 226, 1680, 1029, 1032, 543, 1046, 1576, 1683, 543, 1684, 1685, 1580, 1687, 248, 543, 1588, 1689, 257, 1043, 1054, 261, 1592, 543, 1047, 543, 278, 278, 278, 282, 1594, 1701, 1597, 1048, 1704, 543, 543, 543, 555, 556, 557, 558, 1600, 1601, 1602, 543, 1049, 1055, 1056, 543, 1715, 1716, 1613, 1718, 1719, 1720, 1614, 543, 383, 1057, 555, 556, 557, 558, 1629, 1058, 1729, 1730, 1050, 537, 538, 539, 540, 541, 542, 543, 1059, 543, 1105, 278, 1814, 1060, 1630, 1817, 1648, 1741, 537, 538, 539, 540, 541, 542, 1061, 543, 1089, 543, 384, 385, 554, 413, 1664, 1752, 1666, 1754, 543, 1756, 543, 1757, 543, 543, 1138, 1668, 543, 1670, 1166, 1678, 1688, 386, 1186, 1711, 1184, 427, 1185, 1187, 387, 1774, 543, 555, 556, 557, 558, 543, 1188, 1712, 543, 1051, 1191, 543, 1717, 1787, 1788, 1731, 1192, 1858, 1732, 543, 1859, 1198, 1796, 1797, 1798, 543, 1733, 543, 1801, 388, 389, 390, 1755, 391, 1760, 1189, 98, 392, 543, 543, 1190, 543, 1810, 1811, 1812, 1762, 1764, 99, 1767, 1210, 543, 1216, 1220, 1225, 1228, 546, 547, 1770, 1819, 548, 549, 550, 551, 552, 553, 554, 1824, 1232, 543, 1826, 1827, 1828, 1829, 1830, 1896, 1771, 543, 1233, 1833, 1235, 1835, 543, 1837, 1773, 1839, 543, 534, 536, 1786, 543, 1239, 1842, 1789, 1245, 543, 1846, 1800, 1847, 543, 543, 1849, 1809, 543, 1256, 1851, 1693, 1823, 543, 1312, 1825, 571, 1856, 543, 1857, 1848, 543, 543, 583, 543, 1854, 1860, 1262, 1702, 1873, 1271, 1876, 543, 1273, 98, 1293, 543, 98, 1313, 1885, 1871, 754, 1872, 1899, 543, 99, 603, 1366, 99, 546, 547, 1900, 1367, 548, 549, 550, 551, 552, 553, 554, 543, 1883, 543, 1368, 1369, 1886, 1370, 1923, 1387, 1928, 1889, 1890, 1891, 546, 547, 1371, 1372, 548, 549, 550, 551, 552, 553, 554, 1897, 1379, 1388, 1389, 1397, 1528, 1901, 1431, 1455, 1903, 1460, 1904, 1463, 98, 1464, 1469, 98, 1474, 1906, 1496, 1907, 1529, -4, 1533, 99, 1541, 1542, 99, 1616, 660, 1617, 1618, 1915, 1916, 1651, 555, 556, 557, 558, 1657, 1661, 1714, 1662, 1072, 549, 550, 551, 552, 553, 554, 1924, 1722, 1926, 1723, 1745, 1747, 1749, 1802, 1929, 1803, 1804, 1931, -501, 1932, 1855, 1920, 699, 701, 1301, 546, 98, 283, 707, 548, 549, 550, 551, 552, 553, 554, 284, 99, 757, 1303, 927, 1162, 1159, 1806, 725, 1649, 1382, 925, 1922, 1822, 916, 0, 731, 0, 0, 0, 0, 736, 0, 0, 0, 741, 0, 0, 0, 0, 0, 747, 748, 0, 749, 278, 278, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1086, 0, 0, 0, 546, 547, 776, 0, 548, 549, 550, 551, 552, 553, 554, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1090, 0, 0, 0, 797, 0, 0, 802, 0, 0, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 278, 816, 817, 818, 819, 820, 822, 0, 0, 0, 0, 0, 828, 829, 830, 832, 833, 0, 835, 0, 837, 0, 555, 556, 557, 558, 0, 546, 547, 0, 278, 548, 549, 550, 551, 552, 553, 554, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 555, 556, 557, 558, 0, 0, 0, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 902, 0, 0, 0, 0, 905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 931, 555, 556, 557, 558, 121, 122, 123, 0, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1110, 133, 0, 0, 134, 555, 556, 557, 558, 1002, 0, 135, 136, 1117, 137, 0, 1009, 0, 1010, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 1026, 0, 146, 0, 147, 0, 148, 0, 149, 0, 1036, 1038, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 0, 0, 0, 223, 0, 0, 0, 276, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 1155, 1156, 0, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1168, 0, 0, 0, 0, 0, 1175, 1176, 0, 0, 1179, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1201, 0, 1203, 0, 0, 1206, 0, 1209, 0, 1212, 1214, 1215, 0, 0, 1218, 1219, 0, 0, 0, 1224, 0, 1227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1237, 1238, 0, 0, 0, 0, 921, 0, 0, 0, 0, 0, 1248, 0, 0, 1252, 1253, 0, 0, 0, 0, 1258, 1259, 0, 1261, 0, 1263, 555, 556, 557, 558, 0, 0, 0, 0, 1118, 1272, 0, 1274, 555, 556, 557, 558, 0, 0, 1281, 1283, 1167, 0, 0, 0, 1288, 555, 556, 557, 558, 0, 0, 0, 0, 1194, 1298, 1299, 1300, 123, 0, 0, 125, 555, 556, 557, 558, 0, 0, 736, 1304, 1269, 1306, 0, 0, 1307, 1308, 1309, 0, 0, 0, 0, 0, 127, 0, 0, 1314, 1315, 0, 0, 0, 0, 1320, 1321, 0, 1324, 0, 0, 1327, 555, 556, 557, 558, 1332, 0, 1334, 0, 1294, 0, 0, 1339, 0, 1341, 0, 546, 547, 1345, 0, 548, 549, 550, 551, 552, 553, 554, 1348, 0, 0, 1349, 0, 0, 0, 0, 0, 0, 0, 1350, 0, 0, 0, 1351, 1352, 1353, 1354, 1355, 0, 0, 0, 0, 0, 0, 140, 1357, 0, 141, 233, 234, 0, 0, 0, 144, 0, 0, 546, 547, 235, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 236, 237, 0, 0, 0, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 158, 0, 1377, 0, 0, 0, 0, 0, 0, 0, 238, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 546, 547, 278, 278, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 555, 556, 557, 558, 0, 0, 240, 1150, 1378, 0, 0, 0, 0, 0, 0, 0, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1467, 555, 556, 557, 558, 0, 0, 294, 0, 1383, 300, 302, 305, 311, 316, 0, 322, 324, 0, 330, 333, 335, 339, 341, 344, 345, 0, 349, 357, 364, 0, 368, 0, 0, 0, 375, 377, 379, 0, 0, 0, 394, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 0, 0, 0, 0, 1403, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1532, 0, 546, 547, 0, 1536, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 1545, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 467, 1560, 1561, 0, 0, 1564, 0, 1567, 1569, 555, 556, 557, 558, 0, 1575, 0, 0, 1410, 0, 0, 1581, 1583, 1584, 0, 1586, 0, 0, 1589, 1590, 1591, 0, 1593, 0, 1596, 0, 1598, 0, 1599, 0, 0, 0, 0, 0, 0, 0, 1606, 546, 547, 0, 1610, 548, 549, 550, 551, 552, 553, 554, 0, 0, 529, 1619, 0, 1624, -336, -336, 0, 0, -336, -336, -336, -336, -336, -336, -336, 0, 0, 1632, 0, 0, 1635, 1636, 555, 556, 557, 558, 0, 1641, 0, 0, 1418, 0, 0, 0, 1642, 0, 0, 0, 0, 0, 0, 1644, 0, 1645, 555, 556, 557, 558, 0, 0, 0, 0, 1435, 0, 0, 571, 0, 0, 0, 0, 0, 1656, 0, 0, 0, 0, 555, 556, 557, 558, 0, 607, 0, 0, 1441, 0, 611, 0, 0, 0, 1671, 1672, 617, 0, 0, 1674, 555, 556, 557, 558, 0, 0, 0, 0, 1444, 0, 0, 0, 1682, 0, 0, 0, 0, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 1695, 0, 0, 0, 1699, 0, 0, 0, 0, 0, 661, 0, 1707, 1708, 1709, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1456, 548, 549, 550, 551, 552, 553, 554, 0, -336, -336, -336, -336, 703, 704, 705, 0, 708, 709, 0, 711, 712, 713, 546, 547, 0, 1744, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 546, 547, 0, 1753, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 1763, 0, 1765, 1766, 0, 1768, 0, 0, 0, 0, 1772, 0, 0, 0, 1775, 1776, 1777, 1778, 1779, 0, 1781, 1782, 1783, 0, 1785, 0, 0, 0, 0, 1790, 1791, 0, 0, 0, 1795, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 1807, 0, 798, 0, 801, 0, 0, 0, 1813, 555, 556, 557, 558, 0, 0, 0, 0, 1458, 0, 0, 0, 0, 1820, 1821, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1832, 0, 0, 546, 547, 0, 1836, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1462, 0, 0, 0, 1850, 0, 1852, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 0, 0, 0, 0, 1490, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1493, 0, 0, 1874, 0, 0, 1877, 0, 0, 0, 1879, 0, 1880, 1881, 0, 1882, 0, 1884, 0, 0, 0, 0, 0, 922, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 935, 0, 1898, 0, 555, 556, 557, 558, 1902, 0, 0, 945, 1495, 0, 0, 0, 0, 949, 0, 0, 0, 1908, 953, 0, 0, 0, 957, 0, 959, 0, 0, 0, 0, 0, 964, 0, 0, 965, 1918, 967, 0, 0, 0, 971, 0, 0, 0, 0, 121, 122, 123, 978, 124, 125, 0, 0, 1927, 0, 555, 556, 557, 558, 0, 988, 0, 0, 1665, 0, 0, 0, 994, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 1004, 0, 1006, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1025, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 1148, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 0, 0, 0, 223, 724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 1195, 0, 121, 122, 123, 0, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 1279, 0, 0, 0, 135, 136, 1286, 137, 0, 1289, 1290, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 555, 556, 557, 558, 0, 165, 864, 0, 1342, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 0, 0, 0, 223, 821, 121, 122, 123, 0, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 0, 0, 0, 223, 831, 121, 122, 123, 0, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 1612, 137, 0, 0, 350, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 351, 352, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 353, 0, 153, 154, 0, 0, 354, 155, 355, 356, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 359, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 360, 361, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 1799, 0, 150, 151, 152, 362, 0, 0, 153, 154, 0, 0, 363, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 306, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 307, 308, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 309, 0, 153, 154, 0, 0, 310, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 312, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 313, 314, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 315, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 326, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 327, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 328, 0, 0, 144, 145, 0, 0, 329, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 320, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 321, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 336, 337, 0, 144, 145, 0, 0, 338, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 298, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 299, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 303, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 304, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 331, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 332, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 342, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 343, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 293, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 301, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 323, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 334, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 340, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 348, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 367, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 374, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 376, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 378, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 393, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 223, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 0, 153, 154, 0, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 0, 222, 0, 121, 122, 123, 698, 124, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, 134, 0, 0, 0, 0, 0, 0, 135, 136, 0, 137, 0, 0, 0, 0, 138, 0, 0, 139, 140, 0, 0, 141, 142, 143, 0, 0, 0, 144, 145, 0, 0, 0, 146, 0, 147, 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, 0, 0, 123, 153, 154, 125, 0, 0, 155, 0, 0, 156, 157, 158, 159, 0, 160, 161, 162, 0, 0, 0, 163, 164, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 0, 209, 210, 211, 212, 213, 214, 215, 216, 0, 217, 218, 0, 219, 220, 221, 0, 140, 222, 0, 141, 233, 234, 700, 0, 0, 144, 0, 0, 0, 296, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 0, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 0, 0, 0, 158, 0, 0, 0, 0, 0, 0, 317, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1033, 186, 187, 188, 365, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 0, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 370, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1045, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 372, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1093, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 0, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1094, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 240, 0, 0, 144, 0, 0, 0, 0, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 123, 153, 154, 125, 0, 0, 0, 0, 546, 547, 0, 158, 548, 549, 550, 551, 552, 553, 554, 0, 0, 238, 0, 0, 127, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1095, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 0, 140, 0, 0, 141, 233, 234, 860, 0, 0, 144, 0, 0, 0, 0, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 237, 0, 0, 0, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 238, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1096, 186, 187, 188, 0, 0, 191, 192, 193, 0, 195, 0, 197, 198, 199, 200, 201, 202, 0, 0, 205, 0, 0, 208, 0, 209, 210, 0, 212, 0, 214, 0, 216, 0, 0, 218, 0, 219, 0, 221, 1, 2, 3, 0, 0, 4, 0, 1172, 0, 5, 0, 6, 0, 7, 8, 9, 10, 11, -455, 0, 12, 13, 14, 15, 16, 17, 18, 19, 0, 20, 21, 22, 0, 0, 0, 0, 23, 0, 0, 24, 0, 0, 0, 0, 0, 25, 26, 27, 28, 29, 30, 31, 0, 0, 32, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 33, 34, 35, 36, 37, 38, 0, 0, 0, 0, 39, 40, 41, 0, 0, 42, 43, 0, 0, 44, 0, 45, 0, 46, 47, 48, 49, 50, 51, 52, 53, 0, 0, 54, 0, 55, 56, 57, 0, 58, 0, 59, 60, 61, 62, 63, 64, 65, 0, 66, 67, 68, 0, 0, 69, 70, 71, 0, 72, 0, 73, 0, 0, 74, 75, 0, 76, 0, 0, 0, 77, 0, 0, 78, 0, 79, 80, 0, 0, 0, 0, 0, 81, 546, 547, 82, 83, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 84, 85, 86, 546, 547, 0, 87, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 88, 546, 547, 89, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 90, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1679, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1681, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1686, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1690, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1691, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1692, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1694, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1696, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1697, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1698, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1700, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1703, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1705, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1706, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1710, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1713, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1734, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1748, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1758, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1759, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1761, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1769, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1780, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1784, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1792, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1793, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1794, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1831, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1834, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1838, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1840, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1841, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1843, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1844, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1845, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1853, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1869, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1875, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1878, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1887, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1888, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1905, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1917, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1919, 0, 0, 555, 556, 557, 558, 0, 0, 0, 0, 1925, 0, 0, 555, 556, 557, 558, 0, 546, 547, 0, 1930, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 546, 547, 1097, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1100, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1103, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1104, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1106, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1107, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1108, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1109, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1111, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1121, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 546, 547, 1122, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1124, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1127, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1171, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1276, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 0, 1277, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1386, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1470, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1471, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1477, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1478, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1479, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1480, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1484, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1485, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 0, 0, 1500, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1501, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1502, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1503, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1504, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1507, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1508, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1511, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1531, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1655, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1659, 0, 0, 0, 0, 555, 556, 557, 558, 546, 547, 1721, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 546, 547, 0, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 555, 556, 557, 558, 546, 547, 1735, 0, 548, 549, 550, 551, 552, 553, 554, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1737, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1738, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1861, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1868, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 558, 0, 0, 1914 }; static const yytype_int16 yycheck[] = { 15, 115, 432, 18, 9, 10, 34, 10, 70, 4, 1177, 1178, 7, 28, 4, 56, 70, 7, 60, 10, 35, 36, 10, 10, 4, 5, 112, 42, 71, 224, 35, 3, 47, 48, 10, 7, 8, 104, 60, 54, 3, 112, 57, 12, 7, 8, 56, 9, 112, 59, 60, 82, 75, 76, 69, 16, 14, 72, 73, 112, 0, 70, 71, 78, 91, 112, 81, 82, 400, 401, 220, 0, 3, 42, 89, 225, 7, 227, 37, 38, 23, 42, 26, 110, 42, 61, 62, 110, 110, 65, 66, 67, 68, 69, 70, 71, 111, 48, 224, 42, 112, 41, 57, 65, 66, 67, 68, 69, 70, 151, 61, 62, 41, 144, 65, 66, 67, 68, 69, 70, 71, 220, 4, 138, 139, 7, 225, 213, 227, 144, 89, 39, 218, 247, 42, 65, 66, 67, 68, 69, 70, 65, 66, 67, 68, 69, 70, 218, 213, 213, 50, 218, 294, 218, 218, 65, 66, 67, 68, 69, 70, 94, 224, 305, 210, 129, 213, 213, 210, 311, 224, 218, 218, 224, 316, 115, 218, 0, 221, 222, 322, 225, 324, 227, 4, 5, 115, 228, 330, 242, 243, 333, 524, 335, 526, 33, 34, 339, 178, 179, 180, 213, 220, 345, 224, 220, 218, 225, 223, 227, 219, 220, 221, 222, 220, 357, 71, 220, 228, 225, 220, 227, 364, 220, 227, 240, 224, 227, 225, 224, 227, 246, 213, 375, 224, 377, 227, 218, 253, 227, 227, 269, 270, 219, 220, 221, 222, 219, 220, 220, 220, 227, 394, 395, 225, 225, 219, 220, 220, 224, 65, 66, 67, 68, 69, 70, 4, 5, 219, 220, 221, 222, 220, 220, 289, 290, 42, 292, 225, 227, 227, 296, 220, 298, 4, 5, 301, 225, 303, 304, 220, 306, 307, 308, 309, 310, 220, 312, 313, 314, 315, 225, 220, 227, 319, 320, 321, 247, 323, 227, 220, 326, 327, 328, 329, 225, 331, 332, 247, 334, 224, 336, 337, 338, 220, 340, 110, 342, 343, 225, 70, 346, 347, 348, 70, 350, 351, 352, 353, 354, 355, 356, 220, 358, 359, 360, 361, 362, 363, 227, 365, 220, 367, 220, 369, 370, 225, 372, 227, 374, 227, 376, 22, 378, 219, 220, 221, 222, 421, 422, 1537, 386, 220, 1540, 389, 224, 220, 225, 393, 227, 44, 225, 397, 398, 220, 220, 220, 529, 403, 225, 225, 406, 227, 227, 220, 4, 411, 61, 62, 225, 415, 65, 66, 67, 68, 69, 70, 71, 224, 220, 220, 220, 224, 220, 429, 220, 227, 227, 227, 434, 227, 224, 227, 438, 439, 440, 441, 442, 443, 444, 224, 446, 447, 448, 449, 450, 224, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 224, 464, 465, 466, 224, 468, 469, 470, 471, 472, 212, 474, 475, 575, 477, 478, 220, 607, 225, 224, 227, 225, 429, 430, 65, 66, 67, 68, 69, 70, 69, 70, 71, 496, 497, 498, 499, 500, 68, 69, 70, 71, 225, 506, 227, 508, 224, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 220, 220, 523, 225, 525, 227, 527, 227, 227, 530, 531, 224, 533, 661, 226, 227, 537, 538, 539, 540, 541, 542, 543, 11, 489, 65, 66, 67, 68, 69, 70, 590, 591, 220, 225, 224, 227, 213, 597, 598, 227, 65, 66, 67, 68, 69, 70, 218, 220, 219, 220, 221, 222, 225, 519, 703, 10, 578, 220, 220, 708, 213, 220, 220, 712, 227, 227, 220, 602, 227, 227, 220, 225, 61, 62, 218, 225, 65, 66, 67, 68, 69, 70, 71, 605, 220, 220, 217, 220, 220, 225, 220, 613, 227, 615, 227, 227, 618, 227, 620, 4, 5, 4, 5, 220, 7, 8, 61, 62, 225, 218, 65, 66, 67, 68, 69, 70, 71, 218, 220, 641, 220, 219, 220, 221, 222, 227, 29, 227, 575, 220, 219, 220, 221, 222, 220, 657, 227, 220, 220, 575, 662, 227, 220, 225, 227, 667, 218, 225, 1822, 798, 65, 66, 67, 68, 69, 70, 220, 4, 5, 220, 4, 5, 684, 227, 686, 44, 227, 689, 65, 66, 67, 68, 69, 70, 71, 697, 698, 139, 700, 220, 702, 218, 61, 62, 225, 218, 65, 66, 67, 68, 69, 70, 71, 715, 97, 220, 220, 100, 101, 102, 218, 225, 227, 106, 1141, 727, 728, 1144, 111, 220, 220, 220, 80, 81, 220, 220, 227, 227, 227, 122, 123, 227, 227, 143, 127, 128, 4, 5, 220, 220, 219, 220, 221, 222, 137, 227, 227, 224, 760, 761, 762, 224, 220, 224, 147, 220, 220, 220, 770, 227, 153, 220, 227, 227, 227, 158, 225, 224, 65, 66, 67, 68, 69, 70, 219, 220, 221, 222, 220, 791, 224, 220, 220, 225, 224, 178, 179, 180, 227, 227, 183, 184, 185, 224, 187, 220, 189, 190, 191, 192, 193, 194, 227, 220, 197, 224, 220, 200, 225, 202, 203, 220, 205, 227, 207, 220, 209, 220, 227, 212, 220, 214, 227, 216, 227, 18, 19, 227, 224, 220, 224, 224, 219, 220, 221, 222, 227, 887, 888, 220, 890, 891, 220, 4, 5, 224, 227, 220, 860, 227, 219, 220, 221, 222, 227, 220, 220, 220, 220, 220, 220, 209, 227, 227, 227, 227, 227, 227, 61, 62, 872, 873, 65, 66, 67, 68, 69, 70, 71, 61, 62, 37, 38, 65, 66, 67, 68, 69, 70, 71, 220, 220, 4, 5, 906, 225, 225, 909, 65, 66, 67, 68, 69, 70, 224, 59, 60, 224, 224, 220, 65, 66, 67, 68, 69, 70, 227, 220, 224, 220, 220, 933, 934, 220, 227, 937, 227, 227, 940, 220, 227, 224, 944, 220, 946, 947, 227, 209, 950, 224, 227, 220, 954, 955, 956, 220, 958, 224, 227, 961, 962, 963, 227, 224, 966, 224, 968, 220, 220, 220, 972, 213, 974, 975, 227, 227, 227, 979, 980, 220, 224, 983, 984, 220, 986, 987, 227, 989, 225, 1029, 992, 220, 224, 220, 224, 997, 220, 999, 227, 1001, 227, 1003, 224, 227, 65, 66, 67, 68, 69, 70, 224, 1013, 220, 1015, 1016, 1017, 213, 1019, 224, 227, 224, 1023, 224, 61, 62, 1027, 1028, 65, 66, 67, 68, 69, 70, 71, 224, 220, 219, 220, 221, 222, 220, 1043, 227, 224, 213, 225, 224, 219, 220, 221, 222, 1053, 1054, 225, 220, 227, 224, 220, 220, 220, 1062, 227, 225, 220, 1165, 227, 227, 1069, 1070, 1071, 227, 1073, 1074, 1075, 1076, 220, 1078, 220, 1080, 1081, 220, 1083, 227, 1085, 227, 225, 1088, 1089, 220, 1091, 1092, 224, 61, 62, 224, 227, 65, 66, 67, 68, 69, 70, 71, 220, 65, 66, 67, 68, 69, 70, 227, 220, 1039, 224, 42, 220, 225, 224, 1120, 47, 61, 62, 227, 1039, 65, 66, 67, 68, 69, 70, 71, 1133, 1134, 220, 224, 220, 220, 213, 1140, 220, 227, 1143, 227, 227, 1146, 1147, 1186, 1187, 61, 62, 224, 224, 65, 66, 67, 68, 69, 70, 71, 220, 220, 224, 220, 213, 220, 220, 227, 227, 1170, 227, 1172, 227, 227, 220, 65, 66, 67, 68, 69, 70, 227, 219, 220, 221, 222, 224, 1188, 225, 220, 227, 224, 1193, 1194, 224, 220, 227, 1198, 1199, 213, 220, 1202, 227, 220, 1205, 1305, 1207, 227, 224, 1210, 227, 220, 224, 220, 220, 1216, 220, 1345, 227, 1220, 227, 227, 220, 227, 1225, 224, 220, 1228, 220, 227, 220, 1232, 1233, 227, 1235, 227, 220, 227, 1239, 1165, 1241, 224, 220, 227, 1245, 224, 1191, 1192, 1249, 227, 1165, 219, 220, 221, 222, 1256, 220, 225, 220, 227, 220, 1262, 220, 227, 1265, 227, 1267, 227, 1269, 227, 1271, 220, 1273, 224, 1275, 213, 220, 1278, 227, 219, 220, 221, 222, 227, 56, 225, 220, 227, 220, 220, 220, 1292, 1293, 227, 220, 227, 227, 227, 220, 220, 224, 227, 227, 5, 220, 227, 227, 219, 220, 221, 222, 227, 227, 225, 224, 227, 1317, 1318, 61, 62, 224, 1322, 65, 66, 67, 68, 69, 70, 71, 224, 220, 224, 224, 224, 41, 224, 1337, 227, 65, 66, 67, 68, 69, 70, 224, 227, 61, 62, 1387, 1388, 65, 66, 67, 68, 69, 70, 71, 227, 227, 220, 227, 227, 227, 61, 62, 1366, 227, 65, 66, 67, 68, 69, 70, 71, 220, 220, 1367, 1368, 220, 1305, 220, 227, 227, 227, 227, 227, 227, 227, 220, 66, 1305, 68, 69, 70, 71, 227, 1397, 1398, 1399, 220, 227, 1402, 1403, 220, 1405, 227, 227, 1408, 220, 1410, 227, 220, 1413, 70, 220, 227, 1417, 220, 227, 1420, 1421, 227, 224, 1424, 227, 220, 225, 220, 1429, 1430, 1431, 220, 227, 1434, 227, 225, 1437, 1438, 227, 227, 225, 225, 61, 62, 225, 1446, 65, 66, 67, 68, 69, 70, 71, 224, 1455, 1456, 1457, 224, 1459, 1460, 1461, 227, 1463, 224, 61, 62, 224, 1468, 65, 66, 67, 68, 69, 70, 71, 227, 219, 220, 221, 222, 220, 225, 1483, 225, 227, 220, 41, 227, 1489, 1490, 1491, 220, 227, 220, 1495, 1496, 1497, 1498, 227, 44, 227, 220, 224, 220, 219, 220, 221, 222, 227, 1510, 227, 220, 227, 224, 227, 227, 8, 1518, 227, 227, 1521, 219, 220, 221, 222, 41, 1527, 227, 227, 227, 227, 61, 62, 227, 1535, 65, 66, 67, 68, 69, 70, 71, 219, 220, 221, 222, 1547, 227, 220, 1550, 1650, 220, 220, 220, 1555, 227, 227, 1558, 227, 227, 227, 1562, 220, 11, 1565, 224, 227, 220, 224, 227, 1571, 220, 1573, 1574, 227, 1576, 24, 220, 227, 1580, 28, 227, 227, 31, 227, 220, 225, 220, 36, 37, 38, 39, 227, 1594, 227, 225, 1597, 220, 220, 220, 219, 220, 221, 222, 227, 227, 227, 220, 227, 225, 224, 220, 1613, 1614, 227, 1616, 1617, 1618, 227, 220, 51, 224, 219, 220, 221, 222, 227, 225, 1629, 1630, 227, 65, 66, 67, 68, 69, 70, 220, 225, 220, 225, 89, 1742, 227, 227, 1745, 227, 1648, 65, 66, 67, 68, 69, 70, 227, 220, 227, 220, 89, 90, 71, 109, 227, 1664, 227, 1666, 220, 1668, 220, 1670, 220, 220, 225, 227, 220, 227, 47, 227, 227, 110, 224, 227, 225, 131, 225, 224, 117, 1688, 220, 219, 220, 221, 222, 220, 227, 227, 220, 227, 79, 220, 227, 1702, 1703, 227, 79, 1805, 227, 220, 1808, 227, 1711, 1712, 1713, 220, 227, 220, 1717, 148, 149, 150, 227, 152, 227, 225, 1650, 156, 220, 220, 225, 220, 1731, 1732, 1733, 227, 227, 1650, 227, 227, 220, 227, 227, 227, 227, 61, 62, 227, 1747, 65, 66, 67, 68, 69, 70, 71, 1755, 227, 220, 1758, 1759, 1760, 1761, 1762, 1862, 227, 220, 227, 1767, 227, 1769, 220, 1771, 227, 1773, 220, 222, 223, 227, 220, 227, 1780, 227, 227, 220, 1784, 227, 1786, 220, 220, 1789, 227, 220, 227, 1793, 227, 227, 220, 225, 227, 246, 1800, 220, 1802, 227, 220, 220, 253, 220, 227, 1809, 227, 227, 227, 227, 227, 220, 227, 1742, 227, 220, 1745, 225, 227, 1823, 5, 1825, 227, 220, 1742, 276, 227, 1745, 61, 62, 227, 227, 65, 66, 67, 68, 69, 70, 71, 220, 1844, 220, 227, 225, 1848, 225, 227, 224, 227, 1853, 1854, 1855, 61, 62, 225, 225, 65, 66, 67, 68, 69, 70, 71, 1867, 56, 224, 227, 227, 41, 1873, 227, 227, 1876, 227, 1878, 227, 1805, 227, 225, 1808, 224, 1885, 227, 1887, 36, 41, 224, 1805, 225, 225, 1808, 70, 343, 70, 70, 1899, 1900, 46, 219, 220, 221, 222, 56, 225, 227, 225, 227, 66, 67, 68, 69, 70, 71, 1917, 224, 1919, 224, 45, 224, 224, 70, 1925, 225, 225, 1928, 36, 1930, 227, 4, 380, 381, 1039, 61, 1862, 41, 386, 65, 66, 67, 68, 69, 70, 71, 41, 1862, 432, 1043, 602, 892, 889, 1725, 402, 1527, 1175, 599, 1912, 1751, 589, -1, 410, -1, -1, -1, -1, 415, -1, -1, -1, 419, -1, -1, -1, -1, -1, 425, 426, -1, 428, 429, 430, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, 61, 62, 451, -1, 65, 66, 67, 68, 69, 70, 71, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, 473, -1, -1, 476, -1, -1, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, -1, -1, -1, -1, -1, 501, 502, 503, 504, 505, -1, 507, -1, 509, -1, 219, 220, 221, 222, -1, 61, 62, -1, 519, 65, 66, 67, 68, 69, 70, 71, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, 219, 220, 221, 222, -1, -1, -1, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 576, -1, -1, -1, -1, 581, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 593, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 606, 219, 220, 221, 222, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, 75, -1, -1, 78, 219, 220, 221, 222, 691, -1, 85, 86, 227, 88, -1, 698, -1, 700, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, 717, -1, 111, -1, 113, -1, 115, -1, 117, -1, 727, 728, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, -1, -1, -1, 224, -1, -1, -1, 228, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 874, 875, -1, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 903, -1, -1, -1, -1, -1, 909, 910, -1, -1, 913, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 937, -1, 939, -1, -1, 942, -1, 944, -1, 946, 947, 948, -1, -1, 951, 952, -1, -1, -1, 956, -1, 958, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 969, 970, -1, -1, -1, -1, 975, -1, -1, -1, -1, -1, 981, -1, -1, 984, 985, -1, -1, -1, -1, 990, 991, -1, 993, -1, 995, 219, 220, 221, 222, -1, -1, -1, -1, 227, 1005, -1, 1007, 219, 220, 221, 222, -1, -1, 1014, 1015, 227, -1, -1, -1, 1020, 219, 220, 221, 222, -1, -1, -1, -1, 227, 1030, 1031, 1032, 5, -1, -1, 8, 219, 220, 221, 222, -1, -1, 1043, 1044, 227, 1046, -1, -1, 1049, 1050, 1051, -1, -1, -1, -1, -1, 29, -1, -1, 1060, 1061, -1, -1, -1, -1, 1066, 1067, -1, 1069, -1, -1, 1072, 219, 220, 221, 222, 1077, -1, 1079, -1, 227, -1, -1, 1084, -1, 1086, -1, 61, 62, 1090, -1, 65, 66, 67, 68, 69, 70, 71, 1099, -1, -1, 1102, -1, -1, -1, -1, -1, -1, -1, 1110, -1, -1, -1, 1114, 1115, 1116, 1117, 1118, -1, -1, -1, -1, -1, -1, 97, 1126, -1, 100, 101, 102, -1, -1, -1, 106, -1, -1, 61, 62, 111, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, 1167, -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, 61, 62, 1191, 1192, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 219, 220, 221, 222, -1, -1, 224, 225, 227, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1294, 219, 220, 221, 222, -1, -1, 46, -1, 227, 49, 50, 51, 52, 53, -1, 55, 56, -1, 58, 59, 60, 61, 62, 63, 64, -1, 66, 67, 68, -1, 70, -1, -1, -1, 74, 75, 76, -1, -1, -1, 80, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1378, -1, 61, 62, -1, 1383, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 1398, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 158, 1414, 1415, -1, -1, 1418, -1, 1420, 1421, 219, 220, 221, 222, -1, 1427, -1, -1, 227, -1, -1, 1433, 1434, 1435, -1, 1437, -1, -1, 1440, 1441, 1442, -1, 1444, -1, 1446, -1, 1448, -1, 1450, -1, -1, -1, -1, -1, -1, -1, 1458, 61, 62, -1, 1462, 65, 66, 67, 68, 69, 70, 71, -1, -1, 217, 1473, -1, 1475, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 1489, -1, -1, 1492, 1493, 219, 220, 221, 222, -1, 1499, -1, -1, 227, -1, -1, -1, 1506, -1, -1, -1, -1, -1, -1, 1513, -1, 1515, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 1527, -1, -1, -1, -1, -1, 1533, -1, -1, -1, -1, 219, 220, 221, 222, -1, 288, -1, -1, 227, -1, 293, -1, -1, -1, 1552, 1553, 299, -1, -1, 1557, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, 1570, -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 1588, -1, -1, -1, 1592, -1, -1, -1, -1, -1, 343, -1, 1600, 1601, 1602, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, 219, 220, 221, 222, 383, 384, 385, -1, 387, 388, -1, 390, 391, 392, 61, 62, -1, 1651, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, 61, 62, -1, 1665, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, 1676, -1, 1678, 1679, -1, 1681, -1, -1, -1, -1, 1686, -1, -1, -1, 1690, 1691, 1692, 1693, 1694, -1, 1696, 1697, 1698, -1, 1700, -1, -1, -1, -1, 1705, 1706, -1, -1, -1, 1710, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 1726, -1, 473, -1, 475, -1, -1, -1, 1734, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, -1, 1748, 1749, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1764, -1, -1, 61, 62, -1, 1770, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, 1792, -1, 1794, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 1831, -1, -1, 1834, -1, -1, -1, 1838, -1, 1840, 1841, -1, 1843, -1, 1845, -1, -1, -1, -1, -1, 596, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 612, -1, 1869, -1, 219, 220, 221, 222, 1875, -1, -1, 623, 227, -1, -1, -1, -1, 629, -1, -1, -1, 1888, 634, -1, -1, -1, 638, -1, 640, -1, -1, -1, -1, -1, 646, -1, -1, 649, 1905, 651, -1, -1, -1, 655, -1, -1, -1, -1, 3, 4, 5, 663, 7, 8, -1, -1, 1923, -1, 219, 220, 221, 222, -1, 675, -1, -1, 227, -1, -1, -1, 682, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 693, -1, 695, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, -1, -1, -1, 716, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 858, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, -1, -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 932, -1, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 976, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, 1012, -1, -1, -1, 85, 86, 1018, 88, -1, 1021, 1022, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, 219, 220, 221, 222, -1, 153, 225, -1, 1087, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, -1, -1, -1, 224, 225, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, -1, -1, -1, 224, 225, 3, 4, 5, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, 1464, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, 125, -1, 127, 128, -1, -1, 131, 132, 133, 134, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, 1714, -1, 121, 122, 123, 124, -1, -1, 127, 128, -1, -1, 131, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, 125, -1, 127, 128, -1, -1, 131, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, 131, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, 103, 104, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, 91, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, 120, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, 104, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, 218, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, 110, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, -1, 219, -1, 3, 4, 5, 224, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 78, -1, -1, -1, -1, -1, -1, 85, 86, -1, 88, -1, -1, -1, -1, 93, -1, -1, 96, 97, -1, -1, 100, 101, 102, -1, -1, -1, 106, 107, -1, -1, -1, 111, -1, 113, -1, 115, -1, 117, -1, -1, -1, 121, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, 132, -1, -1, 135, 136, 137, 138, -1, 140, 141, 142, -1, -1, -1, 146, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, -1, 211, 212, -1, 214, 215, 216, -1, 97, 219, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, 144, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, 60, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, 5, 127, 128, 8, -1, -1, -1, -1, 61, 62, -1, 137, 65, 66, 67, 68, 69, 70, 71, -1, -1, 147, -1, -1, 29, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, -1, 97, -1, -1, 100, 101, 102, 224, -1, -1, 106, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, -1, -1, -1, 127, 128, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, -1, -1, -1, 153, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, 178, 179, 180, -1, -1, 183, 184, 185, -1, 187, -1, 189, 190, 191, 192, 193, 194, -1, -1, 197, -1, -1, 200, -1, 202, 203, -1, 205, -1, 207, -1, 209, -1, -1, 212, -1, 214, -1, 216, 4, 5, 6, -1, -1, 9, -1, 224, -1, 13, -1, 15, -1, 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, 29, 30, 31, -1, 33, 34, 35, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, -1, 49, 50, 51, 52, 53, 54, 55, -1, -1, 58, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 72, 73, 74, 75, 76, 77, -1, -1, -1, -1, 82, 83, 84, -1, -1, 87, 88, -1, -1, 91, -1, 93, -1, 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, 105, -1, 107, 108, 109, -1, 111, -1, 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, 123, -1, -1, 126, 127, 128, -1, 130, -1, 132, -1, -1, 135, 136, -1, 138, -1, -1, -1, 142, -1, -1, 145, -1, 147, 148, -1, -1, -1, -1, -1, 154, 61, 62, 157, 158, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, 178, 179, 180, 61, 62, -1, 184, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, 198, 61, 62, 201, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, 214, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, -1, -1, -1, 227, -1, -1, 219, 220, 221, 222, -1, 61, 62, -1, 227, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, 61, 62, -1, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, 219, 220, 221, 222, 61, 62, 225, -1, 65, 66, 67, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219, 220, 221, 222, -1, -1, 225 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 4, 5, 6, 9, 13, 15, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 40, 43, 49, 50, 51, 52, 53, 54, 55, 58, 72, 73, 74, 75, 76, 77, 82, 83, 84, 87, 88, 91, 93, 95, 96, 97, 98, 99, 100, 101, 102, 105, 107, 108, 109, 111, 113, 114, 115, 116, 117, 118, 119, 121, 122, 123, 126, 127, 128, 130, 132, 135, 136, 138, 142, 145, 147, 148, 154, 157, 158, 178, 179, 180, 184, 198, 201, 214, 230, 231, 234, 241, 243, 244, 248, 260, 261, 266, 272, 279, 287, 296, 299, 303, 306, 312, 70, 224, 70, 224, 280, 300, 304, 4, 7, 258, 258, 258, 3, 4, 5, 7, 8, 28, 29, 32, 61, 62, 63, 64, 75, 78, 85, 86, 88, 93, 96, 97, 100, 101, 102, 106, 107, 111, 113, 115, 117, 121, 122, 123, 127, 128, 132, 135, 136, 137, 138, 140, 141, 142, 146, 147, 153, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, 207, 208, 209, 211, 212, 214, 215, 216, 219, 224, 246, 247, 249, 255, 257, 260, 261, 235, 236, 101, 102, 111, 122, 123, 147, 158, 224, 246, 224, 224, 246, 26, 288, 297, 249, 56, 59, 60, 228, 334, 239, 50, 246, 249, 4, 5, 259, 249, 249, 254, 4, 5, 322, 323, 8, 219, 220, 256, 257, 324, 246, 258, 228, 246, 249, 335, 335, 335, 249, 241, 248, 260, 261, 246, 75, 76, 110, 57, 94, 210, 254, 246, 110, 246, 110, 210, 254, 110, 254, 91, 110, 254, 91, 103, 104, 125, 131, 254, 91, 103, 104, 131, 254, 144, 246, 20, 60, 110, 254, 110, 254, 246, 60, 91, 103, 110, 254, 104, 120, 254, 110, 254, 103, 104, 110, 254, 60, 254, 104, 218, 254, 254, 60, 110, 110, 254, 91, 103, 104, 125, 131, 133, 134, 254, 60, 91, 103, 104, 124, 131, 254, 60, 246, 110, 254, 129, 110, 246, 110, 246, 110, 254, 110, 254, 110, 254, 82, 144, 246, 51, 89, 90, 110, 117, 148, 149, 150, 152, 156, 110, 254, 246, 246, 91, 110, 224, 224, 224, 224, 224, 246, 335, 110, 0, 42, 232, 70, 70, 22, 249, 262, 263, 246, 262, 4, 224, 231, 224, 224, 33, 34, 224, 224, 249, 224, 224, 224, 224, 224, 112, 218, 246, 246, 212, 213, 112, 213, 218, 112, 213, 218, 246, 218, 213, 218, 218, 218, 60, 151, 210, 218, 218, 112, 213, 218, 112, 213, 218, 213, 217, 218, 218, 218, 254, 218, 139, 104, 218, 143, 210, 213, 218, 224, 213, 218, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 254, 224, 209, 246, 209, 249, 246, 249, 65, 66, 67, 68, 69, 70, 220, 18, 19, 61, 62, 65, 66, 67, 68, 69, 70, 71, 219, 220, 221, 222, 4, 5, 273, 274, 4, 5, 275, 276, 246, 262, 262, 246, 249, 290, 231, 307, 313, 224, 56, 224, 4, 7, 224, 246, 249, 325, 56, 228, 327, 332, 240, 224, 224, 227, 227, 10, 227, 242, 224, 224, 227, 257, 257, 227, 249, 9, 227, 227, 254, 246, 246, 246, 254, 242, 227, 246, 227, 246, 254, 227, 246, 227, 246, 246, 242, 246, 246, 246, 246, 246, 242, 246, 246, 246, 246, 242, 246, 246, 246, 242, 246, 242, 227, 246, 246, 246, 246, 242, 246, 246, 242, 246, 242, 246, 246, 246, 242, 246, 227, 246, 246, 249, 254, 227, 242, 246, 246, 246, 227, 246, 246, 246, 246, 246, 246, 246, 242, 246, 246, 246, 246, 246, 246, 242, 246, 227, 246, 227, 246, 246, 227, 246, 227, 246, 242, 246, 242, 246, 227, 224, 249, 224, 249, 227, 254, 254, 254, 246, 249, 254, 254, 246, 254, 254, 254, 246, 227, 242, 242, 246, 246, 5, 245, 245, 245, 225, 249, 246, 227, 227, 246, 41, 249, 246, 267, 225, 246, 249, 264, 265, 225, 70, 249, 16, 42, 305, 262, 262, 249, 249, 249, 246, 335, 335, 4, 5, 252, 253, 252, 253, 246, 227, 227, 224, 246, 246, 246, 246, 246, 246, 246, 227, 246, 246, 246, 246, 246, 249, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 227, 246, 246, 246, 246, 246, 249, 254, 246, 246, 254, 249, 246, 246, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 335, 249, 249, 249, 249, 249, 225, 249, 246, 246, 246, 246, 246, 249, 249, 249, 225, 249, 249, 246, 249, 246, 249, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 335, 246, 225, 225, 246, 245, 246, 245, 246, 225, 242, 246, 224, 246, 246, 225, 225, 246, 246, 246, 246, 246, 246, 246, 237, 238, 251, 250, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 224, 224, 227, 224, 224, 227, 225, 225, 41, 289, 39, 42, 298, 44, 231, 249, 224, 246, 249, 48, 326, 226, 227, 224, 4, 7, 224, 8, 333, 327, 262, 262, 4, 5, 249, 254, 262, 262, 323, 8, 256, 80, 81, 246, 249, 242, 227, 227, 254, 246, 227, 246, 227, 227, 246, 227, 246, 227, 254, 227, 227, 227, 254, 227, 227, 227, 254, 227, 227, 227, 254, 227, 254, 246, 227, 227, 227, 254, 254, 227, 254, 227, 227, 227, 254, 227, 246, 227, 227, 242, 246, 254, 227, 227, 227, 246, 227, 227, 227, 227, 227, 254, 227, 227, 227, 227, 227, 254, 227, 246, 227, 246, 227, 246, 227, 249, 227, 254, 227, 254, 227, 246, 249, 249, 246, 242, 227, 227, 227, 227, 227, 242, 227, 227, 242, 227, 227, 246, 254, 249, 227, 227, 224, 227, 227, 227, 225, 225, 246, 249, 246, 249, 233, 4, 5, 271, 227, 281, 225, 224, 225, 225, 227, 227, 227, 225, 227, 227, 225, 224, 224, 225, 225, 227, 227, 227, 246, 246, 246, 227, 227, 246, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 246, 227, 227, 227, 227, 242, 227, 227, 227, 227, 227, 225, 225, 225, 225, 225, 225, 227, 225, 225, 227, 225, 225, 225, 225, 225, 225, 225, 227, 225, 225, 225, 227, 227, 227, 227, 227, 225, 227, 225, 225, 225, 225, 225, 227, 225, 225, 225, 225, 225, 225, 227, 227, 225, 225, 225, 225, 225, 227, 227, 225, 227, 227, 225, 227, 227, 254, 225, 225, 258, 336, 258, 337, 249, 249, 262, 262, 274, 262, 262, 276, 41, 291, 308, 47, 227, 249, 225, 227, 225, 224, 246, 246, 249, 249, 328, 329, 249, 4, 5, 319, 321, 225, 225, 224, 224, 227, 225, 225, 79, 79, 227, 227, 254, 246, 246, 227, 227, 246, 249, 227, 249, 246, 227, 249, 227, 246, 249, 227, 246, 249, 246, 249, 249, 227, 246, 249, 249, 227, 246, 246, 246, 249, 227, 246, 249, 227, 246, 246, 246, 227, 227, 246, 227, 246, 249, 249, 227, 246, 227, 246, 246, 254, 227, 246, 246, 249, 227, 246, 246, 249, 249, 246, 246, 227, 246, 249, 249, 246, 249, 227, 249, 246, 227, 246, 227, 246, 227, 246, 227, 249, 227, 249, 227, 225, 225, 227, 254, 246, 249, 246, 249, 246, 246, 254, 246, 249, 254, 254, 246, 227, 227, 227, 246, 246, 262, 249, 249, 249, 234, 268, 265, 249, 301, 249, 249, 249, 249, 246, 246, 225, 225, 249, 249, 246, 227, 227, 225, 249, 249, 227, 246, 249, 246, 246, 249, 246, 246, 246, 246, 249, 246, 249, 246, 246, 227, 246, 249, 246, 249, 254, 246, 246, 249, 246, 246, 249, 249, 249, 249, 249, 249, 249, 249, 246, 249, 246, 246, 246, 253, 246, 253, 246, 246, 227, 227, 227, 225, 225, 225, 225, 37, 38, 294, 231, 249, 227, 56, 246, 246, 326, 227, 319, 319, 225, 224, 224, 227, 262, 262, 246, 335, 335, 246, 246, 227, 227, 227, 246, 246, 227, 227, 246, 227, 246, 246, 227, 246, 227, 246, 246, 227, 227, 227, 246, 227, 227, 246, 227, 227, 246, 246, 227, 246, 246, 227, 246, 227, 227, 227, 246, 227, 227, 227, 246, 227, 227, 246, 227, 227, 227, 246, 227, 246, 227, 246, 227, 246, 227, 246, 246, 246, 246, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 246, 246, 249, 227, 225, 225, 225, 225, 227, 224, 10, 231, 225, 225, 225, 225, 225, 225, 227, 225, 225, 246, 246, 246, 227, 227, 227, 227, 227, 246, 227, 227, 227, 227, 242, 225, 225, 225, 225, 225, 225, 227, 225, 225, 225, 227, 225, 225, 227, 225, 227, 225, 225, 227, 225, 225, 227, 225, 225, 246, 258, 258, 292, 41, 36, 309, 225, 249, 224, 225, 227, 249, 330, 262, 262, 320, 225, 225, 246, 246, 249, 246, 227, 246, 246, 227, 246, 227, 227, 246, 227, 246, 227, 227, 246, 249, 249, 227, 246, 249, 227, 246, 249, 246, 249, 227, 227, 246, 227, 227, 249, 227, 246, 246, 246, 227, 249, 246, 249, 249, 246, 249, 246, 227, 249, 249, 249, 227, 249, 227, 246, 249, 227, 249, 249, 227, 227, 227, 246, 246, 246, 249, 246, 246, 246, 249, 246, 254, 227, 227, 246, 70, 70, 70, 249, 4, 5, 277, 278, 249, 14, 42, 302, 246, 227, 227, 246, 249, 246, 246, 249, 249, 246, 246, 246, 246, 249, 249, 246, 249, 249, 246, 246, 227, 290, 295, 46, 315, 59, 60, 225, 249, 56, 246, 225, 319, 225, 225, 319, 227, 227, 227, 246, 227, 246, 227, 249, 249, 246, 249, 246, 227, 246, 227, 227, 246, 227, 249, 246, 246, 246, 227, 246, 227, 246, 227, 227, 227, 227, 227, 249, 227, 227, 227, 249, 227, 246, 227, 227, 246, 227, 227, 249, 249, 249, 227, 227, 227, 227, 227, 246, 246, 227, 246, 246, 246, 225, 224, 224, 225, 227, 11, 285, 225, 246, 246, 227, 227, 227, 227, 225, 225, 225, 225, 225, 225, 246, 293, 231, 249, 45, 314, 224, 227, 224, 225, 331, 246, 249, 246, 227, 246, 246, 227, 227, 227, 227, 227, 249, 227, 249, 249, 227, 249, 227, 227, 227, 249, 227, 246, 249, 249, 249, 249, 249, 227, 249, 249, 249, 227, 249, 227, 246, 246, 227, 249, 249, 227, 227, 227, 249, 246, 246, 246, 254, 227, 246, 70, 225, 225, 269, 278, 249, 282, 227, 246, 246, 246, 249, 231, 44, 318, 231, 310, 246, 249, 249, 333, 227, 246, 227, 246, 246, 246, 246, 246, 227, 249, 246, 227, 246, 249, 246, 227, 246, 227, 227, 246, 227, 227, 227, 246, 246, 227, 246, 249, 246, 249, 227, 227, 227, 246, 246, 231, 231, 246, 225, 316, 42, 47, 311, 225, 227, 225, 227, 319, 246, 246, 227, 249, 227, 227, 249, 227, 249, 249, 249, 249, 246, 249, 227, 246, 227, 227, 246, 246, 246, 23, 42, 270, 283, 231, 246, 249, 227, 227, 246, 249, 246, 246, 227, 246, 246, 249, 12, 42, 284, 317, 225, 225, 246, 246, 227, 249, 227, 4, 286, 315, 227, 246, 227, 246, 249, 227, 246, 227, 246, 246 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 229, 230, 231, 232, 233, 231, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 235, 234, 236, 234, 234, 234, 234, 234, 234, 234, 237, 234, 238, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 239, 234, 240, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 241, 241, 241, 241, 241, 241, 242, 242, 243, 243, 243, 243, 244, 244, 245, 245, 246, 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 248, 248, 250, 249, 251, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 256, 256, 256, 257, 257, 258, 258, 259, 259, 259, 259, 260, 261, 263, 262, 264, 264, 264, 265, 265, 267, 268, 269, 266, 270, 270, 271, 271, 272, 272, 272, 272, 273, 273, 274, 274, 274, 274, 275, 275, 276, 276, 276, 276, 277, 277, 277, 278, 278, 278, 278, 280, 281, 282, 283, 279, 284, 284, 285, 285, 286, 286, 288, 287, 289, 289, 290, 290, 291, 292, 293, 291, 294, 295, 294, 297, 296, 298, 298, 300, 301, 299, 302, 302, 304, 303, 305, 305, 307, 308, 309, 310, 306, 311, 311, 313, 312, 314, 314, 315, 316, 317, 315, 318, 318, 319, 320, 319, 321, 321, 321, 321, 322, 322, 323, 323, 323, 323, 324, 324, 324, 324, 325, 325, 325, 325, 325, 326, 326, 326, 328, 327, 329, 327, 330, 327, 331, 327, 332, 327, 333, 333, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 335, 335, 336, 336, 337, 337 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 1, 0, 0, 5, 0, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 0, 3, 1, 1, 2, 2, 3, 3, 0, 5, 0, 5, 2, 1, 2, 1, 2, 4, 4, 3, 4, 4, 0, 3, 0, 4, 2, 2, 1, 2, 2, 1, 2, 2, 2, 9, 10, 8, 10, 10, 12, 10, 3, 5, 7, 10, 5, 3, 5, 5, 5, 5, 6, 8, 10, 5, 1, 2, 2, 7, 7, 3, 3, 4, 5, 7, 9, 6, 10, 5, 5, 7, 7, 7, 11, 3, 5, 5, 11, 5, 7, 8, 3, 12, 7, 10, 5, 5, 5, 5, 7, 7, 9, 11, 14, 16, 7, 7, 11, 5, 2, 7, 11, 5, 7, 9, 4, 9, 7, 7, 9, 11, 3, 6, 8, 3, 6, 9, 5, 5, 7, 3, 10, 5, 9, 11, 7, 3, 5, 5, 5, 7, 5, 5, 13, 17, 5, 5, 4, 9, 3, 3, 12, 11, 15, 3, 5, 5, 11, 10, 5, 6, 7, 9, 5, 5, 7, 9, 10, 9, 11, 12, 9, 9, 14, 5, 3, 3, 3, 3, 5, 3, 5, 12, 7, 9, 10, 5, 10, 11, 9, 5, 6, 2, 2, 1, 1, 3, 4, 4, 4, 4, 4, 4, 1, 1, 2, 1, 2, 3, 10, 8, 8, 8, 3, 1, 1, 6, 4, 6, 6, 4, 6, 1, 4, 1, 1, 1, 1, 3, 3, 6, 6, 8, 6, 4, 6, 8, 1, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 3, 1, 3, 4, 6, 6, 4, 6, 4, 10, 4, 4, 4, 1, 3, 2, 4, 4, 5, 3, 5, 5, 3, 6, 8, 3, 3, 2, 7, 3, 5, 5, 6, 5, 3, 5, 3, 3, 0, 4, 0, 4, 2, 3, 3, 3, 3, 3, 3, 4, 6, 1, 4, 4, 6, 6, 1, 1, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 6, 4, 4, 6, 4, 4, 4, 4, 4, 4, 6, 4, 3, 6, 6, 4, 4, 4, 4, 6, 6, 8, 6, 8, 4, 4, 4, 6, 6, 6, 4, 8, 6, 8, 6, 4, 4, 6, 6, 8, 9, 9, 8, 2, 2, 3, 5, 5, 10, 3, 3, 5, 5, 3, 3, 3, 3, 3, 5, 5, 7, 7, 7, 5, 7, 5, 5, 5, 6, 3, 1, 3, 3, 3, 3, 7, 7, 5, 5, 9, 5, 1, 2, 2, 1, 1, 1, 1, 4, 6, 4, 6, 4, 4, 0, 2, 0, 1, 3, 1, 1, 0, 0, 0, 11, 1, 1, 1, 1, 0, 1, 1, 2, 1, 3, 1, 1, 4, 4, 1, 3, 1, 1, 4, 4, 0, 1, 3, 1, 1, 3, 3, 0, 0, 0, 0, 14, 1, 1, 0, 2, 0, 1, 0, 7, 1, 2, 1, 1, 0, 0, 0, 6, 0, 0, 4, 0, 4, 1, 1, 0, 0, 8, 1, 1, 0, 4, 1, 4, 0, 0, 0, 0, 11, 1, 1, 0, 5, 0, 2, 0, 0, 0, 7, 0, 1, 1, 0, 4, 1, 4, 1, 4, 1, 3, 1, 4, 1, 4, 1, 1, 3, 3, 0, 2, 4, 1, 3, 0, 2, 6, 0, 4, 0, 4, 0, 6, 0, 9, 0, 3, 0, 1, 0, 2, 2, 4, 1, 4, 6, 6, 7, 10, 12, 7, 10, 12, 2, 1, 1, 3, 1, 3 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: {YYACCEPT;} break; case 4: {if (errorlevel<=ERROR) {YYABORT;}} break; case 5: {if ((yyvsp[0].sep)>=0) mylineno+=(yyvsp[0].sep); else switchlib();} break; case 12: {report_missing(ERROR,"do not import a library in a loop or an if-statement");switchlib();} break; case 13: {add_command(cERROR,NULL);} break; case 19: {add_command(cBREAK,NULL);if (!in_loop) error(ERROR,"break outside loop");} break; case 20: {add_command(cCONTINUE,NULL);if (!in_loop) error(ERROR,"continue outside loop");} break; case 22: {create_call((yyvsp[0].symbol));add_command(cPOP,NULL);} break; case 23: {create_call((yyvsp[0].symbol));add_command(cPOP,NULL);} break; case 24: {if (function_type==ftNONE) error(ERROR,"no use for 'local' outside functions");} break; case 26: {if (function_type==ftNONE) error(ERROR,"no use for 'static' outside functions");} break; case 30: {create_goto((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));} break; case 31: {create_gosub((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));} break; case 32: {create_exception(TRUE);} break; case 33: {create_exception(FALSE);} break; case 34: {add_command(cSKIPPER,NULL);} break; case 35: {add_command(cNOP,NULL);} break; case 36: {add_command(cSKIPPER,NULL);} break; case 37: {add_command(cNOP,NULL);} break; case 38: {create_label((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol),cLABEL);} break; case 39: {add_command(cCHECKOPEN,NULL);} break; case 40: {add_command(cCLOSE,NULL);} break; case 41: {add_command(cCHECKSEEK,NULL);} break; case 42: {add_command(cCOMPILE,NULL);} break; case 43: {create_execute(0);add_command(cPOP,NULL);add_command(cPOP,NULL);} break; case 44: {create_execute(1);add_command(cPOP,NULL);add_command(cPOP,NULL);} break; case 45: {create_colour(0);create_print('n');create_pps(cPOPSTREAM,0);} break; case 46: {create_colour(0);create_pps(cPOPSTREAM,0);} break; case 47: {create_colour(0);create_print('t');create_pps(cPOPSTREAM,0);} break; case 48: {tileol=FALSE;} break; case 50: {tileol=TRUE;} break; case 54: {create_restore("");} break; case 55: {create_restore((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));} break; case 56: {add_command(cRESTORE2, NULL);} break; case 57: {if (get_switch_id()) create_clean_switch_mark(0,TRUE); if (function_type!=ftNONE) { add_command(cCLEARREFS,NULL);lastcmd->nextref=firstref; add_command(cPOPSYMLIST,NULL); create_retval(ftNONE,function_type); add_command(cRET_FROM_FUN,NULL); } else { add_command(cRETURN,NULL); }} break; case 58: {if (get_switch_id()) create_clean_switch_mark(1,TRUE); if (function_type==ftNONE) {error(ERROR,"can not return value"); YYABORT;} add_command(cCLEARREFS,NULL);lastcmd->nextref=firstref;add_command(cPOPSYMLIST,NULL);create_retval(ftNUMBER,function_type);add_command(cRET_FROM_FUN,NULL);} break; case 59: {if (get_switch_id()) create_clean_switch_mark(1,TRUE); if (function_type==ftNONE) {error(ERROR,"can not return value"); YYABORT;} add_command(cCLEARREFS,NULL);lastcmd->nextref=firstref;add_command(cPOPSYMLIST,NULL);create_retval(ftSTRING,function_type);add_command(cRET_FROM_FUN,NULL);} break; case 61: {create_openwin(TRUE);} break; case 62: {add_command(cBUTTON,NULL);} break; case 63: {add_command(cMENU,NULL);} break; case 64: {add_command(cCHECKBOX,NULL);} break; case 65: {add_command(cRADIOBUTTON,NULL);} break; case 66: {add_command(cTEXTCONTROL,NULL);} break; case 67: {add_command(cLISTBOX,NULL);} break; case 68: {add_command(cITEMCLEAR, NULL);} break; case 69: {add_command(cLISTBOXADD1, NULL);} break; case 70: {add_command(cLISTBOXADD2, NULL);} break; case 71: {add_command(cDROPBOX,NULL);} break; case 72: {add_command(cITEMADD,NULL);} break; case 73: {add_command(cDROPBOXCLEAR,NULL);} break; case 74: {add_command(cDROPBOXREMOVE,NULL);} break; case 75: {add_command(cITEMDEL,NULL);} break; case 76: {add_command(cLISTBOXDEL2,NULL);} break; case 77: {add_command(cLISTBOXSELECT,NULL);} break; case 78: {add_command(cALERT,NULL);} break; case 79: {add_command(cTEXT,NULL);} break; case 80: {add_command(cTEXT2, NULL);} break; case 81: {add_command(cTEXTALIGN,NULL);} break; case 82: {add_command(cLOCALIZE,NULL);} break; case 83: {add_command(cLOCALIZE2,NULL);} break; case 84: {add_command(cLOCALIZESTOP, NULL);} break; case 85: {add_command(cDRAWTEXT,NULL);} break; case 86: {add_command(cDRAWRECT,NULL);} break; case 87: {add_command(cDRAWCLEAR,NULL);} break; case 88: {add_command(cCLOSEWIN,NULL);} break; case 89: {add_command(cLAYOUT,NULL);} break; case 90: {add_command(cWINSET4,NULL);} break; case 91: {add_command(cWINSET1,NULL);} break; case 92: {add_command(cWINSET3,NULL);} break; case 93: {add_command(cSHORTCUT,NULL);} break; case 94: {add_command(cTEXTEDIT,NULL);} break; case 95: {add_command(cTEXTADD,NULL);} break; case 96: {add_command(cTEXTSET,NULL);} break; case 97: {add_command(cTEXTSET2,NULL);} break; case 98: {add_command(cTEXTSET3,NULL);} break; case 99: {add_command(cTEXTCOLOR1,NULL);} break; case 100: {add_command(cTEXTCOLOR2,NULL);} break; case 101: {add_command(cTEXTCLEAR,NULL);} break; case 102: {add_command(cDRAWSET1,NULL);} break; case 103: {add_command(cDRAWSET2,NULL);} break; case 104: {add_command(cWINSET2,NULL);} break; case 105: {add_command(cDRAWSET3,NULL);} break; case 106: {add_command(cDRAWSET4,NULL);} break; case 107: {add_command(cVIEW,NULL);} break; case 108: {add_command(cWINCLEAR,NULL);} break; case 109: {add_command(cBOXVIEW,NULL);} break; case 110: {add_command(cBOXVIEWSET,NULL);} break; case 111: {add_command(cTAB,NULL);} break; case 112: {add_command(cTABSET,NULL);} break; case 113: {add_command(cTABADD, NULL);} break; case 114: {add_command(cTABDEL, NULL);} break; case 115: {add_command(cDOT,NULL);} break; case 116: {add_command(cLINE,NULL);} break; case 117: {add_command(cCIRCLE,NULL);} break; case 118: {add_command(cELLIPSE,NULL);} break; case 119: {add_command(cCURVE,NULL);} break; case 120: {add_command(cSLIDER1,NULL);} break; case 121: {add_command(cSLIDER2,NULL);} break; case 122: {add_command(cSLIDER3,NULL);} break; case 123: {add_command(cSLIDER4,NULL);} break; case 124: {add_command(cSLIDER5,NULL);} break; case 125: {add_command(cSLIDER6,NULL);} break; case 126: {add_command(cLAUNCH,NULL);} break; case 127: {add_command(cOPTION1,NULL);} break; case 128: {add_command(cOPTION2,NULL);} break; case 129: {add_command(cOPTION4,NULL);} break; case 130: {add_command(cOPTION5,NULL);} break; case 131: {add_command(cOPTION3,NULL);} break; case 132: {add_command(cBITMAP,NULL);} break; case 133: {add_command(cBITMAPGET, NULL);} break; case 134: {add_command(cBITMAPGET2, NULL);} break; case 135: {add_command(cBITMAPGETICON, NULL);} break; case 136: {add_command(cBITMAPDRAW,NULL);} break; case 137: {add_command(cBITMAPDRAW2,NULL);} break; case 138: {add_command(cBITMAPREMOVE,NULL);} break; case 139: {add_command(cSCREENSHOT,NULL);} break; case 140: {add_command(cCANVAS,NULL);} break; case 141: {add_command(cDROPZONE,NULL);} break; case 142: {add_command(cCOLORCONTROL1,NULL);} break; case 143: {add_command(cCOLORCONTROL2,NULL);} break; case 144: {add_command(cTEXTCONTROL2,NULL);} break; case 145: {add_command(cTEXTCONTROL3,NULL);} break; case 146: {add_command(cTEXTCONTROL4,NULL);} break; case 147: {add_command(cTEXTCONTROL5,NULL);} break; case 148: {add_command(cTREEBOX1,NULL);} break; case 149: {add_command(cTREEBOX2,NULL);} break; case 150: {add_command(cTREEBOX3,NULL);} break; case 151: {add_command(cTREEBOX13,NULL);} break; case 152: {add_command(cTREEBOX12,NULL);} break; case 153: {add_command(cTREEBOX4,NULL);} break; case 154: {add_command(cTREEBOX5,NULL);} break; case 155: {add_command(cTREEBOX7,NULL);} break; case 156: {add_command(cTREEBOX8,NULL);} break; case 157: {add_command(cTREEBOX9,NULL);} break; case 158: {add_command(cTREEBOX10,NULL);} break; case 159: {add_command(cTREEBOX11,NULL);} break; case 160: {add_command(cBUTTONIMAGE,NULL);} break; case 161: {add_command(cCHECKBOXIMAGE,NULL);} break; case 162: {add_command(cCHECKBOXSET,NULL);} break; case 163: {add_command(cRADIOSET,NULL);} break; case 164: {add_command(cTOOLTIP,NULL);} break; case 165: {add_command(cTOOLTIPCOLOR,NULL);} break; case 166: {add_command(cLISTSORT,NULL);} break; case 167: {add_command(cTREESORT,NULL);} break; case 168: {add_command(cFILEBOX,NULL);} break; case 169: {add_command(cCOLUMNBOXADD,NULL);} break; case 170: {add_command(cFILEBOXADD2,NULL);} break; case 171: {add_command(cFILEBOXCLEAR,NULL);} break; case 172: {add_command(cCOLUMNBOXREMOVE,NULL);} break; case 173: {add_command(cCOLUMNBOXSELECT,NULL);} break; case 174: {add_command(cCOLUMNBOXCOLOR,NULL);} break; case 175: {add_command(cCALENDAR,NULL);} break; case 176: {add_command(cCALENDARSET,NULL);} break; case 177: {add_command(cSCROLLBAR,NULL);} break; case 178: {add_command(cSCROLLBARSET1,NULL);} break; case 179: {add_command(cSCROLLBARSET2,NULL);} break; case 180: {add_command(cSCROLLBARSET3,NULL);} break; case 181: {add_command(cDROPBOXSELECT,NULL);} break; case 182: {add_command(cMENU2,NULL);} break; case 183: {add_command(cMENU3,NULL);} break; case 184: {add_command(cSUBMENU1,NULL);} break; case 185: {add_command(cSUBMENU2,NULL);} break; case 186: {add_command(cSUBMENU3,NULL);} break; case 187: {add_command(cSTATUSBAR,NULL);} break; case 188: {add_command(cSTATUSBARSET,NULL);} break; case 189: {add_command(cSTATUSBARSET3,NULL);} break; case 190: {add_command(cSPINCONTROL1,NULL);} break; case 191: {add_command(cSPINCONTROL2,NULL);} break; case 192: {add_command(cCLIPBOARDCOPY,NULL);} break; case 193: {add_command(cPRINTERCONFIG,NULL);} break; case 194: {add_command(cMOUSESET,NULL);} break; case 195: {add_command(cSOUNDSTOP,NULL);} break; case 196: {add_command(cSOUNDSTOP,NULL);} break; case 197: {add_command(cSOUNDWAIT,NULL);} break; case 198: {add_command(cSOUNDWAIT,NULL);} break; case 199: {add_command(cSPLITVIEW1,NULL);} break; case 200: {add_command(cSPLITVIEW2,NULL);} break; case 201: {add_command(cSPLITVIEW3,NULL);} break; case 202: {add_command(cSTACKVIEW1,NULL);} break; case 203: {add_command(cSTACKVIEW2,NULL);} break; case 204: {add_command(cTEXTURL1, NULL);} break; case 205: {add_command(cTEXTURL2, NULL);} break; case 206: {add_command(cATTRIBUTE1, NULL);} break; case 207: {add_command(cATTRIBUTECLEAR, NULL);} break; case 208: {add_command(cPUTCHAR,NULL);} break; case 209: {add_command(cCLEARSCR,NULL);} break; case 210: {add_command(cWAIT,NULL);} break; case 211: {add_command(cBELL,NULL);} break; case 212: {create_pushdbl(-1);create_function(fINKEY);add_command(cPOP,NULL);} break; case 213: {create_pushdbl(-1);create_function(fINKEY);add_command(cPOP,NULL);} break; case 214: {create_function(fINKEY);add_command(cPOP,NULL);} break; case 215: {create_function(fSYSTEM2); add_command(cPOP,NULL);} break; case 216: {create_poke('s');} break; case 217: {create_poke('d');} break; case 218: {create_poke('S');} break; case 219: {create_poke('D');} break; case 220: {add_command(cEND,NULL);} break; case 221: {create_pushdbl(0);add_command(cEXIT,NULL);} break; case 222: {add_command(cEXIT,NULL);} break; case 223: {create_docu((yyvsp[0].symbol));} break; case 224: {add_command(cBIND,NULL);} break; case 225: {add_command(cPOPSTRSYM,dotify((yyvsp[-2].symbol),FALSE));} break; case 226: {create_changestring(fMID);} break; case 227: {create_changestring(fMID2);} break; case 228: {create_changestring(fLEFT);} break; case 229: {create_changestring(fRIGHT);} break; case 230: {create_doarray(dotify((yyvsp[-2].symbol),FALSE),ASSIGNSTRINGARRAY);} break; case 233: {create_myopen(OPEN_HAS_STREAM+OPEN_HAS_MODE);} break; case 234: {create_myopen(OPEN_HAS_STREAM);} break; case 235: {add_command(cSWAP,NULL);create_pushstr("r");create_myopen(OPEN_HAS_STREAM+OPEN_HAS_MODE);} break; case 236: {add_command(cSWAP,NULL);create_pushstr("w");create_myopen(OPEN_HAS_STREAM+OPEN_HAS_MODE);} break; case 237: {add_command(cSEEK,NULL);} break; case 238: {add_command(cSEEK2,NULL);} break; case 239: {add_command(cPUSHSTRPTR,dotify((yyvsp[0].symbol),FALSE));} break; case 240: {create_doarray(dotify((yyvsp[-3].symbol),FALSE),GETSTRINGPOINTER);} break; case 241: {add_command(cPUSHSTRSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 243: {add_command(cSTRINGFUNCTION_OR_ARRAY,(yyvsp[0].symbol));} break; case 244: {if ((yyvsp[0].string)==NULL) {error(ERROR,"String not terminated");create_pushstr("");} else {create_pushstr((yyvsp[0].string));}} break; case 245: {add_command(cCONCAT,NULL);} break; case 247: {create_function(fLEFT);} break; case 248: {create_function(fRIGHT);} break; case 249: {create_function(fMID);} break; case 250: {create_function(fMID2);} break; case 251: {create_function(fSTR);} break; case 252: {create_function(fSTR2);} break; case 253: {create_function(fSTR3);} break; case 254: {create_pushdbl(-1);create_function(fINKEY);} break; case 255: {create_pushdbl(-1);create_function(fINKEY);} break; case 256: {create_function(fINKEY);} break; case 257: {create_function(fCHR);} break; case 258: {create_function(fUPPER);} break; case 259: {create_function(fLOWER);} break; case 260: {create_function(fLTRIM);} break; case 261: {create_function(fRTRIM);} break; case 262: {create_function(fTRIM);} break; case 263: {create_function(fSYSTEM);} break; case 264: {create_function(fDATE);} break; case 265: {create_function(fDATE);} break; case 266: {create_function(fTIME);} break; case 267: {create_function(fTIME);} break; case 268: {create_function(fPEEK2);} break; case 269: {create_function(fPEEK3);} break; case 270: {add_command(cTOKENALT2,NULL);} break; case 271: {add_command(cTOKENALT,NULL);} break; case 272: {add_command(cSPLITALT2,NULL);} break; case 273: {add_command(cSPLITALT,NULL);} break; case 274: {create_function(fGETCHAR);} break; case 275: {create_function(fHEX);} break; case 276: {create_function(fBIN);} break; case 277: {create_execute(1);add_command(cSWAP,NULL);add_command(cPOP,NULL);} break; case 278: {create_function(fMESSAGE);} break; case 279: {create_function(fMESSAGE);} break; case 280: {create_function(fMOUSEMOVE);} break; case 281: {create_function(fMOUSEMOVE);} break; case 282: {create_function(fTRANSLATE);} break; case 283: {create_function(fMENUTRANSLATE);} break; case 284: {create_function(fTEXTGET);} break; case 285: {create_function(fTEXTGET3);} break; case 286: {create_function(fTEXTGET6);} break; case 287: {create_function(fTEXTCONTROLGET);} break; case 288: {create_function(fLOAD);} break; case 289: {create_function(fSAVE);} break; case 290: {create_function(fMOUSE);} break; case 291: {create_function(fKEYBOARD);} break; case 292: {create_function(fCLIPBOARDPASTE);} break; case 293: {create_function(fCOLUMNBOXGET);} break; case 294: {create_function(fCALENDAR);} break; case 295: {create_function(fLISTBOXGET);} break; case 296: {create_function(fTREEBOXGET);} break; case 297: {create_function(fPOPUPMENU);} break; case 298: {create_function(fDROPBOXGET);} break; case 299: {create_function(fDRAWGET3);} break; case 300: {create_function(fATTRIBUTEGET1);} break; case 301: {add_command(cPOPDBLSYM,dotify((yyvsp[-2].symbol),FALSE));} break; case 302: {create_doarray((yyvsp[-2].symbol),ASSIGNARRAY);} break; case 303: {add_command(cORSHORT,NULL);pushlabel();} break; case 304: {poplabel();create_boole('|');} break; case 305: {add_command(cANDSHORT,NULL);pushlabel();} break; case 306: {poplabel();create_boole('&');} break; case 307: {create_boole('!');} break; case 308: {create_dblrelop('=');} break; case 309: {create_dblrelop('!');} break; case 310: {create_dblrelop('<');} break; case 311: {create_dblrelop('{');} break; case 312: {create_dblrelop('>');} break; case 313: {create_dblrelop('}');} break; case 314: {add_command(cTESTEOF,NULL);} break; case 315: {add_command(cGLOB,NULL);} break; case 316: {create_pushdbl((yyvsp[0].fnum));} break; case 317: {add_command(cARDIM,"");} break; case 318: {add_command(cARDIM,"");} break; case 319: {add_command(cARSIZE,"");} break; case 320: {add_command(cARSIZE,"");} break; case 321: {add_command(cFUNCTION_OR_ARRAY,(yyvsp[0].symbol));} break; case 322: {add_command(cPUSHDBLSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 323: {create_dblbin('+');} break; case 324: {create_dblbin('-');} break; case 325: {create_dblbin('*');} break; case 326: {create_dblbin('/');} break; case 327: {create_dblbin('^');} break; case 328: {add_command(cNEGATE,NULL);} break; case 329: {create_strrelop('=');} break; case 330: {create_strrelop('!');} break; case 331: {create_strrelop('<');} break; case 332: {create_strrelop('{');} break; case 333: {create_strrelop('>');} break; case 334: {create_strrelop('}');} break; case 337: {create_pusharrayref(dotify((yyvsp[-2].symbol),FALSE),stNUMBERARRAYREF);} break; case 338: {create_pusharrayref(dotify((yyvsp[-2].symbol),FALSE),stSTRINGARRAYREF);} break; case 340: {create_function(fSIN);} break; case 341: {create_function(fASIN);} break; case 342: {create_function(fCOS);} break; case 343: {create_function(fACOS);} break; case 344: {create_function(fTAN);} break; case 345: {create_function(fATAN);} break; case 346: {create_function(fATAN2);} break; case 347: {create_function(fEXP);} break; case 348: {create_function(fLOG);} break; case 349: {create_function(fLOG2);} break; case 350: {create_function(fSQRT);} break; case 351: {create_function(fSQR);} break; case 352: {create_function(fINT);} break; case 353: {create_function(fFRAC);} break; case 354: {create_function(fABS);} break; case 355: {create_function(fSIG);} break; case 356: {create_function(fMOD);} break; case 357: {create_function(fRAN);} break; case 358: {create_function(fRAN2);} break; case 359: {create_function(fMIN);} break; case 360: {create_function(fMAX);} break; case 361: {create_function(fLEN);} break; case 362: {create_function(fVAL);} break; case 363: {create_function(fASC);} break; case 364: {create_function(fDEC);} break; case 365: {create_function(fDEC2);} break; case 366: {if (check_compat) error(WARNING,"instr() has changed in version 2.712"); create_function(fINSTR);} break; case 367: {create_function(fINSTR2);} break; case 368: {create_function(fRINSTR);} break; case 369: {create_function(fRINSTR2);} break; case 370: {create_function(fSYSTEM2);} break; case 371: {create_function(fPEEK4);} break; case 372: {create_function(fPEEK);} break; case 373: {create_function(fAND);} break; case 374: {create_function(fOR);} break; case 375: {create_function(fEOR);} break; case 376: {create_function(fTELL);} break; case 377: {add_command(cTOKEN2,NULL);} break; case 378: {add_command(cTOKEN,NULL);} break; case 379: {add_command(cSPLIT2,NULL);} break; case 380: {add_command(cSPLIT,NULL);} break; case 381: {create_execute(0);add_command(cSWAP,NULL);add_command(cPOP,NULL);} break; case 382: {create_myopen(0);} break; case 383: {create_myopen(OPEN_HAS_MODE);} break; case 384: {create_myopen(OPEN_HAS_STREAM);} break; case 385: {create_myopen(OPEN_HAS_STREAM+OPEN_HAS_MODE);} break; case 386: {create_function(fDRAWIMAGE);} break; case 387: {create_function(fDRAWIMAGE2);} break; case 388: {create_function(fDRAWSVG);} break; case 389: {create_function(fNUMWINDOWS);} break; case 390: {create_function(fISMOUSEIN);} break; case 391: {create_function(fCOLUMNBOXCOUNT);} break; case 392: {create_function(fWINDOWGET);} break; case 393: {create_function(fVIEWGET);} break; case 394: {create_function(fALERT);} break; case 395: {create_function(fLISTBOXCOUNT);} break; case 396: {create_function(fTREEBOXCOUNT);} break; case 397: {create_function(fSCROLLBARGET);} break; case 398: {create_function(fSPLITVIEWGET);} break; case 399: {create_function(fSTACKVIEWGET);} break; case 400: {create_function(fTABVIEWGET);} break; case 401: {create_function(fSPINCONTROLGET);} break; case 402: {create_function(fDROPBOXCOUNT);} break; case 403: {create_function(fSLIDERGET);} break; case 404: {create_function(fCOLORCONTROLGET);} break; case 405: {create_function(fTEXTGET2);} break; case 406: {create_function(fTEXTGET4);} break; case 407: {create_function(fTEXTGET5);} break; case 408: {create_function(fDRAWGET1);} break; case 409: {create_function(fDRAWGET2);} break; case 410: {create_function(fDRAWGET4);} break; case 411: {create_function(fMESSAGESEND);} break; case 412: {create_function(fTHREADKILL);} break; case 413: {create_function(fTHREADGET);} break; case 414: {create_function(fPRINTER);} break; case 415: {create_function(fSOUND);} break; case 416: {create_function(fISCOMPUTERON);} break; case 417: {create_function(fLISTBOXGETNUM);} break; case 418: {create_function(fDROPBOXGETNUM);} break; case 419: {create_function(fTREEBOXGETNUM);} break; case 420: {create_function(fCOLUMNBOXGETNUM);} break; case 421: {create_function(fTREEBOXGETOPT);} break; case 422: {create_function(fBITMAPSAVE);} break; case 423: {create_function(fBITMAPLOAD);} break; case 424: {create_function(fBITMAPGET);} break; case 425: {create_function(fBITMAPCOLOR);} break; case 426: {create_function(fATTRIBUTEGET2);} break; case 427: {(yyval.fnum)=(yyvsp[0].fnum);} break; case 428: {(yyval.fnum)=(yyvsp[0].fnum);} break; case 429: {(yyval.fnum)=-(yyvsp[0].fnum);} break; case 430: {(yyval.fnum)=(yyvsp[0].fnum);} break; case 431: {(yyval.fnum)=strtod((yyvsp[0].digits),NULL);} break; case 432: {(yyval.symbol)=my_strdup(dotify((yyvsp[0].digits),FALSE));} break; case 433: {(yyval.symbol)=my_strdup(dotify((yyvsp[0].symbol),FALSE));} break; case 434: {create_dim(dotify((yyvsp[-3].symbol),FALSE),'D');} break; case 435: {create_dim(dotify((yyvsp[-3].symbol),FALSE),'D');} break; case 436: {create_dim(dotify((yyvsp[-3].symbol),FALSE),'S');} break; case 437: {create_dim(dotify((yyvsp[-3].symbol),FALSE),'S');} break; case 438: {(yyval.symbol)=my_strdup(dotify((yyvsp[-3].symbol),FALSE));} break; case 439: {(yyval.symbol)=my_strdup(dotify((yyvsp[-3].symbol),FALSE));} break; case 440: {add_command(cPUSHFREE,NULL);} break; case 447: {missing_endsub++;missing_endsub_line=mylineno;pushlabel();report_missing(WARNING,"do not define a function in a loop or an if-statement");if (function_type!=ftNONE) {error(ERROR,"nested functions not allowed");YYABORT;}} break; case 448: {if (exported) create_sublink((yyvsp[0].symbol)); create_label((yyvsp[0].symbol),cUSER_FUNCTION); add_command(cPUSHSYMLIST,NULL);add_command(cCLEARREFS,NULL);firstref=lastref=lastcmd; create_numparam();} break; case 449: {create_require(stFREE);add_command(cPOP,NULL);} break; case 450: {add_command(cCLEARREFS,NULL);lastcmd->nextref=firstref;add_command(cPOPSYMLIST,NULL);create_retval(ftNONE,function_type);function_type=ftNONE;add_command(cRET_FROM_FUN,NULL);lastref=NULL;create_endfunction();poplabel();} break; case 451: {if (missing_endsub) {sprintf(string,"%d end-sub(s) are missing (last at line %d)",missing_endsub,missing_endsub_line);error(ERROR,string);} YYABORT;} break; case 452: {missing_endsub--;} break; case 453: {function_type=ftNUMBER;current_function=my_strdup(dotify((yyvsp[0].symbol),FALSE));(yyval.symbol)=my_strdup(dotify((yyvsp[0].symbol),FALSE));} break; case 454: {function_type=ftSTRING;current_function=my_strdup(dotify((yyvsp[0].symbol),FALSE));(yyval.symbol)=my_strdup(dotify((yyvsp[0].symbol),FALSE));} break; case 455: {exported=FALSE;} break; case 456: {exported=TRUE;} break; case 457: {exported=FALSE;} break; case 458: {exported=TRUE;} break; case 461: {create_makelocal(dotify((yyvsp[0].symbol),FALSE),syNUMBER);} break; case 462: {create_makelocal(dotify((yyvsp[0].symbol),FALSE),sySTRING);} break; case 463: {create_makelocal(dotify((yyvsp[-3].symbol),FALSE),syARRAY);create_dim(dotify((yyvsp[-3].symbol),FALSE),'d');} break; case 464: {create_makelocal(dotify((yyvsp[-3].symbol),FALSE),syARRAY);create_dim(dotify((yyvsp[-3].symbol),FALSE),'s');} break; case 467: {create_makestatic(dotify((yyvsp[0].symbol),TRUE),syNUMBER);} break; case 468: {create_makestatic(dotify((yyvsp[0].symbol),TRUE),sySTRING);} break; case 469: {create_makestatic(dotify((yyvsp[-3].symbol),TRUE),syARRAY);create_dim(dotify((yyvsp[-3].symbol),TRUE),'D');} break; case 470: {create_makestatic(dotify((yyvsp[-3].symbol),TRUE),syARRAY);create_dim(dotify((yyvsp[-3].symbol),TRUE),'S');} break; case 474: {create_require(stNUMBER);create_makelocal(dotify((yyvsp[0].symbol),FALSE),syNUMBER);add_command(cPOPDBLSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 475: {create_require(stSTRING);create_makelocal(dotify((yyvsp[0].symbol),FALSE),sySTRING);add_command(cPOPSTRSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 476: {create_require(stNUMBERARRAYREF);create_arraylink(dotify((yyvsp[-2].symbol),FALSE),stNUMBERARRAYREF);} break; case 477: {create_require(stSTRINGARRAYREF);create_arraylink(dotify((yyvsp[-2].symbol),FALSE),stSTRINGARRAYREF);} break; case 478: {missing_next++;missing_next_line=mylineno;} break; case 479: {pushname(dotify((yyvsp[-1].symbol),FALSE)); /* will be used by next_symbol to check equality */ add_command(cRESETSKIPONCE,NULL); pushgoto();add_command(cCONTINUE_HERE,NULL);create_break_mark(0,1);} break; case 480: { /* pushes another expression */ add_command(cSKIPONCE,NULL); pushlabel(); add_command(cSTARTFOR,NULL); add_command(cPOPDBLSYM,dotify((yyvsp[-6].symbol),FALSE)); poplabel(); add_command(cPUSHDBLSYM,dotify((yyvsp[-6].symbol),FALSE)); add_command(cFORINCREMENT,NULL); add_command(cPOPDBLSYM,dotify((yyvsp[-6].symbol),FALSE)); add_command(cPUSHDBLSYM,dotify((yyvsp[-6].symbol),FALSE)); add_command(cFORCHECK,NULL); add_command(cDECIDE,NULL); pushlabel();} break; case 481: { swap();popgoto();poplabel();} break; case 482: {create_break_mark(0,-1);add_command(cBREAK_HERE,NULL);} break; case 483: {if (missing_next) {sprintf(string,"%d next(s) are missing (last at line %d)",missing_next,missing_next_line);error(ERROR,string);} YYABORT;} break; case 484: {missing_next--;} break; case 485: {create_pushdbl(1);} break; case 487: {pop(stSTRING);} break; case 488: {if (strcmp(pop(stSTRING)->pointer,dotify((yyvsp[0].symbol),FALSE))) {error(ERROR,"'for' and 'next' do not match"); YYABORT;} } break; case 489: {push_switch_id();add_command(cPUSH_SWITCH_MARK,NULL);create_break_mark(0,1); add_command(cCONTINUE_CORRECTION,NULL);} break; case 490: {create_break_mark(-1,0);add_command(cBREAK_HERE,NULL);create_break_mark(0,-1);add_command(cBREAK_HERE,NULL);create_clean_switch_mark(0,FALSE);pop_switch_id();} break; case 491: {if ((yyvsp[0].sep)>=0) mylineno+=(yyvsp[0].sep);} break; case 492: {if ((yyvsp[0].sep)>=0) mylineno+=(yyvsp[0].sep);} break; case 496: {create_break_mark(-1,0);add_command(cBREAK_HERE,NULL);} break; case 497: {add_command(cSWITCH_COMPARE,NULL);add_command(cDECIDE,NULL);add_command(cMINOR_BREAK,NULL);create_break_mark(1,0);} break; case 498: {add_command(cNEXT_CASE,NULL);} break; case 500: {if ((yyvsp[0].sep)>=0) mylineno+=(yyvsp[0].sep); create_break_mark(-1,0);add_command(cBREAK_HERE,NULL);} break; case 502: {add_command(cCONTINUE_HERE,NULL);create_break_mark(0,1);missing_loop++;missing_loop_line=mylineno;pushgoto();} break; case 504: {if (missing_loop) {sprintf(string,"%d loop(s) are missing (last at line %d)",missing_loop,missing_loop_line);error(ERROR,string);} YYABORT;} break; case 505: {missing_loop--;popgoto();create_break_mark(0,-1);add_command(cBREAK_HERE,NULL);} break; case 506: {add_command(cCONTINUE_HERE,NULL);create_break_mark(0,1);missing_wend++;missing_wend_line=mylineno;pushgoto();} break; case 507: {add_command(cDECIDE,NULL); pushlabel();} break; case 509: {if (missing_wend) {sprintf(string,"%d wend(s) are missing (last at line %d)",missing_wend,missing_wend_line);error(ERROR,string);} YYABORT;} break; case 510: {missing_wend--;swap();popgoto();poplabel();create_break_mark(0,-1);add_command(cBREAK_HERE,NULL);} break; case 511: {add_command(cCONTINUE_HERE,NULL);create_break_mark(0,1);missing_until++;missing_until_line=mylineno;pushgoto();} break; case 513: {if (missing_until) {sprintf(string,"%d until(s) are missing (last at line %d)",missing_until,missing_until_line);error(ERROR,string);} YYABORT;} break; case 514: {missing_until--;add_command(cDECIDE,NULL);popgoto();create_break_mark(0,-1);add_command(cBREAK_HERE,NULL);} break; case 515: {add_command(cDECIDE,NULL);storelabel();pushlabel();} break; case 516: {missing_endif++;missing_endif_line=mylineno;} break; case 517: {swap();matchgoto();swap();poplabel();} break; case 518: {poplabel();} break; case 520: {if (missing_endif) {sprintf(string,"%d endif(s) are missing (last at line %d)",missing_endif,missing_endif_line);error(ERROR,string);} YYABORT;} break; case 521: {missing_endif--;} break; case 522: {fi_pending++;add_command(cDECIDE,NULL);pushlabel();} break; case 523: {poplabel();} break; case 527: {add_command(cDECIDE,NULL);pushlabel();} break; case 528: {swap();matchgoto();swap();poplabel();} break; case 533: {add_command(cCHKPROMPT,NULL);} break; case 535: {create_myread('d',tileol);add_command(cPOPDBLSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 536: {create_myread('d',tileol);create_doarray(dotify((yyvsp[-3].symbol),FALSE),ASSIGNARRAY);} break; case 537: {create_myread('s',tileol);add_command(cPOPSTRSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 538: {create_myread('s',tileol);create_doarray(dotify((yyvsp[-3].symbol),FALSE),ASSIGNSTRINGARRAY);} break; case 541: {create_readdata('d');add_command(cPOPDBLSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 542: {create_readdata('d');create_doarray(dotify((yyvsp[-3].symbol),FALSE),ASSIGNARRAY);} break; case 543: {create_readdata('s');add_command(cPOPSTRSYM,dotify((yyvsp[0].symbol),FALSE));} break; case 544: {create_readdata('s');create_doarray(dotify((yyvsp[-3].symbol),FALSE),ASSIGNSTRINGARRAY);} break; case 545: {create_strdata((yyvsp[0].string));} break; case 546: {create_dbldata((yyvsp[0].fnum));} break; case 547: {create_strdata((yyvsp[0].string));} break; case 548: {create_dbldata((yyvsp[0].fnum));} break; case 552: {create_print('s');} break; case 553: {create_print('s');} break; case 554: {create_print('d');} break; case 555: {create_print('u');} break; case 556: {create_print('U');} break; case 557: {add_command(cPUSHDBLSYM,dotify((yyvsp[0].symbol),FALSE));create_pps(cPUSHSTREAM,1);} break; case 558: {create_pps(cPOPSTREAM,0);} break; case 559: {create_pushdbl(atoi((yyvsp[0].digits)));create_pps(cPUSHSTREAM,1);} break; case 560: {create_pps(cPOPSTREAM,0);} break; case 561: {create_pps(cPUSHSTREAM,1);} break; case 562: {create_pps(cPOPSTREAM,0);} break; case 563: {add_command(cMOVE,NULL);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,1);} break; case 564: {create_pps(cPOPSTREAM,0);} break; case 565: {create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,1);} break; case 566: {create_pps(cPOPSTREAM,0);} break; case 567: {create_pushstr("?");create_print('s');} break; case 568: {create_pushstr((yyvsp[0].string));create_print('s');} break; case 569: {create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 570: {add_command(cPUSHDBLSYM,dotify((yyvsp[0].symbol),FALSE));create_pps(cPUSHSTREAM,0);} break; case 571: {create_pushdbl(atoi((yyvsp[0].digits)));create_pps(cPUSHSTREAM,0);} break; case 572: {create_pps(cPUSHSTREAM,0);} break; case 573: {create_colour(1);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 574: {create_colour(2);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 575: {create_colour(3);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 576: {add_command(cMOVE,NULL);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 577: {add_command(cMOVE,NULL);create_colour(1);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 578: {add_command(cMOVE,NULL);create_colour(2);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 579: {add_command(cMOVE,NULL);create_colour(3);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);} break; case 580: {create_colour(1);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);add_command(cMOVE,NULL);} break; case 581: {create_colour(2);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);add_command(cMOVE,NULL);} break; case 582: {create_colour(3);create_pushdbl(STDIO_STREAM);create_pps(cPUSHSTREAM,0);add_command(cMOVE,NULL);} break; case 585: {create_goto((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));add_command(cFINDNOP,NULL);} break; case 586: {create_goto((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));add_command(cFINDNOP,NULL);} break; case 587: {create_gosub((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));add_command(cFINDNOP,NULL);} break; case 588: {create_gosub((function_type!=ftNONE)?dotify((yyvsp[0].symbol),TRUE):(yyvsp[0].symbol));add_command(cFINDNOP,NULL);} break; default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; }
[ "lorglas@bccec5e9-3364-482b-a60a-0960f7eb4bb4" ]
lorglas@bccec5e9-3364-482b-a60a-0960f7eb4bb4
1b54d1d464a5ad8ab8a3af83650e55427be08758
1495c5382d409b2e2f72e9f96f5c36d47f14fe2b
/week09.extras/JustSomeTests/Project3/Source.c
27dc033fa4e00d851d408466f6d51e2af88b5ba6
[]
no_license
LukaMeegan/PROG71985F21
c848eb2be2191406164a10639d7a509b2d4e7244
4108f487fba075f173eabf3983886ad6a928c73a
refs/heads/main
2023-08-27T19:21:31.645637
2021-11-12T17:11:05
2021-11-12T17:11:05
null
0
0
null
null
null
null
UTF-8
C
false
false
1,459
c
//prog71985f21 - my interpretation of asn2 refactor q3 //steveh - oct 2021 // opportunities for further improvement // 1. separate into a .h and .c file for the non-main functions // 2. add more comments (?) or maybe just function header comment block - the 3 / thing #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> //for exit #include <stdbool.h> typedef enum limittype {NONE, LOWER, UPPER} LIMITTYPE; bool PromptAndReturnInput(char*, int*, int limit, LIMITTYPE); void CalculateAndPrintOutput(int); #define DAYSinWEEK 7 #define MININPUT 0 int main(void) { bool doAgain; do { int input; if (doAgain = PromptAndReturnInput("Please enter a value: ", &input, MININPUT, LOWER)) CalculateAndPrintOutput(input); } while (doAgain); return 0; } bool PromptAndReturnInput(char* prompt, int *input, int limit, LIMITTYPE limitType) { printf(prompt); if (scanf("%d", input) != 1) return false; switch (limitType) { case(NONE): return true; break; case(LOWER): if (*input < limit) return false; break; case(UPPER): if (*input > limit) return false; break; default: return false; // if somethign else happened, false is a safer response } return true; } void CalculateAndPrintOutput(int input) { int weeks = input / DAYSinWEEK; int days = input % DAYSinWEEK; printf("%d days is %d weeks and %d days\n\n", input, weeks, days); }
[ "shendrikse@conestogac.on.ca" ]
shendrikse@conestogac.on.ca
8cc7a9a5930db5480a5b66dca6d7b86d0c9d4813
de9b2048daaf7a11f2b60d483bd9234e8b30877c
/x86_64-linux/usr/include/libxml2/libxml/xmlversion.h
8de77004f27608390bca5946ae98ee42a4355dc6
[]
no_license
aidlabs/Goldilock-Toolchain
41d7a34f69c5560709d1c9959584a4366d05dbed
ea775b759fdf8ea2fed61b0f44ead11768b2c89a
refs/heads/master
2021-01-11T10:46:48.723738
2017-01-16T05:43:11
2017-01-16T05:43:11
79,086,367
0
0
null
null
null
null
UTF-8
C
false
false
8,067
h
/* * Summary: compile-time version informations * Description: compile-time version informations for the XML library * * Copy: See Copyright for the status of this software. * * Author: Daniel Veillard */ #ifndef __XML_VERSION_H__ #define __XML_VERSION_H__ #include <libxml/xmlexports.h> #ifdef __cplusplus extern "C" { #endif /* * use those to be sure nothing nasty will happen if * your library and includes mismatch */ #ifndef LIBXML2_COMPILING_MSCCDEF XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /* LIBXML2_COMPILING_MSCCDEF */ /** * LIBXML_DOTTED_VERSION: * * the version string like "1.2.3" */ #define LIBXML_DOTTED_VERSION "2.9.2" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ #define LIBXML_VERSION 20902 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ #define LIBXML_VERSION_STRING "20902" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ #define LIBXML_VERSION_EXTRA "" /** * LIBXML_TEST_VERSION: * * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ #define LIBXML_TEST_VERSION xmlCheckVersion(20902); #ifndef VMS #if 0 /** * WITH_TRIO: * * defined if the trio support need to be configured in */ #define WITH_TRIO #else /** * WITHOUT_TRIO: * * defined if the trio support should not be configured in */ #define WITHOUT_TRIO #endif #else /* VMS */ /** * WITH_TRIO: * * defined if the trio support need to be configured in */ #define WITH_TRIO 1 #endif /* VMS */ /** * LIBXML_THREAD_ENABLED: * * Whether the thread support is configured in */ #if 1 #if defined(_REENTRANT) || defined(__MT__) || \ (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif /** * LIBXML_THREAD_ALLOC_ENABLED: * * Whether the allocation hooks are per-thread */ #if 0 #define LIBXML_THREAD_ALLOC_ENABLED #endif /** * LIBXML_TREE_ENABLED: * * Whether the DOM like tree manipulation API support is configured in */ #if 1 #define LIBXML_TREE_ENABLED #endif /** * LIBXML_OUTPUT_ENABLED: * * Whether the serialization/saving support is configured in */ #if 1 #define LIBXML_OUTPUT_ENABLED #endif /** * LIBXML_PUSH_ENABLED: * * Whether the push parsing interfaces are configured in */ #if 1 #define LIBXML_PUSH_ENABLED #endif /** * LIBXML_READER_ENABLED: * * Whether the xmlReader parsing interface is configured in */ #if 1 #define LIBXML_READER_ENABLED #endif /** * LIBXML_PATTERN_ENABLED: * * Whether the xmlPattern node selection interface is configured in */ #if 1 #define LIBXML_PATTERN_ENABLED #endif /** * LIBXML_WRITER_ENABLED: * * Whether the xmlWriter saving interface is configured in */ #if 1 #define LIBXML_WRITER_ENABLED #endif /** * LIBXML_SAX1_ENABLED: * * Whether the older SAX1 interface is configured in */ #if 1 #define LIBXML_SAX1_ENABLED #endif /** * LIBXML_FTP_ENABLED: * * Whether the FTP support is configured in */ #if 1 #define LIBXML_FTP_ENABLED #endif /** * LIBXML_HTTP_ENABLED: * * Whether the HTTP support is configured in */ #if 1 #define LIBXML_HTTP_ENABLED #endif /** * LIBXML_VALID_ENABLED: * * Whether the DTD validation support is configured in */ #if 1 #define LIBXML_VALID_ENABLED #endif /** * LIBXML_HTML_ENABLED: * * Whether the HTML support is configured in */ #if 1 #define LIBXML_HTML_ENABLED #endif /** * LIBXML_LEGACY_ENABLED: * * Whether the deprecated APIs are compiled in for compatibility */ #if 0 #define LIBXML_LEGACY_ENABLED #endif /** * LIBXML_C14N_ENABLED: * * Whether the Canonicalization support is configured in */ #if 1 #define LIBXML_C14N_ENABLED #endif /** * LIBXML_CATALOG_ENABLED: * * Whether the Catalog support is configured in */ #if 1 #define LIBXML_CATALOG_ENABLED #endif /** * LIBXML_DOCB_ENABLED: * * Whether the SGML Docbook support is configured in */ #if 0 #define LIBXML_DOCB_ENABLED #endif /** * LIBXML_XPATH_ENABLED: * * Whether XPath is configured in */ #if 1 #define LIBXML_XPATH_ENABLED #endif /** * LIBXML_XPTR_ENABLED: * * Whether XPointer is configured in */ #if 1 #define LIBXML_XPTR_ENABLED #endif /** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in */ #if 1 #define LIBXML_XINCLUDE_ENABLED #endif /** * LIBXML_ICONV_ENABLED: * * Whether iconv support is available */ #if 1 #define LIBXML_ICONV_ENABLED #endif /** * LIBXML_ICU_ENABLED: * * Whether icu support is available */ #if 0 #define LIBXML_ICU_ENABLED #endif /** * LIBXML_ISO8859X_ENABLED: * * Whether ISO-8859-* support is made available in case iconv is not */ #if 1 #define LIBXML_ISO8859X_ENABLED #endif /** * LIBXML_DEBUG_ENABLED: * * Whether Debugging module is configured in */ #if 1 #define LIBXML_DEBUG_ENABLED #endif /** * DEBUG_MEMORY_LOCATION: * * Whether the memory debugging is configured in */ #if 0 #define DEBUG_MEMORY_LOCATION #endif /** * LIBXML_DEBUG_RUNTIME: * * Whether the runtime debugging is configured in */ #if 0 #define LIBXML_DEBUG_RUNTIME #endif /** * LIBXML_UNICODE_ENABLED: * * Whether the Unicode related interfaces are compiled in */ #if 1 #define LIBXML_UNICODE_ENABLED #endif /** * LIBXML_REGEXP_ENABLED: * * Whether the regular expressions interfaces are compiled in */ #if 1 #define LIBXML_REGEXP_ENABLED #endif /** * LIBXML_AUTOMATA_ENABLED: * * Whether the automata interfaces are compiled in */ #if 1 #define LIBXML_AUTOMATA_ENABLED #endif /** * LIBXML_EXPR_ENABLED: * * Whether the formal expressions interfaces are compiled in */ #if 1 #define LIBXML_EXPR_ENABLED #endif /** * LIBXML_SCHEMAS_ENABLED: * * Whether the Schemas validation interfaces are compiled in */ #if 1 #define LIBXML_SCHEMAS_ENABLED #endif /** * LIBXML_SCHEMATRON_ENABLED: * * Whether the Schematron validation interfaces are compiled in */ #if 1 #define LIBXML_SCHEMATRON_ENABLED #endif /** * LIBXML_MODULES_ENABLED: * * Whether the module interfaces are compiled in */ #if 1 #define LIBXML_MODULES_ENABLED /** * LIBXML_MODULE_EXTENSION: * * the string suffix used by dynamic modules (usually shared libraries) */ #define LIBXML_MODULE_EXTENSION ".so" #endif /** * LIBXML_ZLIB_ENABLED: * * Whether the Zlib support is compiled in */ #if 1 #define LIBXML_ZLIB_ENABLED #endif /** * LIBXML_LZMA_ENABLED: * * Whether the Lzma support is compiled in */ #if 0 #define LIBXML_LZMA_ENABLED #endif #ifdef __GNUC__ /** * ATTRIBUTE_UNUSED: * * Macro used to signal to GCC unused function parameters */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) # define ATTRIBUTE_UNUSED __attribute__((unused)) # else # define ATTRIBUTE_UNUSED # endif #endif /** * LIBXML_ATTR_ALLOC_SIZE: * * Macro used to indicate to GCC this is an allocator function */ #ifndef LIBXML_ATTR_ALLOC_SIZE # if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) # else # define LIBXML_ATTR_ALLOC_SIZE(x) # endif #else # define LIBXML_ATTR_ALLOC_SIZE(x) #endif /** * LIBXML_ATTR_FORMAT: * * Macro used to indicate to GCC the parameter are printf like */ #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) # else # define LIBXML_ATTR_FORMAT(fmt,args) # endif #else # define LIBXML_ATTR_FORMAT(fmt,args) #endif #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: * * Macro used to signal to GCC unused function parameters */ #define ATTRIBUTE_UNUSED /** * LIBXML_ATTR_ALLOC_SIZE: * * Macro used to indicate to GCC this is an allocator function */ #define LIBXML_ATTR_ALLOC_SIZE(x) /** * LIBXML_ATTR_FORMAT: * * Macro used to indicate to GCC the parameter are printf like */ #define LIBXML_ATTR_FORMAT(fmt,args) #endif /* __GNUC__ */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif
[ "simon@aidlabs.co.kr" ]
simon@aidlabs.co.kr
c826dfd6d66b6e4d84ba0ae725fcacbac8c021cb
630216fc466083829783a525b958b69223e2e29e
/os/src/fw/src/core/trap_version/trap_version_slt_entry.h
29cadc06da2f209e3f1719b6d2d51c56ffbb0b02
[]
no_license
litterstar7/Qualcomm_BT_Audio
43c67dc69ff3ee868c3af755147435d9251d99fc
bff2d8c9e5e1ead4018f63098c1adea0e0c28184
refs/heads/master
2022-12-19T03:21:12.052733
2020-09-24T10:25:09
2020-09-24T10:25:09
297,954,877
4
1
null
null
null
null
UTF-8
C
false
false
585
h
/* Copyright (c) 2016 Qualcomm Technologies International, Ltd. */ /* %%version */ /* * \file * * * This file contains the magic to make a few entries appear in the * static SLT */ #ifndef VM_SLT_ENTRY_H #define VM_SLT_ENTRY_H #include "trap_version/trap_version.h" #define CORE_TRAP_VERSION_SLT_ENTRY(m) \ SLT_ENTRY(m, (APPS_SLT_TRAP_VERSION, trap_version)) \ SLT_ENTRY(m, (APPS_SLT_TRAPSET_BITMAP, trapset_bitmap)) \ SLT_ENTRY(m, (APPS_SLT_TRAPSET_BITMAP_LENGTH, &trapset_bitmap_length)) #endif /* TRAP_API_SLT_ENTRY_H */
[ "wang.lei@excelpoint.com.cn" ]
wang.lei@excelpoint.com.cn
dc8849a44153a43b9ed9903be0cc4ccad04b5b75
ab306257b62d8ac42f9d4f15fc64cdc0ad579004
/Sources/libtom/libtomcrypt/mac/pmac/pmac_init.c
1af9c2957e6888e9548478a96da9a148ce6f5157
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
EOSIO/eosio-swift
e771a42d1d695f51f53cbeb80c981ca932649f9b
4e0f706aa62dc16ec1d7073b5b37a57375f0d231
refs/heads/master
2022-01-10T15:14:49.017121
2020-11-30T21:23:31
2020-11-30T21:23:31
167,249,899
74
38
MIT
2021-04-12T17:48:38
2019-01-23T20:33:35
C
UTF-8
C
false
false
3,544
c
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ #include "tomcrypt_private.h" /** @file pmac_init.c PMAC implementation, initialize state, by Tom St Denis */ #ifdef LTC_PMAC static const struct { int len; unsigned char poly_div[MAXBLOCKSIZE], poly_mul[MAXBLOCKSIZE]; } polys[] = { { 8, { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B } }, { 16, { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87 } } }; /** Initialize a PMAC state @param pmac The PMAC state to initialize @param cipher The index of the desired cipher @param key The secret key @param keylen The length of the secret key (octets) @return CRYPT_OK if successful */ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned long keylen) { int poly, x, y, m, err; unsigned char *L; LTC_ARGCHK(pmac != NULL); LTC_ARGCHK(key != NULL); /* valid cipher? */ if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { return err; } /* determine which polys to use */ pmac->block_len = cipher_descriptor[cipher].block_length; for (poly = 0; poly < (int)(sizeof(polys)/sizeof(polys[0])); poly++) { if (polys[poly].len == pmac->block_len) { break; } } if (poly >= (int)(sizeof(polys)/sizeof(polys[0]))) { return CRYPT_INVALID_ARG; } if (polys[poly].len != pmac->block_len) { return CRYPT_INVALID_ARG; } #ifdef LTC_FAST if (pmac->block_len % sizeof(LTC_FAST_TYPE)) { return CRYPT_INVALID_ARG; } #endif /* schedule the key */ if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &pmac->key)) != CRYPT_OK) { return err; } /* allocate L */ L = XMALLOC(pmac->block_len); if (L == NULL) { return CRYPT_MEM; } /* find L = E[0] */ zeromem(L, pmac->block_len); if ((err = cipher_descriptor[cipher].ecb_encrypt(L, L, &pmac->key)) != CRYPT_OK) { goto error; } /* find Ls[i] = L << i for i == 0..31 */ XMEMCPY(pmac->Ls[0], L, pmac->block_len); for (x = 1; x < 32; x++) { m = pmac->Ls[x-1][0] >> 7; for (y = 0; y < pmac->block_len-1; y++) { pmac->Ls[x][y] = ((pmac->Ls[x-1][y] << 1) | (pmac->Ls[x-1][y+1] >> 7)) & 255; } pmac->Ls[x][pmac->block_len-1] = (pmac->Ls[x-1][pmac->block_len-1] << 1) & 255; if (m == 1) { for (y = 0; y < pmac->block_len; y++) { pmac->Ls[x][y] ^= polys[poly].poly_mul[y]; } } } /* find Lr = L / x */ m = L[pmac->block_len-1] & 1; /* shift right */ for (x = pmac->block_len - 1; x > 0; x--) { pmac->Lr[x] = ((L[x] >> 1) | (L[x-1] << 7)) & 255; } pmac->Lr[0] = L[0] >> 1; if (m == 1) { for (x = 0; x < pmac->block_len; x++) { pmac->Lr[x] ^= polys[poly].poly_div[x]; } } /* zero buffer, counters, etc... */ pmac->block_index = 1; pmac->cipher_idx = cipher; pmac->buflen = 0; zeromem(pmac->block, sizeof(pmac->block)); zeromem(pmac->Li, sizeof(pmac->Li)); zeromem(pmac->checksum, sizeof(pmac->checksum)); err = CRYPT_OK; error: #ifdef LTC_CLEAN_STACK zeromem(L, pmac->block_len); #endif XFREE(L); return err; } #endif
[ "noreply@github.com" ]
EOSIO.noreply@github.com
1c255849cd2d294ba5719f45f9439415acd29825
08ac0ec099391e699c6faf1790196664232803a5
/library/wchar_wmemchr.c
840911b323dc9801cfd80132e316dcc33b080cfc
[ "BSD-3-Clause", "SunPro" ]
permissive
jamiepg4/clib2
ef5f0e63eb5b6947307f8b8d0efae99816d3022c
c76bf8e20b3daa9dc92aa9c63b121b02f2cb34e4
refs/heads/master
2021-01-02T09:11:33.731537
2017-08-01T19:28:07
2017-08-01T19:28:07
null
0
0
null
null
null
null
UTF-8
C
false
false
1,803
c
/* * $Id: wchar_wmemchr.c,v 1.3 2006-01-08 12:04:27 obarthel Exp $ * * :ts=4 * * Portable ISO 'C' (1994) runtime library for the Amiga computer * Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net> * 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. * * - Neither the name of Olaf Barthel nor the names of 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 OWNER 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 _WCHAR_HEADERS_H #include "wchar_headers.h" #endif /* _WCHAR_HEADERS_H */ /****************************************************************************/ wchar_t * wmemchr(const wchar_t *ptr, wchar_t val, size_t len) { /* ZZZ unimplemented */ return(NULL); }
[ "obarthel@gmx.net" ]
obarthel@gmx.net