text
stringlengths
2
99.9k
meta
dict
--- ext/odbc/config.m4.orig 2015-04-15 05:43:00.000000000 -0500 +++ ext/odbc/config.m4 2015-04-17 20:19:37.000000000 -0500 @@ -104,6 +104,7 @@ [ --with-odbcver[=HEX] Force support for the passed ODBC version. A hex number is expected, default 0x0300. Use the special value of 0 to prevent an explicit ODBCVER to be defined. ], 0x0300) +:<<'MACPORTS_DISABLED' if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(adabas,, [ --with-adabas[=DIR] Include Adabas D support [/usr/local]]) @@ -446,6 +447,7 @@ fi fi +MACPORTS_DISABLED if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(unixODBC,, [ --with-unixODBC[=DIR] Include unixODBC support [/usr/local]])
{ "pile_set_name": "Github" }
/* Copyright (c) 2014, Nordic Semiconductor ASA * * 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. */ /** * HID (Human Interface Device) template */ /** @defgroup HID_keyboard_project HID_keyboard_project @{ @ingroup projects @brief HID Keyboard project that can be used as a template for new projects. @details IMPORTANT: This example still is not compatible with CHIPKIT This project is a firmware template for new HID keyboard projects. The project will run correctly in its current state. This will show the Arduino board as a HID Keybaord to the Win 8. After HID Keyboard has been bonded with Win 8. The letter 'A' is sent to the Win 8 every 4 seconds. With this project you have a starting point for adding your own application functionality. The following instructions describe the steps to be made on the Windows PC: -# Install the Master Control Panel on your computer. Connect the Master Emulator (nRF2739) and make sure the hardware drivers are installed. -# Alternatively you should be able to get the board to work directly with a iOS 7 device, Win 8/Win RT PC after adding the required buttons for I/O. Note: Pin #6 on Arduino -> PAIRING CLEAR pin: Connect to 3.3v to clear the pairing The setup() and the loop() functions are the equvivlent of main() . */ #include <SPI.h> #include "services.h" #include <lib_aci.h> #include "aci_setup.h" #include "EEPROM.h" #ifdef SERVICES_PIPE_TYPE_MAPPING_CONTENT static services_pipe_type_mapping_t services_pipe_type_mapping[NUMBER_OF_PIPES] = SERVICES_PIPE_TYPE_MAPPING_CONTENT; #else #define NUMBER_OF_PIPES 0 static services_pipe_type_mapping_t * services_pipe_type_mapping = NULL; #endif static const hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT; // aci_struct that will contain // total initial credits // current credit // current state of the aci (setup/standby/active/sleep) // open remote pipe pending // close remote pipe pending // Current pipe available bitmap // Current pipe closed bitmap // Current connection interval, slave latency and link supervision timeout // Current State of the the GATT client (Service Discovery) // Status of the bond (R) Peer address static struct aci_state_t aci_state; static hal_aci_evt_t aci_data; static hal_aci_data_t aci_cmd; /* We will store the bonding info for the nRF8001 in the MCU to recover from a power loss situation */ static bool bonded_first_time = true; /* We will do the timing change for the link only once */ static bool timing_change_done = false; /* Variables used for the timer on the AVR */ volatile uint8_t timer1_f = 0; /* The keyboard report is 8 bytes 0 Modifier keys 1 Reserved 2 Keycode 1 3 Keycode 2 4 Keycode 3 5 Keycode 4 6 Keycode 5 7 Keycode 6 */ uint8_t keypressA[8]={ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }; /*** FUNC Name: Timer1start Function: Start timer 1 to interrupt periodically. Call this from the Arduino setup() function. Description: The pre-scaler and the timer count divide the timer-counter clock frequency to give a timer overflow interrupt rate: Interrupt rate = 16MHz / (prescaler * (255 - TCNT2)) TCCR2B[b2:0] Prescaler Freq [KHz], Period [usec] after prescale 0x0 (TC stopped) 0 0 0x1 1 16000. 0.0625 0x2 8 2000. 0.500 0x3 32 500. 2.000 0x4 64 250. 4.000 0x5 128 125. 8.000 0x6 256 62.5 16.000 0x7 1024 15.625 64.000 Parameters: void Returns: void FUNC ***/ void Timer1start() { // Setup Timer1 overflow to fire every 4000ms // period [sec] = (1 / f_clock [sec]) * prescale * (count) // (1/16000000) * 1024 * (count) = 4000 ms TCCR1B = 0x00; // Disable Timer1 while we set it up TCNT1H = 11; // Approx 4000ms when prescaler is set to 1024 TCNT1L = 0; TIFR1 = 0x00; // Timer1 INT Flag Reg: Clear Timer Overflow Flag TIMSK1 = 0x01; // Timer1 INT Reg: Timer1 Overflow Interrupt Enable TCCR1A = 0x00; // Timer1 Control Reg A: Wave Gen Mode normal TCCR1B = 0x05; // Timer1 Control Reg B: Timer Prescaler set to 1024 } void Timer1stop() { TCCR1B = 0x00; TIMSK1 = 0x00; } /*** FUNC Name: Timer1 ISR Function: Handles the Timer1-overflow interrupt FUNC ***/ ISR(TIMER1_OVF_vect) { if (0 == timer1_f) { timer1_f = 1; } TCNT1H = 11; // Approx 4000 ms - Reload TCNT1L = 0; TIFR1 = 0x00; // timer1 int flag reg: clear timer overflow flag }; /* Define how assert should function in the BLE library */ void __ble_assert(const char *file, uint16_t line) { Serial.print("ERROR "); Serial.print(file); Serial.print(": "); Serial.print(line); Serial.print("\n"); while(1); } /*************NOTE********** Scroll to the end of the file and read the loop() and setup() functions. The loop/setup functions is the equivalent of the main() function */ /* Read the Dymamic data from the EEPROM and send then as ACI Write Dynamic Data to the nRF8001 This will restore the nRF8001 to the situation when the Dynamic Data was Read out */ aci_status_code_t bond_data_restore(aci_state_t *aci_stat, uint8_t eeprom_status, bool *bonded_first_time_state) { aci_evt_t *aci_evt; uint8_t eeprom_offset_read = 1; uint8_t write_dyn_num_msgs = 0; uint8_t len =0; // Get the number of messages to write for the eeprom_status write_dyn_num_msgs = eeprom_status & 0x7F; //Read from the EEPROM while(1) { len = EEPROM.read(eeprom_offset_read); eeprom_offset_read++; aci_cmd.buffer[0] = len; for (uint8_t i=1; i<=len; i++) { aci_cmd.buffer[i] = EEPROM.read(eeprom_offset_read); eeprom_offset_read++; } //Send the ACI Write Dynamic Data if (!hal_aci_tl_send(&aci_cmd)) { Serial.println(F("bond_data_restore: Cmd Q Full")); return ACI_STATUS_ERROR_INTERNAL; } //Spin in the while loop waiting for an event while (1) { if (lib_aci_event_get(aci_stat, &aci_data)) { aci_evt = &aci_data.evt; if (ACI_EVT_CMD_RSP != aci_evt->evt_opcode) { //Got something other than a command response evt -> Error Serial.print(F("bond_data_restore: Expected cmd rsp evt. Got: 0x")); Serial.println(aci_evt->evt_opcode, HEX); return ACI_STATUS_ERROR_INTERNAL; } else { write_dyn_num_msgs--; //ACI Evt Command Response if (ACI_STATUS_TRANSACTION_COMPLETE == aci_evt->params.cmd_rsp.cmd_status) { //Set the state variables correctly *bonded_first_time_state = false; aci_stat->bonded = ACI_BOND_STATUS_SUCCESS; delay(10); return ACI_STATUS_TRANSACTION_COMPLETE; } if (0 >= write_dyn_num_msgs) { //should have returned earlier return ACI_STATUS_ERROR_INTERNAL; } if (ACI_STATUS_TRANSACTION_CONTINUE == aci_evt->params.cmd_rsp.cmd_status) { //break and write the next ACI Write Dynamic Data break; } } } } } } /* This function is specific to the atmega328 @params ACI Command Response Evt received from the Read Dynmaic Data */ void bond_data_store(aci_evt_t *evt) { static int eeprom_write_offset = 1; //Write it to non-volatile storage EEPROM.write( eeprom_write_offset, evt->len -2 ); eeprom_write_offset++; EEPROM.write( eeprom_write_offset, ACI_CMD_WRITE_DYNAMIC_DATA); eeprom_write_offset++; for (uint8_t i=0; i< (evt->len-3); i++) { EEPROM.write( eeprom_write_offset, evt->params.cmd_rsp.params.padding[i]); eeprom_write_offset++; } } bool bond_data_read_store(aci_state_t *aci_stat) { /* The size of the dynamic data for a specific Bluetooth Low Energy configuration is present in the ublue_setup.gen.out.txt generated by the nRFgo studio as "dynamic data size". */ bool status = false; aci_evt_t * aci_evt = NULL; uint8_t read_dyn_num_msgs = 0; //Start reading the dynamic data lib_aci_read_dynamic_data(); read_dyn_num_msgs++; while (1) { if (true == lib_aci_event_get(aci_stat, &aci_data)) { aci_evt = &aci_data.evt; if (ACI_EVT_CMD_RSP != aci_evt->evt_opcode ) { //Got something other than a command response evt -> Error status = false; break; } if (ACI_STATUS_TRANSACTION_COMPLETE == aci_evt->params.cmd_rsp.cmd_status) { //Store the contents of the command response event in the EEPROM //(len, cmd, seq-no, data) : cmd ->Write Dynamic Data so it can be used directly bond_data_store(aci_evt); //Set the flag in the EEPROM that the contents of the EEPROM is valid EEPROM.write(0, 0x80|read_dyn_num_msgs ); //Finished with reading the dynamic data status = true; break; } if (!(ACI_STATUS_TRANSACTION_CONTINUE == aci_evt->params.cmd_rsp.cmd_status)) { //We failed the read dymanic data //Set the flag in the EEPROM that the contents of the EEPROM is invalid EEPROM.write(0, 0xFF); status = false; break; } else { //Store the contents of the command response event in the EEPROM // (len, cmd, seq-no, data) : cmd ->Write Dynamic Data so it can be used directly when re-storing the dynamic data bond_data_store(aci_evt); //Read the next dynamic data message lib_aci_read_dynamic_data(); read_dyn_num_msgs++; } } } return status; } //Process all ACI events here void aci_loop() { static bool setup_required = false; // We enter the if statement only when there is a ACI event available to be processed if (lib_aci_event_get(&aci_state, &aci_data)) { aci_evt_t * aci_evt; aci_evt = &aci_data.evt; switch(aci_evt->evt_opcode) { case ACI_EVT_DEVICE_STARTED: { aci_state.data_credit_total = aci_evt->params.device_started.credit_available; switch(aci_evt->params.device_started.device_mode) { case ACI_DEVICE_SETUP: /** When the device is in the setup mode */ aci_state.device_state = ACI_DEVICE_SETUP; Serial.println(F("Evt Device Started: Setup")); setup_required = true; break; case ACI_DEVICE_STANDBY: Serial.println(F("Evt Device Started: Standby")); if (aci_evt->params.device_started.hw_error) { delay(20); //Magic number used to make sure the HW error event is handled correctly. } else { //Manage the bond in EEPROM of the AVR { uint8_t eeprom_status = 0; eeprom_status = EEPROM.read(0); if (eeprom_status != 0xFF) { Serial.println(F("Previous Bond present. Restoring")); Serial.println(F("Using existing bond stored in EEPROM.")); Serial.println(F(" To delete the bond stored in EEPROM, connect Pin 6 to 3.3v and Reset.")); Serial.println(F(" Make sure that the bond on the phone/PC is deleted as well.")); //We must have lost power and restarted and must restore the bonding infromation using the ACI Write Dynamic Data if (ACI_STATUS_TRANSACTION_COMPLETE == bond_data_restore(&aci_state, eeprom_status, &bonded_first_time)) { Serial.println(F("Bond restored successfully")); } else { Serial.println(F("Bond restore failed. Delete the bond and try again.")); } } } // Start bonding as all proximity devices need to be bonded to be usable if (ACI_BOND_STATUS_SUCCESS != aci_state.bonded) { lib_aci_bond(180/* in seconds */, 0x0050 /* advertising interval 50ms*/); Serial.println(F("No Bond present in EEPROM.")); Serial.println(F("Advertising started : Waiting to be connected and bonded")); } else { //connect to an already bonded device //Use lib_aci_direct_connect for faster re-connections with PC, not recommended to use with iOS/OS X lib_aci_connect(100/* in seconds */, 0x0020 /* advertising interval 20ms*/); Serial.println(F("Already bonded : Advertising started : Waiting to be connected")); } } break; } } break; //ACI Device Started Event case ACI_EVT_CMD_RSP: //If an ACI command response event comes with an error -> stop if ((ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status ) && (ACI_CMD_READ_DYNAMIC_DATA != aci_evt->params.cmd_rsp.cmd_opcode) && (ACI_CMD_WRITE_DYNAMIC_DATA != aci_evt->params.cmd_rsp.cmd_opcode)) { //ACI ReadDynamicData and ACI WriteDynamicData will have status codes of //TRANSACTION_CONTINUE and TRANSACTION_COMPLETE //all other ACI commands will have status code of ACI_STATUS_SCUCCESS for a successful command Serial.print(F("ACI Command ")); Serial.println(aci_evt->params.cmd_rsp.cmd_opcode, HEX); Serial.print(F("Evt Cmd respone: Status ")); Serial.println(aci_evt->params.cmd_rsp.cmd_status, HEX); } if (ACI_CMD_GET_DEVICE_VERSION == aci_evt->params.cmd_rsp.cmd_opcode) { //Store the version and configuration information of the nRF8001 in the Hardware Revision String Characteristic lib_aci_set_local_data(&aci_state, PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET, (uint8_t *)&(aci_evt->params.cmd_rsp.params.get_device_version), sizeof(aci_evt_cmd_rsp_params_get_device_version_t)); } break; case ACI_EVT_CONNECTED: /* reset the credit available when the link gets connected */ aci_state.data_credit_available = aci_state.data_credit_total; timing_change_done = false; Serial.println(F("Evt Connected")); /* Get the Device Version of the nRF8001 and place it in the Hardware Revision String Characteristic of the Device Info. GATT Service */ lib_aci_device_version(); Timer1stop(); break; case ACI_EVT_PIPE_STATUS: Serial.println(F("Evt Pipe Status")); if (lib_aci_is_pipe_available(&aci_state, PIPE_HID_SERVICE_HID_REPORT_TX) && (false == timing_change_done)) { lib_aci_change_timing_GAP_PPCP(); //Uses the GAP preferred timing as put in the nRFGo studio xml file-> See also in services.h timing_change_done = true; Timer1start(); } break; case ACI_EVT_TIMING: Serial.print(F("Timing change received conn Interval: 0x")); Serial.println(aci_evt->params.timing.conn_rf_interval, HEX); //Disconnect as soon as we are bonded and required pipes are available //This is used to store the bonding info on disconnect and then re-connect to verify the bond if((ACI_BOND_STATUS_SUCCESS == aci_state.bonded) && (true == bonded_first_time) && (GAP_PPCP_MAX_CONN_INT >= aci_state.connection_interval) && (GAP_PPCP_MIN_CONN_INT <= aci_state.connection_interval) && //Timing change already done: Provide time for the the peer to finish (lib_aci_is_pipe_available(&aci_state, PIPE_HID_SERVICE_HID_REPORT_TX))) { lib_aci_disconnect(&aci_state, ACI_REASON_TERMINATE); } break; case ACI_EVT_DATA_CREDIT: /** Bluetooth Radio ack received from the peer radio for the data packet sent. Multiple data packets can be acked in a single aci data credit event. */ aci_state.data_credit_available = aci_state.data_credit_available + aci_evt->params.data_credit.credit; break; case ACI_EVT_PIPE_ERROR: //See the appendix in the nRF8001 Product Specication for details on the error codes Serial.print(F("ACI Evt Pipe Error: Pipe #:")); Serial.print(aci_evt->params.pipe_error.pipe_number, DEC); Serial.print(F(" Pipe Error Code: 0x")); Serial.println(aci_evt->params.pipe_error.error_code, HEX); //Increment the credit available as the data packet was not sent. //The pipe error also represents the Attribute protocol Error Response sent from the peer and that should not be counted //for the credit. if (ACI_STATUS_ERROR_PEER_ATT_ERROR != aci_evt->params.pipe_error.error_code) { aci_state.data_credit_available++; } break; case ACI_EVT_BOND_STATUS: Serial.println(F("Evt Bond Status")); aci_state.bonded = aci_evt->params.bond_status.status_code; break; case ACI_EVT_DISCONNECTED: //Stop the timer Timer1stop(); /** Advertise again if the advertising timed out. */ if(ACI_STATUS_ERROR_ADVT_TIMEOUT == aci_evt->params.disconnected.aci_status) { Serial.println(F("Evt Disconnected -> Advertising timed out")); { Serial.println(F("nRF8001 going to sleep")); lib_aci_sleep(); aci_state.device_state = ACI_DEVICE_SLEEP; //Put the MCU to sleep here // Wakeup the MCU and the nRF8001 when the keyboard is pressed // Use lib_aci_device_wakeup() to wakeup the nRF8001 } } else { if (ACI_BOND_STATUS_SUCCESS != aci_state.bonded) { // Previous bonding failed. Try to bond again. lib_aci_bond(180/* in seconds */, 0x0050 /* advertising interval 50ms*/); Serial.println(F("Advertising started : Waiting to be connected and bonded")); } else { if (bonded_first_time) { bonded_first_time = false; //Store away the dynamic data of the nRF8001 in the Flash or EEPROM of the MCU // so we can restore the bond information of the nRF8001 in the event of power loss //For a HID Keyboard, storage can be only one. Other apps may require storage for every disconnect. //Check if the data has changed before storing the dynamic data for every disconnect. if (bond_data_read_store(&aci_state)) { Serial.println(F("Dynamic Data read and stored successfully")); } } //connect to an already bonded device //Use lib_aci_direct_connect for faster re-connections (advertising interval of 3.75 ms is used for directed advertising) //Directed Advertising will work with Android 4.3 and greater and Windows 8 and greater, will not work with iOS lib_aci_connect(180/* in seconds */, 0x0020 /* advertising interval 20ms*/); Serial.println(F("Already bonded : Advertising started : Waiting to be connected")); } } break; case ACI_EVT_DATA_RECEIVED: Serial.print(F("Pipe #: 0x")); Serial.print(aci_evt->params.data_received.rx_data.pipe_number, HEX); { int i; Serial.print(F(" Data(Hex) : ")); for(i=0; i<aci_evt->len - 2; i++) { Serial.print(aci_evt->params.data_received.rx_data.aci_data[i], HEX); Serial.print(F(" ")); } } Serial.println(F("")); break; case ACI_EVT_HW_ERROR: Serial.print(F("HW error: ")); Serial.println(aci_evt->params.hw_error.line_num, DEC); for(uint8_t counter = 0; counter <= (aci_evt->len - 3); counter++) { Serial.write(aci_evt->params.hw_error.file_name[counter]); //uint8_t file_name[20]; } Serial.println(); //Manage the bond in EEPROM of the AVR { uint8_t eeprom_status = 0; eeprom_status = EEPROM.read(0); if (eeprom_status != 0xFF) { Serial.println(F("Previous Bond present. Restoring")); Serial.println(F("Using existing bond stored in EEPROM.")); Serial.println(F(" To delete the bond stored in EEPROM, connect Pin 6 to 3.3v and Reset.")); Serial.println(F(" Make sure that the bond on the phone/PC is deleted as well.")); //We must have lost power and restarted and must restore the bonding infromation using the ACI Write Dynamic Data if (ACI_STATUS_TRANSACTION_COMPLETE == bond_data_restore(&aci_state, eeprom_status, &bonded_first_time)) { Serial.println(F("Bond restored successfully")); } else { Serial.println(F("Bond restore failed. Delete the bond and try again.")); } } } // Start bonding as all proximity devices need to be bonded to be usable if (ACI_BOND_STATUS_SUCCESS != aci_state.bonded) { lib_aci_bond(180/* in seconds */, 0x0050 /* advertising interval 50ms*/); Serial.println(F("No Bond present in EEPROM.")); Serial.println(F("Advertising started : Waiting to be connected and bonded")); } else { //connect to an already bonded device //Use lib_aci_direct_connect for faster re-connections with PC, not recommended to use with iOS/OS X lib_aci_connect(100/* in seconds */, 0x0020 /* advertising interval 20ms*/); Serial.println(F("Already bonded : Advertising started : Waiting to be connected")); } break; } } else { //Serial.println(F("No ACI Events available")); // No event in the ACI Event queue // Arduino can go to sleep now // Wakeup from sleep from the RDYN line } /* setup_required is set to true when the device starts up and enters setup mode. * It indicates that do_aci_setup() should be called. The flag should be cleared if * do_aci_setup() returns ACI_STATUS_TRANSACTION_COMPLETE. */ if(setup_required) { if (SETUP_SUCCESS == do_aci_setup(&aci_state)) { setup_required = false; } } } /* This is called only once after a reset of the AVR */ void setup(void) { Serial.begin(115200); //Wait until the serial port is available (useful only for the Leonardo) //As the Leonardo board is not reseted every time you open the Serial Monitor #if defined (__AVR_ATmega32U4__) while(!Serial) {} delay(5000); //5 seconds delay for enabling to see the start up comments on the serial board #elif defined(__PIC32MX__) delay(1000); #endif Serial.println(F("Arduino setup")); /** Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001 */ if (NULL != services_pipe_type_mapping) { aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0]; } else { aci_state.aci_setup_info.services_pipe_type_mapping = NULL; } aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES; aci_state.aci_setup_info.setup_msgs = (hal_aci_data_t*) setup_msgs; aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES; //Tell the ACI library, the MCU to nRF8001 pin connections aci_state.aci_pins.board_name = BOARD_DEFAULT; //REDBEARLAB_SHIELD_V1_1 See board.h for details aci_state.aci_pins.reqn_pin = 9; aci_state.aci_pins.rdyn_pin = 8; aci_state.aci_pins.mosi_pin = MOSI; aci_state.aci_pins.miso_pin = MISO; aci_state.aci_pins.sck_pin = SCK; aci_state.aci_pins.spi_clock_divider = SPI_CLOCK_DIV8;//SPI_CLOCK_DIV8 = 2MHz SPI speed //SPI_CLOCK_DIV16 = 1MHz SPI speed aci_state.aci_pins.reset_pin = 4; aci_state.aci_pins.active_pin = UNUSED; aci_state.aci_pins.optional_chip_sel_pin = UNUSED; aci_state.aci_pins.interface_is_interrupt = false; aci_state.aci_pins.interrupt_number = UNUSED; /** We reset the nRF8001 here by toggling the RESET line connected to the nRF8001 * and initialize the data structures required to setup the nRF8001 */ //The second parameter is for turning debug printing on for the ACI Commands and Events so they be printed on the Serial lib_aci_init(&aci_state, false); pinMode(6, INPUT); //Pin #6 on Arduino -> PAIRING CLEAR pin: Connect to 3.3v to clear the pairing if (0x01 == digitalRead(6)) { //Clear the pairing Serial.println(F("Pairing cleared. Remove the wire on Pin 6 and reset the board for normal operation.")); //Address. Value EEPROM.write(0, 0xFF); while(1) {}; } //Initialize the state of the bond aci_state.bonded = ACI_BOND_STATUS_FAILED; } /* This is like a main() { while(1) { loop() } } */ void loop(void) { aci_loop(); /* Method for sending HID Reports */ if (lib_aci_is_pipe_available(&aci_state, PIPE_HID_SERVICE_HID_REPORT_TX) && (aci_state.data_credit_available == 2) && (1 == timer1_f) ) { timer1_f = 0; keypressA[2] = 0x04; lib_aci_send_data(PIPE_HID_SERVICE_HID_REPORT_TX, &keypressA[0], 8); aci_state.data_credit_available--; keypressA[2] = 0x00; lib_aci_send_data(PIPE_HID_SERVICE_HID_REPORT_TX, &keypressA[0], 8); aci_state.data_credit_available--; } }
{ "pile_set_name": "Github" }
_NOTE: The iperf3 issue tracker is for registering bugs, enhancement requests, or submissions of code. It is not a means for asking questions about building or using iperf3. Those are best directed towards the iperf3 mailing list at [email protected] or question sites such as Stack Overflow (http://www.stackoverflow.com/). A list of frequently-asked questions regarding iperf3 can be found at http://software.es.net/iperf/faq.html._ # Context * Version of iperf3: * Hardware: * Operating system (and distribution, if any): _Please note: iperf3 is supported on Linux, FreeBSD, and macOS. Support may be provided on a best-effort basis to other UNIX-like platforms. We cannot provide support for building and/or running iperf3 on Windows, iOS, or Android._ * Other relevant information (for example, non-default compilers, libraries, cross-compiling, etc.): _Please fill out one of the "Bug Report" or "Enhancement Request" sections, as appropriate._ # Bug Report * Expected Behavior * Actual Behavior * Steps to Reproduce * Possible Solution _Please submit patches or code changes as a pull request._ # Enhancement Request * Current behavior * Desired behavior * Implementation notes _If submitting a proposed implementation of an enhancement request, please use the pull request mechanism._
{ "pile_set_name": "Github" }
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage_Sales * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Quote address shipping rate mysql4 resource model * * @category Mage * @package Mage_Sales * @author Magento Core Team <[email protected]> */ class Mage_Sales_Model_Mysql4_Quote_Address_Rate extends Mage_Sales_Model_Resource_Quote_Address_Rate { }
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # termineter # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of the project 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. # from __future__ import absolute_import from __future__ import unicode_literals import argparse import logging import os import sys lib_directory = os.path.join(os.path.dirname(__file__), 'lib') if os.path.isdir(os.path.join(lib_directory, 'termineter')): sys.path.insert(0, lib_directory) from termineter import __version__ from termineter.interface import InteractiveInterpreter def main(): parser = argparse.ArgumentParser(description='Termineter: Python Smart Meter Testing Framework', conflict_handler='resolve') parser.add_argument('-v', '--version', action='version', version=parser.prog + ' Version: ' + __version__) parser.add_argument('-L', '--log', dest='loglvl', action='store', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], default='CRITICAL', help='set the logging level') parser.add_argument('-r', '--rc-file', dest='resource_file', action='store', default=True, help='execute a resource file') arguments = parser.parse_args() logging.getLogger('').setLevel(logging.DEBUG) console_log_handler = logging.StreamHandler() console_log_handler.setLevel(getattr(logging, arguments.loglvl)) console_log_handler.setFormatter(logging.Formatter("%(levelname)-8s %(message)s")) logging.getLogger('').addHandler(console_log_handler) rc_file = arguments.resource_file del arguments, parser interpreter = InteractiveInterpreter(rc_file, log_handler=console_log_handler) interpreter.cmdloop() logging.shutdown() if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
Subsystem-SymbolicName: t7.c-1.0; singleton:=true Subsystem-Version: 1.0 Subsystem-Type: osgi.subsystem.feature Subsystem-Content: t7.h-1.0; type="osgi.subsystem.feature", t7.i-1.0; type="osgi.subsystem.feature"
{ "pile_set_name": "Github" }
// (C) Copyright John Maddock 2005. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_COMPLEX_ATAN_INCLUDED #define BOOST_MATH_COMPLEX_ATAN_INCLUDED #ifndef BOOST_MATH_COMPLEX_DETAILS_INCLUDED # include <boost/math/complex/details.hpp> #endif #ifndef BOOST_MATH_COMPLEX_ATANH_INCLUDED # include <boost/math/complex/atanh.hpp> #endif namespace boost{ namespace math{ template<class T> std::complex<T> atan(const std::complex<T>& x) { // // We're using the C99 definition here; atan(z) = -i atanh(iz): // if(x.real() == 0) { if(x.imag() == 1) return std::complex<T>(0, std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : static_cast<T>(HUGE_VAL)); if(x.imag() == -1) return std::complex<T>(0, std::numeric_limits<T>::has_infinity ? -std::numeric_limits<T>::infinity() : -static_cast<T>(HUGE_VAL)); } return ::boost::math::detail::mult_minus_i(::boost::math::atanh(::boost::math::detail::mult_i(x))); } } } // namespaces #endif // BOOST_MATH_COMPLEX_ATAN_INCLUDED
{ "pile_set_name": "Github" }
//===-- AMDGPURegisterInfo.td - AMDGPU register info -------*- tablegen -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Tablegen register definitions common to all hw codegen targets. // //===----------------------------------------------------------------------===// let Namespace = "AMDGPU" in { foreach Index = 0-15 in { // Indices are used in a variety of ways here, so don't set a size/offset. def sub#Index : SubRegIndex<-1, -1>; } def INDIRECT_BASE_ADDR : Register <"INDIRECT_BASE_ADDR">; } include "R600RegisterInfo.td" include "SIRegisterInfo.td"
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>Api Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/bootstrap.min.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/prettify.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/bundled/bootstrap-responsive.min.css'/> <link type='text/css' rel='stylesheet' href='../../../apidoc/stylesheets/application.css'/> <!-- IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div id='container'> <ul class='breadcrumb'> <li> <a href='../../../apidoc/v2.ca.html'>Foreman v2</a> <span class='divider'>/</span> </li> <li> <a href='../../../apidoc/v2/report_templates.ca.html'> Report templates </a> <span class='divider'>/</span> </li> <li class='active'>create</li> <li class='pull-right'> &nbsp;[ <b><a href="../../../apidoc/v2/report_templates/create.ca.html">ca</a></b> | <a href="../../../apidoc/v2/report_templates/create.cs_CZ.html">cs_CZ</a> | <a href="../../../apidoc/v2/report_templates/create.de.html">de</a> | <a href="../../../apidoc/v2/report_templates/create.en.html">en</a> | <a href="../../../apidoc/v2/report_templates/create.en_GB.html">en_GB</a> | <a href="../../../apidoc/v2/report_templates/create.es.html">es</a> | <a href="../../../apidoc/v2/report_templates/create.fr.html">fr</a> | <a href="../../../apidoc/v2/report_templates/create.gl.html">gl</a> | <a href="../../../apidoc/v2/report_templates/create.it.html">it</a> | <a href="../../../apidoc/v2/report_templates/create.ja.html">ja</a> | <a href="../../../apidoc/v2/report_templates/create.ko.html">ko</a> | <a href="../../../apidoc/v2/report_templates/create.nl_NL.html">nl_NL</a> | <a href="../../../apidoc/v2/report_templates/create.pl.html">pl</a> | <a href="../../../apidoc/v2/report_templates/create.pt_BR.html">pt_BR</a> | <a href="../../../apidoc/v2/report_templates/create.ru.html">ru</a> | <a href="../../../apidoc/v2/report_templates/create.sv_SE.html">sv_SE</a> | <a href="../../../apidoc/v2/report_templates/create.zh_CN.html">zh_CN</a> | <a href="../../../apidoc/v2/report_templates/create.zh_TW.html">zh_TW</a> ] </li> </ul> <div class='page-header'> <h1> POST /api/report_templates <br> <small>Create a report template</small> </h1> </div> <div> <h2><span class="translation_missing" title="translation missing: ca.apipie.examples">Examples</span></h2> <pre class="prettyprint">POST /api/report_templates { &quot;report_template&quot;: { &quot;name&quot;: &quot;report_template_test&quot;, &quot;template&quot;: &quot;a,b,c&quot;, &quot;organization_ids&quot;: [ 114267492 ] } } 201 { &quot;template&quot;: &quot;a,b,c&quot;, &quot;default&quot;: false, &quot;snippet&quot;: false, &quot;locked&quot;: false, &quot;description&quot;: null, &quot;created_at&quot;: &quot;2020-03-11 11:18:42 UTC&quot;, &quot;updated_at&quot;: &quot;2020-03-11 11:18:42 UTC&quot;, &quot;name&quot;: &quot;report_template_test&quot;, &quot;id&quot;: 1007981704, &quot;locations&quot;: [], &quot;organizations&quot;: [ { &quot;id&quot;: 114267492, &quot;name&quot;: &quot;Empty Organization&quot;, &quot;title&quot;: &quot;Empty Organization&quot;, &quot;description&quot;: null } ] }</pre> <h2><span class="translation_missing" title="translation missing: ca.apipie.params">Params</span></h2> <table class='table'> <thead> <tr> <th><span class="translation_missing" title="translation missing: ca.apipie.param_name">Param Name</span></th> <th><span class="translation_missing" title="translation missing: ca.apipie.description">Description</span></th> </tr> </thead> <tbody> <tr style='background-color:rgb(255,255,255);'> <td> <strong>location_id </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> </small> </td> <td> <p>Set the current location context for the request</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Integer</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(255,255,255);'> <td> <strong>organization_id </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> </small> </td> <td> <p>Set the current organization context for the request</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Integer</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(255,255,255);'> <td> <strong>report_template </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.required">Required</span> </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a Hash</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[name] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.required">Required</span> </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a String</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[description] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a String</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[template] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.required">Required</span> </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a String</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[snippet] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be one of: <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>.</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[audit_comment] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be a String</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[locked] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p>Determina si una plantilla està bloquejada o no per a l’edició</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be one of: <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>.</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[default] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p>Whether or not the template is added automatically to new organizations and locations</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be one of: <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>.</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[location_ids] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p>SUBSTITUEIX les ubicacions amb els ID donats</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be an array of any type</p> </li> </ul> </td> </tr> <tr style='background-color:rgb(250,250,250);'> <td> <strong>report_template[organization_ids] </strong><br> <small> <span class="translation_missing" title="translation missing: ca.apipie.optional">Optional</span> , &lt;span class=&quot;translation_missing&quot; title=&quot;translation missing: ca.apipie.nil_allowed&quot;&gt;Nil Allowed&lt;/span&gt; </small> </td> <td> <p>SUBSTITUEIX les organitzacions amb els ID donats.</p> <p><strong>Validations:</strong></p> <ul> <li> <p>Must be an array of any type</p> </li> </ul> </td> </tr> </tbody> </table> </div> </div> </div> <hr> <footer></footer> </div> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/jquery.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/bootstrap-collapse.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/bundled/prettify.js'></script> <script type='text/javascript' src='../../../apidoc/javascripts/apipie.js'></script> </body> </html>
{ "pile_set_name": "Github" }
/** * A specialized version of `_.indexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } module.exports = strictIndexOf;
{ "pile_set_name": "Github" }
/* * 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. */ /* * $Id$ */ #if !defined(XERCESC_INCLUDE_GUARD_DOM_HPP) #define XERCESC_INCLUDE_GUARD_DOM_HPP // // This is the primary header file for inclusion in application // programs using the C++ XML Document Object Model API. // #include <xercesc/dom/DOMAttr.hpp> #include <xercesc/dom/DOMCDATASection.hpp> #include <xercesc/dom/DOMCharacterData.hpp> #include <xercesc/dom/DOMComment.hpp> #include <xercesc/dom/DOMDocument.hpp> #include <xercesc/dom/DOMDocumentFragment.hpp> #include <xercesc/dom/DOMDocumentType.hpp> #include <xercesc/dom/DOMElement.hpp> #include <xercesc/dom/DOMEntity.hpp> #include <xercesc/dom/DOMEntityReference.hpp> #include <xercesc/dom/DOMException.hpp> #include <xercesc/dom/DOMImplementation.hpp> #include <xercesc/dom/DOMNamedNodeMap.hpp> #include <xercesc/dom/DOMNode.hpp> #include <xercesc/dom/DOMNodeList.hpp> #include <xercesc/dom/DOMNotation.hpp> #include <xercesc/dom/DOMProcessingInstruction.hpp> #include <xercesc/dom/DOMText.hpp> // Introduced in DOM Level 2 #include <xercesc/dom/DOMDocumentRange.hpp> #include <xercesc/dom/DOMDocumentTraversal.hpp> #include <xercesc/dom/DOMNodeFilter.hpp> #include <xercesc/dom/DOMNodeIterator.hpp> #include <xercesc/dom/DOMRange.hpp> #include <xercesc/dom/DOMRangeException.hpp> #include <xercesc/dom/DOMTreeWalker.hpp> // Introduced in DOM Level 3 #include <xercesc/dom/DOMLSParser.hpp> #include <xercesc/dom/DOMLSParserFilter.hpp> #include <xercesc/dom/DOMConfiguration.hpp> #include <xercesc/dom/DOMLSResourceResolver.hpp> #include <xercesc/dom/DOMError.hpp> #include <xercesc/dom/DOMErrorHandler.hpp> #include <xercesc/dom/DOMImplementationLS.hpp> #include <xercesc/dom/DOMImplementationList.hpp> #include <xercesc/dom/DOMImplementationRegistry.hpp> #include <xercesc/dom/DOMImplementationSource.hpp> #include <xercesc/dom/DOMLSInput.hpp> #include <xercesc/dom/DOMLSOutput.hpp> #include <xercesc/dom/DOMLocator.hpp> #include <xercesc/dom/DOMPSVITypeInfo.hpp> #include <xercesc/dom/DOMStringList.hpp> #include <xercesc/dom/DOMTypeInfo.hpp> #include <xercesc/dom/DOMUserDataHandler.hpp> #include <xercesc/dom/DOMLSSerializer.hpp> #include <xercesc/dom/DOMLSSerializerFilter.hpp> #include <xercesc/dom/DOMXPathEvaluator.hpp> #include <xercesc/dom/DOMXPathNSResolver.hpp> #include <xercesc/dom/DOMXPathException.hpp> #include <xercesc/dom/DOMXPathExpression.hpp> #include <xercesc/dom/DOMXPathResult.hpp> #include <xercesc/dom/DOMXPathNamespace.hpp> #endif
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard. // #import <Cocoa/NSView.h> @class NSButton, NSPopUpButton, NSTextField; @interface SetDateIncrementOptions : NSView { NSPopUpButton *mAddSubtractSwitch; NSPopUpButton *mAddTimeQuanta; NSTextField *mAddTimeValue; NSButton *mEmbedSwitch; } - (BOOL)embed; - (double)incrementedDateForDate:(double)arg1; - (void)setDateIncrement:(double)arg1 embed:(BOOL)arg2; - (void)saveToPrefs; - (void)loadFromPrefs; @end
{ "pile_set_name": "Github" }
[2016-12-19 16:31:47,278] INFO Starting the log cleaner (kafka.log.LogCleaner) [2016-12-19 16:31:47,283] INFO [kafka-log-cleaner-thread-0], Starting (kafka.log.LogCleaner)
{ "pile_set_name": "Github" }
rdkit.Chem.Draw.qtCanvas module =============================== .. automodule:: rdkit.Chem.Draw.qtCanvas :members: :undoc-members: :show-inheritance:
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.7"/> <title>My Project: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">My Project </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.7 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">NexNumber Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="class_nex_number.html">NexNumber</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="class_nex_touch.html#a4da1c4fcdfadb7eabfb9ccaba9ecad11">attachPop</a>(NexTouchEventCb pop, void *ptr=NULL)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_touch.html#a685a753aae5eb9fb9866a7807a310132">attachPush</a>(NexTouchEventCb push, void *ptr=NULL)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_touch.html#af656640c1078a553287a68bf792dd291">detachPop</a>(void)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_touch.html#a2bc36096119534344c2bcd8021b93289">detachPush</a>(void)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#aa7ef40e79d89eb0aeebbeb67147a0d20">Get_background_color_bco</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a9772a6717c19c5a03ea0e33ff71492d9">Get_background_crop_picc</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#a9f235a8929b4f6c282511c04c88216c1">Get_background_image_pic</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a7eb3fba2bfa2fff8df8e7e0f633f9cf9">Get_font_color_pco</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#a0dfc73db91229f114e502bc14084e711">Get_number_lenth</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a7ca05534f06911218bae6606ccc355fa">Get_place_xcen</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#ac8f0cef0d04e72bb864f6da88f028c9f">Get_place_ycen</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a8ccd35555397e828cf8b1f0a8e9ba294">getFont</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>getObjCid</b>(void) (defined in <a class="el" href="class_nex_object.html">NexObject</a>)</td><td class="entry"><a class="el" href="class_nex_object.html">NexObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>getObjName</b>(void) (defined in <a class="el" href="class_nex_object.html">NexObject</a>)</td><td class="entry"><a class="el" href="class_nex_object.html">NexObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>getObjPid</b>(void) (defined in <a class="el" href="class_nex_object.html">NexObject</a>)</td><td class="entry"><a class="el" href="class_nex_object.html">NexObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#ad184ed818666ec482efddf840185c7b8">getValue</a>(uint32_t *number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>iterate</b>(NexTouch **list, uint8_t pid, uint8_t cid, int32_t event) (defined in <a class="el" href="class_nex_touch.html">NexTouch</a>)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a59c2ed35b787f498e7fbc54eff71d00b">NexNumber</a>(uint8_t pid, uint8_t cid, const char *name)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_object.html#ab15aadb9c91d9690786d8d25d12d94e1">NexObject</a>(uint8_t pid, uint8_t cid, const char *name)</td><td class="entry"><a class="el" href="class_nex_object.html">NexObject</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_touch.html#a9e028e45e0d2d2cc39c8bf8d03dbb887">NexTouch</a>(uint8_t pid, uint8_t cid, const char *name)</td><td class="entry"><a class="el" href="class_nex_touch.html">NexTouch</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_object.html#abeff0c61474e8b3ce6bac76771820b64">printObjInfo</a>(void)</td><td class="entry"><a class="el" href="class_nex_object.html">NexObject</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a8168c315e57d9aec3b61ed4febaa6663">Set_background_color_bco</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#a410bd4092a5874541da654edd86a01eb">Set_background_crop_picc</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#aa45acacbde526fce04c699104114d1f1">Set_background_image_pic</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#ab1836d2d570fca4cd707acecc4b67dea">Set_font_color_pco</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a045519a466875775d561e54176c459ad">Set_number_lenth</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#a5e58200c740340cc2666e61b6c80e891">Set_place_xcen</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a05aa6572aabe07b48c1b0675904aaadd">Set_place_ycen</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="class_nex_number.html#aed567aef79411c5457c81be272218439">setFont</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="class_nex_number.html#a9cef51f6b76b4ba03a31b2427ffd4526">setValue</a>(uint32_t number)</td><td class="entry"><a class="el" href="class_nex_number.html">NexNumber</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Dec 1 2016 09:26:03 for My Project by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.7 </small></address> </body> </html>
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // @protocol settingModifyAliasDelegate - (void)saveNewAlias; @end
{ "pile_set_name": "Github" }
/** * refer: * * @atimb "Real keep-alive HTTP agent": https://gist.github.com/2963672 * * https://github.com/joyent/node/blob/master/lib/http.js * * https://github.com/joyent/node/blob/master/lib/https.js * * https://github.com/joyent/node/blob/master/lib/_http_agent.js */ 'use strict'; const OriginalAgent = require('./_http_agent').Agent; const ms = require('humanize-ms'); class Agent extends OriginalAgent { constructor(options) { options = options || {}; options.keepAlive = options.keepAlive !== false; // default is keep-alive and 15s free socket timeout if (options.freeSocketKeepAliveTimeout === undefined) { options.freeSocketKeepAliveTimeout = 15000; } // Legacy API: keepAliveTimeout should be rename to `freeSocketKeepAliveTimeout` if (options.keepAliveTimeout) { options.freeSocketKeepAliveTimeout = options.keepAliveTimeout; } options.freeSocketKeepAliveTimeout = ms(options.freeSocketKeepAliveTimeout); // Sets the socket to timeout after timeout milliseconds of inactivity on the socket. // By default is double free socket keepalive timeout. if (options.timeout === undefined) { options.timeout = options.freeSocketKeepAliveTimeout * 2; // make sure socket default inactivity timeout >= 30s if (options.timeout < 30000) { options.timeout = 30000; } } options.timeout = ms(options.timeout); super(options); this.createSocketCount = 0; this.createSocketCountLastCheck = 0; this.createSocketErrorCount = 0; this.createSocketErrorCountLastCheck = 0; this.closeSocketCount = 0; this.closeSocketCountLastCheck = 0; // socket error event count this.errorSocketCount = 0; this.errorSocketCountLastCheck = 0; this.requestCount = 0; this.requestCountLastCheck = 0; this.timeoutSocketCount = 0; this.timeoutSocketCountLastCheck = 0; this.on('free', s => { this.requestCount++; // last enter free queue timestamp s.lastFreeTime = Date.now(); }); this.on('timeout', () => { this.timeoutSocketCount++; }); this.on('close', () => { this.closeSocketCount++; }); this.on('error', () => { this.errorSocketCount++; }); } createSocket(req, options, cb) { super.createSocket(req, options, (err, socket) => { if (err) { this.createSocketErrorCount++; return cb(err); } if (this.keepAlive) { // Disable Nagle's algorithm: http://blog.caustik.com/2012/04/08/scaling-node-js-to-100k-concurrent-connections/ // https://fengmk2.com/benchmark/nagle-algorithm-delayed-ack-mock.html socket.setNoDelay(true); } this.createSocketCount++; cb(null, socket); }); } get statusChanged() { const changed = this.createSocketCount !== this.createSocketCountLastCheck || this.createSocketErrorCount !== this.createSocketErrorCountLastCheck || this.closeSocketCount !== this.closeSocketCountLastCheck || this.errorSocketCount !== this.errorSocketCountLastCheck || this.timeoutSocketCount !== this.timeoutSocketCountLastCheck || this.requestCount !== this.requestCountLastCheck; if (changed) { this.createSocketCountLastCheck = this.createSocketCount; this.createSocketErrorCountLastCheck = this.createSocketErrorCount; this.closeSocketCountLastCheck = this.closeSocketCount; this.errorSocketCountLastCheck = this.errorSocketCount; this.timeoutSocketCountLastCheck = this.timeoutSocketCount; this.requestCountLastCheck = this.requestCount; } return changed; } getCurrentStatus() { return { createSocketCount: this.createSocketCount, createSocketErrorCount: this.createSocketErrorCount, closeSocketCount: this.closeSocketCount, errorSocketCount: this.errorSocketCount, timeoutSocketCount: this.timeoutSocketCount, requestCount: this.requestCount, freeSockets: inspect(this.freeSockets), sockets: inspect(this.sockets), requests: inspect(this.requests), }; } } module.exports = Agent; function inspect(obj) { const res = {}; for (const key in obj) { res[key] = obj[key].length; } return res; }
{ "pile_set_name": "Github" }
/** * 设置LayaNative屏幕方向,可设置以下值 * landscape 横屏 * portrait 竖屏 * sensor_landscape 横屏(双方向) * sensor_portrait 竖屏(双方向) */ window.screenOrientation = "sensor_landscape"; //-----libs-begin----- loadLib("libs/laya.core.js") loadLib("libs/laya.webgl.js") loadLib("libs/laya.ui.js") loadLib("libs/laya.physics.js") //-----libs-end------- loadLib("js/bundle.js");
{ "pile_set_name": "Github" }
WITH lastset AS ( SELECT max(set) as lastset from tests ) SELECT set,script,scale,test,clients,workers, rate_limit AS limit, round(tps) AS tps, round(1000*avg_latency)/1000 AS avg_latency, round(1000*percentile_90_latency)/1000 AS "90%<", 1000*round(max_latency)/1000 AS max_latency, trans FROM tests WHERE set = (SELECT lastset FROM lastset) ORDER BY set,script,scale,test,clients,rate_limit;
{ "pile_set_name": "Github" }
--- layout: single elementName: span --- <section id="span" class="element"> <header class="element-header"> <nav class="element-links"> <span> Type: <strong>inline</strong> </span> <span> Self-closing: <strong> No </strong> </span> <a class="element-links-direct" href="{{site.url}}/element/span/" data-element-name="span" data-tooltip="Single page for this element">Permalink</a> <a class="element-share" data-tooltip="Share on Twitter or Facebook" data-element-name="span">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/HTML/Element/span" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a> </nav> <h2 class="element-name"> <a href="#span"> <span>#</span> span </a> </h2> <div class="element-description"> <p>Defines a <strong>generic inline</strong> container of content, that does not carry any semantic value.</p> </div> </header> </section>
{ "pile_set_name": "Github" }
using HamburgerMenuApp.Core.MVVM; namespace HamburgerMenuApp.V4.ViewModels { public class HomeViewModel : MenuItemViewModel { public HomeViewModel(MainViewModel mainViewModel) : base(mainViewModel) { } } }
{ "pile_set_name": "Github" }
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`SplitButton for business themes renders styles correctly 1`] = ` .c6 { display: inline-block; position: relative; color: #26A826; background-color: transparent; } .c6:hover { color: #1E861E; background-color: transparent; } .c6::before { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: CarbonIcons; content: "\\e910"; font-size: 16px; font-style: normal; font-weight: normal; line-height: 16px; vertical-align: middle; display: block; } .c7 ~ .c1 { margin-left: 16px; } .c7:hover .c5 { color: #FFFFFF; } .c7 .c5 { margin-left: 8px; margin-right: 0px; height: 16px; } .c7 .c5 svg { margin-top: 0; } .c2 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; cursor: pointer; display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-flex-flow: wrap; -ms-flex-flow: wrap; flex-flow: wrap; -webkit-box-pack: center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; vertical-align: middle; border: 2px solid transparent; box-sizing: border-box; font-weight: 600; padding-top: 1px; padding-bottom: 1px; -webkit-text-decoration: none; text-decoration: none; background: transparent; border-color: #26A826; color: #26A826; font-size: 14px; height: 40px; padding-left: 24px; padding-right: 24px; margin-left: 0; } .c2:focus { outline: solid 3px #FFB500; } .c2 ~ .c1 { margin-left: 16px; } .c2:hover { background: #006300; border-color: #006300; color: #FFFFFF; } .c2:hover .c5 { color: #FFFFFF; } .c2 .c5 { margin-left: 0px; margin-right: 8px; height: 16px; } .c2 .c5 svg { margin-top: 0; } .c0 { display: inline-block; position: relative; } .c0 > .c1 { margin: 0; } .c0 > .c1:focus { border: 3px solid #FFB500; outline: none; margin: -1px; } .c4 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; cursor: pointer; display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; -webkit-flex-flow: wrap; -ms-flex-flow: wrap; flex-flow: wrap; -webkit-box-pack: center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; vertical-align: middle; border: 2px solid transparent; box-sizing: border-box; font-weight: 600; padding-top: 1px; padding-bottom: 1px; -webkit-text-decoration: none; text-decoration: none; background: transparent; border-color: #26A826; color: #26A826; font-size: 14px; height: 40px; padding-left: 24px; padding-right: 24px; margin-left: 0; border-left-width: 0; padding: 0 10px; } .c4:focus { outline: solid 3px #FFB500; } .c4 ~ .c3 { margin-left: 16px; } .c4:hover { background: #006300; border-color: #006300; color: #FFFFFF; } .c4:hover .c5 { color: #FFFFFF; } .c4 .c5 { margin-left: 8px; margin-right: 0px; height: 16px; } .c4 .c5 svg { margin-top: 0; } .c1 + .c4 { margin-left: 0; } .c1 + .c4:focus { margin-left: -3px; } .c1 + .c4 .c5 { margin-left: 0; } .c8 .c1 { background-color: #006046; border: 1px solid #006046; color: #FFFFFF; display: block; margin-left: 0; margin-top: 3px; margin-bottom: 3px; min-width: 100%; z-index: 1000; } .c8 .c1:focus, .c8 .c1:hover { background-color: #00402E; } .c8 .c1 + .c10 .c1 { margin-top: 3px; } .c9 .c1 { background-color: #005C9A; border: 1px solid #005C9A; color: #FFFFFF; display: block; margin-left: 0; margin-top: 3px; margin-bottom: 3px; min-width: 100%; z-index: 1000; } .c9 .c1:focus, .c9 .c1:hover { background-color: #004472; } .c9 .c1 + .c10 .c1 { margin-top: 3px; } <div aria-haspopup="true" className="c0" data-component="split-button" data-element="bar" data-role="baz" onMouseLeave={[Function]} > <button className="c1 c2" data-component="button" data-element="main-button" disabled={false} id="guid-12345" onFocus={[Function]} onMouseEnter={[Function]} onTouchStart={[Function]} role="button" size="medium" type="button" > <span> <span data-element="main-text" > Split button </span> </span> </button> <button aria-expanded={false} aria-haspopup="true" aria-label="Show more" className="c1 c3 c4" data-element="toggle-button" disabled={false} onBlur={[Function]} onFocus={[Function]} onKeyDown={[Function]} onMouseEnter={[Function]} onTouchStart={[Function]} size="medium" > <span className="c5 c6" data-component="icon" data-element="dropdown" disabled={false} fontSize="small" type="dropdown" /> </button> </div> `;
{ "pile_set_name": "Github" }
.validatebox-invalid { border-color: #ffa8a8; background-color: #fff; color: #404040; }
{ "pile_set_name": "Github" }
import * as assert from "assert"; import * as sort from "./sort"; export function sortTest() { }
{ "pile_set_name": "Github" }
# shellcheck shell=bash log() { echo "•" "$@" } error() { log "error:" "$@" exit 1 } command_exists() { command -v "${1}" >/dev/null 2>&1 } check_command() { local cmd="${1}" if ! command_exists "${cmd}"; then error "${cmd}: command not found, please install ${cmd}." fi } goos() { local os os="$(uname -s)" case "${os}" in Linux*) echo linux;; Darwin*) echo darwin;; *) error "unknown OS: ${os}";; esac } arch() { uname -m } goarch() { local arch arch="$(uname -m)" case "${arch}" in armv5*) echo "armv5";; armv6*) echo "armv6";; armv7*) echo "armv7";; aarch64) echo "arm64";; x86) echo "386";; x86_64) echo "amd64";; i686) echo "386";; i386) echo "386";; *) error "uknown arch: ${arch}";; esac } mktempdir() { mktemp -d 2>/dev/null || mktemp -d -t 'firekube' } do_curl() { local path="${1}" local url="${2}" log "Downloading ${url}" curl --progress-bar -fLo "${path}" "${url}" } do_curl_binary() { local cmd="${1}" local url="${2}" do_curl "${HOME}/.wks/bin/${cmd}" "${url}" chmod +x "${HOME}/.wks/bin/${cmd}" } do_curl_tarball() { local cmd="${1}" local url="${2}" dldir="$(mktempdir)" mkdir "${dldir}/${cmd}" do_curl "${dldir}/${cmd}.tar.gz" "${url}" tar -C "${dldir}/${cmd}" -xvf "${dldir}/${cmd}.tar.gz" mv "${dldir}/${cmd}/${cmd}" "${HOME}/.wks/bin/${cmd}" rm -rf "${dldir}" } clean_version() { echo "${1}" | sed -n -e 's#^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*#\1#p' } # Given "${1}" and $2 as semantic version numbers like 3.1.2, return [ "${1}" < $2 ] version_lt() { # clean up the version string local a a="$(clean_version "${1}")" local b b="$(clean_version "${2}")" A_MAJOR="${a%.*.*}" REST="${a%.*}" A_MINOR="${REST#*.}" A_PATCH="${a#*.*.}" B_MAJOR="${b%.*.*}" REST="${b%.*}" B_MINOR="${REST#*.}" B_PATCH="${b#*.*.}" [ "${A_MAJOR}" -lt "${B_MAJOR}" ] && return 0 [ "${A_MAJOR}" -gt "${B_MAJOR}" ] && return 1 [ "${A_MINOR}" -lt "${B_MINOR}" ] && return 0 [ "${A_MINOR}" -gt "${B_MINOR}" ] && return 1 [ "${A_PATCH}" -lt "${B_PATCH}" ] } download() { local cmd="${1}" local version="${2}" eval "${cmd}_download" "${cmd}" "${version}" } help() { local cmd="${1}" shift log "error: ${cmd}:" "$@" echo eval "${cmd}_help" exit 1 } version_check() { local cmd="${1}" local version="${2}" local req="${3}" log "Found ${cmd} ${version}" if version_lt "${version}" "${req}"; then help "${cmd}" "Found version ${version} but ${req} is the minimum required version." fi } check_version() { local cmd="${1}" local req="${2}" if ! command_exists "${cmd}" || [ "${download_force}" == "yes" ]; then if [ "${download}" == "yes" ]; then download "${cmd}" "${req}" else log "${cmd}: command not found" eval "${cmd}_help" exit 1 fi fi eval "${cmd}_version" "${req}" } git_ssh_url() { # shellcheck disable=SC2001 echo "${1}" | sed -e 's#^https://github.com/#[email protected]:#' } git_http_url() { # shellcheck disable=SC2001 echo "${1}" | sed -e 's#^[email protected]:#https://github.com/#' } git_current_branch() { # Fails when not on a branch unlike: `git name-rev --name-only HEAD` git symbolic-ref --short HEAD } git_remote_fetchurl() { git config --get "remote.${1}.url" }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Impact++ / Source: abilities/ability-shoot.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="scripts/html5shiv.js"> </script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="styles/main.css"> </head> <body data-spy="scroll" data-target="#navdoc"> <section> <article> <pre class="prettyprint source"><code>ig.module( 'plusplus.abilities.ability-shoot' ) .requires( 'plusplus.core.config', 'plusplus.core.input', 'plusplus.abilities.ability', 'plusplus.helpers.utilsmath' ) .defines(function() { "use strict"; var _c = ig.CONFIG; var _utm = ig.utilsmath; /** * Ability to shoot projectiles. For instant damage, use {@link ig.AbilityDamage} instead. * &lt;span class="alert alert-danger">&lt;strong>IMPORTANT:&lt;/strong> always use abilities by calling the {@link ig.Ability#activate} method, and if the ability {@link ig.Ability#requiresTarget} make sure it {@link ig.Ability#canFindTarget} or you supply one via {@link ig.Ability#setEntityTarget} or {@link ig.Ability#setEntityTargetFirst}!&lt;/span> * @class * @extends ig.Ability * @author Collin Hover - collinhover.com * @example * // shooting things is easy * // each character already has an abilities list * // which is a special hierarchy object * // that has built in methods to facilitate ability use * character.abilities = new ig.Hierarchy(); * // but this abilities list is empty * // so create a new shoot ability * // and don't forget to pass the entity * // so the ability has a reference to its user * character.shoot = new ig.AbilityShoot( character ); * // unlike some other abilities * // the shoot ability won't work out of the box * // it needs a projectile entity class * // so lets make a new one * ig.EntityBullet = ig.global.EntityBullet = ig.Projectile.extend({ * size: { x: 10, y: 6 }, * animSheet: new ig.AnimationSheet( ig.CONFIG.PATH_TO_MEDIA + 'bullet.png', 10, 6), * damage: 10 * }); * // and set it as our shoot ability's spawningEntity * character.shoot.spawningEntity = ig.EntityBullet; * // then, optionally, add the ability * // to the character's ability list * character.abilities.addDescendant( character.shoot ); * // now when our character needs to get violent * // and really shoot something * character.shoot.activate(); * // but we also want to control where the bullet fires * var shootSettings = { offsetX: -10, offsetY: 0 }; * // it can accelerate towards our offset * character.shoot.offsetAccelX = 1; * character.shoot.offsetAccelY = 1; * // it can also start with a velocity towards our offset * character.shoot.offsetVelX = 1; * character.shoot.offsetVelY = 1; * // and now, when we shoot, the projectile * // should go towards the left * character.shoot.activate( shootSettings ); * // or instead of defining the offset in the settings * // we can give the ability the player's tapping input * // and it will figure out the offset direction for us * // so lets get all input points that have tapped * var inputPoints = ig.input.getInputPoints([ 'tapped' ], [ true ]); * // for the example, use only the first * var inputPoint = inputPoints[ 0 ]; * if ( inputPoint ) { * // and give it to the shoot ability * character.shoot.activate(inputPoint); * } * // in the case of the player * // if you want the shoot to automatically work with tapping * // in other words, you won't need to bother with input points * // just set the ability type to spammable (don't forget to require ig.utils) * ig.AbilityShootThings = ig.AbilityShoot.extend({ * initTypes: function () { * this.parent(); * ig.utils.addType(ig.Ability, this, 'type', "SPAMMABLE"); * } * }); **/ ig.AbilityShoot = ig.Ability.extend( /**@lends ig.AbilityShoot.prototype */ { /** * Type of projectile to spawn. * @type String|ig.EntityExtended */ spawningEntity: '', /** * Ability can be done while moving. * @override * @default */ movable: true, /** * Whether to spawn at entity or at target position. * @type Boolean * @default */ spawnAtTarget: false, /** * Minimum position on y axis, as a percent from 0 to 1, from left of entity that a projectile can be fired from. * @type Number * @default */ shootLocationMinPctX: 0, /** * Maximum position on y axis, as a percent from 0 to 1, from left of entity that a projectile can be fired from. * @type Number * @default */ shootLocationMaxPctX: 1, /** * Minimum position on x axis, as a percent from 0 to 1, from top of entity that a projectile can be fired from. * @type Number * @default */ shootLocationMinPctY: _c.TOP_DOWN ? 0 : 0.5, /** * Maximum position on x axis, as a percent from 0 to 1, from top of entity that a projectile can be fired from. * @type Number * @default */ shootLocationMaxPctY: _c.TOP_DOWN ? 1 : 0.5, /** * Horizontal acceleration of projectile in offset direction. * @type Number * @default */ offsetAccelX: 0, /** * Vertical acceleration of projectile in offset direction. * @type Number * @default */ offsetAccelY: 0, /** * Horizontal velocity of projectile in offset direction. * @type Number * @default */ offsetVelX: 0, /** * Vertical velocity of projectile in offset direction. * @type Number * @default */ offsetVelY: 0, /** * Percent user's horizontal velocity to add to projectile, where 1 = 100%. * @type Number * @default */ relativeVelPctX: 0, /** * Percent user's vertical velocity to add to projectile, where 1 = 100%. * @type Number * @default */ relativeVelPctY: 0, /** * Cast activate by animation 'shoot' while moving. * @override */ activateCastSettings: { animName: 'shoot' }, /** * Creates projectile and handles application of settings. * @param {Object} settings settings object. * @override **/ activateComplete: function(settings) { var entityOptions = this.entityOptions || this.entity; // add entity group to projectile settings so we don't hit own group with projectile var ps = { group: this.entity.group }; // merge settings if (entityOptions.projectileSettings) { ig.merge(ps, entityOptions.projectileSettings); } var minX; var minY; var width; var height; var x; var y; if (this.spawnAtTarget &amp;&amp; this.entityTarget) { minX = this.entityTarget.pos.x; minY = this.entityTarget.pos.y; width = this.entityTarget.size.x; height = this.entityTarget.size.y; } else { minX = this.entity.pos.x; minY = this.entity.pos.y; width = this.entity.size.x; height = this.entity.size.y; } x = minX + width * 0.5; y = minY + height * 0.5; if (settings) { if (settings.projectileSettings) { ig.merge(ps, settings.projectileSettings); } var offsetX = settings.offsetX || 0; var offsetY = settings.offsetY || 0; var length; if (!offsetX &amp;&amp; !offsetY) { var targetX; var targetY; if (settings instanceof ig.InputPoint) { targetX = settings.worldX || 0; targetY = settings.worldY || 0; } else { targetX = settings.x || 0; targetY = settings.y || 0; } var diffX = targetX - x; var diffY = targetY - y; length = Math.sqrt(diffX * diffX + diffY * diffY) || 1; offsetX = (diffX / length) * width * 0.5; offsetY = (diffY / length) * height * 0.5; } length = Math.sqrt(offsetX * offsetX + offsetY * offsetY) || 1; if (this.spawnAtTarget &amp;&amp; !this.entityTarget) { x = minX = targetX; y = minY = targetY; width = height = 0; } x += offsetX; y += offsetY; var normalX = offsetX / length; var normalY = offsetY / length; } x = _utm.clamp(x, minX + width * this.shootLocationMinPctX, minX + width * this.shootLocationMaxPctX); y = _utm.clamp(y, minY + height * this.shootLocationMinPctY, minY + height * this.shootLocationMaxPctY); if (ig.game.isInsideLevel(x, y)) { var projectile = ig.game.spawnEntity(this.spawningEntity, x, y, ps); projectile.pos.x -= projectile.size.x * 0.5; projectile.pos.y -= projectile.size.y * 0.5; // offset x if (offsetX) { // check velocity base if ((offsetX > 0 &amp;&amp; projectile.vel.x &lt; 0) || (offsetX &lt; 0 &amp;&amp; projectile.vel.x > 0)) { projectile.vel.x = -projectile.vel.x; } // offset accel if (this.offsetAccelX) { projectile.accel.x += this.offsetAccelX * (this.offsetAccelY ? normalX : (normalX &lt; 0 ? -1 : 1)); } // offset velocity if (this.offsetVelX) { projectile.vel.x += this.offsetVelX * (this.offsetVelY ? normalX : (normalX &lt; 0 ? -1 : 1)); } } // offset y if (offsetY) { // check velocity base if ((offsetY > 0 &amp;&amp; projectile.vel.y &lt; 0) || (offsetY &lt; 0 &amp;&amp; projectile.vel.y > 0)) { projectile.vel.x = -projectile.vel.y; } // offset accel if (this.offsetAccelY) { projectile.accel.y += this.offsetAccelY * (this.offsetAccelX ? normalY : (normalY &lt; 0 ? -1 : 1)); } // offset velocity if (this.offsetVelY) { projectile.vel.y += this.offsetVelY * (this.offsetVelX ? normalY : (normalY &lt; 0 ? -1 : 1)); } } // add velocity of entity if (this.relativeVelPctX) { projectile.vel.x += this.entity.vel.x * this.relativeVelPctX; } if (this.relativeVelPctY &amp;&amp; !this.entity.grounded) { projectile.vel.y += this.entity.vel.y * this.relativeVelPctY; } // flip entity to projectile this.entity.lookAt(projectile); } this.parent(); return projectile; }, /** * @override **/ clone: function(c) { if (c instanceof ig.AbilityShoot !== true) { c = new ig.AbilityShoot(); } c.spawningEntity = this.spawningEntity; return this.parent(c); } }); }); </code></pre> </article> </section> <script src="scripts/linenumber.js"> </script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="scripts/jquery-1.9.1.min.js"><\/script>')</script> <script src="scripts/bootstrap.min.js"> </script> <script src="scripts/main.js"> </script> </body> </html>
{ "pile_set_name": "Github" }
// +build gofuzz package securecookie var hashKey = []byte("very-secret12345") var blockKey = []byte("a-lot-secret1234") var s = New(hashKey, blockKey) type Cookie struct { B bool I int S string } func Fuzz(data []byte) int { datas := string(data) var c Cookie if err := s.Decode("fuzz", datas, &c); err != nil { return 0 } if _, err := s.Encode("fuzz", c); err != nil { panic(err) } return 1 }
{ "pile_set_name": "Github" }
function muf(s) x=-3:.001:3; f1=abs(x+sqrt(s)).^((sqrt(s)-1)/(2*sqrt(s))); f2=abs(x-sqrt(s)).^((sqrt(s)+1)/(2*sqrt(s))); f=f1.*f2; clf hold on plot(x,f1,'b--'); plot(x,f2,'k--'); plot(x,f ,'k'); xlabel('x'); ylabel('f(x)'); grid on;
{ "pile_set_name": "Github" }
%% DO NOT EDIT this file manually; it is automatically %% generated from LSR http://lsr.di.unimi.it %% Make any changes in LSR itself, or in Documentation/snippets/new/ , %% and then run scripts/auxiliar/makelsr.py %% %% This file is in the public domain. \version "2.21.2" \header { lsrtags = "editorial-annotations" texidoc = " Choose different font sizes for instrumentName and shortInstrumentName as a context override. " doctitle = "Different font size settings for instrumentName and shortInstrumentName" } % begin verbatim InstrumentNameFontSize = #(define-music-function (font-size-pair)(pair?) "Sets the @code{font-size} of @code{InstrumentName}. The font-size for the initial @code{instrumentName} is taken from the first value in @var{font-size-pair}. @code{shortInstrumentName} will get the second value of @var{font-size-pair}. " ;; This code could be changed/extended to set different values for each ;; occurance of `shortInstrumentName' #{ \override InstrumentName.after-line-breaking = #(lambda (grob) (let* ((orig (ly:grob-original grob)) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '()))) (if (pair? siblings) (begin (ly:grob-set-property! (car siblings) 'font-size (car font-size-pair)) (for-each (lambda (g) (ly:grob-set-property! g 'font-size (cdr font-size-pair))) (cdr siblings)))))) #}) \layout { \context { \Staff \InstrumentNameFontSize #'(6 . -3) } } \new StaffGroup << \new Staff \with { instrumentName = "Flute" shortInstrumentName = "Fl." } { c''1 \break c'' \break c'' } \new Staff \with { instrumentName = "Violin" shortInstrumentName = "Vl." } { c''1 \break c'' \break c'' } >>
{ "pile_set_name": "Github" }
import styled from 'styled-components'; import ButtonIcon from '../../ButtonIcon'; import attachThemeAttrs from '../../../styles/helpers/attachThemeAttrs'; const StyledAutoplayButton = attachThemeAttrs(styled(ButtonIcon))` color: ${props => props.palette.brand.main}; `; export default StyledAutoplayButton;
{ "pile_set_name": "Github" }
// // MJG2DPinchGestureRecognizer.h // MJGFoundation // // Created by Matt Galloway on 01/02/2012. // Copyright 2012 Matt Galloway. All rights reserved. // #import <UIKit/UIKit.h> @interface MJG2DPinchGestureRecognizer : UIGestureRecognizer @property (nonatomic, assign, readonly) CGFloat horizontalScale; @property (nonatomic, assign, readonly) CGFloat verticalScale; @property (nonatomic, assign, readonly) CGFloat scale; @end
{ "pile_set_name": "Github" }
using System.IO; using Ohana3DS_Rebirth.Ohana.Containers; namespace Ohana3DS_Rebirth.Ohana.Models.PocketMonsters { class GR { /// <summary> /// Loads a GR map model from Pokémon. /// </summary> /// <param name="data">The data</param> /// <returns>The Model group with the map meshes</returns> public static RenderBase.OModelGroup load(Stream data) { RenderBase.OModelGroup models; OContainer container = PkmnContainer.load(data); models = BCH.load(new MemoryStream(container.content[1].data)); return models; } } }
{ "pile_set_name": "Github" }
$mobileBreakpoint: 768px; $trackerFeedWidth: 530px; $trackerFeedPadding: 30px; $lineColor: rgb(151,216,255); $borderRadius: 5px; $name: 'module-city-feed'; ##{$name} { z-index: 3; pointer-events: none; @import "sass/_city-view.scss"; .ico { width: 25px; height: 25px; background-size: contain; background-repeat: no-repeat; background-position: 50% 50%; margin-right: 5px; } .ico-marker { background-image: url(../img/marker.svg); } .ico-arrow { background-image: url(../img/arrow.svg); } .ico-clock { background-image: url(../img/city-feed-timer.svg); width: 22px; height: 22px; } .ico-weatherchanel { background-image: url(../img/twc.svg); width: 22px; height: 22px; } .ico-arrow-yellow { background-image: url(../img/tracker-icons_next-stop.svg); height: 13px; width: 16px; display: inline-block; } .ico-location-yellow { background-image: url(../img/tracker-icons_location.svg); height: 12px; width: 9px; display: inline-block; } .ico-clock-yellow { background-image: url(../img/clock-yellow.svg); height: 12px; width: 12px; display: inline-block; } #items.iron-list > * { background: #00BE7B; } #feed-header { background: linear-gradient(to bottom, rgba(39,193,130,0.8) 40%, rgba(125,185,232,0) 100%); top: 0; width: $trackerFeedWidth; right: 0; height: 60px; z-index: 100; position: absolute; text-align: right; opacity: 0; pointer-events: all; transition: opacity 100ms ease; a { color: #fff; text-transform: uppercase; text-decoration: none; font-size: 13px; font-weight: 600; line-height: 60px; right: 24px; position: relative; display: block; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.33)); iron-icon { transform: rotate(90deg) scale(.8); } } } iron-list { width: $trackerFeedWidth + $trackerFeedPadding; box-sizing: border-box; padding-left: $trackerFeedPadding; height: 100%; pointer-events: all; right: 0; position: absolute; opacity: 1; transition: opacity 250ms ease; &::-webkit-scrollbar { width: 0 !important; } } &.fade-list { iron-list { opacity: 0; } } .card { width: 100%; background: #00cc81; margin-bottom: 14px; border-radius: 0; } .card.card-santa-info { padding-top: 10px; margin-bottom: 14px; height: 209px; .santa-info-row { display: flex; align-items: stretch; align-content: stretch; justify-content: space-between; border-top: 1px solid #2ab786; & > div { flex-grow: 1; padding: 17px 30px; position: relative; z-index: 2; box-sizing: border-box; width: calc(50% - 1px); } .divider { flex-grow: 0; width: 1px; z-index: 1; padding: 0; border-left: 1px solid #2ab786; } h2, h3, h4 { margin: 0; } h4 { text-transform: uppercase; color: white; font-size: 11px; margin-bottom: 17px; } h2, h3 { color: #FFFEAB; } h2.santa-distance { color: #fff; } .santa-user-location { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } h2 { font-size: 30px; } h3 { font-size: 16px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } .santa-info-distance { .fancy-bg { position: absolute; width: 304px; height: 139px; background: url(../img/santa-distance-bg.png) center no-repeat; background-size: contain; left: -8px; top: -10px; } .fancy-content { position: relative; width: 208px; // relative to .fancy-bg .ico { position: relative; top: 2px; margin-right: 0; } } } } } .card.card-city { width: 100%; $cardHeight: 325px; $cardContentHeight: $cardHeight - 14px; height: $cardHeight; $padding: 25px; $cardPurple: rgb(121,49,164); background: #00BE7B; box-sizing: border-box; margin: 0 auto; a { text-decoration: none; &:hover { .card-city-bg { iron-image { transform: scale(1.1) translateZ(0); } } .card-header { background-color: rgba(19, 142, 96, 0.55); box-shadow: 0 12px 33px -1px rgba(0,0,0,0.2); } } } & > div { position: relative; height: 100%; } h1, h2, h3, h4 { margin: 0; } h1 { color: #EFE8DB; font-size: 42px; line-height: 42px; font-weight: 600; margin-bottom: 18px; } h2 { color: white; font-size: 22px; font-weight: 300; } h4 { text-transform: uppercase; color: white; font-size: 11px; margin-bottom: 7px; } .card-city-bg { top: 0; height: $cardContentHeight; left: 0; right: 0; position: absolute; z-index: 1; overflow: hidden; iron-image { transform: scale(1) translateZ(0); transition: transform 500ms cubic-bezier(0,.36,.07,1); } } .card-header { background-color: rgba(19, 142, 96, 0.75); padding: $padding; position: relative; z-index: 2; height: $cardContentHeight; box-shadow: 0px 3px 7px -1px rgba(0,0,0,0.17); box-sizing: border-box; .card-city-attribution { background: rgba(0, 0, 0, .7); position: absolute; top: 0; right: 0; text-align: right; color: #fff; border-radius: 0 0 0 4px; line-height: 14px; font-size: 10px; padding: 2px 8px; a { text-decoration: none; color: #fff; } } } .stats { margin-bottom: 10px; h4 { color: #E5EBE4; } > div > div { margin-right: 20px; } } .card-icons { position: absolute; right: $padding; bottom: -31px; width: 270px; // FF text-align: right; // FF z-index: 2; // FF img { height: 50px; margin-left: 10px; transition: transform 200ms ease-in-out; cursor: pointer; &.iron-selected { transform: scale(0.75); } } } .card-fab { background: #E26254; position: absolute; left: -21px; bottom: 20px; &::after { width: 241px; height: 212px; background: url(../img/tracker-card-elf-point.svg); content: ''; position: absolute; bottom: -27px; left: 57px; } } .wikipedia { .gradientbar { height: 60px; width: 100%; position: absolute; bottom: 0; background-image: linear-gradient(transparent, $cardPurple 100%); pointer-events: none; border-radius: 0 0 $borderRadius $borderRadius; } .wikipedia__body { overflow: auto; height: $cardContentHeight - 25px; padding: 25px 25px 0 25px; display: block; color: #fff; font-weight: 300; font-size: 14px; line-height: 1.5; box-sizing: border-box; } .wikipedia__logo { position: absolute; bottom: 10px; right: 15px; width: 27px; height: 18px; background: url("../img/wikipedia_2x.png") no-repeat; background-size: contain; } } .corner-image { position: absolute; right: 0; top: 0; background-size: contain; height: 100px; width: 100px; background: url("img/cardavatars/Cards-avatars-04_general.svg") no-repeat; } .card-body { position: relative; background-color: $cardPurple; height: $cardContentHeight; box-sizing: border-box; overflow: hidden; .attribution { background: rgba(0,0,0,0.6); color: white; position: absolute; bottom: 0; border-radius: 0 $borderRadius 0 $borderRadius; padding: 1px 0; .attrib { border-right: 1px solid rgba(255,255,255,.4); padding: 4px 10px 4px 5px; display: inline-block; } .addview { padding: 4px 10px; display: inline-block; } a { color: #3d97ff; } } a { color: inherit; text-decoration: none; } } } .card { box-shadow: 0px 3px 7px -1px rgba(0,0,0,0.17); iron-image { height: 100%; width: 100%; } } @import "sass/_cards.scss"; @media (max-width: ($mobileBreakpoint - 1)) { transform: none; iron-list { box-shadow: 0 -2px 2px rgba(0, 0, 0, 0.25); position: absolute; bottom: 0; padding-left: 0; padding-top: 60vh; left: 0; right: 0; width: 100%; #feed { background: #00cd82; } } #feed-header { top: auto; bottom: 0; width: 100%; background: linear-gradient(to top, rgba(39,193,130,0.8) 40%, rgba(125,185,232,0) 100%); } .card.card-santa-info { height: auto; // mobile can work this out fine .santa-info-row { div.santa-info-distance { position: absolute; top: -80px; .fancy-bg { top: -30px; width: 280px; } .fancy-content { margin-top: -10px; } } h4 { margin-bottom: 4px; } } } .card.card-city { .card-fab { left: auto; right: 24px; &::after { display: none; } } } } }
{ "pile_set_name": "Github" }
GPU Management and Monitoring ============================= The ``nvidia-smi`` command provided by NVIDIA can be used to manage and monitor GPUs enabled Compute Nodes. In conjunction with the xCAT``xdsh`` command, you can easily manage and monitor the entire set of GPU enabled Compute Nodes remotely from the Management Node. Example: :: # xdsh <noderange> "nvidia-smi -i 0 --query-gpu=name,serial,uuid --format=csv,noheader" node01: Tesla K80, 0322415075970, GPU-b4f79b83-c282-4409-a0e8-0da3e06a13c3 ... .. warning:: The following commands are provided as convenience. Always consult the ``nvidia-smi`` manpage for the latest supported functions. Management ---------- Some useful ``nvidia-smi`` example commands for management. * Set persistence mode, When persistence mode is enabled the NVIDIA driver remains loaded even when no active clients, DISABLED by default:: nvidia-smi -i 0 -pm 1 * Disabled ECC support for GPU. Toggle ECC support, A flag that indicates whether ECC support is enabled, need to use --query-gpu=ecc.mode.pending to check [Reboot required]:: nvidia-smi -i 0 -e 0 * Reset the ECC volatile/aggregate error counters for the target GPUs:: nvidia-smi -i 0 -p 0/1 * Set MODE for compute applications, query with --query-gpu=compute_mode:: nvidia-smi -i 0 -c 0/1/2/3 * Trigger reset of the GPU :: nvidia-smi -i 0 -r * Enable or disable Accounting Mode, statistics can be calculated for each compute process running on the GPU, query with -query-gpu=accounting.mode:: nvidia-smi -i 0 -am 0/1 * Specifies maximum power management limit in watts, query with --query-gpu=power.limit :: nvidia-smi -i 0 -pl 200 Monitoring ---------- Some useful ``nvidia-smi`` example commands for monitoring. * The number of NVIDIA GPUs in the system :: nvidia-smi --query-gpu=count --format=csv,noheader * The version of the installed NVIDIA display driver :: nvidia-smi -i 0 --query-gpu=driver_version --format=csv,noheader * The BIOS of the GPU board :: nvidia-smi -i 0 --query-gpu=vbios_version --format=csv,noheader * Product name, serial number and UUID of the GPU:: nvidia-smi -i 0 --query-gpu=name,serial,uuid --format=csv,noheader * Fan speed:: nvidia-smi -i 0 --query-gpu=fan.speed --format=csv,noheader * The compute mode flag indicates whether individual or multiple compute applications may run on the GPU. (known as exclusivity modes) :: nvidia-smi -i 0 --query-gpu=compute_mode --format=csv,noheader * Percent of time over the past sample period during which one or more kernels was executing on the GPU:: nvidia-smi -i 0 --query-gpu=utilization.gpu --format=csv,noheader * Total errors detected across entire chip. Sum of device_memory, register_file, l1_cache, l2_cache and texture_memory :: nvidia-smi -i 0 --query-gpu=ecc.errors.corrected.aggregate.total --format=csv,noheader * Core GPU temperature, in degrees C:: nvidia-smi -i 0 --query-gpu=temperature.gpu --format=csv,noheader * The ECC mode that the GPU is currently operating under:: nvidia-smi -i 0 --query-gpu=ecc.mode.current --format=csv,noheader * The power management status:: nvidia-smi -i 0 --query-gpu=power.management --format=csv,noheader * The last measured power draw for the entire board, in watts:: nvidia-smi -i 0 --query-gpu=power.draw --format=csv,noheader * The minimum and maximum value in watts that power limit can be set to :: nvidia-smi -i 0 --query-gpu=power.min_limit,power.max_limit --format=csv
{ "pile_set_name": "Github" }
/* * drm_irq.c IRQ and vblank support * * \author Rickard E. (Rik) Faith <[email protected]> * \author Gareth Hughes <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include <drm/drm_vblank.h> #include <drm/drmP.h> #include <linux/export.h> #include "drm_trace.h" #include "drm_internal.h" /** * DOC: vblank handling * * Vertical blanking plays a major role in graphics rendering. To achieve * tear-free display, users must synchronize page flips and/or rendering to * vertical blanking. The DRM API offers ioctls to perform page flips * synchronized to vertical blanking and wait for vertical blanking. * * The DRM core handles most of the vertical blanking management logic, which * involves filtering out spurious interrupts, keeping race-free blanking * counters, coping with counter wrap-around and resets and keeping use counts. * It relies on the driver to generate vertical blanking interrupts and * optionally provide a hardware vertical blanking counter. * * Drivers must initialize the vertical blanking handling core with a call to * drm_vblank_init(). Minimally, a driver needs to implement * &drm_crtc_funcs.enable_vblank and &drm_crtc_funcs.disable_vblank plus call * drm_crtc_handle_vblank() in it's vblank interrupt handler for working vblank * support. * * Vertical blanking interrupts can be enabled by the DRM core or by drivers * themselves (for instance to handle page flipping operations). The DRM core * maintains a vertical blanking use count to ensure that the interrupts are not * disabled while a user still needs them. To increment the use count, drivers * call drm_crtc_vblank_get() and release the vblank reference again with * drm_crtc_vblank_put(). In between these two calls vblank interrupts are * guaranteed to be enabled. * * On many hardware disabling the vblank interrupt cannot be done in a race-free * manner, see &drm_driver.vblank_disable_immediate and * &drm_driver.max_vblank_count. In that case the vblank core only disables the * vblanks after a timer has expired, which can be configured through the * ``vblankoffdelay`` module parameter. */ /* Retry timestamp calculation up to 3 times to satisfy * drm_timestamp_precision before giving up. */ #define DRM_TIMESTAMP_MAXRETRIES 3 /* Threshold in nanoseconds for detection of redundant * vblank irq in drm_handle_vblank(). 1 msec should be ok. */ #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 static bool drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, ktime_t *tvblank, bool in_vblank_irq); static unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */ static int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */ module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600); module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600); MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs] (0: never disable, <0: disable immediately)"); MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); static void store_vblank(struct drm_device *dev, unsigned int pipe, u32 vblank_count_inc, ktime_t t_vblank, u32 last) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; assert_spin_locked(&dev->vblank_time_lock); vblank->last = last; write_seqlock(&vblank->seqlock); vblank->time = t_vblank; vblank->count += vblank_count_inc; write_sequnlock(&vblank->seqlock); } /* * "No hw counter" fallback implementation of .get_vblank_counter() hook, * if there is no useable hardware frame counter available. */ static u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe) { WARN_ON_ONCE(dev->max_vblank_count != 0); return 0; } static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) { if (drm_core_check_feature(dev, DRIVER_MODESET)) { struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); if (crtc->funcs->get_vblank_counter) return crtc->funcs->get_vblank_counter(crtc); } if (dev->driver->get_vblank_counter) return dev->driver->get_vblank_counter(dev, pipe); return drm_vblank_no_hw_counter(dev, pipe); } /* * Reset the stored timestamp for the current vblank count to correspond * to the last vblank occurred. * * Only to be called from drm_crtc_vblank_on(). * * Note: caller must hold &drm_device.vbl_lock since this reads & writes * device vblank fields. */ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe) { u32 cur_vblank; bool rc; ktime_t t_vblank; int count = DRM_TIMESTAMP_MAXRETRIES; spin_lock(&dev->vblank_time_lock); /* * sample the current counter to avoid random jumps * when drm_vblank_enable() applies the diff */ do { cur_vblank = __get_vblank_counter(dev, pipe); rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false); } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); /* * Only reinitialize corresponding vblank timestamp if high-precision query * available and didn't fail. Otherwise reinitialize delayed at next vblank * interrupt and assign 0 for now, to mark the vblanktimestamp as invalid. */ if (!rc) t_vblank = 0; /* * +1 to make sure user will never see the same * vblank counter value before and after a modeset */ store_vblank(dev, pipe, 1, t_vblank, cur_vblank); spin_unlock(&dev->vblank_time_lock); } /* * Call back into the driver to update the appropriate vblank counter * (specified by @pipe). Deal with wraparound, if it occurred, and * update the last read value so we can deal with wraparound on the next * call if necessary. * * Only necessary when going from off->on, to account for frames we * didn't get an interrupt for. * * Note: caller must hold &drm_device.vbl_lock since this reads & writes * device vblank fields. */ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, bool in_vblank_irq) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; u32 cur_vblank, diff; bool rc; ktime_t t_vblank; int count = DRM_TIMESTAMP_MAXRETRIES; int framedur_ns = vblank->framedur_ns; /* * Interrupts were disabled prior to this call, so deal with counter * wrap if needed. * NOTE! It's possible we lost a full dev->max_vblank_count + 1 events * here if the register is small or we had vblank interrupts off for * a long time. * * We repeat the hardware vblank counter & timestamp query until * we get consistent results. This to prevent races between gpu * updating its hardware counter while we are retrieving the * corresponding vblank timestamp. */ do { cur_vblank = __get_vblank_counter(dev, pipe); rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, in_vblank_irq); } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); if (dev->max_vblank_count != 0) { /* trust the hw counter when it's around */ diff = (cur_vblank - vblank->last) & dev->max_vblank_count; } else if (rc && framedur_ns) { u64 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); /* * Figure out how many vblanks we've missed based * on the difference in the timestamps and the * frame/field duration. */ diff = DIV_ROUND_CLOSEST_ULL(diff_ns, framedur_ns); if (diff == 0 && in_vblank_irq) DRM_DEBUG_VBL("crtc %u: Redundant vblirq ignored." " diff_ns = %lld, framedur_ns = %d)\n", pipe, (long long) diff_ns, framedur_ns); } else { /* some kind of default for drivers w/o accurate vbl timestamping */ diff = in_vblank_irq ? 1 : 0; } /* * Within a drm_vblank_pre_modeset - drm_vblank_post_modeset * interval? If so then vblank irqs keep running and it will likely * happen that the hardware vblank counter is not trustworthy as it * might reset at some point in that interval and vblank timestamps * are not trustworthy either in that interval. Iow. this can result * in a bogus diff >> 1 which must be avoided as it would cause * random large forward jumps of the software vblank counter. */ if (diff > 1 && (vblank->inmodeset & 0x2)) { DRM_DEBUG_VBL("clamping vblank bump to 1 on crtc %u: diffr=%u" " due to pre-modeset.\n", pipe, diff); diff = 1; } DRM_DEBUG_VBL("updating vblank count on crtc %u:" " current=%llu, diff=%u, hw=%u hw_last=%u\n", pipe, vblank->count, diff, cur_vblank, vblank->last); if (diff == 0) { WARN_ON_ONCE(cur_vblank != vblank->last); return; } /* * Only reinitialize corresponding vblank timestamp if high-precision query * available and didn't fail, or we were called from the vblank interrupt. * Otherwise reinitialize delayed at next vblank interrupt and assign 0 * for now, to mark the vblanktimestamp as invalid. */ if (!rc && !in_vblank_irq) t_vblank = 0; store_vblank(dev, pipe, diff, t_vblank, cur_vblank); } static u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; if (WARN_ON(pipe >= dev->num_crtcs)) return 0; return vblank->count; } /** * drm_crtc_accurate_vblank_count - retrieve the master vblank counter * @crtc: which counter to retrieve * * This function is similar to drm_crtc_vblank_count() but this function * interpolates to handle a race with vblank interrupts using the high precision * timestamping support. * * This is mostly useful for hardware that can obtain the scanout position, but * doesn't have a hardware frame counter. */ u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; unsigned int pipe = drm_crtc_index(crtc); u32 vblank; unsigned long flags; WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp, "This function requires support for accurate vblank timestamps."); spin_lock_irqsave(&dev->vblank_time_lock, flags); drm_update_vblank_count(dev, pipe, false); vblank = drm_vblank_count(dev, pipe); spin_unlock_irqrestore(&dev->vblank_time_lock, flags); return vblank; } EXPORT_SYMBOL(drm_crtc_accurate_vblank_count); static void __disable_vblank(struct drm_device *dev, unsigned int pipe) { if (drm_core_check_feature(dev, DRIVER_MODESET)) { struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); if (crtc->funcs->disable_vblank) { crtc->funcs->disable_vblank(crtc); return; } } dev->driver->disable_vblank(dev, pipe); } /* * Disable vblank irq's on crtc, make sure that last vblank count * of hardware and corresponding consistent software vblank counter * are preserved, even if there are any spurious vblank irq's after * disable. */ void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; unsigned long irqflags; assert_spin_locked(&dev->vbl_lock); /* Prevent vblank irq processing while disabling vblank irqs, * so no updates of timestamps or count can happen after we've * disabled. Needed to prevent races in case of delayed irq's. */ spin_lock_irqsave(&dev->vblank_time_lock, irqflags); /* * Only disable vblank interrupts if they're enabled. This avoids * calling the ->disable_vblank() operation in atomic context with the * hardware potentially runtime suspended. */ if (vblank->enabled) { __disable_vblank(dev, pipe); vblank->enabled = false; } /* * Always update the count and timestamp to maintain the * appearance that the counter has been ticking all along until * this time. This makes the count account for the entire time * between drm_crtc_vblank_on() and drm_crtc_vblank_off(). */ drm_update_vblank_count(dev, pipe, false); spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); } static void vblank_disable_fn(struct timer_list *t) { struct drm_vblank_crtc *vblank = from_timer(vblank, t, disable_timer); struct drm_device *dev = vblank->dev; unsigned int pipe = vblank->pipe; unsigned long irqflags; spin_lock_irqsave(&dev->vbl_lock, irqflags); if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) { DRM_DEBUG("disabling vblank on crtc %u\n", pipe); drm_vblank_disable_and_save(dev, pipe); } spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } void drm_vblank_cleanup(struct drm_device *dev) { unsigned int pipe; /* Bail if the driver didn't call drm_vblank_init() */ if (dev->num_crtcs == 0) return; for (pipe = 0; pipe < dev->num_crtcs; pipe++) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; WARN_ON(READ_ONCE(vblank->enabled) && drm_core_check_feature(dev, DRIVER_MODESET)); del_timer_sync(&vblank->disable_timer); } kfree(dev->vblank); dev->num_crtcs = 0; } /** * drm_vblank_init - initialize vblank support * @dev: DRM device * @num_crtcs: number of CRTCs supported by @dev * * This function initializes vblank support for @num_crtcs display pipelines. * Cleanup is handled by the DRM core, or through calling drm_dev_fini() for * drivers with a &drm_driver.release callback. * * Returns: * Zero on success or a negative error code on failure. */ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs) { int ret = -ENOMEM; unsigned int i; spin_lock_init(&dev->vbl_lock); spin_lock_init(&dev->vblank_time_lock); dev->num_crtcs = num_crtcs; dev->vblank = kcalloc(num_crtcs, sizeof(*dev->vblank), GFP_KERNEL); if (!dev->vblank) goto err; for (i = 0; i < num_crtcs; i++) { struct drm_vblank_crtc *vblank = &dev->vblank[i]; vblank->dev = dev; vblank->pipe = i; init_waitqueue_head(&vblank->queue); timer_setup(&vblank->disable_timer, vblank_disable_fn, 0); seqlock_init(&vblank->seqlock); } DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n"); /* Driver specific high-precision vblank timestamping supported? */ if (dev->driver->get_vblank_timestamp) DRM_INFO("Driver supports precise vblank timestamp query.\n"); else DRM_INFO("No driver support for vblank timestamp query.\n"); /* Must have precise timestamping for reliable vblank instant disable */ if (dev->vblank_disable_immediate && !dev->driver->get_vblank_timestamp) { dev->vblank_disable_immediate = false; DRM_INFO("Setting vblank_disable_immediate to false because " "get_vblank_timestamp == NULL\n"); } return 0; err: dev->num_crtcs = 0; return ret; } EXPORT_SYMBOL(drm_vblank_init); /** * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC * @crtc: which CRTC's vblank waitqueue to retrieve * * This function returns a pointer to the vblank waitqueue for the CRTC. * Drivers can use this to implement vblank waits using wait_event() and related * functions. */ wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc) { return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; } EXPORT_SYMBOL(drm_crtc_vblank_waitqueue); /** * drm_calc_timestamping_constants - calculate vblank timestamp constants * @crtc: drm_crtc whose timestamp constants should be updated. * @mode: display mode containing the scanout timings * * Calculate and store various constants which are later needed by vblank and * swap-completion timestamping, e.g, by * drm_calc_vbltimestamp_from_scanoutpos(). They are derived from CRTC's true * scanout timing, so they take things like panel scaling or other adjustments * into account. */ void drm_calc_timestamping_constants(struct drm_crtc *crtc, const struct drm_display_mode *mode) { struct drm_device *dev = crtc->dev; unsigned int pipe = drm_crtc_index(crtc); struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; int linedur_ns = 0, framedur_ns = 0; int dotclock = mode->crtc_clock; if (!dev->num_crtcs) return; if (WARN_ON(pipe >= dev->num_crtcs)) return; /* Valid dotclock? */ if (dotclock > 0) { int frame_size = mode->crtc_htotal * mode->crtc_vtotal; /* * Convert scanline length in pixels and video * dot clock to line duration and frame duration * in nanoseconds: */ linedur_ns = div_u64((u64) mode->crtc_htotal * 1000000, dotclock); framedur_ns = div_u64((u64) frame_size * 1000000, dotclock); /* * Fields of interlaced scanout modes are only half a frame duration. */ if (mode->flags & DRM_MODE_FLAG_INTERLACE) framedur_ns /= 2; } else DRM_ERROR("crtc %u: Can't calculate constants, dotclock = 0!\n", crtc->base.id); vblank->linedur_ns = linedur_ns; vblank->framedur_ns = framedur_ns; vblank->hwmode = *mode; DRM_DEBUG("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n", crtc->base.id, mode->crtc_htotal, mode->crtc_vtotal, mode->crtc_vdisplay); DRM_DEBUG("crtc %u: clock %d kHz framedur %d linedur %d\n", crtc->base.id, dotclock, framedur_ns, linedur_ns); } EXPORT_SYMBOL(drm_calc_timestamping_constants); /** * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper * @dev: DRM device * @pipe: index of CRTC whose vblank timestamp to retrieve * @max_error: Desired maximum allowable error in timestamps (nanosecs) * On return contains true maximum error of timestamp * @vblank_time: Pointer to time which should receive the timestamp * @in_vblank_irq: * True when called from drm_crtc_handle_vblank(). Some drivers * need to apply some workarounds for gpu-specific vblank irq quirks * if flag is set. * * Implements calculation of exact vblank timestamps from given drm_display_mode * timings and current video scanout position of a CRTC. This can be directly * used as the &drm_driver.get_vblank_timestamp implementation of a kms driver * if &drm_driver.get_scanout_position is implemented. * * The current implementation only handles standard video modes. For double scan * and interlaced modes the driver is supposed to adjust the hardware mode * (taken from &drm_crtc_state.adjusted mode for atomic modeset drivers) to * match the scanout position reported. * * Note that atomic drivers must call drm_calc_timestamping_constants() before * enabling a CRTC. The atomic helpers already take care of that in * drm_atomic_helper_update_legacy_modeset_state(). * * Returns: * * Returns true on success, and false on failure, i.e. when no accurate * timestamp could be acquired. */ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, unsigned int pipe, int *max_error, ktime_t *vblank_time, bool in_vblank_irq) { struct timespec64 ts_etime, ts_vblank_time; ktime_t stime, etime; bool vbl_status; struct drm_crtc *crtc; const struct drm_display_mode *mode; struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; int vpos, hpos, i; int delta_ns, duration_ns; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return false; crtc = drm_crtc_from_index(dev, pipe); if (pipe >= dev->num_crtcs || !crtc) { DRM_ERROR("Invalid crtc %u\n", pipe); return false; } /* Scanout position query not supported? Should not happen. */ if (!dev->driver->get_scanout_position) { DRM_ERROR("Called from driver w/o get_scanout_position()!?\n"); return false; } if (drm_drv_uses_atomic_modeset(dev)) mode = &vblank->hwmode; else mode = &crtc->hwmode; /* If mode timing undefined, just return as no-op: * Happens during initial modesetting of a crtc. */ if (mode->crtc_clock == 0) { DRM_DEBUG("crtc %u: Noop due to uninitialized mode.\n", pipe); WARN_ON_ONCE(drm_drv_uses_atomic_modeset(dev)); return false; } /* Get current scanout position with system timestamp. * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times * if single query takes longer than max_error nanoseconds. * * This guarantees a tight bound on maximum error if * code gets preempted or delayed for some reason. */ for (i = 0; i < DRM_TIMESTAMP_MAXRETRIES; i++) { /* * Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ vbl_status = dev->driver->get_scanout_position(dev, pipe, in_vblank_irq, &vpos, &hpos, &stime, &etime, mode); /* Return as no-op if scanout query unsupported or failed. */ if (!vbl_status) { DRM_DEBUG("crtc %u : scanoutpos query failed.\n", pipe); return false; } /* Compute uncertainty in timestamp of scanout position query. */ duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime); /* Accept result with < max_error nsecs timing uncertainty. */ if (duration_ns <= *max_error) break; } /* Noisy system timing? */ if (i == DRM_TIMESTAMP_MAXRETRIES) { DRM_DEBUG("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n", pipe, duration_ns/1000, *max_error/1000, i); } /* Return upper bound of timestamp precision error. */ *max_error = duration_ns; /* Convert scanout position into elapsed time at raw_time query * since start of scanout at first display scanline. delta_ns * can be negative if start of scanout hasn't happened yet. */ delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos), mode->crtc_clock); /* Subtract time delta from raw timestamp to get final * vblank_time timestamp for end of vblank. */ *vblank_time = ktime_sub_ns(etime, delta_ns); if ((drm_debug & DRM_UT_VBL) == 0) return true; ts_etime = ktime_to_timespec64(etime); ts_vblank_time = ktime_to_timespec64(*vblank_time); DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n", pipe, hpos, vpos, (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000, (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000, duration_ns / 1000, i); return true; } EXPORT_SYMBOL(drm_calc_vbltimestamp_from_scanoutpos); /** * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * vblank interval * @dev: DRM device * @pipe: index of CRTC whose vblank timestamp to retrieve * @tvblank: Pointer to target time which should receive the timestamp * @in_vblank_irq: * True when called from drm_crtc_handle_vblank(). Some drivers * need to apply some workarounds for gpu-specific vblank irq quirks * if flag is set. * * Fetches the system timestamp corresponding to the time of the most recent * vblank interval on specified CRTC. May call into kms-driver to * compute the timestamp with a high-precision GPU specific method. * * Returns zero if timestamp originates from uncorrected do_gettimeofday() * call, i.e., it isn't very precisely locked to the true vblank. * * Returns: * True if timestamp is considered to be very precise, false otherwise. */ static bool drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, ktime_t *tvblank, bool in_vblank_irq) { bool ret = false; /* Define requested maximum error on timestamps (nanoseconds). */ int max_error = (int) drm_timestamp_precision * 1000; /* Query driver if possible and precision timestamping enabled. */ if (dev->driver->get_vblank_timestamp && (max_error > 0)) ret = dev->driver->get_vblank_timestamp(dev, pipe, &max_error, tvblank, in_vblank_irq); /* GPU high precision timestamp query unsupported or failed. * Return current monotonic/gettimeofday timestamp as best estimate. */ if (!ret) *tvblank = ktime_get(); return ret; } /** * drm_crtc_vblank_count - retrieve "cooked" vblank counter value * @crtc: which counter to retrieve * * Fetches the "cooked" vblank count value that represents the number of * vblank events since the system was booted, including lost events due to * modesetting activity. Note that this timer isn't correct against a racing * vblank interrupt (since it only reports the software vblank counter), see * drm_crtc_accurate_vblank_count() for such use-cases. * * Returns: * The software vblank counter. */ u64 drm_crtc_vblank_count(struct drm_crtc *crtc) { return drm_vblank_count(crtc->dev, drm_crtc_index(crtc)); } EXPORT_SYMBOL(drm_crtc_vblank_count); /** * drm_vblank_count_and_time - retrieve "cooked" vblank counter value and the * system timestamp corresponding to that vblank counter value. * @dev: DRM device * @pipe: index of CRTC whose counter to retrieve * @vblanktime: Pointer to ktime_t to receive the vblank timestamp. * * Fetches the "cooked" vblank count value that represents the number of * vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. * * This is the legacy version of drm_crtc_vblank_count_and_time(). */ static u64 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, ktime_t *vblanktime) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; u64 vblank_count; unsigned int seq; if (WARN_ON(pipe >= dev->num_crtcs)) { *vblanktime = 0; return 0; } do { seq = read_seqbegin(&vblank->seqlock); vblank_count = vblank->count; *vblanktime = vblank->time; } while (read_seqretry(&vblank->seqlock, seq)); return vblank_count; } /** * drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value * and the system timestamp corresponding to that vblank counter value * @crtc: which counter to retrieve * @vblanktime: Pointer to time to receive the vblank timestamp. * * Fetches the "cooked" vblank count value that represents the number of * vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. */ u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, ktime_t *vblanktime) { return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc), vblanktime); } EXPORT_SYMBOL(drm_crtc_vblank_count_and_time); static void send_vblank_event(struct drm_device *dev, struct drm_pending_vblank_event *e, u64 seq, ktime_t now) { struct timespec64 tv; switch (e->event.base.type) { case DRM_EVENT_VBLANK: case DRM_EVENT_FLIP_COMPLETE: tv = ktime_to_timespec64(now); e->event.vbl.sequence = seq; /* * e->event is a user space structure, with hardcoded unsigned * 32-bit seconds/microseconds. This is safe as we always use * monotonic timestamps since linux-4.15 */ e->event.vbl.tv_sec = tv.tv_sec; e->event.vbl.tv_usec = tv.tv_nsec / 1000; break; case DRM_EVENT_CRTC_SEQUENCE: if (seq) e->event.seq.sequence = seq; e->event.seq.time_ns = ktime_to_ns(now); break; } trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq); drm_send_event_locked(dev, &e->base); } /** * drm_crtc_arm_vblank_event - arm vblank event after pageflip * @crtc: the source CRTC of the vblank event * @e: the event to send * * A lot of drivers need to generate vblank events for the very next vblank * interrupt. For example when the page flip interrupt happens when the page * flip gets armed, but not when it actually executes within the next vblank * period. This helper function implements exactly the required vblank arming * behaviour. * * NOTE: Drivers using this to send out the &drm_crtc_state.event as part of an * atomic commit must ensure that the next vblank happens at exactly the same * time as the atomic commit is committed to the hardware. This function itself * does **not** protect against the next vblank interrupt racing with either this * function call or the atomic commit operation. A possible sequence could be: * * 1. Driver commits new hardware state into vblank-synchronized registers. * 2. A vblank happens, committing the hardware state. Also the corresponding * vblank interrupt is fired off and fully processed by the interrupt * handler. * 3. The atomic commit operation proceeds to call drm_crtc_arm_vblank_event(). * 4. The event is only send out for the next vblank, which is wrong. * * An equivalent race can happen when the driver calls * drm_crtc_arm_vblank_event() before writing out the new hardware state. * * The only way to make this work safely is to prevent the vblank from firing * (and the hardware from committing anything else) until the entire atomic * commit sequence has run to completion. If the hardware does not have such a * feature (e.g. using a "go" bit), then it is unsafe to use this functions. * Instead drivers need to manually send out the event from their interrupt * handler by calling drm_crtc_send_vblank_event() and make sure that there's no * possible race with the hardware committing the atomic update. * * Caller must hold a vblank reference for the event @e, which will be dropped * when the next vblank arrives. */ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc, struct drm_pending_vblank_event *e) { struct drm_device *dev = crtc->dev; unsigned int pipe = drm_crtc_index(crtc); assert_spin_locked(&dev->event_lock); e->pipe = pipe; e->sequence = drm_crtc_accurate_vblank_count(crtc) + 1; list_add_tail(&e->base.link, &dev->vblank_event_list); } EXPORT_SYMBOL(drm_crtc_arm_vblank_event); /** * drm_crtc_send_vblank_event - helper to send vblank event after pageflip * @crtc: the source CRTC of the vblank event * @e: the event to send * * Updates sequence # and timestamp on event for the most recently processed * vblank, and sends it to userspace. Caller must hold event lock. * * See drm_crtc_arm_vblank_event() for a helper which can be used in certain * situation, especially to send out events for atomic commit operations. */ void drm_crtc_send_vblank_event(struct drm_crtc *crtc, struct drm_pending_vblank_event *e) { struct drm_device *dev = crtc->dev; u64 seq; unsigned int pipe = drm_crtc_index(crtc); ktime_t now; if (dev->num_crtcs > 0) { seq = drm_vblank_count_and_time(dev, pipe, &now); } else { seq = 0; now = ktime_get(); } e->pipe = pipe; send_vblank_event(dev, e, seq, now); } EXPORT_SYMBOL(drm_crtc_send_vblank_event); static int __enable_vblank(struct drm_device *dev, unsigned int pipe) { if (drm_core_check_feature(dev, DRIVER_MODESET)) { struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); if (crtc->funcs->enable_vblank) return crtc->funcs->enable_vblank(crtc); } return dev->driver->enable_vblank(dev, pipe); } static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; int ret = 0; assert_spin_locked(&dev->vbl_lock); spin_lock(&dev->vblank_time_lock); if (!vblank->enabled) { /* * Enable vblank irqs under vblank_time_lock protection. * All vblank count & timestamp updates are held off * until we are done reinitializing master counter and * timestamps. Filtercode in drm_handle_vblank() will * prevent double-accounting of same vblank interval. */ ret = __enable_vblank(dev, pipe); DRM_DEBUG("enabling vblank on crtc %u, ret: %d\n", pipe, ret); if (ret) { atomic_dec(&vblank->refcount); } else { drm_update_vblank_count(dev, pipe, 0); /* drm_update_vblank_count() includes a wmb so we just * need to ensure that the compiler emits the write * to mark the vblank as enabled after the call * to drm_update_vblank_count(). */ WRITE_ONCE(vblank->enabled, true); } } spin_unlock(&dev->vblank_time_lock); return ret; } static int drm_vblank_get(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; unsigned long irqflags; int ret = 0; if (!dev->num_crtcs) return -EINVAL; if (WARN_ON(pipe >= dev->num_crtcs)) return -EINVAL; spin_lock_irqsave(&dev->vbl_lock, irqflags); /* Going from 0->1 means we have to enable interrupts again */ if (atomic_add_return(1, &vblank->refcount) == 1) { ret = drm_vblank_enable(dev, pipe); } else { if (!vblank->enabled) { atomic_dec(&vblank->refcount); ret = -EINVAL; } } spin_unlock_irqrestore(&dev->vbl_lock, irqflags); return ret; } /** * drm_crtc_vblank_get - get a reference count on vblank events * @crtc: which CRTC to own * * Acquire a reference count on vblank events to avoid having them disabled * while in use. * * Returns: * Zero on success or a negative error code on failure. */ int drm_crtc_vblank_get(struct drm_crtc *crtc) { return drm_vblank_get(crtc->dev, drm_crtc_index(crtc)); } EXPORT_SYMBOL(drm_crtc_vblank_get); static void drm_vblank_put(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; if (WARN_ON(pipe >= dev->num_crtcs)) return; if (WARN_ON(atomic_read(&vblank->refcount) == 0)) return; /* Last user schedules interrupt disable */ if (atomic_dec_and_test(&vblank->refcount)) { if (drm_vblank_offdelay == 0) return; else if (drm_vblank_offdelay < 0) vblank_disable_fn(&vblank->disable_timer); else if (!dev->vblank_disable_immediate) mod_timer(&vblank->disable_timer, jiffies + ((drm_vblank_offdelay * HZ)/1000)); } } /** * drm_crtc_vblank_put - give up ownership of vblank events * @crtc: which counter to give up * * Release ownership of a given vblank counter, turning off interrupts * if possible. Disable interrupts after drm_vblank_offdelay milliseconds. */ void drm_crtc_vblank_put(struct drm_crtc *crtc) { drm_vblank_put(crtc->dev, drm_crtc_index(crtc)); } EXPORT_SYMBOL(drm_crtc_vblank_put); /** * drm_wait_one_vblank - wait for one vblank * @dev: DRM device * @pipe: CRTC index * * This waits for one vblank to pass on @pipe, using the irq driver interfaces. * It is a failure to call this when the vblank irq for @pipe is disabled, e.g. * due to lack of driver support or because the crtc is off. * * This is the legacy version of drm_crtc_wait_one_vblank(). */ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; int ret; u32 last; if (WARN_ON(pipe >= dev->num_crtcs)) return; ret = drm_vblank_get(dev, pipe); if (WARN(ret, "vblank not available on crtc %i, ret=%i\n", pipe, ret)) return; last = drm_vblank_count(dev, pipe); ret = wait_event_timeout(vblank->queue, last != drm_vblank_count(dev, pipe), msecs_to_jiffies(100)); WARN(ret == 0, "vblank wait timed out on crtc %i\n", pipe); drm_vblank_put(dev, pipe); } EXPORT_SYMBOL(drm_wait_one_vblank); /** * drm_crtc_wait_one_vblank - wait for one vblank * @crtc: DRM crtc * * This waits for one vblank to pass on @crtc, using the irq driver interfaces. * It is a failure to call this when the vblank irq for @crtc is disabled, e.g. * due to lack of driver support or because the crtc is off. */ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc) { drm_wait_one_vblank(crtc->dev, drm_crtc_index(crtc)); } EXPORT_SYMBOL(drm_crtc_wait_one_vblank); /** * drm_crtc_vblank_off - disable vblank events on a CRTC * @crtc: CRTC in question * * Drivers can use this function to shut down the vblank interrupt handling when * disabling a crtc. This function ensures that the latest vblank frame count is * stored so that drm_vblank_on can restore it again. * * Drivers must use this function when the hardware vblank counter can get * reset, e.g. when suspending or disabling the @crtc in general. */ void drm_crtc_vblank_off(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; unsigned int pipe = drm_crtc_index(crtc); struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; struct drm_pending_vblank_event *e, *t; ktime_t now; unsigned long irqflags; u64 seq; if (WARN_ON(pipe >= dev->num_crtcs)) return; spin_lock_irqsave(&dev->event_lock, irqflags); spin_lock(&dev->vbl_lock); DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n", pipe, vblank->enabled, vblank->inmodeset); /* Avoid redundant vblank disables without previous * drm_crtc_vblank_on(). */ if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) drm_vblank_disable_and_save(dev, pipe); wake_up(&vblank->queue); /* * Prevent subsequent drm_vblank_get() from re-enabling * the vblank interrupt by bumping the refcount. */ if (!vblank->inmodeset) { atomic_inc(&vblank->refcount); vblank->inmodeset = 1; } spin_unlock(&dev->vbl_lock); /* Send any queued vblank events, lest the natives grow disquiet */ seq = drm_vblank_count_and_time(dev, pipe, &now); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { if (e->pipe != pipe) continue; DRM_DEBUG("Sending premature vblank event on disable: " "wanted %llu, current %llu\n", e->sequence, seq); list_del(&e->base.link); drm_vblank_put(dev, pipe); send_vblank_event(dev, e, seq, now); } spin_unlock_irqrestore(&dev->event_lock, irqflags); /* Will be reset by the modeset helpers when re-enabling the crtc by * calling drm_calc_timestamping_constants(). */ vblank->hwmode.crtc_clock = 0; } EXPORT_SYMBOL(drm_crtc_vblank_off); /** * drm_crtc_vblank_reset - reset vblank state to off on a CRTC * @crtc: CRTC in question * * Drivers can use this function to reset the vblank state to off at load time. * Drivers should use this together with the drm_crtc_vblank_off() and * drm_crtc_vblank_on() functions. The difference compared to * drm_crtc_vblank_off() is that this function doesn't save the vblank counter * and hence doesn't need to call any driver hooks. * * This is useful for recovering driver state e.g. on driver load, or on resume. */ void drm_crtc_vblank_reset(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; unsigned long irqflags; unsigned int pipe = drm_crtc_index(crtc); struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; spin_lock_irqsave(&dev->vbl_lock, irqflags); /* * Prevent subsequent drm_vblank_get() from enabling the vblank * interrupt by bumping the refcount. */ if (!vblank->inmodeset) { atomic_inc(&vblank->refcount); vblank->inmodeset = 1; } spin_unlock_irqrestore(&dev->vbl_lock, irqflags); WARN_ON(!list_empty(&dev->vblank_event_list)); } EXPORT_SYMBOL(drm_crtc_vblank_reset); /** * drm_crtc_vblank_on - enable vblank events on a CRTC * @crtc: CRTC in question * * This functions restores the vblank interrupt state captured with * drm_crtc_vblank_off() again and is generally called when enabling @crtc. Note * that calls to drm_crtc_vblank_on() and drm_crtc_vblank_off() can be * unbalanced and so can also be unconditionally called in driver load code to * reflect the current hardware state of the crtc. */ void drm_crtc_vblank_on(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; unsigned int pipe = drm_crtc_index(crtc); struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; unsigned long irqflags; if (WARN_ON(pipe >= dev->num_crtcs)) return; spin_lock_irqsave(&dev->vbl_lock, irqflags); DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n", pipe, vblank->enabled, vblank->inmodeset); /* Drop our private "prevent drm_vblank_get" refcount */ if (vblank->inmodeset) { atomic_dec(&vblank->refcount); vblank->inmodeset = 0; } drm_reset_vblank_timestamp(dev, pipe); /* * re-enable interrupts if there are users left, or the * user wishes vblank interrupts to be enabled all the time. */ if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) WARN_ON(drm_vblank_enable(dev, pipe)); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } EXPORT_SYMBOL(drm_crtc_vblank_on); static void drm_legacy_vblank_pre_modeset(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; /* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs) return; if (WARN_ON(pipe >= dev->num_crtcs)) return; /* * To avoid all the problems that might happen if interrupts * were enabled/disabled around or between these calls, we just * have the kernel take a reference on the CRTC (just once though * to avoid corrupting the count if multiple, mismatch calls occur), * so that interrupts remain enabled in the interim. */ if (!vblank->inmodeset) { vblank->inmodeset = 0x1; if (drm_vblank_get(dev, pipe) == 0) vblank->inmodeset |= 0x2; } } static void drm_legacy_vblank_post_modeset(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; unsigned long irqflags; /* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs) return; if (WARN_ON(pipe >= dev->num_crtcs)) return; if (vblank->inmodeset) { spin_lock_irqsave(&dev->vbl_lock, irqflags); drm_reset_vblank_timestamp(dev, pipe); spin_unlock_irqrestore(&dev->vbl_lock, irqflags); if (vblank->inmodeset & 0x2) drm_vblank_put(dev, pipe); vblank->inmodeset = 0; } } int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_modeset_ctl *modeset = data; unsigned int pipe; /* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs) return 0; /* KMS drivers handle this internally */ if (!drm_core_check_feature(dev, DRIVER_LEGACY)) return 0; pipe = modeset->crtc; if (pipe >= dev->num_crtcs) return -EINVAL; switch (modeset->cmd) { case _DRM_PRE_MODESET: drm_legacy_vblank_pre_modeset(dev, pipe); break; case _DRM_POST_MODESET: drm_legacy_vblank_post_modeset(dev, pipe); break; default: return -EINVAL; } return 0; } static inline bool vblank_passed(u64 seq, u64 ref) { return (seq - ref) <= (1 << 23); } static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe, u64 req_seq, union drm_wait_vblank *vblwait, struct drm_file *file_priv) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; struct drm_pending_vblank_event *e; ktime_t now; unsigned long flags; u64 seq; int ret; e = kzalloc(sizeof(*e), GFP_KERNEL); if (e == NULL) { ret = -ENOMEM; goto err_put; } e->pipe = pipe; e->event.base.type = DRM_EVENT_VBLANK; e->event.base.length = sizeof(e->event.vbl); e->event.vbl.user_data = vblwait->request.signal; e->event.vbl.crtc_id = 0; if (drm_core_check_feature(dev, DRIVER_MODESET)) { struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); if (crtc) e->event.vbl.crtc_id = crtc->base.id; } spin_lock_irqsave(&dev->event_lock, flags); /* * drm_crtc_vblank_off() might have been called after we called * drm_vblank_get(). drm_crtc_vblank_off() holds event_lock around the * vblank disable, so no need for further locking. The reference from * drm_vblank_get() protects against vblank disable from another source. */ if (!READ_ONCE(vblank->enabled)) { ret = -EINVAL; goto err_unlock; } ret = drm_event_reserve_init_locked(dev, file_priv, &e->base, &e->event.base); if (ret) goto err_unlock; seq = drm_vblank_count_and_time(dev, pipe, &now); DRM_DEBUG("event on vblank count %llu, current %llu, crtc %u\n", req_seq, seq, pipe); trace_drm_vblank_event_queued(file_priv, pipe, req_seq); e->sequence = req_seq; if (vblank_passed(seq, req_seq)) { drm_vblank_put(dev, pipe); send_vblank_event(dev, e, seq, now); vblwait->reply.sequence = seq; } else { /* drm_handle_vblank_events will call drm_vblank_put */ list_add_tail(&e->base.link, &dev->vblank_event_list); vblwait->reply.sequence = req_seq; } spin_unlock_irqrestore(&dev->event_lock, flags); return 0; err_unlock: spin_unlock_irqrestore(&dev->event_lock, flags); kfree(e); err_put: drm_vblank_put(dev, pipe); return ret; } static bool drm_wait_vblank_is_query(union drm_wait_vblank *vblwait) { if (vblwait->request.sequence) return false; return _DRM_VBLANK_RELATIVE == (vblwait->request.type & (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_EVENT | _DRM_VBLANK_NEXTONMISS)); } /* * Widen a 32-bit param to 64-bits. * * \param narrow 32-bit value (missing upper 32 bits) * \param near 64-bit value that should be 'close' to near * * This function returns a 64-bit value using the lower 32-bits from * 'narrow' and constructing the upper 32-bits so that the result is * as close as possible to 'near'. */ static u64 widen_32_to_64(u32 narrow, u64 near) { return near + (s32) (narrow - near); } static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe, struct drm_wait_vblank_reply *reply) { ktime_t now; struct timespec64 ts; /* * drm_wait_vblank_reply is a UAPI structure that uses 'long' * to store the seconds. This is safe as we always use monotonic * timestamps since linux-4.15. */ reply->sequence = drm_vblank_count_and_time(dev, pipe, &now); ts = ktime_to_timespec64(now); reply->tval_sec = (u32)ts.tv_sec; reply->tval_usec = ts.tv_nsec / 1000; } int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_crtc *crtc; struct drm_vblank_crtc *vblank; union drm_wait_vblank *vblwait = data; int ret; u64 req_seq, seq; unsigned int pipe_index; unsigned int flags, pipe, high_pipe; if (!dev->irq_enabled) return -EINVAL; if (vblwait->request.type & _DRM_VBLANK_SIGNAL) return -EINVAL; if (vblwait->request.type & ~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK | _DRM_VBLANK_HIGH_CRTC_MASK)) { DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n", vblwait->request.type, (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK | _DRM_VBLANK_HIGH_CRTC_MASK)); return -EINVAL; } flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; high_pipe = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); if (high_pipe) pipe_index = high_pipe >> _DRM_VBLANK_HIGH_CRTC_SHIFT; else pipe_index = flags & _DRM_VBLANK_SECONDARY ? 1 : 0; /* Convert lease-relative crtc index into global crtc index */ if (drm_core_check_feature(dev, DRIVER_MODESET)) { pipe = 0; drm_for_each_crtc(crtc, dev) { if (drm_lease_held(file_priv, crtc->base.id)) { if (pipe_index == 0) break; pipe_index--; } pipe++; } } else { pipe = pipe_index; } if (pipe >= dev->num_crtcs) return -EINVAL; vblank = &dev->vblank[pipe]; /* If the counter is currently enabled and accurate, short-circuit * queries to return the cached timestamp of the last vblank. */ if (dev->vblank_disable_immediate && drm_wait_vblank_is_query(vblwait) && READ_ONCE(vblank->enabled)) { drm_wait_vblank_reply(dev, pipe, &vblwait->reply); return 0; } ret = drm_vblank_get(dev, pipe); if (ret) { DRM_DEBUG("crtc %d failed to acquire vblank counter, %d\n", pipe, ret); return ret; } seq = drm_vblank_count(dev, pipe); switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { case _DRM_VBLANK_RELATIVE: req_seq = seq + vblwait->request.sequence; vblwait->request.sequence = req_seq; vblwait->request.type &= ~_DRM_VBLANK_RELATIVE; break; case _DRM_VBLANK_ABSOLUTE: req_seq = widen_32_to_64(vblwait->request.sequence, seq); break; default: ret = -EINVAL; goto done; } if ((flags & _DRM_VBLANK_NEXTONMISS) && vblank_passed(seq, req_seq)) { req_seq = seq + 1; vblwait->request.type &= ~_DRM_VBLANK_NEXTONMISS; vblwait->request.sequence = req_seq; } if (flags & _DRM_VBLANK_EVENT) { /* must hold on to the vblank ref until the event fires * drm_vblank_put will be called asynchronously */ return drm_queue_vblank_event(dev, pipe, req_seq, vblwait, file_priv); } if (req_seq != seq) { DRM_DEBUG("waiting on vblank count %llu, crtc %u\n", req_seq, pipe); DRM_WAIT_ON(ret, vblank->queue, 3 * HZ, vblank_passed(drm_vblank_count(dev, pipe), req_seq) || !READ_ONCE(vblank->enabled)); } if (ret != -EINTR) { drm_wait_vblank_reply(dev, pipe, &vblwait->reply); DRM_DEBUG("crtc %d returning %u to client\n", pipe, vblwait->reply.sequence); } else { DRM_DEBUG("crtc %d vblank wait interrupted by signal\n", pipe); } done: drm_vblank_put(dev, pipe); return ret; } static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) { struct drm_pending_vblank_event *e, *t; ktime_t now; u64 seq; assert_spin_locked(&dev->event_lock); seq = drm_vblank_count_and_time(dev, pipe, &now); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { if (e->pipe != pipe) continue; if (!vblank_passed(seq, e->sequence)) continue; DRM_DEBUG("vblank event on %llu, current %llu\n", e->sequence, seq); list_del(&e->base.link); drm_vblank_put(dev, pipe); send_vblank_event(dev, e, seq, now); } trace_drm_vblank_event(pipe, seq); } /** * drm_handle_vblank - handle a vblank event * @dev: DRM device * @pipe: index of CRTC where this event occurred * * Drivers should call this routine in their vblank interrupt handlers to * update the vblank counter and send any signals that may be pending. * * This is the legacy version of drm_crtc_handle_vblank(). */ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe) { struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; unsigned long irqflags; bool disable_irq; if (WARN_ON_ONCE(!dev->num_crtcs)) return false; if (WARN_ON(pipe >= dev->num_crtcs)) return false; spin_lock_irqsave(&dev->event_lock, irqflags); /* Need timestamp lock to prevent concurrent execution with * vblank enable/disable, as this would cause inconsistent * or corrupted timestamps and vblank counts. */ spin_lock(&dev->vblank_time_lock); /* Vblank irq handling disabled. Nothing to do. */ if (!vblank->enabled) { spin_unlock(&dev->vblank_time_lock); spin_unlock_irqrestore(&dev->event_lock, irqflags); return false; } drm_update_vblank_count(dev, pipe, true); spin_unlock(&dev->vblank_time_lock); wake_up(&vblank->queue); /* With instant-off, we defer disabling the interrupt until after * we finish processing the following vblank after all events have * been signaled. The disable has to be last (after * drm_handle_vblank_events) so that the timestamp is always accurate. */ disable_irq = (dev->vblank_disable_immediate && drm_vblank_offdelay > 0 && !atomic_read(&vblank->refcount)); drm_handle_vblank_events(dev, pipe); spin_unlock_irqrestore(&dev->event_lock, irqflags); if (disable_irq) vblank_disable_fn(&vblank->disable_timer); return true; } EXPORT_SYMBOL(drm_handle_vblank); /** * drm_crtc_handle_vblank - handle a vblank event * @crtc: where this event occurred * * Drivers should call this routine in their vblank interrupt handlers to * update the vblank counter and send any signals that may be pending. * * This is the native KMS version of drm_handle_vblank(). * * Returns: * True if the event was successfully handled, false on failure. */ bool drm_crtc_handle_vblank(struct drm_crtc *crtc) { return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc)); } EXPORT_SYMBOL(drm_crtc_handle_vblank); /* * Get crtc VBLANK count. * * \param dev DRM device * \param data user arguement, pointing to a drm_crtc_get_sequence structure. * \param file_priv drm file private for the user's open file descriptor */ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_crtc *crtc; struct drm_vblank_crtc *vblank; int pipe; struct drm_crtc_get_sequence *get_seq = data; ktime_t now; bool vblank_enabled; int ret; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; if (!dev->irq_enabled) return -EINVAL; crtc = drm_crtc_find(dev, file_priv, get_seq->crtc_id); if (!crtc) return -ENOENT; pipe = drm_crtc_index(crtc); vblank = &dev->vblank[pipe]; vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled); if (!vblank_enabled) { ret = drm_crtc_vblank_get(crtc); if (ret) { DRM_DEBUG("crtc %d failed to acquire vblank counter, %d\n", pipe, ret); return ret; } } drm_modeset_lock(&crtc->mutex, NULL); if (crtc->state) get_seq->active = crtc->state->enable; else get_seq->active = crtc->enabled; drm_modeset_unlock(&crtc->mutex); get_seq->sequence = drm_vblank_count_and_time(dev, pipe, &now); get_seq->sequence_ns = ktime_to_ns(now); if (!vblank_enabled) drm_crtc_vblank_put(crtc); return 0; } /* * Queue a event for VBLANK sequence * * \param dev DRM device * \param data user arguement, pointing to a drm_crtc_queue_sequence structure. * \param file_priv drm file private for the user's open file descriptor */ int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_crtc *crtc; struct drm_vblank_crtc *vblank; int pipe; struct drm_crtc_queue_sequence *queue_seq = data; ktime_t now; struct drm_pending_vblank_event *e; u32 flags; u64 seq; u64 req_seq; int ret; unsigned long spin_flags; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; if (!dev->irq_enabled) return -EINVAL; crtc = drm_crtc_find(dev, file_priv, queue_seq->crtc_id); if (!crtc) return -ENOENT; flags = queue_seq->flags; /* Check valid flag bits */ if (flags & ~(DRM_CRTC_SEQUENCE_RELATIVE| DRM_CRTC_SEQUENCE_NEXT_ON_MISS)) return -EINVAL; pipe = drm_crtc_index(crtc); vblank = &dev->vblank[pipe]; e = kzalloc(sizeof(*e), GFP_KERNEL); if (e == NULL) return -ENOMEM; ret = drm_crtc_vblank_get(crtc); if (ret) { DRM_DEBUG("crtc %d failed to acquire vblank counter, %d\n", pipe, ret); goto err_free; } seq = drm_vblank_count_and_time(dev, pipe, &now); req_seq = queue_seq->sequence; if (flags & DRM_CRTC_SEQUENCE_RELATIVE) req_seq += seq; if ((flags & DRM_CRTC_SEQUENCE_NEXT_ON_MISS) && vblank_passed(seq, req_seq)) req_seq = seq + 1; e->pipe = pipe; e->event.base.type = DRM_EVENT_CRTC_SEQUENCE; e->event.base.length = sizeof(e->event.seq); e->event.seq.user_data = queue_seq->user_data; spin_lock_irqsave(&dev->event_lock, spin_flags); /* * drm_crtc_vblank_off() might have been called after we called * drm_crtc_vblank_get(). drm_crtc_vblank_off() holds event_lock around the * vblank disable, so no need for further locking. The reference from * drm_crtc_vblank_get() protects against vblank disable from another source. */ if (!READ_ONCE(vblank->enabled)) { ret = -EINVAL; goto err_unlock; } ret = drm_event_reserve_init_locked(dev, file_priv, &e->base, &e->event.base); if (ret) goto err_unlock; e->sequence = req_seq; if (vblank_passed(seq, req_seq)) { drm_crtc_vblank_put(crtc); send_vblank_event(dev, e, seq, now); queue_seq->sequence = seq; } else { /* drm_handle_vblank_events will call drm_vblank_put */ list_add_tail(&e->base.link, &dev->vblank_event_list); queue_seq->sequence = req_seq; } spin_unlock_irqrestore(&dev->event_lock, spin_flags); return 0; err_unlock: spin_unlock_irqrestore(&dev->event_lock, spin_flags); drm_crtc_vblank_put(crtc); err_free: kfree(e); return ret; }
{ "pile_set_name": "Github" }
/* Copyright 2017 The Kubernetes Authors. 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. */ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "metrics.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder AddToScheme = SchemeBuilder.AddToScheme ) func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &NodeMetrics{}, &NodeMetricsList{}, &PodMetrics{}, &PodMetricsList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
{ "pile_set_name": "Github" }
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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. */ package org.keycloak.adapters.rotation; import org.keycloak.adapters.KeycloakDeployment; import java.security.PublicKey; /** * @author <a href="mailto:[email protected]">Marek Posolda</a> */ public interface PublicKeyLocator { /** * @param kid * @param deployment * @return publicKey, which should be used for verify signature on given "input" */ PublicKey getPublicKey(String kid, KeycloakDeployment deployment); /** * Reset the state of locator (eg. clear the cached keys) * * @param deployment */ void reset(KeycloakDeployment deployment); }
{ "pile_set_name": "Github" }
// =============================================================================== // May be included multiple times - sets structure packing to 1 // for all supported compilers. #include <poppack1.h> reverts the changes. // // Currently this works on the following compilers: // MSVC 7,8,9 // GCC // BORLAND (complains about 'pack state changed but not reverted', but works) // Clang // // // USAGE: // // struct StructToBePacked { // } PACK_STRUCT; // // =============================================================================== #ifdef AI_PUSHPACK_IS_DEFINED # error poppack1.h must be included after pushpack1.h #endif #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) # pragma pack(push,1) # define PACK_STRUCT #elif defined( __GNUC__ ) # if !defined(HOST_MINGW) # define PACK_STRUCT __attribute__((__packed__)) # else # define PACK_STRUCT __attribute__((gcc_struct, __packed__)) # endif #else # error Compiler not supported #endif #if defined(_MSC_VER) // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop # pragma warning (disable : 4103) #endif #define AI_PUSHPACK_IS_DEFINED
{ "pile_set_name": "Github" }
#ifndef _TRANSPORT_H_ #define _TRANSPORT_H_ #include <linux/blkdev.h> /* usb_stor_bulk_transfer_xxx() return codes, in order of severity */ #define USB_STOR_XFER_GOOD 0 /* good transfer */ #define USB_STOR_XFER_SHORT 1 /* transferred less than expected */ #define USB_STOR_XFER_STALLED 2 /* endpoint stalled */ #define USB_STOR_XFER_LONG 3 /* device tried to send too much */ #define USB_STOR_XFER_ERROR 4 /* transfer died in the middle */ /* Transport return codes */ #define USB_STOR_TRANSPORT_GOOD 0 /* Transport good, command good */ #define USB_STOR_TRANSPORT_FAILED 1 /* Transport good, command failed */ #define USB_STOR_TRANSPORT_NO_SENSE 2 /* Command failed, no auto-sense */ #define USB_STOR_TRANSPORT_ERROR 3 /* Transport bad (i.e. device dead) */ /* * We used to have USB_STOR_XFER_ABORTED and USB_STOR_TRANSPORT_ABORTED * return codes. But now the transport and low-level transfer routines * treat an abort as just another error (-ENOENT for a cancelled URB). * It is up to the invoke_transport() function to test for aborts and * distinguish them from genuine communication errors. */ /* CBI accept device specific command */ #define US_CBI_ADSC 0 extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data*); extern int usb_stor_Bulk_max_lun(struct us_data *); extern int usb_stor_Bulk_reset(struct us_data *); extern void usb_stor_print_cmd(struct scsi_cmnd *); extern void usb_stor_invoke_transport(struct scsi_cmnd *, struct us_data*); extern void usb_stor_stop_transport(struct us_data *); extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe, u8 request, u8 requesttype, u16 value, u16 index, void *data, u16 size, int timeout); extern int usb_stor_clear_halt(struct us_data *us, unsigned int pipe); extern int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe, void *buf, unsigned int length, unsigned int *act_len); extern int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe, void *buf, unsigned int length, int use_sg, int *residual); extern int usb_stor_bulk_srb(struct us_data *us, unsigned int pipe, struct scsi_cmnd *srb); extern int usb_stor_port_reset(struct us_data *us); /* Protocol handling routines */ enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; extern unsigned int usb_stor_access_xfer_buf(struct us_data*, unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **, unsigned int *offset, enum xfer_buf_dir dir); extern void usb_stor_set_xfer_buf(struct us_data*, unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb, unsigned int dir); /* * ENE scsi function */ extern void ENE_stor_invoke_transport(struct scsi_cmnd *, struct us_data *); extern int ENE_InitMedia(struct us_data *); extern int ENE_SMInit(struct us_data *); extern int ENE_SendScsiCmd(struct us_data*, BYTE, void*, int); extern int ENE_LoadBinCode(struct us_data*, BYTE); extern int ENE_Read_BYTE(struct us_data*, WORD index, void *buf); extern int ENE_Read_Data(struct us_data*, void *buf, unsigned int length); extern int ENE_Write_Data(struct us_data*, void *buf, unsigned int length); extern void BuildSenseBuffer(struct scsi_cmnd *, int); /* * ENE scsi function */ extern int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb); #endif
{ "pile_set_name": "Github" }
package org.raku.nqp.sixmodel.reprs; import org.raku.nqp.sixmodel.SixModelObject; import org.raku.nqp.sixmodel.StorageSpec; public class VMArrayREPRData { public StorageSpec ss; public SixModelObject type; }
{ "pile_set_name": "Github" }
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> AXFR hyatt. @ns3.dns.nic.hyatt. +nocomments +nocmd +noquestion +nostats +time=15 ;; global options: +cmd ; Transfer failed.
{ "pile_set_name": "Github" }
+---++---+ | U || C | +---++---+ ^ ^ | | | | +---++---+ | | A || B | | +---++---+ | | | | +----+----+
{ "pile_set_name": "Github" }
3 tests, 11 assertions, 0 failures, 0 errors Status Test Message passed testSynchronousRequest 2 assertions, 0 failures, 0 errors passed testAsynchronousRequest 2 assertions, 0 failures, 0 errors passed testUpdater 7 assertions, 0 failures, 0 errors
{ "pile_set_name": "Github" }
/**************************************************************************** * Driver for Solarflare network controllers and boards * Copyright 2005-2006 Fen Systems Ltd. * Copyright 2006-2013 Solarflare Communications Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation, incorporated herein by reference. */ #ifndef EFX_EFX_H #define EFX_EFX_H #include "net_driver.h" #include "filter.h" int efx_net_open(struct net_device *net_dev); int efx_net_stop(struct net_device *net_dev); /* TX */ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue); void efx_remove_tx_queue(struct efx_tx_queue *tx_queue); void efx_init_tx_queue(struct efx_tx_queue *tx_queue); void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev); netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type, void *type_data); unsigned int efx_tx_max_skb_descs(struct efx_nic *efx); extern unsigned int efx_piobuf_size; extern bool efx_separate_tx_channels; /* RX */ void efx_set_default_rx_indir_table(struct efx_nic *efx, struct efx_rss_context *ctx); void efx_rx_config_page_split(struct efx_nic *efx); int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); void efx_remove_rx_queue(struct efx_rx_queue *rx_queue); void efx_init_rx_queue(struct efx_rx_queue *rx_queue); void efx_fini_rx_queue(struct efx_rx_queue *rx_queue); void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic); void efx_rx_slow_fill(struct timer_list *t); void __efx_rx_packet(struct efx_channel *channel); void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, unsigned int n_frags, unsigned int len, u16 flags); static inline void efx_rx_flush_packet(struct efx_channel *channel) { if (channel->rx_pkt_n_frags) __efx_rx_packet(channel); } void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); #define EFX_MAX_DMAQ_SIZE 4096UL #define EFX_DEFAULT_DMAQ_SIZE 1024UL #define EFX_MIN_DMAQ_SIZE 512UL #define EFX_MAX_EVQ_SIZE 16384UL #define EFX_MIN_EVQ_SIZE 512UL /* Maximum number of TCP segments we support for soft-TSO */ #define EFX_TSO_MAX_SEGS 100 /* The smallest [rt]xq_entries that the driver supports. RX minimum * is a bit arbitrary. For TX, we must have space for at least 2 * TSO skbs. */ #define EFX_RXQ_MIN_ENT 128U #define EFX_TXQ_MIN_ENT(efx) (2 * efx_tx_max_skb_descs(efx)) /* All EF10 architecture NICs steal one bit of the DMAQ size for various * other purposes when counting TxQ entries, so we halve the queue size. */ #define EFX_TXQ_MAX_ENT(efx) (EFX_WORKAROUND_EF10(efx) ? \ EFX_MAX_DMAQ_SIZE / 2 : EFX_MAX_DMAQ_SIZE) static inline bool efx_rss_enabled(struct efx_nic *efx) { return efx->rss_spread > 1; } /* Filters */ void efx_mac_reconfigure(struct efx_nic *efx); /** * efx_filter_insert_filter - add or replace a filter * @efx: NIC in which to insert the filter * @spec: Specification for the filter * @replace_equal: Flag for whether the specified filter may replace an * existing filter with equal priority * * On success, return the filter ID. * On failure, return a negative error code. * * If existing filters have equal match values to the new filter spec, * then the new filter might replace them or the function might fail, * as follows. * * 1. If the existing filters have lower priority, or @replace_equal * is set and they have equal priority, replace them. * * 2. If the existing filters have higher priority, return -%EPERM. * * 3. If !efx_filter_is_mc_recipient(@spec), or the NIC does not * support delivery to multiple recipients, return -%EEXIST. * * This implies that filters for multiple multicast recipients must * all be inserted with the same priority and @replace_equal = %false. */ static inline s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, bool replace_equal) { return efx->type->filter_insert(efx, spec, replace_equal); } /** * efx_filter_remove_id_safe - remove a filter by ID, carefully * @efx: NIC from which to remove the filter * @priority: Priority of filter, as passed to @efx_filter_insert_filter * @filter_id: ID of filter, as returned by @efx_filter_insert_filter * * This function will range-check @filter_id, so it is safe to call * with a value passed from userland. */ static inline int efx_filter_remove_id_safe(struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id) { return efx->type->filter_remove_safe(efx, priority, filter_id); } /** * efx_filter_get_filter_safe - retrieve a filter by ID, carefully * @efx: NIC from which to remove the filter * @priority: Priority of filter, as passed to @efx_filter_insert_filter * @filter_id: ID of filter, as returned by @efx_filter_insert_filter * @spec: Buffer in which to store filter specification * * This function will range-check @filter_id, so it is safe to call * with a value passed from userland. */ static inline int efx_filter_get_filter_safe(struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id, struct efx_filter_spec *spec) { return efx->type->filter_get_safe(efx, priority, filter_id, spec); } static inline u32 efx_filter_count_rx_used(struct efx_nic *efx, enum efx_filter_priority priority) { return efx->type->filter_count_rx_used(efx, priority); } static inline u32 efx_filter_get_rx_id_limit(struct efx_nic *efx) { return efx->type->filter_get_rx_id_limit(efx); } static inline s32 efx_filter_get_rx_ids(struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size) { return efx->type->filter_get_rx_ids(efx, priority, buf, size); } #ifdef CONFIG_RFS_ACCEL int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id); bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned quota); static inline void efx_filter_rfs_expire(struct work_struct *data) { struct efx_channel *channel = container_of(data, struct efx_channel, filter_work); if (channel->rfs_filters_added >= 60 && __efx_filter_rfs_expire(channel->efx, 100)) channel->rfs_filters_added -= 60; } #define efx_filter_rfs_enabled() 1 #else static inline void efx_filter_rfs_expire(struct work_struct *data) {} #define efx_filter_rfs_enabled() 0 #endif bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); bool efx_filter_spec_equal(const struct efx_filter_spec *left, const struct efx_filter_spec *right); u32 efx_filter_spec_hash(const struct efx_filter_spec *spec); #ifdef CONFIG_RFS_ACCEL bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, bool *force); struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, const struct efx_filter_spec *spec); /* @new is written to indicate if entry was newly added (true) or if an old * entry was found and returned (false). */ struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, const struct efx_filter_spec *spec, bool *new); void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec); #endif /* RSS contexts */ struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); void efx_free_rss_context_entry(struct efx_rss_context *ctx); static inline bool efx_rss_active(struct efx_rss_context *ctx) { return ctx->context_id != EFX_EF10_RSS_CONTEXT_INVALID; } /* Channels */ int efx_channel_dummy_op_int(struct efx_channel *channel); void efx_channel_dummy_op_void(struct efx_channel *channel); int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries); /* Ports */ int efx_reconfigure_port(struct efx_nic *efx); int __efx_reconfigure_port(struct efx_nic *efx); /* Ethtool support */ extern const struct ethtool_ops efx_ethtool_ops; /* Reset handling */ int efx_reset(struct efx_nic *efx, enum reset_type method); void efx_reset_down(struct efx_nic *efx, enum reset_type method); int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); int efx_try_recovery(struct efx_nic *efx); /* Global */ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs); unsigned int efx_ticks_to_usecs(struct efx_nic *efx, unsigned int ticks); int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, unsigned int rx_usecs, bool rx_adaptive, bool rx_may_override_tx); void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, unsigned int *rx_usecs, bool *rx_adaptive); void efx_stop_eventq(struct efx_channel *channel); void efx_start_eventq(struct efx_channel *channel); /* Dummy PHY ops for PHY drivers */ int efx_port_dummy_op_int(struct efx_nic *efx); void efx_port_dummy_op_void(struct efx_nic *efx); /* Update the generic software stats in the passed stats array */ void efx_update_sw_stats(struct efx_nic *efx, u64 *stats); /* MTD */ #ifdef CONFIG_SFC_MTD int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, size_t n_parts, size_t sizeof_part); static inline int efx_mtd_probe(struct efx_nic *efx) { return efx->type->mtd_probe(efx); } void efx_mtd_rename(struct efx_nic *efx); void efx_mtd_remove(struct efx_nic *efx); #else static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; } static inline void efx_mtd_rename(struct efx_nic *efx) {} static inline void efx_mtd_remove(struct efx_nic *efx) {} #endif #ifdef CONFIG_SFC_SRIOV static inline unsigned int efx_vf_size(struct efx_nic *efx) { return 1 << efx->vi_scale; } #endif static inline void efx_schedule_channel(struct efx_channel *channel) { netif_vdbg(channel->efx, intr, channel->efx->net_dev, "channel %d scheduling NAPI poll on CPU%d\n", channel->channel, raw_smp_processor_id()); napi_schedule(&channel->napi_str); } static inline void efx_schedule_channel_irq(struct efx_channel *channel) { channel->event_test_cpu = raw_smp_processor_id(); efx_schedule_channel(channel); } void efx_link_status_changed(struct efx_nic *efx); void efx_link_set_advertising(struct efx_nic *efx, const unsigned long *advertising); void efx_link_clear_advertising(struct efx_nic *efx); void efx_link_set_wanted_fc(struct efx_nic *efx, u8); static inline void efx_device_detach_sync(struct efx_nic *efx) { struct net_device *dev = efx->net_dev; /* Lock/freeze all TX queues so that we can be sure the * TX scheduler is stopped when we're done and before * netif_device_present() becomes false. */ netif_tx_lock_bh(dev); netif_device_detach(dev); netif_tx_unlock_bh(dev); } static inline void efx_device_attach_if_not_resetting(struct efx_nic *efx) { if ((efx->state != STATE_DISABLED) && !efx->reset_pending) netif_device_attach(efx->net_dev); } static inline bool efx_rwsem_assert_write_locked(struct rw_semaphore *sem) { if (WARN_ON(down_read_trylock(sem))) { up_read(sem); return false; } return true; } #endif /* EFX_EFX_H */
{ "pile_set_name": "Github" }
/* Copyright (C) 2014-2019 by Jacob Alexander * * This file 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 3 of the License, or * (at your option) any later version. * * This file 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 this file. If not, see <http://www.gnu.org/licenses/>. */ // ----- Includes ----- // Compiler Includes #include <Lib/ScanLib.h> // Project Includes #include <Lib/gpio.h> #include <Lib/storage.h> #include <cli.h> #include <kll_defs.h> #include <latency.h> #include <led.h> #include <print.h> #include <pixel.h> #include <spi.h> // Interconnect module if compiled in #if defined(ConnectEnabled_define) #include <connect_scan.h> #endif // KLL Include #include <kll.h> // Local Includes #include "led_scan.h" // ----- Defines ----- // ISSI Addresses // IS31FL3743B (1 chip per CS) #if ISSI_Chip_31FL3743B_define == 1 #define LED_BufferLength 198 #define LED_ScalingLength 198 #define ISSI_ConfigPage 0x52 #define ISSI_ConfigPageLength 0x2F #define ISSI_LEDScalePage 0x51 #define ISSI_LEDScalePageStart 0x01 #define ISSI_LEDPwmPage 0x50 #define ISSI_LEDPwmPageStart 0x01 #define ISSI_PageLength 0xC6 #else #error "ISSI Driver Chip not defined in Scan scancode_map.kll..." #endif #define LED_TotalChannels (LED_BufferLength * ISSI_Chips_define) #define LED_TransferSize ((LED_BufferLength + 2) * ISSI_Chips_define) // ----- Macros ----- #define LED_ChannelMapDefine(ch) ch #define LED_MaskDefine(ch) \ { \ { ISSILedMask##ch##_define }, \ } #define LED_SPIWrite(cs, _data, _lastxfer) \ { \ .lastxfer = _lastxfer, \ .pcs = cs, \ .data = _data, \ } #define LED_RegisterWriteSetup(cs, page, reg, val) \ LED_SPIWrite(cs, page, 0), \ LED_SPIWrite(cs, reg, 0), \ LED_SPIWrite(cs, val, 1) #define LED_RegisterWrite(cs, page, reg, val) \ { \ LED_RegisterWriteSetup(cs, page, reg, val) \ } // ----- Structs ----- typedef struct LED_Buffer { uint8_t buffer[LED_BufferLength]; } LED_Buffer; typedef struct LED_ScalingBuffer { uint8_t buffer[LED_ScalingLength]; } LED_ScalingBuffer; // ----- Function Declarations ----- // CLI Functions void cliFunc_ledCheck ( char* args ); void cliFunc_ledFPS ( char* args ); void cliFunc_ledReset ( char* args ); void cliFunc_ledSet ( char* args ); void cliFunc_ledToggle( char* args ); void LED_loadConfig(); void LED_saveConfig(); void LED_printConfig(); // ----- Variables ----- // Scan Module command dictionary CLIDict_Entry( ledCheck, "Run LED diagnostics. Not all ISSI chips support this."); CLIDict_Entry( ledFPS, "Show/set FPS of LED driver, r - Reset framerate" ); CLIDict_Entry( ledReset, "Reset ISSI chips." ); CLIDict_Entry( ledSet, "Set ISSI overall brightness." ); CLIDict_Entry( ledToggle, "Toggle ISSI hardware shutdown." ); CLIDict_Def( ledCLIDict, "ISSI LED Module Commands" ) = { CLIDict_Item( ledCheck ), CLIDict_Item( ledFPS ), CLIDict_Item( ledReset ), CLIDict_Item( ledSet ), CLIDict_Item( ledToggle ), { 0, 0, 0 } // Null entry for dictionary end }; // Storage Module typedef struct { uint8_t brightness; uint8_t framerate; } LedConfig; static LedConfig settings = { .brightness = ISSI_Global_Brightness_define, .framerate = ISSI_FrameRate_ms_define, }; #if Storage_Enable_define == 1 static LedConfig defaults = { .brightness = ISSI_Global_Brightness_define, .framerate = ISSI_FrameRate_ms_define, }; static StorageModule LedStorage = { .name = "LED Scan", .settings = &settings, .defaults = &defaults, .size = sizeof(LedConfig), .onLoad = LED_loadConfig, .onSave = LED_saveConfig, .display = LED_printConfig }; #endif // Output buffer used for SPI volatile SPI_Packet LED_spi_buffer[LED_TransferSize]; volatile SPI_Transaction LED_spi_transaction; extern LED_Buffer LED_pageBuffer[ISSI_Chips_define]; uint8_t LED_displayFPS; // Display fps to cli uint8_t LED_enable; // Enable/disable ISSI chips uint8_t LED_enable_current; // Enable/disable ISSI chips (based on USB current availability) uint8_t LED_pause; // Pause ISSI updates uint8_t LED_brightness; // Global brightness for LEDs uint32_t LED_framerate; // Configured led framerate, given in ms per frame Time LED_timePrev; // Last frame processed // Enable mask and default brightness for ISSI chip channel const LED_ScalingBuffer LED_ledScalingMask[ISSI_Chips_define] = { LED_MaskDefine( 1 ), #if ISSI_Chips_define >= 2 LED_MaskDefine( 2 ), #endif #if ISSI_Chips_define >= 3 LED_MaskDefine( 3 ), #endif #if ISSI_Chips_define >= 4 LED_MaskDefine( 4 ), #endif }; #if ISSI_Chips_define >= 5 #error "Invalid number of ISSI Chips" #endif // GPIO Pins static const GPIO_Pin hardware_shutdown_pin = ISSI_HardwareShutdownPin_define; // Latency measurement resource static uint8_t ledLatencyResource; // ----- Functions ----- // Write register on all ISSI chips // Prepare pages first, then attempt write register with a minimal delay between chips // page - ISSI page // reg - Register address // val - Value to write void LED_syncReg(uint8_t page, uint8_t reg, uint8_t val) { /* info_print("SPI Sync page("); printHex( page ); print(")reg("); printHex( reg ); print(")val("); printHex( val ); print(")" NL); */ // Setup packet sequence for writing const SPI_Packet buffer[] = { LED_RegisterWriteSetup(0, page, reg, val), #if ISSI_Chips_define >= 2 LED_RegisterWriteSetup(1, page, reg, val), #elif ISSI_Chips_define >= 3 LED_RegisterWriteSetup(2, page, reg, val), #elif ISSI_Chips_define >= 4 LED_RegisterWriteSetup(3, page, reg, val), #endif }; // Build each of the transactions volatile SPI_Transaction transaction = SPI_TransactionSetup(NULL, 0, buffer, ISSI_Chips_define * 3); // Queue transactions spi_add_transaction(&transaction); // Wait for final transaction to complete while (transaction.status != SPI_Transaction_Status_Finished); } // Write address // cs - SPI Channel // page - ISSI page // reg - Register address // val - Value to write void LED_writeReg(uint8_t cs, uint8_t page, uint8_t reg, uint8_t val) { /* info_print("SPI Write cs("); printHex( cs ); print(")page("); printHex( page ); print(")reg("); printHex( reg ); print(")val("); printHex( val ); print(")" NL); */ // Setup packet sequence for writing SPI_Packet buffer[3] = LED_RegisterWrite(cs, page, reg, val); // Setup transaction volatile SPI_Transaction transaction = SPI_TransactionSetup(NULL, 0, buffer, 3); // Queue transaction spi_add_transaction( &transaction ); // Wait for transaction to complete while (transaction.status != SPI_Transaction_Status_Finished); } // Read address // cs - SPI Channel // page - ISSI page // reg - Register address uint8_t LED_readReg(uint8_t cs, uint8_t page, uint8_t reg) { /* info_print("SPI Read cs("); printHex( cs ); print(")page("); printHex( page ); print(")reg("); printHex( reg ); print(")" NL ); */ // Setup packet sequence for writing SPI_Packet txbuffer[2] = { { .lastxfer = 0, .pcs = cs, .data = page | 0x80, // Read bit }, { .lastxfer = 0, .pcs = cs, .data = reg, }, }; SPI_Packet rxbuffer; // Setup transaction volatile SPI_Transaction transaction = { .status = SPI_Transaction_Status_None, .rx_buffer = { .ul_addr = (uint32_t)&rxbuffer, .ul_size = 1, }, .tx_buffer = { .ul_addr = (uint32_t)&txbuffer, .ul_size = 2, }, }; // Queue transaction spi_add_transaction( &transaction ); // Wait for transaction to complete while ( transaction.status != SPI_Transaction_Status_Finished ); return (uint8_t)rxbuffer.data; } void LED_reset() { // Force PixelMap to stop during reset Pixel_FrameState = FrameState_Sending; // Disable FPS by default LED_displayFPS = 0; // Enable Hardware shutdown (pull low) GPIO_Ctrl(hardware_shutdown_pin, GPIO_Type_DriveSetup, GPIO_Config_Pullup); GPIO_Ctrl(hardware_shutdown_pin, GPIO_Type_DriveLow, GPIO_Config_Pullup); // Disable Hardware shutdown of ISSI chips (pull high) if ( LED_enable && LED_enable_current ) { GPIO_Ctrl(hardware_shutdown_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup); } // Clear LED Pages // Call reset to clear all registers LED_syncReg(ISSI_ConfigPage, 0x2F, 0xAE); // Setup enable mask/scaling per channel for (uint8_t cs = 0; cs < ISSI_Chips_define; cs++) { // Setup command byte volatile SPI_Packet *cmd = &LED_spi_buffer[cs * (LED_BufferLength + 2)]; cmd->data = ISSI_LEDScalePage; // Scaling Page cmd->pcs = cs; // Setup register byte (always 0x01) volatile SPI_Packet *reg = &LED_spi_buffer[cs * (LED_BufferLength + 2) + 1]; reg->data = ISSI_LEDPwmPageStart; reg->pcs = cs; for (uint16_t pkt = 0; pkt < LED_BufferLength; pkt++) { volatile SPI_Packet *pos = &LED_spi_buffer[cs * (LED_BufferLength + 2) + pkt + 2]; pos->data = LED_ledScalingMask[cs].buffer[pkt]; pos->pcs = cs; pos->lastxfer = 0; } // Set lastxfer volatile SPI_Packet *final = &LED_spi_buffer[cs * (LED_BufferLength + 2) + LED_BufferLength - 1 + 2]; final->lastxfer = 1; } // Setup spi transaction LED_spi_transaction = SPI_TransactionSetup(NULL, 0, LED_spi_buffer, LED_TransferSize); // Send scaling setup via spi // XXX (HaaTa): No need to wait as the next register set will wait for us spi_add_transaction(&LED_spi_transaction); // Reset global brightness LED_brightness = settings.brightness; // Set global brightness control LED_syncReg(ISSI_ConfigPage, 0x01, LED_brightness); // Enable pul-up and pull-down anti-ghosting resistors LED_syncReg(ISSI_ConfigPage, 0x02, 0x33); // Set tempeature roll-off LED_syncReg(ISSI_ConfigPage, 0x24, 0x00); // Setup ISSI sync and spread spectrum function for (uint8_t ch = 0; ch < ISSI_Chips_define; ch++) { // Enable master sync for the last chip and disable software shutdown // XXX (HaaTa); The last chip is used as it is the last chip all of the frame data is sent to // This is imporant as it may take more time to send the packet than the ISSI chip can handle // between frames. if (ch == ISSI_Chips_define - 1) { LED_writeReg(ch, ISSI_ConfigPage, 0x25, 0xC0); } // Slave sync for the rest and disable software shutdown else { LED_writeReg(ch, ISSI_ConfigPage, 0x25, 0x80); } } // Disable software shutdown LED_syncReg(ISSI_ConfigPage, 0x00, 0x01); // Force PixelMap to be ready for the next frame LED_spi_transaction.status = SPI_Transaction_Status_None; Pixel_FrameState = FrameState_Update; // Un-pause ISSI processing LED_pause = 0; } // Detect short or open circuit in Matrix // - Uses LED Mask to determine which LED channels are working/valid // - Detect shorts, used for manufacturing test (bad channel) // - Detect opens, used for manufacturing test (bad solder/channel) // * LED Mask will define which LEDs are expected to be working void LED_shortOpenDetect() { // Pause ISSI processing LED_pause = 1; // Set Global Current Control (needed for accurate reading) LED_syncReg(ISSI_ConfigPage, 0x01, 0x0F); // -- Case 1: Open detection (bad soldering/no led) -- // Disable pull resistors LED_syncReg(ISSI_ConfigPage, 0x02, 0x00); // Set OSD to open detection LED_syncReg(ISSI_ConfigPage, 0x00, 0x03); // Must wait for 750 us before reading (2 cycles) // Waiting 1 ms to be safe delay_us(1000); // TODO Validation info_printNL("Open Detection"); for (uint8_t cs = 0; cs < ISSI_Chips_define; cs++) { for (uint8_t reg = 0x03; reg <= 0x23; reg++) { uint8_t val = LED_readReg(cs, ISSI_ConfigPage, reg); printHex_op( val, 2 ); print(" "); } print(NL); } // -- Case 2: Short detection (bad soldering/bad led) -- // Set pull down resistors LED_syncReg(ISSI_ConfigPage, 0x02, 0x30); // Set OSD to short detection LED_syncReg(ISSI_ConfigPage, 0x00, 0x05); // Must wait for 750 us before reading (2 cycles) // Waiting 1 ms to be safe delay_us(1000); // TODO Validation info_printNL("Short Detection"); for (uint8_t cs = 0; cs < ISSI_Chips_define; cs++) { for (uint8_t reg = 0x03; reg <= 0x23; reg++) { uint8_t val = LED_readReg(cs, ISSI_ConfigPage, reg); printHex_op( val, 2 ); print(" "); } print(NL); } // We have to adjust various settings in order to get the correct reading // Reset ISSI configuration LED_reset(); } // Setup inline void LED_setup() { // Register Scan CLI dictionary CLI_registerDictionary(ledCLIDict, ledCLIDictName); #if Storage_Enable_define == 1 //Storage_registerModule(&LedStorage); #endif // Zero out FPS time LED_timePrev = Time_now(); // Initialize framerate LED_framerate = ISSI_FrameRate_ms_define; // Global brightness setting LED_brightness = ISSI_Global_Brightness_define; // Initialize SPI spi_setup(); // Setup CS pins GPIO_ConfigPin cs0 = ISSI_SPI_CS0_define; PIO_Setup(cs0); #if ISSI_Chips_define >= 2 GPIO_ConfigPin cs1 = ISSI_SPI_CS1_define; PIO_Setup(cs1); #endif #if ISSI_Chips_define >= 3 GPIO_ConfigPin cs2 = ISSI_SPI_CS2_define; PIO_Setup(cs2); #endif #if ISSI_Chips_define >= 4 GPIO_ConfigPin cs3 = ISSI_SPI_CS3_define; PIO_Setup(cs3); #endif // Setup both buffers and SPI settings for (uint8_t cs = 0; cs < ISSI_Chips_define; cs++) { // Apply SPI settings SPI_Channel settings = { // Mode 3 (cpol = 1, ncpha = 0) .cpol = 1, // SPCK .ncpha = 0, // data capture .csnaat = 0, // CS not active after transfer .csaat = 1, // CS active after transfer .size = SPI_Size_8_BIT, // Transfer size // SPCK bit rate // 60 MHz peripheral clock // 12 MHz max ISSI clock // SCBR = f_per / f_issi = 5 (4, 15 MHz has also been tested to work) .scbr = 5, .dlybs = 0, // Delay between CS and first SPCK .dlybct = 0, // Delay between consecutive transfer (no CS change) }; spi_cs_setup(cs, settings); } // LED default setting LED_enable = ISSI_Enable_define; LED_enable_current = ISSI_Enable_define; // Needs a default setting, almost always unset immediately // Reset LED sequencing LED_reset(); // Allocate latency resource ledLatencyResource = Latency_add_resource("ISSILedSPI", LatencyOption_Ticks); } // LED State processing loop unsigned int LED_currentEvent = 0; inline void LED_scan() { // Latency measurement start Latency_start_time( ledLatencyResource ); // Check for current change event if ( LED_currentEvent ) { // Turn LEDs off in low power mode if ( LED_currentEvent < 150 ) { LED_enable_current = 0; // Pause animations and clear display Pixel_setAnimationControl( AnimationControl_WipePause ); } else { LED_enable_current = 1; // Start animations Pixel_setAnimationControl( AnimationControl_Forward ); } LED_currentEvent = 0; } // Check status of SPI transaction // Only allow frame updating once the transaction has finished if (LED_spi_transaction.status == SPI_Transaction_Status_Finished) { // SPI transaction finished LED_spi_transaction.status = SPI_Transaction_Status_None; Pixel_FrameState = FrameState_Update; } // Check if an LED_pause is set // Some ISSI operations need a clear buffer, but still have the chip running if ( LED_pause ) { goto led_finish_scan; } // Check enable state if ( LED_enable && LED_enable_current ) { // Disable Hardware shutdown of ISSI chips (pull high) GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveHigh, GPIO_Config_Pullup ); } // Only write pages to I2C if chip is enabled (i.e. Hardware shutdown is disabled) else { // Enable hardware shutdown GPIO_Ctrl( hardware_shutdown_pin, GPIO_Type_DriveLow, GPIO_Config_Pullup ); goto led_finish_scan; } // Only start if we haven't already // And if we've finished updating the buffers if ( Pixel_FrameState == FrameState_Sending ) goto led_finish_scan; // Only send frame to ISSI chip if buffers are ready if ( Pixel_FrameState != FrameState_Ready ) goto led_finish_scan; // Adjust frame rate (i.e. delay and do something else for a bit) Time duration = Time_duration( LED_timePrev ); if ( duration.ms < LED_framerate ) goto led_finish_scan; // FPS Display if ( LED_displayFPS ) { // Show frame calculation dbug_print("1frame/"); printInt32( Time_ms( duration ) ); print("ms + "); printInt32( duration.ticks ); print(" ticks"); // Check if we're not meeting frame rate if ( duration.ms > LED_framerate ) { print(" - Could not meet framerate: "); printInt32( LED_framerate ); } print( NL ); } // Update frame start time LED_timePrev = Time_now(); // Do a sparse copy from the LED Buffer to the SPI Buffer for (uint8_t cs = 0; cs < ISSI_Chips_define; cs++) { // Setup command byte // Register byte is already setup (always 0x01) volatile SPI_Packet *cmd = &LED_spi_buffer[cs * (LED_BufferLength + 2)]; cmd->data = ISSI_LEDPwmPage; // PWM Page for (uint16_t pkt = 0; pkt < LED_BufferLength; pkt++) { volatile SPI_Packet *pos = &LED_spi_buffer[cs * (LED_BufferLength + 2) + pkt + 2]; pos->data = LED_pageBuffer[cs].buffer[pkt]; } } // Setup spi transaction LED_spi_transaction = SPI_TransactionSetup(NULL, 0, &LED_spi_buffer, LED_TransferSize); // Send via spi // Purposefully not waiting, this will send in the background without interrupts or CPU interference // An interrupt is only used to move onto the next transaction if any are queued spi_add_transaction(&LED_spi_transaction); led_finish_scan: // Latency measurement end Latency_end_time( ledLatencyResource ); } // Called by parent Scan Module whenver the available current has changed // current - mA void LED_currentChange( unsigned int current ) { // Delay action till next LED scan loop (as this callback sometimes occurs during interrupt requests) LED_currentEvent = current; // If current available is 0 mA, we're entering sleep mode, proceed immediately if (current == 0) { // Enter software shutdown, allows for SDB LED to be off // The MCU will have to be reset to exit sleep mode, so we don't have to worry about the current state LED_syncReg(ISSI_ConfigPage, 0x00, 0x00); } } // ----- Capabilities ----- // Basic LED Control Capability typedef enum LedControl { // Set all LEDs - with argument LedControl_brightness_decrease_all = 0, LedControl_brightness_increase_all = 1, LedControl_brightness_set_all = 2, LedControl_brightness_default = 10, // Set all LEDs - no argument LedControl_off = 3, LedControl_on = 4, LedControl_toggle = 5, // FPS Control - with argument LedControl_set_fps = 6, LedControl_increase_fps = 7, LedControl_decrease_fps = 8, LedControl_default_fps = 9, } LedControl; void LED_control( LedControl control, uint8_t arg ) { switch ( control ) { case LedControl_brightness_decrease_all: LED_enable = 1; // Only decrease to zero if ( LED_brightness - arg < 0 ) { LED_brightness = 0; } else { LED_brightness -= arg; } break; case LedControl_brightness_increase_all: LED_enable = 1; // Only increase to max if ( LED_brightness + arg > 0xFF ) { LED_brightness = 0xFF; } else { LED_brightness += arg; } break; case LedControl_brightness_set_all: LED_enable = 1; LED_brightness = arg; break; case LedControl_off: LED_enable = 0; return; case LedControl_on: LED_enable = 1; return; case LedControl_toggle: LED_enable = !LED_enable; return; case LedControl_set_fps: LED_framerate = (uint32_t)arg; return; case LedControl_increase_fps: if ( LED_framerate > 0 ) { // Smaller timeout, higher FPS LED_framerate -= arg; } return; case LedControl_decrease_fps: if ( LED_framerate < 0xFF ) { // Higher timeout, lower FPS LED_framerate += arg; } return; case LedControl_default_fps: LED_framerate = ISSI_FrameRate_ms_define; return; case LedControl_brightness_default: LED_brightness = ISSI_Global_Brightness_define; return; } // Update brightness LED_syncReg(ISSI_ConfigPage, 0x01, LED_brightness); } void LED_control_capability( TriggerMacro *trigger, uint8_t state, uint8_t stateType, uint8_t *args ) { CapabilityState cstate = KLL_CapabilityState( state, stateType ); switch ( cstate ) { case CapabilityState_Initial: // Only use capability on press break; case CapabilityState_Debug: // Display capability name print("LED_control_capability(mode,amount)"); return; default: return; } // Set the input structure LedControl control = (LedControl)args[0]; uint8_t arg = (uint8_t)args[1]; // Interconnect broadcasting #if defined(ConnectEnabled_define) // By default send to the *next* node, which will determine where to go next extern uint8_t Connect_id; // connect_scan.c uint8_t addr = Connect_id + 1; // Send interconnect remote capability packet // generatedKeymap.h extern const Capability CapabilitiesList[]; // Broadcast layerStackExact remote capability (0xFF is the broadcast id) Connect_send_RemoteCapability( addr, LED_control_capability_index, state, stateType, CapabilitiesList[ LED_control_capability_index ].argCount, args ); #endif // Modify led state of this node LED_control( control, arg ); } // ----- CLI Command Functions ----- void cliFunc_ledCheck( char* args ) { print( NL ); // No \r\n by default after the command is entered LED_shortOpenDetect(); } void cliFunc_ledReset( char* args ) { print( NL ); // No \r\n by default after the command is entered // Clear buffers for ( uint8_t buf = 0; buf < ISSI_Chips_define; buf++ ) { memset( (void*)LED_pageBuffer[ buf ].buffer, 0, LED_BufferLength * 2 ); } // Reset LEDs LED_reset(); } void cliFunc_ledFPS( char* args ) { print( NL ); // No \r\n by default after the command is entered char* curArgs; char* arg1Ptr; char* arg2Ptr = args; // Process speed argument if given curArgs = arg2Ptr; CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr ); // Just toggling FPS display if ( *arg1Ptr == '\0' ) { info_print("FPS Toggle"); LED_displayFPS = !LED_displayFPS; return; } // Check if f argument was given switch ( *arg1Ptr ) { case 'r': // Reset framerate case 'R': LED_framerate = ISSI_FrameRate_ms_define; break; default: // Convert to a number LED_framerate = numToInt( arg1Ptr ); break; } // Show result info_print("Setting framerate to: "); printInt32( LED_framerate ); print("ms"); } void cliFunc_ledToggle( char* args ) { print( NL ); // No \r\n by default after the command is entered info_print("LEDs Toggle"); LED_enable = !LED_enable; } void LED_setBrightness(uint8_t brightness) { LED_brightness = brightness; // Update brightness LED_syncReg(ISSI_ConfigPage, 0x01, LED_brightness); } void cliFunc_ledSet( char* args ) { print( NL ); // No \r\n by default after the command is entered char* curArgs; char* arg1Ptr; char* arg2Ptr = args; // Process speed argument if given curArgs = arg2Ptr; CLI_argumentIsolation( curArgs, &arg1Ptr, &arg2Ptr ); // Reset brightness if ( *arg1Ptr == '\0' ) { LED_setBrightness( settings.brightness ); } else { LED_setBrightness( numToInt(arg1Ptr) ); } info_print("LED Brightness Set"); } #if Storage_Enable_define == 1 void LED_loadConfig() { LED_setBrightness(settings.brightness); LED_framerate = settings.framerate; } void LED_saveConfig() { settings.brightness = LED_brightness; settings.framerate = LED_framerate; } void LED_printConfig() { print(" \033[35mBrightness\033[0m "); printInt8(settings.brightness); print( NL ); print(" \033[35mFramerate (ms/f)\033[0m "); printInt8(settings.framerate); print( NL ); } #endif
{ "pile_set_name": "Github" }
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's 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. // // * The name of the copyright holders may not 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 Intel Corporation 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. // //M*/ #ifndef __OPENCV_GPU_TEST_UTILITY_HPP__ #define __OPENCV_GPU_TEST_UTILITY_HPP__ #include "opencv2/core/core.hpp" #include "opencv2/core/gpumat.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/ts/ts.hpp" #include "opencv2/ts/ts_perf.hpp" namespace cvtest { ////////////////////////////////////////////////////////////////////// // random generators CV_EXPORTS int randomInt(int minVal, int maxVal); CV_EXPORTS double randomDouble(double minVal, double maxVal); CV_EXPORTS cv::Size randomSize(int minVal, int maxVal); CV_EXPORTS cv::Scalar randomScalar(double minVal, double maxVal); CV_EXPORTS cv::Mat randomMat(cv::Size size, int type, double minVal = 0.0, double maxVal = 255.0); ////////////////////////////////////////////////////////////////////// // GpuMat create CV_EXPORTS cv::gpu::GpuMat createMat(cv::Size size, int type, bool useRoi = false); CV_EXPORTS cv::gpu::GpuMat loadMat(const cv::Mat& m, bool useRoi = false); ////////////////////////////////////////////////////////////////////// // Image load //! read image from testdata folder CV_EXPORTS cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR); //! read image from testdata folder and convert it to specified type CV_EXPORTS cv::Mat readImageType(const std::string& fname, int type); ////////////////////////////////////////////////////////////////////// // Gpu devices //! return true if device supports specified feature and gpu module was built with support the feature. CV_EXPORTS bool supportFeature(const cv::gpu::DeviceInfo& info, cv::gpu::FeatureSet feature); class CV_EXPORTS DeviceManager { public: static DeviceManager& instance(); void load(int i); void loadAll(); const std::vector<cv::gpu::DeviceInfo>& values() const { return devices_; } private: std::vector<cv::gpu::DeviceInfo> devices_; }; #define ALL_DEVICES testing::ValuesIn(cvtest::DeviceManager::instance().values()) ////////////////////////////////////////////////////////////////////// // Additional assertion CV_EXPORTS void minMaxLocGold(const cv::Mat& src, double* minVal_, double* maxVal_ = 0, cv::Point* minLoc_ = 0, cv::Point* maxLoc_ = 0, const cv::Mat& mask = cv::Mat()); CV_EXPORTS cv::Mat getMat(cv::InputArray arr); CV_EXPORTS testing::AssertionResult assertMatNear(const char* expr1, const char* expr2, const char* eps_expr, cv::InputArray m1, cv::InputArray m2, double eps); #define EXPECT_MAT_NEAR(m1, m2, eps) EXPECT_PRED_FORMAT3(cvtest::assertMatNear, m1, m2, eps) #define ASSERT_MAT_NEAR(m1, m2, eps) ASSERT_PRED_FORMAT3(cvtest::assertMatNear, m1, m2, eps) #define EXPECT_SCALAR_NEAR(s1, s2, eps) \ { \ EXPECT_NEAR(s1[0], s2[0], eps); \ EXPECT_NEAR(s1[1], s2[1], eps); \ EXPECT_NEAR(s1[2], s2[2], eps); \ EXPECT_NEAR(s1[3], s2[3], eps); \ } #define ASSERT_SCALAR_NEAR(s1, s2, eps) \ { \ ASSERT_NEAR(s1[0], s2[0], eps); \ ASSERT_NEAR(s1[1], s2[1], eps); \ ASSERT_NEAR(s1[2], s2[2], eps); \ ASSERT_NEAR(s1[3], s2[3], eps); \ } #define EXPECT_POINT2_NEAR(p1, p2, eps) \ { \ EXPECT_NEAR(p1.x, p2.x, eps); \ EXPECT_NEAR(p1.y, p2.y, eps); \ } #define ASSERT_POINT2_NEAR(p1, p2, eps) \ { \ ASSERT_NEAR(p1.x, p2.x, eps); \ ASSERT_NEAR(p1.y, p2.y, eps); \ } #define EXPECT_POINT3_NEAR(p1, p2, eps) \ { \ EXPECT_NEAR(p1.x, p2.x, eps); \ EXPECT_NEAR(p1.y, p2.y, eps); \ EXPECT_NEAR(p1.z, p2.z, eps); \ } #define ASSERT_POINT3_NEAR(p1, p2, eps) \ { \ ASSERT_NEAR(p1.x, p2.x, eps); \ ASSERT_NEAR(p1.y, p2.y, eps); \ ASSERT_NEAR(p1.z, p2.z, eps); \ } CV_EXPORTS double checkSimilarity(cv::InputArray m1, cv::InputArray m2); #define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \ { \ ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.size(), mat2.size()); \ EXPECT_LE(checkSimilarity(mat1, mat2), eps); \ } #define ASSERT_MAT_SIMILAR(mat1, mat2, eps) \ { \ ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_LE(checkSimilarity(mat1, mat2), eps); \ } ////////////////////////////////////////////////////////////////////// // Helper structs for value-parameterized tests #define GPU_TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ : public test_case_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \ virtual void TestBody(); \ private: \ void UnsafeTestBody(); \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder<test_case_name>(\ #test_case_name, __FILE__, __LINE__)->AddTestPattern(\ #test_case_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_case_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() \ { \ try \ { \ UnsafeTestBody(); \ } \ catch (...) \ { \ cv::gpu::resetDevice(); \ throw; \ } \ } \ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::UnsafeTestBody() #define PARAM_TEST_CASE(name, ...) struct name : testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > > #define GET_PARAM(k) std::tr1::get< k >(GetParam()) #define DIFFERENT_SIZES testing::Values(cv::Size(128, 128), cv::Size(113, 113)) // Depth using perf::MatDepth; #define ALL_DEPTH testing::Values(MatDepth(CV_8U), MatDepth(CV_8S), MatDepth(CV_16U), MatDepth(CV_16S), MatDepth(CV_32S), MatDepth(CV_32F), MatDepth(CV_64F)) #define DEPTH_PAIRS testing::Values(std::make_pair(MatDepth(CV_8U), MatDepth(CV_8U)), \ std::make_pair(MatDepth(CV_8U), MatDepth(CV_16U)), \ std::make_pair(MatDepth(CV_8U), MatDepth(CV_16S)), \ std::make_pair(MatDepth(CV_8U), MatDepth(CV_32S)), \ std::make_pair(MatDepth(CV_8U), MatDepth(CV_32F)), \ std::make_pair(MatDepth(CV_8U), MatDepth(CV_64F)), \ \ std::make_pair(MatDepth(CV_16U), MatDepth(CV_16U)), \ std::make_pair(MatDepth(CV_16U), MatDepth(CV_32S)), \ std::make_pair(MatDepth(CV_16U), MatDepth(CV_32F)), \ std::make_pair(MatDepth(CV_16U), MatDepth(CV_64F)), \ \ std::make_pair(MatDepth(CV_16S), MatDepth(CV_16S)), \ std::make_pair(MatDepth(CV_16S), MatDepth(CV_32S)), \ std::make_pair(MatDepth(CV_16S), MatDepth(CV_32F)), \ std::make_pair(MatDepth(CV_16S), MatDepth(CV_64F)), \ \ std::make_pair(MatDepth(CV_32S), MatDepth(CV_32S)), \ std::make_pair(MatDepth(CV_32S), MatDepth(CV_32F)), \ std::make_pair(MatDepth(CV_32S), MatDepth(CV_64F)), \ \ std::make_pair(MatDepth(CV_32F), MatDepth(CV_32F)), \ std::make_pair(MatDepth(CV_32F), MatDepth(CV_64F)), \ \ std::make_pair(MatDepth(CV_64F), MatDepth(CV_64F))) // Type using perf::MatType; //! return vector with types from specified range. CV_EXPORTS std::vector<MatType> types(int depth_start, int depth_end, int cn_start, int cn_end); //! return vector with all types (depth: CV_8U-CV_64F, channels: 1-4). CV_EXPORTS const std::vector<MatType>& all_types(); #define ALL_TYPES testing::ValuesIn(all_types()) #define TYPES(depth_start, depth_end, cn_start, cn_end) testing::ValuesIn(types(depth_start, depth_end, cn_start, cn_end)) // ROI class UseRoi { public: inline UseRoi(bool val = false) : val_(val) {} inline operator bool() const { return val_; } private: bool val_; }; CV_EXPORTS void PrintTo(const UseRoi& useRoi, std::ostream* os); #define WHOLE_SUBMAT testing::Values(UseRoi(false), UseRoi(true)) // Direct/Inverse class Inverse { public: inline Inverse(bool val = false) : val_(val) {} inline operator bool() const { return val_; } private: bool val_; }; CV_EXPORTS void PrintTo(const Inverse& useRoi, std::ostream* os); #define DIRECT_INVERSE testing::Values(Inverse(false), Inverse(true)) // Param class #define IMPLEMENT_PARAM_CLASS(name, type) \ class name \ { \ public: \ name ( type arg = type ()) : val_(arg) {} \ operator type () const {return val_;} \ private: \ type val_; \ }; \ inline void PrintTo( name param, std::ostream* os) \ { \ *os << #name << "(" << testing::PrintToString(static_cast< type >(param)) << ")"; \ } IMPLEMENT_PARAM_CLASS(Channels, int) #define ALL_CHANNELS testing::Values(Channels(1), Channels(2), Channels(3), Channels(4)) #define IMAGE_CHANNELS testing::Values(Channels(1), Channels(3), Channels(4)) // Flags and enums CV_ENUM(NormCode, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_TYPE_MASK, cv::NORM_RELATIVE, cv::NORM_MINMAX) CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) CV_ENUM(BorderType, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP) #define ALL_BORDER_TYPES testing::Values(BorderType(cv::BORDER_REFLECT101), BorderType(cv::BORDER_REPLICATE), BorderType(cv::BORDER_CONSTANT), BorderType(cv::BORDER_REFLECT), BorderType(cv::BORDER_WRAP)) CV_FLAGS(WarpFlags, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::WARP_INVERSE_MAP) ////////////////////////////////////////////////////////////////////// // Features2D CV_EXPORTS testing::AssertionResult assertKeyPointsEquals(const char* gold_expr, const char* actual_expr, std::vector<cv::KeyPoint>& gold, std::vector<cv::KeyPoint>& actual); #define ASSERT_KEYPOINTS_EQ(gold, actual) EXPECT_PRED_FORMAT2(assertKeyPointsEquals, gold, actual) CV_EXPORTS int getMatchedPointsCount(std::vector<cv::KeyPoint>& gold, std::vector<cv::KeyPoint>& actual); CV_EXPORTS int getMatchedPointsCount(const std::vector<cv::KeyPoint>& keypoints1, const std::vector<cv::KeyPoint>& keypoints2, const std::vector<cv::DMatch>& matches); ////////////////////////////////////////////////////////////////////// // Other CV_EXPORTS void dumpImage(const std::string& fileName, const cv::Mat& image); CV_EXPORTS void showDiff(cv::InputArray gold, cv::InputArray actual, double eps); CV_EXPORTS void printCudaInfo(); } namespace cv { namespace gpu { CV_EXPORTS void PrintTo(const DeviceInfo& info, std::ostream* os); }} #endif // __OPENCV_GPU_TEST_UTILITY_HPP__
{ "pile_set_name": "Github" }
/* PropertyPermissionCollection.java -- a collection of PropertyPermissions Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package java.util; import java.security.Permission; import java.security.PermissionCollection; /** * This class provides the implementation for * <code>PropertyPermission.newPermissionCollection()</code>. It only accepts * PropertyPermissions, and correctly implements <code>implies</code>. It * is synchronized, as specified in the superclass. * * @author Eric Blake ([email protected]) * @status an undocumented class, but this matches Sun's serialization */ class PropertyPermissionCollection extends PermissionCollection { /** * Compatible with JDK 1.4. */ private static final long serialVersionUID = 7015263904581634791L; /** * The permissions. * * @serial the table of permissions in the collection */ private final Hashtable permissions = new Hashtable(); /** * A flag to detect if "*" is in the collection. * * @serial true if "*" is in the collection */ private boolean all_allowed; /** * Adds a PropertyPermission to this collection. * * @param permission the permission to add * @throws IllegalArgumentException if permission is not a PropertyPermission * @throws SecurityException if collection is read-only */ public void add(Permission permission) { if (isReadOnly()) throw new SecurityException("readonly"); if (! (permission instanceof PropertyPermission)) throw new IllegalArgumentException(); PropertyPermission pp = (PropertyPermission) permission; String name = pp.getName(); if (name.equals("*")) all_allowed = true; PropertyPermission old = (PropertyPermission) permissions.get(name); if (old != null) { if ((pp.actions | old.actions) == old.actions) pp = old; // Old implies pp. else if ((pp.actions | old.actions) != pp.actions) // Here pp doesn't imply old; the only case left is both actions. pp = new PropertyPermission(name, "read,write"); } permissions.put(name, pp); } /** * Returns true if this collection implies the given permission. This even * returns true for this case: * * <pre> * collection.add(new PropertyPermission("a.*", "read")); * collection.add(new PropertyPermission("a.b.*", "write")); * collection.implies(new PropertyPermission("a.b.c", "read,write")); * </pre> * * @param permission the permission to check * @return true if it is implied by this */ public boolean implies(Permission permission) { if (! (permission instanceof PropertyPermission)) return false; PropertyPermission toImply = (PropertyPermission) permission; int actions = toImply.actions; if (all_allowed) { int all_actions = ((PropertyPermission) permissions.get("*")).actions; actions &= ~all_actions; if (actions == 0) return true; } String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { PropertyPermission forName = (PropertyPermission) permissions.get(name); if (forName != null) { actions &= ~forName.actions; if (actions == 0) return true; } prefixLength = name.lastIndexOf('.', prefixLength - 1); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } } /** * Enumerate over the collection. * * @return an enumeration of the collection contents */ public Enumeration elements() { return permissions.elements(); } }
{ "pile_set_name": "Github" }
package resource import ( "context" "net" "time" "github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin" "github.com/hashicorp/terraform-plugin-sdk/internal/providers" proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" tfplugin "github.com/hashicorp/terraform-plugin-sdk/plugin" "github.com/hashicorp/terraform-plugin-sdk/terraform" "google.golang.org/grpc" "google.golang.org/grpc/test/bufconn" ) // GRPCTestProvider takes a legacy ResourceProvider, wraps it in the new GRPC // shim and starts it in a grpc server using an inmem connection. It returns a // GRPCClient for this new server to test the shimmed resource provider. func GRPCTestProvider(rp terraform.ResourceProvider) providers.Interface { listener := bufconn.Listen(256 * 1024) grpcServer := grpc.NewServer() p := plugin.NewGRPCProviderServerShim(rp) proto.RegisterProviderServer(grpcServer, p) go grpcServer.Serve(listener) conn, err := grpc.Dial("", grpc.WithDialer(func(string, time.Duration) (net.Conn, error) { return listener.Dial() }), grpc.WithInsecure()) if err != nil { panic(err) } var pp tfplugin.GRPCProviderPlugin client, _ := pp.GRPCClient(context.Background(), nil, conn) grpcClient := client.(*tfplugin.GRPCProvider) grpcClient.TestServer = grpcServer return grpcClient }
{ "pile_set_name": "Github" }
/* * 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. */ package com.aliyuncs.jarvis.transform.v20180206; import com.aliyuncs.jarvis.model.v20180206.DescribeUidGcLevelResponse; import com.aliyuncs.transform.UnmarshallerContext; public class DescribeUidGcLevelResponseUnmarshaller { public static DescribeUidGcLevelResponse unmarshall(DescribeUidGcLevelResponse describeUidGcLevelResponse, UnmarshallerContext context) { describeUidGcLevelResponse.setRequestId(context.stringValue("DescribeUidGcLevelResponse.RequestId")); describeUidGcLevelResponse.setModule(context.stringValue("DescribeUidGcLevelResponse.Module")); describeUidGcLevelResponse.setGclevel(context.stringValue("DescribeUidGcLevelResponse.Gclevel")); return describeUidGcLevelResponse; } }
{ "pile_set_name": "Github" }
.. _finalizers: ========= Finalizer ========= Finalizer is a special function, which is called in exactly two cases ``delete`` is called explicitly on a data type:: var f <- [{int 1;2;3;4}] delete f Lambda based iterator or generator is sequenced out:: var src <- [{int 1;2;3;4}] var gen <- generator<int&> [[<-src]] () <| $ () for w in src yield w return false for t in gen print("t = {t}\n") // finalizer is called on captured version of src By default finalizers are called recursively on subtypes. If memory models allows deallocation, standard finalizers will also free the memory:: options persistent_heap = true var src <- [{int 1;2;3;4}] delete src // memory of src will be freed here Custom finalizer can be defined for any type by overriding ``finalize`` function. Generic custom finalizers are also allowed:: struct Foo a : int def finalize ( var foo : Foo ) print("we kill foo\n") var f = [[Foo a = 5]] delete f // prints 'we kill foo' here -------------------------------- Rules and implementation details -------------------------------- Finalizers obey the following rules. If custom ``finalize`` is available, its called instead of default one. Pointer finalizer expands to calling ``finalize`` on dereferenced pointer, and then calling native memory finalizer on the result:: var pf = new Foo unsafe delete pf expands to:: def finalize ( var __this:Foo?& explicit -const ) if __this != null _::finalize(deref(__this)) delete /*native*/ __this __this = null Static array calls ``finalize_dim`` generic, which finalizes all its values:: var f : Foo[5] delete f expands to:: def builtin`finalize_dim ( var a:Foo aka TT[5] explicit ) for aV in a _::finalize(aV) Dynamic array calls ``finalize`` generic, which finalizes all its values:: var f : array<Foo> delete f expands to:: def builtin`finalize ( var a:array<Foo aka TT> explicit ) for aV in a _::finalize(aV) __builtin_array_free(a,4,__context__) Table calls ``finalize`` generic, which finalizes all its values, but not keys:: var f : table<string;Foo> delete f expands to:: def builtin`finalize ( var a:table<string aka TK;Foo aka TV> explicit ) for aV in values(a) _::finalize(aV) __builtin_table_free(a,8,4,__context__) Custom finalizer is generated for structure. Fields annotated as [[do_not_delete]] are ignored. ``memzero`` clears structure memory at the end:: struct Goo a : Foo [[do_not_delete]] b : array<int> var g <- [[Goo]] delete g expands to:: def finalize ( var __this:Goo explicit ) _::finalize(__this.a) __::builtin`finalize(__this.b) memzero(__this) Tuple behaves similar to structure. There is no way to ignore individual fields:: var t : tuple<Foo; int> delete t expands to:: def finalize ( var __this:tuple<Foo;int> explicit -const ) _::finalize(__this._0) memzero(__this) Variant behaves similar to tuple. Only currently active variant is finalized:: var t : variant<f:Foo; i:int; ai:array<int>> delete t epxands to:: def finalize ( var __this:variant<f:Foo;i:int;ai:array<int>> explicit -const ) if __this is f _::finalize(__this.f) else if __this is ai __::builtin`finalize(__this.ai) memzero(__this) Lambdas and generators have their capture structure finalized. Lambda can have custom finalizer defined as well (see :ref:`Lambdas <lambdas_finalizer>`). Classes can define custom finalizer inside the class body (see :ref:`Classes <classes_finalizer>`).
{ "pile_set_name": "Github" }
// Cartesian kinematics stepper pulse time generation // // Copyright (C) 2018-2019 Kevin O'Connor <[email protected]> // // This file may be distributed under the terms of the GNU GPLv3 license. #include <stdlib.h> // malloc #include <string.h> // memset #include "compiler.h" // __visible #include "itersolve.h" // struct stepper_kinematics #include "pyhelper.h" // errorf #include "trapq.h" // move_get_coord static double cart_stepper_x_calc_position(struct stepper_kinematics *sk, struct move *m , double move_time) { return move_get_coord(m, move_time).x; } static double cart_stepper_y_calc_position(struct stepper_kinematics *sk, struct move *m , double move_time) { return move_get_coord(m, move_time).y; } static double cart_stepper_z_calc_position(struct stepper_kinematics *sk, struct move *m , double move_time) { return move_get_coord(m, move_time).z; } struct stepper_kinematics * __visible cartesian_stepper_alloc(char axis) { struct stepper_kinematics *sk = malloc(sizeof(*sk)); memset(sk, 0, sizeof(*sk)); if (axis == 'x') { sk->calc_position_cb = cart_stepper_x_calc_position; sk->active_flags = AF_X; } else if (axis == 'y') { sk->calc_position_cb = cart_stepper_y_calc_position; sk->active_flags = AF_Y; } else if (axis == 'z') { sk->calc_position_cb = cart_stepper_z_calc_position; sk->active_flags = AF_Z; } return sk; }
{ "pile_set_name": "Github" }
/* * 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. */ /* $Id$ */ package org.apache.fop.render.ps.extensions; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; /** * Base postscript commment element class */ public abstract class AbstractPSCommentElement extends AbstractPSExtensionElement { /** * Default constructor * * @param parent parent of this node * @see org.apache.fop.fo.FONode#FONode(FONode) */ public AbstractPSCommentElement(FONode parent) { super(parent); } /** * @throws FOPException if there's a problem during processing * @see org.apache.fop.fo.FONode#startOfNode() */ public void startOfNode() throws FOPException { if (parent.getNameId() != Constants.FO_DECLARATIONS && parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) { invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(), "rule.childOfSPMorDeclarations"); } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.maps</key> <true/> </dict> </plist>
{ "pile_set_name": "Github" }
/** * @name exports * @summary SubstanceReferenceInformation Class */ module.exports = class SubstanceReferenceInformation { constructor(opts) { // Create an object to store all props Object.defineProperty(this, '__data', { value: {} }); // Define getters and setters as enumerable Object.defineProperty(this, '_id', { enumerable: true, get: () => this.__data._id, set: (value) => { if (value === undefined || value === null) { return; } let Element = require('./element.js'); this.__data._id = new Element(value); }, }); Object.defineProperty(this, 'id', { enumerable: true, get: () => this.__data.id, set: (value) => { if (value === undefined || value === null) { return; } this.__data.id = value; }, }); Object.defineProperty(this, 'meta', { enumerable: true, get: () => this.__data.meta, set: (value) => { if (value === undefined || value === null) { return; } let Meta = require('./meta.js'); this.__data.meta = new Meta(value); }, }); Object.defineProperty(this, '_implicitRules', { enumerable: true, get: () => this.__data._implicitRules, set: (value) => { if (value === undefined || value === null) { return; } let Element = require('./element.js'); this.__data._implicitRules = new Element(value); }, }); Object.defineProperty(this, 'implicitRules', { enumerable: true, get: () => this.__data.implicitRules, set: (value) => { if (value === undefined || value === null) { return; } this.__data.implicitRules = value; }, }); Object.defineProperty(this, '_language', { enumerable: true, get: () => this.__data._language, set: (value) => { if (value === undefined || value === null) { return; } let Element = require('./element.js'); this.__data._language = new Element(value); }, }); Object.defineProperty(this, 'language', { enumerable: true, get: () => this.__data.language, set: (value) => { if (value === undefined || value === null) { return; } this.__data.language = value; }, }); Object.defineProperty(this, 'text', { enumerable: true, get: () => this.__data.text, set: (value) => { if (value === undefined || value === null) { return; } let Narrative = require('./narrative.js'); this.__data.text = new Narrative(value); }, }); Object.defineProperty(this, 'contained', { enumerable: true, get: () => this.__data.contained, set: (value) => { if (value === undefined || value === null) { return; } this.__data.contained = Array.isArray(value) ? value.map((v) => v) : [value]; }, }); Object.defineProperty(this, 'extension', { enumerable: true, get: () => this.__data.extension, set: (value) => { if (value === undefined || value === null) { return; } let Extension = require('./extension.js'); this.__data.extension = Array.isArray(value) ? value.map((v) => new Extension(v)) : [new Extension(value)]; }, }); Object.defineProperty(this, 'modifierExtension', { enumerable: true, get: () => this.__data.modifierExtension, set: (value) => { if (value === undefined || value === null) { return; } let Extension = require('./extension.js'); this.__data.modifierExtension = Array.isArray(value) ? value.map((v) => new Extension(v)) : [new Extension(value)]; }, }); Object.defineProperty(this, '_comment', { enumerable: true, get: () => this.__data._comment, set: (value) => { if (value === undefined || value === null) { return; } let Element = require('./element.js'); this.__data._comment = new Element(value); }, }); Object.defineProperty(this, 'comment', { enumerable: true, get: () => this.__data.comment, set: (value) => { if (value === undefined || value === null) { return; } this.__data.comment = value; }, }); Object.defineProperty(this, 'gene', { enumerable: true, get: () => this.__data.gene, set: (value) => { if (value === undefined || value === null) { return; } let SubstanceReferenceInformationGene = require('./substancereferenceinformationgene.js'); this.__data.gene = Array.isArray(value) ? value.map((v) => new SubstanceReferenceInformationGene(v)) : [new SubstanceReferenceInformationGene(value)]; }, }); Object.defineProperty(this, 'geneElement', { enumerable: true, get: () => this.__data.geneElement, set: (value) => { if (value === undefined || value === null) { return; } let SubstanceReferenceInformationGeneElement = require('./substancereferenceinformationgeneelement.js'); this.__data.geneElement = Array.isArray(value) ? value.map((v) => new SubstanceReferenceInformationGeneElement(v)) : [new SubstanceReferenceInformationGeneElement(value)]; }, }); Object.defineProperty(this, 'classification', { enumerable: true, get: () => this.__data.classification, set: (value) => { if (value === undefined || value === null) { return; } let SubstanceReferenceInformationClassification = require('./substancereferenceinformationclassification.js'); this.__data.classification = Array.isArray(value) ? value.map((v) => new SubstanceReferenceInformationClassification(v)) : [new SubstanceReferenceInformationClassification(value)]; }, }); Object.defineProperty(this, 'target', { enumerable: true, get: () => this.__data.target, set: (value) => { if (value === undefined || value === null) { return; } let SubstanceReferenceInformationTarget = require('./substancereferenceinformationtarget.js'); this.__data.target = Array.isArray(value) ? value.map((v) => new SubstanceReferenceInformationTarget(v)) : [new SubstanceReferenceInformationTarget(value)]; }, }); // Merge in any defaults Object.assign(this, opts); // Define a default non-writable resourceType property Object.defineProperty(this, 'resourceType', { value: 'SubstanceReferenceInformation', enumerable: true, writable: false, }); } static get resourceType() { return 'SubstanceReferenceInformation'; } toJSON() { return { resourceType: this.resourceType, id: this.id, meta: this.meta && this.meta.toJSON(), _implicitRules: this._implicitRules && this._implicitRules.toJSON(), implicitRules: this.implicitRules, _language: this._language && this._language.toJSON(), language: this.language, text: this.text && this.text.toJSON(), contained: this.contained, extension: this.extension && this.extension.map((v) => v.toJSON()), modifierExtension: this.modifierExtension && this.modifierExtension.map((v) => v.toJSON()), _comment: this._comment && this._comment.toJSON(), comment: this.comment, gene: this.gene && this.gene.map((v) => v.toJSON()), geneElement: this.geneElement && this.geneElement.map((v) => v.toJSON()), classification: this.classification && this.classification.map((v) => v.toJSON()), target: this.target && this.target.map((v) => v.toJSON()), }; } };
{ "pile_set_name": "Github" }
#! /bin/bash socat tcp-l:10088,fork exec:./deploy.py
{ "pile_set_name": "Github" }
%module xxx %typemap(in) (char *str, int len) { } %apply (char *str, int len) { int x };
{ "pile_set_name": "Github" }
# 方块 本索引列出了OC全部的的方块 如果要找物品点[这里](../item/index.md). 注意有些方块由于合成表的原因,可能不可用. ## 电脑 * [机箱](case1.md) * [单片机](microcontroller.md) * [机架](rack.md) * [机器人](robot.md) ## 组件 ### 输入 / 输出 * [全息投影机](hologram1.md) * [键盘](keyboard.md) * [屏幕](screen1.md) ### 存储 * [软盘驱动器](diskDrive.md) * [硬盘阵列](raid.md) ### 扩展 * [适配器](adapter.md) * [扫描器](geolyzer.md) * [运动探测器](motionSensor.md) * [红石IO接口](redstone.md) * [转置器(注:直译)](transposer.md) * [路径点](waypoint.md) ## 组装 / 打印 * [3D打印](print.md) * [3D打印机](printer.md) * [组装器](assembler.md) * [染色方块](chameliumBlock.md) * [拆解器](disassembler.md) ## 网络 * [线缆](cable.md) * [VLAN分割器](netSplitter.md) * [中继器](relay.md) ## 电源管理 * [电容](capacitor.md) * [充电器](charger.md) * [能源转换](powerConverter.md) * [能源分发](powerDistributor.md)
{ "pile_set_name": "Github" }
<HTML> <HEAD> <meta charset="UTF-8"> <title>TrafficAnimationRenderer.<init> - kotcity4</title> <link rel="stylesheet" href="../../../style.css"> </HEAD> <BODY> <a href="../../index.html">kotcity4</a>&nbsp;/&nbsp;<a href="../index.html">kotcity.ui.layers</a>&nbsp;/&nbsp;<a href="index.html">TrafficAnimationRenderer</a>&nbsp;/&nbsp;<a href="./-init-.html">&lt;init&gt;</a><br/> <br/> <h1>&lt;init&gt;</h1> <a name="kotcity.ui.layers.TrafficAnimationRenderer$&lt;init&gt;(kotcity.data.CityMap, kotcity.ui.map.CityRenderer, kotcity.ui.ResizableCanvas)"></a> <code><span class="identifier">TrafficAnimationRenderer</span><span class="symbol">(</span><span class="identifier" id="kotcity.ui.layers.TrafficAnimationRenderer$<init>(kotcity.data.CityMap, kotcity.ui.map.CityRenderer, kotcity.ui.ResizableCanvas)/cityMap">cityMap</span><span class="symbol">:</span>&nbsp;<a href="../../kotcity.data/-city-map/index.html"><span class="identifier">CityMap</span></a><span class="symbol">, </span><span class="identifier" id="kotcity.ui.layers.TrafficAnimationRenderer$<init>(kotcity.data.CityMap, kotcity.ui.map.CityRenderer, kotcity.ui.ResizableCanvas)/cityRenderer">cityRenderer</span><span class="symbol">:</span>&nbsp;<a href="../../kotcity.ui.map/-city-renderer/index.html"><span class="identifier">CityRenderer</span></a><span class="symbol">, </span><span class="identifier" id="kotcity.ui.layers.TrafficAnimationRenderer$<init>(kotcity.data.CityMap, kotcity.ui.map.CityRenderer, kotcity.ui.ResizableCanvas)/trafficCanvas">trafficCanvas</span><span class="symbol">:</span>&nbsp;<a href="../../kotcity.ui/-resizable-canvas/index.html"><span class="identifier">ResizableCanvas</span></a><span class="symbol">)</span></code> </BODY> </HTML>
{ "pile_set_name": "Github" }
#![allow(unused)] #![allow(type_alias_bounds)] pub trait Foo { fn test(&self); } fn generic_function<X: Foo>(x: X) {} enum E where i32: Foo { V } //~ ERROR struct S where i32: Foo; //~ ERROR trait T where i32: Foo {} //~ ERROR union U where i32: Foo { f: i32 } //~ ERROR type Y where i32: Foo = (); // OK - bound is ignored impl Foo for () where i32: Foo { //~ ERROR fn test(&self) { 3i32.test(); Foo::test(&4i32); generic_function(5i32); } } fn f() where i32: Foo //~ ERROR { let s = S; 3i32.test(); Foo::test(&4i32); generic_function(5i32); } fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR -s } fn use_for() where i32: Iterator { //~ ERROR for _ in 2i32 {} } trait A {} impl A for i32 {} struct Dst<X: ?Sized> { x: X, } struct TwoStrs(str, str) where str: Sized; //~ ERROR fn unsized_local() where Dst<dyn A>: Sized { //~ ERROR let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>); } fn return_str() -> str where str: Sized { //~ ERROR *"Sized".to_string().into_boxed_str() } // This is currently accepted because the function pointer isn't // considered global. fn global_hr(x: fn(&())) where fn(&()): Foo { // OK x.test(); } fn main() {}
{ "pile_set_name": "Github" }
# spo knowledgehub set Sets the Knowledge Hub Site for your tenant ## Usage ```sh m365 spo knowledgehub set [options] ``` ## Options Option|Description ------|----------- `--help`|output usage information `-u, --url <url>`|URL of the site to set as Knowledge Hub `--query [query]`|JMESPath query string. See [http://jmespath.org/](http://jmespath.org/) for more information and examples `-o, --output [output]`|Output type. `json,text`. Default `text` `--verbose`|Runs command with verbose logging `--debug`|Runs command with debug logging !!! important To use this command you have to have permissions to access the tenant admin site. ## Remarks If the specified url doesn't refer to an existing site collection, you will get a `404 - "404 FILE NOT FOUND"` error. ## Examples Sets the Knowledge Hub Site for your tenant ```sh m365 spo knowledgehub set --url https://contoso.sharepoint.com/sites/knowledgesite ```
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); namespace Shopware\Core\Checkout\Cart\Order; use Shopware\Core\Checkout\Cart\Cart; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\Event\NestedEvent; use Shopware\Core\System\SalesChannel\SalesChannelContext; class CartConvertedEvent extends NestedEvent { /** * @var SalesChannelContext */ private $salesChannelContext; /** * @var OrderConversionContext */ private $conversionContext; /** * @var Cart */ private $cart; /** * @var array */ private $originalConvertedCart; /** * @var array */ private $convertedCart; public function __construct( Cart $cart, array $convertedCart, SalesChannelContext $salesChannelContext, OrderConversionContext $conversionContext ) { $this->salesChannelContext = $salesChannelContext; $this->conversionContext = $conversionContext; $this->cart = $cart; $this->originalConvertedCart = $convertedCart; $this->convertedCart = $convertedCart; } public function getContext(): Context { return $this->salesChannelContext->getContext(); } public function getCart(): Cart { return $this->cart; } public function getOriginalConvertedCart(): array { return $this->originalConvertedCart; } public function getConvertedCart(): array { return $this->convertedCart; } public function setConvertedCart(array $convertedCart): void { $this->convertedCart = $convertedCart; } public function getSalesChannelContext(): SalesChannelContext { return $this->salesChannelContext; } public function getConversionContext(): OrderConversionContext { return $this->conversionContext; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016§ The Android Open Source Project 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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:color="?attr/colorControlNormal" android:alpha="?android:disabledAlpha"/> <item android:state_checked="true" android:color="?attr/colorControlActivated"/> <item android:color="?attr/colorControlNormal"/> </selector>
{ "pile_set_name": "Github" }
#ifndef crypto_core_ristretto255_H #define crypto_core_ristretto255_H #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #define crypto_core_ristretto255_BYTES 32 SODIUM_EXPORT size_t crypto_core_ristretto255_bytes(void); #define crypto_core_ristretto255_HASHBYTES 64 SODIUM_EXPORT size_t crypto_core_ristretto255_hashbytes(void); #define crypto_core_ristretto255_SCALARBYTES 32 SODIUM_EXPORT size_t crypto_core_ristretto255_scalarbytes(void); #define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64 SODIUM_EXPORT size_t crypto_core_ristretto255_nonreducedscalarbytes(void); SODIUM_EXPORT int crypto_core_ristretto255_is_valid_point(const unsigned char *p) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_add(unsigned char *r, const unsigned char *p, const unsigned char *q) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_sub(unsigned char *r, const unsigned char *p, const unsigned char *q) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_from_hash(unsigned char *p, const unsigned char *r) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_from_string(unsigned char p[crypto_core_ristretto255_BYTES], const char *ctx, const unsigned char *msg, size_t msg_len) __attribute__ ((nonnull(1))); SODIUM_EXPORT int crypto_core_ristretto255_from_string_ro(unsigned char p[crypto_core_ristretto255_BYTES], const char *ctx, const unsigned char *msg, size_t msg_len) __attribute__ ((nonnull(1))); SODIUM_EXPORT void crypto_core_ristretto255_random(unsigned char *p) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_random(unsigned char *r) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_scalar_invert(unsigned char *recip, const unsigned char *s) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_negate(unsigned char *neg, const unsigned char *s) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_complement(unsigned char *comp, const unsigned char *s) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_add(unsigned char *z, const unsigned char *x, const unsigned char *y) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_sub(unsigned char *z, const unsigned char *x, const unsigned char *y) __attribute__ ((nonnull)); SODIUM_EXPORT void crypto_core_ristretto255_scalar_mul(unsigned char *z, const unsigned char *x, const unsigned char *y) __attribute__ ((nonnull)); /* * The interval `s` is sampled from should be at least 317 bits to ensure almost * uniformity of `r` over `L`. */ SODIUM_EXPORT void crypto_core_ristretto255_scalar_reduce(unsigned char *r, const unsigned char *s) __attribute__ ((nonnull)); SODIUM_EXPORT int crypto_core_ristretto255_scalar_is_canonical(const unsigned char *s) __attribute__ ((nonnull)); #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
{ "component": true }
{ "pile_set_name": "Github" }
package io.github.iamyours.wandroid.ui.xxmh.update import androidx.lifecycle.Transformations import io.github.iamyours.wandroid.base.BaseViewModel import io.github.iamyours.wandroid.net.xxmh.XBookApi import io.github.iamyours.wandroid.util.StringUtil class XBookListVM : BaseViewModel() { val xApi = XBookApi.get("http://xxmh106.com/") var day = 0 private val _bookPage = Transformations.switchMap(page) { xApi.updateBookPage(it, day) } val bookPage = Transformations.map(_bookPage) { it.content?.run { if (pageNum == 1) { refreshing.value = false } else { moreLoading.value = false } hasMore.value = hasNextPage } it.content } override fun refresh() { page.value = 1 refreshing.value = true } }
{ "pile_set_name": "Github" }
az: азербайджанский az_AZ: 'азербайджанский (Азербайджан)' az_Cyrl_AZ: 'азербайджанский (кириллица, Азербайджан)' az_Cyrl: 'азербайджанский (кириллица)' az_Latn_AZ: 'азербайджанский (латиница, Азербайджан)' az_Latn: 'азербайджанский (латиница)' ak: акан ak_GH: 'акан (Гана)' sq: албанский sq_AL: 'албанский (Албания)' sq_XK: 'албанский (Косово)' sq_MK: 'албанский (Македония)' am: амхарский am_ET: 'амхарский (Эфиопия)' en: английский en_AU: 'английский (Австралия)' en_AS: 'английский (Американское Самоа)' en_AI: 'английский (Ангилья)' en_AG: 'английский (Антигуа и Барбуда)' en_BS: 'английский (Багамские о-ва)' en_BB: 'английский (Барбадос)' en_BZ: 'английский (Белиз)' en_BE: 'английский (Бельгия)' en_BM: 'английский (Бермудские о-ва)' en_BW: 'английский (Ботсвана)' en_IO: 'английский (Британская территория в Индийском океане)' en_VU: 'английский (Вануату)' en_GB: 'английский (Великобритания)' en_VG: 'английский (Виргинские о-ва (Британские))' en_VI: 'английский (Виргинские о-ва (США))' en_UM: 'английский (Внешние малые о-ва (США))' en_GY: 'английский (Гайана)' en_GM: 'английский (Гамбия)' en_GH: 'английский (Гана)' en_GG: 'английский (Гернси)' en_GI: 'английский (Гибралтар)' en_HK: 'английский (Гонконг (особый район))' en_GD: 'английский (Гренада)' en_GU: 'английский (Гуам)' en_JE: 'английский (Джерси)' en_DG: 'английский (Диего-Гарсия)' en_DM: 'английский (Доминика)' en_ZM: 'английский (Замбия)' en_ZW: 'английский (Зимбабве)' en_IN: 'английский (Индия)' en_IE: 'английский (Ирландия)' en_KY: 'английский (Каймановы о-ва)' en_CM: 'английский (Камерун)' en_CA: 'английский (Канада)' en_KE: 'английский (Кения)' en_KI: 'английский (Кирибати)' en_CC: 'английский (Кокосовые о-ва)' en_LS: 'английский (Лесото)' en_LR: 'английский (Либерия)' en_MU: 'английский (Маврикий)' en_MG: 'английский (Мадагаскар)' en_MO: 'английский (Макао (особый район))' en_MW: 'английский (Малави)' en_MY: 'английский (Малайзия)' en_MT: 'английский (Мальта)' en_MH: 'английский (Маршалловы о-ва)' en_MS: 'английский (Монтсеррат)' en_NA: 'английский (Намибия)' en_NR: 'английский (Науру)' en_NG: 'английский (Нигерия)' en_NU: 'английский (Ниуэ)' en_NZ: 'английский (Новая Зеландия)' en_IM: 'английский (О-в Мэн)' en_NF: 'английский (о-в Норфолк)' en_CX: 'английский (о-в Рождества)' en_SH: 'английский (О-в Св. Елены)' en_CK: 'английский (о-ва Кука)' en_TC: 'английский (О-ва Тёркс и Кайкос)' en_PK: 'английский (Пакистан)' en_PW: 'английский (Палау)' en_PG: 'английский (Папуа – Новая Гвинея)' en_PN: 'английский (Питкэрн)' en_PR: 'английский (Пуэрто-Рико)' en_RW: 'английский (Руанда)' en_WS: 'английский (Самоа)' en_SZ: 'английский (Свазиленд)' en_MP: 'английский (Северные Марианские о-ва)' en_SC: 'английский (Сейшельские о-ва)' en_VC: 'английский (Сент-Винсент и Гренадины)' en_KN: 'английский (Сент-Китс и Невис)' en_LC: 'английский (Сент-Люсия)' en_SG: 'английский (Сингапур)' en_SX: 'английский (Синт-Мартен)' en_US: 'английский (Соединенные Штаты)' en_SB: 'английский (Соломоновы о-ва)' en_SD: 'английский (Судан)' en_SL: 'английский (Сьерра-Леоне)' en_TZ: 'английский (Танзания)' en_TK: 'английский (Токелау)' en_TO: 'английский (Тонга)' en_TT: 'английский (Тринидад и Тобаго)' en_TV: 'английский (Тувалу)' en_UG: 'английский (Уганда)' en_FM: 'английский (Федеративные Штаты Микронезии)' en_FJ: 'английский (Фиджи)' en_PH: 'английский (Филиппины)' en_FK: 'английский (Фолклендские о-ва)' en_ER: 'английский (Эритрея)' en_ZA: 'английский (ЮАР)' en_SS: 'английский (Южный Судан)' en_JM: 'английский (Ямайка)' ar: арабский ar_DZ: 'арабский (Алжир)' ar_BH: 'арабский (Бахрейн)' ar_DJ: 'арабский (Джибути)' ar_EG: 'арабский (Египет)' ar_EH: 'арабский (Западная Сахара)' ar_IL: 'арабский (Израиль)' ar_JO: 'арабский (Иордания)' ar_IQ: 'арабский (Ирак)' ar_YE: 'арабский (Йемен)' ar_QA: 'арабский (Катар)' ar_KM: 'арабский (Коморские о-ва)' ar_KW: 'арабский (Кувейт)' ar_LB: 'арабский (Ливан)' ar_LY: 'арабский (Ливия)' ar_MR: 'арабский (Мавритания)' ar_MA: 'арабский (Марокко)' ar_AE: 'арабский (ОАЭ)' ar_OM: 'арабский (Оман)' ar_PS: 'арабский (Палестинские территории)' ar_SA: 'арабский (Саудовская Аравия)' ar_SY: 'арабский (Сирия)' ar_SO: 'арабский (Сомали)' ar_SD: 'арабский (Судан)' ar_TN: 'арабский (Тунис)' ar_TD: 'арабский (Чад)' ar_ER: 'арабский (Эритрея)' ar_SS: 'арабский (Южный Судан)' hy: армянский hy_AM: 'армянский (Армения)' as: ассамский as_IN: 'ассамский (Индия)' af: африкаанс af_NA: 'африкаанс (Намибия)' af_ZA: 'африкаанс (ЮАР)' bm: бамбарийский bm_Latn_ML: 'бамбарийский (латиница, Мали)' bm_Latn: 'бамбарийский (латиница)' eu: баскский eu_ES: 'баскский (Испания)' be: белорусский be_BY: 'белорусский (Беларусь)' bn: бенгальский bn_BD: 'бенгальский (Бангладеш)' bn_IN: 'бенгальский (Индия)' my: бирманский my_MM: 'бирманский (Мьянма (Бирма))' bg: болгарский bg_BG: 'болгарский (Болгария)' bs: боснийский bs_BA: 'боснийский (Босния и Герцеговина)' bs_Cyrl_BA: 'боснийский (кириллица, Босния и Герцеговина)' bs_Cyrl: 'боснийский (кириллица)' bs_Latn_BA: 'боснийский (латиница, Босния и Герцеговина)' bs_Latn: 'боснийский (латиница)' br: бретонский br_FR: 'бретонский (Франция)' cy: валлийский cy_GB: 'валлийский (Великобритания)' hu: венгерский hu_HU: 'венгерский (Венгрия)' vi: вьетнамский vi_VN: 'вьетнамский (Вьетнам)' gl: галисийский gl_ES: 'галисийский (Испания)' lg: ганда lg_UG: 'ганда (Уганда)' nl: голландский nl_AW: 'голландский (Аруба)' nl_BE: 'голландский (Бельгия)' nl_BQ: 'голландский (Бонэйр, Синт-Эстатиус и Саба)' nl_CW: 'голландский (Кюрасао)' nl_NL: 'голландский (Нидерланды)' nl_SX: 'голландский (Синт-Мартен)' nl_SR: 'голландский (Суринам)' kl: гренландский kl_GL: 'гренландский (Гренландия)' el: греческий el_GR: 'греческий (Греция)' el_CY: 'греческий (Кипр)' ka: грузинский ka_GE: 'грузинский (Грузия)' gu: гуджарати gu_IN: 'гуджарати (Индия)' gd: гэльский gd_GB: 'гэльский (Великобритания)' da: датский da_GL: 'датский (Гренландия)' da_DK: 'датский (Дания)' dz: дзонг-кэ dz_BT: 'дзонг-кэ (Бутан)' fy: западно-фризский fy_NL: 'западно-фризский (Нидерланды)' zu: зулу zu_ZA: 'зулу (ЮАР)' he: иврит he_IL: 'иврит (Израиль)' ig: игбо ig_NG: 'игбо (Нигерия)' yi: идиш id: индонезийский id_ID: 'индонезийский (Индонезия)' ga: ирландский ga_IE: 'ирландский (Ирландия)' is: исландский is_IS: 'исландский (Исландия)' es: испанский es_AR: 'испанский (Аргентина)' es_BO: 'испанский (Боливия)' es_VE: 'испанский (Венесуэла)' es_GT: 'испанский (Гватемала)' es_HN: 'испанский (Гондурас)' es_DO: 'испанский (Доминиканская Республика)' es_ES: 'испанский (Испания)' es_IC: 'испанский (Канарские о-ва)' es_CO: 'испанский (Колумбия)' es_CR: 'испанский (Коста-Рика)' es_CU: 'испанский (Куба)' es_MX: 'испанский (Мексика)' es_NI: 'испанский (Никарагуа)' es_PA: 'испанский (Панама)' es_PY: 'испанский (Парагвай)' es_PE: 'испанский (Перу)' es_PR: 'испанский (Пуэрто-Рико)' es_SV: 'испанский (Сальвадор)' es_EA: 'испанский (Сеута и Мелилья)' es_US: 'испанский (Соединенные Штаты)' es_UY: 'испанский (Уругвай)' es_PH: 'испанский (Филиппины)' es_CL: 'испанский (Чили)' es_EC: 'испанский (Эквадор)' es_GQ: 'испанский (Экваториальная Гвинея)' it: итальянский it_IT: 'итальянский (Италия)' it_SM: 'итальянский (Сан-Марино)' it_CH: 'итальянский (Швейцария)' yo: йоруба yo_BJ: 'йоруба (Бенин)' yo_NG: 'йоруба (Нигерия)' kk: казахский kk_KZ: 'казахский (Казахстан)' kk_Cyrl_KZ: 'казахский (кириллица, Казахстан)' kk_Cyrl: 'казахский (кириллица)' kn: каннада kn_IN: 'каннада (Индия)' ca: каталанский ca_AD: 'каталанский (Андорра)' ca_ES: 'каталанский (Испания)' ca_IT: 'каталанский (Италия)' ca_FR: 'каталанский (Франция)' ks: кашмири ks_Arab_IN: 'кашмири (арабица, Индия)' ks_Arab: 'кашмири (арабица)' ks_IN: 'кашмири (Индия)' qu: кечуа qu_BO: 'кечуа (Боливия)' qu_PE: 'кечуа (Перу)' qu_EC: 'кечуа (Эквадор)' ki: кикуйю ki_KE: 'кикуйю (Кения)' rw: киньяруанда rw_RW: 'киньяруанда (Руанда)' ky: киргизский ky_KG: 'киргизский (Киргизия)' ky_Cyrl_KG: 'киргизский (кириллица, Киргизия)' ky_Cyrl: 'киргизский (кириллица)' zh: китайский zh_HK: 'китайский (Гонконг (особый район))' zh_CN: 'китайский (Китай)' zh_MO: 'китайский (Макао (особый район))' zh_SG: 'китайский (Сингапур)' zh_TW: 'китайский (Тайвань)' zh_Hant_HK: 'китайский (традиционная китайская, Гонконг (особый район))' zh_Hant_MO: 'китайский (традиционная китайская, Макао (особый район))' zh_Hant_TW: 'китайский (традиционная китайская, Тайвань)' zh_Hant: 'китайский (традиционная китайская)' zh_Hans_HK: 'китайский (упрощенная китайская, Гонконг (особый район))' zh_Hans_CN: 'китайский (упрощенная китайская, Китай)' zh_Hans_MO: 'китайский (упрощенная китайская, Макао (особый район))' zh_Hans_SG: 'китайский (упрощенная китайская, Сингапур)' zh_Hans: 'китайский (упрощенная китайская)' ko: корейский ko_KP: 'корейский (КНДР)' ko_KR: 'корейский (Республика Корея)' kw: корнийский kw_GB: 'корнийский (Великобритания)' km: кхмерский km_KH: 'кхмерский (Камбоджа)' lo: лаосский lo_LA: 'лаосский (Лаос)' lv: латышский lv_LV: 'латышский (Латвия)' ln: лингала ln_AO: 'лингала (Ангола)' ln_CG: 'лингала (Конго - Браззавиль)' ln_CD: 'лингала (Конго - Киншаса)' ln_CF: 'лингала (ЦАР)' lt: литовский lt_LT: 'литовский (Литва)' lu: луба-катанга lu_CD: 'луба-катанга (Конго - Киншаса)' lb: люксембургский lb_LU: 'люксембургский (Люксембург)' mk: македонский mk_MK: 'македонский (Македония)' mg: малагасийский mg_MG: 'малагасийский (Мадагаскар)' ms: малайский ms_BN: 'малайский (Бруней-Даруссалам)' ms_Latn_BN: 'малайский (латиница, Бруней-Даруссалам)' ms_Latn_MY: 'малайский (латиница, Малайзия)' ms_Latn_SG: 'малайский (латиница, Сингапур)' ms_Latn: 'малайский (латиница)' ms_MY: 'малайский (Малайзия)' ms_SG: 'малайский (Сингапур)' ml: малаялам ml_IN: 'малаялам (Индия)' mt: мальтийский mt_MT: 'мальтийский (Мальта)' mr: маратхи mr_IN: 'маратхи (Индия)' mn: монгольский mn_Cyrl_MN: 'монгольский (кириллица, Монголия)' mn_Cyrl: 'монгольский (кириллица)' mn_MN: 'монгольский (Монголия)' gv: мэнский gv_IM: 'мэнский (О-в Мэн)' de: немецкий de_AT: 'немецкий (Австрия)' de_BE: 'немецкий (Бельгия)' de_DE: 'немецкий (Германия)' de_LI: 'немецкий (Лихтенштейн)' de_LU: 'немецкий (Люксембург)' de_CH: 'немецкий (Швейцария)' ne: непальский ne_IN: 'непальский (Индия)' ne_NP: 'непальский (Непал)' 'no': норвежский no_NO: 'норвежский (Норвегия)' nb: 'норвежский букмол' nb_NO: 'норвежский букмол (Норвегия)' nb_SJ: 'норвежский букмол (Шпицберген и Ян-Майен)' nn: 'норвежский нюнорск' nn_NO: 'норвежский нюнорск (Норвегия)' or: ория or_IN: 'ория (Индия)' om: оромо om_KE: 'оромо (Кения)' om_ET: 'оромо (Эфиопия)' os: осетинский os_GE: 'осетинский (Грузия)' os_RU: 'осетинский (Россия)' pa: панджаби pa_Arab_PK: 'панджаби (арабица, Пакистан)' pa_Arab: 'панджаби (арабица)' pa_Guru_IN: 'панджаби (гурмукхи, Индия)' pa_Guru: 'панджаби (гурмукхи)' pa_IN: 'панджаби (Индия)' pa_PK: 'панджаби (Пакистан)' fa: персидский fa_AF: 'персидский (Афганистан)' fa_IR: 'персидский (Иран)' pl: польский pl_PL: 'польский (Польша)' pt: португальский pt_AO: 'португальский (Ангола)' pt_BR: 'португальский (Бразилия)' pt_TL: 'португальский (Восточный Тимор)' pt_GW: 'португальский (Гвинея-Бисау)' pt_CV: 'португальский (Кабо-Верде)' pt_MO: 'португальский (Макао (особый район))' pt_MZ: 'португальский (Мозамбик)' pt_PT: 'португальский (Португалия)' pt_ST: 'португальский (Сан-Томе и Принсипи)' ps: пушту ps_AF: 'пушту (Афганистан)' rm: романшский rm_CH: 'романшский (Швейцария)' ro: румынский ro_MD: 'румынский (Молдова)' ro_RO: 'румынский (Румыния)' rn: рунди rn_BI: 'рунди (Бурунди)' ru: русский ru_BY: 'русский (Беларусь)' ru_KZ: 'русский (Казахстан)' ru_KG: 'русский (Киргизия)' ru_MD: 'русский (Молдова)' ru_RU: 'русский (Россия)' ru_UA: 'русский (Украина)' sg: санго sg_CF: 'санго (ЦАР)' se: северносаамский se_NO: 'северносаамский (Норвегия)' se_FI: 'северносаамский (Финляндия)' se_SE: 'северносаамский (Швеция)' nd: 'северный ндебели' nd_ZW: 'северный ндебели (Зимбабве)' sr: сербский sr_BA: 'сербский (Босния и Герцеговина)' sr_Cyrl_BA: 'сербский (кириллица, Босния и Герцеговина)' sr_Cyrl_XK: 'сербский (кириллица, Косово)' sr_Cyrl_RS: 'сербский (кириллица, Сербия)' sr_Cyrl_ME: 'сербский (кириллица, Черногория)' sr_Cyrl: 'сербский (кириллица)' sr_XK: 'сербский (Косово)' sr_Latn_BA: 'сербский (латиница, Босния и Герцеговина)' sr_Latn_XK: 'сербский (латиница, Косово)' sr_Latn_RS: 'сербский (латиница, Сербия)' sr_Latn_ME: 'сербский (латиница, Черногория)' sr_Latn: 'сербский (латиница)' sr_RS: 'сербский (Сербия)' sr_ME: 'сербский (Черногория)' sh: сербскохорватский sh_BA: 'сербскохорватский (Босния и Герцеговина)' si: сингальский si_LK: 'сингальский (Шри-Ланка)' sk: словацкий sk_SK: 'словацкий (Словакия)' sl: словенский sl_SI: 'словенский (Словения)' so: сомали so_DJ: 'сомали (Джибути)' so_KE: 'сомали (Кения)' so_SO: 'сомали (Сомали)' so_ET: 'сомали (Эфиопия)' sw: суахили sw_KE: 'суахили (Кения)' sw_TZ: 'суахили (Танзания)' sw_UG: 'суахили (Уганда)' ii: сычуань ii_CN: 'сычуань (Китай)' tl: тагалог tl_PH: 'тагалог (Филиппины)' th: тайский th_TH: 'тайский (Таиланд)' ta: тамильский ta_IN: 'тамильский (Индия)' ta_MY: 'тамильский (Малайзия)' ta_SG: 'тамильский (Сингапур)' ta_LK: 'тамильский (Шри-Ланка)' te: телугу te_IN: 'телугу (Индия)' bo: тибетский bo_IN: 'тибетский (Индия)' bo_CN: 'тибетский (Китай)' ti: тигринья ti_ER: 'тигринья (Эритрея)' ti_ET: 'тигринья (Эфиопия)' to: тонганский to_TO: 'тонганский (Тонга)' tr: турецкий tr_CY: 'турецкий (Кипр)' tr_TR: 'турецкий (Турция)' uz: узбекский uz_Arab_AF: 'узбекский (арабица, Афганистан)' uz_Arab: 'узбекский (арабица)' uz_AF: 'узбекский (Афганистан)' uz_Cyrl_UZ: 'узбекский (кириллица, Узбекистан)' uz_Cyrl: 'узбекский (кириллица)' uz_Latn_UZ: 'узбекский (латиница, Узбекистан)' uz_Latn: 'узбекский (латиница)' uz_UZ: 'узбекский (Узбекистан)' ug: уйгурский ug_Arab_CN: 'уйгурский (арабица, Китай)' ug_Arab: 'уйгурский (арабица)' ug_CN: 'уйгурский (Китай)' uk: украинский uk_UA: 'украинский (Украина)' ur: урду ur_IN: 'урду (Индия)' ur_PK: 'урду (Пакистан)' fo: фарерский fo_FO: 'фарерский (Фарерские о-ва)' fi: финский fi_FI: 'финский (Финляндия)' fr: французский fr_DZ: 'французский (Алжир)' fr_BE: 'французский (Бельгия)' fr_BJ: 'французский (Бенин)' fr_BF: 'французский (Буркина-Фасо)' fr_BI: 'французский (Бурунди)' fr_VU: 'французский (Вануату)' fr_GA: 'французский (Габон)' fr_HT: 'французский (Гаити)' fr_GP: 'французский (Гваделупа)' fr_GN: 'французский (Гвинея)' fr_DJ: 'французский (Джибути)' fr_CM: 'французский (Камерун)' fr_CA: 'французский (Канада)' fr_KM: 'французский (Коморские о-ва)' fr_CG: 'французский (Конго - Браззавиль)' fr_CD: 'французский (Конго - Киншаса)' fr_CI: 'французский (Кот-д’Ивуар)' fr_LU: 'французский (Люксембург)' fr_MU: 'французский (Маврикий)' fr_MR: 'французский (Мавритания)' fr_MG: 'французский (Мадагаскар)' fr_YT: 'французский (Майотта)' fr_ML: 'французский (Мали)' fr_MA: 'французский (Марокко)' fr_MQ: 'французский (Мартиника)' fr_MC: 'французский (Монако)' fr_NE: 'французский (Нигер)' fr_NC: 'французский (Новая Каледония)' fr_RE: 'французский (Реюньон)' fr_RW: 'французский (Руанда)' fr_SC: 'французский (Сейшельские о-ва)' fr_BL: 'французский (Сен-Бартельми)' fr_MF: 'французский (Сен-Мартен)' fr_PM: 'французский (Сен-Пьер и Микелон)' fr_SN: 'французский (Сенегал)' fr_SY: 'французский (Сирия)' fr_TG: 'французский (Того)' fr_TN: 'французский (Тунис)' fr_WF: 'французский (Уоллис и Футуна)' fr_FR: 'французский (Франция)' fr_GF: 'французский (Французская Гвиана)' fr_PF: 'французский (Французская Полинезия)' fr_CF: 'французский (ЦАР)' fr_TD: 'французский (Чад)' fr_CH: 'французский (Швейцария)' fr_GQ: 'французский (Экваториальная Гвинея)' ff: фулах ff_GN: 'фулах (Гвинея)' ff_CM: 'фулах (Камерун)' ff_MR: 'фулах (Мавритания)' ff_SN: 'фулах (Сенегал)' ha: хауса ha_GH: 'хауса (Гана)' ha_Latn_GH: 'хауса (латиница, Гана)' ha_Latn_NE: 'хауса (латиница, Нигер)' ha_Latn_NG: 'хауса (латиница, Нигерия)' ha_Latn: 'хауса (латиница)' ha_NE: 'хауса (Нигер)' ha_NG: 'хауса (Нигерия)' hi: хинди hi_IN: 'хинди (Индия)' hr: хорватский hr_BA: 'хорватский (Босния и Герцеговина)' hr_HR: 'хорватский (Хорватия)' cs: чешский cs_CZ: 'чешский (Чехия)' sv: шведский sv_AX: 'шведский (Аландские о-ва)' sv_FI: 'шведский (Финляндия)' sv_SE: 'шведский (Швеция)' sn: шона sn_ZW: 'шона (Зимбабве)' ee: эве ee_GH: 'эве (Гана)' ee_TG: 'эве (Того)' eo: эсперанто et: эстонский et_EE: 'эстонский (Эстония)' ja: японский ja_JP: 'японский (Япония)'
{ "pile_set_name": "Github" }
/* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if !SDL_RENDER_DISABLED #include "SDL_draw.h" #include "SDL_drawpoint.h" int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color) { if (!dst) { return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { return SDL_SetError("SDL_DrawPoint(): Unsupported surface format"); } /* Perform clipping */ if (x < dst->clip_rect.x || y < dst->clip_rect.y || x >= (dst->clip_rect.x + dst->clip_rect.w) || y >= (dst->clip_rect.y + dst->clip_rect.h)) { return 0; } switch (dst->format->BytesPerPixel) { case 1: DRAW_FASTSETPIXELXY1(x, y); break; case 2: DRAW_FASTSETPIXELXY2(x, y); break; case 3: return SDL_Unsupported(); case 4: DRAW_FASTSETPIXELXY4(x, y); break; } return 0; } int SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color) { int minx, miny; int maxx, maxy; int i; int x, y; if (!dst) { return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { return SDL_SetError("SDL_DrawPoints(): Unsupported surface format"); } minx = dst->clip_rect.x; maxx = dst->clip_rect.x + dst->clip_rect.w - 1; miny = dst->clip_rect.y; maxy = dst->clip_rect.y + dst->clip_rect.h - 1; for (i = 0; i < count; ++i) { x = points[i].x; y = points[i].y; if (x < minx || x > maxx || y < miny || y > maxy) { continue; } switch (dst->format->BytesPerPixel) { case 1: DRAW_FASTSETPIXELXY1(x, y); break; case 2: DRAW_FASTSETPIXELXY2(x, y); break; case 3: return SDL_Unsupported(); case 4: DRAW_FASTSETPIXELXY4(x, y); break; } } return 0; } #endif /* !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */
{ "pile_set_name": "Github" }
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); var _rest = require('./internal/rest'); var _rest2 = _interopRequireDefault(_rest); var _reduce = require('./reduce'); var _reduce2 = _interopRequireDefault(_reduce); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Version of the compose function that is more natural to read. Each function * consumes the return value of the previous function. It is the equivalent of * [compose]{@link module:ControlFlow.compose} with the arguments reversed. * * Each function is executed with the `this` binding of the composed function. * * @name seq * @static * @memberOf module:ControlFlow * @method * @see [async.compose]{@link module:ControlFlow.compose} * @category Control Flow * @param {...Function} functions - the asynchronous functions to compose * @returns {Function} a function that composes the `functions` in order * @example * * // Requires lodash (or underscore), express3 and dresende's orm2. * // Part of an app, that fetches cats of the logged user. * // This example uses `seq` function to avoid overnesting and error * // handling clutter. * app.get('/cats', function(request, response) { * var User = request.models.User; * async.seq( * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) * function(user, fn) { * user.getCats(fn); // 'getCats' has signature (callback(err, data)) * } * )(req.session.user_id, function (err, cats) { * if (err) { * console.error(err); * response.json({ status: 'error', message: err.message }); * } else { * response.json({ status: 'ok', message: 'Cats found', data: cats }); * } * }); * }); */ exports.default = (0, _rest2.default)(function seq(functions) { return (0, _rest2.default)(function (args) { var that = this; var cb = args[args.length - 1]; if (typeof cb == 'function') { args.pop(); } else { cb = _noop2.default; } (0, _reduce2.default)(functions, args, function (newargs, fn, cb) { fn.apply(that, newargs.concat([(0, _rest2.default)(function (err, nextargs) { cb(err, nextargs); })])); }, function (err, results) { cb.apply(that, [err].concat(results)); }); }); }); module.exports = exports['default'];
{ "pile_set_name": "Github" }
sarama ====== Sarama is an MIT-licensed Go client library for Apache Kafka 0.8 (and later). Documentation is available via godoc at http://godoc.org/github.com/Shopify/sarama It is compatible with Go 1.1 and 1.2 (which means `go vet` on 1.2 may return some suggestions that we are ignoring for the sake of compatibility with 1.1). A word of warning: the API is not 100% stable yet. It won't change much (in particular the low-level Broker and Request/Response objects could *probably* be considered frozen) but there may be the occasional parameter added or function renamed. As far as semantic versioning is concerned, we haven't quite hit 1.0.0 yet. It is absolutely stable enough to use, just expect that you might have to tweak things when you update to a newer version. Other related links: * https://kafka.apache.org/ * https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
{ "pile_set_name": "Github" }
// // YYTextArchiver.m // YYKit <https://github.com/ibireme/YYKit> // // Created by ibireme on 15/3/16. // Copyright (c) 2015 ibireme. // // This source code is licensed under the MIT-style license found in the // LICENSE file in the root directory of this source tree. // #import "YYTextArchiver.h" #import "YYTextRunDelegate.h" #import "YYTextRubyAnnotation.h" #import "UIDevice+YYAdd.h" /** When call CTRunDelegateGetTypeID() on some devices (runs iOS6), I got the error: "dyld: lazy symbol binding failed: Symbol not found: _CTRunDelegateGetTypeID" Here's a workaround for this issue. */ static CFTypeID CTRunDelegateTypeID() { static CFTypeID typeID; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ /* if ((long)CTRunDelegateGetTypeID + 1 > 1) { //avoid compiler optimization typeID = CTRunDelegateGetTypeID(); } */ YYTextRunDelegate *delegate = [YYTextRunDelegate new]; CTRunDelegateRef ref = delegate.CTRunDelegate; typeID = CFGetTypeID(ref); CFRelease(ref); }); return typeID; } static CFTypeID CTRubyAnnotationTypeID() { static CFTypeID typeID; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ if ((long)CTRubyAnnotationGetTypeID + 1 > 1) { //avoid compiler optimization typeID = CTRunDelegateGetTypeID(); } else { typeID = kCFNotFound; } }); return typeID; } /** A wrapper for CGColorRef. Used for Archive/Unarchive/Copy. */ @interface _YYCGColor : NSObject <NSCopying, NSCoding> @property (nonatomic, assign) CGColorRef CGColor; + (instancetype)colorWithCGColor:(CGColorRef)CGColor; @end @implementation _YYCGColor + (instancetype)colorWithCGColor:(CGColorRef)CGColor { _YYCGColor *color = [self new]; color.CGColor = CGColor; return color; } - (void)setCGColor:(CGColorRef)CGColor { if (_CGColor != CGColor) { if (CGColor) CGColor = (CGColorRef)CFRetain(CGColor); if (_CGColor) CFRelease(_CGColor); _CGColor = CGColor; } } - (void)dealloc { if (_CGColor) CFRelease(_CGColor); _CGColor = NULL; } - (id)copyWithZone:(NSZone *)zone { _YYCGColor *color = [self.class new]; color.CGColor = self.CGColor; return color; } - (void)encodeWithCoder:(NSCoder *)aCoder { UIColor *color = [UIColor colorWithCGColor:_CGColor]; [aCoder encodeObject:color forKey:@"color"]; } - (id)initWithCoder:(NSCoder *)aDecoder { self = [self init]; UIColor *color = [aDecoder decodeObjectForKey:@"color"]; self.CGColor = color.CGColor; return self; } @end /** A wrapper for CGImageRef. Used for Archive/Unarchive/Copy. */ @interface _YYCGImage : NSObject <NSCoding, NSCopying> @property (nonatomic, assign) CGImageRef CGImage; + (instancetype)imageWithCGImage:(CGImageRef)CGImage; @end @implementation _YYCGImage + (instancetype)imageWithCGImage:(CGImageRef)CGImage { _YYCGImage *image = [self new]; image.CGImage = CGImage; return image; } - (void)setCGImage:(CGImageRef)CGImage { if (_CGImage != CGImage) { if (CGImage) CGImage = (CGImageRef)CFRetain(CGImage); if (_CGImage) CFRelease(_CGImage); _CGImage = CGImage; } } - (void)dealloc { if (_CGImage) CFRelease(_CGImage); } - (id)copyWithZone:(NSZone *)zone { _YYCGImage *image = [self.class new]; image.CGImage = self.CGImage; return image; } - (void)encodeWithCoder:(NSCoder *)aCoder { UIImage *image = [UIImage imageWithCGImage:_CGImage]; [aCoder encodeObject:image forKey:@"image"]; } - (id)initWithCoder:(NSCoder *)aDecoder { self = [self init]; UIImage *image = [aDecoder decodeObjectForKey:@"image"]; self.CGImage = image.CGImage; return self; } @end @implementation YYTextArchiver + (NSData *)archivedDataWithRootObject:(id)rootObject { if (!rootObject) return nil; NSMutableData *data = [NSMutableData data]; YYTextArchiver *archiver = [[[self class] alloc] initForWritingWithMutableData:data]; [archiver encodeRootObject:rootObject]; [archiver finishEncoding]; return data; } + (BOOL)archiveRootObject:(id)rootObject toFile:(NSString *)path { NSData *data = [self archivedDataWithRootObject:rootObject]; if (!data) return NO; return [data writeToFile:path atomically:YES]; } - (instancetype)init { self = [super init]; self.delegate = self; return self; } - (instancetype)initForWritingWithMutableData:(NSMutableData *)data { self = [super initForWritingWithMutableData:data]; self.delegate = self; return self; } - (id)archiver:(NSKeyedArchiver *)archiver willEncodeObject:(id)object { CFTypeID typeID = CFGetTypeID((CFTypeRef)object); if (typeID == CTRunDelegateTypeID()) { CTRunDelegateRef runDelegate = (__bridge CFTypeRef)(object); id ref = CTRunDelegateGetRefCon(runDelegate); if (ref) return ref; } else if (typeID == CTRubyAnnotationTypeID()) { CTRubyAnnotationRef ctRuby = (__bridge CFTypeRef)(object); YYTextRubyAnnotation *ruby = [YYTextRubyAnnotation rubyWithCTRubyRef:ctRuby]; if (ruby) return ruby; } else if (typeID == CGColorGetTypeID()) { return [_YYCGColor colorWithCGColor:(CGColorRef)object]; } else if (typeID == CGImageGetTypeID()) { return [_YYCGImage imageWithCGImage:(CGImageRef)object]; } return object; } @end @implementation YYTextUnarchiver + (id)unarchiveObjectWithData:(NSData *)data { if (data.length == 0) return nil; YYTextUnarchiver *unarchiver = [[self alloc] initForReadingWithData:data]; return [unarchiver decodeObject]; } + (id)unarchiveObjectWithFile:(NSString *)path { NSData *data = [NSData dataWithContentsOfFile:path]; return [self unarchiveObjectWithData:data]; } - (instancetype)init { self = [super init]; self.delegate = self; return self; } - (instancetype)initForReadingWithData:(NSData *)data { self = [super initForReadingWithData:data]; self.delegate = self; return self; } - (id)unarchiver:(NSKeyedUnarchiver *)unarchiver didDecodeObject:(id) NS_RELEASES_ARGUMENT object NS_RETURNS_RETAINED { if ([object class] == [YYTextRunDelegate class]) { YYTextRunDelegate *runDelegate = object; CTRunDelegateRef ct = runDelegate.CTRunDelegate; id ctObj = (__bridge id)ct; if (ct) CFRelease(ct); return ctObj; } else if ([object class] == [YYTextRubyAnnotation class]) { YYTextRubyAnnotation *ruby = object; if (kiOS8Later) { CTRubyAnnotationRef ct = ruby.CTRubyAnnotation; id ctObj = (__bridge id)(ct); if (ct) CFRelease(ct); return ctObj; } else { return object; } } else if ([object class] == [_YYCGColor class]) { _YYCGColor *color = object; return (id)color.CGColor; } else if ([object class] == [_YYCGImage class]) { _YYCGImage *image = object; return (id)image.CGImage; } return object; } @end
{ "pile_set_name": "Github" }
## Gradle插件开发介绍 - [英文文档](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/english.md) #### Gradle基础详解: 这一次一定要系统掌握,你准备好了吗? - [初识Gradle 和 领域专用语言](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/day01.gradle) - [Gradle 版本配置](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/day02.md) - [Gradle 模块配置](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/day03.gradle) - [Gradle 插件分类](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/day04.gradle) - [Gradle Android插件包含的内容](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/android.gradle) - [CompileSdkVersion minSdkVersion targetSdkVersion buildToolsVersion区别](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/sdkVersionType.md) - [Gradle 统一配置你的版本号](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/version.gradle) - [Gradle 分渠道打包](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/productflavor.gradle) - [Gradle 配置你的AndroidManifest](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/configManifest.gradle) - [Gradle 指定你的源码路径、动态去除不需要打包的类·优](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/sourceSet.gradle) - [Gradle 项目依赖配置](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/project_library.md) - [Gradle lintOption·优](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/lintOption.gradle) - [lint报告](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/lint-results-obmDebug.html) - [Gradle 打包优化配置·优](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/optimization.gradle) - [Gradle gradle.properties 配置gradle版本和buildTools版本,和一些不便的版本](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/properties.gradle) - [Gradle 使用variantFilter修改生成apk路径、名字](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/applicationVariant.gradle) - [Gradle 指定java版本](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/set_java_version.gradle) - [Gradle packagingOptions解决重复包和文件](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/packageOption.gradle) - [AndroidStudio常见问题](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/android_studio.xml) - [Gradle 命令打包apk](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/assemble.md) - [Gradle 命令行传递参数](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/assembleWithParams.md) - [Gradle 编译器动态生成java·优](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/operate_file.md) - [Gradle 创建Task](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/task.md) - [Gradle 打包选择不同的AndroidManifest.xml](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/diffManifest.md) - [Gradle 执行顺序](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/exeRank.md) - Gradle 生成测试报告 - [Gradle 生成接口文档](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/genJavadoc.gradle) - [AAR 生成](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/aar.md) - [jar 生成](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/makeJar.md) - [元编程](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/metaprogramming.md) - 查看所有tasks命令 *./gradlew tasks --all* #### Gradle高级插件开发 - [插件开发详细步骤](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/plugin_develop.md) - [Gradle Transform监听文件编译结束](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/gradle_tranform.md) #### Android性能优化 - [apk瘦身优化](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/android_apk_optimization.md) - [界面性能UI](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/ui_optimization.md) - [内存泄露](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/memory_optimization.md) - [WorkManager](https://github.com/UCodeUStory/GradlePlugin/blob/master/source/workmanager.md) ### 问题总结 - 1.找不到依赖库,需要在repositories中添加jcenter() - 2.javassist找不到jar包,就是需要javassist引入jar包 - 3.发现生成的apk没有变化,删除了build目录重新build,仍然无变化,点击Android Studio setting 清理缓存,重新启动 - 4.项目app修改名字报错时提示找不到项目,一般根目录.idea就可以解决 - 5.解决Error:All flavors must now belong to a named flavor dimension. flavorDimensions "versionCode" - 6.Android Studio clean 时产生 Error:Execution failed for task ':app:mockableAndroidJar' > java.lang.NullPointer 解决1. 这个问题由于更改主项目complieSdk版本导致的,只需要将所有子项目的版本更改相同即可; 解决2. 也可以通过在 1. Go to File -> Settings -> Build, Execution, Deployment -> Compiler 2. Add to “Command-line Options”: -x :app:mockableAndroidJar 3. Press “OK” and try to Rebuild Project again. 解决3.File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Experimental 取消 Enable All test..勾选,但是mac版本没找到这个选项 解决4. 在根目录添加 gradle.taskGraph.whenReady { tasks.each { task -> if (task.name.equals('mockableAndroidJar')) { task.enabled = false } } } - 7.当我们修改 compile 'com.android.support:appcompat-v7:25.0.0'版本时,会报很多value 主题找不到等错误 此时我们只需要修改compileSDK版本和这个V7后面版本一致即可 #### 友情链接 [fly803/BaseProject](https://github.com/fly803/BaseProject)
{ "pile_set_name": "Github" }
--- layout: index title: ScopeExitsAll --- ScopeExitsAll () Returns an [objectlist](../../types/objectlist.html) containing all the exits which are available to the player from the current room. **This function was replaced in 5.4 by [ScopeExits](scopeexits.html)**
{ "pile_set_name": "Github" }
obj-y := access.o chip.o core.o handle.o irqdomain.o virq.o obj-$(CONFIG_INTC_BALANCING) += balancing.o obj-$(CONFIG_INTC_USERIMASK) += userimask.o obj-$(CONFIG_INTC_MAPPING_DEBUG) += virq-debugfs.o
{ "pile_set_name": "Github" }
{ "network": [ [ "probeNetwork - default - end", 6, 290116 ], [ "probeNetwork - default - start", 0, 0 ] ], "gfx": [ [ "probeGFX - default - end", 6, 11, 5, 1, [ 1638400, 1638400 ], [ 22, 22 ], [ 64, 64 ] ] ] }
{ "pile_set_name": "Github" }
# # cmake -DCMAKE_BUILD_TYPE=Debug .. # # http://www.cmake.org/Wiki/CMake_FAQ # http://www.cmake.org/Wiki/CMake_Useful_Variables # http://clang.llvm.org/docs/LanguageExtensions.html # # Address Sanitizer: http://clang.llvm.org/docs/AddressSanitizer.html # https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#Getting_AddressSanitizer # cmake_minimum_required(VERSION 2.8) set(BUILD_X64 "" CACHE STRING "whether to perform 64-bit build: ON or OFF overrides default detection") option(CMAKE_VERBOSE "Verbose CMake" FALSE) if (CMAKE_VERBOSE) SET(CMAKE_VERBOSE_MAKEFILE ON) endif() # With clang: http://clang.llvm.org/docs/AddressSanitizer.html # With gcc48: http://indico.cern.ch/getFile.py/access?contribId=1&resId=0&materialId=slides&confId=230762 option(WITH_ASAN "Enable address sanitizer" OFF) # gcc4.8+, clang 3.1+ option(WITH_HARDENING "Enable hardening: Compile-time protection against static sized buffer overflows" OFF) option(USE_TELEMETRY "Build with Telemetry" OFF) # Unless user specifies BUILD_X64 explicitly, assume native target if (BUILD_X64 STREQUAL "") if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(BUILD_X64 "TRUE") else() set(BUILD_X64 "FALSE") endif() endif() # Generate bitness suffix to use, but make sure to include the existing suffix (.exe) # for platforms that need it (ie, Windows) if (BUILD_X64) set(CMAKE_EXECUTABLE_SUFFIX "64${CMAKE_EXECUTABLE_SUFFIX}") set(CMAKE_SHARED_LIBRARY_SUFFIX "64${CMAKE_SHARED_LIBRARY_SUFFIX}") else() set(CMAKE_EXECUTABLE_SUFFIX "32${CMAKE_EXECUTABLE_SUFFIX}") set(CMAKE_SHARED_LIBRARY_SUFFIX "32${CMAKE_SHARED_LIBRARY_SUFFIX}") endif() # Default to release build if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() # Make sure we're using 64-bit versions of stat, fopen, etc. # Large File Support extensions: # http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#Feature-Test-Macros add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) # support for inttypes.h macros add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS) if(MSVC) set(CMAKE_CXX_FLAGS_LIST "/W3 /D_CRT_SECURE_NO_WARNINGS=1 /DWIN32 /D_WIN32") set(CMAKE_CXX_FLAGS_RELEASE_LIST "/O2 /DNDEBUG") set(CMAKE_CXX_FLAGS_DEBUG_LIST "/Od /D_DEBUG") else() set(CMAKE_CXX_FLAGS_LIST "-g -Wall -Wextra") set(CMAKE_CXX_FLAGS_RELEASE_LIST "-g -O2 -DNDEBUG") set(CMAKE_CXX_FLAGS_DEBUG_LIST "-g -O0 -D_DEBUG") endif() if(USE_MALLOC) set(CMAKE_CXX_FLAGS_LIST "-DVOGL_USE_STB_MALLOC=0") endif() set(CLANG_EVERYTHING 0) if (NOT VOGL_BUILDING_SAMPLES) # Samples have tons of shadowing issues. Only add this flag for regular vogl projects. set(CLANG_EVERYTHING 1) endif() set(OPENGL_LIBRARY "GL") if (USE_TELEMETRY) add_definitions("-DUSE_TELEMETRY") endif() if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") # clang doesn't print colored diagnostics when invoked from Ninja if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja") add_definitions ("-fcolor-diagnostics") endif() if (CLANG_EVERYTHING) set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} # "-pedantic" # Warn on language extensions "-Weverything" # Enable all warnings "-fdiagnostics-show-category=name" "-Wno-unused-macros" "-Wno-padded" "-Wno-variadic-macros" "-Wno-missing-variable-declarations" "-Wno-missing-prototypes" "-Wno-sign-conversion" "-Wno-conversion" "-Wno-cast-align" "-Wno-exit-time-destructors" "-Wno-documentation-deprecated-sync" "-Wno-documentation-unknown-command" # TODO: Would be great to start enabling some of these warnings... "-Wno-undefined-reinterpret-cast" "-Wno-incompatible-pointer-types-discards-qualifiers" "-Wno-float-equal" "-Wno-unreachable-code" "-Wno-weak-vtables" "-Wno-extra-semi" "-Wno-disabled-macro-expansion" "-Wno-format-nonliteral" "-Wno-packed" "-Wno-c++11-long-long" "-Wno-c++11-extensions" "-Wno-nested-anon-types" "-Wno-pedantic" "-Wno-header-hygiene" "-Wno-covered-switch-default" "-Wno-duplicate-enum" "-Wno-switch-enum" "-Wno-extra-tokens" # Added because SDL2 headers have a ton of Doxygen warnings currently. "-Wno-documentation" # This needs to be removed after fixing the VOGL_NO_ATOMICS, etc. "-Wno-undef" ) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "-Wno-gnu-anonymous-struct" "-Wno-gnu-zero-variadic-macro-arguments" "-Wno-gnu-redeclared-enum" ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "-Wno-duplicate-enum" ) endif() endif() endif() if ((NOT MSVC) AND (NOT BUILD_X64) AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) set(CMAKE_CXX_FLAGS_LIST "${CMAKE_CXX_FLAGS_LIST} -m32") set(CMAKE_EXE_LINK_FLAGS_LIST "${CMAKE_EXE_LINK_FLAGS_LIST} -m32") set(CMAKE_SHARED_LINK_FLAGS_LIST "${CMAKE_SHARED_LINK_FLAGS_LIST} -m32") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF) set(CMAKE_SYSTEM_LIBRARY_PATH /lib32 /usr/lib32 /usr/lib/i386-linux-gnu /usr/local/lib32) set(CMAKE_IGNORE_PATH /lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib64 /usr/local/lib) endif() function(add_compiler_flag flag) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE) endfunction() function(add_compiler_flag_debug flag) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag}" PARENT_SCOPE) endfunction() function(add_compiler_flag_release flag) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag}" PARENT_SCOPE) endfunction() function(add_linker_flag flag) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}" PARENT_SCOPE) endfunction() function(add_shared_linker_flag flag) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}" PARENT_SCOPE) endfunction() # # To show the include files as you're building, do this: # add_compiler_flag("-H") # For Visual Studio, it's /showIncludes I believe... # # stack-protector-strong: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00974.html ## -fstack-protector-strong # Compile with the option "-fstack-usage" and a file .su will be generated with stack # information for each function. ## -fstack-usage # For more info on -fno-strict-aliasing: "Just Say No to strict aliasing optimizations in C": http://nothings.org/ # The Linux kernel is compiled with -fno-strict-aliasing: https://lkml.org/lkml/2003/2/26/158 or http://www.mail-archive.com/[email protected]/msg01647.html ### TODO: see if sse is generated with these instructions and clang: ## -march=corei7 -msse -mfpmath=sse set(MARCH_STR "-march=corei7") if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") if ( NOT BUILD_X64 ) # Fix startup crash in dlopen_notify_callback (called indirectly from our dlopen() function) when tracing glxspheres on my AMD dev box (x86 release only) # Also fixes tracing Q3 Arena using release tracer # Clang is generating sse2 code even when it shouldn't be: # http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-March/020310.html set(MARCH_STR "-march=i586") endif() endif() if(MSVC) set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "/EHsc" # Need exceptions ) else() set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "-fno-omit-frame-pointer" ${MARCH_STR} # "-msse2 -mfpmath=sse" # To build with SSE instruction sets "-Wno-unused-parameter -Wno-unused-function" "-fno-strict-aliasing" # DO NOT remove this, we have lots of code that will fail in obscure ways otherwise because it was developed with MSVC first. "-fno-math-errno" "-fvisibility=hidden" # "-fno-exceptions" # Exceptions are enabled by default for c++ files, disabled for c files. ) endif() if (CMAKE_COMPILER_IS_GNUCC) execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) # message(STATUS "Detected GCC v ${GCC_MAJOR} . ${GCC_MINOR}") endif() if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8) set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "-Wno-unused-local-typedefs" ) endif() if (MSVC) else() if (WITH_HARDENING) # http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html add_definitions(-D_FORTIFY_SOURCE=2 -fpic) if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") # During program load, several ELF memory sections need to be written to by the # linker, but can be turned read-only before turning over control to the # program. This prevents some GOT (and .dtors) overwrite attacks, but at least # the part of the GOT used by the dynamic linker (.got.plt) is still vulnerable. add_definitions(-pie -z now -z relro) endif() endif() endif() if (WITH_ASAN) # llvm-symbolizer must be on the path. So something like this: # path_prepend /home/mikesart/dev/voglproj/vogl_chroot/vogl_extbuild/i386/clang34_rev1/build/bin set(CMAKE_CXX_FLAGS_LIST "${CMAKE_CXX_FLAGS_LIST} -fsanitize=address -fno-optimize-sibling-calls -DVOGL_USE_STB_MALLOC=0") set(CMAKE_EXE_LINK_FLAGS_LIST "${CMAKE_EXE_LINK_FLAGS_LIST} -fsanitize=address") set(CMAKE_SHARED_LINK_FLAGS_LIST "${CMAKE_SHARED_LINK_FLAGS_LIST} -fsanitize=address") endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_EXE_LINK_FLAGS_LIST "-Wl,--no-undefined") # When linking shared libraries, the AddressSanitizer run-time is not linked, # so -Wl,-z,defs may cause link errors. # http://clang.llvm.org/docs/AddressSanitizer.html if (NOT WITH_ASAN) set(CMAKE_SHARED_LINK_FLAGS_LIST "-Wl,--no-undefined") endif() endif() # Compiler flags string(REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS_LIST}") string(REPLACE ";" " " CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_LIST}") string(REPLACE ";" " " CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_LIST}") string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_LIST}") string(REPLACE ";" " " CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_LIST}") string(REPLACE ";" " " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_LIST}") # Linker flags (exe) string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINK_FLAGS_LIST}") # Linker flags (shared) string(REPLACE ";" " " CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINK_FLAGS_LIST}") # If building from inside chroot project, use vogl_build there. if (EXISTS "${CMAKE_SOURCE_DIR}/../bin/chroot_build.sh") set(RADPROJ_BUILD_DIR ${CMAKE_SOURCE_DIR}/../vogl_build) else() set(RADPROJ_BUILD_DIR ${CMAKE_SOURCE_DIR}/vogl_build) endif() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${RADPROJ_BUILD_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${RADPROJ_BUILD_DIR}) # Telemetry setup function(telemetry_init) if (USE_TELEMETRY) include_directories("${SRC_DIR}/telemetry/include") if (BUILD_X64) find_library(RAD_TELEMETRY_LIBRARY libTelemetryX64.link.a HINTS ${SRC_DIR}/telemetry/lib) find_library(RAD_TELEMETRY_SO libTelemetryX64.so HINTS ${SRC_DIR}/telemetry/redist) else() find_library(RAD_TELEMETRY_LIBRARY libTelemetryX86.link.a HINTS ${SRC_DIR}/telemetry/lib) find_library(RAD_TELEMETRY_SO libTelemetryX86.so HINTS ${SRC_DIR}/telemetry/redist) endif() endif() endfunction() if (USE_TELEMETRY) set(TELEMETRY_LIBRARY telemetry) else() set(TELEMETRY_LIBRARY ) endif() function(build_options_finalize) if (CMAKE_VERBOSE) message(" CMAKE_PROJECT_NAME: ${CMAKE_PROJECT_NAME}") message(" PROJECT_NAME: ${PROJECT_NAME}") message(" BUILD_X64: ${BUILD_X64}") message(" BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message(" PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}") message(" CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") message(" PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") message(" CMAKE_CURRENT_LIST_FILE: ${CMAKE_CURRENT_LIST_FILE}") message(" CXX_FLAGS: ${CMAKE_CXX_FLAGS}") message(" CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}") message(" CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}") message(" EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") message(" SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}") message(" SHARED_LIBRARY_C_FLAGS: ${CMAKE_SHARED_LIBRARY_C_FLAGS}") message(" SHARED_LIBRARY_CXX_FLAGS: ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") message(" SHARED_LIBRARY_LINK_CXX_FLAGS: ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") message(" SHARED_LIBRARY_LINK_C_FLAGS: ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}") message(" CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") message(" CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message(" CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}") message(" CMAKE_EXECUTABLE_SUFFIX: ${CMAKE_EXECUTABLE_SUFFIX}") message("") endif() endfunction() function(require_pthreads) find_package(Threads) if (NOT CMAKE_USE_PTHREADS_INIT AND NOT WIN32_PTHREADS_INCLUDE_PATH) message(FATAL_ERROR "pthread not found") endif() if (MSVC) include_directories("${WIN32_PTHREADS_INCLUDE_PATH}") if (BUILD_X64) set(PTHREAD_SRC_LIB "${WIN32_PTHREADS_PATH}/lib/x64/pthreadVC2.lib" PARENT_SCOPE) set(PTHREAD_SRC_DLL "${WIN32_PTHREADS_PATH}/dll/x64/pthreadVC2.dll" PARENT_SCOPE) else() set(PTHREAD_SRC_LIB "${WIN32_PTHREADS_PATH}/lib/x86/pthreadVC2.lib" PARENT_SCOPE) set(PTHREAD_SRC_DLL "${WIN32_PTHREADS_PATH}/dll/x86/pthreadVC2.dll" PARENT_SCOPE) endif() else() # Export the variable to the parent scope so the linker knows where to find the library. set(CMAKE_THREAD_LIBS_INIT ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE) endif() endfunction() function(require_libjpegturbo) find_library(LibJpegTurbo_LIBRARY NAMES libturbojpeg.so libturbojpeg.so.0 libturbojpeg.dylib PATHS /opt/libjpeg-turbo/lib ) # On platforms that find this, the include files will have also been installed to the system # so we don't need extra include dirs. if (LibJpegTurbo_LIBRARY) set(LibJpegTurbo_INCLUDE "" PARENT_SCOPE) # On Darwin we assume a Homebrew install elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(LibJpegTurbo_INCLUDE "/usr/local/opt/jpeg-turbo/include" PARENT_SCOPE) set(LibJpegTurbo_LIBRARY "/usr/local/opt/jpeg-turbo/lib/libturbojpeg.a" PARENT_SCOPE) else() if (BUILD_X64) set(BITS_STRING "x64") else() set(BITS_STRING "x86") endif() set(LibJpegTurbo_INCLUDE "${CMAKE_PREFIX_PATH}/libjpeg-turbo-2.1.3/include" PARENT_SCOPE) set(LibJpegTurbo_LIBRARY "${CMAKE_PREFIX_PATH}/libjpeg-turbo-2.1.3/lib_${BITS_STRING}/turbojpeg.lib" PARENT_SCOPE) endif() endfunction() function(require_sdl2) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(FindPkgConfig) pkg_search_module(PC_SDL2 REQUIRED sdl2) find_path(SDL2_INCLUDE SDL.h DOC "SDL2 Include Path" HINTS ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS} ) find_library(SDL2_LIBRARY SDL2 DOC "SDL2 Library" HINTS ${PC_SDL2_LIBDIR} ${PC_SDL2_LIBRARY_DIRS} ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(FindPkgConfig) pkg_search_module(PC_SDL2 REQUIRED sdl2) find_path(SDL2_INCLUDE SDL.h DOC "SDL2 Include Path" HINTS ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS} ) find_library(SDL2_LIBRARY SDL2 DOC "SDL2 Library" HINTS ${PC_SDL2_LIBDIR} ${PC_SDL2_LIBRARY_DIRS} ) elseif (MSVC) set(SDL2Root "${CMAKE_EXTERNAL_PATH}/SDL") set(SDL2_INCLUDE "${SDL2Root}/include" CACHE PATH "SDL2 Include Path") set(SDL2_LIBRARY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/SDL2.lib" CACHE FILEPATH "SDL2 Library") # Only want to include this once. # This has to go into properties because it needs to persist across the entire cmake run. get_property(SDL_PROJECT_ALREADY_INCLUDED GLOBAL PROPERTY SDL_PROJECT_INCLUDED ) if (NOT SDL_PROJECT_ALREADY_INCLUDED) INCLUDE_EXTERNAL_MSPROJECT(SDL "${SDL2Root}/VisualC/SDL/SDL_VS2013.vcxproj") set_property(GLOBAL PROPERTY SDL_PROJECT_INCLUDED "TRUE" ) message("Including SDL_VS2013.vcxproj for you!") endif() else() message(FATAL_ERROR "Need to deal with SDL on non-Windows platforms") endif() endfunction() function(require_m) if (MSVC) set(M_LIBRARY "winmm.lib" PARENT_SCOPE) else() set(M_LIBRARY "m" PARENT_SCOPE) endif() endfunction() function(require_gl) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(FindPkgConfig) pkg_search_module(PC_GL QUIET gl) find_path(GL_INCLUDE GL/gl.h DOC "OpenGL Include Path" HINTS ${PC_GL_INCLUDEDIR} ${PC_GL_INCLUDE_DIRS} ) find_library(GL_LIBRARY GL DOC "OpenGL Library" HINTS ${PC_GL_LIBDIR} ${PC_GL_LIBRARY_DIRS} ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(GL_INCLUDE "" CACHE PATH "OpenGL Include Path") set(GL_LIBRARY "-framework OpenGL" CACHE FILEPATH "OpenGL Library") elseif (MSVC) set(GL_INCLUDE "" CACHE PATH "OpenGL Include Path") set(GL_LIBRARY "opengl32.lib" CACHE FILEPATH "OpenGL Library") else() set(GL_INCLUDE "" CACHE PATH "OpenGL Include Path") set(GL_LIBRARY "GL" CACHE FILEPATH "OpenGL Library") endif() endfunction() function(require_glu) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(FindPkgConfig) pkg_search_module(PC_GLU QUIET glu) find_path(GLU_INCLUDE GL/glu.h DOC "GLU Include Path" HINTS ${PC_GLU_INCLUDEDIR} ${PC_GLU_INCLUDE_DIRS} ) find_library(GLU_LIBRARY GLU DOC "GLU Library" HINTS ${PC_GLU_LIBDIR} ${PC_GLU_LIBRARY_DIRS} ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(GLU_INCLUDE "" CACHE PATH "GLU Include Path") set(GLU_LIBRARY "-framework GLUT" CACHE FILEPATH "GLU Library") elseif (MSVC) set(GLU_INCLUDE "" CACHE PATH "GLU Include Path") set(GLU_LIBRARY "glu32.lib" CACHE FILEPATH "GLU Library") else() set(GLU_INCLUDE "" CACHE PATH "GLU Include Path") set(GLU_LIBRARY "GLU" CACHE FILEPATH "GLU Library") endif() endfunction() function(request_backtrace) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set( LibBackTrace_INCLUDE "${SRC_DIR}/libbacktrace" PARENT_SCOPE ) set( LibBackTrace_LIBRARY "backtracevogl" PARENT_SCOPE ) else() set( LibBackTrace_INCLUDE "" PARENT_SCOPE ) set( LibBackTrace_LIBRARY "" PARENT_SCOPE ) endif() endfunction() function(require_app) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") find_package(X11 REQUIRED) set(APP_LIBRARY ${X11_X11_LIB} PARENT_SCOPE) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(APP_LIBRARY "" PARENT_SCOPE) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(APP_LIBRARY "" PARENT_SCOPE) else() set(APP_LIBRARY "" PARENT_SCOPE) endif() endfunction() # What compiler toolchain are we building on? if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") add_compiler_flag("-DCOMPILER_GCC=1") add_compiler_flag("-DCOMPILER_GCCLIKE=1") elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "mingw") add_compiler_flag("-DCOMPILER_MINGW=1") add_compiler_flag("-DCOMPILER_GCCLIKE=1") elseif (MSVC) add_compiler_flag("-DCOMPILER_MSVC=1") elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") add_compiler_flag("-DCOMPILER_CLANG=1") add_compiler_flag("-DCOMPILER_GCCLIKE=1") else() message("Compiler is ${CMAKE_C_COMPILER_ID}") message(FATAL_ERROR "Compiler unset, build will fail--stopping at CMake time.") endif() # Platform specific libary defines. if (WIN32) set( LIBRT "" ) set( LIBDL "" ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set( LIBRT rt ) set( LIBDL dl ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set( LIBRT "" ) set( LIBDL "" ) else() message(FATAL_ERROR "Need to determine what the library name for 'rt' is for non-windows, non-unix platforms (or if it's even needed).") endif() # What OS will we be running on? if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_compiler_flag("-DPLATFORM_OSX=1") add_compiler_flag("-DPLATFORM_POSIX=1") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_compiler_flag("-DPLATFORM_LINUX=1") add_compiler_flag("-DPLATFORM_POSIX=1") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") add_compiler_flag("-DPLATFORM_WINDOWS=1") else() message(FATAL_ERROR "Platform unset, build will fail--stopping at CMake time.") endif() # What bittedness are we building? if (BUILD_X64) add_compiler_flag("-DPLATFORM_64BIT=1") else() add_compiler_flag("-DPLATFORM_32BIT=1") endif() # Compiler flags for windows. if (MSVC) # Multithreaded compilation is a big time saver. add_compiler_flag("/MP") # In debug, we use the DLL debug runtime. add_compiler_flag_debug("/MDd") # And in release we use the DLL release runtime add_compiler_flag_release("/MD") # x64 doesn't ever support /ZI, only /Zi. if (BUILD_X64) add_compiler_flag("/Zi") else() # In debug, get debug information suitable for Edit and Continue add_compiler_flag_debug("/ZI") # In release, still generate debug information (because not having it is dumb) add_compiler_flag_release("/Zi") endif() # And tell the linker to always generate the file for us. add_linker_flag("/DEBUG") endif()
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- version = '10.6.2'
{ "pile_set_name": "Github" }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <DVTFoundation/DVTSourceModelParser.h> @interface DVTCSourceModelParser : DVTSourceModelParser { void *_lexer; } + (id)createTerminalNodeForToken:(CDStruct_341fcc3f *)arg1 scopeProductionRule:(id *)arg2; + (void)initializeLexerModes; + (id)languageSpecification; - (void)_endLexerMode:(unsigned long long)arg1; - (void)_beginLexerMode:(unsigned long long)arg1; - (BOOL)_getNextToken:(CDStruct_341fcc3f *)arg1 temporaryFlags:(unsigned long long)arg2; - (unsigned long long)_currentLocation; - (void)_setCurrentLocation:(unsigned long long)arg1; - (void)_resetLexerWithInputString:(id)arg1; - (id)init; @end
{ "pile_set_name": "Github" }
# Rank Sales Leads Given a set of sales leads (i.e. prospective customers), rank which ones will most likely convert to a sale. ### Hypothetical Use Case Suppose you sell software that helps stores manage their inventory. You collect leads on thousands of potential customers, and your strategy is to cold-call them and pitch your product. You can only make 100 phone calls per day, so you want to identify leads with a high probability of converting to a sale. By calling leads randomly, you only generate about 2 sales per day (a 2% hit ratio). In this case, it's important to identify the leads which are most likely to convert to a sale. We are **not** interested interested in optimizing accuracy rate, because it's likely that no leads have a > 50% chance of becoming a sale, in which case the most accurate model will be the one that predicts no lead will convert to a sale. A better objective is to predict the probability that each lead becomes a sale... but even that's not necessary. In this scenario, we more intested in ranking the likelihood that each lead becomes a sale. With this in mind, area under the ROC curve (AUC ROC) is a good and typical candidate objective function. An even better objective function might be Partial AUC ROC, only considering the highest 10% or 20% of leads predicted to convert, in order to specifically reduce our model's false positive rate. ### References - [Convert More Sales Leads With Machine Learning - GormAnalysis](http://gormanalysis.com/convert-more-sales-leads-with-machine-learning/) ### Tags [binary-classification] [classification] [gradient_boosting] [logistic-regression] [one-hot-encoding] [python] [R] [random-forest] [rank-target] [sparse-data] [supervised-learning] [xgboost]
{ "pile_set_name": "Github" }
category:刑事 title:小区保安自称黑社会勒索业主10万元 content:一段时间以来,家住花都某别墅小区的老邹心有不安———竟然有“黑社会”打电话来勒索钱财,一开口就是10万元。老邹赶紧报了案。很快,警方查出了“真凶”,原来是小区的保安小罗……“邹某某……我是深圳黑社会李强的弟弟李勇……你小儿子应该值百万元吧, 一段时间以来,家住花都某别墅小区的老邹心有不安———竟然有“黑社会”打电话来勒索钱财,一开口就是10万元。老邹赶紧报了案。很快,警方查出了“真凶”,原来是小区的保安小罗…… “邹某某……我是深圳黑社会李强的弟弟李勇……你小儿子应该值百万元吧,我看中的就是你两个儿子,以后我会天天打电话到你豪宅问候你……”今年7月2日,老邹收到第一条敲诈短信。 为了不让家人担心受怕,老邹跟谁都没说,就当没这回事一样。“何况我不认识,也没得罪什么黑道人物,没准是哪个朋友在搞恶作剧呢”,老邹这样宽慰自己。接下来的两天,家里并没收到什么电话,公司也没有什么异常。老邹以为这事就这么过去了。 不想,7月5日和7月10日,勒索短信再度“来访”,短信的内容更加具体。发短信的人表示,希望老邹先“赞助10万元消遣消遣”,否则就将老邹的女儿绑架,再强行索要100万元。老邹有点坐不住了,几经思考之后,他向公安机关报了案。 公安机关迅速展开侦查。种种迹象显示,老邹所在社区的保安小罗的嫌疑很大,公安机关随即在小区工作人员的配合之下,将正躺在床上睡觉的小罗带回讯问。小罗很快就把犯罪事实和盘托出。 据查,今年6月份,小罗盗用之前一位工友的身份证,办了一张银行卡,作为收钱之用。他随后又利用值夜班的便利,偷偷进入小区管理室盗走了该小区业主的相关资料,知道了老邹的电话号码。接着他便假冒“黑社会”的名义,开始给老邹发短信…… 据了解,今年25岁的小罗在老邹的小区当保安员不过数月,是因为在对富人生活的耳濡目染中产生了“仇富”心理,才有了敲诈勒索的想法。 记者昨日从花都区人民检察院获悉,小罗涉嫌敲诈勒索罪,已经被批捕。
{ "pile_set_name": "Github" }
-----BEGIN EC PRIVATE KEY----- MHcCAQEEIPEqEyB2AnCoPL/9U/YDHvdqXYbIogTywwyp6/UfDw6noAoGCCqGSM49 AwEHoUQDQgAEN8xW2XYJHlpyPsdZLf8gbu58+QaRdNCtFLX3aCJZYpJO5QDYIxH/ 6i/SNF1dFr2KiMJrdw1VzYoqDvoByLTt/w== -----END EC PRIVATE KEY-----
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Acl\Model; /** * Retrieves the object identity for a given domain object * * @author Johannes M. Schmitt <[email protected]> */ interface ObjectIdentityRetrievalStrategyInterface { /** * Retrieves the object identity from a domain object * * @param object $domainObject * @return ObjectIdentityInterface */ public function getObjectIdentity($domainObject); }
{ "pile_set_name": "Github" }
package tools.tracesviewer; import java.awt.*; import java.awt.event.*; public class TracesSessionsList extends List { protected TracesSessions tracesSessions; protected TracesCanvas tracesCanvas; protected int index = 0; public TracesSessionsList() { //super(new DefaultListModel()); } public void setTracesCanvas(TracesCanvas tracesCanvas) { this.tracesCanvas = tracesCanvas; } /** * Get the call identifier for a given trace session. * *@param name is the session name for the trace session. * */ public String getCallId(String name) { try { int index = name.indexOf("//"); int firstIndex = name.indexOf("/", index + 2); return name.substring(firstIndex + 1); } catch (Exception e) { return name; } } /** * Get the origin for a trace session. * *@param name is the name of the trace session. * */ public String getOrigin(String name) { try { int firstIndex = name.indexOf("//"); int secondIndex = name.indexOf("/", 2); String origin = name.substring(2, secondIndex); if (origin.equals(TracesViewer.stackId)) return "the proxy"; else return "a user agent (" + origin + ")"; } catch (Exception e) { return "unknown"; } } public void setTracesSessions(TracesSessions tracesSessions) { removeAll(); //((DefaultListModel)getModel()).removeAllElements(); this.tracesSessions = tracesSessions; for (int i = 0; i < tracesSessions.size(); i++) { TracesSession tracesSession = (TracesSession) tracesSessions.elementAt(i); String name = tracesSession.getName(); String logDescription = tracesSession.getLogDescription(); //System.out.println("logDesc1:"+logDescription); String callId = getCallId(name); String origin = getOrigin(name); if (name.equals("No available session, refresh")) { add(name); } else if ( logDescription == null || logDescription.trim().equals("")) { add( "Trace " + (i + 1) + " from " + origin + "; callId: " + callId); } else { add( "Trace " + (i + 1) + " from " + logDescription + "; callId: " + callId); } } if (tracesSessions.size() != 0) select(0); } public void updateTracesCanvas() { if (tracesSessions == null || tracesSessions.isEmpty()) return; // We take the first trace from the list TracesSession tracesSession = (TracesSession) tracesSessions.firstElement(); String name = tracesSession.getName(); String logDescription = tracesSession.getLogDescription(); String callId = getCallId(name); String origin = getOrigin(name); if (name.equals("No available session, refresh")) { tracesCanvas.refreshTracesCanvas(tracesSession, "unknown"); } else if ( logDescription == null || logDescription.trim().equals("")) { tracesCanvas.refreshTracesCanvas(tracesSession, origin); } else { tracesCanvas.refreshTracesCanvas(tracesSession, logDescription); } } public void updateTracesCanvas(ItemEvent e) { if (tracesSessions == null || tracesSessions.isEmpty()) return; index = ((Integer) e.getItem()).intValue(); TracesSession tracesSession = (TracesSession) tracesSessions.elementAt(index); String name = tracesSession.getName(); String logDescription = tracesSession.getLogDescription(); String callId = getCallId(name); String origin = getOrigin(name); if (name.equals("No available session, refresh")) { tracesCanvas.refreshTracesCanvas(tracesSession, "unknown"); } else if ( logDescription == null || logDescription.trim().equals("")) { tracesCanvas.refreshTracesCanvas(tracesSession, origin); } else { System.out.println("logDesc33:" + logDescription); tracesCanvas.refreshTracesCanvas(tracesSession, logDescription); } } }
{ "pile_set_name": "Github" }
windows ------- qt5\buildqtlibs.bat 2>&1 | grep first -> 5 tane qt5\buildplugins.bat 2>&1 | grep first -> 7 tane qt5\cleanqt.bat qt5\buildqt.bat | grep first -> 8 tane * now we have Gideros[Studio,Player,TexturePacker,FontCreator].exe for windows makejar.bat * now we have gideros.jar for android buildandroidlibs.bat buildandroidso.bat * now we're building android on windows buildandroidplugins.bat 2>&1 | grep SharedLibrary -> 10 tane * now we have android plugins mac --- qt5/buildqtlibs.sh 2>&1 | grep "ln -s lib" qt5/buildplugins.sh 2>&1 | grep "ln -s lib" qt5/cleanqt.sh qt5/buildqt.sh * now we have Gideros[Studio,Player,TexturePacker,FontCreator].app for mac ./cleanioslibs.sh ./buildioslibs.sh ./copyioslibs.sh * now we have libiosplayer.a and libflurry.a ./buildiosplugins.sh ./copyiosplugins.sh * now we have libluasocket.a -------------------------------------------------------------------------------------------- copyall.bat > out.txt createpackage.bat * now we have windows installer ./copyall.sh ./createpackage.sh * now we have mac os installer
{ "pile_set_name": "Github" }
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Quake III Arena source code 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 Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // // cg_ents.c -- present snapshot entities, happens every single frame #include "cg_local.h" /* ====================== CG_PositionEntityOnTag Modifies the entities position and axis by the given tag location ====================== */ void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName ) { int i; orientation_t lerped; // lerp the tag trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame, 1.0 - parent->backlerp, tagName ); // FIXME: allow origin offsets along tag? VectorCopy( parent->origin, entity->origin ); for ( i = 0 ; i < 3 ; i++ ) { VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin ); } // had to cast away the const to avoid compiler problems... MatrixMultiply( lerped.axis, ((refEntity_t *)parent)->axis, entity->axis ); entity->backlerp = parent->backlerp; } /* ====================== CG_PositionRotatedEntityOnTag Modifies the entities position and axis by the given tag location ====================== */ void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName ) { int i; orientation_t lerped; vec3_t tempAxis[3]; //AxisClear( entity->axis ); // lerp the tag trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame, 1.0 - parent->backlerp, tagName ); // FIXME: allow origin offsets along tag? VectorCopy( parent->origin, entity->origin ); for ( i = 0 ; i < 3 ; i++ ) { VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin ); } // had to cast away the const to avoid compiler problems... MatrixMultiply( entity->axis, lerped.axis, tempAxis ); MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis ); } /* ========================================================================== FUNCTIONS CALLED EACH FRAME ========================================================================== */ /* ====================== CG_SetEntitySoundPosition Also called by event processing code ====================== */ void CG_SetEntitySoundPosition( centity_t *cent ) { if ( cent->currentState.solid == SOLID_BMODEL ) { vec3_t origin; float *v; v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ]; VectorAdd( cent->lerpOrigin, v, origin ); trap_S_UpdateEntityPosition( cent->currentState.number, origin ); } else { trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin ); } } /* ================== CG_EntityEffects Add continuous entity effects, like local entity emission and lighting ================== */ static void CG_EntityEffects( centity_t *cent ) { // update sound origins CG_SetEntitySoundPosition( cent ); // add loop sound if ( cent->currentState.loopSound ) { if (cent->currentState.eType != ET_SPEAKER) { trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.gameSounds[ cent->currentState.loopSound ] ); } else { trap_S_AddRealLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.gameSounds[ cent->currentState.loopSound ] ); } } // constant light glow if ( cent->currentState.constantLight ) { int cl; int i, r, g, b; cl = cent->currentState.constantLight; r = cl & 255; g = ( cl >> 8 ) & 255; b = ( cl >> 16 ) & 255; i = ( ( cl >> 24 ) & 255 ) * 4; trap_R_AddLightToScene( cent->lerpOrigin, i, r, g, b ); } } /* ================== CG_General ================== */ static void CG_General( centity_t *cent ) { refEntity_t ent; entityState_t *s1; s1 = &cent->currentState; // if set to invisible, skip if (!s1->modelindex) { return; } memset (&ent, 0, sizeof(ent)); // set frame ent.frame = s1->frame; ent.oldframe = ent.frame; ent.backlerp = 0; VectorCopy( cent->lerpOrigin, ent.origin); VectorCopy( cent->lerpOrigin, ent.oldorigin); ent.hModel = cgs.gameModels[s1->modelindex]; // player model if (s1->number == cg.snap->ps.clientNum) { ent.renderfx |= RF_THIRD_PERSON; // only draw from mirrors } // convert angles to axis AnglesToAxis( cent->lerpAngles, ent.axis ); // add to refresh list trap_R_AddRefEntityToScene (&ent); } /* ================== CG_Speaker Speaker entities can automatically play sounds ================== */ static void CG_Speaker( centity_t *cent ) { if ( ! cent->currentState.clientNum ) { // FIXME: use something other than clientNum... return; // not auto triggering } if ( cg.time < cent->miscTime ) { return; } trap_S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[cent->currentState.eventParm] ); // ent->s.frame = ent->wait * 10; // ent->s.clientNum = ent->random * 10; cent->miscTime = cg.time + cent->currentState.frame * 100 + cent->currentState.clientNum * 100 * crandom(); } /* ================== CG_Item ================== */ static void CG_Item( centity_t *cent ) { refEntity_t ent; entityState_t *es; gitem_t *item; int msec; float frac; float scale; weaponInfo_t *wi; es = &cent->currentState; if ( es->modelindex >= bg_numItems ) { CG_Error( "Bad item index %i on entity", es->modelindex ); } // if set to invisible, skip if ( !es->modelindex || ( es->eFlags & EF_NODRAW ) ) { return; } item = &bg_itemlist[ es->modelindex ]; if ( cg_simpleItems.integer && item->giType != IT_TEAM ) { memset( &ent, 0, sizeof( ent ) ); ent.reType = RT_SPRITE; VectorCopy( cent->lerpOrigin, ent.origin ); ent.radius = 14; ent.customShader = cg_items[es->modelindex].icon; ent.shaderRGBA[0] = 255; ent.shaderRGBA[1] = 255; ent.shaderRGBA[2] = 255; ent.shaderRGBA[3] = 255; trap_R_AddRefEntityToScene(&ent); return; } // items bob up and down continuously scale = 0.005 + cent->currentState.number * 0.00001; cent->lerpOrigin[2] += 4 + cos( ( cg.time + 1000 ) * scale ) * 4; memset (&ent, 0, sizeof(ent)); // autorotate at one of two speeds if ( item->giType == IT_HEALTH ) { VectorCopy( cg.autoAnglesFast, cent->lerpAngles ); AxisCopy( cg.autoAxisFast, ent.axis ); } else { VectorCopy( cg.autoAngles, cent->lerpAngles ); AxisCopy( cg.autoAxis, ent.axis ); } wi = NULL; // the weapons have their origin where they attatch to player // models, so we need to offset them or they will rotate // eccentricly if ( item->giType == IT_WEAPON ) { wi = &cg_weapons[item->giTag]; cent->lerpOrigin[0] -= wi->weaponMidpoint[0] * ent.axis[0][0] + wi->weaponMidpoint[1] * ent.axis[1][0] + wi->weaponMidpoint[2] * ent.axis[2][0]; cent->lerpOrigin[1] -= wi->weaponMidpoint[0] * ent.axis[0][1] + wi->weaponMidpoint[1] * ent.axis[1][1] + wi->weaponMidpoint[2] * ent.axis[2][1]; cent->lerpOrigin[2] -= wi->weaponMidpoint[0] * ent.axis[0][2] + wi->weaponMidpoint[1] * ent.axis[1][2] + wi->weaponMidpoint[2] * ent.axis[2][2]; cent->lerpOrigin[2] += 8; // an extra height boost } ent.hModel = cg_items[es->modelindex].models[0]; VectorCopy( cent->lerpOrigin, ent.origin); VectorCopy( cent->lerpOrigin, ent.oldorigin); ent.nonNormalizedAxes = qfalse; // if just respawned, slowly scale up msec = cg.time - cent->miscTime; if ( msec >= 0 && msec < ITEM_SCALEUP_TIME ) { frac = (float)msec / ITEM_SCALEUP_TIME; VectorScale( ent.axis[0], frac, ent.axis[0] ); VectorScale( ent.axis[1], frac, ent.axis[1] ); VectorScale( ent.axis[2], frac, ent.axis[2] ); ent.nonNormalizedAxes = qtrue; } else { frac = 1.0; } // items without glow textures need to keep a minimum light value // so they are always visible if ( ( item->giType == IT_WEAPON ) || ( item->giType == IT_ARMOR ) ) { ent.renderfx |= RF_MINLIGHT; } // increase the size of the weapons when they are presented as items if ( item->giType == IT_WEAPON ) { VectorScale( ent.axis[0], 1.5, ent.axis[0] ); VectorScale( ent.axis[1], 1.5, ent.axis[1] ); VectorScale( ent.axis[2], 1.5, ent.axis[2] ); ent.nonNormalizedAxes = qtrue; #ifdef MISSIONPACK trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.weaponHoverSound ); #endif } #ifdef MISSIONPACK if ( item->giType == IT_HOLDABLE && item->giTag == HI_KAMIKAZE ) { VectorScale( ent.axis[0], 2, ent.axis[0] ); VectorScale( ent.axis[1], 2, ent.axis[1] ); VectorScale( ent.axis[2], 2, ent.axis[2] ); ent.nonNormalizedAxes = qtrue; } #endif // add to refresh list trap_R_AddRefEntityToScene(&ent); #ifdef MISSIONPACK if ( item->giType == IT_WEAPON && wi->barrelModel ) { refEntity_t barrel; memset( &barrel, 0, sizeof( barrel ) ); barrel.hModel = wi->barrelModel; VectorCopy( ent.lightingOrigin, barrel.lightingOrigin ); barrel.shadowPlane = ent.shadowPlane; barrel.renderfx = ent.renderfx; CG_PositionRotatedEntityOnTag( &barrel, &ent, wi->weaponModel, "tag_barrel" ); AxisCopy( ent.axis, barrel.axis ); barrel.nonNormalizedAxes = ent.nonNormalizedAxes; trap_R_AddRefEntityToScene( &barrel ); } #endif // accompanying rings / spheres for powerups if ( !cg_simpleItems.integer ) { vec3_t spinAngles; VectorClear( spinAngles ); if ( item->giType == IT_HEALTH || item->giType == IT_POWERUP ) { if ( ( ent.hModel = cg_items[es->modelindex].models[1] ) != 0 ) { if ( item->giType == IT_POWERUP ) { ent.origin[2] += 12; spinAngles[1] = ( cg.time & 1023 ) * 360 / -1024.0f; } AnglesToAxis( spinAngles, ent.axis ); // scale up if respawning if ( frac != 1.0 ) { VectorScale( ent.axis[0], frac, ent.axis[0] ); VectorScale( ent.axis[1], frac, ent.axis[1] ); VectorScale( ent.axis[2], frac, ent.axis[2] ); ent.nonNormalizedAxes = qtrue; } trap_R_AddRefEntityToScene( &ent ); } } } } //============================================================================ /* =============== CG_Missile =============== */ static void CG_Missile( centity_t *cent ) { refEntity_t ent; entityState_t *s1; const weaponInfo_t *weapon; // int col; s1 = &cent->currentState; if ( s1->weapon > WP_NUM_WEAPONS ) { s1->weapon = 0; } weapon = &cg_weapons[s1->weapon]; // calculate the axis VectorCopy( s1->angles, cent->lerpAngles); // add trails if ( weapon->missileTrailFunc ) { weapon->missileTrailFunc( cent, weapon ); } /* if ( cent->currentState.modelindex == TEAM_RED ) { col = 1; } else if ( cent->currentState.modelindex == TEAM_BLUE ) { col = 2; } else { col = 0; } // add dynamic light if ( weapon->missileDlight ) { trap_R_AddLightToScene(cent->lerpOrigin, weapon->missileDlight, weapon->missileDlightColor[col][0], weapon->missileDlightColor[col][1], weapon->missileDlightColor[col][2] ); } */ // add dynamic light if ( weapon->missileDlight ) { trap_R_AddLightToScene(cent->lerpOrigin, weapon->missileDlight, weapon->missileDlightColor[0], weapon->missileDlightColor[1], weapon->missileDlightColor[2] ); } // add missile sound if ( weapon->missileSound ) { vec3_t velocity; BG_EvaluateTrajectoryDelta( &cent->currentState.pos, cg.time, velocity ); trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, weapon->missileSound ); } // create the render entity memset (&ent, 0, sizeof(ent)); VectorCopy( cent->lerpOrigin, ent.origin); VectorCopy( cent->lerpOrigin, ent.oldorigin); if ( cent->currentState.weapon == WP_PLASMAGUN ) { ent.reType = RT_SPRITE; ent.radius = 16; ent.rotation = 0; ent.customShader = cgs.media.plasmaBallShader; trap_R_AddRefEntityToScene( &ent ); return; } // flicker between two skins ent.skinNum = cg.clientFrame & 1; ent.hModel = weapon->missileModel; ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW; #ifdef MISSIONPACK if ( cent->currentState.weapon == WP_PROX_LAUNCHER ) { if (s1->generic1 == TEAM_BLUE) { ent.hModel = cgs.media.blueProxMine; } } #endif // convert direction of travel into axis if ( VectorNormalize2( s1->pos.trDelta, ent.axis[0] ) == 0 ) { ent.axis[0][2] = 1; } // spin as it moves if ( s1->pos.trType != TR_STATIONARY ) { RotateAroundDirection( ent.axis, cg.time / 4 ); } else { #ifdef MISSIONPACK if ( s1->weapon == WP_PROX_LAUNCHER ) { AnglesToAxis( cent->lerpAngles, ent.axis ); } else #endif { RotateAroundDirection( ent.axis, s1->time ); } } // add to refresh list, possibly with quad glow CG_AddRefEntityWithPowerups( &ent, s1, TEAM_FREE ); } /* =============== CG_Grapple This is called when the grapple is sitting up against the wall =============== */ static void CG_Grapple( centity_t *cent ) { refEntity_t ent; entityState_t *s1; const weaponInfo_t *weapon; s1 = &cent->currentState; if ( s1->weapon > WP_NUM_WEAPONS ) { s1->weapon = 0; } weapon = &cg_weapons[s1->weapon]; // calculate the axis VectorCopy( s1->angles, cent->lerpAngles); #if 0 // FIXME add grapple pull sound here..? // add missile sound if ( weapon->missileSound ) { trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->missileSound ); } #endif // Will draw cable if needed CG_GrappleTrail ( cent, weapon ); // create the render entity memset (&ent, 0, sizeof(ent)); VectorCopy( cent->lerpOrigin, ent.origin); VectorCopy( cent->lerpOrigin, ent.oldorigin); // flicker between two skins ent.skinNum = cg.clientFrame & 1; ent.hModel = weapon->missileModel; ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW; // convert direction of travel into axis if ( VectorNormalize2( s1->pos.trDelta, ent.axis[0] ) == 0 ) { ent.axis[0][2] = 1; } trap_R_AddRefEntityToScene( &ent ); } /* =============== CG_Mover =============== */ static void CG_Mover( centity_t *cent ) { refEntity_t ent; entityState_t *s1; s1 = &cent->currentState; // create the render entity memset (&ent, 0, sizeof(ent)); VectorCopy( cent->lerpOrigin, ent.origin); VectorCopy( cent->lerpOrigin, ent.oldorigin); AnglesToAxis( cent->lerpAngles, ent.axis ); ent.renderfx = RF_NOSHADOW; // flicker between two skins (FIXME?) ent.skinNum = ( cg.time >> 6 ) & 1; // get the model, either as a bmodel or a modelindex if ( s1->solid == SOLID_BMODEL ) { ent.hModel = cgs.inlineDrawModel[s1->modelindex]; } else { ent.hModel = cgs.gameModels[s1->modelindex]; } // add to refresh list trap_R_AddRefEntityToScene(&ent); // add the secondary model if ( s1->modelindex2 ) { ent.skinNum = 0; ent.hModel = cgs.gameModels[s1->modelindex2]; trap_R_AddRefEntityToScene(&ent); } } /* =============== CG_Beam Also called as an event =============== */ void CG_Beam( centity_t *cent ) { refEntity_t ent; entityState_t *s1; s1 = &cent->currentState; // create the render entity memset (&ent, 0, sizeof(ent)); VectorCopy( s1->pos.trBase, ent.origin ); VectorCopy( s1->origin2, ent.oldorigin ); AxisClear( ent.axis ); ent.reType = RT_BEAM; ent.renderfx = RF_NOSHADOW; // add to refresh list trap_R_AddRefEntityToScene(&ent); } /* =============== CG_Portal =============== */ static void CG_Portal( centity_t *cent ) { refEntity_t ent; entityState_t *s1; s1 = &cent->currentState; // create the render entity memset (&ent, 0, sizeof(ent)); VectorCopy( cent->lerpOrigin, ent.origin ); VectorCopy( s1->origin2, ent.oldorigin ); ByteToDir( s1->eventParm, ent.axis[0] ); PerpendicularVector( ent.axis[1], ent.axis[0] ); // negating this tends to get the directions like they want // we really should have a camera roll value VectorSubtract( vec3_origin, ent.axis[1], ent.axis[1] ); CrossProduct( ent.axis[0], ent.axis[1], ent.axis[2] ); ent.reType = RT_PORTALSURFACE; ent.oldframe = s1->powerups; ent.frame = s1->frame; // rotation speed ent.skinNum = s1->clientNum/256.0 * 360; // roll offset // add to refresh list trap_R_AddRefEntityToScene(&ent); } /* ========================= CG_AdjustPositionForMover Also called by client movement prediction code ========================= */ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) { centity_t *cent; vec3_t oldOrigin, origin, deltaOrigin; vec3_t oldAngles, angles, deltaAngles; if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) { VectorCopy( in, out ); return; } cent = &cg_entities[ moverNum ]; if ( cent->currentState.eType != ET_MOVER ) { VectorCopy( in, out ); return; } BG_EvaluateTrajectory( &cent->currentState.pos, fromTime, oldOrigin ); BG_EvaluateTrajectory( &cent->currentState.apos, fromTime, oldAngles ); BG_EvaluateTrajectory( &cent->currentState.pos, toTime, origin ); BG_EvaluateTrajectory( &cent->currentState.apos, toTime, angles ); VectorSubtract( origin, oldOrigin, deltaOrigin ); VectorSubtract( angles, oldAngles, deltaAngles ); VectorAdd( in, deltaOrigin, out ); // FIXME: origin change when on a rotating object } /* ============================= CG_InterpolateEntityPosition ============================= */ static void CG_InterpolateEntityPosition( centity_t *cent ) { vec3_t current, next; float f; // it would be an internal error to find an entity that interpolates without // a snapshot ahead of the current one if ( cg.nextSnap == NULL ) { CG_Error( "CG_InterpoateEntityPosition: cg.nextSnap == NULL" ); } f = cg.frameInterpolation; // this will linearize a sine or parabolic curve, but it is important // to not extrapolate player positions if more recent data is available BG_EvaluateTrajectory( &cent->currentState.pos, cg.snap->serverTime, current ); BG_EvaluateTrajectory( &cent->nextState.pos, cg.nextSnap->serverTime, next ); cent->lerpOrigin[0] = current[0] + f * ( next[0] - current[0] ); cent->lerpOrigin[1] = current[1] + f * ( next[1] - current[1] ); cent->lerpOrigin[2] = current[2] + f * ( next[2] - current[2] ); BG_EvaluateTrajectory( &cent->currentState.apos, cg.snap->serverTime, current ); BG_EvaluateTrajectory( &cent->nextState.apos, cg.nextSnap->serverTime, next ); cent->lerpAngles[0] = LerpAngle( current[0], next[0], f ); cent->lerpAngles[1] = LerpAngle( current[1], next[1], f ); cent->lerpAngles[2] = LerpAngle( current[2], next[2], f ); } /* =============== CG_CalcEntityLerpPositions =============== */ static void CG_CalcEntityLerpPositions( centity_t *cent ) { // if this player does not want to see extrapolated players if ( !cg_smoothClients.integer ) { // make sure the clients use TR_INTERPOLATE if ( cent->currentState.number < MAX_CLIENTS ) { cent->currentState.pos.trType = TR_INTERPOLATE; cent->nextState.pos.trType = TR_INTERPOLATE; } } if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) { CG_InterpolateEntityPosition( cent ); return; } // first see if we can interpolate between two snaps for // linear extrapolated clients if ( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP && cent->currentState.number < MAX_CLIENTS) { CG_InterpolateEntityPosition( cent ); return; } // just use the current frame and evaluate as best we can BG_EvaluateTrajectory( &cent->currentState.pos, cg.time, cent->lerpOrigin ); BG_EvaluateTrajectory( &cent->currentState.apos, cg.time, cent->lerpAngles ); // adjust for riding a mover if it wasn't rolled into the predicted // player state if ( cent != &cg.predictedPlayerEntity ) { CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum, cg.snap->serverTime, cg.time, cent->lerpOrigin ); } } /* =============== CG_TeamBase =============== */ static void CG_TeamBase( centity_t *cent ) { refEntity_t model; #ifdef MISSIONPACK vec3_t angles; int t, h; float c; if ( cgs.gametype == GT_CTF || cgs.gametype == GT_1FCTF ) { #else if ( cgs.gametype == GT_CTF) { #endif // show the flag base memset(&model, 0, sizeof(model)); model.reType = RT_MODEL; VectorCopy( cent->lerpOrigin, model.lightingOrigin ); VectorCopy( cent->lerpOrigin, model.origin ); AnglesToAxis( cent->currentState.angles, model.axis ); if ( cent->currentState.modelindex == TEAM_RED ) { model.hModel = cgs.media.redFlagBaseModel; } else if ( cent->currentState.modelindex == TEAM_BLUE ) { model.hModel = cgs.media.blueFlagBaseModel; } else { model.hModel = cgs.media.neutralFlagBaseModel; } trap_R_AddRefEntityToScene( &model ); } #ifdef MISSIONPACK else if ( cgs.gametype == GT_OBELISK ) { // show the obelisk memset(&model, 0, sizeof(model)); model.reType = RT_MODEL; VectorCopy( cent->lerpOrigin, model.lightingOrigin ); VectorCopy( cent->lerpOrigin, model.origin ); AnglesToAxis( cent->currentState.angles, model.axis ); model.hModel = cgs.media.overloadBaseModel; trap_R_AddRefEntityToScene( &model ); // if hit if ( cent->currentState.frame == 1) { // show hit model // modelindex2 is the health value of the obelisk c = cent->currentState.modelindex2; model.shaderRGBA[0] = 0xff; model.shaderRGBA[1] = c; model.shaderRGBA[2] = c; model.shaderRGBA[3] = 0xff; // model.hModel = cgs.media.overloadEnergyModel; trap_R_AddRefEntityToScene( &model ); } // if respawning if ( cent->currentState.frame == 2) { if ( !cent->miscTime ) { cent->miscTime = cg.time; } t = cg.time - cent->miscTime; h = (cg_obeliskRespawnDelay.integer - 5) * 1000; // if (t > h) { c = (float) (t - h) / h; if (c > 1) c = 1; } else { c = 0; } // show the lights AnglesToAxis( cent->currentState.angles, model.axis ); // model.shaderRGBA[0] = c * 0xff; model.shaderRGBA[1] = c * 0xff; model.shaderRGBA[2] = c * 0xff; model.shaderRGBA[3] = c * 0xff; model.hModel = cgs.media.overloadLightsModel; trap_R_AddRefEntityToScene( &model ); // show the target if (t > h) { if ( !cent->muzzleFlashTime ) { trap_S_StartSound (cent->lerpOrigin, ENTITYNUM_NONE, CHAN_BODY, cgs.media.obeliskRespawnSound); cent->muzzleFlashTime = 1; } VectorCopy(cent->currentState.angles, angles); angles[YAW] += (float) 16 * acos(1-c) * 180 / M_PI; AnglesToAxis( angles, model.axis ); VectorScale( model.axis[0], c, model.axis[0]); VectorScale( model.axis[1], c, model.axis[1]); VectorScale( model.axis[2], c, model.axis[2]); model.shaderRGBA[0] = 0xff; model.shaderRGBA[1] = 0xff; model.shaderRGBA[2] = 0xff; model.shaderRGBA[3] = 0xff; // model.origin[2] += 56; model.hModel = cgs.media.overloadTargetModel; trap_R_AddRefEntityToScene( &model ); } else { //FIXME: show animated smoke } } else { cent->miscTime = 0; cent->muzzleFlashTime = 0; // modelindex2 is the health value of the obelisk c = cent->currentState.modelindex2; model.shaderRGBA[0] = 0xff; model.shaderRGBA[1] = c; model.shaderRGBA[2] = c; model.shaderRGBA[3] = 0xff; // show the lights model.hModel = cgs.media.overloadLightsModel; trap_R_AddRefEntityToScene( &model ); // show the target model.origin[2] += 56; model.hModel = cgs.media.overloadTargetModel; trap_R_AddRefEntityToScene( &model ); } } else if ( cgs.gametype == GT_HARVESTER ) { // show harvester model memset(&model, 0, sizeof(model)); model.reType = RT_MODEL; VectorCopy( cent->lerpOrigin, model.lightingOrigin ); VectorCopy( cent->lerpOrigin, model.origin ); AnglesToAxis( cent->currentState.angles, model.axis ); if ( cent->currentState.modelindex == TEAM_RED ) { model.hModel = cgs.media.harvesterModel; model.customSkin = cgs.media.harvesterRedSkin; } else if ( cent->currentState.modelindex == TEAM_BLUE ) { model.hModel = cgs.media.harvesterModel; model.customSkin = cgs.media.harvesterBlueSkin; } else { model.hModel = cgs.media.harvesterNeutralModel; model.customSkin = 0; } trap_R_AddRefEntityToScene( &model ); } #endif } /* =============== CG_AddCEntity =============== */ static void CG_AddCEntity( centity_t *cent ) { // event-only entities will have been dealt with already if ( cent->currentState.eType >= ET_EVENTS ) { return; } // calculate the current origin CG_CalcEntityLerpPositions( cent ); // add automatic effects CG_EntityEffects( cent ); switch ( cent->currentState.eType ) { default: CG_Error( "Bad entity type: %i\n", cent->currentState.eType ); break; case ET_INVISIBLE: case ET_PUSH_TRIGGER: case ET_TELEPORT_TRIGGER: break; case ET_GENERAL: CG_General( cent ); break; case ET_PLAYER: CG_Player( cent ); break; case ET_ITEM: CG_Item( cent ); break; case ET_MISSILE: CG_Missile( cent ); break; case ET_MOVER: CG_Mover( cent ); break; case ET_BEAM: CG_Beam( cent ); break; case ET_PORTAL: CG_Portal( cent ); break; case ET_SPEAKER: CG_Speaker( cent ); break; case ET_GRAPPLE: CG_Grapple( cent ); break; case ET_TEAM: CG_TeamBase( cent ); break; } } /* =============== CG_AddPacketEntities =============== */ void CG_AddPacketEntities( void ) { int num; centity_t *cent; playerState_t *ps; // set cg.frameInterpolation if ( cg.nextSnap ) { int delta; delta = (cg.nextSnap->serverTime - cg.snap->serverTime); if ( delta == 0 ) { cg.frameInterpolation = 0; } else { cg.frameInterpolation = (float)( cg.time - cg.snap->serverTime ) / delta; } } else { cg.frameInterpolation = 0; // actually, it should never be used, because // no entities should be marked as interpolating } // the auto-rotating items will all have the same axis cg.autoAngles[0] = 0; cg.autoAngles[1] = ( cg.time & 2047 ) * 360 / 2048.0; cg.autoAngles[2] = 0; cg.autoAnglesFast[0] = 0; cg.autoAnglesFast[1] = ( cg.time & 1023 ) * 360 / 1024.0f; cg.autoAnglesFast[2] = 0; AnglesToAxis( cg.autoAngles, cg.autoAxis ); AnglesToAxis( cg.autoAnglesFast, cg.autoAxisFast ); // generate and add the entity from the playerstate ps = &cg.predictedPlayerState; BG_PlayerStateToEntityState( ps, &cg.predictedPlayerEntity.currentState, qfalse ); CG_AddCEntity( &cg.predictedPlayerEntity ); // lerp the non-predicted value for lightning gun origins CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] ); // add each entity sent over by the server for ( num = 0 ; num < cg.snap->numEntities ; num++ ) { cent = &cg_entities[ cg.snap->entities[ num ].number ]; CG_AddCEntity( cent ); } }
{ "pile_set_name": "Github" }
from django.test import TestCase from casexml.apps.case.mock import CaseBlock from casexml.apps.case.tests.util import deprecated_check_user_has_case from casexml.apps.case.util import post_case_blocks from corehq.apps.domain.shortcuts import create_domain from corehq.apps.groups.models import Group from corehq.apps.users.models import CommCareUser from corehq.apps.users.util import format_username class CaseSharingTest(TestCase): def setUp(self): """ Two groups A and B, with users A1, A2 and B1, B2 respectively, and supervisor X who belongs to both. """ self.domain = "test-domain" create_domain(self.domain) password = "****" def create_user(username): return CommCareUser.create(self.domain, format_username(username, self.domain), password, None, None) def create_group(name, *users): group = Group(users=[user.user_id for user in users], name=name, domain=self.domain, case_sharing=True) group.save() return group self.userX = create_user("X") self.userA1 = create_user("A1") self.userA2 = create_user("A2") self.userB1 = create_user("B1") self.userB2 = create_user("B2") self.groupA = create_group("A", self.userX, self.userA1, self.userA2) self.groupB = create_group("B", self.userX, self.userB1, self.userB2) def test_sharing(self): def create_and_test(case_id, user, owner, should_have, should_not_have): case_block = self.get_create_block( case_id=case_id, type="case", user_id=user.user_id, owner_id=owner.get_id, ) post_case_blocks([case_block], {'domain': self.domain}) check_has_block(case_block, should_have, should_not_have) def update_and_test(case_id, owner=None, should_have=None, should_not_have=None): case_block = self.get_update_block( case_id=case_id, update={'greeting': "Hello!"}, owner_id=owner.get_id if owner else None, ) post_case_blocks([case_block], {'domain': self.domain}) check_has_block(case_block, should_have, should_not_have, line_by_line=False) def check_has_block(case_block, should_have, should_not_have, line_by_line=True): for user in should_have: deprecated_check_user_has_case(self, user.to_ota_restore_user(), case_block, line_by_line=line_by_line) for user in should_not_have: deprecated_check_user_has_case(self, user.to_ota_restore_user(), case_block, should_have=False, line_by_line=line_by_line) create_and_test( case_id='case-a-1', user=self.userA1, owner=self.groupA, should_have=[self.userA1, self.userA2, self.userX], should_not_have=[self.userB1, self.userB2], ) create_and_test( case_id='case-b-1', user=self.userB1, owner=self.groupB, should_have=[self.userB1, self.userB2, self.userX], should_not_have=[self.userA1, self.userA2], ) create_and_test( case_id='case-a-2', user=self.userX, owner=self.groupA, should_have=[self.userA1, self.userA2, self.userX], should_not_have=[self.userB1, self.userB2], ) update_and_test( case_id='case-a-1', should_have=[self.userA1, self.userA2, self.userX], should_not_have=[self.userB1, self.userB2], ) update_and_test( case_id='case-a-1', owner=self.groupB, should_have=[self.userB1, self.userB2, self.userX], should_not_have=[self.userA1, self.userA2], ) def get_create_block(self, case_id, type, user_id, owner_id, name=None, **kwargs): name = name or case_id case_block = CaseBlock.deprecated_init( create=True, case_id=case_id, case_name=name, case_type=type, user_id=user_id, external_id=case_id, owner_id=owner_id, **kwargs ).as_xml() return case_block def get_update_block(self, case_id, owner_id=None, update=None): update = update or {} case_block = CaseBlock.deprecated_init( case_id=case_id, update=update, owner_id=owner_id or CaseBlock.undefined, ).as_xml() return case_block
{ "pile_set_name": "Github" }
/// @dir poller /// Polls a number of "pollee" nodes as fast as possible to get data from them. // 2011-11-23 <[email protected]> http://opensource.org/licenses/mit-license.php // // Warning: this test will flood the radio band so nothing else gets through! // // Maximum rates will only be achieved if all nodes 1 .. NUM_NODES are powered // up, properly configured, and pre-loaded with the pollee.ino sketch. #include <JeeLib.h> const byte NUM_NODES = 3; // poll using node ID from 1 to NUM_NODES typedef struct { byte node; long time; } Payload; byte nextId; MilliTimer timer; void setup () { Serial.begin(57600); Serial.println("\n[poller]"); rf12_initialize(1, RF12_868MHZ, 77); } void loop () { // switch to next node if (++nextId > NUM_NODES) nextId = 1; // send an empty packet to one specific pollee rf12_sendNow(RF12_HDR_ACK | RF12_HDR_DST | nextId, 0, 0); // wait up to 10 milliseconds for a reply timer.set(10); while (!timer.poll()) if (rf12_recvDone() && rf12_crc == 0 && rf12_len == sizeof (Payload)) { // got a good ACK packet, print out its contents const Payload* p = (const Payload*) rf12_data; Serial.print((word) p->node); Serial.print(": "); Serial.println(p->time); break; } }
{ "pile_set_name": "Github" }
/* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef JSHTMLTrackElement_h #define JSHTMLTrackElement_h #if ENABLE(VIDEO_TRACK) #include "JSHTMLElement.h" #include <runtime/JSObjectWithGlobalObject.h> namespace WebCore { class HTMLTrackElement; class JSHTMLTrackElement : public JSHTMLElement { typedef JSHTMLElement Base; public: JSHTMLTrackElement(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<HTMLTrackElement>); static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); static const JSC::ClassInfo s_info; static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; class JSHTMLTrackElementPrototype : public JSC::JSObjectWithGlobalObject { typedef JSC::JSObjectWithGlobalObject Base; public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); static const JSC::ClassInfo s_info; static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } JSHTMLTrackElementPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) : JSC::JSObjectWithGlobalObject(globalData, globalObject, structure) { } protected: static const unsigned StructureFlags = Base::StructureFlags; }; // Attributes JSC::JSValue jsHTMLTrackElementSrc(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSHTMLTrackElementSrc(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTrackElementKind(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSHTMLTrackElementKind(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTrackElementSrclang(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSHTMLTrackElementSrclang(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTrackElementLabel(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSHTMLTrackElementLabel(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTrackElementIsDefault(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSHTMLTrackElementIsDefault(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsHTMLTrackElementConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore #endif // ENABLE(VIDEO_TRACK) #endif
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>CSS Test: Max-height on absolutely positioned, non-replaced elements, static position of fixed element</title> <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height"> <meta name="flags" content=""> <meta name="assert" content="The calculation of static position is based on initial containing block when there is a fixed positioned element."> <style type="text/css"> html, body, p { margin: 0; padding: 0; } #div1 { border: solid black; height: 2in; position: absolute; width: 2in; } div div { background: blue; height: 1in; max-height: 0.5in; position: fixed; width: 1in; } </style> </head> <body> <p>Test passes the blue box is in the upper-left corner of the black box.</p> <div id="div1"> <div></div> </div> </body> </html>
{ "pile_set_name": "Github" }
# -- # Copyright (C) 2001-2020 OTRS AG, https://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt. # -- <div class="WidgetSimple MessageOfTheDayBox" id="MessageOfTheDayBox"> <div class="Header"> <h2 class="Center">[% Translate("Message of the Day") | html %]</h2> </div> <div class="Content"> <p>[% Translate("This is the message of the day. You can edit this in %s.", 'Kernel/Output/HTML/Templates/Standard/Motd.tt') | html %]</p> </div> </div>
{ "pile_set_name": "Github" }
// // Forms // -------------------------------------------------- // Normalize non-controls // // Restyle and baseline non-control form elements. fieldset { padding: 0; margin: 0; border: 0; // Chrome and Firefox set a `min-width: -webkit-min-content;` on fieldsets, // so we reset that to ensure it behaves more like a standard block element. // See https://github.com/twbs/bootstrap/issues/12359. min-width: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: @line-height-computed; font-size: (@font-size-base * 1.5); line-height: inherit; color: @legend-color; border: 0; border-bottom: 1px solid @legend-border-color; } label { display: inline-block; margin-bottom: 5px; font-weight: bold; } // Normalize form controls // // While most of our form styles require extra classes, some basic normalization // is required to ensure optimum display with or without those classes to better // address browser inconsistencies. // Override content-box in Normalize (* isn't specific enough) input[type="search"] { .box-sizing(border-box); } // Position radios and checkboxes better input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; /* IE8-9 */ line-height: normal; } // Set the height of file controls to match text inputs input[type="file"] { display: block; } // Make range inputs behave like textual form controls input[type="range"] { display: block; width: 100%; } // Make multiple select elements height not fixed select[multiple], select[size] { height: auto; } // Focus for file, radio, and checkbox input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { .tab-focus(); } // Adjust output element output { display: block; padding-top: (@padding-base-vertical + 1); font-size: @font-size-base; line-height: @line-height-base; color: @input-color; } // Common form controls // // Shared size and type resets for form controls. Apply `.form-control` to any // of the following form controls: // // select // textarea // input[type="text"] // input[type="password"] // input[type="datetime"] // input[type="datetime-local"] // input[type="date"] // input[type="month"] // input[type="time"] // input[type="week"] // input[type="number"] // input[type="email"] // input[type="url"] // input[type="search"] // input[type="tel"] // input[type="color"] .form-control { display: block; width: 100%; height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) padding: @padding-base-vertical @padding-base-horizontal; font-size: @font-size-base; line-height: @line-height-base; color: @input-color; background-color: @input-bg; background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 border: 1px solid @input-border; border-radius: @input-border-radius; .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s"); // Customize the `:focus` state to imitate native WebKit styles. .form-control-focus(); // Placeholder .placeholder(); // Disabled and read-only inputs // // HTML5 says that controls under a fieldset > legend:first-child won't be // disabled if the fieldset is disabled. Due to implementation difficulty, we // don't honor that edge case; we style them as disabled anyway. &[disabled], &[readonly], fieldset[disabled] & { cursor: not-allowed; background-color: @input-bg-disabled; opacity: 1; // iOS fix for unreadable disabled content } // Reset height for `textarea`s textarea& { height: auto; } } // Search inputs in iOS // // This overrides the extra rounded corners on search inputs in iOS so that our // `.form-control` class can properly style them. Note that this cannot simply // be added to `.form-control` as it's not specific enough. For details, see // https://github.com/twbs/bootstrap/issues/11586. input[type="search"] { -webkit-appearance: none; } // Special styles for iOS date input // // In Mobile Safari, date inputs require a pixel line-height that matches the // given height of the input. input[type="date"] { line-height: @input-height-base; } // Form groups // // Designed to help with the organization and spacing of vertical forms. For // horizontal forms, use the predefined grid classes. .form-group { margin-bottom: 15px; } // Checkboxes and radios // // Indent the labels to position radios/checkboxes as hanging controls. .radio, .checkbox { display: block; min-height: @line-height-computed; // clear the floating input if there is no label text margin-top: 10px; margin-bottom: 10px; padding-left: 20px; label { display: inline; font-weight: normal; cursor: pointer; } } .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] { float: left; margin-left: -20px; } .radio + .radio, .checkbox + .checkbox { margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing } // Radios and checkboxes on same line .radio-inline, .checkbox-inline { display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: normal; cursor: pointer; } .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline { margin-top: 0; margin-left: 10px; // space out consecutive inline controls } // Apply same disabled cursor tweak as for inputs // // Note: Neither radios nor checkboxes can be readonly. input[type="radio"], input[type="checkbox"], .radio, .radio-inline, .checkbox, .checkbox-inline { &[disabled], fieldset[disabled] & { cursor: not-allowed; } } // Form control sizing // // Build on `.form-control` with modifier classes to decrease or increase the // height and font-size of form controls. .input-sm { .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small); } .input-lg { .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large); } // Form control feedback states // // Apply contextual and semantic states to individual form controls. .has-feedback { // Enable absolute positioning position: relative; // Ensure icons don't overlap text .form-control { padding-right: (@input-height-base * 1.25); } // Feedback icon (requires .glyphicon classes) .form-control-feedback { position: absolute; top: (@line-height-computed + 5); // Height of the `label` and its margin right: 0; display: block; width: @input-height-base; height: @input-height-base; line-height: @input-height-base; text-align: center; } } // Feedback states .has-success { .form-control-validation(@state-success-text; @state-success-text; @state-success-bg); } .has-warning { .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg); } .has-error { .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg); } // Static form control text // // Apply class to a `p` element to make any string of text align with labels in // a horizontal form layout. .form-control-static { margin-bottom: 0; // Remove default margin from `p` } // Help text // // Apply to any element you wish to create light text for placement immediately // below a form control. Use for general help, formatting, or instructional text. .help-block { display: block; // account for any element using help-block margin-top: 5px; margin-bottom: 10px; color: lighten(@text-color, 25%); // lighten the text some for contrast } // Inline forms // // Make forms appear inline(-block) by adding the `.form-inline` class. Inline // forms begin stacked on extra small (mobile) devices and then go inline when // viewports reach <768px. // // Requires wrapping inputs and labels with `.form-group` for proper display of // default HTML form controls and our custom form controls (e.g., input groups). // // Heads up! This is mixin-ed into `.navbar-form` in navbars.less. .form-inline { // Kick in the inline @media (min-width: @screen-sm-min) { // Inline-block all the things for "inline" .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } // In navbar-form, allow folks to *not* use `.form-group` .form-control { display: inline-block; width: auto; // Prevent labels from stacking above inputs in `.form-group` vertical-align: middle; } // Input groups need that 100% width though .input-group > .form-control { width: 100%; } .control-label { margin-bottom: 0; vertical-align: middle; } // Remove default margin on radios/checkboxes that were used for stacking, and // then undo the floating of radios and checkboxes to match (which also avoids // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969). .radio, .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; padding-left: 0; vertical-align: middle; } .radio input[type="radio"], .checkbox input[type="checkbox"] { float: none; margin-left: 0; } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; } } } // Horizontal forms // // Horizontal forms are built on grid classes and allow you to create forms with // labels on the left and inputs on the right. .form-horizontal { // Consistent vertical alignment of labels, radios, and checkboxes .control-label, .radio, .checkbox, .radio-inline, .checkbox-inline { margin-top: 0; margin-bottom: 0; padding-top: (@padding-base-vertical + 1); // Default padding plus a border } // Account for padding we're adding to ensure the alignment and of help text // and other content below items .radio, .checkbox { min-height: (@line-height-computed + (@padding-base-vertical + 1)); } // Make form groups behave like rows .form-group { .make-row(); } .form-control-static { padding-top: (@padding-base-vertical + 1); } // Only right align form labels here when the columns stop stacking @media (min-width: @screen-sm-min) { .control-label { text-align: right; } } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; right: (@grid-gutter-width / 2); } }
{ "pile_set_name": "Github" }
package com.journaldev.dagger2retrofitrecyclerview; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
{ "pile_set_name": "Github" }
/* Copyright (C) 2016 Arb authors This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "bool_mat.h" void bool_mat_add(bool_mat_t res, const bool_mat_t mat1, const bool_mat_t mat2) { slong i, j; if (bool_mat_is_empty(mat1)) return; for (i = 0; i < bool_mat_nrows(mat1); i++) for (j = 0; j < bool_mat_ncols(mat1); j++) bool_mat_set_entry(res, i, j, (bool_mat_get_entry(mat1, i, j) | bool_mat_get_entry(mat2, i, j))); }
{ "pile_set_name": "Github" }
//===--- RDFDeadCode.h ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // RDF-based generic dead code elimination. // // The main interface of this class are functions "collect" and "erase". // This allows custom processing of the function being optimized by a // particular consumer. The simplest way to use this class would be to // instantiate an object, and then simply call "collect" and "erase", // passing the result of "getDeadInstrs()" to it. // A more complex scenario would be to call "collect" first, then visit // all post-increment instructions to see if the address update is dead // or not, and if it is, convert the instruction to a non-updating form. // After that "erase" can be called with the set of nodes including both, // dead defs from the updating instructions and the nodes corresponding // to the dead instructions. #ifndef RDF_DEADCODE_H #define RDF_DEADCODE_H #include "RDFGraph.h" #include "RDFLiveness.h" #include "llvm/ADT/SetVector.h" namespace llvm { class MachineRegisterInfo; namespace rdf { struct DeadCodeElimination { DeadCodeElimination(DataFlowGraph &dfg, MachineRegisterInfo &mri) : Trace(false), DFG(dfg), MRI(mri), LV(mri, dfg) {} bool collect(); bool erase(const SetVector<NodeId> &Nodes); void trace(bool On) { Trace = On; } bool trace() const { return Trace; } SetVector<NodeId> getDeadNodes() { return DeadNodes; } SetVector<NodeId> getDeadInstrs() { return DeadInstrs; } DataFlowGraph &getDFG() { return DFG; } private: bool Trace; SetVector<NodeId> LiveNodes; SetVector<NodeId> DeadNodes; SetVector<NodeId> DeadInstrs; DataFlowGraph &DFG; MachineRegisterInfo &MRI; Liveness LV; template<typename T> struct SetQueue; bool isLiveInstr(const MachineInstr *MI) const; void scanInstr(NodeAddr<InstrNode*> IA, SetQueue<NodeId> &WorkQ); void processDef(NodeAddr<DefNode*> DA, SetQueue<NodeId> &WorkQ); void processUse(NodeAddr<UseNode*> UA, SetQueue<NodeId> &WorkQ); }; } // namespace rdf } // namespace llvm #endif
{ "pile_set_name": "Github" }
Results of test95: OK 0 - [[:alpha:][=a=]]\+ OK 1 - [[:alpha:][=a=]]\+ OK 2 - [[:alpha:][=a=]]\+ OK 0 - [[=a=]]\+ OK 1 - [[=a=]]\+ OK 2 - [[=a=]]\+ OK 0 - [^ม ]\+ OK 1 - [^ม ]\+ OK 2 - [^ม ]\+ OK 0 - [^ ]\+ OK 1 - [^ ]\+ OK 2 - [^ ]\+ OK 0 - [ม[:alpha:][=a=]]\+ OK 1 - [ม[:alpha:][=a=]]\+ OK 2 - [ม[:alpha:][=a=]]\+ OK 0 - \p\+ OK 1 - \p\+ OK 2 - \p\+ OK 0 - \p* OK 1 - \p* OK 2 - \p* OK 0 - \i\+ OK 1 - \i\+ OK 2 - \i\+ OK 0 - \f\+ OK 1 - \f\+ OK 2 - \f\+ OK 0 - .ม OK 1 - .ม OK 2 - .ม OK 0 - .ม่ OK 1 - .ม่ OK 2 - .ม่ OK 0 - ֹ OK 1 - ֹ OK 2 - ֹ OK 0 - .ֹ OK 1 - .ֹ OK 2 - .ֹ OK 0 - ֹֻ OK 1 - ֹֻ OK 2 - ֹֻ OK 0 - .ֹֻ OK 1 - .ֹֻ OK 2 - .ֹֻ OK 0 - ֹֻ OK 1 - ֹֻ OK 2 - ֹֻ OK 0 - .ֹֻ OK 1 - .ֹֻ OK 2 - .ֹֻ OK 0 - ֹ OK 1 - ֹ OK 2 - ֹ OK 0 - .ֹ OK 1 - .ֹ OK 2 - .ֹ OK 0 - ֹ OK 1 - ֹ OK 2 - ֹ OK 0 - .ֹ OK 1 - .ֹ OK 2 - .ֹ OK 0 - ֹֻ OK 2 - ֹֻ OK 0 - .ֹֻ OK 1 - .ֹֻ OK 2 - .ֹֻ OK 0 - a OK 1 - a OK 2 - a OK 0 - ca OK 1 - ca OK 2 - ca OK 0 - à OK 1 - à OK 2 - à OK 0 - a\%C OK 1 - a\%C OK 2 - a\%C OK 0 - ca\%C OK 1 - ca\%C OK 2 - ca\%C OK 0 - ca\%Ct OK 1 - ca\%Ct OK 2 - ca\%Ct OK 0 - ú\Z OK 1 - ú\Z OK 2 - ú\Z OK 0 - יהוה\Z OK 1 - יהוה\Z OK 2 - יהוה\Z OK 0 - יְהוָה\Z OK 1 - יְהוָה\Z OK 2 - יְהוָה\Z OK 0 - יהוה\Z OK 1 - יהוה\Z OK 2 - יהוה\Z OK 0 - יְהוָה\Z OK 1 - יְהוָה\Z OK 2 - יְהוָה\Z OK 0 - יְ\Z OK 1 - יְ\Z OK 2 - יְ\Z OK 0 - ק‍ֹx\Z OK 1 - ק‍ֹx\Z OK 2 - ק‍ֹx\Z OK 0 - ק‍ֹx\Z OK 1 - ק‍ֹx\Z OK 2 - ק‍ֹx\Z OK 0 - ק‍x\Z OK 1 - ק‍x\Z OK 2 - ק‍x\Z OK 0 - ק‍x\Z OK 1 - ק‍x\Z OK 2 - ק‍x\Z OK 0 - ֹ\Z OK 1 - ֹ\Z OK 2 - ֹ\Z OK 0 - \Zֹ OK 1 - \Zֹ OK 2 - \Zֹ OK 0 - ֹ\Z OK 1 - ֹ\Z OK 2 - ֹ\Z OK 0 - \Zֹ OK 1 - \Zֹ OK 2 - \Zֹ OK 0 - ֹ\+\Z OK 2 - ֹ\+\Z OK 0 - \Zֹ\+ OK 2 - \Zֹ\+ OK 0 - [^[=a=]]\+ OK 1 - [^[=a=]]\+ OK 2 - [^[=a=]]\+ eng 1 ambi single: 0 eng 1 ambi double: 0 eng 2 ambi single: 0 eng 2 ambi double: 0
{ "pile_set_name": "Github" }
var functionNoVendorRegexStr = '[A-Z]+(\\-|[A-Z]|[0-9])+\\(.*?\\)'; var functionVendorRegexStr = '\\-(\\-|[A-Z]|[0-9])+\\(.*?\\)'; var variableRegexStr = 'var\\(\\-\\-[^\\)]+\\)'; var functionAnyRegexStr = '(' + variableRegexStr + '|' + functionNoVendorRegexStr + '|' + functionVendorRegexStr + ')'; var calcRegex = new RegExp('^(\\-moz\\-|\\-webkit\\-)?calc\\([^\\)]+\\)$', 'i'); var decimalRegex = /[0-9]/; var functionAnyRegex = new RegExp('^' + functionAnyRegexStr + '$', 'i'); var hslColorRegex = /^hsl\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31}\)|hsla\(\s{0,31}[\-\.]?\d+\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+%\s{0,31},\s{0,31}\.?\d+\s{0,31}\)$/; var identifierRegex = /^(\-[a-z0-9_][a-z0-9\-_]*|[a-z][a-z0-9\-_]*)$/i; var namedEntityRegex = /^[a-z]+$/i; var prefixRegex = /^-([a-z0-9]|-)*$/i; var rgbColorRegex = /^rgb\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31}\)|rgba\(\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\d]{1,3}\s{0,31},\s{0,31}[\.\d]+\s{0,31}\)$/; var timingFunctionRegex = /^(cubic\-bezier|steps)\([^\)]+\)$/; var validTimeUnits = ['ms', 's']; var urlRegex = /^url\([\s\S]+\)$/i; var variableRegex = new RegExp('^' + variableRegexStr + '$', 'i'); var eightValueColorRegex = /^#[0-9a-f]{8}$/i; var fourValueColorRegex = /^#[0-9a-f]{4}$/i; var sixValueColorRegex = /^#[0-9a-f]{6}$/i; var threeValueColorRegex = /^#[0-9a-f]{3}$/i; var DECIMAL_DOT = '.'; var MINUS_SIGN = '-'; var PLUS_SIGN = '+'; var Keywords = { '^': [ 'inherit', 'initial', 'unset' ], '*-style': [ 'auto', 'dashed', 'dotted', 'double', 'groove', 'hidden', 'inset', 'none', 'outset', 'ridge', 'solid' ], '*-timing-function': [ 'ease', 'ease-in', 'ease-in-out', 'ease-out', 'linear', 'step-end', 'step-start' ], 'animation-direction': [ 'alternate', 'alternate-reverse', 'normal', 'reverse' ], 'animation-fill-mode': [ 'backwards', 'both', 'forwards', 'none' ], 'animation-iteration-count': [ 'infinite' ], 'animation-name': [ 'none' ], 'animation-play-state': [ 'paused', 'running' ], 'background-attachment': [ 'fixed', 'inherit', 'local', 'scroll' ], 'background-clip': [ 'border-box', 'content-box', 'inherit', 'padding-box', 'text' ], 'background-origin': [ 'border-box', 'content-box', 'inherit', 'padding-box' ], 'background-position': [ 'bottom', 'center', 'left', 'right', 'top' ], 'background-repeat': [ 'no-repeat', 'inherit', 'repeat', 'repeat-x', 'repeat-y', 'round', 'space' ], 'background-size': [ 'auto', 'cover', 'contain' ], 'border-collapse': [ 'collapse', 'inherit', 'separate' ], 'bottom': [ 'auto' ], 'clear': [ 'both', 'left', 'none', 'right' ], 'color': [ 'transparent' ], 'cursor': [ 'all-scroll', 'auto', 'col-resize', 'crosshair', 'default', 'e-resize', 'help', 'move', 'n-resize', 'ne-resize', 'no-drop', 'not-allowed', 'nw-resize', 'pointer', 'progress', 'row-resize', 's-resize', 'se-resize', 'sw-resize', 'text', 'vertical-text', 'w-resize', 'wait' ], 'display': [ 'block', 'inline', 'inline-block', 'inline-table', 'list-item', 'none', 'table', 'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row', 'table-row-group' ], 'float': [ 'left', 'none', 'right' ], 'left': [ 'auto' ], 'font': [ 'caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar', 'unset' ], 'font-size': [ 'large', 'larger', 'medium', 'small', 'smaller', 'x-large', 'x-small', 'xx-large', 'xx-small' ], 'font-stretch': [ 'condensed', 'expanded', 'extra-condensed', 'extra-expanded', 'normal', 'semi-condensed', 'semi-expanded', 'ultra-condensed', 'ultra-expanded' ], 'font-style': [ 'italic', 'normal', 'oblique' ], 'font-variant': [ 'normal', 'small-caps' ], 'font-weight': [ '100', '200', '300', '400', '500', '600', '700', '800', '900', 'bold', 'bolder', 'lighter', 'normal' ], 'line-height': [ 'normal' ], 'list-style-position': [ 'inside', 'outside' ], 'list-style-type': [ 'armenian', 'circle', 'decimal', 'decimal-leading-zero', 'disc', 'decimal|disc', // this is the default value of list-style-type, see comment in compactable.js 'georgian', 'lower-alpha', 'lower-greek', 'lower-latin', 'lower-roman', 'none', 'square', 'upper-alpha', 'upper-latin', 'upper-roman' ], 'overflow': [ 'auto', 'hidden', 'scroll', 'visible' ], 'position': [ 'absolute', 'fixed', 'relative', 'static' ], 'right': [ 'auto' ], 'text-align': [ 'center', 'justify', 'left', 'left|right', // this is the default value of list-style-type, see comment in compactable.js 'right' ], 'text-decoration': [ 'line-through', 'none', 'overline', 'underline' ], 'text-overflow': [ 'clip', 'ellipsis' ], 'top': [ 'auto' ], 'vertical-align': [ 'baseline', 'bottom', 'middle', 'sub', 'super', 'text-bottom', 'text-top', 'top' ], 'visibility': [ 'collapse', 'hidden', 'visible' ], 'white-space': [ 'normal', 'nowrap', 'pre' ], 'width': [ 'inherit', 'initial', 'medium', 'thick', 'thin' ] }; var Units = [ '%', 'ch', 'cm', 'em', 'ex', 'in', 'mm', 'pc', 'pt', 'px', 'rem', 'vh', 'vm', 'vmax', 'vmin', 'vw' ]; function isColor(value) { return value != 'auto' && ( isKeyword('color')(value) || isHexColor(value) || isColorFunction(value) || isNamedEntity(value) ); } function isColorFunction(value) { return isRgbColor(value) || isHslColor(value); } function isDynamicUnit(value) { return calcRegex.test(value); } function isFunction(value) { return functionAnyRegex.test(value); } function isHexColor(value) { return threeValueColorRegex.test(value) || fourValueColorRegex.test(value) || sixValueColorRegex.test(value) || eightValueColorRegex.test(value); } function isHslColor(value) { return hslColorRegex.test(value); } function isIdentifier(value) { return identifierRegex.test(value); } function isImage(value) { return value == 'none' || value == 'inherit' || isUrl(value); } function isKeyword(propertyName) { return function(value) { return Keywords[propertyName].indexOf(value) > -1; }; } function isNamedEntity(value) { return namedEntityRegex.test(value); } function isNumber(value) { return scanForNumber(value) == value.length; } function isRgbColor(value) { return rgbColorRegex.test(value); } function isPrefixed(value) { return prefixRegex.test(value); } function isPositiveNumber(value) { return isNumber(value) && parseFloat(value) >= 0; } function isVariable(value) { return variableRegex.test(value); } function isTime(value) { var numberUpTo = scanForNumber(value); return numberUpTo == value.length && parseInt(value) === 0 || numberUpTo > -1 && validTimeUnits.indexOf(value.slice(numberUpTo + 1)) > -1; } function isTimingFunction() { var isTimingFunctionKeyword = isKeyword('*-timing-function'); return function (value) { return isTimingFunctionKeyword(value) || timingFunctionRegex.test(value); }; } function isUnit(validUnits, value) { var numberUpTo = scanForNumber(value); return numberUpTo == value.length && parseInt(value) === 0 || numberUpTo > -1 && validUnits.indexOf(value.slice(numberUpTo + 1)) > -1 || value == 'auto' || value == 'inherit'; } function isUrl(value) { return urlRegex.test(value); } function isZIndex(value) { return value == 'auto' || isNumber(value) || isKeyword('^')(value); } function scanForNumber(value) { var hasDot = false; var hasSign = false; var character; var i, l; for (i = 0, l = value.length; i < l; i++) { character = value[i]; if (i === 0 && (character == PLUS_SIGN || character == MINUS_SIGN)) { hasSign = true; } else if (i > 0 && hasSign && (character == PLUS_SIGN || character == MINUS_SIGN)) { return i - 1; } else if (character == DECIMAL_DOT && !hasDot) { hasDot = true; } else if (character == DECIMAL_DOT && hasDot) { return i - 1; } else if (decimalRegex.test(character)) { continue; } else { return i - 1; } } return i; } function validator(compatibility) { var validUnits = Units.slice(0).filter(function (value) { return !(value in compatibility.units) || compatibility.units[value] === true; }); return { colorOpacity: compatibility.colors.opacity, isAnimationDirectionKeyword: isKeyword('animation-direction'), isAnimationFillModeKeyword: isKeyword('animation-fill-mode'), isAnimationIterationCountKeyword: isKeyword('animation-iteration-count'), isAnimationNameKeyword: isKeyword('animation-name'), isAnimationPlayStateKeyword: isKeyword('animation-play-state'), isTimingFunction: isTimingFunction(), isBackgroundAttachmentKeyword: isKeyword('background-attachment'), isBackgroundClipKeyword: isKeyword('background-clip'), isBackgroundOriginKeyword: isKeyword('background-origin'), isBackgroundPositionKeyword: isKeyword('background-position'), isBackgroundRepeatKeyword: isKeyword('background-repeat'), isBackgroundSizeKeyword: isKeyword('background-size'), isColor: isColor, isColorFunction: isColorFunction, isDynamicUnit: isDynamicUnit, isFontKeyword: isKeyword('font'), isFontSizeKeyword: isKeyword('font-size'), isFontStretchKeyword: isKeyword('font-stretch'), isFontStyleKeyword: isKeyword('font-style'), isFontVariantKeyword: isKeyword('font-variant'), isFontWeightKeyword: isKeyword('font-weight'), isFunction: isFunction, isGlobal: isKeyword('^'), isHslColor: isHslColor, isIdentifier: isIdentifier, isImage: isImage, isKeyword: isKeyword, isLineHeightKeyword: isKeyword('line-height'), isListStylePositionKeyword: isKeyword('list-style-position'), isListStyleTypeKeyword: isKeyword('list-style-type'), isNumber: isNumber, isPrefixed: isPrefixed, isPositiveNumber: isPositiveNumber, isRgbColor: isRgbColor, isStyleKeyword: isKeyword('*-style'), isTime: isTime, isUnit: isUnit.bind(null, validUnits), isUrl: isUrl, isVariable: isVariable, isWidth: isKeyword('width'), isZIndex: isZIndex }; } module.exports = validator;
{ "pile_set_name": "Github" }
TEMPLATE = app DEPENDPATH += . OBJECTS_DIR = .obj MOC_DIR = .moc SOURCES += main.cpp QT = core gui CONFIG -= release CONFIG += debug
{ "pile_set_name": "Github" }
# text-table generate borderless text table strings suitable for printing to stdout [![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table) [![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table) # example ### default align ``` js var table = require('text-table'); var t = table([ [ 'master', '0123456789abcdef' ], [ 'staging', 'fedcba9876543210' ] ]); console.log(t); ``` ``` master 0123456789abcdef staging fedcba9876543210 ``` ### left-right align ``` js var table = require('text-table'); var t = table([ [ 'beep', '1024' ], [ 'boop', '33450' ], [ 'foo', '1006' ], [ 'bar', '45' ] ], { align: [ 'l', 'r' ] }); console.log(t); ``` ``` beep 1024 boop 33450 foo 1006 bar 45 ``` ### dotted align ``` js var table = require('text-table'); var t = table([ [ 'beep', '1024' ], [ 'boop', '334.212' ], [ 'foo', '1006' ], [ 'bar', '45.6' ], [ 'baz', '123.' ] ], { align: [ 'l', '.' ] }); console.log(t); ``` ``` beep 1024 boop 334.212 foo 1006 bar 45.6 baz 123. ``` ### centered ``` js var table = require('text-table'); var t = table([ [ 'beep', '1024', 'xyz' ], [ 'boop', '3388450', 'tuv' ], [ 'foo', '10106', 'qrstuv' ], [ 'bar', '45', 'lmno' ] ], { align: [ 'l', 'c', 'l' ] }); console.log(t); ``` ``` beep 1024 xyz boop 3388450 tuv foo 10106 qrstuv bar 45 lmno ``` # methods ``` js var table = require('text-table') ``` ### var s = table(rows, opts={}) Return a formatted table string `s` from an array of `rows` and some options `opts`. `rows` should be an array of arrays containing strings, numbers, or other printable values. options can be: * `opts.hsep` - separator to use between columns, default `' '` * `opts.align` - array of alignment types for each column, default `['l','l',...]` * `opts.stringLength` - callback function to use when calculating the string length alignment types are: * `'l'` - left * `'r'` - right * `'c'` - center * `'.'` - decimal # install With [npm](https://npmjs.org) do: ``` npm install text-table ``` # Use with ANSI-colors Since the string length of ANSI color schemes does not equal the length JavaScript sees internally it is necessary to pass the a custom string length calculator during the main function call. See the `test/ansi-colors.js` file for an example. # license MIT
{ "pile_set_name": "Github" }
/* * Created by SharpDevelop. * User: Alexander Petrovskiy * Date: 12/24/2012 * Time: 1:54 PM * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; namespace Tmx.Helpers.UnderlyingCode.Commands { /// <summary> /// Description of BddSetCurrentFeatureDataCommand. /// </summary> public class BddSetCurrentFeatureDataCommand { public BddSetCurrentFeatureDataCommand() { } } }
{ "pile_set_name": "Github" }
/* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // sv_game.c -- interface to the game dll #include "server.h" game_export_t *ge; /* =============== PF_Unicast Sends the contents of the mutlicast buffer to a single client =============== */ void PF_Unicast (edict_t *ent, qboolean reliable) { int p; client_t *client; if (!ent) return; p = NUM_FOR_EDICT(ent); if (p < 1 || p > maxclients->value) return; client = svs.clients + (p-1); if (reliable) SZ_Write (&client->netchan.message, sv.multicast.data, sv.multicast.cursize); else SZ_Write (&client->datagram, sv.multicast.data, sv.multicast.cursize); SZ_Clear (&sv.multicast); } /* =============== PF_dprintf Debug print to server console =============== */ void PF_dprintf (char *fmt, ...) { char msg[1024]; va_list argptr; va_start (argptr,fmt); vsprintf (msg, fmt, argptr); va_end (argptr); Com_Printf ("%s", msg); } /* =============== PF_cprintf Print to a single client =============== */ void PF_cprintf (edict_t *ent, int level, char *fmt, ...) { char msg[1024]; va_list argptr; int n; if (ent) { n = NUM_FOR_EDICT(ent); if (n < 1 || n > maxclients->value) Com_Error (ERR_DROP, "cprintf to a non-client"); } va_start (argptr,fmt); vsprintf (msg, fmt, argptr); va_end (argptr); if (ent) SV_ClientPrintf (svs.clients+(n-1), level, "%s", msg); else Com_Printf ("%s", msg); } /* =============== PF_centerprintf centerprint to a single client =============== */ void PF_centerprintf (edict_t *ent, char *fmt, ...) { char msg[1024]; va_list argptr; int n; n = NUM_FOR_EDICT(ent); if (n < 1 || n > maxclients->value) return; // Com_Error (ERR_DROP, "centerprintf to a non-client"); va_start (argptr,fmt); vsprintf (msg, fmt, argptr); va_end (argptr); MSG_WriteByte (&sv.multicast,svc_centerprint); MSG_WriteString (&sv.multicast,msg); PF_Unicast (ent, true); } /* =============== PF_error Abort the server with a game error =============== */ void PF_error (char *fmt, ...) { char msg[1024]; va_list argptr; va_start (argptr,fmt); vsprintf (msg, fmt, argptr); va_end (argptr); Com_Error (ERR_DROP, "Game Error: %s", msg); } /* ================= PF_setmodel Also sets mins and maxs for inline bmodels ================= */ void PF_setmodel (edict_t *ent, char *name) { int i; cmodel_t *mod; if (!name) Com_Error (ERR_DROP, "PF_setmodel: NULL"); i = SV_ModelIndex (name); // ent->model = name; ent->s.modelindex = i; // if it is an inline model, get the size information for it if (name[0] == '*') { mod = CM_InlineModel (name); VectorCopy (mod->mins, ent->mins); VectorCopy (mod->maxs, ent->maxs); SV_LinkEdict (ent); } } /* =============== PF_Configstring =============== */ void PF_Configstring (int index, char *val) { if (index < 0 || index >= MAX_CONFIGSTRINGS) Com_Error (ERR_DROP, "configstring: bad index %i\n", index); if (!val) val = ""; // change the string in sv strcpy (sv.configstrings[index], val); if (sv.state != ss_loading) { // send the update to everyone SZ_Clear (&sv.multicast); MSG_WriteChar (&sv.multicast, svc_configstring); MSG_WriteShort (&sv.multicast, index); MSG_WriteString (&sv.multicast, val); SV_Multicast (vec3_origin, MULTICAST_ALL_R); } } void PF_WriteChar (int c) {MSG_WriteChar (&sv.multicast, c);} void PF_WriteByte (int c) {MSG_WriteByte (&sv.multicast, c);} void PF_WriteShort (int c) {MSG_WriteShort (&sv.multicast, c);} void PF_WriteLong (int c) {MSG_WriteLong (&sv.multicast, c);} void PF_WriteFloat (float f) {MSG_WriteFloat (&sv.multicast, f);} void PF_WriteString (char *s) {MSG_WriteString (&sv.multicast, s);} void PF_WritePos (vec3_t pos) {MSG_WritePos (&sv.multicast, pos);} void PF_WriteDir (vec3_t dir) {MSG_WriteDir (&sv.multicast, dir);} void PF_WriteAngle (float f) {MSG_WriteAngle (&sv.multicast, f);} /* ================= PF_inPVS Also checks portalareas so that doors block sight ================= */ qboolean PF_inPVS (vec3_t p1, vec3_t p2) { int leafnum; int cluster; int area1, area2; byte *mask; leafnum = CM_PointLeafnum (p1); cluster = CM_LeafCluster (leafnum); area1 = CM_LeafArea (leafnum); mask = CM_ClusterPVS (cluster); leafnum = CM_PointLeafnum (p2); cluster = CM_LeafCluster (leafnum); area2 = CM_LeafArea (leafnum); if ( mask && (!(mask[cluster>>3] & (1<<(cluster&7)) ) ) ) return false; if (!CM_AreasConnected (area1, area2)) return false; // a door blocks sight return true; } /* ================= PF_inPHS Also checks portalareas so that doors block sound ================= */ qboolean PF_inPHS (vec3_t p1, vec3_t p2) { int leafnum; int cluster; int area1, area2; byte *mask; leafnum = CM_PointLeafnum (p1); cluster = CM_LeafCluster (leafnum); area1 = CM_LeafArea (leafnum); mask = CM_ClusterPHS (cluster); leafnum = CM_PointLeafnum (p2); cluster = CM_LeafCluster (leafnum); area2 = CM_LeafArea (leafnum); if ( mask && (!(mask[cluster>>3] & (1<<(cluster&7)) ) ) ) return false; // more than one bounce away if (!CM_AreasConnected (area1, area2)) return false; // a door blocks hearing return true; } void PF_StartSound (edict_t *entity, int channel, int sound_num, float volume, float attenuation, float timeofs) { if (!entity) return; SV_StartSound (NULL, entity, channel, sound_num, volume, attenuation, timeofs); } //============================================== /* =============== SV_ShutdownGameProgs Called when either the entire server is being killed, or it is changing to a different game directory. =============== */ void SV_ShutdownGameProgs (void) { if (!ge) return; ge->Shutdown (); Sys_UnloadGame (); ge = NULL; } /* =============== SV_InitGameProgs Init the game subsystem for a new map =============== */ void SCR_DebugGraph (float value, int color); void SV_InitGameProgs (void) { game_import_t import; // unload anything we have now if (ge) SV_ShutdownGameProgs (); // load a new game dll import.multicast = SV_Multicast; import.unicast = PF_Unicast; import.bprintf = SV_BroadcastPrintf; import.dprintf = PF_dprintf; import.cprintf = PF_cprintf; import.centerprintf = PF_centerprintf; import.error = PF_error; import.linkentity = SV_LinkEdict; import.unlinkentity = SV_UnlinkEdict; import.BoxEdicts = SV_AreaEdicts; import.trace = SV_Trace; import.pointcontents = SV_PointContents; import.setmodel = PF_setmodel; import.inPVS = PF_inPVS; import.inPHS = PF_inPHS; import.Pmove = Pmove; import.modelindex = SV_ModelIndex; import.soundindex = SV_SoundIndex; import.imageindex = SV_ImageIndex; import.configstring = PF_Configstring; import.sound = PF_StartSound; import.positioned_sound = SV_StartSound; import.WriteChar = PF_WriteChar; import.WriteByte = PF_WriteByte; import.WriteShort = PF_WriteShort; import.WriteLong = PF_WriteLong; import.WriteFloat = PF_WriteFloat; import.WriteString = PF_WriteString; import.WritePosition = PF_WritePos; import.WriteDir = PF_WriteDir; import.WriteAngle = PF_WriteAngle; import.TagMalloc = Z_TagMalloc; import.TagFree = Z_Free; import.FreeTags = Z_FreeTags; import.cvar = Cvar_Get; import.cvar_set = Cvar_Set; import.cvar_forceset = Cvar_ForceSet; import.argc = Cmd_Argc; import.argv = Cmd_Argv; import.args = Cmd_Args; import.AddCommandString = Cbuf_AddText; import.DebugGraph = SCR_DebugGraph; import.SetAreaPortalState = CM_SetAreaPortalState; import.AreasConnected = CM_AreasConnected; ge = (game_export_t *)Sys_GetGameAPI (&import); if (!ge) Com_Error (ERR_DROP, "failed to load game DLL"); if (ge->apiversion != GAME_API_VERSION) Com_Error (ERR_DROP, "game is version %i, not %i", ge->apiversion, GAME_API_VERSION); ge->Init (); }
{ "pile_set_name": "Github" }
/* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_messagebox_h #define _SDL_messagebox_h #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief SDL_MessageBox flags. If supported will display warning icon, etc. */ typedef enum { SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ } SDL_MessageBoxFlags; /** * \brief Flags for SDL_MessageBoxButtonData. */ typedef enum { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ } SDL_MessageBoxButtonFlags; /** * \brief Individual button data. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char * text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; /** * \brief RGB value used in a message box color scheme */ typedef struct { Uint8 r, g, b; } SDL_MessageBoxColor; typedef enum { SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_MAX } SDL_MessageBoxColorType; /** * \brief A set of colors to use for message box dialogs */ typedef struct { SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; } SDL_MessageBoxColorScheme; /** * \brief MessageBox structure containing title, text, window, etc. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxFlags */ SDL_Window *window; /**< Parent window, can be NULL */ const char *title; /**< UTF-8 title */ const char *message; /**< UTF-8 message text */ int numbuttons; const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ } SDL_MessageBoxData; /** * \brief Create a modal message box. * * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. * \param buttonid The pointer to which user id of hit button should be copied. * * \return -1 on error, otherwise 0 and buttonid contains user id of button * hit or -1 if dialog was closed. * * \note This function should be called on the thread that created the parent * window, or on the main thread if the messagebox has no parent. It will * block execution of that thread until the user clicks a button or * closes the messagebox. */ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); /** * \brief Create a simple modal message box * * \param flags ::SDL_MessageBoxFlags * \param title UTF-8 title text * \param message UTF-8 message text * \param window The parent window, or NULL for no parent * * \return 0 on success, -1 on error * * \sa SDL_ShowMessageBox */ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_messagebox_h */ /* vi: set ts=4 sw=4 expandtab: */
{ "pile_set_name": "Github" }