code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 3 1.01M |
|---|---|---|---|---|---|
#callme { height: 151px; position: fixed; *position: absolute; top: 150px; right: 0; width: 22px; z-index: 110; }
.cme-form { border: 1px solid #bbc1ce; -moz-box-shadow: 0 2px 20px #333333; -webkit-box-shadow: 0 2px 20px #333333; box-shadow: 0 2px 20px #333333; -webkit-border-radius: 5px; -moz-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px; background: white; z-index: 109; font-family: "Lucida Grande", Tahoma; display: none; position: fixed; *position: absolute; right: 50px; top: 150px; width: 305px; color: gray; }
.cme-form .has-error { background: #f2dede; }
.cme-form span { padding: 2px 3px 2px 10px; display: block; color: gray; font-size: 11px; clear: both; }
.cme-form .cme-btn { padding: 4px 7px 5px; color: white; font-size: 13px; font-weight: bold; border-radius: 0px; text-shadow: 0 1px 0 #757575; margin: 0; cursor: pointer; width: 140px; outline: 0; }
.cme-form select { border: 1px solid #98a198; background: white; padding: 4px 3px 3px 9px; width: 100%; font-size: 12px; border-radius: 0px; outline-style: none; height: 21px; line-height: 21px; margin: 0 0 5px 0; font-size: 12px; cursor: pointer; font-family: "Lucida Grande", Tahoma; outline: 0; }
.cme-form .cme-select { width: 280px; margin-left: 10px; height: 27px; line-height: 27px; }
.cme-form .cme-txt { border: 1px solid #98a198; width: 280px; border-radius: 0px; color: black; font-size: 12px; padding: 5px 3px !important; outline: 0; }
.cme-form h6 { border-bottom: 1px solid #e9e9e9; color: #3b5998; font-size: 13px; padding: 10px 0 9px 10px; margin: 0 0 7px 0; }
.cme-form span div { float: left; display: inline; margin: 0 5px 0 0; line-height: 19px; }
.cme-form .cme-cls { text-shadow: 0 1px 0 #4d659f; height: 20px; width: 20px; font-size: 13px; overflow: hidden; border-radius: 2px; text-align: center; padding: 0 3px 3px; float: right; display: inline; color: white; text-shadow: none; margin: 7px 8px 0 0; cursor: pointer; text-decoration: none; }
.cme-form .cme-cls:hover { color: white; opacity: 0.8; -webkit-opacity: 0.8; -khtml-opacity: 0.8; -moz-opacity: 0.8; filter: alpha(opacity=80); -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=$p)"; }
.cme-form .cme-btn-place span { display: inline; float: right; padding: 7px 12px 0 0 !important; font-size: 8px !important; color: #888 !important; }
.cme-form .cme-btn-place span a { font-size: 11px; color: #888; }
.cme-form .cme-btn-place span a:hover { text-decoration: none; }
.cme-form .callmebody { font-size: 13px; background: white; padding: 5px 10px; }
.cme-form .callmebody .inf { padding: 0 5px; margin: 0 0 10px 0; font-weight: bold; clear: both; }
.cme-form .callme-result { background: white url(loading.gif) 10px center no-repeat; display: block; clear: both; margin: 5px 11px 10px 10px; }
.cme-form .callme-result div { padding: 7px 7px; margin: 4px 0 0 0; }
.cme-form .callme-result div.sending { padding: 7px 0 7px 35px; display: block; color: gray; clear: both; }
.cme-form .callme-result div.c_success { background: #98c462; color: #fff; text-shadow: none; }
.cme-form .callme-result div.c_error { background: #f76363; color: #fffafa; text-shadow: none; }
#viewform { border: 0; padding: 0; background: url(bttn.png); height: 185px; width: 22px; cursor: pointer; outline: 0; }
#cme-back { display: none; z-index: 108; opacity: 0.5; top: 0; left: 0; width: 100%; height: 100%; position: absolute; background: #333; }
.cme-btn, .cme-form .cme-btn { border-top: 1px solid #8a9cc2; border-right: 1px solid #4b5e84; border-bottom: 1px solid #4b5e84; border-left: 1px solid #4b5e84; -moz-box-shadow: 0 -1px 0 #4b5e84; -webkit-box-shadow: 0 -1px 0 #4b5e84; box-shadow: 0 -1px 0 #4b5e84; background: #637bad; }
.cme-cls, .cme-form .cme-cls { background: #4d659f; }
| sgaluzin/pechki | callme/templates/fb/style.css | CSS | gpl-2.0 | 3,750 |
<?php
/*
homepage: http://arc.semsol.org/
license: http://arc.semsol.org/license
class: ARC2 RDF/XML Serializer
author: Benjamin Nowack
version: 2009-02-12 (Fix: scheme-detection: scheme must have at least 2 chars, thanks to Eric Schoonover)
*/
ARC2::inc('RDFSerializer');
class ARC2_RDFXMLSerializer extends ARC2_RDFSerializer {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_RDFXMLSerializer($a = '', &$caller) {
$this->__construct($a, $caller);
}
function __init() {
parent::__init();
$this->content_header = 'application/rdf+xml';
$this->pp_containers = $this->v('serializer_prettyprint_containers', 0, $this->a);
}
/* */
function getTerm($v, $type) {
if (!is_array($v)) {/* uri or bnode */
if (preg_match('/^\_\:(.*)$/', $v, $m)) {
return ' rdf:nodeID="' . $m[1] . '"';
}
if ($type == 's') {
return ' rdf:about="' . htmlspecialchars($v) . '"';
}
if ($type == 'p') {
if ($pn = $this->getPName($v)) {
return $pn;
}
return 0;
}
if ($type == 'o') {
$v = $this->expandPName($v);
if (!preg_match('/^[a-z0-9]{2,}\:[^\s]+$/is', $v)) return $this->getTerm(array('value' => $v, 'type' => 'literal'), $type);
return ' rdf:resource="' . htmlspecialchars($v) . '"';
}
if ($type == 'datatype') {
$v = $this->expandPName($v);
return ' rdf:datatype="' . htmlspecialchars($v) . '"';
}
if ($type == 'lang') {
return ' xml:lang="' . htmlspecialchars($v) . '"';
}
}
if ($v['type'] != 'literal') {
return $this->getTerm($v['value'], 'o');
}
/* literal */
$dt = isset($v['datatype']) ? $v['datatype'] : '';
$lang = isset($v['lang']) ? $v['lang'] : '';
if ($dt == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {
return ' rdf:parseType="Literal">' . $v['value'];
}
elseif ($dt) {
return $this->getTerm($dt, 'datatype') . '>' . htmlspecialchars($v['value']);
}
elseif ($lang) {
return $this->getTerm($lang, 'lang') . '>' . htmlspecialchars($v['value']);
}
return '>' . htmlspecialchars($v['value']);
}
function getHead() {
$r = '';
$nl = "\n";
$r .= '<?xml version="1.0" encoding="UTF-8"?>';
$r .= $nl . '<rdf:RDF';
$first_ns = 1;
foreach ($this->used_ns as $v) {
$r .= $first_ns ? ' ' : $nl . ' ';
$r .= 'xmlns:' . $this->nsp[$v] . '="' .$v. '"';
$first_ns = 0;
}
$r .= '>';
return $r;
}
function getFooter() {
$r = '';
$nl = "\n";
$r .= $nl . $nl . '</rdf:RDF>';
return $r;
}
function getSerializedIndex($index, $raw = 0) {
$r = '';
$nl = "\n";
foreach ($index as $raw_s => $ps) {
$r .= $r ? $nl . $nl : '';
$s = $this->getTerm($raw_s, 's');
$tag = 'rdf:Description';
$sub_ps = 0;
/* pretty containers */
if ($this->pp_containers && ($ctag = $this->getContainerTag($ps))) {
$tag = 'rdf:' . $ctag;
list($ps, $sub_ps) = $this->splitContainerEntries($ps);
}
$r .= ' <' . $tag . '' .$s . '>';
$first_p = 1;
foreach ($ps as $p => $os) {
if (!$os) continue;
if ($p = $this->getTerm($p, 'p')) {
$r .= $nl . str_pad('', 4);
$first_o = 1;
if (!is_array($os)) {/* single literal o */
$os = array(array('value' => $os, 'type' => 'literal'));
}
foreach ($os as $o) {
$o = $this->getTerm($o, 'o');
$r .= $first_o ? '' : $nl . ' ';
$r .= '<' . $p;
$r .= $o;
$r .= preg_match('/\>/', $o) ? '</' . $p . '>' : '/>';
$first_o = 0;
}
$first_p = 0;
}
}
$r .= $r ? $nl . ' </' . $tag . '>' : '';
if ($sub_ps) $r .= $nl . $nl . $this->getSerializedIndex(array($raw_s => $sub_ps), 1);
}
if ($raw) {
return $r;
}
return $this->getHead() . $nl . $nl . $r . $this->getFooter();
}
/* */
function getContainerTag($ps) {
$rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
if (!isset($ps[$rdf . 'type'])) return '';
$types = $ps[$rdf . 'type'];
foreach ($types as $type) {
if (!in_array($type['value'], array($rdf . 'Bag', $rdf . 'Seq', $rdf . 'Alt'))) return '';
return str_replace($rdf, '', $type['value']);
}
}
function splitContainerEntries($ps) {
$rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
$items = array();
$rest = array();
foreach ($ps as $p => $os) {
$p_short = str_replace($rdf, '', $p);
if ($p_short === 'type') continue;
if (preg_match('/^\_([0-9]+)$/', $p_short, $m)) {
$items = array_merge($items, $os);
}
else {
$rest[$p] = $os;
}
}
if ($items) return array(array($rdf . 'li' => $items), $rest);
return array($rest, 0);
}
/* */
}
| baxtree/OKBook | sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFXMLSerializer.php | PHP | gpl-2.0 | 5,008 |
<?php
/**
*
* Board Rules extension for the phpBB Forum Software package.
*
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace phpbb\boardrules\tests\operators;
class rule_operator_move_test extends rule_operator_base
{
/**
* Test data for the test_move_rules() function
*
* @return array Array of test data
*/
public function move_rules_test_data()
{
return array(
array(
1,
'up', // Move item 1 up (not expected to move)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
2,
'up', // Move item 2 up
array(
array('rule_id' => 2, 'rule_left_id' => 1),
array('rule_id' => 1, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
3,
'up', // Move item 3 up
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 3, 'rule_left_id' => 3),
array('rule_id' => 2, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
4,
'up', // Move item 4 up (carries its child item 5 along)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 4, 'rule_left_id' => 5),
array('rule_id' => 5, 'rule_left_id' => 6),
array('rule_id' => 3, 'rule_left_id' => 9),
),
),
array(
5,
'up', // Move item 5 up (not expected to move because it's a child of item 4)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
1,
'down', // Move item 1 down
array(
array('rule_id' => 2, 'rule_left_id' => 1),
array('rule_id' => 1, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
2,
'down', // Move item 2 down
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 3, 'rule_left_id' => 3),
array('rule_id' => 2, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
3,
'down', // Move item 3 down (moves past 4 and 5 which are nested)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 4, 'rule_left_id' => 5),
array('rule_id' => 5, 'rule_left_id' => 6),
array('rule_id' => 3, 'rule_left_id' => 9),
),
),
array(
4,
'down', // Move item 4 down (not expected to move)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
array(
5,
'down', // Move item 5 down (not expected to move because it's a child of item 4)
array(
array('rule_id' => 1, 'rule_left_id' => 1),
array('rule_id' => 2, 'rule_left_id' => 3),
array('rule_id' => 3, 'rule_left_id' => 5),
array('rule_id' => 4, 'rule_left_id' => 7),
array('rule_id' => 5, 'rule_left_id' => 8),
),
),
);
}
/**
* Test moving rules up and down
*
* @dataProvider move_rules_test_data
*/
public function test_move_rules($rule_id, $direction, $expected)
{
// Setup the operator class
$operator = $this->get_rule_operator();
$operator->move($rule_id, $direction);
$result = $this->db->sql_query('SELECT rule_id, rule_left_id
FROM phpbb_boardrules
ORDER BY rule_left_id ASC');
self::assertEquals($expected, $this->db->sql_fetchrowset($result));
$this->db->sql_freeresult($result);
}
/**
* Test data for the test_move_rules_fails() function
*
* @return array Array of test data
*/
public function move_rules_fails_data()
{
return array(
array(10),
);
}
/**
* Test moving non-existent rules which should throw an exception
*
* @dataProvider move_rules_fails_data
*/
public function test_move_rules_fails($rule_id)
{
$this->expectException(\phpbb\boardrules\exception\base::class);
// Setup the operator class
$operator = $this->get_rule_operator();
$operator->move($rule_id);
}
}
| phpbb-extensions/boardrules | tests/operators/rule_operator_move_test.php | PHP | gpl-2.0 | 4,883 |
package dataset;
public class UndefinedSampleLengthException extends Exception {
private static final long serialVersionUID = 1L;
}
| ric2b/POO | java/src/dataset/UndefinedSampleLengthException.java | Java | gpl-2.0 | 135 |
/*
* board/omap3621_boxer/max17042.c
*
* Copyright (C) 2010 Barnes & Noble, Inc.
* Intrinsyc Software International, Inc. on behalf of Barnes & Noble, Inc.
*
* Max17042 Gas Gauge initialization for u-boot
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <common.h>
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/bits.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/sys_info.h>
#include <asm/arch/clocks.h>
#include <asm/arch/mem.h>
#include <i2c.h>
#include <asm/mach-types.h>
#define TEMP_RESOLUTION 3900 /*3900uC*/
#define COMPLEMENT_VAL(x, y, z) (( ((((~x) & 0x7FFF) + 1) * y) / z ) * (-1))
#define MAX17042_ADDR 0x36
#define MAX_WRITE(reg, val) i2c_multidata_write(MAX17042_ADDR, (reg), 1, (val), 2)
#define MAX_READ(reg, val) i2c_read_2_byte(MAX17042_ADDR,(reg), (val))
struct max17042_saved_data {
uint16_t tag;
uint16_t val_FullCAP;
uint16_t val_Cycles;
uint16_t val_FullCAPNom;
uint16_t val_SOCempty;
uint16_t val_Iavg_empty;
uint16_t val_RCOMP0;
uint16_t val_TempCo;
uint16_t val_k_empty0;
uint16_t val_dQacc;
uint16_t val_dPacc;
uint16_t val_SOCmix;
uint16_t val_Empty_TempCo;
uint16_t val_ICHGTerm;
uint16_t val_Vempty;
uint16_t val_FilterCFG;
uint16_t val_TempNom;
uint16_t val_DesignCap;
uint16_t val_Capacity;
uint16_t val_SOCREP;
};
static struct max17042_saved_data save_store;
static int is_power_on = 1; //battery flat, battery removed,
static int is_history_exist = 1; //max17042.bin is in ROM partition
static uint16_t VFSOC = 0;
#define DEBUG(x...) printf(x)
#define TEMPLIM 0x2305 // hard POR value
#define MISCCFG 0x0810 // hard POR value -- and with 0xCC1F
#define MISCCFG_MASK 0xCC1F
#define TGAIN 0xE3E1 // hard POR value
#define TOFF 0x290E // hard POR value
#define CGAIN 0x4000 // hard POR value
#define COFF 0x0000 // hard POR value
#define FCTC 0x05E0 // hard POR value
#define MAX17042_STATUS 0x00
#define MAX17042_RemCapREP 0x05
#define MAX17042_SOCREP 0x06
#define MAX17042_Vcell 0x09
#define MAX17042_SOCmix 0x0D
#define MAX17042_RemCapmix 0x0F
#define MAX17042_FullCap 0x10
#define MAX17042_Vempty 0x12
#define MAX17042_Cycles 0x17
#define MAX17042_DesignCap 0x18
#define MAX17042_CONFIG 0x1D
#define MAX17042_ICHGTerm 0x1E
#define MAX17042_Version 0x21
#define MAX17042_FullCAPNom 0x23
#define MAX17042_TempNom 0x24
#define MAX17042_TempLim 0x25
#define MAX17042_LearnCFG 0x28
#define MAX17042_RelaxCFG 0x2A
#define MAX17042_FilterCFG 0x29
#define MAX17042_MiscCFG 0x2B
#define MAX17042_TGAIN 0x2C
#define MAX17042_TOFF 0x2D
#define MAX17042_CGAIN 0x2E
#define MAX17042_COFF 0x2F
#define MAX17042_SOCempty 0x33
#define MAX17042_FullCap0 0x35
#define MAX17042_Iavg_empty 0x36
#define MAX17042_FCTC 0x37
#define MAX17042_RCOMP0 0x38
#define MAX17042_TempCo 0x39
#define MAX17042_Empty_TempCo 0x3A
#define MAX17042_k_empty0 0x3B
#define MAX17042_dQacc 0x45
#define MAX17042_dPacc 0x46
#define MAX17042_VFSOC_Unlock 0x60
#define MAX17042_OCV 0xFB
#define MAX17042_FSTAT 0xFD
#define MAX17042_SOCvf 0xFF
#define MAX17042_STATUS_bit_POR (1<<1)
typedef enum
{
BATT_LG = 0,
BATT_MCNAIR,
/* add new battery type here */
BATT_MAX
} batt_type;
// This struct contains registers for initialize configuration
typedef struct
{
uint16_t RelaxCFG;
uint16_t Config;
uint16_t FilterCFG;
uint16_t LearnCFG;
uint16_t Vempty;
uint16_t RCOMP0;
uint16_t TempCo;
uint16_t ETC;
uint16_t Kempty0;
uint16_t ICHGTerm;
uint16_t Capacity;
} max17042_init_params;
// 48-word custom model params
typedef struct
{
uint16_t buf_80h[16];
uint16_t buf_90h[16];
uint16_t buf_A0h[16];
} max17042_custom_model;
// All the registers for initializing max17042
typedef struct
{
const max17042_init_params* init_params;
const max17042_custom_model* model;
} batt_type_params;
// This table containas default initialization values provided by maxim for different battery types.
static const max17042_init_params const init_param_table[BATT_MAX] =
{
//RelaxCFG Config FilterCFG LearnCFG Vempty RCOMP0 TempCo ETC Kempty0 ICHGTerm Capacity
/*LG */{ 0x083B, 0x2210, 0x87A4, 0x2406, 0x7D5A, 0x0080, 0x3670, 0x2F2C, 0x078F, 0x0140, 0x205C},
/*MCNAIR*/{ 0x083B, 0x2210, 0x87A4, 0x2406, 0x7D5A, 0x0081, 0x1921, 0x0635, 0x0679, 0x04F3, 0x1EB9},
// add an entry here for new battery type
};
// This table containas 48-word custom model params provided by maxim for different battery types.
static const max17042_custom_model const model_table[BATT_MAX] =
{
// LG
{
/*80h*/{0xA0D0, 0xB3F0, 0xB820, 0xB940, 0xBB80, 0xBBF0, 0xBC90, 0xBD00, 0xBDA0, 0xBE80, 0xBF70, 0xC280, 0xC5B0, 0xC7F0, 0xCAB0, 0xD030},
/*90h*/{0x0100, 0x0700, 0x1400, 0x0B00, 0x2640, 0x3210, 0x1D40, 0x2C00, 0x1760, 0x15D0, 0x09C0, 0x0CE0, 0x0BD0, 0x09F0, 0x08F0, 0x08F0},
/*A0h*/{0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100},
},
// MCNAIR
{
/*80h*/{0x9EE0, 0xB660, 0xB7D0, 0xB980, 0xBB00, 0xBBD0, 0xBCA0, 0xBD70, 0xBE60, 0xBF70, 0xC0A0, 0xC410, 0xC710, 0xCA50, 0xCC80, 0xD100},
/*90h*/{0x0060, 0x13F0, 0x0AF0, 0x10B0, 0x1920, 0x2720, 0x1E30, 0x1A20, 0x1600, 0x14F0, 0x0BF0, 0x0CF0, 0x0610, 0x0A00, 0x0A80, 0x0A80},
/*A0h*/{0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100},
},
// add an entry here for new battery type
};
static const batt_type_params param_table[BATT_MAX] =
{
/*LG */ {&init_param_table[BATT_LG], &model_table[BATT_LG] },
/*MCNAIR*/ {&init_param_table[BATT_MCNAIR], &model_table[BATT_MCNAIR]},
// add an entry here for new battery type
};
static const batt_type_params* type_params = ¶m_table[BATT_LG];
static inline int max17042_dumpreg( char *pRegName, int iReg ) {
uint16_t val;
MAX_READ( iReg, (uchar*)&val);
DEBUG("%s (%02xh) is 0x%04x\n", pRegName, iReg, val );
return val;
}
#define MAX17042_DUMPREG( reg ) max17042_dumpreg( #reg, reg )
static int max17042_check_init_config(void)
{
uint16_t buf=0;
const max17042_init_params* params = type_params->init_params;
MAX_READ(MAX17042_CONFIG, (uchar*)&buf);
DEBUG("uboot verify: %02x CONFIG is %04x ; should be %04x & 0xFDFB\n",
MAX17042_CONFIG, buf, params->Config);
// in case of warm boot, kernel might have changed bits Ten and Aen
if ( (buf & ~0x0204) != ( params->Config & ~0x0204) )
return 1;
buf=0;
MAX_READ(MAX17042_RelaxCFG, (uchar*)&buf);
DEBUG("uboot verify: %02x RELAXCFG is %04x ; should be %04x\n",
MAX17042_RelaxCFG, buf, params->RelaxCFG);
if ( buf != params->RelaxCFG )
return 1;
buf=0;
MAX_READ(MAX17042_FilterCFG, (uchar*)&buf);
DEBUG("uboot verify: %02x FILTERCFG is %04x ; should be %04x\n",
MAX17042_FilterCFG, buf, params->FilterCFG);
if ( buf != params->FilterCFG )
return 1;
buf=0;
MAX_READ(MAX17042_LearnCFG, (uchar*)&buf);
DEBUG("uboot verify: %02x LEARNCFG is %04x ; should be %04x & 0xFF0F\n",
MAX17042_LearnCFG, buf, params->LearnCFG);
if ( (buf & 0xFF0F) != ( params->LearnCFG & 0xFF0F) )
return 1;
MAX_READ( MAX17042_DesignCap, (u8*)&buf);
DEBUG("uboot verify: %02x DesignCap is %04x ; should be %04x\n",
MAX17042_DesignCap, buf, params->Capacity);
if ( buf != params->Capacity )
return 1;
MAX_READ( MAX17042_Vempty, (u8*)&buf);
DEBUG("uboot verify: %02x Vempty is %04x ; should be %04x\n",
MAX17042_Vempty, buf, params->Vempty);
if ( buf != params->Vempty )
return 1;
buf=0;
MAX_READ(MAX17042_TempLim, (uchar*)&buf);
DEBUG("uboot verify: %02x TEMPLIM is %04x ; should be %04x\n",
MAX17042_TempLim, buf, TEMPLIM);
if ( buf != TEMPLIM )
return 1;
buf=0;
MAX_READ(MAX17042_MiscCFG, (uchar*)&buf);
DEBUG("uboot verify: %02x MiscCFG is %04x ; should be %04x & %04x\n",
MAX17042_MiscCFG, buf, MISCCFG, MISCCFG_MASK );
if ( (buf & MISCCFG_MASK) != (MISCCFG & MISCCFG_MASK) )
return 1;
buf=0;
MAX_READ(MAX17042_TGAIN, (uchar*)&buf);
DEBUG("uboot verify: %02x TGAIN is %04x ; should be %04x\n",
MAX17042_TGAIN, buf, TGAIN);
if ( buf != TGAIN )
return 1;
buf=0;
MAX_READ(MAX17042_TOFF, (uchar*)&buf);
DEBUG("uboot verify: %02x TOFF is %04x ; should be %04x\n",
MAX17042_TOFF, buf, TOFF);
if ( buf != TOFF )
return 1;
buf=0;
MAX_READ(MAX17042_CGAIN, (uchar*)&buf);
DEBUG("uboot verify: %02x CGAIN is %04x ; should be %04x\n",
MAX17042_CGAIN, buf, CGAIN);
if ( buf != CGAIN )
return 1;
buf=0;
MAX_READ(MAX17042_COFF, (uchar*)&buf);
DEBUG("uboot verify: %02x COFF is %04x ; should be %04x\n",
MAX17042_COFF, buf, COFF);
if ( buf != COFF )
return 1;
buf=0;
MAX_READ(MAX17042_FCTC, (uchar*)&buf);
DEBUG("uboot verify: %02x FCTC is %04x ; should be %04x\n",
MAX17042_FCTC, buf, FCTC);
if ( buf != FCTC )
return 1;
return 0;
}
static int max17042_init_config(void)
{
int err;
const max17042_init_params* params = type_params->init_params;
err =MAX_WRITE(MAX17042_CONFIG, (uchar*)&(params->Config));
if ( err != 0 ) {
DEBUG("uboot: write err CONFIG \n");
return err;
}
// DEBUG("config = 0x%04x\n", params->Config);
err =MAX_WRITE(MAX17042_RelaxCFG, (uchar*)¶ms->RelaxCFG);
if ( err != 0 ) {
DEBUG( "uboot: write err RelaxCFG \n");
return err;
}
// DEBUG("relaxcfg = 0x%04x\n", params->RelaxCFG);
err =MAX_WRITE(MAX17042_FilterCFG, (uchar*)¶ms->FilterCFG);
if ( err != 0 ) {
DEBUG( "write err FilterCFG \n");
return err;
}
// DEBUG("filtercfg = 0x%04x\n", params->FilterCFG);
err =MAX_WRITE(MAX17042_LearnCFG, (uchar*)& params->LearnCFG);
if ( err != 0 ) {
DEBUG( "write err LearnCFG\n");
return err;
}
// DEBUG("LearnCFG = 0x%04x\n", params->learncfg);
err =MAX_WRITE(MAX17042_Vempty, (uchar*)& params->Vempty);
if ( err != 0 ) {
DEBUG( "write err Vempty\n");
return err;
}
// DEBUG("Vempty = 0x%04x\n", params->Vempty);
return max17042_check_init_config();
}
int is_max17042_por(void)
{
uint16_t stat = 0;
int ret;
stat = MAX17042_DUMPREG(MAX17042_STATUS);
ret = (stat & MAX17042_STATUS_bit_POR) ? 1: 0 ;
return ret;
}
//return 1: memory lost on power_on
//return 0; memory is in place
static int is_power_on_rst(void)
{
int ret = 0;
uint16_t stat = 0;
stat = MAX17042_DUMPREG(MAX17042_STATUS);
/*POR bit check*/
/*
previous code has the operator precedence problem where
!= is evaluated before bitand !
*/
if ( (stat & MAX17042_STATUS_bit_POR) != 0 ) {
ret = 1;
}
if( (stat & (1 <<15))!=0)
DEBUG("MAX17042+UBOOT: POWER SUPPLY Detected!\n");
else
DEBUG("MAX17042+UBOOT: BATTERY Detected!\n");
is_power_on = ret;
return ret;
}
static void max17042_clear_POR(void)
{
uint16_t stat = 0;
stat = MAX17042_DUMPREG(MAX17042_STATUS);
if ( stat & MAX17042_STATUS_bit_POR ) {
DEBUG("STATUS = 0x%04x -- clearing POR\n", stat );
stat &= ~MAX17042_STATUS_bit_POR;
MAX_WRITE(MAX17042_STATUS,(uchar*)&stat);
MAX17042_DUMPREG(MAX17042_STATUS);
}
}
static int max17042_save_start_para(void)
{
int err;
uint16_t buf;
err =MAX_READ(MAX17042_SOCmix, (uchar*)&buf);
if ( err != 0 ) {
DEBUG("read err MixedSOC \n");
return err;
}
else
save_store.val_SOCmix = buf;
err =MAX_READ(MAX17042_dQacc, (uchar*)&buf);
if ( err != 0 ) {
DEBUG( "read err dQ_acc \n");
return err;
}
else
save_store.val_dQacc = buf;
err =MAX_READ(MAX17042_dPacc, (uchar*)&buf);
if ( err != 0 ) {
DEBUG( "read err dP_acc \n");
return err;
}
else
save_store.val_dPacc = buf;
return 0;
}
static void max17042_unlock_model(void)
{
static uint16_t val1 = 0x0059;
static uint16_t val2 = 0x00C4;
MAX_WRITE(0x62, (uchar*)&val1);
udelay(10);
MAX_WRITE(0x63, (uchar*)&val2);
}
static int max17042_write_model(void)
{
int i;
int err=1;
const max17042_custom_model* model = type_params->model;
for ( i = 0; i < 16; i++) {
err = MAX_WRITE((0x80+i), (uchar*)(&model->buf_80h[i]));
if ( err != 0 ) {
DEBUG( "write err model 0x80 \n");
return err;
}
//DEBUG(" %x write %04x\n", (0x80+i), model->buf_80h[i]);
udelay(10);
err = MAX_WRITE((0x90+i), (uchar*)(&model->buf_90h[i]));
if ( err != 0 ) {
DEBUG( "write err model 0x90 \n");
return err;
}
//DEBUG(" %x write %04x\n", (0x90+i), model->buf_90h[i]);
udelay(10);
MAX_WRITE((0xA0+i), (uchar*)(&model->buf_A0h[i]));
if ( err != 0 ) {
DEBUG( "write err model 0xA0 \n");
return err;
}
//DEBUG(" %x write %04x\n", (0xA0+i), model->buf_A0h[i]);
udelay(10);
}
return 0;
}
static int max17042_read_verify_model(void)
{
int i;
uint16_t buf;
int err = 1;
const max17042_custom_model* model = type_params->model;
for ( i = 0; i < 16; i++) {
err = MAX_READ((0x80+i), (uchar*)&buf);
if ( err != 0 ) {
DEBUG( "read err model 0x80 \n");
return err;
} else if ( buf != model->buf_80h[i] ) {
DEBUG(" err 80h item %d not matched\n", i);
return 1;
}
//DEBUG(" %x model: %04x\n", (0x80+i), buf);
udelay(10);
err = MAX_READ((0x90+i), (uchar*)&buf);
if ( err != 0 ) {
DEBUG( "read err model 0x90 \n");
return err;
}else if ( buf != model->buf_90h[i] ) {
DEBUG(" err 90h item %d not matched\n", i);
return 1;
}
//DEBUG(" %x model: %04x\n", (0x90+i), buf);
udelay(10);
err = MAX_READ((0xA0+i), (uchar*)&buf);
if ( err != 0 ) {
DEBUG( "read err model 0xA0 \n");
return err;
}else if ( buf != model->buf_A0h[i] ) {
DEBUG(" err A0h item %d not matched\n", i);
return 1;
}
//DEBUG(" %x model: %04x\n", (0xA0+i), buf);
udelay(10);
}
return 0;
}
static void max17042_lock_model(void)
{
static const uint16_t lock = 0x0000;
MAX_WRITE(0x62, (uchar*)&lock);
udelay(10);
MAX_WRITE(0x63, (uchar*)&lock);
udelay(100);
return;
}
static int max17042_verify_lock_model(void)
{
int i;
uint16_t buf;
int err = 1;
for ( i = 0; i < 16; i++) {
err = MAX_READ((0x80+i), (uchar*)&buf);
//DEBUG(" %x model: %04x\n", (0x80+i), buf);
if ( err != 0 ) {
DEBUG( "read err model 0x80 \n");
return err;
} else if ( buf != 0x0000 ) {
DEBUG(" err model not locked!\n", i);
return 1;
}
udelay(10);
err = MAX_READ((0x90+i), (uchar*)&buf);
//DEBUG(" %x model: %04x\n", (0x90+i), buf);
if ( err != 0 ) {
DEBUG( "read err model 0x90 \n");
return err;
}else if ( buf != 0x0000 ) {
DEBUG(" err model not locked\n", i);
return 1;
}
udelay(10);
err = MAX_READ((0xA0+i), (uchar*)&buf);
//DEBUG(" %x model: %04x\n", (0xA0+i), buf);
if ( err != 0 ) {
DEBUG( "read err model 0xA0 \n");
return err;
}else if ( buf != 0x0000 ) {
DEBUG(" err model not locked\n", i);
return 1;
}
udelay(10);
}
return 0;
}
int max17042_soft_por(void)
{
uint16_t buf = 0;
int iReps;
iReps = 0;
while ( 1 ) {
if ( iReps++ > 10 ) {
DEBUG("Soft POR : unlock failure\n");
return 1;
}
// DEBUG("Soft POR : attempting unlock\n");
max17042_lock_model();
buf = 0;
MAX_WRITE(MAX17042_STATUS, (uchar*)&buf); // clear all Status
// note: clear POR bit is not enough here
udelay(1000);
MAX_READ(MAX17042_STATUS, (uchar*)&buf);
if ( buf != 0 )
continue;
MAX_READ(0x62, (uchar*)&buf);
if ( buf != 0 )
continue;
MAX_READ(0x63, (uchar*)&buf);
if ( buf != 0 )
continue;
break;
}
// DEBUG("Soft POR: unlocked\n");
for ( iReps = 0; iReps < 10; iReps++ ) {
buf = 0x000F;
MAX_WRITE(0x60, (uchar*)&buf);
udelay(2*1000);
if ( is_max17042_por() ) {
DEBUG("Soft POR: Success!\n");
return 0;
}
}
DEBUG("Soft POR: failed\n");
return 1;
}
static int max_write_verify( u8 reg, const u8* val)
{
int err;
uint16_t buf1, buf2;
int iTmp;
buf1 = *(uint16_t*)val;
// DEBUG("%s: write 0x%04x to reg 0x%x\n", __FUNCTION__, buf1, reg );
for ( iTmp=0; iTmp < 3; iTmp++ ) {
err = MAX_WRITE( reg, (uchar*)val );
udelay(50);
err = MAX_READ( reg, (u8*)&buf2 );
if ( buf1 == buf2 )
return 0;
DEBUG("Retry write 0x%04x to reg 0x%x\n", buf1, reg );
}
DEBUG ("Failed to write 0x%04x to reg 0x%x (contains 0x%04x)\n", buf1, reg, buf2 );
return 1;
}
static int max17042_set_cycles( uint16_t cycles )
{
return max_write_verify(MAX17042_Cycles, (u8*)&cycles);
}
static int max17042_restore_fullcap(void)
{
int err;
uint16_t fullcap0, remcap, SOCmix, dPacc, dQacc;
if ( !is_history_exist ) {
printf("%s: no history file exists!\n", __FUNCTION__);
return 1;
}
DEBUG("Restoring learned full capacity\n");
err = MAX_READ(MAX17042_FullCap0, (u8*)&fullcap0);
if ( err != 0 ) {
DEBUG( "read err reg 0x%x\n", MAX17042_FullCap0);
return err;
}
err =MAX_READ(MAX17042_SOCmix, (uchar*)&SOCmix);
if ( err != 0 ) {
DEBUG( "read err reg 0x%x\n", MAX17042_SOCmix);
return err;
}
remcap = (uint16_t)( ((int)SOCmix * (int)fullcap0) / 25600 );
DEBUG("FullCap0=0x%04x SOCmix=0x%04x, remcap=0x%04x\n", fullcap0, SOCmix, remcap);
err = max_write_verify(MAX17042_RemCapmix, (u8*)&remcap);
if ( err != 0 ) {
return err;
}
err = max_write_verify(MAX17042_FullCap,(u8*)&save_store.val_FullCAP);
if ( err != 0 ) {
return err;
}
DEBUG("FullCAP = 0x%04x\n", save_store.val_FullCAP);
dQacc = (save_store.val_FullCAPNom / 4);
err = max_write_verify(MAX17042_dQacc, (u8*)&dQacc);
if ( err != 0 ) {
return err;
}
dPacc = 0x1900;
err = max_write_verify(MAX17042_dPacc, (u8*)&dPacc);
if ( err != 0 ) {
return err;
}
return 0;
}
static int max17042_restore_learned_para(void)
{
int err;
if ( !is_history_exist ) {
printf("%s: error: no history file exists!\n", __FUNCTION__);
return 1;
}
DEBUG("Restoring learned parameters\n");
//21. Restore Learned Parameters
err = max_write_verify( MAX17042_RCOMP0, (u8*)&save_store.val_RCOMP0 );
if ( err != 0 ) {
return err;
}
err = max_write_verify ( MAX17042_TempCo, (u8*)&save_store.val_TempCo );
if ( err != 0 ) {
return err;
}
err = max_write_verify( MAX17042_Iavg_empty, (u8*)&save_store.val_Iavg_empty);
if ( err != 0 ) {
return err;
}
err = max_write_verify( MAX17042_k_empty0, (u8*)&save_store.val_k_empty0 );
if ( err != 0 ) {
return err;
}
err = max_write_verify(MAX17042_FullCAPNom, (u8*)&save_store.val_FullCAPNom);
if ( err != 0 ) {
return err;
}
//22. delay 350ms;
udelay ( 350 *1000 );
//23. RestoreFullCap
err = max17042_restore_fullcap();
if ( err != 0 ) {
return err;
}
//24. delay 350ms;
udelay ( 350 *1000 );
//25. restore Cycles
err = max17042_set_cycles( save_store.val_Cycles );
if (err != 0 ) {
DEBUG("restoring cycles failed\n");
return err;
}
return 0;
}
static int max17042_write_custom_para(void)
{
uint16_t buf;
int err;
/*
* Note: This hardcoded values are specific to Encore as supplied
* by Maxim via email, 16/07/2010
*/
DEBUG("%s: use hardcoded values\n", __FUNCTION__);
buf = 0x0080;
err = max_write_verify( MAX17042_RCOMP0, (u8*)&buf );
if ( err != 0 ) {
return err;
}
buf = 0x3670;
err = max_write_verify ( MAX17042_TempCo, (u8*)&buf );
if ( err != 0 ) {
DEBUG( "write verify err 0x39 \n");
return err;
}
buf = 0x2F2C;
err = MAX_WRITE( MAX17042_Empty_TempCo, (u8*)&buf);
if ( err != 0 ) {
DEBUG( "write err 0x3A \n");
return err;
}
buf = 0x078F;
err = max_write_verify( MAX17042_k_empty0, (u8*)&buf );
if ( err != 0 ) {
DEBUG( "write verify err 0x3B \n");
return err;
}
// IchgTerm should map to 50 mA
buf = (uint16_t)(0.050 * 0.01 / 0.0000015625);
err = MAX_WRITE( MAX17042_ICHGTerm, (u8*)&buf );
if ( err != 0 ) {
DEBUG( "write verify err reg 0x%x\n", MAX17042_ICHGTerm);
return err;
}
DEBUG("ICHGTerm = 0x%04x\n", buf);
return 0;
}
static int max17042_update_cap_para(void)
{
int err;
uint16_t buf;
buf = type_params->init_params->Capacity;
DEBUG(" use hardcoded Capacity 0x%04x\n", buf);
err = max_write_verify( MAX17042_FullCap, (u8*)&buf);
if ( err != 0 ) {
return err;
}
err = MAX_WRITE( MAX17042_DesignCap, (u8*)&buf);
if ( err != 0 ) {
DEBUG( "write verify err reg 0x%x\n", MAX17042_DesignCap);
return err;
}
err = max_write_verify( MAX17042_FullCAPNom, (u8*)&buf);
if ( err != 0 ) {
DEBUG( "write verify err reg 0x%x\n", MAX17042_FullCAPNom);
return err;
}
return 0;
}
static int max17042_write_vfsoc(void)
{
int err = 0;
uint16_t buf;
err = MAX_READ(0xFF, (u8*)&buf);
if ( err != 0 ) {
DEBUG( "read err 0xFF\n");
return err;
}
VFSOC = buf; // used in step 16
DEBUG("VFSOC = 0x%04x\n", VFSOC);
buf = 0x0080; // unlock code
MAX_WRITE(MAX17042_VFSOC_Unlock, (u8*)&buf);
err = max_write_verify(0x48, (u8*)&VFSOC);
buf = 0x0000; // lock code
MAX_WRITE(MAX17042_VFSOC_Unlock, (u8*)&buf);
return err;
}
static int max17042_load_cap_para( void )
{
uint16_t buf, remcap, repcap, dq_acc, fullcap0;
//16.
MAX_READ(MAX17042_FullCap0, (u8*)&fullcap0);
remcap = (uint16_t)( ((int)VFSOC * (int)fullcap0) / 25600 );
DEBUG("fullcap0=0x%04x VFSOC=0x%04x remcap=0x%04x\n", fullcap0, VFSOC, remcap);
MAX_WRITE(MAX17042_RemCapmix, (u8*)&remcap);
repcap = remcap;
max_write_verify(MAX17042_RemCapREP, (u8*)&repcap);
//write dQ_acc and dP_acc to 200% of capacity
dq_acc = save_store.val_DesignCap / 4;
max_write_verify(MAX17042_dQacc, (u8*)&dq_acc);
buf = 0x3200;
max_write_verify(MAX17042_dPacc, (u8*)&buf);
max_write_verify(MAX17042_FullCap, (u8*)&save_store.val_DesignCap);
MAX_WRITE(MAX17042_DesignCap, (u8*)&save_store.val_DesignCap);
max_write_verify(MAX17042_FullCAPNom, (u8*)&save_store.val_DesignCap);
return 0;
}
static batt_type get_battery_type(int load)
{
batt_type ret = BATT_LG;
char *token = (char*) 0x81000000;
token[0] = 'L';
token[1] = 'G';
if (load) {
// Ignore the result of this command, if it fails it's LG battery...
run_command("mmcinit 1; fatload mmc 1:4 0x81000000 devconf/BatteryType 0x40", 0);
}
if(('L' == token[0] || 'l' == token[0]) &&
('G' == token[1] || 'g' == token[1]) )
{ }
else if (('M' == token[0] || 'm' == token[0]) &&
('C' == token[1] || 'c' == token[1]) &&
('N' == token[2] || 'n' == token[2]) &&
('A' == token[3] || 'a' == token[3]) &&
('I' == token[4] || 'i' == token[4]) &&
('R' == token[5] || 'r' == token[5]) )
{
ret = BATT_MCNAIR;
}
DEBUG("MAX17042+UBOOT: battery type=%s\n", (BATT_LG == ret)? "LG" : "MCNAIR");
return ret;
}
int max17042_init(int load)
{
uint16_t data;
int i;
static const uint16_t* bufp = (uint16_t*) 0x81000000;
uint16_t* savestorep;
int err, retries=2, force_por=0;
uint16_t designcap;
type_params = ¶m_table[get_battery_type(load)];
designcap = type_params->init_params->Capacity;
i2c_init(100, MAX17042_ADDR);
if ( MAX_READ(MAX17042_STATUS, (uchar*)&data) != 0)
{
DEBUG("MAX17042+UBOOT: No battery or 0V battery!\n");
return 1;
}
DEBUG("MAX17042+UBOOT: gas gauge detected (0x%04x)\n",data);
//check if we need restore registers inside
is_power_on_rst();
if ( is_power_on ) {
DEBUG("MAX17042+UBOOT:POR detected!\n");
} else {
DEBUG("MAX17042+UBOOT:WARM BOOT \n");
}
if (load) {
run_command("mmcinit 1; fatload mmc 1:5 0x81000000 max17042.bin 0x1000", 0);
}
if (*bufp != 0x1234 || !load) {
DEBUG(" No valid max17042 init data found, assume no battery history \n");
is_history_exist = 0;
} else {
DEBUG(" Valid max17042 init data is loaded into memory \n");
}
if ( is_history_exist == 1 ) {
savestorep = (uint16_t*)&save_store;
for ( i = 0; i <(sizeof(save_store) / sizeof(uint16_t)); i++) {
DEBUG (" 0x%04x\n", *bufp);
*savestorep++ = *bufp++;
}
#define MIN_CAP_AGING 25/100 // allow no less than 25% of design capacity before rejecting
#define MAX_CAP_AGING 13/10 // reject history capacity if it seems overly big
#define MIN_CAPNOM_AGING 25/100 // allow no less than 25% of nominal design capacity before rejecting
#define MAX_CAPNOM_AGING 15/10 // reject history capacity if it seems overly big
if ( (save_store.val_FullCAP < (uint16_t)(((uint32_t)designcap)*MIN_CAP_AGING)) ||
(save_store.val_FullCAP > (uint16_t)(((uint32_t)designcap)*MAX_CAP_AGING)) ||
(save_store.val_FullCAPNom < (uint16_t)(((uint32_t)designcap)*MIN_CAPNOM_AGING)) ||
(save_store.val_FullCAPNom > (uint16_t)(((uint32_t)designcap)*MAX_CAPNOM_AGING)) )
{
printf("Resetting battery defaults due to faulty CAPACITY (0x%x, 0x%x)\n",
save_store.val_FullCAP, save_store.val_FullCAPNom);
force_por = 1;
is_history_exist = 0;
}
else
{
DEBUG(" verify if mem loaded: FullcapNom was saved as %04x\n",
save_store.val_FullCAPNom );
}
// In case val_DesignCap in history data does not match battery's design capacity,
// we should throw away the history data.
if(save_store.val_DesignCap != designcap) {
printf("Resetting battery defaults because Design Capactiy(0x%04X)in history data"
" does not match battery's Design Capacity(0x%04X)\n",
save_store.val_DesignCap, designcap);
force_por = 1;
is_history_exist = 0;
}
}
save_store.val_DesignCap = designcap;
i2c_init(100, 0x36); //no need
if ( !is_power_on )
{
// when there is no history file, assume it is a POR
//if ( is_history_exist && max17042_check_init_config() == 0 )
// UPDATE: if history file doesn't exist don't do a POR,
if (!force_por && max17042_check_init_config() == 0 )
{
DEBUG("MAX17042+UBOOT: warm config is okay\n");
return 0;
}
else
{
/* when the config is bad but it's not a POR, then something
* is quite wrong.
*/
DEBUG("MAX17042+UBOOT: warm config bad. soft POR\n");
is_power_on = 1;
max17042_soft_por();
}
}
//1. Delay 500ms
udelay( 500 * 1000 );
MAX17042_DUMPREG( MAX17042_Version );
MAX17042_DUMPREG( MAX17042_DesignCap );
MAX17042_DUMPREG( MAX17042_OCV );
MAX17042_DUMPREG( MAX17042_FSTAT );
MAX17042_DUMPREG( MAX17042_SOCvf );
//2. Init Configuration
max17042_init_config();
//3. Save starting para
max17042_save_start_para();
//4. unlock model access
max17042_unlock_model();
do {
//5. write custom model
max17042_write_model();
//6. read model
//7. verify model
err = max17042_read_verify_model();
} while ( err != 0 && --retries > 0 );
if ( retries == 0 ) {
DEBUG( " writing model failed\n");
return err;
}
retries = 2;
do {
//8. lock model access
max17042_lock_model();
//9. verify model access is locked
err = max17042_verify_lock_model();
} while ( err != 0 && --retries > 0 );
if ( retries == 0 ) {
DEBUG( " locking model failed\n");
return err;
}
//10. write custom parameters
err = max17042_write_custom_para( );
if ( err != 0 ) {
DEBUG("write custom parameters failed\n");
return err;
}
//11 update full capacity parameters
err = max17042_update_cap_para( );
if ( err != 0 ) {
DEBUG("update capacity parameters failed\n");
return err;
}
//13. delay 350ms;
udelay ( 350 *1000 );
//14. write VFSOC to VFSCO0
err = max17042_write_vfsoc();
if ( err != 0 ) {
DEBUG("write vfsoc failed\n");
return err;
}
/* 15.5 Advance to Colomb-Counter Mode
* We do this all the time. In the factory the battery is fresh (close to
* design capacity, and when there is a history file we restore a known good
* capacity after this, so that case it's safe to assume we have a good estimate
* as well.
*/
err = max17042_set_cycles( 0x00A0 );
if ( err != 0 ) {
DEBUG("set cycles 0x00A0 failed\n");
return err;
}
err = max17042_load_cap_para( );
if ( err != 0 ) {
DEBUG("load capacity parameters failed\n");
return err;
}
max17042_clear_POR();
if ( is_history_exist ) {
err = max17042_restore_learned_para();
if ( err != 0 ) {
DEBUG("restore learned parameters failed\n");
return err;
}
}
is_power_on = 0;
DEBUG("Max17042 init is done\n");
return 0;
}
/*get the volage reading*/
int max17042_voltage( uint16_t* val)
{
int err;
/*reading Vcell*/
err = MAX_READ(0x09, (u8*)val);
if ( err != 0 ) {
printf( "read 0x09 Vcell err\n");
return err;
}
else
{
(*val)>>=3;
return 0;
}
}
/*get the volage reading*/
int max17042_vfocv( uint16_t* val)
{
int err;
/*reading Vcell*/
err = MAX_READ(0xFB, (u8*)val);
if ( err != 0 ) {
printf( "read 0xFB open circuit v\n");
return err;
}
else
{
(*val)>>=3;
return 0;
}
}
int max17042_soc( uint16_t* val)
{
int err;
err = MAX_READ(0x06, (u8*)val);
if ( err != 0 ) {
printf( "read 0x06 SOCREP err\n");
return err;
}
(*val) >>= 8; //upper byte is good enough
return 0;
}
//resolution 0.0039-degree, or 3900uC
int max17042_temp( uint32_t* temp)
{
int err;
uint16_t val;
err = MAX_READ(0x08, (u8*)&val);
if ( err != 0 ) {
printf( "read 0x08 reg(temperature) err!\n");
return err;
}
else {
if ( val & (1<<15) ) {
*temp = COMPLEMENT_VAL(val, TEMP_RESOLUTION, 1);
}
else {
*temp = (val & 0x7FFF) * TEMP_RESOLUTION;
}
return err;
}
}
| astarasikov/uboot-bn-nook-hd-fastboot | drivers/max17042.c | C | gpl-2.0 | 30,417 |
obj-y := msm_fb.o
obj-$(CONFIG_FB_MSM_LOGO) += logo.o
obj-$(CONFIG_FB_BACKLIGHT) += msm_fb_bl.o
ifeq ($(CONFIG_FB_MSM_MDP_HW),y)
# MDP
obj-y += mdp.o
obj-$(CONFIG_DEBUG_FS) += mdp_debugfs.o
ifeq ($(CONFIG_FB_MSM_MDP40),y)
obj-y += mdp4_util.o
obj-y += mdp4_hsic.o
else
obj-y += mdp_hw_init.o
obj-y += mdp_ppp.o
ifeq ($(CONFIG_FB_MSM_MDP31),y)
obj-y += mdp_ppp_v31.o
else
obj-y += mdp_ppp_v20.o
endif
endif
ifeq ($(CONFIG_FB_MSM_OVERLAY),y)
obj-y += mdp4_overlay.o
obj-y += mdp4_overlay_lcdc.o
ifeq ($(CONFIG_FB_MSM_MIPI_DSI),y)
obj-y += mdp4_overlay_dsi_video.o
obj-y += mdp4_overlay_dsi_cmd.o
else
obj-y += mdp4_overlay_mddi.o
endif
else
obj-y += mdp_dma_lcdc.o
endif
obj-$(CONFIG_FB_MSM_MDP303) += mdp_dma_dsi_video.o
ifeq ($(CONFIG_FB_MSM_DTV),y)
obj-y += mdp4_dtv.o
obj-y += mdp4_overlay_dtv.o
endif
obj-y += mdp_dma.o
obj-y += mdp_dma_s.o
obj-y += mdp_vsync.o
obj-y += mdp_cursor.o
obj-y += mdp_dma_tv.o
obj-$(CONFIG_ARCH_MSM7X27A) += msm_dss_io_7x27a.o
obj-$(CONFIG_ARCH_MSM8X60) += msm_dss_io_8x60.o
obj-$(CONFIG_ARCH_MSM8960) += msm_dss_io_8960.o
# EBI2
obj-$(CONFIG_FB_MSM_EBI2) += ebi2_lcd.o
# LCDC
obj-$(CONFIG_FB_MSM_LCDC) += lcdc.o
# MDDI
msm_mddi-objs := mddi.o mddihost.o mddihosti.o
obj-$(CONFIG_FB_MSM_MDDI) += msm_mddi.o
# External MDDI
msm_mddi_ext-objs := mddihost_e.o mddi_ext.o
obj-$(CONFIG_FB_MSM_EXTMDDI) += msm_mddi_ext.o
# MIPI gereric
msm_mipi-objs := mipi_dsi.o mipi_dsi_host.o
obj-$(CONFIG_FB_MSM_MIPI_DSI) += msm_mipi.o
# MIPI manufacture
obj-$(CONFIG_FB_MSM_MIPI_DSI_TOSHIBA) += mipi_toshiba.o
obj-$(CONFIG_FB_MSM_MIPI_DSI_NOVATEK) += mipi_novatek.o
obj-$(CONFIG_FB_MSM_MIPI_DSI_ORISE) += mipi_orise.o
obj-$(CONFIG_FB_MSM_MIPI_DSI_RENESAS) += mipi_renesas.o
obj-$(CONFIG_FB_MSM_MIPI_DSI_TRULY) += mipi_truly.o
obj-$(CONFIG_FB_MSM_MIPI_DSI_SIMULATOR) += mipi_simulator.o
# MIPI Bridge
obj-$(CONFIG_FB_MSM_MIPI_DSI_TC358764_DSI2LVDS) += mipi_tc358764_dsi2lvds.o
# TVEnc
obj-$(CONFIG_FB_MSM_TVOUT) += tvenc.o
ifeq ($(CONFIG_FB_MSM_OVERLAY),y)
obj-$(CONFIG_FB_MSM_TVOUT) += mdp4_overlay_atv.o
endif
# MSM FB Panel
obj-y += msm_fb_panel.o
obj-$(CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF) += ebi2_tmd20.o
obj-$(CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF) += ebi2_l2f.o
ifeq ($(CONFIG_FB_MSM_MDDI_AUTO_DETECT),y)
obj-y += mddi_prism.o
obj-y += mddi_toshiba.o
obj-y += mddi_toshiba_vga.o
obj-y += mddi_toshiba_wvga_pt.o
obj-y += mddi_toshiba_wvga.o
obj-y += mddi_sharp.o
obj-y += mddi_orise.o
obj-y += mddi_quickvx.o
else
obj-$(CONFIG_FB_MSM_MDDI_PRISM_WVGA) += mddi_prism.o
obj-$(CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON) += mddi_toshiba.o
obj-$(CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON_VGA) += mddi_toshiba_vga.o
obj-$(CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA_PORTRAIT) += mddi_toshiba_wvga_pt.o
obj-$(CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA) += mddi_toshiba_wvga.o
obj-$(CONFIG_FB_MSM_MDDI_SHARP_QVGA_128x128) += mddi_sharp.o
obj-$(CONFIG_FB_MSM_MDDI_ORISE) += mddi_orise.o
obj-$(CONFIG_FB_MSM_MDDI_QUICKVX) += mddi_quickvx.o
endif
ifeq ($(CONFIG_FB_MSM_MIPI_PANEL_DETECT),y)
obj-y += mipi_toshiba_video_wvga_pt.o mipi_toshiba_video_wsvga_pt.o mipi_toshiba_video_wuxga.o
obj-y += mipi_novatek_video_qhd_pt.o mipi_novatek_cmd_qhd_pt.o
obj-y += mipi_orise_video_720p_pt.o mipi_orise_cmd_720p_pt.o
obj-y += mipi_renesas_video_fwvga_pt.o mipi_renesas_cmd_fwvga_pt.o
obj-y += mipi_chimei_wxga_pt.o
obj-y += mipi_chimei_wuxga.o
obj-y += mipi_truly_video_wvga_pt.o
else
obj-$(CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT) += mipi_toshiba_video_wvga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT) += mipi_toshiba_video_wsvga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA) += mipi_toshiba_video_wuxga.o
obj-$(CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT) += mipi_novatek_video_qhd_pt.o
obj-$(CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT) += mipi_orise_video_720p_pt.o
obj-$(CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT) += mipi_orise_cmd_720p_pt.o
obj-$(CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT) += mipi_novatek_cmd_qhd_pt.o
obj-$(CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT) += mipi_renesas_video_fwvga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT) += mipi_renesas_cmd_fwvga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_TRULY_VIDEO_WVGA_PT) += mipi_truly_video_wvga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO) += mipi_simulator_video.o
obj-$(CONFIG_FB_MSM_MIPI_CHIMEI_WXGA) += mipi_chimei_wxga_pt.o
obj-$(CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA) += mipi_chimei_wuxga.o
endif
obj-$(CONFIG_FB_MSM_LCDC_PANEL) += lcdc_panel.o
obj-$(CONFIG_FB_MSM_LCDC_PRISM_WVGA) += lcdc_prism.o
obj-$(CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA) += lcdc_samsung_wsvga.o
obj-$(CONFIG_FB_MSM_LCDC_CHIMEI_WXGA) += lcdc_chimei_wxga.o
obj-$(CONFIG_FB_MSM_LCDC_NT35582_WVGA) += lcdc_nt35582_wvga.o
obj-$(CONFIG_FB_MSM_LCDC_EXTERNAL_WXGA) += lcdc_external.o
obj-$(CONFIG_FB_MSM_HDMI_SII_EXTERNAL_720P) += hdmi_sii9022.o
obj-$(CONFIG_FB_MSM_LCDC_GORDON_VGA) += lcdc_gordon.o
obj-$(CONFIG_FB_MSM_LCDC_WXGA) += lcdc_wxga.o
obj-$(CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT) += lcdc_toshiba_wvga_pt.o
obj-$(CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT) += lcdc_toshiba_fwvga_pt.o
obj-$(CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT) += lcdc_sharp_wvga_pt.o
obj-$(CONFIG_FB_MSM_LCDC_AUO_WVGA) += lcdc_auo_wvga.o
obj-$(CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT) += lcdc_samsung_oled_pt.o
obj-$(CONFIG_FB_MSM_HDMI_ADV7520_PANEL) += adv7520.o
obj-$(CONFIG_FB_MSM_LCDC_ST15_WXGA) += lcdc_st15.o
obj-$(CONFIG_FB_MSM_HDMI_MSM_PANEL) += hdmi_msm.o
obj-$(CONFIG_FB_MSM_EXT_INTERFACE_COMMON) += external_common.o
obj-$(CONFIG_FB_MSM_TVOUT) += tvout_msm.o
obj-$(CONFIG_FB_MSM_EXTMDDI_SVGA) += mddi_ext_lcd.o
obj-$(CONFIG_FB_MSM_WRITEBACK_MSM_PANEL) += mdp4_wfd_writeback_panel.o
obj-$(CONFIG_FB_MSM_WRITEBACK_MSM_PANEL) += mdp4_wfd_writeback.o
obj-$(CONFIG_FB_MSM_WRITEBACK_MSM_PANEL) += mdp4_overlay_writeback.o
obj-$(CONFIG_MSM_VIDC_1080P) += vidc/
obj-$(CONFIG_MSM_VIDC_720P) += vidc/
else
obj-$(CONFIG_FB_MSM_EBI2) += ebi2_host.o
obj-$(CONFIG_FB_MSM_EBI2) += ebi2_lcd.o
obj-y += msm_fb_panel.o
obj-$(CONFIG_FB_MSM_EBI2_EPSON_S1D_QVGA_PANEL) += ebi2_epson_s1d_qvga.o
endif
obj-$(CONFIG_FB_MSM_SAGA_PANEL) += lcdc_sony_wvga.o
obj-$(CONFIG_FB_MSM_SPADE_PANEL) += lcdc_spade_wvga.o
obj-$(CONFIG_FB_MSM_VISION_PANEL) += lcdc_sony_wvga.o lcdc_samsung_s6e63m0_wvga.o lcdc_samsung_tl2796a_wvga.o
clean:
rm *.o .*cmd
| TeamGlide/android_kernel_htc_msm7x30 | drivers/video/msm/Makefile | Makefile | gpl-2.0 | 6,199 |
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge"> | TechnoTroopInc/portal | site/themes/hugo-fresh/layouts/partials/meta.html | HTML | gpl-2.0 | 163 |
/*
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* This module contains functions for generating tags for Rust files.
*/
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include "main.h"
#include <string.h>
#include "keyword.h"
#include "parse.h"
#include "entry.h"
#include "options.h"
#include "read.h"
#include "vstring.h"
/*
* MACROS
*/
#define MAX_STRING_LENGTH 64
/*
* DATA DECLARATIONS
*/
typedef enum {
K_MOD,
K_STRUCT,
K_TRAIT,
K_IMPL,
K_FN,
K_ENUM,
K_TYPE,
K_STATIC,
K_MACRO,
K_FIELD,
K_VARIANT,
K_METHOD,
K_NONE
} RustKind;
static kindOption rustKinds[] = {
{TRUE, 'n', "namespace", "module"},
{TRUE, 's', "struct", "structural type"},
{TRUE, 'i', "interface", "trait interface"},
{TRUE, 'c', "class", "implementation"},
{TRUE, 'f', "function", "Function"},
{TRUE, 'g', "enum", "Enum"},
{TRUE, 't', "typedef", "Type Alias"},
{TRUE, 'v', "variable", "Global variable"},
{TRUE, 'M', "macro", "Macro Definition"},
{TRUE, 'm', "field", "A struct field"},
{TRUE, 'e', "enumerator", "An enum variant"},
{TRUE, 'F', "method", "A method"},
};
typedef enum {
TOKEN_WHITESPACE,
TOKEN_STRING,
TOKEN_IDENT,
TOKEN_LSHIFT,
TOKEN_RSHIFT,
TOKEN_RARROW,
TOKEN_EOF
} tokenType;
typedef struct {
/* Characters */
int cur_c;
int next_c;
/* Tokens */
int cur_token;
vString* token_str;
unsigned long line;
MIOPos pos;
} lexerState;
/*
* FUNCTION PROTOTYPES
*/
static void parseBlock (lexerState *lexer, boolean delim, int kind, vString *scope);
/*
* FUNCTION DEFINITIONS
*/
/* Resets the scope string to the old length */
static void resetScope (vString *scope, size_t old_len)
{
scope->length = old_len;
scope->buffer[old_len] = '\0';
}
/* Adds a name to the end of the scope string */
static void addToScope (vString *scope, vString *name)
{
if (vStringLength(scope) > 0)
vStringCatS(scope, "::");
vStringCat(scope, name);
}
/* Write the lexer's current token to string, taking care of special tokens */
static void writeCurTokenToStr (lexerState *lexer, vString *out_str)
{
switch (lexer->cur_token)
{
case TOKEN_IDENT:
vStringCat(out_str, lexer->token_str);
break;
case TOKEN_STRING:
vStringPut(out_str, '"');
vStringCat(out_str, lexer->token_str);
vStringPut(out_str, '"');
break;
case TOKEN_WHITESPACE:
vStringPut(out_str, ' ');
break;
case TOKEN_LSHIFT:
vStringCatS(out_str, "<<");
break;
case TOKEN_RSHIFT:
vStringCatS(out_str, ">>");
break;
case TOKEN_RARROW:
vStringCatS(out_str, "->");
break;
default:
vStringPut(out_str, (char) lexer->cur_token);
}
}
/* Reads a character from the file */
static void advanceChar (lexerState *lexer)
{
lexer->cur_c = lexer->next_c;
lexer->next_c = fileGetc();
}
/* Reads N characters from the file */
static void advanceNChar (lexerState *lexer, int n)
{
while (n--)
advanceChar(lexer);
}
static boolean isWhitespace (int c)
{
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
}
static boolean isAscii (int c)
{
return (c >= 0) && (c < 0x80);
}
/* This isn't quite right for Unicode identifiers */
static boolean isIdentifierStart (int c)
{
return (isAscii(c) && (isalpha(c) || c == '_')) || !isAscii(c);
}
/* This isn't quite right for Unicode identifiers */
static boolean isIdentifierContinue (int c)
{
return (isAscii(c) && (isalnum(c) || c == '_')) || !isAscii(c);
}
static void scanWhitespace (lexerState *lexer)
{
while (isWhitespace(lexer->cur_c))
advanceChar(lexer);
}
/* Normal line comments start with two /'s and continue until the next \n
* (NOT any other newline character!). Additionally, a shebang in the beginning
* of the file also counts as a line comment.
* Block comments start with / followed by a * and end with a * followed by a /.
* Unlike in C/C++ they nest. */
static void scanComments (lexerState *lexer)
{
/* // or #! */
if (lexer->next_c == '/' || lexer->next_c == '!')
{
advanceNChar(lexer, 2);
while (lexer->cur_c != EOF && lexer->cur_c != '\n')
advanceChar(lexer);
}
else if (lexer->next_c == '*')
{
int level = 1;
advanceNChar(lexer, 2);
while (lexer->cur_c != EOF && level > 0)
{
if (lexer->cur_c == '*' && lexer->next_c == '/')
{
level--;
advanceNChar(lexer, 2);
}
else if (lexer->cur_c == '/' && lexer->next_c == '*')
{
level++;
advanceNChar(lexer, 2);
}
else
{
advanceChar(lexer);
}
}
}
}
static void scanIdentifier (lexerState *lexer)
{
vStringClear(lexer->token_str);
do
{
vStringPut(lexer->token_str, (char) lexer->cur_c);
advanceChar(lexer);
} while(lexer->cur_c != EOF && isIdentifierContinue(lexer->cur_c));
}
/* Double-quoted strings, we only care about the \" escape. These
* last past the end of the line, so be careful not too store too much
* of them (see MAX_STRING_LENGTH). The only place we look at their
* contents is in the function definitions, and there the valid strings are
* things like "C" and "Rust" */
static void scanString (lexerState *lexer)
{
vStringClear(lexer->token_str);
advanceChar(lexer);
while (lexer->cur_c != EOF && lexer->cur_c != '"')
{
if (lexer->cur_c == '\\' && lexer->next_c == '"')
advanceChar(lexer);
if (vStringLength(lexer->token_str) < MAX_STRING_LENGTH)
vStringPut(lexer->token_str, (char) lexer->cur_c);
advanceChar(lexer);
}
advanceChar(lexer);
}
/* Raw strings look like this: r"" or r##""## where the number of
* hashes must match */
static void scanRawString (lexerState *lexer)
{
size_t num_initial_hashes = 0;
vStringClear(lexer->token_str);
advanceChar(lexer);
/* Count how many leading hashes there are */
while (lexer->cur_c == '#')
{
num_initial_hashes++;
advanceChar(lexer);
}
if (lexer->cur_c != '"')
return;
advanceChar(lexer);
while (lexer->cur_c != EOF)
{
if (vStringLength(lexer->token_str) < MAX_STRING_LENGTH)
vStringPut(lexer->token_str, (char) lexer->cur_c);
/* Count how many trailing hashes there are. If the number is equal or more
* than the number of leading hashes, break. */
if (lexer->cur_c == '"')
{
size_t num_trailing_hashes = 0;
advanceChar(lexer);
while (lexer->cur_c == '#' && num_trailing_hashes < num_initial_hashes)
{
num_trailing_hashes++;
if (vStringLength(lexer->token_str) < MAX_STRING_LENGTH)
vStringPut(lexer->token_str, (char) lexer->cur_c);
advanceChar(lexer);
}
if (num_trailing_hashes == num_initial_hashes)
{
/* Strip the trailing hashes and quotes */
if (vStringLength(lexer->token_str) < MAX_STRING_LENGTH && vStringLength(lexer->token_str) > num_trailing_hashes + 1)
{
lexer->token_str->length = vStringLength(lexer->token_str) - num_trailing_hashes - 1;
lexer->token_str->buffer[lexer->token_str->length] = '\0';
}
break;
}
}
else
{
advanceChar(lexer);
}
}
}
/* Advances the parser one token, optionally skipping whitespace
* (otherwise it is concatenated and returned as a single whitespace token).
* Whitespace is needed to properly render function signatures. Unrecognized
* token starts are stored literally, e.g. token may equal to a character '#'. */
static int advanceToken (lexerState *lexer, boolean skip_whitspace)
{
boolean have_whitespace = FALSE;
lexer->line = getSourceLineNumber();
lexer->pos = getInputFilePosition();
while (lexer->cur_c != EOF)
{
if (isWhitespace(lexer->cur_c))
{
scanWhitespace(lexer);
have_whitespace = TRUE;
}
else if (lexer->cur_c == '/' && (lexer->next_c == '/' || lexer->next_c == '*'))
{
scanComments(lexer);
have_whitespace = TRUE;
}
else
{
if (have_whitespace && !skip_whitspace)
return lexer->cur_token = TOKEN_WHITESPACE;
break;
}
}
lexer->line = getSourceLineNumber();
lexer->pos = getInputFilePosition();
while (lexer->cur_c != EOF)
{
if (lexer->cur_c == '"')
{
scanString(lexer);
return lexer->cur_token = TOKEN_STRING;
}
else if (lexer->cur_c == 'r' && (lexer->next_c == '#' || lexer->next_c == '"'))
{
scanRawString(lexer);
return lexer->cur_token = TOKEN_STRING;
}
else if (isIdentifierStart(lexer->cur_c))
{
scanIdentifier(lexer);
return lexer->cur_token = TOKEN_IDENT;
}
/* These shift tokens aren't too important for tag-generation per se,
* but they confuse the skipUntil code which tracks the <> pairs. */
else if (lexer->cur_c == '>' && lexer->next_c == '>')
{
advanceNChar(lexer, 2);
return lexer->cur_token = TOKEN_RSHIFT;
}
else if (lexer->cur_c == '<' && lexer->next_c == '<')
{
advanceNChar(lexer, 2);
return lexer->cur_token = TOKEN_LSHIFT;
}
else if (lexer->cur_c == '-' && lexer->next_c == '>')
{
advanceNChar(lexer, 2);
return lexer->cur_token = TOKEN_RARROW;
}
else
{
int c = lexer->cur_c;
advanceChar(lexer);
return lexer->cur_token = c;
}
}
return lexer->cur_token = TOKEN_EOF;
}
static void initLexer (lexerState *lexer)
{
advanceNChar(lexer, 2);
lexer->token_str = vStringNew();
if (lexer->cur_c == '#' && lexer->next_c == '!')
scanComments(lexer);
advanceToken(lexer, TRUE);
}
static void deInitLexer (lexerState *lexer)
{
vStringDelete(lexer->token_str);
lexer->token_str = NULL;
}
static void addTag (vString* ident, const char* type, const char* arg_list, int kind, unsigned long line, MIOPos pos, vString *scope, int parent_kind)
{
if (kind == K_NONE)
return;
tagEntryInfo tag;
initTagEntry(&tag, ident->buffer);
tag.lineNumber = line;
tag.filePosition = pos;
tag.sourceFileName = getSourceFileName();
tag.kindName = rustKinds[kind].name;
tag.kind = rustKinds[kind].letter;
tag.extensionFields.arglist = arg_list;
tag.extensionFields.varType = type;
if (parent_kind != K_NONE)
{
tag.extensionFields.scope[0] = rustKinds[parent_kind].name;
tag.extensionFields.scope[1] = scope->buffer;
}
makeTagEntry(&tag);
}
/* Skip tokens until one of the goal tokens is hit. Escapes when level = 0 if there are no goal tokens.
* Keeps track of balanced <>'s, ()'s, []'s, and {}'s and ignores the goal tokens within those pairings */
static void skipUntil (lexerState *lexer, int goal_tokens[], int num_goal_tokens)
{
int angle_level = 0;
int paren_level = 0;
int brace_level = 0;
int bracket_level = 0;
while (lexer->cur_token != TOKEN_EOF)
{
if (angle_level == 0 && paren_level == 0 && brace_level == 0
&& bracket_level == 0)
{
int ii = 0;
for(ii = 0; ii < num_goal_tokens; ii++)
{
if (lexer->cur_token == goal_tokens[ii])
{
break;
}
}
if (ii < num_goal_tokens)
break;
}
switch (lexer->cur_token)
{
case '<':
angle_level++;
break;
case '(':
paren_level++;
break;
case '{':
brace_level++;
break;
case '[':
bracket_level++;
break;
case '>':
angle_level--;
break;
case ')':
paren_level--;
break;
case '}':
brace_level--;
break;
case ']':
bracket_level--;
break;
case TOKEN_RSHIFT:
if (angle_level >= 2)
angle_level -= 2;
break;
/* TOKEN_LSHIFT is never interpreted as two <'s in valid Rust code */
default:
break;
}
/* Has to be after the token switch to catch the case when we start with the initial level token */
if (num_goal_tokens == 0 && angle_level == 0 && paren_level == 0 && brace_level == 0
&& bracket_level == 0)
break;
advanceToken(lexer, TRUE);
}
}
/* Function format:
* "fn" <ident>[<type_bounds>] "(" [<args>] ")" ["->" <ret_type>] "{" [<body>] "}"*/
static void parseFn (lexerState *lexer, vString *scope, int parent_kind)
{
int kind = (parent_kind == K_TRAIT || parent_kind == K_IMPL) ? K_METHOD : K_FN;
vString *name;
vString *arg_list;
unsigned long line;
MIOPos pos;
int paren_level = 0;
boolean found_paren = FALSE;
boolean valid_signature = TRUE;
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
name = vStringNewCopy(lexer->token_str);
arg_list = vStringNew();
line = lexer->line;
pos = lexer->pos;
advanceToken(lexer, TRUE);
/* HACK: This is a bit coarse as far as what tag entry means by
* 'arglist'... */
while (lexer->cur_token != '{' && lexer->cur_token != ';')
{
if (lexer->cur_token == '}')
{
valid_signature = FALSE;
break;
}
else if (lexer->cur_token == '(')
{
found_paren = TRUE;
paren_level++;
}
else if (lexer->cur_token == ')')
{
paren_level--;
if (paren_level < 0)
{
valid_signature = FALSE;
break;
}
}
else if (lexer->cur_token == TOKEN_EOF)
{
valid_signature = FALSE;
break;
}
writeCurTokenToStr(lexer, arg_list);
advanceToken(lexer, FALSE);
}
if (!found_paren || paren_level != 0)
valid_signature = FALSE;
if (valid_signature)
{
vStringStripTrailing(arg_list);
addTag(name, NULL, arg_list->buffer, kind, line, pos, scope, parent_kind);
addToScope(scope, name);
parseBlock(lexer, TRUE, kind, scope);
}
vStringDelete(name);
vStringDelete(arg_list);
}
/* Mod format:
* "mod" <ident> "{" [<body>] "}"
* "mod" <ident> ";"*/
static void parseMod (lexerState *lexer, vString *scope, int parent_kind)
{
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, K_MOD, lexer->line, lexer->pos, scope, parent_kind);
addToScope(scope, lexer->token_str);
advanceToken(lexer, TRUE);
parseBlock(lexer, TRUE, K_MOD, scope);
}
/* Trait format:
* "trait" <ident> [<type_bounds>] "{" [<body>] "}"
*/
static void parseTrait (lexerState *lexer, vString *scope, int parent_kind)
{
int goal_tokens[] = {'{'};
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, K_TRAIT, lexer->line, lexer->pos, scope, parent_kind);
addToScope(scope, lexer->token_str);
advanceToken(lexer, TRUE);
skipUntil(lexer, goal_tokens, 1);
parseBlock(lexer, TRUE, K_TRAIT, scope);
}
/* Skips type blocks of the form <T:T<T>, ...> */
static void skipTypeBlock (lexerState *lexer)
{
if (lexer->cur_token == '<')
{
skipUntil(lexer, NULL, 0);
advanceToken(lexer, TRUE);
}
}
/* Essentially grabs the last ident before 'for', '<' and '{', which
* tends to correspond to what we want as the impl tag entry name */
static void parseQualifiedType (lexerState *lexer, vString* name)
{
while (lexer->cur_token != TOKEN_EOF)
{
if (lexer->cur_token == TOKEN_IDENT)
{
if (strcmp(lexer->token_str->buffer, "for") == 0)
break;
vStringClear(name);
vStringCat(name, lexer->token_str);
}
else if (lexer->cur_token == '<' || lexer->cur_token == '{')
{
break;
}
advanceToken(lexer, TRUE);
}
skipTypeBlock(lexer);
}
/* Impl format:
* "impl" [<type_bounds>] <qualified_ident>[<type_bounds>] ["for" <qualified_ident>[<type_bounds>]] "{" [<body>] "}"
*/
static void parseImpl (lexerState *lexer, vString *scope, int parent_kind)
{
unsigned long line;
MIOPos pos;
vString *name;
advanceToken(lexer, TRUE);
line = lexer->line;
pos = lexer->pos;
skipTypeBlock(lexer);
name = vStringNew();
parseQualifiedType(lexer, name);
if (lexer->cur_token == TOKEN_IDENT && strcmp(lexer->token_str->buffer, "for") == 0)
{
advanceToken(lexer, TRUE);
parseQualifiedType(lexer, name);
}
addTag(name, NULL, NULL, K_IMPL, line, pos, scope, parent_kind);
addToScope(scope, name);
parseBlock(lexer, TRUE, K_IMPL, scope);
vStringDelete(name);
}
/* Static format:
* "static" ["mut"] <ident>
*/
static void parseStatic (lexerState *lexer, vString *scope, int parent_kind)
{
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
if (strcmp(lexer->token_str->buffer, "mut") == 0)
{
advanceToken(lexer, TRUE);
}
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, K_STATIC, lexer->line, lexer->pos, scope, parent_kind);
}
/* Type format:
* "type" <ident>
*/
static void parseType (lexerState *lexer, vString *scope, int parent_kind)
{
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, K_TYPE, lexer->line, lexer->pos, scope, parent_kind);
}
/* Structs and enums are very similar syntax-wise.
* It is possible to parse variants a bit more cleverly (e.g. make tuple variants functions and
* struct variants structs) but it'd be too clever and the signature wouldn't make too much sense without
* the enum's definition (e.g. for the type bounds)
*
* Struct/Enum format:
* "struct/enum" <ident>[<type_bounds>] "{" [<ident>,]+ "}"
* "struct/enum" <ident>[<type_bounds>] ";"
* */
static void parseStructOrEnum (lexerState *lexer, vString *scope, int parent_kind, boolean is_struct)
{
int kind = is_struct ? K_STRUCT : K_ENUM;
int field_kind = is_struct ? K_FIELD : K_VARIANT;
int goal_tokens1[] = {';', '{'};
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, kind, lexer->line, lexer->pos, scope, parent_kind);
addToScope(scope, lexer->token_str);
skipUntil(lexer, goal_tokens1, 2);
if (lexer->cur_token == '{')
{
vString *field_name = vStringNew();
while (lexer->cur_token != TOKEN_EOF)
{
int goal_tokens2[] = {'}', ','};
/* Skip attributes. Format:
* #[..] or #![..]
* */
if (lexer->cur_token == '#')
{
advanceToken(lexer, TRUE);
if (lexer->cur_token == '!')
advanceToken(lexer, TRUE);
if (lexer->cur_token == '[')
{
/* It's an attribute, skip it. */
skipUntil(lexer, NULL, 0);
}
else
{
/* Something's up with this field, skip to the next one */
skipUntil(lexer, goal_tokens2, 2);
continue;
}
}
if (lexer->cur_token == TOKEN_IDENT)
{
if (strcmp(lexer->token_str->buffer, "priv") == 0
|| strcmp(lexer->token_str->buffer, "pub") == 0)
{
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
{
/* Something's up with this field, skip to the next one */
skipUntil(lexer, goal_tokens2, 2);
continue;
}
}
vStringClear(field_name);
vStringCat(field_name, lexer->token_str);
addTag(field_name, NULL, NULL, field_kind, lexer->line, lexer->pos, scope, kind);
skipUntil(lexer, goal_tokens2, 2);
}
if (lexer->cur_token == '}')
{
advanceToken(lexer, TRUE);
break;
}
advanceToken(lexer, TRUE);
}
vStringDelete(field_name);
}
}
/* Skip the body of the macro. Can't use skipUntil here as
* the body of the macro may have arbitrary code which confuses it (e.g.
* bitshift operators/function return arrows) */
static void skipMacro (lexerState *lexer)
{
int level = 0;
int plus_token = 0;
int minus_token = 0;
advanceToken(lexer, TRUE);
switch (lexer->cur_token)
{
case '(':
plus_token = '(';
minus_token = ')';
break;
case '{':
plus_token = '{';
minus_token = '}';
break;
case '[':
plus_token = '[';
minus_token = ']';
break;
default:
return;
}
while (lexer->cur_token != TOKEN_EOF)
{
if (lexer->cur_token == plus_token)
level++;
else if (lexer->cur_token == minus_token)
level--;
if (level == 0)
break;
advanceToken(lexer, TRUE);
}
advanceToken(lexer, TRUE);
}
/*
* Macro rules format:
* "macro_rules" "!" <ident> <macro_body>
*/
static void parseMacroRules (lexerState *lexer, vString *scope, int parent_kind)
{
advanceToken(lexer, TRUE);
if (lexer->cur_token != '!')
return;
advanceToken(lexer, TRUE);
if (lexer->cur_token != TOKEN_IDENT)
return;
addTag(lexer->token_str, NULL, NULL, K_MACRO, lexer->line, lexer->pos, scope, parent_kind);
skipMacro(lexer);
}
/*
* Rust is very liberal with nesting, so this function is used pretty much for any block
*/
static void parseBlock (lexerState *lexer, boolean delim, int kind, vString *scope)
{
int level = 1;
if (delim)
{
if (lexer->cur_token != '{')
return;
advanceToken(lexer, TRUE);
}
while (lexer->cur_token != TOKEN_EOF)
{
if (lexer->cur_token == TOKEN_IDENT)
{
size_t old_scope_len = vStringLength(scope);
if (strcmp(lexer->token_str->buffer, "fn") == 0)
{
parseFn(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "mod") == 0)
{
parseMod(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "static") == 0)
{
parseStatic(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "trait") == 0)
{
parseTrait(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "type") == 0)
{
parseType(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "impl") == 0)
{
parseImpl(lexer, scope, kind);
}
else if(strcmp(lexer->token_str->buffer, "struct") == 0)
{
parseStructOrEnum(lexer, scope, kind, TRUE);
}
else if(strcmp(lexer->token_str->buffer, "enum") == 0)
{
parseStructOrEnum(lexer, scope, kind, FALSE);
}
else if(strcmp(lexer->token_str->buffer, "macro_rules") == 0)
{
parseMacroRules(lexer, scope, kind);
}
else
{
advanceToken(lexer, TRUE);
if (lexer->cur_token == '!')
{
skipMacro(lexer);
}
}
resetScope(scope, old_scope_len);
}
else if (lexer->cur_token == '{')
{
level++;
advanceToken(lexer, TRUE);
}
else if (lexer->cur_token == '}')
{
level--;
advanceToken(lexer, TRUE);
}
else if (lexer->cur_token == '\'')
{
/* Skip over the 'static lifetime, as it confuses the static parser above */
advanceToken(lexer, TRUE);
if (lexer->cur_token == TOKEN_IDENT && strcmp(lexer->token_str->buffer, "static") == 0)
advanceToken(lexer, TRUE);
}
else
{
advanceToken(lexer, TRUE);
}
if (delim && level <= 0)
break;
}
}
static void findRustTags (void)
{
lexerState lexer;
vString* scope = vStringNew();
initLexer(&lexer);
parseBlock(&lexer, FALSE, K_NONE, scope);
vStringDelete(scope);
deInitLexer(&lexer);
}
extern parserDefinition *RustParser (void)
{
static const char *const extensions[] = { "rs", NULL };
parserDefinition *def = parserNew ("Rust");
def->kinds = rustKinds;
def->kindCount = KIND_COUNT (rustKinds);
def->extensions = extensions;
def->parser = findRustTags;
return def;
}
| TheGameCreators/AGKIDE | tagmanager/ctags/rust.c | C | gpl-2.0 | 22,209 |
/*
* 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.
*/
#include <string.h>
#include <math.h>
#include "vmi.h"
#include "cbigint.h"
#include "harmonyglob.h"
#include "exceptions.h"
#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX)
#define USE_LL
#endif
#define LOW_I32_FROM_VAR(u64) LOW_I32_FROM_LONG64(u64)
#define LOW_I32_FROM_PTR(u64ptr) LOW_I32_FROM_LONG64_PTR(u64ptr)
#define HIGH_I32_FROM_VAR(u64) HIGH_I32_FROM_LONG64(u64)
#define HIGH_I32_FROM_PTR(u64ptr) HIGH_I32_FROM_LONG64_PTR(u64ptr)
#define MAX_ACCURACY_WIDTH 17
#define DEFAULT_WIDTH MAX_ACCURACY_WIDTH
JNIEXPORT jdouble JNICALL
Java_org_apache_harmony_luni_util_FloatingPointParser_parseDblImpl (JNIEnv * env,
jclass clazz,
jstring s, jint e);
JNIEXPORT void JNICALL
Java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl (JNIEnv *
env,
jobject
inst,
jlong f,
jint e,
jboolean
isDenormalized,
jboolean
mantissaIsZero,
jint p);
jdouble createDouble (JNIEnv * env, const char *s, jint e);
jdouble createDouble1 (JNIEnv * env, U_64 * f, IDATA length, jint e);
jdouble doubleAlgorithm (JNIEnv * env, U_64 * f, IDATA length, jint e,
jdouble z);
U_64 dblparse_shiftRight64 (U_64 * lp, volatile int mbe);
static const jdouble tens[] = {
1.0,
1.0e1,
1.0e2,
1.0e3,
1.0e4,
1.0e5,
1.0e6,
1.0e7,
1.0e8,
1.0e9,
1.0e10,
1.0e11,
1.0e12,
1.0e13,
1.0e14,
1.0e15,
1.0e16,
1.0e17,
1.0e18,
1.0e19,
1.0e20,
1.0e21,
1.0e22
};
#define tenToTheE(e) (*(tens + (e)))
#define LOG5_OF_TWO_TO_THE_N 23
#define INV_LOG_OF_TEN_BASE_2 (0.30102999566398114)
#define DOUBLE_MIN_VALUE 5.0e-324
#define sizeOfTenToTheE(e) (((e) / 19) + 1)
#if defined(USE_LL)
#define INFINITE_LONGBITS (0x7FF0000000000000LL)
#else
#if defined(USE_L)
#define INFINITE_LONGBITS (0x7FF0000000000000L)
#else
#define INFINITE_LONGBITS (0x7FF0000000000000)
#endif /* USE_L */
#endif /* USE_LL */
#define MINIMUM_LONGBITS (0x1)
#if defined(USE_LL)
#define MANTISSA_MASK (0x000FFFFFFFFFFFFFLL)
#define EXPONENT_MASK (0x7FF0000000000000LL)
#define NORMAL_MASK (0x0010000000000000LL)
#else
#if defined(USE_L)
#define MANTISSA_MASK (0x000FFFFFFFFFFFFFL)
#define EXPONENT_MASK (0x7FF0000000000000L)
#define NORMAL_MASK (0x0010000000000000L)
#else
#define MANTISSA_MASK (0x000FFFFFFFFFFFFF)
#define EXPONENT_MASK (0x7FF0000000000000)
#define NORMAL_MASK (0x0010000000000000)
#endif /* USE_L */
#endif /* USE_LL */
#define DOUBLE_TO_LONGBITS(dbl) (*((U_64 *)(&dbl)))
/* Keep a count of the number of times we decrement and increment to
* approximate the double, and attempt to detect the case where we
* could potentially toggle back and forth between decrementing and
* incrementing. It is possible for us to be stuck in the loop when
* incrementing by one or decrementing by one may exceed or stay below
* the value that we are looking for. In this case, just break out of
* the loop if we toggle between incrementing and decrementing for more
* than twice.
*/
#define INCREMENT_DOUBLE(_x, _decCount, _incCount) \
{ \
++DOUBLE_TO_LONGBITS(_x); \
_incCount++; \
if( (_incCount > 2) && (_decCount > 2) ) { \
if( _decCount > _incCount ) { \
DOUBLE_TO_LONGBITS(_x) += _decCount - _incCount; \
} else if( _incCount > _decCount ) { \
DOUBLE_TO_LONGBITS(_x) -= _incCount - _decCount; \
} \
break; \
} \
}
#define DECREMENT_DOUBLE(_x, _decCount, _incCount) \
{ \
--DOUBLE_TO_LONGBITS(_x); \
_decCount++; \
if( (_incCount > 2) && (_decCount > 2) ) { \
if( _decCount > _incCount ) { \
DOUBLE_TO_LONGBITS(_x) += _decCount - _incCount; \
} else if( _incCount > _decCount ) { \
DOUBLE_TO_LONGBITS(_x) -= _incCount - _decCount; \
} \
break; \
} \
}
#define ERROR_OCCURED(x) (HIGH_I32_FROM_VAR(x) < 0)
#define allocateU64(x, n) if (!((x) = (U_64*) hymem_allocate_memory((n) * sizeof(U_64)))) goto OutOfMemory;
#define release(r) if ((r)) hymem_free_memory((r));
/*NB the Number converter methods are synchronized so it is possible to
*have global data for use by bigIntDigitGenerator */
#define RM_SIZE 21
#define STemp_SIZE 22
jdouble
createDouble (JNIEnv * env, const char *s, jint e)
{
/* assumes s is a null terminated string with at least one
* character in it */
U_64 def[DEFAULT_WIDTH];
U_64 defBackup[DEFAULT_WIDTH];
U_64 *f, *fNoOverflow, *g, *tempBackup;
U_32 overflow;
jdouble result;
IDATA index = 1;
int unprocessedDigits = 0;
f = def;
fNoOverflow = defBackup;
*f = 0;
tempBackup = g = 0;
do
{
if (*s >= '0' && *s <= '9')
{
/* Make a back up of f before appending, so that we can
* back out of it if there is no more room, i.e. index >
* MAX_ACCURACY_WIDTH.
*/
memcpy (fNoOverflow, f, sizeof (U_64) * index);
overflow =
simpleAppendDecimalDigitHighPrecision (f, index, *s - '0');
if (overflow)
{
f[index++] = overflow;
/* There is an overflow, but there is no more room
* to store the result. We really only need the top 52
* bits anyway, so we must back out of the overflow,
* and ignore the rest of the string.
*/
if (index >= MAX_ACCURACY_WIDTH)
{
index--;
memcpy (f, fNoOverflow, sizeof (U_64) * index);
break;
}
if (tempBackup)
{
fNoOverflow = tempBackup;
}
}
}
else
index = -1;
}
while (index > 0 && *(++s) != '\0');
/* We've broken out of the parse loop either because we've reached
* the end of the string or we've overflowed the maximum accuracy
* limit of a double. If we still have unprocessed digits in the
* given string, then there are three possible results:
* 1. (unprocessed digits + e) == 0, in which case we simply
* convert the existing bits that are already parsed
* 2. (unprocessed digits + e) < 0, in which case we simply
* convert the existing bits that are already parsed along
* with the given e
* 3. (unprocessed digits + e) > 0 indicates that the value is
* simply too big to be stored as a double, so return Infinity
*/
if ((unprocessedDigits = strlen (s)) > 0)
{
e += unprocessedDigits;
if (index > -1)
{
if (e == 0)
result = toDoubleHighPrecision (f, index);
else if (e < 0)
result = createDouble1 (env, f, index, e);
else
{
DOUBLE_TO_LONGBITS (result) = INFINITE_LONGBITS;
}
}
else
{
LOW_I32_FROM_VAR (result) = -1;
HIGH_I32_FROM_VAR (result) = -1;
}
}
else
{
if (index > -1)
{
if (e == 0)
result = toDoubleHighPrecision (f, index);
else
result = createDouble1 (env, f, index, e);
}
else
{
LOW_I32_FROM_VAR (result) = -1;
HIGH_I32_FROM_VAR (result) = -1;
}
}
return result;
}
jdouble
createDouble1 (JNIEnv * env, U_64 * f, IDATA length, jint e)
{
IDATA numBits;
jdouble result;
#define APPROX_MIN_MAGNITUDE -309
#define APPROX_MAX_MAGNITUDE 309
numBits = highestSetBitHighPrecision (f, length) + 1;
numBits -= lowestSetBitHighPrecision (f, length);
if (numBits < 54 && e >= 0 && e < LOG5_OF_TWO_TO_THE_N)
{
return toDoubleHighPrecision (f, length) * tenToTheE (e);
}
else if (numBits < 54 && e < 0 && (-e) < LOG5_OF_TWO_TO_THE_N)
{
return toDoubleHighPrecision (f, length) / tenToTheE (-e);
}
else if (e >= 0 && e < APPROX_MAX_MAGNITUDE)
{
result = toDoubleHighPrecision (f, length) * pow (10.0, (double) e);
}
else if (e >= APPROX_MAX_MAGNITUDE)
{
/* Convert the partial result to make sure that the
* non-exponential part is not zero. This check fixes the case
* where the user enters 0.0e309! */
result = toDoubleHighPrecision (f, length);
/* Don't go straight to zero as the fact that x*0 = 0 independent of x might
cause the algorithm to produce an incorrect result. Instead try the min value
first and let it fall to zero if need be. */
if (result == 0.0)
DOUBLE_TO_LONGBITS (result) = MINIMUM_LONGBITS;
else
DOUBLE_TO_LONGBITS (result) = INFINITE_LONGBITS;
}
else if (e > APPROX_MIN_MAGNITUDE)
{
result = toDoubleHighPrecision (f, length) / pow (10.0, (double) -e);
}
if (e <= APPROX_MIN_MAGNITUDE)
{
result = toDoubleHighPrecision (f, length) * pow (10.0, (double) (e + 52));
result = result * pow (10.0, (double) -52);
}
/* Don't go straight to zero as the fact that x*0 = 0 independent of x might
cause the algorithm to produce an incorrect result. Instead try the min value
first and let it fall to zero if need be. */
if (result == 0.0)
DOUBLE_TO_LONGBITS (result) = MINIMUM_LONGBITS;
return doubleAlgorithm (env, f, length, e, result);
}
U_64
dblparse_shiftRight64 (U_64 * lp, volatile int mbe)
{
U_64 b1Value = 0;
U_32 hi = HIGH_U32_FROM_LONG64_PTR (lp);
U_32 lo = LOW_U32_FROM_LONG64_PTR (lp);
int srAmt;
if (mbe == 0)
return 0;
if (mbe >= 128)
{
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
LOW_U32_FROM_LONG64_PTR (lp) = 0;
return 0;
}
/* Certain platforms do not handle de-referencing a 64-bit value
* from a pointer on the stack correctly (e.g. MVL-hh/XScale)
* because the pointer may not be properly aligned, so we'll have
* to handle two 32-bit chunks. */
if (mbe < 32)
{
LOW_U32_FROM_LONG64 (b1Value) = 0;
HIGH_U32_FROM_LONG64 (b1Value) = lo << (32 - mbe);
LOW_U32_FROM_LONG64_PTR (lp) = (hi << (32 - mbe)) | (lo >> mbe);
HIGH_U32_FROM_LONG64_PTR (lp) = hi >> mbe;
}
else if (mbe == 32)
{
LOW_U32_FROM_LONG64 (b1Value) = 0;
HIGH_U32_FROM_LONG64 (b1Value) = lo;
LOW_U32_FROM_LONG64_PTR (lp) = hi;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
}
else if (mbe < 64)
{
srAmt = mbe - 32;
LOW_U32_FROM_LONG64 (b1Value) = lo << (32 - srAmt);
HIGH_U32_FROM_LONG64 (b1Value) = (hi << (32 - srAmt)) | (lo >> srAmt);
LOW_U32_FROM_LONG64_PTR (lp) = hi >> srAmt;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
}
else if (mbe == 64)
{
LOW_U32_FROM_LONG64 (b1Value) = lo;
HIGH_U32_FROM_LONG64 (b1Value) = hi;
LOW_U32_FROM_LONG64_PTR (lp) = 0;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
}
else if (mbe < 96)
{
srAmt = mbe - 64;
b1Value = *lp;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
LOW_U32_FROM_LONG64_PTR (lp) = 0;
LOW_U32_FROM_LONG64 (b1Value) >>= srAmt;
LOW_U32_FROM_LONG64 (b1Value) |= (hi << (32 - srAmt));
HIGH_U32_FROM_LONG64 (b1Value) >>= srAmt;
}
else if (mbe == 96)
{
LOW_U32_FROM_LONG64 (b1Value) = hi;
HIGH_U32_FROM_LONG64 (b1Value) = 0;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
LOW_U32_FROM_LONG64_PTR (lp) = 0;
}
else
{
LOW_U32_FROM_LONG64 (b1Value) = hi >> (mbe - 96);
HIGH_U32_FROM_LONG64 (b1Value) = 0;
HIGH_U32_FROM_LONG64_PTR (lp) = 0;
LOW_U32_FROM_LONG64_PTR (lp) = 0;
}
return b1Value;
}
#if defined(WIN32)
/* disable global optimizations on the microsoft compiler for the
* doubleAlgorithm function otherwise it won't compile */
#pragma optimize("g",off)
#endif
/* The algorithm for the function doubleAlgorithm() below can be found
* in:
*
* "How to Read Floating-Point Numbers Accurately", William D.
* Clinger, Proceedings of the ACM SIGPLAN '90 Conference on
* Programming Language Design and Implementation, June 20-22,
* 1990, pp. 92-101.
*
* There is a possibility that the function will end up in an endless
* loop if the given approximating floating-point number (a very small
* floating-point whose value is very close to zero) straddles between
* two approximating integer values. We modified the algorithm slightly
* to detect the case where it oscillates back and forth between
* incrementing and decrementing the floating-point approximation. It
* is currently set such that if the oscillation occurs more than twice
* then return the original approximation.
*/
jdouble
doubleAlgorithm (JNIEnv * env, U_64 * f, IDATA length, jint e, jdouble z)
{
U_64 m;
IDATA k, comparison, comparison2;
U_64 *x, *y, *D, *D2;
IDATA xLength, yLength, DLength, D2Length, decApproxCount, incApproxCount;
PORT_ACCESS_FROM_ENV (env);
x = y = D = D2 = 0;
xLength = yLength = DLength = D2Length = 0;
decApproxCount = incApproxCount = 0;
do
{
m = doubleMantissa (z);
k = doubleExponent (z);
if (x && x != f)
jclmem_free_memory (env, x);
release (y);
release (D);
release (D2);
if (e >= 0 && k >= 0)
{
xLength = sizeOfTenToTheE (e) + length;
allocateU64 (x, xLength);
memset (x + length, 0, sizeof (U_64) * (xLength - length));
memcpy (x, f, sizeof (U_64) * length);
timesTenToTheEHighPrecision (x, xLength, e);
yLength = (k >> 6) + 2;
allocateU64 (y, yLength);
memset (y + 1, 0, sizeof (U_64) * (yLength - 1));
*y = m;
simpleShiftLeftHighPrecision (y, yLength, k);
}
else if (e >= 0)
{
xLength = sizeOfTenToTheE (e) + length + ((-k) >> 6) + 1;
allocateU64 (x, xLength);
memset (x + length, 0, sizeof (U_64) * (xLength - length));
memcpy (x, f, sizeof (U_64) * length);
timesTenToTheEHighPrecision (x, xLength, e);
simpleShiftLeftHighPrecision (x, xLength, -k);
yLength = 1;
allocateU64 (y, 1);
*y = m;
}
else if (k >= 0)
{
xLength = length;
x = f;
yLength = sizeOfTenToTheE (-e) + 2 + (k >> 6);
allocateU64 (y, yLength);
memset (y + 1, 0, sizeof (U_64) * (yLength - 1));
*y = m;
timesTenToTheEHighPrecision (y, yLength, -e);
simpleShiftLeftHighPrecision (y, yLength, k);
}
else
{
xLength = length + ((-k) >> 6) + 1;
allocateU64 (x, xLength);
memset (x + length, 0, sizeof (U_64) * (xLength - length));
memcpy (x, f, sizeof (U_64) * length);
simpleShiftLeftHighPrecision (x, xLength, -k);
yLength = sizeOfTenToTheE (-e) + 1;
allocateU64 (y, yLength);
memset (y + 1, 0, sizeof (U_64) * (yLength - 1));
*y = m;
timesTenToTheEHighPrecision (y, yLength, -e);
}
comparison = compareHighPrecision (x, xLength, y, yLength);
if (comparison > 0)
{ /* x > y */
DLength = xLength;
allocateU64 (D, DLength);
memcpy (D, x, DLength * sizeof (U_64));
subtractHighPrecision (D, DLength, y, yLength);
}
else if (comparison)
{ /* y > x */
DLength = yLength;
allocateU64 (D, DLength);
memcpy (D, y, DLength * sizeof (U_64));
subtractHighPrecision (D, DLength, x, xLength);
}
else
{ /* y == x */
DLength = 1;
allocateU64 (D, 1);
*D = 0;
}
D2Length = DLength + 1;
allocateU64 (D2, D2Length);
m <<= 1;
multiplyHighPrecision (D, DLength, &m, 1, D2, D2Length);
m >>= 1;
comparison2 = compareHighPrecision (D2, D2Length, y, yLength);
if (comparison2 < 0)
{
if (comparison < 0 && m == NORMAL_MASK)
{
simpleShiftLeftHighPrecision (D2, D2Length, 1);
if (compareHighPrecision (D2, D2Length, y, yLength) > 0)
{
DECREMENT_DOUBLE (z, decApproxCount, incApproxCount);
}
else
{
break;
}
}
else
{
break;
}
}
else if (comparison2 == 0)
{
if ((LOW_U32_FROM_VAR (m) & 1) == 0)
{
if (comparison < 0 && m == NORMAL_MASK)
{
DECREMENT_DOUBLE (z, decApproxCount, incApproxCount);
}
else
{
break;
}
}
else if (comparison < 0)
{
DECREMENT_DOUBLE (z, decApproxCount, incApproxCount);
break;
}
else
{
INCREMENT_DOUBLE (z, decApproxCount, incApproxCount);
break;
}
}
else if (comparison < 0)
{
DECREMENT_DOUBLE (z, decApproxCount, incApproxCount);
}
else
{
if (DOUBLE_TO_LONGBITS (z) == INFINITE_LONGBITS)
break;
INCREMENT_DOUBLE (z, decApproxCount, incApproxCount);
}
}
while (1);
if (x && x != f)
jclmem_free_memory (env, x);
release (y);
release (D);
release (D2);
return z;
OutOfMemory:
if (x && x != f)
jclmem_free_memory (env, x);
release (y);
release (D);
release (D2);
DOUBLE_TO_LONGBITS (z) = -2;
return z;
}
#if defined(WIN32)
#pragma optimize("",on) /*restore optimizations */
#endif
JNIEXPORT jdouble JNICALL
Java_org_apache_harmony_luni_util_FloatingPointParser_parseDblImpl (JNIEnv * env,
jclass clazz,
jstring s, jint e)
{
jdouble dbl;
const char *str = (*env)->GetStringUTFChars (env, s, 0);
dbl = createDouble (env, str, e);
(*env)->ReleaseStringUTFChars (env, s, str);
if (!ERROR_OCCURED (dbl))
{
return dbl;
}
else if (LOW_I32_FROM_VAR (dbl) == (I_32) - 1)
{ /* NumberFormatException */
throwNewExceptionByName(env, "java/lang/NumberFormatException", "");
}
else
{ /* OutOfMemoryError */
throwNewOutOfMemoryError(env, "");
}
return 0.0;
}
/* The algorithm for this particular function can be found in:
*
* Printing Floating-Point Numbers Quickly and Accurately, Robert
* G. Burger, and R. Kent Dybvig, Programming Language Design and
* Implementation (PLDI) 1996, pp.108-116.
*
* The previous implementation of this function combined m+ and m- into
* one single M which caused some inaccuracy of the last digit. The
* particular case below shows this inaccuracy:
*
* System.out.println(new Double((1.234123412431233E107)).toString());
* System.out.println(new Double((1.2341234124312331E107)).toString());
* System.out.println(new Double((1.2341234124312332E107)).toString());
*
* outputs the following:
*
* 1.234123412431233E107
* 1.234123412431233E107
* 1.234123412431233E107
*
* instead of:
*
* 1.234123412431233E107
* 1.2341234124312331E107
* 1.2341234124312331E107
*
*/
JNIEXPORT void JNICALL
Java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl (JNIEnv *
env,
jobject
inst,
jlong f,
jint e,
jboolean
isDenormalized,
jboolean
mantissaIsZero,
jint p)
{
int RLength, SLength, TempLength, mplus_Length, mminus_Length;
int high, low, i;
jint k, firstK, U;
jint getCount, setCount;
jint *uArray;
jclass clazz;
jfieldID fid;
jintArray uArrayObject;
U_64 R[RM_SIZE], S[STemp_SIZE], mplus[RM_SIZE], mminus[RM_SIZE],
Temp[STemp_SIZE];
memset (R, 0, RM_SIZE * sizeof (U_64));
memset (S, 0, STemp_SIZE * sizeof (U_64));
memset (mplus, 0, RM_SIZE * sizeof (U_64));
memset (mminus, 0, RM_SIZE * sizeof (U_64));
memset (Temp, 0, STemp_SIZE * sizeof (U_64));
if (e >= 0)
{
*R = f;
*mplus = *mminus = 1;
simpleShiftLeftHighPrecision (mminus, RM_SIZE, e);
if (f != (2 << (p - 1)))
{
simpleShiftLeftHighPrecision (R, RM_SIZE, e + 1);
*S = 2;
/*
* m+ = m+ << e results in 1.0e23 to be printed as
* 0.9999999999999999E23
* m+ = m+ << e+1 results in 1.0e23 to be printed as
* 1.0e23 (caused too much rounding)
* 470fffffffffffff = 2.0769187434139308E34
* 4710000000000000 = 2.076918743413931E34
*/
simpleShiftLeftHighPrecision (mplus, RM_SIZE, e);
}
else
{
simpleShiftLeftHighPrecision (R, RM_SIZE, e + 2);
*S = 4;
simpleShiftLeftHighPrecision (mplus, RM_SIZE, e + 1);
}
}
else
{
if (isDenormalized || (f != (2 << (p - 1))))
{
*R = f << 1;
*S = 1;
simpleShiftLeftHighPrecision (S, STemp_SIZE, 1 - e);
*mplus = *mminus = 1;
}
else
{
*R = f << 2;
*S = 1;
simpleShiftLeftHighPrecision (S, STemp_SIZE, 2 - e);
*mplus = 2;
*mminus = 1;
}
}
k = (int) ceil ((e + p - 1) * INV_LOG_OF_TEN_BASE_2 - 1e-10);
if (k > 0)
{
timesTenToTheEHighPrecision (S, STemp_SIZE, k);
}
else
{
timesTenToTheEHighPrecision (R, RM_SIZE, -k);
timesTenToTheEHighPrecision (mplus, RM_SIZE, -k);
timesTenToTheEHighPrecision (mminus, RM_SIZE, -k);
}
RLength = mplus_Length = mminus_Length = RM_SIZE;
SLength = TempLength = STemp_SIZE;
memset (Temp + RM_SIZE, 0, (STemp_SIZE - RM_SIZE) * sizeof (U_64));
memcpy (Temp, R, RM_SIZE * sizeof (U_64));
while (RLength > 1 && R[RLength - 1] == 0)
--RLength;
while (mplus_Length > 1 && mplus[mplus_Length - 1] == 0)
--mplus_Length;
while (mminus_Length > 1 && mminus[mminus_Length - 1] == 0)
--mminus_Length;
while (SLength > 1 && S[SLength - 1] == 0)
--SLength;
TempLength = (RLength > mplus_Length ? RLength : mplus_Length) + 1;
addHighPrecision (Temp, TempLength, mplus, mplus_Length);
if (compareHighPrecision (Temp, TempLength, S, SLength) >= 0)
{
firstK = k;
}
else
{
firstK = k - 1;
simpleAppendDecimalDigitHighPrecision (R, ++RLength, 0);
simpleAppendDecimalDigitHighPrecision (mplus, ++mplus_Length, 0);
simpleAppendDecimalDigitHighPrecision (mminus, ++mminus_Length, 0);
while (RLength > 1 && R[RLength - 1] == 0)
--RLength;
while (mplus_Length > 1 && mplus[mplus_Length - 1] == 0)
--mplus_Length;
while (mminus_Length > 1 && mminus[mminus_Length - 1] == 0)
--mminus_Length;
}
clazz = (*env)->GetObjectClass (env, inst);
fid = (*env)->GetFieldID (env, clazz, "uArray", "[I");
uArrayObject = (jintArray) (*env)->GetObjectField (env, inst, fid);
uArray = (*env)->GetIntArrayElements (env, uArrayObject, 0);
getCount = setCount = 0;
do
{
U = 0;
for (i = 3; i >= 0; --i)
{
TempLength = SLength + 1;
Temp[SLength] = 0;
memcpy (Temp, S, SLength * sizeof (U_64));
simpleShiftLeftHighPrecision (Temp, TempLength, i);
if (compareHighPrecision (R, RLength, Temp, TempLength) >= 0)
{
subtractHighPrecision (R, RLength, Temp, TempLength);
U += 1 << i;
}
}
low = compareHighPrecision (R, RLength, mminus, mminus_Length) <= 0;
memset (Temp + RLength, 0, (STemp_SIZE - RLength) * sizeof (U_64));
memcpy (Temp, R, RLength * sizeof (U_64));
TempLength = (RLength > mplus_Length ? RLength : mplus_Length) + 1;
addHighPrecision (Temp, TempLength, mplus, mplus_Length);
high = compareHighPrecision (Temp, TempLength, S, SLength) >= 0;
if (low || high)
break;
simpleAppendDecimalDigitHighPrecision (R, ++RLength, 0);
simpleAppendDecimalDigitHighPrecision (mplus, ++mplus_Length, 0);
simpleAppendDecimalDigitHighPrecision (mminus, ++mminus_Length, 0);
while (RLength > 1 && R[RLength - 1] == 0)
--RLength;
while (mplus_Length > 1 && mplus[mplus_Length - 1] == 0)
--mplus_Length;
while (mminus_Length > 1 && mminus[mminus_Length - 1] == 0)
--mminus_Length;
uArray[setCount++] = U;
}
while (1);
simpleShiftLeftHighPrecision (R, ++RLength, 1);
if (low && !high)
uArray[setCount++] = U;
else if (high && !low)
uArray[setCount++] = U + 1;
else if (compareHighPrecision (R, RLength, S, SLength) < 0)
uArray[setCount++] = U;
else
uArray[setCount++] = U + 1;
(*env)->ReleaseIntArrayElements (env, uArrayObject, uArray, 0);
fid = (*env)->GetFieldID (env, clazz, "setCount", "I");
(*env)->SetIntField (env, inst, fid, setCount);
fid = (*env)->GetFieldID (env, clazz, "getCount", "I");
(*env)->SetIntField (env, inst, fid, getCount);
fid = (*env)->GetFieldID (env, clazz, "firstK", "I");
(*env)->SetIntField (env, inst, fid, firstK);
}
| skyHALud/codenameone | Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/luni/src/main/native/luni/shared/dblparse.c | C | gpl-2.0 | 28,372 |
/*
* 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.
*/
/**
* @author Evgeniya G. Maenkova
*/
package org.apache.harmony.awt.text;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.swing.text.Element;
import javax.swing.text.View;
public abstract class TextFactory {
private static final String FACTORY_IMPL_CLS_NAME =
"javax.swing.text.TextFactoryImpl"; //$NON-NLS-1$
private static final TextFactory viewFactory = createTextFactory();
public static TextFactory getTextFactory() {
return viewFactory;
}
private static TextFactory createTextFactory() {
PrivilegedAction<TextFactory> createAction = new PrivilegedAction<TextFactory>() {
public TextFactory run() {
try {
Class<?> factoryImplClass = Class
.forName(FACTORY_IMPL_CLS_NAME);
Constructor<?> defConstr =
factoryImplClass.getDeclaredConstructor(new Class[0]);
defConstr.setAccessible(true);
return (TextFactory)defConstr.newInstance(new Object[0]);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
};
return AccessController.doPrivileged(createAction);
}
public abstract RootViewContext createRootView(final Element element);
public abstract View createPlainView(final Element e);
public abstract View createWrappedPlainView(final Element e);
public abstract View createFieldView(final Element e);
public abstract View createPasswordView(Element e);
public abstract TextCaret createCaret();
}
| skyHALud/codenameone | Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/awt/src/main/java/common/org/apache/harmony/awt/text/TextFactory.java | Java | gpl-2.0 | 3,164 |
/**
******************************************************************************
* @file fatfs.c
* @brief Code for fatfs applications
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
#include "fatfs.h"
uint8_t retSD; /* Return value for SD */
char SDPath[4]; /* SD logical drive path */
FATFS SDFatFS; /* File system object for SD logical drive */
FIL SDFile; /* File object for SD */
/* USER CODE BEGIN Variables */
/* USER CODE END Variables */
void MX_FATFS_Init(void)
{
/*## FatFS: Link the SD driver ###########################*/
retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
/* USER CODE BEGIN Init */
/* additional user code for init */
/* USER CODE END Init */
}
/**
* @brief Gets Time from RTC
* @param None
* @retval Time in DWORD
*/
DWORD get_fattime(void)
{
/* USER CODE BEGIN get_fattime */
return 0;
/* USER CODE END get_fattime */
}
/* USER CODE BEGIN Application */
/* USER CODE END Application */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| cafe-alpha/wascafe | v13/stm32_bup_test/r07c_firm_F446RE/Src/fatfs.c | C | gpl-2.0 | 1,568 |
/* MMIX-specific support for 64-bit ELF.
Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Hans-Peter Nilsson <hp@bitrange.com>
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* No specific ABI or "processor-specific supplement" defined. */
/* TODO:
- "Traditional" linker relaxation (shrinking whole sections).
- Merge reloc stubs jumping to same location.
- GETA stub relaxation (call a stub for out of range new
R_MMIX_GETA_STUBBABLE). */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/mmix.h"
#include "opcode/mmix.h"
#define MINUS_ONE (((bfd_vma) 0) - 1)
#define MAX_PUSHJ_STUB_SIZE (5 * 4)
/* Put these everywhere in new code. */
#define FATAL_DEBUG \
_bfd_abort (__FILE__, __LINE__, \
"Internal: Non-debugged code (test-case missing)")
#define BAD_CASE(x) \
_bfd_abort (__FILE__, __LINE__, \
"bad case for " #x)
struct _mmix_elf_section_data
{
struct bfd_elf_section_data elf;
union
{
struct bpo_reloc_section_info *reloc;
struct bpo_greg_section_info *greg;
} bpo;
struct pushj_stub_info
{
/* Maximum number of stubs needed for this section. */
bfd_size_type n_pushj_relocs;
/* Size of stubs after a mmix_elf_relax_section round. */
bfd_size_type stubs_size_sum;
/* Per-reloc stubs_size_sum information. The stubs_size_sum member is the sum
of these. Allocated in mmix_elf_check_common_relocs. */
bfd_size_type *stub_size;
/* Offset of next stub during relocation. Somewhat redundant with the
above: error coverage is easier and we don't have to reset the
stubs_size_sum for relocation. */
bfd_size_type stub_offset;
} pjs;
};
#define mmix_elf_section_data(sec) \
((struct _mmix_elf_section_data *) elf_section_data (sec))
/* For each section containing a base-plus-offset (BPO) reloc, we attach
this struct as mmix_elf_section_data (section)->bpo, which is otherwise
NULL. */
struct bpo_reloc_section_info
{
/* The base is 1; this is the first number in this section. */
size_t first_base_plus_offset_reloc;
/* Number of BPO-relocs in this section. */
size_t n_bpo_relocs_this_section;
/* Running index, used at relocation time. */
size_t bpo_index;
/* We don't have access to the bfd_link_info struct in
mmix_final_link_relocate. What we really want to get at is the
global single struct greg_relocation, so we stash it here. */
asection *bpo_greg_section;
};
/* Helper struct (in global context) for the one below.
There's one of these created for every BPO reloc. */
struct bpo_reloc_request
{
bfd_vma value;
/* Valid after relaxation. The base is 0; the first register number
must be added. The offset is in range 0..255. */
size_t regindex;
size_t offset;
/* The order number for this BPO reloc, corresponding to the order in
which BPO relocs were found. Used to create an index after reloc
requests are sorted. */
size_t bpo_reloc_no;
/* Set when the value is computed. Better than coding "guard values"
into the other members. Is FALSE only for BPO relocs in a GC:ed
section. */
bfd_boolean valid;
};
/* We attach this as mmix_elf_section_data (sec)->bpo in the linker-allocated
greg contents section (MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME),
which is linked into the register contents section
(MMIX_REG_CONTENTS_SECTION_NAME). This section is created by the
linker; using the same hook as for usual with BPO relocs does not
collide. */
struct bpo_greg_section_info
{
/* After GC, this reflects the number of remaining, non-excluded
BPO-relocs. */
size_t n_bpo_relocs;
/* This is the number of allocated bpo_reloc_requests; the size of
sorted_indexes. Valid after the check.*relocs functions are called
for all incoming sections. It includes the number of BPO relocs in
sections that were GC:ed. */
size_t n_max_bpo_relocs;
/* A counter used to find out when to fold the BPO gregs, since we
don't have a single "after-relaxation" hook. */
size_t n_remaining_bpo_relocs_this_relaxation_round;
/* The number of linker-allocated GREGs resulting from BPO relocs.
This is an approximation after _bfd_mmix_before_linker_allocation
and supposedly accurate after mmix_elf_relax_section is called for
all incoming non-collected sections. */
size_t n_allocated_bpo_gregs;
/* Index into reloc_request[], sorted on increasing "value", secondary
by increasing index for strict sorting order. */
size_t *bpo_reloc_indexes;
/* An array of all relocations, with the "value" member filled in by
the relaxation function. */
struct bpo_reloc_request *reloc_request;
};
static bfd_boolean mmix_elf_link_output_symbol_hook
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *));
static bfd_reloc_status_type mmix_elf_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void mmix_info_to_howto_rela
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static int mmix_elf_sort_relocs PARAMS ((const PTR, const PTR));
static bfd_boolean mmix_elf_new_section_hook
PARAMS ((bfd *, asection *));
static bfd_boolean mmix_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static bfd_boolean mmix_elf_check_common_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static bfd_boolean mmix_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static asection * mmix_elf_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static bfd_boolean mmix_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static bfd_reloc_status_type mmix_final_link_relocate
PARAMS ((reloc_howto_type *, asection *, bfd_byte *,
bfd_vma, bfd_signed_vma, bfd_vma, const char *, asection *));
static bfd_reloc_status_type mmix_elf_perform_relocation
PARAMS ((asection *, reloc_howto_type *, PTR, bfd_vma, bfd_vma));
static bfd_boolean mmix_elf_section_from_bfd_section
PARAMS ((bfd *, asection *, int *));
static bfd_boolean mmix_elf_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *));
static bfd_boolean mmix_elf_is_local_label_name
PARAMS ((bfd *, const char *));
static int bpo_reloc_request_sort_fn PARAMS ((const PTR, const PTR));
static bfd_boolean mmix_elf_relax_section
PARAMS ((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
bfd_boolean *again));
extern bfd_boolean mmix_elf_final_link PARAMS ((bfd *, struct bfd_link_info *));
extern void mmix_elf_symbol_processing PARAMS ((bfd *, asymbol *));
/* Only intended to be called from a debugger. */
extern void mmix_dump_bpo_gregs
PARAMS ((struct bfd_link_info *, bfd_error_handler_type));
static void
mmix_set_relaxable_size
PARAMS ((bfd *, asection *, void *));
/* Watch out: this currently needs to have elements with the same index as
their R_MMIX_ number. */
static reloc_howto_type elf_mmix_howto_table[] =
{
/* This reloc does nothing. */
HOWTO (R_MMIX_NONE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_NONE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
/* An 8 bit absolute relocation. */
HOWTO (R_MMIX_8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An 16 bit absolute relocation. */
HOWTO (R_MMIX_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_16", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* An 24 bit absolute relocation. */
HOWTO (R_MMIX_24, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_24", /* name */
FALSE, /* partial_inplace */
~0xffffff, /* src_mask */
0xffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 32 bit absolute relocation. */
HOWTO (R_MMIX_32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_32", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* 64 bit relocation. */
HOWTO (R_MMIX_64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_64", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
FALSE), /* pcrel_offset */
/* An 8 bit PC-relative relocation. */
HOWTO (R_MMIX_PC_8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_PC_8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
TRUE), /* pcrel_offset */
/* An 16 bit PC-relative relocation. */
HOWTO (R_MMIX_PC_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_PC_16", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* An 24 bit PC-relative relocation. */
HOWTO (R_MMIX_PC_24, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_PC_24", /* name */
FALSE, /* partial_inplace */
~0xffffff, /* src_mask */
0xffffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 32 bit absolute PC-relative relocation. */
HOWTO (R_MMIX_PC_32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_PC_32", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* 64 bit PC-relative relocation. */
HOWTO (R_MMIX_PC_64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MMIX_PC_64", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
TRUE), /* pcrel_offset */
/* GNU extension to record C++ vtable hierarchy. */
HOWTO (R_MMIX_GNU_VTINHERIT, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_MMIX_GNU_VTINHERIT", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
TRUE), /* pcrel_offset */
/* GNU extension to record C++ vtable member usage. */
HOWTO (R_MMIX_GNU_VTENTRY, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
"R_MMIX_GNU_VTENTRY", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
/* The GETA relocation is supposed to get any address that could
possibly be reached by the GETA instruction. It can silently expand
to get a 64-bit operand, but will complain if any of the two least
significant bits are set. The howto members reflect a simple GETA. */
HOWTO (R_MMIX_GETA, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_GETA", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_GETA_1, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_GETA_1", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_GETA_2, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_GETA_2", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_GETA_3, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_GETA_3", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* The conditional branches are supposed to reach any (code) address.
It can silently expand to a 64-bit operand, but will emit an error if
any of the two least significant bits are set. The howto members
reflect a simple branch. */
HOWTO (R_MMIX_CBRANCH, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_CBRANCH", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_CBRANCH_J, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_CBRANCH_J", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_CBRANCH_1, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_CBRANCH_1", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_CBRANCH_2, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_CBRANCH_2", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_CBRANCH_3, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_CBRANCH_3", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* The PUSHJ instruction can reach any (code) address, as long as it's
the beginning of a function (no usable restriction). It can silently
expand to a 64-bit operand, but will emit an error if any of the two
least significant bits are set. It can also expand into a call to a
stub; see R_MMIX_PUSHJ_STUBBABLE. The howto members reflect a simple
PUSHJ. */
HOWTO (R_MMIX_PUSHJ, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_PUSHJ", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_PUSHJ_1, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_PUSHJ_1", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_PUSHJ_2, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_PUSHJ_2", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_PUSHJ_3, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_PUSHJ_3", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A JMP is supposed to reach any (code) address. By itself, it can
reach +-64M; the expansion can reach all 64 bits. Note that the 64M
limit is soon reached if you link the program in wildly different
memory segments. The howto members reflect a trivial JMP. */
HOWTO (R_MMIX_JMP, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
27, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_JMP", /* name */
FALSE, /* partial_inplace */
~0x1ffffff, /* src_mask */
0x1ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_JMP_1, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
27, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_JMP_1", /* name */
FALSE, /* partial_inplace */
~0x1ffffff, /* src_mask */
0x1ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_JMP_2, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
27, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_JMP_2", /* name */
FALSE, /* partial_inplace */
~0x1ffffff, /* src_mask */
0x1ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_MMIX_JMP_3, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
27, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_JMP_3", /* name */
FALSE, /* partial_inplace */
~0x1ffffff, /* src_mask */
0x1ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* When we don't emit link-time-relaxable code from the assembler, or
when relaxation has done all it can do, these relocs are used. For
GETA/PUSHJ/branches. */
HOWTO (R_MMIX_ADDR19, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_ADDR19", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* For JMP. */
HOWTO (R_MMIX_ADDR27, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
27, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_ADDR27", /* name */
FALSE, /* partial_inplace */
~0x1ffffff, /* src_mask */
0x1ffffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A general register or the value 0..255. If a value, then the
instruction (offset -3) needs adjusting. */
HOWTO (R_MMIX_REG_OR_BYTE, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_REG_OR_BYTE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A general register. */
HOWTO (R_MMIX_REG, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_REG", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A register plus an index, corresponding to the relocation expression.
The sizes must correspond to the valid range of the expression, while
the bitmasks correspond to what we store in the image. */
HOWTO (R_MMIX_BASE_PLUS_OFFSET, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_BASE_PLUS_OFFSET", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A "magic" relocation for a LOCAL expression, asserting that the
expression is less than the number of global registers. No actual
modification of the contents is done. Implementing this as a
relocation was less intrusive than e.g. putting such expressions in a
section to discard *after* relocation. */
HOWTO (R_MMIX_LOCAL, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_LOCAL", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_MMIX_PUSHJ_STUBBABLE, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
19, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mmix_elf_reloc, /* special_function */
"R_MMIX_PUSHJ_STUBBABLE", /* name */
FALSE, /* partial_inplace */
~0x0100ffff, /* src_mask */
0x0100ffff, /* dst_mask */
TRUE) /* pcrel_offset */
};
/* Map BFD reloc types to MMIX ELF reloc types. */
struct mmix_reloc_map
{
bfd_reloc_code_real_type bfd_reloc_val;
enum elf_mmix_reloc_type elf_reloc_val;
};
static const struct mmix_reloc_map mmix_reloc_map[] =
{
{BFD_RELOC_NONE, R_MMIX_NONE},
{BFD_RELOC_8, R_MMIX_8},
{BFD_RELOC_16, R_MMIX_16},
{BFD_RELOC_24, R_MMIX_24},
{BFD_RELOC_32, R_MMIX_32},
{BFD_RELOC_64, R_MMIX_64},
{BFD_RELOC_8_PCREL, R_MMIX_PC_8},
{BFD_RELOC_16_PCREL, R_MMIX_PC_16},
{BFD_RELOC_24_PCREL, R_MMIX_PC_24},
{BFD_RELOC_32_PCREL, R_MMIX_PC_32},
{BFD_RELOC_64_PCREL, R_MMIX_PC_64},
{BFD_RELOC_VTABLE_INHERIT, R_MMIX_GNU_VTINHERIT},
{BFD_RELOC_VTABLE_ENTRY, R_MMIX_GNU_VTENTRY},
{BFD_RELOC_MMIX_GETA, R_MMIX_GETA},
{BFD_RELOC_MMIX_CBRANCH, R_MMIX_CBRANCH},
{BFD_RELOC_MMIX_PUSHJ, R_MMIX_PUSHJ},
{BFD_RELOC_MMIX_JMP, R_MMIX_JMP},
{BFD_RELOC_MMIX_ADDR19, R_MMIX_ADDR19},
{BFD_RELOC_MMIX_ADDR27, R_MMIX_ADDR27},
{BFD_RELOC_MMIX_REG_OR_BYTE, R_MMIX_REG_OR_BYTE},
{BFD_RELOC_MMIX_REG, R_MMIX_REG},
{BFD_RELOC_MMIX_BASE_PLUS_OFFSET, R_MMIX_BASE_PLUS_OFFSET},
{BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL},
{BFD_RELOC_MMIX_PUSHJ_STUBBABLE, R_MMIX_PUSHJ_STUBBABLE}
};
static reloc_howto_type *
bfd_elf64_bfd_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
unsigned int i;
for (i = 0;
i < sizeof (mmix_reloc_map) / sizeof (mmix_reloc_map[0]);
i++)
{
if (mmix_reloc_map[i].bfd_reloc_val == code)
return &elf_mmix_howto_table[mmix_reloc_map[i].elf_reloc_val];
}
return NULL;
}
static bfd_boolean
mmix_elf_new_section_hook (abfd, sec)
bfd *abfd;
asection *sec;
{
struct _mmix_elf_section_data *sdata;
bfd_size_type amt = sizeof (*sdata);
sdata = (struct _mmix_elf_section_data *) bfd_zalloc (abfd, amt);
if (sdata == NULL)
return FALSE;
sec->used_by_bfd = (PTR) sdata;
return _bfd_elf_new_section_hook (abfd, sec);
}
/* This function performs the actual bitfiddling and sanity check for a
final relocation. Each relocation gets its *worst*-case expansion
in size when it arrives here; any reduction in size should have been
caught in linker relaxation earlier. When we get here, the relocation
looks like the smallest instruction with SWYM:s (nop:s) appended to the
max size. We fill in those nop:s.
R_MMIX_GETA: (FIXME: Relaxation should break this up in 1, 2, 3 tetra)
GETA $N,foo
->
SETL $N,foo & 0xffff
INCML $N,(foo >> 16) & 0xffff
INCMH $N,(foo >> 32) & 0xffff
INCH $N,(foo >> 48) & 0xffff
R_MMIX_CBRANCH: (FIXME: Relaxation should break this up, but
condbranches needing relaxation might be rare enough to not be
worthwhile.)
[P]Bcc $N,foo
->
[~P]B~cc $N,.+20
SETL $255,foo & ...
INCML ...
INCMH ...
INCH ...
GO $255,$255,0
R_MMIX_PUSHJ: (FIXME: Relaxation...)
PUSHJ $N,foo
->
SETL $255,foo & ...
INCML ...
INCMH ...
INCH ...
PUSHGO $N,$255,0
R_MMIX_JMP: (FIXME: Relaxation...)
JMP foo
->
SETL $255,foo & ...
INCML ...
INCMH ...
INCH ...
GO $255,$255,0
R_MMIX_ADDR19 and R_MMIX_ADDR27 are just filled in. */
static bfd_reloc_status_type
mmix_elf_perform_relocation (isec, howto, datap, addr, value)
asection *isec;
reloc_howto_type *howto;
PTR datap;
bfd_vma addr;
bfd_vma value;
{
bfd *abfd = isec->owner;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_reloc_status_type r;
int offs = 0;
int reg = 255;
/* The worst case bits are all similar SETL/INCML/INCMH/INCH sequences.
We handle the differences here and the common sequence later. */
switch (howto->type)
{
case R_MMIX_GETA:
offs = 0;
reg = bfd_get_8 (abfd, (bfd_byte *) datap + 1);
/* We change to an absolute value. */
value += addr;
break;
case R_MMIX_CBRANCH:
{
int in1 = bfd_get_16 (abfd, (bfd_byte *) datap) << 16;
/* Invert the condition and prediction bit, and set the offset
to five instructions ahead.
We *can* do better if we want to. If the branch is found to be
within limits, we could leave the branch as is; there'll just
be a bunch of NOP:s after it. But we shouldn't see this
sequence often enough that it's worth doing it. */
bfd_put_32 (abfd,
(((in1 ^ ((PRED_INV_BIT | COND_INV_BIT) << 24)) & ~0xffff)
| (24/4)),
(bfd_byte *) datap);
/* Put a "GO $255,$255,0" after the common sequence. */
bfd_put_32 (abfd,
((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24) | 0xffff00,
(bfd_byte *) datap + 20);
/* Common sequence starts at offset 4. */
offs = 4;
/* We change to an absolute value. */
value += addr;
}
break;
case R_MMIX_PUSHJ_STUBBABLE:
/* If the address fits, we're fine. */
if ((value & 3) == 0
/* Note rightshift 0; see R_MMIX_JMP case below. */
&& (r = bfd_check_overflow (complain_overflow_signed,
howto->bitsize,
0,
bfd_arch_bits_per_address (abfd),
value)) == bfd_reloc_ok)
goto pcrel_mmix_reloc_fits;
else
{
bfd_size_type size = isec->rawsize ? isec->rawsize : isec->size;
/* We have the bytes at the PUSHJ insn and need to get the
position for the stub. There's supposed to be room allocated
for the stub. */
bfd_byte *stubcontents
= ((bfd_byte *) datap
- (addr - (isec->output_section->vma + isec->output_offset))
+ size
+ mmix_elf_section_data (isec)->pjs.stub_offset);
bfd_vma stubaddr;
/* The address doesn't fit, so redirect the PUSHJ to the
location of the stub. */
r = mmix_elf_perform_relocation (isec,
&elf_mmix_howto_table
[R_MMIX_ADDR19],
datap,
addr,
isec->output_section->vma
+ isec->output_offset
+ size
+ (mmix_elf_section_data (isec)
->pjs.stub_offset)
- addr);
if (r != bfd_reloc_ok)
return r;
stubaddr
= (isec->output_section->vma
+ isec->output_offset
+ size
+ mmix_elf_section_data (isec)->pjs.stub_offset);
/* We generate a simple JMP if that suffices, else the whole 5
insn stub. */
if (bfd_check_overflow (complain_overflow_signed,
elf_mmix_howto_table[R_MMIX_ADDR27].bitsize,
0,
bfd_arch_bits_per_address (abfd),
addr + value - stubaddr) == bfd_reloc_ok)
{
bfd_put_32 (abfd, JMP_INSN_BYTE << 24, stubcontents);
r = mmix_elf_perform_relocation (isec,
&elf_mmix_howto_table
[R_MMIX_ADDR27],
stubcontents,
stubaddr,
value + addr - stubaddr);
mmix_elf_section_data (isec)->pjs.stub_offset += 4;
if (size + mmix_elf_section_data (isec)->pjs.stub_offset
> isec->size)
abort ();
return r;
}
else
{
/* Put a "GO $255,0" after the common sequence. */
bfd_put_32 (abfd,
((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24)
| 0xff00, (bfd_byte *) stubcontents + 16);
/* Prepare for the general code to set the first part of the
linker stub, and */
value += addr;
datap = stubcontents;
mmix_elf_section_data (isec)->pjs.stub_offset
+= MAX_PUSHJ_STUB_SIZE;
}
}
break;
case R_MMIX_PUSHJ:
{
int inreg = bfd_get_8 (abfd, (bfd_byte *) datap + 1);
/* Put a "PUSHGO $N,$255,0" after the common sequence. */
bfd_put_32 (abfd,
((PUSHGO_INSN_BYTE | IMM_OFFSET_BIT) << 24)
| (inreg << 16)
| 0xff00,
(bfd_byte *) datap + 16);
/* We change to an absolute value. */
value += addr;
}
break;
case R_MMIX_JMP:
/* This one is a little special. If we get here on a non-relaxing
link, and the destination is actually in range, we don't need to
execute the nops.
If so, we fall through to the bit-fiddling relocs.
FIXME: bfd_check_overflow seems broken; the relocation is
rightshifted before testing, so supply a zero rightshift. */
if (! ((value & 3) == 0
&& (r = bfd_check_overflow (complain_overflow_signed,
howto->bitsize,
0,
bfd_arch_bits_per_address (abfd),
value)) == bfd_reloc_ok))
{
/* If the relocation doesn't fit in a JMP, we let the NOP:s be
modified below, and put a "GO $255,$255,0" after the
address-loading sequence. */
bfd_put_32 (abfd,
((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24)
| 0xffff00,
(bfd_byte *) datap + 16);
/* We change to an absolute value. */
value += addr;
break;
}
/* FALLTHROUGH. */
case R_MMIX_ADDR19:
case R_MMIX_ADDR27:
pcrel_mmix_reloc_fits:
/* These must be in range, or else we emit an error. */
if ((value & 3) == 0
/* Note rightshift 0; see above. */
&& (r = bfd_check_overflow (complain_overflow_signed,
howto->bitsize,
0,
bfd_arch_bits_per_address (abfd),
value)) == bfd_reloc_ok)
{
bfd_vma in1
= bfd_get_32 (abfd, (bfd_byte *) datap);
bfd_vma highbit;
if ((bfd_signed_vma) value < 0)
{
highbit = 1 << 24;
value += (1 << (howto->bitsize - 1));
}
else
highbit = 0;
value >>= 2;
bfd_put_32 (abfd,
(in1 & howto->src_mask)
| highbit
| (value & howto->dst_mask),
(bfd_byte *) datap);
return bfd_reloc_ok;
}
else
return bfd_reloc_overflow;
case R_MMIX_BASE_PLUS_OFFSET:
{
struct bpo_reloc_section_info *bpodata
= mmix_elf_section_data (isec)->bpo.reloc;
asection *bpo_greg_section
= bpodata->bpo_greg_section;
struct bpo_greg_section_info *gregdata
= mmix_elf_section_data (bpo_greg_section)->bpo.greg;
size_t bpo_index
= gregdata->bpo_reloc_indexes[bpodata->bpo_index++];
/* A consistency check: The value we now have in "relocation" must
be the same as the value we stored for that relocation. It
doesn't cost much, so can be left in at all times. */
if (value != gregdata->reloc_request[bpo_index].value)
{
(*_bfd_error_handler)
(_("%s: Internal inconsistency error for value for\n\
linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n"),
bfd_get_filename (isec->owner),
(unsigned long) (value >> 32), (unsigned long) value,
(unsigned long) (gregdata->reloc_request[bpo_index].value
>> 32),
(unsigned long) gregdata->reloc_request[bpo_index].value);
bfd_set_error (bfd_error_bad_value);
return bfd_reloc_overflow;
}
/* Then store the register number and offset for that register
into datap and datap + 1 respectively. */
bfd_put_8 (abfd,
gregdata->reloc_request[bpo_index].regindex
+ bpo_greg_section->output_section->vma / 8,
datap);
bfd_put_8 (abfd,
gregdata->reloc_request[bpo_index].offset,
((unsigned char *) datap) + 1);
return bfd_reloc_ok;
}
case R_MMIX_REG_OR_BYTE:
case R_MMIX_REG:
if (value > 255)
return bfd_reloc_overflow;
bfd_put_8 (abfd, value, datap);
return bfd_reloc_ok;
default:
BAD_CASE (howto->type);
}
/* This code adds the common SETL/INCML/INCMH/INCH worst-case
sequence. */
/* Lowest two bits must be 0. We return bfd_reloc_overflow for
everything that looks strange. */
if (value & 3)
flag = bfd_reloc_overflow;
bfd_put_32 (abfd,
(SETL_INSN_BYTE << 24) | (value & 0xffff) | (reg << 16),
(bfd_byte *) datap + offs);
bfd_put_32 (abfd,
(INCML_INSN_BYTE << 24) | ((value >> 16) & 0xffff) | (reg << 16),
(bfd_byte *) datap + offs + 4);
bfd_put_32 (abfd,
(INCMH_INSN_BYTE << 24) | ((value >> 32) & 0xffff) | (reg << 16),
(bfd_byte *) datap + offs + 8);
bfd_put_32 (abfd,
(INCH_INSN_BYTE << 24) | ((value >> 48) & 0xffff) | (reg << 16),
(bfd_byte *) datap + offs + 12);
return flag;
}
/* Set the howto pointer for an MMIX ELF reloc (type RELA). */
static void
mmix_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{
unsigned int r_type;
r_type = ELF64_R_TYPE (dst->r_info);
BFD_ASSERT (r_type < (unsigned int) R_MMIX_max);
cache_ptr->howto = &elf_mmix_howto_table[r_type];
}
/* Any MMIX-specific relocation gets here at assembly time or when linking
to other formats (such as mmo); this is the relocation function from
the reloc_table. We don't get here for final pure ELF linking. */
static bfd_reloc_status_type
mmix_elf_reloc (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
bfd_vma relocation;
bfd_reloc_status_type r;
asection *reloc_target_output_section;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_vma output_base = 0;
bfd_vma addr;
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
/* If that was all that was needed (i.e. this isn't a final link, only
some segment adjustments), we're done. */
if (r != bfd_reloc_continue)
return r;
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
&& output_bfd == (bfd *) NULL)
return bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = bfd_get_output_section (symbol);
/* Here the variable relocation holds the final address of the symbol we
are relocating against, plus any addend. */
if (output_bfd)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
relocation += output_base + symbol->section->output_offset;
/* Get position of relocation. */
addr = (reloc_entry->address + input_section->output_section->vma
+ input_section->output_offset);
if (output_bfd != (bfd *) NULL)
{
/* Add in supplied addend. */
relocation += reloc_entry->addend;
/* This is a partial relocation, and we want to apply the
relocation to the reloc entry rather than the raw data.
Modify the reloc inplace to reflect what we now know. */
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
return mmix_final_link_relocate (reloc_entry->howto, input_section,
data, reloc_entry->address,
reloc_entry->addend, relocation,
bfd_asymbol_name (symbol),
reloc_target_output_section);
}
/* Relocate an MMIX ELF section. Modified from elf32-fr30.c; look to it
for guidance if you're thinking of copying this. */
static bfd_boolean
mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
bfd_byte *contents;
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
bfd_size_type size;
size_t pjsno = 0;
size = input_section->rawsize ? input_section->rawsize : input_section->size;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
/* Zero the stub area before we start. */
if (input_section->rawsize != 0
&& input_section->size > input_section->rawsize)
memset (contents + input_section->rawsize, 0,
input_section->size - input_section->rawsize);
for (rel = relocs; rel < relend; rel ++)
{
reloc_howto_type *howto;
unsigned long r_symndx;
Elf_Internal_Sym *sym;
asection *sec;
struct elf_link_hash_entry *h;
bfd_vma relocation;
bfd_reloc_status_type r;
const char *name = NULL;
int r_type;
bfd_boolean undefined_signalled = FALSE;
r_type = ELF64_R_TYPE (rel->r_info);
if (r_type == R_MMIX_GNU_VTINHERIT
|| r_type == R_MMIX_GNU_VTENTRY)
continue;
r_symndx = ELF64_R_SYM (rel->r_info);
if (info->relocatable)
{
/* This is a relocatable link. For most relocs we don't have to
change anything, unless the reloc is against a section
symbol, in which case we have to adjust according to where
the section symbol winds up in the output section. */
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
sec = local_sections [r_symndx];
rel->r_addend += sec->output_offset + sym->st_value;
}
}
/* For PUSHJ stub relocs however, we may need to change the
reloc and the section contents, if the reloc doesn't reach
beyond the end of the output section and previous stubs.
Then we change the section contents to be a PUSHJ to the end
of the input section plus stubs (we can do that without using
a reloc), and then we change the reloc to be a R_MMIX_PUSHJ
at the stub location. */
if (r_type == R_MMIX_PUSHJ_STUBBABLE)
{
/* We've already checked whether we need a stub; use that
knowledge. */
if (mmix_elf_section_data (input_section)->pjs.stub_size[pjsno]
!= 0)
{
Elf_Internal_Rela relcpy;
if (mmix_elf_section_data (input_section)
->pjs.stub_size[pjsno] != MAX_PUSHJ_STUB_SIZE)
abort ();
/* There's already a PUSHJ insn there, so just fill in
the offset bits to the stub. */
if (mmix_final_link_relocate (elf_mmix_howto_table
+ R_MMIX_ADDR19,
input_section,
contents,
rel->r_offset,
0,
input_section
->output_section->vma
+ input_section->output_offset
+ size
+ mmix_elf_section_data (input_section)
->pjs.stub_offset,
NULL, NULL) != bfd_reloc_ok)
return FALSE;
/* Put a JMP insn at the stub; it goes with the
R_MMIX_JMP reloc. */
bfd_put_32 (output_bfd, JMP_INSN_BYTE << 24,
contents
+ size
+ mmix_elf_section_data (input_section)
->pjs.stub_offset);
/* Change the reloc to be at the stub, and to a full
R_MMIX_JMP reloc. */
rel->r_info = ELF64_R_INFO (r_symndx, R_MMIX_JMP);
rel->r_offset
= (size
+ mmix_elf_section_data (input_section)
->pjs.stub_offset);
mmix_elf_section_data (input_section)->pjs.stub_offset
+= MAX_PUSHJ_STUB_SIZE;
/* Shift this reloc to the end of the relocs to maintain
the r_offset sorted reloc order. */
relcpy = *rel;
memmove (rel, rel + 1, (char *) relend - (char *) rel);
relend[-1] = relcpy;
/* Back up one reloc, or else we'd skip the next reloc
in turn. */
rel--;
}
pjsno++;
}
continue;
}
/* This is a final link. */
howto = elf_mmix_howto_table + ELF64_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
name = bfd_section_name (input_bfd, sec);
}
else
{
bfd_boolean unresolved_reloc;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, undefined_signalled);
name = h->root.root.string;
}
r = mmix_final_link_relocate (howto, input_section,
contents, rel->r_offset,
rel->r_addend, relocation, name, sec);
if (r != bfd_reloc_ok)
{
bfd_boolean check_ok = TRUE;
const char * msg = (const char *) NULL;
switch (r)
{
case bfd_reloc_overflow:
check_ok = info->callbacks->reloc_overflow
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section, rel->r_offset);
break;
case bfd_reloc_undefined:
/* We may have sent this message above. */
if (! undefined_signalled)
check_ok = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, rel->r_offset,
TRUE);
undefined_signalled = TRUE;
break;
case bfd_reloc_outofrange:
msg = _("internal error: out of range error");
break;
case bfd_reloc_notsupported:
msg = _("internal error: unsupported relocation error");
break;
case bfd_reloc_dangerous:
msg = _("internal error: dangerous relocation");
break;
default:
msg = _("internal error: unknown error");
break;
}
if (msg)
check_ok = info->callbacks->warning
(info, msg, name, input_bfd, input_section, rel->r_offset);
if (! check_ok)
return FALSE;
}
}
return TRUE;
}
/* Perform a single relocation. By default we use the standard BFD
routines. A few relocs we have to do ourselves. */
static bfd_reloc_status_type
mmix_final_link_relocate (howto, input_section, contents,
r_offset, r_addend, relocation, symname, symsec)
reloc_howto_type *howto;
asection *input_section;
bfd_byte *contents;
bfd_vma r_offset;
bfd_signed_vma r_addend;
bfd_vma relocation;
const char *symname;
asection *symsec;
{
bfd_reloc_status_type r = bfd_reloc_ok;
bfd_vma addr
= (input_section->output_section->vma
+ input_section->output_offset
+ r_offset);
bfd_signed_vma srel
= (bfd_signed_vma) relocation + r_addend;
switch (howto->type)
{
/* All these are PC-relative. */
case R_MMIX_PUSHJ_STUBBABLE:
case R_MMIX_PUSHJ:
case R_MMIX_CBRANCH:
case R_MMIX_ADDR19:
case R_MMIX_GETA:
case R_MMIX_ADDR27:
case R_MMIX_JMP:
contents += r_offset;
srel -= (input_section->output_section->vma
+ input_section->output_offset
+ r_offset);
r = mmix_elf_perform_relocation (input_section, howto, contents,
addr, srel);
break;
case R_MMIX_BASE_PLUS_OFFSET:
if (symsec == NULL)
return bfd_reloc_undefined;
/* Check that we're not relocating against a register symbol. */
if (strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_CONTENTS_SECTION_NAME) == 0
|| strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_SECTION_NAME) == 0)
{
/* Note: This is separated out into two messages in order
to ease the translation into other languages. */
if (symname == NULL || *symname == 0)
(*_bfd_error_handler)
(_("%s: base-plus-offset relocation against register symbol: (unknown) in %s"),
bfd_get_filename (input_section->owner),
bfd_get_section_name (symsec->owner, symsec));
else
(*_bfd_error_handler)
(_("%s: base-plus-offset relocation against register symbol: %s in %s"),
bfd_get_filename (input_section->owner), symname,
bfd_get_section_name (symsec->owner, symsec));
return bfd_reloc_overflow;
}
goto do_mmix_reloc;
case R_MMIX_REG_OR_BYTE:
case R_MMIX_REG:
/* For now, we handle these alike. They must refer to an register
symbol, which is either relative to the register section and in
the range 0..255, or is in the register contents section with vma
regno * 8. */
/* FIXME: A better way to check for reg contents section?
FIXME: Postpone section->scaling to mmix_elf_perform_relocation? */
if (symsec == NULL)
return bfd_reloc_undefined;
if (strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_CONTENTS_SECTION_NAME) == 0)
{
if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8)
{
/* The bfd_reloc_outofrange return value, though intuitively
a better value, will not get us an error. */
return bfd_reloc_overflow;
}
srel /= 8;
}
else if (strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_SECTION_NAME) == 0)
{
if (srel < 0 || srel > 255)
/* The bfd_reloc_outofrange return value, though intuitively a
better value, will not get us an error. */
return bfd_reloc_overflow;
}
else
{
/* Note: This is separated out into two messages in order
to ease the translation into other languages. */
if (symname == NULL || *symname == 0)
(*_bfd_error_handler)
(_("%s: register relocation against non-register symbol: (unknown) in %s"),
bfd_get_filename (input_section->owner),
bfd_get_section_name (symsec->owner, symsec));
else
(*_bfd_error_handler)
(_("%s: register relocation against non-register symbol: %s in %s"),
bfd_get_filename (input_section->owner), symname,
bfd_get_section_name (symsec->owner, symsec));
/* The bfd_reloc_outofrange return value, though intuitively a
better value, will not get us an error. */
return bfd_reloc_overflow;
}
do_mmix_reloc:
contents += r_offset;
r = mmix_elf_perform_relocation (input_section, howto, contents,
addr, srel);
break;
case R_MMIX_LOCAL:
/* This isn't a real relocation, it's just an assertion that the
final relocation value corresponds to a local register. We
ignore the actual relocation; nothing is changed. */
{
asection *regsec
= bfd_get_section_by_name (input_section->output_section->owner,
MMIX_REG_CONTENTS_SECTION_NAME);
bfd_vma first_global;
/* Check that this is an absolute value, or a reference to the
register contents section or the register (symbol) section.
Absolute numbers can get here as undefined section. Undefined
symbols are signalled elsewhere, so there's no conflict in us
accidentally handling it. */
if (!bfd_is_abs_section (symsec)
&& !bfd_is_und_section (symsec)
&& strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_CONTENTS_SECTION_NAME) != 0
&& strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_SECTION_NAME) != 0)
{
(*_bfd_error_handler)
(_("%s: directive LOCAL valid only with a register or absolute value"),
bfd_get_filename (input_section->owner));
return bfd_reloc_overflow;
}
/* If we don't have a register contents section, then $255 is the
first global register. */
if (regsec == NULL)
first_global = 255;
else
{
first_global = bfd_get_section_vma (abfd, regsec) / 8;
if (strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_CONTENTS_SECTION_NAME) == 0)
{
if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8)
/* The bfd_reloc_outofrange return value, though
intuitively a better value, will not get us an error. */
return bfd_reloc_overflow;
srel /= 8;
}
}
if ((bfd_vma) srel >= first_global)
{
/* FIXME: Better error message. */
(*_bfd_error_handler)
(_("%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld."),
bfd_get_filename (input_section->owner), (long) srel, (long) first_global);
return bfd_reloc_overflow;
}
}
r = bfd_reloc_ok;
break;
default:
r = _bfd_final_link_relocate (howto, input_section->owner, input_section,
contents, r_offset,
relocation, r_addend);
}
return r;
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
mmix_elf_gc_mark_hook (sec, info, rel, h, sym)
asection *sec;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{
if (h != NULL)
{
switch (ELF64_R_TYPE (rel->r_info))
{
case R_MMIX_GNU_VTINHERIT:
case R_MMIX_GNU_VTENTRY:
break;
default:
switch (h->root.type)
{
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
return h->root.u.def.section;
case bfd_link_hash_common:
return h->root.u.c.p->section;
default:
break;
}
}
}
else
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
/* Update relocation info for a GC-excluded section. We could supposedly
perform the allocation after GC, but there's no suitable hook between
GC (or section merge) and the point when all input sections must be
present. Better to waste some memory and (perhaps) a little time. */
static bfd_boolean
mmix_elf_gc_sweep_hook (abfd, info, sec, relocs)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
asection *sec ATTRIBUTE_UNUSED;
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
{
struct bpo_reloc_section_info *bpodata
= mmix_elf_section_data (sec)->bpo.reloc;
asection *allocated_gregs_section;
/* If no bpodata here, we have nothing to do. */
if (bpodata == NULL)
return TRUE;
allocated_gregs_section = bpodata->bpo_greg_section;
mmix_elf_section_data (allocated_gregs_section)->bpo.greg->n_bpo_relocs
-= bpodata->n_bpo_relocs_this_section;
return TRUE;
}
/* Sort register relocs to come before expanding relocs. */
static int
mmix_elf_sort_relocs (p1, p2)
const PTR p1;
const PTR p2;
{
const Elf_Internal_Rela *r1 = (const Elf_Internal_Rela *) p1;
const Elf_Internal_Rela *r2 = (const Elf_Internal_Rela *) p2;
int r1_is_reg, r2_is_reg;
/* Sort primarily on r_offset & ~3, so relocs are done to consecutive
insns. */
if ((r1->r_offset & ~(bfd_vma) 3) > (r2->r_offset & ~(bfd_vma) 3))
return 1;
else if ((r1->r_offset & ~(bfd_vma) 3) < (r2->r_offset & ~(bfd_vma) 3))
return -1;
r1_is_reg
= (ELF64_R_TYPE (r1->r_info) == R_MMIX_REG_OR_BYTE
|| ELF64_R_TYPE (r1->r_info) == R_MMIX_REG);
r2_is_reg
= (ELF64_R_TYPE (r2->r_info) == R_MMIX_REG_OR_BYTE
|| ELF64_R_TYPE (r2->r_info) == R_MMIX_REG);
if (r1_is_reg != r2_is_reg)
return r2_is_reg - r1_is_reg;
/* Neither or both are register relocs. Then sort on full offset. */
if (r1->r_offset > r2->r_offset)
return 1;
else if (r1->r_offset < r2->r_offset)
return -1;
return 0;
}
/* Subset of mmix_elf_check_relocs, common to ELF and mmo linking. */
static bfd_boolean
mmix_elf_check_common_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{
bfd *bpo_greg_owner = NULL;
asection *allocated_gregs_section = NULL;
struct bpo_greg_section_info *gregdata = NULL;
struct bpo_reloc_section_info *bpodata = NULL;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
/* We currently have to abuse this COFF-specific member, since there's
no target-machine-dedicated member. There's no alternative outside
the bfd_link_info struct; we can't specialize a hash-table since
they're different between ELF and mmo. */
bpo_greg_owner = (bfd *) info->base_file;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
switch (ELF64_R_TYPE (rel->r_info))
{
/* This relocation causes a GREG allocation. We need to count
them, and we need to create a section for them, so we need an
object to fake as the owner of that section. We can't use
the ELF dynobj for this, since the ELF bits assume lots of
DSO-related stuff if that member is non-NULL. */
case R_MMIX_BASE_PLUS_OFFSET:
/* We don't do anything with this reloc for a relocatable link. */
if (info->relocatable)
break;
if (bpo_greg_owner == NULL)
{
bpo_greg_owner = abfd;
info->base_file = (PTR) bpo_greg_owner;
}
if (allocated_gregs_section == NULL)
allocated_gregs_section
= bfd_get_section_by_name (bpo_greg_owner,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (allocated_gregs_section == NULL)
{
allocated_gregs_section
= bfd_make_section_with_flags (bpo_greg_owner,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME,
(SEC_HAS_CONTENTS
| SEC_IN_MEMORY
| SEC_LINKER_CREATED));
/* Setting both SEC_ALLOC and SEC_LOAD means the section is
treated like any other section, and we'd get errors for
address overlap with the text section. Let's set none of
those flags, as that is what currently happens for usual
GREG allocations, and that works. */
if (allocated_gregs_section == NULL
|| !bfd_set_section_alignment (bpo_greg_owner,
allocated_gregs_section,
3))
return FALSE;
gregdata = (struct bpo_greg_section_info *)
bfd_zalloc (bpo_greg_owner, sizeof (struct bpo_greg_section_info));
if (gregdata == NULL)
return FALSE;
mmix_elf_section_data (allocated_gregs_section)->bpo.greg
= gregdata;
}
else if (gregdata == NULL)
gregdata
= mmix_elf_section_data (allocated_gregs_section)->bpo.greg;
/* Get ourselves some auxiliary info for the BPO-relocs. */
if (bpodata == NULL)
{
/* No use doing a separate iteration pass to find the upper
limit - just use the number of relocs. */
bpodata = (struct bpo_reloc_section_info *)
bfd_alloc (bpo_greg_owner,
sizeof (struct bpo_reloc_section_info)
* (sec->reloc_count + 1));
if (bpodata == NULL)
return FALSE;
mmix_elf_section_data (sec)->bpo.reloc = bpodata;
bpodata->first_base_plus_offset_reloc
= bpodata->bpo_index
= gregdata->n_max_bpo_relocs;
bpodata->bpo_greg_section
= allocated_gregs_section;
bpodata->n_bpo_relocs_this_section = 0;
}
bpodata->n_bpo_relocs_this_section++;
gregdata->n_max_bpo_relocs++;
/* We don't get another chance to set this before GC; we've not
set up any hook that runs before GC. */
gregdata->n_bpo_relocs
= gregdata->n_max_bpo_relocs;
break;
case R_MMIX_PUSHJ_STUBBABLE:
mmix_elf_section_data (sec)->pjs.n_pushj_relocs++;
break;
}
}
/* Allocate per-reloc stub storage and initialize it to the max stub
size. */
if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs != 0)
{
size_t i;
mmix_elf_section_data (sec)->pjs.stub_size
= bfd_alloc (abfd, mmix_elf_section_data (sec)->pjs.n_pushj_relocs
* sizeof (mmix_elf_section_data (sec)
->pjs.stub_size[0]));
if (mmix_elf_section_data (sec)->pjs.stub_size == NULL)
return FALSE;
for (i = 0; i < mmix_elf_section_data (sec)->pjs.n_pushj_relocs; i++)
mmix_elf_section_data (sec)->pjs.stub_size[i] = MAX_PUSHJ_STUB_SIZE;
}
return TRUE;
}
/* Look through the relocs for a section during the first phase. */
static bfd_boolean
mmix_elf_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym);
if (!elf_bad_symtab (abfd))
sym_hashes_end -= symtab_hdr->sh_info;
/* First we sort the relocs so that any register relocs come before
expansion-relocs to the same insn. FIXME: Not done for mmo. */
qsort ((PTR) relocs, sec->reloc_count, sizeof (Elf_Internal_Rela),
mmix_elf_sort_relocs);
/* Do the common part. */
if (!mmix_elf_check_common_relocs (abfd, info, sec, relocs))
return FALSE;
if (info->relocatable)
return TRUE;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
struct elf_link_hash_entry *h;
unsigned long r_symndx;
r_symndx = ELF64_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
switch (ELF64_R_TYPE (rel->r_info))
{
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_MMIX_GNU_VTINHERIT:
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_MMIX_GNU_VTENTRY:
if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;
}
}
return TRUE;
}
/* Wrapper for mmix_elf_check_common_relocs, called when linking to mmo.
Copied from elf_link_add_object_symbols. */
bfd_boolean
_bfd_mmix_check_all_relocs (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
asection *o;
for (o = abfd->sections; o != NULL; o = o->next)
{
Elf_Internal_Rela *internal_relocs;
bfd_boolean ok;
if ((o->flags & SEC_RELOC) == 0
|| o->reloc_count == 0
|| ((info->strip == strip_all || info->strip == strip_debugger)
&& (o->flags & SEC_DEBUGGING) != 0)
|| bfd_is_abs_section (o->output_section))
continue;
internal_relocs
= _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL,
(Elf_Internal_Rela *) NULL,
info->keep_memory);
if (internal_relocs == NULL)
return FALSE;
ok = mmix_elf_check_common_relocs (abfd, info, o, internal_relocs);
if (! info->keep_memory)
free (internal_relocs);
if (! ok)
return FALSE;
}
return TRUE;
}
/* Change symbols relative to the reg contents section to instead be to
the register section, and scale them down to correspond to the register
number. */
static bfd_boolean
mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
const char *name ATTRIBUTE_UNUSED;
Elf_Internal_Sym *sym;
asection *input_sec;
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
{
if (input_sec != NULL
&& input_sec->name != NULL
&& ELF_ST_TYPE (sym->st_info) != STT_SECTION
&& strcmp (input_sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0)
{
sym->st_value /= 8;
sym->st_shndx = SHN_REGISTER;
}
return TRUE;
}
/* We fake a register section that holds values that are register numbers.
Having a SHN_REGISTER and register section translates better to other
formats (e.g. mmo) than for example a STT_REGISTER attribute.
This section faking is based on a construct in elf32-mips.c. */
static asection mmix_elf_reg_section;
static asymbol mmix_elf_reg_section_symbol;
static asymbol *mmix_elf_reg_section_symbol_ptr;
/* Handle the special section numbers that a symbol may use. */
void
mmix_elf_symbol_processing (abfd, asym)
bfd *abfd ATTRIBUTE_UNUSED;
asymbol *asym;
{
elf_symbol_type *elfsym;
elfsym = (elf_symbol_type *) asym;
switch (elfsym->internal_elf_sym.st_shndx)
{
case SHN_REGISTER:
if (mmix_elf_reg_section.name == NULL)
{
/* Initialize the register section. */
mmix_elf_reg_section.name = MMIX_REG_SECTION_NAME;
mmix_elf_reg_section.flags = SEC_NO_FLAGS;
mmix_elf_reg_section.output_section = &mmix_elf_reg_section;
mmix_elf_reg_section.symbol = &mmix_elf_reg_section_symbol;
mmix_elf_reg_section.symbol_ptr_ptr = &mmix_elf_reg_section_symbol_ptr;
mmix_elf_reg_section_symbol.name = MMIX_REG_SECTION_NAME;
mmix_elf_reg_section_symbol.flags = BSF_SECTION_SYM;
mmix_elf_reg_section_symbol.section = &mmix_elf_reg_section;
mmix_elf_reg_section_symbol_ptr = &mmix_elf_reg_section_symbol;
}
asym->section = &mmix_elf_reg_section;
break;
default:
break;
}
}
/* Given a BFD section, try to locate the corresponding ELF section
index. */
static bfd_boolean
mmix_elf_section_from_bfd_section (abfd, sec, retval)
bfd * abfd ATTRIBUTE_UNUSED;
asection * sec;
int * retval;
{
if (strcmp (bfd_get_section_name (abfd, sec), MMIX_REG_SECTION_NAME) == 0)
*retval = SHN_REGISTER;
else
return FALSE;
return TRUE;
}
/* Hook called by the linker routine which adds symbols from an object
file. We must handle the special SHN_REGISTER section number here.
We also check that we only have *one* each of the section-start
symbols, since otherwise having two with the same value would cause
them to be "merged", but with the contents serialized. */
bfd_boolean
mmix_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
bfd *abfd;
struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Sym *sym;
const char **namep ATTRIBUTE_UNUSED;
flagword *flagsp ATTRIBUTE_UNUSED;
asection **secp;
bfd_vma *valp ATTRIBUTE_UNUSED;
{
if (sym->st_shndx == SHN_REGISTER)
{
*secp = bfd_make_section_old_way (abfd, MMIX_REG_SECTION_NAME);
(*secp)->flags |= SEC_LINKER_CREATED;
}
else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.'
&& strncmp (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX,
strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0)
{
/* See if we have another one. */
struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,
*namep,
FALSE,
FALSE,
FALSE);
if (h != NULL && h->type != bfd_link_hash_undefined)
{
/* How do we get the asymbol (or really: the filename) from h?
h->u.def.section->owner is NULL. */
((*_bfd_error_handler)
(_("%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n"),
bfd_get_filename (abfd), *namep,
*namep + strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)));
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
}
return TRUE;
}
/* We consider symbols matching "L.*:[0-9]+" to be local symbols. */
bfd_boolean
mmix_elf_is_local_label_name (abfd, name)
bfd *abfd;
const char *name;
{
const char *colpos;
int digits;
/* Also include the default local-label definition. */
if (_bfd_elf_is_local_label_name (abfd, name))
return TRUE;
if (*name != 'L')
return FALSE;
/* If there's no ":", or more than one, it's not a local symbol. */
colpos = strchr (name, ':');
if (colpos == NULL || strchr (colpos + 1, ':') != NULL)
return FALSE;
/* Check that there are remaining characters and that they are digits. */
if (colpos[1] == 0)
return FALSE;
digits = strspn (colpos + 1, "0123456789");
return digits != 0 && colpos[1 + digits] == 0;
}
/* We get rid of the register section here. */
bfd_boolean
mmix_elf_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
/* We never output a register section, though we create one for
temporary measures. Check that nobody entered contents into it. */
asection *reg_section;
reg_section = bfd_get_section_by_name (abfd, MMIX_REG_SECTION_NAME);
if (reg_section != NULL)
{
/* FIXME: Pass error state gracefully. */
if (bfd_get_section_flags (abfd, reg_section) & SEC_HAS_CONTENTS)
_bfd_abort (__FILE__, __LINE__, _("Register section has contents\n"));
/* Really remove the section, if it hasn't already been done. */
if (!bfd_section_removed_from_list (abfd, reg_section))
{
bfd_section_list_remove (abfd, reg_section);
--abfd->section_count;
}
}
if (! bfd_elf_final_link (abfd, info))
return FALSE;
/* Since this section is marked SEC_LINKER_CREATED, it isn't output by
the regular linker machinery. We do it here, like other targets with
special sections. */
if (info->base_file != NULL)
{
asection *greg_section
= bfd_get_section_by_name ((bfd *) info->base_file,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (!bfd_set_section_contents (abfd,
greg_section->output_section,
greg_section->contents,
(file_ptr) greg_section->output_offset,
greg_section->size))
return FALSE;
}
return TRUE;
}
/* We need to include the maximum size of PUSHJ-stubs in the initial
section size. This is expected to shrink during linker relaxation. */
static void
mmix_set_relaxable_size (abfd, sec, ptr)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
void *ptr;
{
struct bfd_link_info *info = ptr;
/* Make sure we only do this for section where we know we want this,
otherwise we might end up resetting the size of COMMONs. */
if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0)
return;
sec->rawsize = sec->size;
sec->size += (mmix_elf_section_data (sec)->pjs.n_pushj_relocs
* MAX_PUSHJ_STUB_SIZE);
/* For use in relocatable link, we start with a max stubs size. See
mmix_elf_relax_section. */
if (info->relocatable && sec->output_section)
mmix_elf_section_data (sec->output_section)->pjs.stubs_size_sum
+= (mmix_elf_section_data (sec)->pjs.n_pushj_relocs
* MAX_PUSHJ_STUB_SIZE);
}
/* Initialize stuff for the linker-generated GREGs to match
R_MMIX_BASE_PLUS_OFFSET relocs seen by the linker. */
bfd_boolean
_bfd_mmix_before_linker_allocation (abfd, info)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
asection *bpo_gregs_section;
bfd *bpo_greg_owner;
struct bpo_greg_section_info *gregdata;
size_t n_gregs;
bfd_vma gregs_size;
size_t i;
size_t *bpo_reloc_indexes;
bfd *ibfd;
/* Set the initial size of sections. */
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
bfd_map_over_sections (ibfd, mmix_set_relaxable_size, info);
/* The bpo_greg_owner bfd is supposed to have been set by
mmix_elf_check_relocs when the first R_MMIX_BASE_PLUS_OFFSET is seen.
If there is no such object, there was no R_MMIX_BASE_PLUS_OFFSET. */
bpo_greg_owner = (bfd *) info->base_file;
if (bpo_greg_owner == NULL)
return TRUE;
bpo_gregs_section
= bfd_get_section_by_name (bpo_greg_owner,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (bpo_gregs_section == NULL)
return TRUE;
/* We use the target-data handle in the ELF section data. */
gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg;
if (gregdata == NULL)
return FALSE;
n_gregs = gregdata->n_bpo_relocs;
gregdata->n_allocated_bpo_gregs = n_gregs;
/* When this reaches zero during relaxation, all entries have been
filled in and the size of the linker gregs can be calculated. */
gregdata->n_remaining_bpo_relocs_this_relaxation_round = n_gregs;
/* Set the zeroth-order estimate for the GREGs size. */
gregs_size = n_gregs * 8;
if (!bfd_set_section_size (bpo_greg_owner, bpo_gregs_section, gregs_size))
return FALSE;
/* Allocate and set up the GREG arrays. They're filled in at relaxation
time. Note that we must use the max number ever noted for the array,
since the index numbers were created before GC. */
gregdata->reloc_request
= bfd_zalloc (bpo_greg_owner,
sizeof (struct bpo_reloc_request)
* gregdata->n_max_bpo_relocs);
gregdata->bpo_reloc_indexes
= bpo_reloc_indexes
= bfd_alloc (bpo_greg_owner,
gregdata->n_max_bpo_relocs
* sizeof (size_t));
if (bpo_reloc_indexes == NULL)
return FALSE;
/* The default order is an identity mapping. */
for (i = 0; i < gregdata->n_max_bpo_relocs; i++)
{
bpo_reloc_indexes[i] = i;
gregdata->reloc_request[i].bpo_reloc_no = i;
}
return TRUE;
}
/* Fill in contents in the linker allocated gregs. Everything is
calculated at this point; we just move the contents into place here. */
bfd_boolean
_bfd_mmix_after_linker_allocation (abfd, link_info)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *link_info;
{
asection *bpo_gregs_section;
bfd *bpo_greg_owner;
struct bpo_greg_section_info *gregdata;
size_t n_gregs;
size_t i, j;
size_t lastreg;
bfd_byte *contents;
/* The bpo_greg_owner bfd is supposed to have been set by mmix_elf_check_relocs
when the first R_MMIX_BASE_PLUS_OFFSET is seen. If there is no such
object, there was no R_MMIX_BASE_PLUS_OFFSET. */
bpo_greg_owner = (bfd *) link_info->base_file;
if (bpo_greg_owner == NULL)
return TRUE;
bpo_gregs_section
= bfd_get_section_by_name (bpo_greg_owner,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
/* This can't happen without DSO handling. When DSOs are handled
without any R_MMIX_BASE_PLUS_OFFSET seen, there will be no such
section. */
if (bpo_gregs_section == NULL)
return TRUE;
/* We use the target-data handle in the ELF section data. */
gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg;
if (gregdata == NULL)
return FALSE;
n_gregs = gregdata->n_allocated_bpo_gregs;
bpo_gregs_section->contents
= contents = bfd_alloc (bpo_greg_owner, bpo_gregs_section->size);
if (contents == NULL)
return FALSE;
/* Sanity check: If these numbers mismatch, some relocation has not been
accounted for and the rest of gregdata is probably inconsistent.
It's a bug, but it's more helpful to identify it than segfaulting
below. */
if (gregdata->n_remaining_bpo_relocs_this_relaxation_round
!= gregdata->n_bpo_relocs)
{
(*_bfd_error_handler)
(_("Internal inconsistency: remaining %u != max %u.\n\
Please report this bug."),
gregdata->n_remaining_bpo_relocs_this_relaxation_round,
gregdata->n_bpo_relocs);
return FALSE;
}
for (lastreg = 255, i = 0, j = 0; j < n_gregs; i++)
if (gregdata->reloc_request[i].regindex != lastreg)
{
bfd_put_64 (bpo_greg_owner, gregdata->reloc_request[i].value,
contents + j * 8);
lastreg = gregdata->reloc_request[i].regindex;
j++;
}
return TRUE;
}
/* Sort valid relocs to come before non-valid relocs, then on increasing
value. */
static int
bpo_reloc_request_sort_fn (p1, p2)
const PTR p1;
const PTR p2;
{
const struct bpo_reloc_request *r1 = (const struct bpo_reloc_request *) p1;
const struct bpo_reloc_request *r2 = (const struct bpo_reloc_request *) p2;
/* Primary function is validity; non-valid relocs sorted after valid
ones. */
if (r1->valid != r2->valid)
return r2->valid - r1->valid;
/* Then sort on value. Don't simplify and return just the difference of
the values: the upper bits of the 64-bit value would be truncated on
a host with 32-bit ints. */
if (r1->value != r2->value)
return r1->value > r2->value ? 1 : -1;
/* As a last re-sort, use the relocation number, so we get a stable
sort. The *addresses* aren't stable since items are swapped during
sorting. It depends on the qsort implementation if this actually
happens. */
return r1->bpo_reloc_no > r2->bpo_reloc_no
? 1 : (r1->bpo_reloc_no < r2->bpo_reloc_no ? -1 : 0);
}
/* For debug use only. Dumps the global register allocations resulting
from base-plus-offset relocs. */
void
mmix_dump_bpo_gregs (link_info, pf)
struct bfd_link_info *link_info;
bfd_error_handler_type pf;
{
bfd *bpo_greg_owner;
asection *bpo_gregs_section;
struct bpo_greg_section_info *gregdata;
unsigned int i;
if (link_info == NULL || link_info->base_file == NULL)
return;
bpo_greg_owner = (bfd *) link_info->base_file;
bpo_gregs_section
= bfd_get_section_by_name (bpo_greg_owner,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (bpo_gregs_section == NULL)
return;
gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg;
if (gregdata == NULL)
return;
if (pf == NULL)
pf = _bfd_error_handler;
/* These format strings are not translated. They are for debug purposes
only and never displayed to an end user. Should they escape, we
surely want them in original. */
(*pf) (" n_bpo_relocs: %u\n n_max_bpo_relocs: %u\n n_remain...round: %u\n\
n_allocated_bpo_gregs: %u\n", gregdata->n_bpo_relocs,
gregdata->n_max_bpo_relocs,
gregdata->n_remaining_bpo_relocs_this_relaxation_round,
gregdata->n_allocated_bpo_gregs);
if (gregdata->reloc_request)
for (i = 0; i < gregdata->n_max_bpo_relocs; i++)
(*pf) ("%4u (%4u)/%4u#%u: 0x%08lx%08lx r: %3u o: %3u\n",
i,
(gregdata->bpo_reloc_indexes != NULL
? gregdata->bpo_reloc_indexes[i] : (size_t) -1),
gregdata->reloc_request[i].bpo_reloc_no,
gregdata->reloc_request[i].valid,
(unsigned long) (gregdata->reloc_request[i].value >> 32),
(unsigned long) gregdata->reloc_request[i].value,
gregdata->reloc_request[i].regindex,
gregdata->reloc_request[i].offset);
}
/* This links all R_MMIX_BASE_PLUS_OFFSET relocs into a special array, and
when the last such reloc is done, an index-array is sorted according to
the values and iterated over to produce register numbers (indexed by 0
from the first allocated register number) and offsets for use in real
relocation.
PUSHJ stub accounting is also done here.
Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */
static bfd_boolean
mmix_elf_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
struct bfd_link_info *link_info;
bfd_boolean *again;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *irel, *irelend;
asection *bpo_gregs_section = NULL;
struct bpo_greg_section_info *gregdata;
struct bpo_reloc_section_info *bpodata
= mmix_elf_section_data (sec)->bpo.reloc;
/* The initialization is to quiet compiler warnings. The value is to
spot a missing actual initialization. */
size_t bpono = (size_t) -1;
size_t pjsno = 0;
bfd *bpo_greg_owner;
Elf_Internal_Sym *isymbuf = NULL;
bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
mmix_elf_section_data (sec)->pjs.stubs_size_sum = 0;
/* Assume nothing changes. */
*again = FALSE;
/* We don't have to do anything if this section does not have relocs, or
if this is not a code section. */
if ((sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0
|| (sec->flags & SEC_LINKER_CREATED) != 0
/* If no R_MMIX_BASE_PLUS_OFFSET relocs and no PUSHJ-stub relocs,
then nothing to do. */
|| (bpodata == NULL
&& mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
bpo_greg_owner = (bfd *) link_info->base_file;
if (bpodata != NULL)
{
bpo_gregs_section = bpodata->bpo_greg_section;
gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg;
bpono = bpodata->first_base_plus_offset_reloc;
}
else
gregdata = NULL;
/* Get a copy of the native relocations. */
internal_relocs
= _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
(Elf_Internal_Rela *) NULL,
link_info->keep_memory);
if (internal_relocs == NULL)
goto error_return;
/* Walk through them looking for relaxing opportunities. */
irelend = internal_relocs + sec->reloc_count;
for (irel = internal_relocs; irel < irelend; irel++)
{
bfd_vma symval;
struct elf_link_hash_entry *h = NULL;
/* We only process two relocs. */
if (ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_BASE_PLUS_OFFSET
&& ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_PUSHJ_STUBBABLE)
continue;
/* We process relocs in a distinctly different way when this is a
relocatable link (for one, we don't look at symbols), so we avoid
mixing its code with that for the "normal" relaxation. */
if (link_info->relocatable)
{
/* The only transformation in a relocatable link is to generate
a full stub at the location of the stub calculated for the
input section, if the relocated stub location, the end of the
output section plus earlier stubs, cannot be reached. Thus
relocatable linking can only lead to worse code, but it still
works. */
if (ELF64_R_TYPE (irel->r_info) == R_MMIX_PUSHJ_STUBBABLE)
{
/* If we can reach the end of the output-section and beyond
any current stubs, then we don't need a stub for this
reloc. The relaxed order of output stub allocation may
not exactly match the straightforward order, so we always
assume presence of output stubs, which will allow
relaxation only on relocations indifferent to the
presence of output stub allocations for other relocations
and thus the order of output stub allocation. */
if (bfd_check_overflow (complain_overflow_signed,
19,
0,
bfd_arch_bits_per_address (abfd),
/* Output-stub location. */
sec->output_section->rawsize
+ (mmix_elf_section_data (sec
->output_section)
->pjs.stubs_size_sum)
/* Location of this PUSHJ reloc. */
- (sec->output_offset + irel->r_offset)
/* Don't count *this* stub twice. */
- (mmix_elf_section_data (sec)
->pjs.stub_size[pjsno]
+ MAX_PUSHJ_STUB_SIZE))
== bfd_reloc_ok)
mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0;
mmix_elf_section_data (sec)->pjs.stubs_size_sum
+= mmix_elf_section_data (sec)->pjs.stub_size[pjsno];
pjsno++;
}
continue;
}
/* Get the value of the symbol referred to by the reloc. */
if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
Elf_Internal_Sym *isym;
asection *sym_sec;
/* Read this BFD's local symbols if we haven't already. */
if (isymbuf == NULL)
{
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
if (isymbuf == NULL)
isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
symtab_hdr->sh_info, 0,
NULL, NULL, NULL);
if (isymbuf == 0)
goto error_return;
}
isym = isymbuf + ELF64_R_SYM (irel->r_info);
if (isym->st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr;
else if (isym->st_shndx == SHN_ABS)
sym_sec = bfd_abs_section_ptr;
else if (isym->st_shndx == SHN_COMMON)
sym_sec = bfd_com_section_ptr;
else
sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
symval = (isym->st_value
+ sym_sec->output_section->vma
+ sym_sec->output_offset);
}
else
{
unsigned long indx;
/* An external symbol. */
indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info;
h = elf_sym_hashes (abfd)[indx];
BFD_ASSERT (h != NULL);
if (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
{
/* This appears to be a reference to an undefined symbol. Just
ignore it--it will be caught by the regular reloc processing.
We need to keep BPO reloc accounting consistent, though
else we'll abort instead of emitting an error message. */
if (ELF64_R_TYPE (irel->r_info) == R_MMIX_BASE_PLUS_OFFSET
&& gregdata != NULL)
{
gregdata->n_remaining_bpo_relocs_this_relaxation_round--;
bpono++;
}
continue;
}
symval = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
}
if (ELF64_R_TYPE (irel->r_info) == (int) R_MMIX_PUSHJ_STUBBABLE)
{
bfd_vma value = symval + irel->r_addend;
bfd_vma dot
= (sec->output_section->vma
+ sec->output_offset
+ irel->r_offset);
bfd_vma stubaddr
= (sec->output_section->vma
+ sec->output_offset
+ size
+ mmix_elf_section_data (sec)->pjs.stubs_size_sum);
if ((value & 3) == 0
&& bfd_check_overflow (complain_overflow_signed,
19,
0,
bfd_arch_bits_per_address (abfd),
value - dot
- (value > dot
? mmix_elf_section_data (sec)
->pjs.stub_size[pjsno]
: 0))
== bfd_reloc_ok)
/* If the reloc fits, no stub is needed. */
mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0;
else
/* Maybe we can get away with just a JMP insn? */
if ((value & 3) == 0
&& bfd_check_overflow (complain_overflow_signed,
27,
0,
bfd_arch_bits_per_address (abfd),
value - stubaddr
- (value > dot
? mmix_elf_section_data (sec)
->pjs.stub_size[pjsno] - 4
: 0))
== bfd_reloc_ok)
/* Yep, account for a stub consisting of a single JMP insn. */
mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 4;
else
/* Nope, go for the full insn stub. It doesn't seem useful to
emit the intermediate sizes; those will only be useful for
a >64M program assuming contiguous code. */
mmix_elf_section_data (sec)->pjs.stub_size[pjsno]
= MAX_PUSHJ_STUB_SIZE;
mmix_elf_section_data (sec)->pjs.stubs_size_sum
+= mmix_elf_section_data (sec)->pjs.stub_size[pjsno];
pjsno++;
continue;
}
/* We're looking at a R_MMIX_BASE_PLUS_OFFSET reloc. */
gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono]].value
= symval + irel->r_addend;
gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono++]].valid = TRUE;
gregdata->n_remaining_bpo_relocs_this_relaxation_round--;
}
/* Check if that was the last BPO-reloc. If so, sort the values and
calculate how many registers we need to cover them. Set the size of
the linker gregs, and if the number of registers changed, indicate
that we need to relax some more because we have more work to do. */
if (gregdata != NULL
&& gregdata->n_remaining_bpo_relocs_this_relaxation_round == 0)
{
size_t i;
bfd_vma prev_base;
size_t regindex;
/* First, reset the remaining relocs for the next round. */
gregdata->n_remaining_bpo_relocs_this_relaxation_round
= gregdata->n_bpo_relocs;
qsort ((PTR) gregdata->reloc_request,
gregdata->n_max_bpo_relocs,
sizeof (struct bpo_reloc_request),
bpo_reloc_request_sort_fn);
/* Recalculate indexes. When we find a change (however unlikely
after the initial iteration), we know we need to relax again,
since items in the GREG-array are sorted by increasing value and
stored in the relaxation phase. */
for (i = 0; i < gregdata->n_max_bpo_relocs; i++)
if (gregdata->bpo_reloc_indexes[gregdata->reloc_request[i].bpo_reloc_no]
!= i)
{
gregdata->bpo_reloc_indexes[gregdata->reloc_request[i].bpo_reloc_no]
= i;
*again = TRUE;
}
/* Allocate register numbers (indexing from 0). Stop at the first
non-valid reloc. */
for (i = 0, regindex = 0, prev_base = gregdata->reloc_request[0].value;
i < gregdata->n_bpo_relocs;
i++)
{
if (gregdata->reloc_request[i].value > prev_base + 255)
{
regindex++;
prev_base = gregdata->reloc_request[i].value;
}
gregdata->reloc_request[i].regindex = regindex;
gregdata->reloc_request[i].offset
= gregdata->reloc_request[i].value - prev_base;
}
/* If it's not the same as the last time, we need to relax again,
because the size of the section has changed. I'm not sure we
actually need to do any adjustments since the shrinking happens
at the start of this section, but better safe than sorry. */
if (gregdata->n_allocated_bpo_gregs != regindex + 1)
{
gregdata->n_allocated_bpo_gregs = regindex + 1;
*again = TRUE;
}
bpo_gregs_section->size = (regindex + 1) * 8;
}
if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
{
if (! link_info->keep_memory)
free (isymbuf);
else
{
/* Cache the symbols for elf_link_input_bfd. */
symtab_hdr->contents = (unsigned char *) isymbuf;
}
}
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
if (sec->size < size + mmix_elf_section_data (sec)->pjs.stubs_size_sum)
abort ();
if (sec->size > size + mmix_elf_section_data (sec)->pjs.stubs_size_sum)
{
sec->size = size + mmix_elf_section_data (sec)->pjs.stubs_size_sum;
*again = TRUE;
}
return TRUE;
error_return:
if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents)
free (isymbuf);
if (internal_relocs != NULL
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
return FALSE;
}
#define ELF_ARCH bfd_arch_mmix
#define ELF_MACHINE_CODE EM_MMIX
/* According to mmix-doc page 36 (paragraph 45), this should be (1LL << 48LL).
However, that's too much for something somewhere in the linker part of
BFD; perhaps the start-address has to be a non-zero multiple of this
number, or larger than this number. The symptom is that the linker
complains: "warning: allocated section `.text' not in segment". We
settle for 64k; the page-size used in examples is 8k.
#define ELF_MAXPAGESIZE 0x10000
Unfortunately, this causes excessive padding in the supposedly small
for-education programs that are the expected usage (where people would
inspect output). We stick to 256 bytes just to have *some* default
alignment. */
#define ELF_MAXPAGESIZE 0x100
#define TARGET_BIG_SYM bfd_elf64_mmix_vec
#define TARGET_BIG_NAME "elf64-mmix"
#define elf_info_to_howto_rel NULL
#define elf_info_to_howto mmix_info_to_howto_rela
#define elf_backend_relocate_section mmix_elf_relocate_section
#define elf_backend_gc_mark_hook mmix_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook mmix_elf_gc_sweep_hook
#define elf_backend_link_output_symbol_hook \
mmix_elf_link_output_symbol_hook
#define elf_backend_add_symbol_hook mmix_elf_add_symbol_hook
#define elf_backend_check_relocs mmix_elf_check_relocs
#define elf_backend_symbol_processing mmix_elf_symbol_processing
#define bfd_elf64_bfd_is_local_label_name \
mmix_elf_is_local_label_name
#define elf_backend_may_use_rel_p 0
#define elf_backend_may_use_rela_p 1
#define elf_backend_default_use_rela_p 1
#define elf_backend_can_gc_sections 1
#define elf_backend_section_from_bfd_section \
mmix_elf_section_from_bfd_section
#define bfd_elf64_new_section_hook mmix_elf_new_section_hook
#define bfd_elf64_bfd_final_link mmix_elf_final_link
#define bfd_elf64_bfd_relax_section mmix_elf_relax_section
#include "elf64-target.h"
| guoqingzhang/binutils-coffee | bfd/elf64-mmix.c | C | gpl-2.0 | 94,117 |
puavo-sharedir
==============
A script to manage "shared directories", using inotify and ACLs,
and some additional scripts.
| puavo-org/puavo-os | parts/sharedir/README.md | Markdown | gpl-2.0 | 125 |
#!/bin/sh
# $Id: run_tic.sh,v 1.1 2011/08/18 02:20:39 tsaitc Exp $
##############################################################################
# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. #
# #
# 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, distribute #
# with modifications, 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 ABOVE 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. #
# #
# Except as contained in this notice, the name(s) of the above copyright #
# holders shall not be used in advertising or otherwise to promote the sale, #
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
#
# Author: Thomas E. Dickey 1996-on
#
# This script is used to install terminfo.src using tic. We use a script
# because the path checking is too awkward to do in a makefile.
#
# Assumes:
# The leaf directory names (lib, tabset, terminfo)
#
echo '** Building terminfo database, please wait...'
#
# The script is designed to be run from the misc/Makefile as
# make install.data
: ${suffix:=}
: ${DESTDIR:=}
: ${prefix:=$(ROOTDIR)/romfs/usr}
: ${exec_prefix:=${prefix}}
: ${bindir:=${exec_prefix}/bin}
: ${top_srcdir:=..}
: ${srcdir:=.}
: ${datadir:=${prefix}/share}
: ${TIC_PATH:=/usr/bin/tic}
: ${ticdir:=${prefix}/share/terminfo}
: ${source:=${top_srcdir}/misc/terminfo.src}
: ${LN_S:="ln -s -f"}
: ${cross_compiling:=no}
: ${ext_funcs:=1}
test -z "${DESTDIR}" && DESTDIR=
# Allow tic to run either from the install-path, or from the build-directory.
# Do not do this if we appear to be cross-compiling. In that case, we rely
# on the host's copy of tic to compile the terminfo database.
if test "x$cross_compiling" = "xno"
then
if test -f ../progs/tic$suffix
then
case "$PATH" in
\:*)
PATH="../progs:../lib:${DESTDIR}$bindir$PATH"
;;
*)
PATH="../progs:../lib:${DESTDIR}$bindir:$PATH"
;;
esac
export PATH
if test shared = shared
then
SHLIB="sh $srcdir/shlib"
TIC_PATH="$SHLIB tic"
else
TIC_PATH="tic"
fi
elif test "$TIC_PATH" = unknown
then
echo '? no tic program found'
exit 1
fi
else
# Cross-compiling, so don't set PATH or run shlib.
SHLIB=
# reset $suffix, since it applies to the target, not the build platform.
suffix=
fi
# set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
# the PATH we just set.
SHLIB_PATH=$PATH
export SHLIB_PATH
# set a variable to simplify environment update in shlib
SHLIB_HOST=linux-gnu
export SHLIB_HOST
# don't use user's TERMINFO variable
TERMINFO=${DESTDIR}$ticdir ; export TERMINFO
umask 022
# Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'`
# Parent directory may not exist, which would confuse the install for hashed
# database. Fix.
PARENT=`echo "$TERMINFO" | sed -e 's%/[^/]*$%%'`
if test -n "$PARENT"
then
test -d $PARENT || mkdir -p $PARENT
fi
# Remove the old terminfo stuff; we don't care if it existed before, and it
# would generate a lot of confusing error messages if we tried to overwrite it.
# We explicitly remove its contents rather than the directory itself, in case
# the directory is actually a symbolic link.
( test -d "$TERMINFO" && cd $TERMINFO && rm -fr ? 2>/dev/null )
if test "$ext_funcs" = 1 ; then
cat <<EOF
Running $TIC_PATH to install $TERMINFO ...
You may see messages regarding extended capabilities, e.g., AX.
These are extended terminal capabilities which are compiled
using
tic -x
If you have ncurses 4.2 applications, you should read the INSTALL
document, and install the terminfo without the -x option.
EOF
if ( $TIC_PATH -x -s -o $TERMINFO $source )
then
echo '** built new '$TERMINFO
else
echo '? tic could not build '$TERMINFO
exit 1
fi
else
cat <<EOF
Running $TIC_PATH to install $TERMINFO ...
You may see messages regarding unknown capabilities, e.g., AX.
These are extended terminal capabilities which may be compiled
using
tic -x
If you have ncurses 4.2 applications, you should read the INSTALL
document, and install the terminfo without the -x option.
EOF
if ( $TIC_PATH -s -o $TERMINFO $source )
then
echo '** built new '$TERMINFO
else
echo '? tic could not build '$TERMINFO
exit 1
fi
fi
# Make a symbolic link to provide compatibility with applications that expect
# to find terminfo under /usr/lib. That is, we'll _try_ to do that. Not
# all systems support symbolic links, and those that do provide a variety
# of options for 'test'.
if test "$TICDIR" != "$TERMINFO" ; then
( rm -f $TICDIR 2>/dev/null )
if ( cd $TICDIR 2>/dev/null )
then
cd $TICDIR
TICDIR=`pwd`
if test $TICDIR != $TERMINFO ; then
# Well, we tried. Some systems lie to us, so the
# installer will have to double-check.
echo "Verify if $TICDIR and $TERMINFO are the same."
echo "The new terminfo is in $TERMINFO; the other should be a link to it."
echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
fi
else
cd ${DESTDIR}$prefix
# Construct a symbolic link that only assumes $ticdir has the
# same $prefix as the other installed directories.
RELATIVE=`echo $ticdir|sed -e 's%^'$prefix'/%%'`
if test "$RELATIVE" != "$ticdir" ; then
RELATIVE=../`echo $ticdir|sed -e 's%^'$prefix'/%%' -e 's%^/%%'`
fi
if ( ln -s -f $RELATIVE $TICDIR )
then
echo '** sym-linked '$TICDIR' for compatibility'
else
echo '** could not sym-link '$TICDIR' for compatibility'
fi
fi
fi
# vile:shmode
| ysleu/RTL8685 | uClinux-dist/lib/ncurses/misc/run_tic.sh | Shell | gpl-2.0 | 7,003 |
<?php
/**
* @package sauto
* @subpackage Base
* @author Dacian Strain {@link http://shop.elbase.eu}
* @author Created on 17-Nov-2013
* @license GNU/GPL
*/
//-- No direct access
defined('_JEXEC') || die('=;)');
$id =& JRequest::getVar( 'id', '', 'post', 'string' );
$db = JFactory::getDbo();
$query = "DELETE FROM #__sa_stare_auto WHERE `id` = '".$id."'";
$db->setQuery($query);
$db->query();
$app =& JFactory::getApplication();
$redirect = 'index.php?option=com_sauto&task=setari&action=stare';
$app->redirect($redirect, 'Stare auto eliminata cu succes');
| grchis/android | administrator/components/com_sauto/assets/includes/p_delete_stare.php | PHP | gpl-2.0 | 581 |
var hilbert = (function() {
// From Mike Bostock: http://bl.ocks.org/597287
// Adapted from Nick Johnson: http://bit.ly/biWkkq
var pairs = [
[[0, 3], [1, 0], [3, 1], [2, 0]],
[[2, 1], [1, 1], [3, 0], [0, 2]],
[[2, 2], [3, 3], [1, 2], [0, 1]],
[[0, 0], [3, 2], [1, 3], [2, 3]]
];
// d2xy and rot are from:
// http://en.wikipedia.org/wiki/Hilbert_curve#Applications_and_mapping_algorithms
var rot = function(n, x, y, rx, ry) {
if (ry === 0) {
if (rx === 1) {
x = n - 1 - x;
y = n - 1 - y;
}
return [y, x];
}
return [x, y];
};
return {
xy2d: function(x, y, z) {
var quad = 0,
pair,
i = 0;
while (--z >= 0) {
pair = pairs[quad][(x & (1 << z) ? 2 : 0) | (y & (1 << z) ? 1 : 0)];
i = (i << 2) | pair[0];
quad = pair[1];
}
return i;
},
d2xy: function(z, t) {
var n = 1 << z,
x = 0,
y = 0;
for (var s = 1; s < n; s *= 2) {
var rx = 1 & (t / 2),
ry = 1 & (t ^ rx);
var xy = rot(s, x, y, rx, ry);
x = xy[0] + s * rx;
y = xy[1] + s * ry;
t /= 4;
}
return [x, y];
}
};
})();
| eggla/LA-glazed | sites/all/modules/openlayers/modules/openlayers_library/src/Plugin/Component/Hilbert/js/hilbert_algo.js | JavaScript | gpl-2.0 | 1,468 |
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*//////////////////// Responsive Framework CSS Rules Start */
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
@media screen and (min-width: 420px) {
.mainMenuWrapper {
padding-right: 24px;
padding-left: 36px;
}
.mainMenuWrapper > li {
float: left;
box-sizing: border-box;
width: 50%;
}
.mainMenuWrapper > li:nth-child(odd) {
margin-left: -12px;
}
.mainMenuWrapper > li:nth-child(even) {
margin-left: 12px;
}
}
@media screen and (max-width: 380px) {
.serviceWrapper {
float: none;
margin-right: 0px;
width: 100%;
}
.serviceWrapper:last-child {
border-bottom: 0px;
}
}
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*//////////////////// Responsive Framework CSS Rules End */
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
| JoelPub/wordpress-amazon | order/themes/mobile/style62/css/responsive.css | CSS | gpl-2.0 | 1,218 |
/*
*************************************************************************************
* Linux
* USB Host Controller Driver
*
* (c) Copyright 2006-2012, SoftWinners Co,Ld.
* All Rights Reserved
*
* File Name : sw_hcd_virt_hub.c
*
* Author : javen
*
* Description : 虚拟 hub
*
* History :
* <author> <time> <version > <desc>
* javen 2010-12-20 1.0 create this file
*
*************************************************************************************
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <asm/unaligned.h>
#include "../include/sw_hcd_config.h"
#include "../include/sw_hcd_core.h"
#include "../include/sw_hcd_virt_hub.h"
/*
*******************************************************************************
* sw_hcd_port_suspend_ex
*
* Description:
* only suspend USB port
*
* Parameters:
* sw_hcd : input. USB控制器
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
void sw_hcd_port_suspend_ex(struct sw_hcd *sw_hcd)
{
/* if peripheral connect, suspend the device */
if (sw_hcd->is_active) {
/* suspend usb port */
USBC_Host_SuspendPort(sw_hcd->sw_hcd_io->usb_bsp_hdle);
/* delay for 1000ms */
mdelay(1000);
}
return;
}
/*
*******************************************************************************
* sw_hcd_port_resume_ex
*
* Description:
* only resume USB port
*
* Parameters:
* sw_hcd : input. USB控制器
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
void sw_hcd_port_resume_ex(struct sw_hcd *sw_hcd)
{
/* resume port */
USBC_Host_RusumePort(sw_hcd->sw_hcd_io->usb_bsp_hdle);
mdelay(500);
USBC_Host_ClearRusumePortFlag(sw_hcd->sw_hcd_io->usb_bsp_hdle);
return;
}
/*
*******************************************************************************
* sw_hcd_port_reset_ex
*
* Description:
* only reset USB port
*
* Parameters:
* sw_hcd : input. USB控制器
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
void sw_hcd_port_reset_ex(struct sw_hcd *sw_hcd)
{
/* resume port */
sw_hcd_port_resume_ex(sw_hcd);
/* reset port */
USBC_Host_ResetPort(sw_hcd->sw_hcd_io->usb_bsp_hdle);
mdelay(50);
USBC_Host_ClearResetPortFlag(sw_hcd->sw_hcd_io->usb_bsp_hdle);
mdelay(500);
return;
}
/*
*******************************************************************************
* sw_hcd_port_suspend
*
* Description:
* suspend USB port
*
* Parameters:
* sw_hcd : input. USB控制器
* do_suspend : input. flag. is suspend USB port or not?
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
static void sw_hcd_port_suspend(struct sw_hcd *sw_hcd, bool do_suspend)
{
u8 power = 0;
void __iomem *usbc_base = sw_hcd->mregs;
if (!is_host_active(sw_hcd)){
DMSG_PANIC("ERR: usb host is not active\n");
return;
}
/* NOTE: this doesn't necessarily put PHY into low power mode,
* turning off its clock; that's a function of PHY integration and
* sw_hcd_POWER_ENSUSPEND. PHY may need a clock (sigh) to detect
* SE0 changing to connect (J) or wakeup (K) states.
*/
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
if (do_suspend) {
int retries = 10000;
DMSG_INFO("[sw_hcd]: suspend port.\n");
power &= ~(1 << USBC_BP_POWER_H_RESUME);
power |= (1 << USBC_BP_POWER_H_SUSPEND);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
/* Needed for OPT A tests */
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
while (power & (1 << USBC_BP_POWER_H_SUSPEND)) {
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
if (retries-- < 1)
break;
}
DMSG_DBG_HCD("DBG: Root port suspended, power %02x\n", power);
sw_hcd->port1_status |= USB_PORT_STAT_SUSPEND;
}else if (power & (1 << USBC_BP_POWER_H_SUSPEND)){
DMSG_INFO("[sw_hcd]: suspend portend, resume port.\n");
power &= ~(1 << USBC_BP_POWER_H_SUSPEND);
power |= (1 << USBC_BP_POWER_H_RESUME);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
DMSG_DBG_HCD("DBG: Root port resuming, power %02x\n", power);
/* later, GetPortStatus will stop RESUME signaling */
sw_hcd->port1_status |= SW_HCD_PORT_STAT_RESUME;
sw_hcd->rh_timer = jiffies + msecs_to_jiffies(20);
}else{
DMSG_PANIC("WRN: sw_hcd_port_suspend nothing to do\n");
}
return ;
}
/*
*******************************************************************************
* sw_hcd_port_reset
*
* Description:
* reset USB port
*
* Parameters:
* sw_hcd : input. USB控制器
* do_reset : input. flag. is reset USB port or not?
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
static void sw_hcd_port_reset(struct sw_hcd *sw_hcd, bool do_reset)
{
u8 power = 0;
void __iomem *usbc_base = sw_hcd->mregs;
if (!is_host_active(sw_hcd)){
DMSG_PANIC("ERR: usb host is not active\n");
return;
}
/* NOTE: caller guarantees it will turn off the reset when
* the appropriate amount of time has passed
*/
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
if (do_reset) {
DMSG_INFO("[sw_hcd]: reset port. \n");
/*
* If RESUME is set, we must make sure it stays minimum 20 ms.
* Then we must clear RESUME and wait a bit to let sw_hcd start
* generating SOFs. If we don't do this, OPT HS A 6.8 tests
* fail with "Error! Did not receive an SOF before suspend
* detected".
*/
if (power & (1 << USBC_BP_POWER_H_RESUME)) {
while (time_before(jiffies, sw_hcd->rh_timer)){
msleep(1);
}
power &= ~(1 << USBC_BP_POWER_H_RESUME);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
msleep(1);
}
sw_hcd->ignore_disconnect = true;
power &= 0xf0;
power |= (1 << USBC_BP_POWER_H_RESET);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
sw_hcd->port1_status |= USB_PORT_STAT_RESET;
sw_hcd->port1_status &= ~USB_PORT_STAT_ENABLE;
sw_hcd->rh_timer = jiffies + msecs_to_jiffies(50);
USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, 0);
//set address ep0
{
__u32 i = 1;
__u8 old_ep_index = 0;
old_ep_index = USBC_GetActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle);
USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, 0);
USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, 0);
for( i = 1 ; i <= 5; i++){
USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, i);
USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, i);
USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_RX, i);
}
USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, old_ep_index);
}
}else{
DMSG_INFO("[sw_hcd]: reset port stopped.\n");
UsbPhyEndReset(0);
power &= ~(1 << USBC_BP_POWER_H_RESET);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
sw_hcd->ignore_disconnect = false;
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
if(power & (1 << USBC_BP_POWER_H_HIGH_SPEED_FLAG)){
DMSG_DBG_HCD("high-speed device connected\n");
sw_hcd->port1_status |= USB_PORT_STAT_HIGH_SPEED;
}
sw_hcd->port1_status &= ~USB_PORT_STAT_RESET;
sw_hcd->port1_status |= USB_PORT_STAT_ENABLE
| (USB_PORT_STAT_C_RESET << 16)
| (USB_PORT_STAT_C_ENABLE << 16);
usb_hcd_poll_rh_status(sw_hcd_to_hcd(sw_hcd));
sw_hcd->vbuserr_retry = VBUSERR_RETRY_COUNT;
}
return ;
}
/*
*******************************************************************************
* sw_hcd_root_disconnect
*
* Description:
* 断开连接
*
* Parameters:
* sw_hcd : input. USB控制器
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
void sw_hcd_root_disconnect(struct sw_hcd *sw_hcd)
{
sw_hcd->port1_status = (1 << USB_PORT_FEAT_POWER)
| (1 << USB_PORT_FEAT_C_CONNECTION);
usb_hcd_poll_rh_status(sw_hcd_to_hcd(sw_hcd));
sw_hcd->is_active = 0;
return;
}
EXPORT_SYMBOL(sw_hcd_root_disconnect);
/*
*******************************************************************************
* sw_hcd_hub_status_data
*
* Description:
* Caller may or may not hold sw_hcd->lock
*
* Parameters:
* void
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
int sw_hcd_hub_status_data(struct usb_hcd *hcd, char *buf)
{
struct sw_hcd *sw_hcd = hcd_to_sw_hcd(hcd);
int retval = 0;
/* called in_irq() via usb_hcd_poll_rh_status() */
if (sw_hcd->port1_status & 0xffff0000) {
*buf = 0x02;
retval = 1;
}
return retval;
}
EXPORT_SYMBOL(sw_hcd_hub_status_data);
/*
*******************************************************************************
* sw_hcd_hub_control
*
* Description:
* void
*
* Parameters:
* void
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
int sw_hcd_hub_control(struct usb_hcd *hcd,
u16 typeReq,
u16 wValue,
u16 wIndex,
char *buf,
u16 wLength)
{
struct sw_hcd *sw_hcd = hcd_to_sw_hcd(hcd);
u32 temp = 0;
int retval = 0;
unsigned long flags = 0;
void __iomem *usbc_base = sw_hcd->mregs;
if(hcd == NULL){
DMSG_PANIC("ERR: invalid argment\n");
return -ESHUTDOWN;
}
spin_lock_irqsave(&sw_hcd->lock, flags);
if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) {
spin_unlock_irqrestore(&sw_hcd->lock, flags);
return -ESHUTDOWN;
}
DMSG_DBG_HCD("sw_hcd_hub_control: typeReq = %x, wValue = 0x%x, wIndex = 0x%x\n",
typeReq, wValue, wIndex);
/* hub features: always zero, setting is a NOP
* port features: reported, sometimes updated when host is active
* no indicators
*/
switch (typeReq) {
case ClearHubFeature:
case SetHubFeature:
switch (wValue) {
case C_HUB_OVER_CURRENT:
case C_HUB_LOCAL_POWER:
break;
default:
goto error;
}
break;
case ClearPortFeature:
if ((wIndex & 0xff) != 1){
goto error;
}
switch (wValue) {
case USB_PORT_FEAT_ENABLE:
break;
case USB_PORT_FEAT_SUSPEND:
sw_hcd_port_suspend(sw_hcd, false);
break;
case USB_PORT_FEAT_POWER:
/* fixme */
sw_hcd_set_vbus(sw_hcd, 0);
break;
case USB_PORT_FEAT_C_CONNECTION:
case USB_PORT_FEAT_C_ENABLE:
case USB_PORT_FEAT_C_OVER_CURRENT:
case USB_PORT_FEAT_C_RESET:
case USB_PORT_FEAT_C_SUSPEND:
break;
default:
goto error;
}
DMSG_DBG_HCD("DBG: clear feature %d\n", wValue);
sw_hcd->port1_status &= ~(1 << wValue);
break;
case GetHubDescriptor:
{
struct usb_hub_descriptor *desc = (void *)buf;
desc->bDescLength = 9;
desc->bDescriptorType = 0x29;
desc->bNbrPorts = 1;
desc->wHubCharacteristics = cpu_to_le16(
0x0001 /* per-port power switching */
| 0x0010 /* no overcurrent reporting */
);
desc->bPwrOn2PwrGood = 5; /* msec/2 */
desc->bHubContrCurrent = 0;
/* workaround bogus struct definition */
desc->u.hs.DeviceRemovable[0] = 0x02; /* port 1 */
desc->u.hs.DeviceRemovable[1] = 0xff;
}
break;
case GetHubStatus:
temp = 0;
*(__le32 *) buf = cpu_to_le32(temp);
break;
case GetPortStatus:
{
if (wIndex != 1){
DMSG_PANIC("ERR: GetPortStatus parameter wIndex is not 1.\n");
goto error;
}
/* finish RESET signaling? */
if ((sw_hcd->port1_status & USB_PORT_STAT_RESET)
&& time_after_eq(jiffies, sw_hcd->rh_timer)){
sw_hcd_port_reset(sw_hcd, false);
}
/* finish RESUME signaling? */
if ((sw_hcd->port1_status & SW_HCD_PORT_STAT_RESUME)
&& time_after_eq(jiffies, sw_hcd->rh_timer)) {
u8 power = 0;
power = USBC_Readb(USBC_REG_PCTL(usbc_base));
power &= ~(1 << USBC_BP_POWER_H_RESUME);
USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
DMSG_DBG_HCD("DBG: root port resume stopped, power %02x\n", power);
/* ISSUE: DaVinci (RTL 1.300) disconnects after
* resume of high speed peripherals (but not full
* speed ones).
*/
sw_hcd->is_active = 1;
sw_hcd->port1_status &= ~(USB_PORT_STAT_SUSPEND
| SW_HCD_PORT_STAT_RESUME);
sw_hcd->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
usb_hcd_poll_rh_status(sw_hcd_to_hcd(sw_hcd));
}
put_unaligned(cpu_to_le32(sw_hcd->port1_status
& ~SW_HCD_PORT_STAT_RESUME),
(__le32 *) buf);
/* port change status is more interesting */
DMSG_DBG_HCD("DBG: port status %08x\n", sw_hcd->port1_status);
}
break;
case SetPortFeature:
{
if ((wIndex & 0xff) != 1){
goto error;
}
switch (wValue) {
case USB_PORT_FEAT_POWER:
/* NOTE: this controller has a strange state machine
* that involves "requesting sessions" according to
* magic side effects from incompletely-described
* rules about startup...
*
* This call is what really starts the host mode; be
* very careful about side effects if you reorder any
* initialization logic, e.g. for OTG, or change any
* logic relating to VBUS power-up.
*/
sw_hcd_start(sw_hcd);
break;
case USB_PORT_FEAT_RESET:
sw_hcd_port_reset(sw_hcd, true);
break;
case USB_PORT_FEAT_SUSPEND:
sw_hcd_port_suspend(sw_hcd, true);
break;
case USB_PORT_FEAT_TEST:
{
if (unlikely(is_host_active(sw_hcd))){
DMSG_PANIC("ERR: usb host is not active\n");
goto error;
}
wIndex >>= 8;
switch (wIndex) {
case 1:
DMSG_DBG_HCD("TEST_J\n");
temp = 1 << USBC_BP_TMCTL_TEST_J;
break;
case 2:
DMSG_DBG_HCD("TEST_K\n");
temp = 1 << USBC_BP_TMCTL_TEST_K;
break;
case 3:
DMSG_DBG_HCD("TEST_SE0_NAK\n");
temp = 1 << USBC_BP_TMCTL_TEST_SE0_NAK;
break;
case 4:
DMSG_DBG_HCD("TEST_PACKET\n");
temp = 1 << USBC_BP_TMCTL_TEST_PACKET;
sw_hcd_load_testpacket(sw_hcd);
break;
case 5:
DMSG_DBG_HCD("TEST_FORCE_ENABLE\n");
temp = (1 << USBC_BP_TMCTL_FORCE_HOST)
| (1 << USBC_BP_TMCTL_FORCE_HS);
USBC_REG_set_bit_b(USBC_BP_DEVCTL_SESSION, USBC_REG_DEVCTL(usbc_base));
break;
case 6:
DMSG_DBG_HCD("TEST_FIFO_ACCESS\n");
temp = 1 << USBC_BP_TMCTL_FIFO_ACCESS;
break;
default:
DMSG_PANIC("ERR: unkown SetPortFeature USB_PORT_FEAT_TEST wIndex(%d)\n", wIndex);
goto error;
}
USBC_Writeb(temp, USBC_REG_TMCTL(usbc_base));
}
break;
default:{
DMSG_PANIC("ERR: unkown SetPortFeature wValue(%d)\n", wValue);
goto error;
}
}
DMSG_DBG_HCD("DBG: set feature %d\n", wValue);
sw_hcd->port1_status |= 1 << wValue;
}
break;
default:
error:
DMSG_PANIC("ERR: protocol stall on error\n");
/* "protocol stall" on error */
retval = -EPIPE;
}
spin_unlock_irqrestore(&sw_hcd->lock, flags);
return retval;
}
EXPORT_SYMBOL(sw_hcd_hub_control);
| mozilla-b2g/kernel_flatfish | drivers/usb/sun7i_usb/hcd/core/sw_hcd_virt_hub.c | C | gpl-2.0 | 15,810 |
/*
* This file contains work-arounds for many known PCI hardware
* bugs. Devices present only on certain architectures (host
* bridges et cetera) should be handled in arch-specific code.
*
* Note: any quirks for hotpluggable devices must _NOT_ be declared __init.
*
* Copyright (c) 1999 Martin Mares <mj@ucw.cz>
*
* Init/reset quirks for USB host controllers should be in the
* USB quirks file, where their drivers can access reuse it.
*
* The bridge optimization stuff has been removed. If you really
* have a silly BIOS which is unable to set your host bridge right,
* use the PowerTweak utility (see http://powertweak.sourceforge.net).
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/acpi.h>
#include <linux/kallsyms.h>
#include <linux/dmi.h>
#include <linux/pci-aspm.h>
#include <linux/ioport.h>
#include "pci.h"
int isa_dma_bridge_buggy;
EXPORT_SYMBOL(isa_dma_bridge_buggy);
int pci_pci_problems;
EXPORT_SYMBOL(pci_pci_problems);
#ifdef CONFIG_PCI_QUIRKS
/*
* This quirk function disables memory decoding and releases memory resources
* of the device specified by kernel's boot parameter 'pci=resource_alignment='.
* It also rounds up size to specified alignment.
* Later on, the kernel will assign page-aligned memory resource back
* to the device.
*/
static void __devinit quirk_resource_alignment(struct pci_dev *dev)
{
int i;
struct resource *r;
resource_size_t align, size;
u16 command;
if (!pci_is_reassigndev(dev))
return;
if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL &&
(dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) {
dev_warn(&dev->dev,
"Can't reassign resources to host bridge.\n");
return;
}
dev_info(&dev->dev,
"Disabling memory decoding and releasing memory resources.\n");
pci_read_config_word(dev, PCI_COMMAND, &command);
command &= ~PCI_COMMAND_MEMORY;
pci_write_config_word(dev, PCI_COMMAND, command);
align = pci_specified_resource_alignment(dev);
for (i=0; i < PCI_BRIDGE_RESOURCES; i++) {
r = &dev->resource[i];
if (!(r->flags & IORESOURCE_MEM))
continue;
size = resource_size(r);
if (size < align) {
size = align;
dev_info(&dev->dev,
"Rounding up size of resource #%d to %#llx.\n",
i, (unsigned long long)size);
}
r->end = size - 1;
r->start = 0;
}
/* Need to disable bridge's resource window,
* to enable the kernel to reassign new resource
* window later on.
*/
if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
(dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) {
r = &dev->resource[i];
if (!(r->flags & IORESOURCE_MEM))
continue;
r->end = resource_size(r) - 1;
r->start = 0;
}
pci_disable_bridge_window(dev);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_resource_alignment);
#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
/* The Mellanox Tavor device gives false positive parity errors
* Mark this device with a broken_parity_status, to allow
* PCI scanning code to "skip" this now blacklisted device.
*/
static void __devinit quirk_mellanox_tavor(struct pci_dev *dev)
{
dev->broken_parity_status = 1; /* This device gives false positives */
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor);
/* Deal with broken BIOS'es that neglect to enable passive release,
which can cause problems in combination with the 82441FX/PPro MTRRs */
static void quirk_passive_release(struct pci_dev *dev)
{
struct pci_dev *d = NULL;
unsigned char dlc;
/* We have to make sure a particular bit is set in the PIIX3
ISA bridge, so we have to go out and find it. */
while ((d = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_0, d))) {
pci_read_config_byte(d, 0x82, &dlc);
if (!(dlc & 1<<1)) {
dev_info(&d->dev, "PIIX3: Enabling Passive Release\n");
dlc |= 1<<1;
pci_write_config_byte(d, 0x82, dlc);
}
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release);
/* The VIA VP2/VP3/MVP3 seem to have some 'features'. There may be a workaround
but VIA don't answer queries. If you happen to have good contacts at VIA
ask them for me please -- Alan
This appears to be BIOS not version dependent. So presumably there is a
chipset level fix */
static void __devinit quirk_isa_dma_hangs(struct pci_dev *dev)
{
if (!isa_dma_bridge_buggy) {
isa_dma_bridge_buggy=1;
dev_info(&dev->dev, "Activating ISA DMA hang workarounds\n");
}
}
/*
* Its not totally clear which chipsets are the problematic ones
* We know 82C586 and 82C596 variants are affected.
*/
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_0, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_1, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs);
/*
* Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
* for some HT machines to use C4 w/o hanging.
*/
static void __devinit quirk_tigerpoint_bm_sts(struct pci_dev *dev)
{
u32 pmbase;
u16 pm1a;
pci_read_config_dword(dev, 0x40, &pmbase);
pmbase = pmbase & 0xff80;
pm1a = inw(pmbase);
if (pm1a & 0x10) {
dev_info(&dev->dev, FW_BUG "TigerPoint LPC.BM_STS cleared\n");
outw(0x10, pmbase);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
/*
* Chipsets where PCI->PCI transfers vanish or hang
*/
static void __devinit quirk_nopcipci(struct pci_dev *dev)
{
if ((pci_pci_problems & PCIPCI_FAIL)==0) {
dev_info(&dev->dev, "Disabling direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_FAIL;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, quirk_nopcipci);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496, quirk_nopcipci);
static void __devinit quirk_nopciamd(struct pci_dev *dev)
{
u8 rev;
pci_read_config_byte(dev, 0x08, &rev);
if (rev == 0x13) {
/* Erratum 24 */
dev_info(&dev->dev, "Chipset erratum: Disabling direct PCI/AGP transfers\n");
pci_pci_problems |= PCIAGP_FAIL;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8151_0, quirk_nopciamd);
/*
* Triton requires workarounds to be used by the drivers
*/
static void __devinit quirk_triton(struct pci_dev *dev)
{
if ((pci_pci_problems&PCIPCI_TRITON)==0) {
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_TRITON;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437, quirk_triton);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX, quirk_triton);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439, quirk_triton);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439TX, quirk_triton);
/*
* VIA Apollo KT133 needs PCI latency patch
* Made according to a windows driver based patch by George E. Breese
* see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
* Also see http://www.au-ja.org/review-kt133a-1-en.phtml for
* the info on which Mr Breese based his work.
*
* Updated based on further information from the site and also on
* information provided by VIA
*/
static void quirk_vialatency(struct pci_dev *dev)
{
struct pci_dev *p;
u8 busarb;
/* Ok we have a potential problem chipset here. Now see if we have
a buggy southbridge */
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, NULL);
if (p!=NULL) {
/* 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A; thanks Dan Hollis */
/* Check for buggy part revisions */
if (p->revision < 0x40 || p->revision > 0x42)
goto exit;
} else {
p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL);
if (p==NULL) /* No problem parts */
goto exit;
/* Check for buggy part revisions */
if (p->revision < 0x10 || p->revision > 0x12)
goto exit;
}
/*
* Ok we have the problem. Now set the PCI master grant to
* occur every master grant. The apparent bug is that under high
* PCI load (quite common in Linux of course) you can get data
* loss when the CPU is held off the bus for 3 bus master requests
* This happens to include the IDE controllers....
*
* VIA only apply this fix when an SB Live! is present but under
* both Linux and Windows this isnt enough, and we have seen
* corruption without SB Live! but with things like 3 UDMA IDE
* controllers. So we ignore that bit of the VIA recommendation..
*/
pci_read_config_byte(dev, 0x76, &busarb);
/* Set bit 4 and bi 5 of byte 76 to 0x01
"Master priority rotation on every PCI master grant */
busarb &= ~(1<<5);
busarb |= (1<<4);
pci_write_config_byte(dev, 0x76, busarb);
dev_info(&dev->dev, "Applying VIA southbridge workaround\n");
exit:
pci_dev_put(p);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency);
/* Must restore this on a resume from RAM */
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency);
/*
* VIA Apollo VP3 needs ETBF on BT848/878
*/
static void __devinit quirk_viaetbf(struct pci_dev *dev)
{
if ((pci_pci_problems&PCIPCI_VIAETBF)==0) {
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_VIAETBF;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_viaetbf);
static void __devinit quirk_vsfx(struct pci_dev *dev)
{
if ((pci_pci_problems&PCIPCI_VSFX)==0) {
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_VSFX;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576, quirk_vsfx);
/*
* Ali Magik requires workarounds to be used by the drivers
* that DMA to AGP space. Latency must be set to 0xA and triton
* workaround applied too
* [Info kindly provided by ALi]
*/
static void __init quirk_alimagik(struct pci_dev *dev)
{
if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) {
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_ALIMAGIK|PCIPCI_TRITON;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1647, quirk_alimagik);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1651, quirk_alimagik);
/*
* Natoma has some interesting boundary conditions with Zoran stuff
* at least
*/
static void __devinit quirk_natoma(struct pci_dev *dev)
{
if ((pci_pci_problems&PCIPCI_NATOMA)==0) {
dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n");
pci_pci_problems |= PCIPCI_NATOMA;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_natoma);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443LX_0, quirk_natoma);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443LX_1, quirk_natoma);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_0, quirk_natoma);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_1, quirk_natoma);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_2, quirk_natoma);
/*
* This chip can cause PCI parity errors if config register 0xA0 is read
* while DMAs are occurring.
*/
static void __devinit quirk_citrine(struct pci_dev *dev)
{
dev->cfg_size = 0xA0;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, quirk_citrine);
/*
* S3 868 and 968 chips report region size equal to 32M, but they decode 64M.
* If it's needed, re-allocate the region.
*/
static void __devinit quirk_s3_64M(struct pci_dev *dev)
{
struct resource *r = &dev->resource[0];
if ((r->start & 0x3ffffff) || r->end != r->start + 0x3ffffff) {
r->start = 0;
r->end = 0x3ffffff;
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M);
static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
unsigned size, int nr, const char *name)
{
region &= ~(size-1);
if (region) {
struct pci_bus_region bus_region;
struct resource *res = dev->resource + nr;
res->name = pci_name(dev);
res->start = region;
res->end = region + size - 1;
res->flags = IORESOURCE_IO;
/* Convert from PCI bus to resource space. */
bus_region.start = res->start;
bus_region.end = res->end;
pcibios_bus_to_resource(dev, res, &bus_region);
pci_claim_resource(dev, nr);
dev_info(&dev->dev, "quirk: region %04x-%04x claimed by %s\n", region, region + size - 1, name);
}
}
/*
* ATI Northbridge setups MCE the processor if you even
* read somewhere between 0x3b0->0x3bb or read 0x3d3
*/
static void __devinit quirk_ati_exploding_mce(struct pci_dev *dev)
{
dev_info(&dev->dev, "ATI Northbridge, reserving I/O ports 0x3b0 to 0x3bb\n");
/* Mae rhaid i ni beidio ag edrych ar y lleoliadiau I/O hyn */
request_region(0x3b0, 0x0C, "RadeonIGP");
request_region(0x3d3, 0x01, "RadeonIGP");
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, quirk_ati_exploding_mce);
/*
* Let's make the southbridge information explicit instead
* of having to worry about people probing the ACPI areas,
* for example.. (Yes, it happens, and if you read the wrong
* ACPI register it will put the machine to sleep with no
* way of waking it up again. Bummer).
*
* ALI M7101: Two IO regions pointed to by words at
* 0xE0 (64 bytes of ACPI registers)
* 0xE2 (32 bytes of SMB registers)
*/
static void __devinit quirk_ali7101_acpi(struct pci_dev *dev)
{
u16 region;
pci_read_config_word(dev, 0xE0, ®ion);
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
pci_read_config_word(dev, 0xE2, ®ion);
quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi);
static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
{
u32 devres;
u32 mask, size, base;
pci_read_config_dword(dev, port, &devres);
if ((devres & enable) != enable)
return;
mask = (devres >> 16) & 15;
base = devres & 0xffff;
size = 16;
for (;;) {
unsigned bit = size >> 1;
if ((bit & mask) == bit)
break;
size = bit;
}
/*
* For now we only print it out. Eventually we'll want to
* reserve it (at least if it's in the 0x1000+ range), but
* let's get enough confirmation reports first.
*/
base &= -size;
dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, base + size - 1);
}
static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
{
u32 devres;
u32 mask, size, base;
pci_read_config_dword(dev, port, &devres);
if ((devres & enable) != enable)
return;
base = devres & 0xffff0000;
mask = (devres & 0x3f) << 16;
size = 128 << 16;
for (;;) {
unsigned bit = size >> 1;
if ((bit & mask) == bit)
break;
size = bit;
}
/*
* For now we only print it out. Eventually we'll want to
* reserve it, but let's get enough confirmation reports first.
*/
base &= -size;
dev_info(&dev->dev, "%s MMIO at %04x-%04x\n", name, base, base + size - 1);
}
/*
* PIIX4 ACPI: Two IO regions pointed to by longwords at
* 0x40 (64 bytes of ACPI registers)
* 0x90 (16 bytes of SMB registers)
* and a few strange programmable PIIX4 device resources.
*/
static void __devinit quirk_piix4_acpi(struct pci_dev *dev)
{
u32 region, res_a;
pci_read_config_dword(dev, 0x40, ®ion);
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI");
pci_read_config_dword(dev, 0x90, ®ion);
quirk_io_region(dev, region, 16, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB");
/* Device resource A has enables for some of the other ones */
pci_read_config_dword(dev, 0x5c, &res_a);
piix4_io_quirk(dev, "PIIX4 devres B", 0x60, 3 << 21);
piix4_io_quirk(dev, "PIIX4 devres C", 0x64, 3 << 21);
/* Device resource D is just bitfields for static resources */
/* Device 12 enabled? */
if (res_a & (1 << 29)) {
piix4_io_quirk(dev, "PIIX4 devres E", 0x68, 1 << 20);
piix4_mem_quirk(dev, "PIIX4 devres F", 0x6c, 1 << 7);
}
/* Device 13 enabled? */
if (res_a & (1 << 30)) {
piix4_io_quirk(dev, "PIIX4 devres G", 0x70, 1 << 20);
piix4_mem_quirk(dev, "PIIX4 devres H", 0x74, 1 << 7);
}
piix4_io_quirk(dev, "PIIX4 devres I", 0x78, 1 << 20);
piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi);
/*
* ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
* 0x40 (128 bytes of ACPI, GPIO & TCO registers)
* 0x58 (64 bytes of GPIO I/O space)
*/
static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
{
u32 region;
pci_read_config_dword(dev, 0x40, ®ion);
quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO");
pci_read_config_dword(dev, 0x58, ®ion);
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, quirk_ich4_lpc_acpi);
static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev)
{
u32 region;
pci_read_config_dword(dev, 0x40, ®ion);
quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH6 ACPI/GPIO/TCO");
pci_read_config_dword(dev, 0x48, ®ion);
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH6 GPIO");
}
static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize)
{
u32 val;
u32 size, base;
pci_read_config_dword(dev, reg, &val);
/* Enabled? */
if (!(val & 1))
return;
base = val & 0xfffc;
if (dynsize) {
/*
* This is not correct. It is 16, 32 or 64 bytes depending on
* register D31:F0:ADh bits 5:4.
*
* But this gets us at least _part_ of it.
*/
size = 16;
} else {
size = 128;
}
base &= ~(size-1);
/* Just print it out for now. We should reserve it after more debugging */
dev_info(&dev->dev, "%s PIO at %04x-%04x\n", name, base, base+size-1);
}
static void __devinit quirk_ich6_lpc(struct pci_dev *dev)
{
/* Shared ACPI/GPIO decode with all ICH6+ */
ich6_lpc_acpi_gpio(dev);
/* ICH6-specific generic IO decode */
ich6_lpc_generic_decode(dev, 0x84, "LPC Generic IO decode 1", 0);
ich6_lpc_generic_decode(dev, 0x88, "LPC Generic IO decode 2", 1);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, quirk_ich6_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, quirk_ich6_lpc);
static void __devinit ich7_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name)
{
u32 val;
u32 mask, base;
pci_read_config_dword(dev, reg, &val);
/* Enabled? */
if (!(val & 1))
return;
/*
* IO base in bits 15:2, mask in bits 23:18, both
* are dword-based
*/
base = val & 0xfffc;
mask = (val >> 16) & 0xfc;
mask |= 3;
/* Just print it out for now. We should reserve it after more debugging */
dev_info(&dev->dev, "%s PIO at %04x (mask %04x)\n", name, base, mask);
}
/* ICH7-10 has the same common LPC generic IO decode registers */
static void __devinit quirk_ich7_lpc(struct pci_dev *dev)
{
/* We share the common ACPI/DPIO decode with ICH6 */
ich6_lpc_acpi_gpio(dev);
/* And have 4 ICH7+ generic decodes */
ich7_lpc_generic_decode(dev, 0x84, "ICH7 LPC Generic IO decode 1");
ich7_lpc_generic_decode(dev, 0x88, "ICH7 LPC Generic IO decode 2");
ich7_lpc_generic_decode(dev, 0x8c, "ICH7 LPC Generic IO decode 3");
ich7_lpc_generic_decode(dev, 0x90, "ICH7 LPC Generic IO decode 4");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich7_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_1, quirk_ich7_lpc);
/*
* VIA ACPI: One IO region pointed to by longword at
* 0x48 or 0x20 (256 bytes of ACPI registers)
*/
static void __devinit quirk_vt82c586_acpi(struct pci_dev *dev)
{
u32 region;
if (dev->revision & 0x10) {
pci_read_config_dword(dev, 0x48, ®ion);
region &= PCI_BASE_ADDRESS_IO_MASK;
quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES, "vt82c586 ACPI");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi);
/*
* VIA VT82C686 ACPI: Three IO region pointed to by (long)words at
* 0x48 (256 bytes of ACPI registers)
* 0x70 (128 bytes of hardware monitoring register)
* 0x90 (16 bytes of SMB registers)
*/
static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev)
{
u16 hm;
u32 smb;
quirk_vt82c586_acpi(dev);
pci_read_config_word(dev, 0x70, &hm);
hm &= PCI_BASE_ADDRESS_IO_MASK;
quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c686 HW-mon");
pci_read_config_dword(dev, 0x90, &smb);
smb &= PCI_BASE_ADDRESS_IO_MASK;
quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c686 SMB");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi);
/*
* VIA VT8235 ISA Bridge: Two IO regions pointed to by words at
* 0x88 (128 bytes of power management registers)
* 0xd0 (16 bytes of SMB registers)
*/
static void __devinit quirk_vt8235_acpi(struct pci_dev *dev)
{
u16 pm, smb;
pci_read_config_word(dev, 0x88, &pm);
pm &= PCI_BASE_ADDRESS_IO_MASK;
quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM");
pci_read_config_word(dev, 0xd0, &smb);
smb &= PCI_BASE_ADDRESS_IO_MASK;
quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1, "vt8235 SMB");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi);
/*
* TI XIO2000a PCIe-PCI Bridge erroneously reports it supports fast back-to-back:
* Disable fast back-to-back on the secondary bus segment
*/
static void __devinit quirk_xio2000a(struct pci_dev *dev)
{
struct pci_dev *pdev;
u16 command;
dev_warn(&dev->dev, "TI XIO2000a quirk detected; "
"secondary bus fast back-to-back transfers disabled\n");
list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) {
pci_read_config_word(pdev, PCI_COMMAND, &command);
if (command & PCI_COMMAND_FAST_BACK)
pci_write_config_word(pdev, PCI_COMMAND, command & ~PCI_COMMAND_FAST_BACK);
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XIO2000A,
quirk_xio2000a);
#ifdef CONFIG_X86_IO_APIC
#include <asm/io_apic.h>
/*
* VIA 686A/B: If an IO-APIC is active, we need to route all on-chip
* devices to the external APIC.
*
* TODO: When we have device-specific interrupt routers,
* this code will go away from quirks.
*/
static void quirk_via_ioapic(struct pci_dev *dev)
{
u8 tmp;
if (nr_ioapics < 1)
tmp = 0; /* nothing routed to external APIC */
else
tmp = 0x1f; /* all known bits (4-0) routed to external APIC */
dev_info(&dev->dev, "%sbling VIA external APIC routing\n",
tmp == 0 ? "Disa" : "Ena");
/* Offset 0x58: External APIC IRQ output control */
pci_write_config_byte (dev, 0x58, tmp);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic);
/*
* VIA 8237: Some BIOSs don't set the 'Bypass APIC De-Assert Message' Bit.
* This leads to doubled level interrupt rates.
* Set this bit to get rid of cycle wastage.
* Otherwise uncritical.
*/
static void quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev)
{
u8 misc_control2;
#define BYPASS_APIC_DEASSERT 8
pci_read_config_byte(dev, 0x5B, &misc_control2);
if (!(misc_control2 & BYPASS_APIC_DEASSERT)) {
dev_info(&dev->dev, "Bypassing VIA 8237 APIC De-Assert Message\n");
pci_write_config_byte(dev, 0x5B, misc_control2|BYPASS_APIC_DEASSERT);
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
/*
* The AMD io apic can hang the box when an apic irq is masked.
* We check all revs >= B0 (yet not in the pre production!) as the bug
* is currently marked NoFix
*
* We have multiple reports of hangs with this chipset that went away with
* noapic specified. For the moment we assume it's the erratum. We may be wrong
* of course. However the advice is demonstrably good even if so..
*/
static void __devinit quirk_amd_ioapic(struct pci_dev *dev)
{
if (dev->revision >= 0x02) {
dev_warn(&dev->dev, "I/O APIC: AMD Erratum #22 may be present. In the event of instability try\n");
dev_warn(&dev->dev, " : booting with the \"noapic\" option\n");
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410, quirk_amd_ioapic);
static void __init quirk_ioapic_rmw(struct pci_dev *dev)
{
if (dev->devfn == 0 && dev->bus->number == 0)
sis_apic_bug = 1;
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw);
#endif /* CONFIG_X86_IO_APIC */
/*
* Some settings of MMRBC can lead to data corruption so block changes.
* See AMD 8131 HyperTransport PCI-X Tunnel Revision Guide
*/
static void __init quirk_amd_8131_mmrbc(struct pci_dev *dev)
{
if (dev->subordinate && dev->revision <= 0x12) {
dev_info(&dev->dev, "AMD8131 rev %x detected; "
"disabling PCI-X MMRBC\n", dev->revision);
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_mmrbc);
/*
* FIXME: it is questionable that quirk_via_acpi
* is needed. It shows up as an ISA bridge, and does not
* support the PCI_INTERRUPT_LINE register at all. Therefore
* it seems like setting the pci_dev's 'irq' to the
* value of the ACPI SCI interrupt is only done for convenience.
* -jgarzik
*/
static void __devinit quirk_via_acpi(struct pci_dev *d)
{
/*
* VIA ACPI device: SCI IRQ line in PCI config byte 0x42
*/
u8 irq;
pci_read_config_byte(d, 0x42, &irq);
irq &= 0xf;
if (irq && (irq != 2))
d->irq = irq;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_acpi);
/*
* VIA bridges which have VLink
*/
static int via_vlink_dev_lo = -1, via_vlink_dev_hi = 18;
static void quirk_via_bridge(struct pci_dev *dev)
{
/* See what bridge we have and find the device ranges */
switch (dev->device) {
case PCI_DEVICE_ID_VIA_82C686:
/* The VT82C686 is special, it attaches to PCI and can have
any device number. All its subdevices are functions of
that single device. */
via_vlink_dev_lo = PCI_SLOT(dev->devfn);
via_vlink_dev_hi = PCI_SLOT(dev->devfn);
break;
case PCI_DEVICE_ID_VIA_8237:
case PCI_DEVICE_ID_VIA_8237A:
via_vlink_dev_lo = 15;
break;
case PCI_DEVICE_ID_VIA_8235:
via_vlink_dev_lo = 16;
break;
case PCI_DEVICE_ID_VIA_8231:
case PCI_DEVICE_ID_VIA_8233_0:
case PCI_DEVICE_ID_VIA_8233A:
case PCI_DEVICE_ID_VIA_8233C_0:
via_vlink_dev_lo = 17;
break;
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_0, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233A, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233C_0, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237A, quirk_via_bridge);
/**
* quirk_via_vlink - VIA VLink IRQ number update
* @dev: PCI device
*
* If the device we are dealing with is on a PIC IRQ we need to
* ensure that the IRQ line register which usually is not relevant
* for PCI cards, is actually written so that interrupts get sent
* to the right place.
* We only do this on systems where a VIA south bridge was detected,
* and only for VIA devices on the motherboard (see quirk_via_bridge
* above).
*/
static void quirk_via_vlink(struct pci_dev *dev)
{
u8 irq, new_irq;
/* Check if we have VLink at all */
if (via_vlink_dev_lo == -1)
return;
new_irq = dev->irq;
/* Don't quirk interrupts outside the legacy IRQ range */
if (!new_irq || new_irq > 15)
return;
/* Internal device ? */
if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) > via_vlink_dev_hi ||
PCI_SLOT(dev->devfn) < via_vlink_dev_lo)
return;
/* This is an internal VLink device on a PIC interrupt. The BIOS
ought to have set this but may not have, so we redo it */
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
if (new_irq != irq) {
dev_info(&dev->dev, "VIA VLink IRQ fixup, from %d to %d\n",
irq, new_irq);
udelay(15); /* unknown if delay really needed */
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
}
}
DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_vlink);
/*
* VIA VT82C598 has its device ID settable and many BIOSes
* set it to the ID of VT82C597 for backward compatibility.
* We need to switch it off to be able to recognize the real
* type of the chip.
*/
static void __devinit quirk_vt82c598_id(struct pci_dev *dev)
{
pci_write_config_byte(dev, 0xfc, 0);
pci_read_config_word(dev, PCI_DEVICE_ID, &dev->device);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id);
/*
* CardBus controllers have a legacy base address that enables them
* to respond as i82365 pcmcia controllers. We don't want them to
* do this even if the Linux CardBus driver is not loaded, because
* the Linux i82365 driver does not (and should not) handle CardBus.
*/
static void quirk_cardbus_legacy(struct pci_dev *dev)
{
if ((PCI_CLASS_BRIDGE_CARDBUS << 8) ^ dev->class)
return;
pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0);
}
DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
/*
* Following the PCI ordering rules is optional on the AMD762. I'm not
* sure what the designers were smoking but let's not inhale...
*
* To be fair to AMD, it follows the spec by default, its BIOS people
* who turn it off!
*/
static void quirk_amd_ordering(struct pci_dev *dev)
{
u32 pcic;
pci_read_config_dword(dev, 0x4C, &pcic);
if ((pcic&6)!=6) {
pcic |= 6;
dev_warn(&dev->dev, "BIOS failed to enable PCI standards compliance; fixing this error\n");
pci_write_config_dword(dev, 0x4C, pcic);
pci_read_config_dword(dev, 0x84, &pcic);
pcic |= (1<<23); /* Required in this mode */
pci_write_config_dword(dev, 0x84, pcic);
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering);
/*
* DreamWorks provided workaround for Dunord I-3000 problem
*
* This card decodes and responds to addresses not apparently
* assigned to it. We force a larger allocation to ensure that
* nothing gets put too close to it.
*/
static void __devinit quirk_dunord ( struct pci_dev * dev )
{
struct resource *r = &dev->resource [1];
r->start = 0;
r->end = 0xffffff;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DUNORD, PCI_DEVICE_ID_DUNORD_I3000, quirk_dunord);
/*
* i82380FB mobile docking controller: its PCI-to-PCI bridge
* is subtractive decoding (transparent), and does indicate this
* in the ProgIf. Unfortunately, the ProgIf value is wrong - 0x80
* instead of 0x01.
*/
static void __devinit quirk_transparent_bridge(struct pci_dev *dev)
{
dev->transparent = 1;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82380FB, quirk_transparent_bridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge);
/*
* Common misconfiguration of the MediaGX/Geode PCI master that will
* reduce PCI bandwidth from 70MB/s to 25MB/s. See the GXM/GXLV/GX1
* datasheets found at http://www.national.com/ds/GX for info on what
* these bits do. <christer@weinigel.se>
*/
static void quirk_mediagx_master(struct pci_dev *dev)
{
u8 reg;
pci_read_config_byte(dev, 0x41, ®);
if (reg & 2) {
reg &= ~2;
dev_info(&dev->dev, "Fixup for MediaGX/Geode Slave Disconnect Boundary (0x41=0x%02x)\n", reg);
pci_write_config_byte(dev, 0x41, reg);
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master);
/*
* Ensure C0 rev restreaming is off. This is normally done by
* the BIOS but in the odd case it is not the results are corruption
* hence the presence of a Linux check
*/
static void quirk_disable_pxb(struct pci_dev *pdev)
{
u16 config;
if (pdev->revision != 0x04) /* Only C0 requires this */
return;
pci_read_config_word(pdev, 0x40, &config);
if (config & (1<<6)) {
config &= ~(1<<6);
pci_write_config_word(pdev, 0x40, config);
dev_info(&pdev->dev, "C0 revision 450NX. Disabling PCI restreaming\n");
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev)
{
/* set SBX00/Hudson-2 SATA in IDE mode to AHCI mode */
u8 tmp;
pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp);
if (tmp == 0x01) {
pci_read_config_byte(pdev, 0x40, &tmp);
pci_write_config_byte(pdev, 0x40, tmp|1);
pci_write_config_byte(pdev, 0x9, 1);
pci_write_config_byte(pdev, 0xa, 6);
pci_write_config_byte(pdev, 0x40, tmp);
pdev->class = PCI_CLASS_STORAGE_SATA_AHCI;
dev_info(&pdev->dev, "set SATA to AHCI mode\n");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
/*
* Serverworks CSB5 IDE does not fully support native mode
*/
static void __devinit quirk_svwks_csb5ide(struct pci_dev *pdev)
{
u8 prog;
pci_read_config_byte(pdev, PCI_CLASS_PROG, &prog);
if (prog & 5) {
prog &= ~5;
pdev->class &= ~5;
pci_write_config_byte(pdev, PCI_CLASS_PROG, prog);
/* PCI layer will sort out resources */
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide);
/*
* Intel 82801CAM ICH3-M datasheet says IDE modes must be the same
*/
static void __init quirk_ide_samemode(struct pci_dev *pdev)
{
u8 prog;
pci_read_config_byte(pdev, PCI_CLASS_PROG, &prog);
if (((prog & 1) && !(prog & 4)) || ((prog & 4) && !(prog & 1))) {
dev_info(&pdev->dev, "IDE mode mismatch; forcing legacy mode\n");
prog &= ~5;
pdev->class &= ~5;
pci_write_config_byte(pdev, PCI_CLASS_PROG, prog);
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode);
/*
* Some ATA devices break if put into D3
*/
static void __devinit quirk_no_ata_d3(struct pci_dev *pdev)
{
/* Quirk the legacy ATA devices only. The AHCI ones are ok */
if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3);
/* ALi loses some register settings that we cannot then restore */
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, quirk_no_ata_d3);
/* VIA comes back fine but we need to keep it alive or ACPI GTM failures
occur when mode detecting */
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_no_ata_d3);
/* This was originally an Alpha specific thing, but it really fits here.
* The i82375 PCI/EISA bridge appears as non-classified. Fix that.
*/
static void __init quirk_eisa_bridge(struct pci_dev *dev)
{
dev->class = PCI_CLASS_BRIDGE_EISA << 8;
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_eisa_bridge);
/*
* On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
* is not activated. The myth is that Asus said that they do not want the
* users to be irritated by just another PCI Device in the Win98 device
* manager. (see the file prog/hotplug/README.p4b in the lm_sensors
* package 2.7.0 for details)
*
* The SMBus PCI Device can be activated by setting a bit in the ICH LPC
* bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
* becomes necessary to do this tweak in two steps -- the chosen trigger
* is either the Host bridge (preferred) or on-board VGA controller.
*
* Note that we used to unhide the SMBus that way on Toshiba laptops
* (Satellite A40 and Tecra M2) but then found that the thermal management
* was done by SMM code, which could cause unsynchronized concurrent
* accesses to the SMBus registers, with potentially bad effects. Thus you
* should be very careful when adding new entries: if SMM is accessing the
* Intel SMBus, this is a very good reason to leave it hidden.
*
* Likewise, many recent laptops use ACPI for thermal management. If the
* ACPI DSDT code accesses the SMBus, then Linux should not access it
* natively, and keeping the SMBus hidden is the right thing to do. If you
* are about to add an entry in the table below, please first disassemble
* the DSDT and double-check that there is no code accessing the SMBus.
*/
static int asus_hides_smbus;
static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
{
if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
switch(dev->subsystem_device) {
case 0x8025: /* P4B-LX */
case 0x8070: /* P4B */
case 0x8088: /* P4B533 */
case 0x1626: /* L3C notebook */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB)
switch(dev->subsystem_device) {
case 0x80b1: /* P4GE-V */
case 0x80b2: /* P4PE */
case 0x8093: /* P4B533-V */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB)
switch(dev->subsystem_device) {
case 0x8030: /* P4T533 */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_7205_0)
switch (dev->subsystem_device) {
case 0x8070: /* P4G8X Deluxe */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_E7501_MCH)
switch (dev->subsystem_device) {
case 0x80c9: /* PU-DLS */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
switch (dev->subsystem_device) {
case 0x1751: /* M2N notebook */
case 0x1821: /* M5N notebook */
case 0x1897: /* A6L notebook */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
switch (dev->subsystem_device) {
case 0x184b: /* W1N notebook */
case 0x186a: /* M6Ne notebook */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82865_HB)
switch (dev->subsystem_device) {
case 0x80f2: /* P4P800-X */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB)
switch (dev->subsystem_device) {
case 0x1882: /* M6V notebook */
case 0x1977: /* A6VA notebook */
asus_hides_smbus = 1;
}
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
switch(dev->subsystem_device) {
case 0x088C: /* HP Compaq nc8000 */
case 0x0890: /* HP Compaq nc6000 */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82865_HB)
switch (dev->subsystem_device) {
case 0x12bc: /* HP D330L */
case 0x12bd: /* HP D530 */
case 0x006a: /* HP Compaq nx9500 */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82875_HB)
switch (dev->subsystem_device) {
case 0x12bf: /* HP xw4100 */
asus_hides_smbus = 1;
}
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
switch(dev->subsystem_device) {
case 0xC00C: /* Samsung P35 notebook */
asus_hides_smbus = 1;
}
} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
switch(dev->subsystem_device) {
case 0x0058: /* Compaq Evo N620c */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3)
switch(dev->subsystem_device) {
case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */
/* Motherboard doesn't have Host bridge
* subvendor/subdevice IDs, therefore checking
* its on-board VGA controller */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2)
switch(dev->subsystem_device) {
case 0x00b8: /* Compaq Evo D510 CMT */
case 0x00b9: /* Compaq Evo D510 SFF */
case 0x00ba: /* Compaq Evo D510 USDT */
/* Motherboard doesn't have Host bridge
* subvendor/subdevice IDs and on-board VGA
* controller is disabled if an AGP card is
* inserted, therefore checking USB UHCI
* Controller #1 */
asus_hides_smbus = 1;
}
else if (dev->device == PCI_DEVICE_ID_INTEL_82815_CGC)
switch (dev->subsystem_device) {
case 0x001A: /* Compaq Deskpro EN SSF P667 815E */
/* Motherboard doesn't have host bridge
* subvendor/subdevice IDs, therefore checking
* its on-board VGA controller */
asus_hides_smbus = 1;
}
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845G_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82850_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82865_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82875_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_7205_0, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7501_MCH, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855PM_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810_IG3, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_2, asus_hides_smbus_hostbridge);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82815_CGC, asus_hides_smbus_hostbridge);
static void asus_hides_smbus_lpc(struct pci_dev *dev)
{
u16 val;
if (likely(!asus_hides_smbus))
return;
pci_read_config_word(dev, 0xF2, &val);
if (val & 0x8) {
pci_write_config_word(dev, 0xF2, val & (~0x8));
pci_read_config_word(dev, 0xF2, &val);
if (val & 0x8)
dev_info(&dev->dev, "i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val);
else
dev_info(&dev->dev, "Enabled i801 SMBus device\n");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc);
/* It appears we just have one such device. If not, we have a warning */
static void __iomem *asus_rcba_base;
static void asus_hides_smbus_lpc_ich6_suspend(struct pci_dev *dev)
{
u32 rcba;
if (likely(!asus_hides_smbus))
return;
WARN_ON(asus_rcba_base);
pci_read_config_dword(dev, 0xF0, &rcba);
/* use bits 31:14, 16 kB aligned */
asus_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000);
if (asus_rcba_base == NULL)
return;
}
static void asus_hides_smbus_lpc_ich6_resume_early(struct pci_dev *dev)
{
u32 val;
if (likely(!asus_hides_smbus || !asus_rcba_base))
return;
/* read the Function Disable register, dword mode only */
val = readl(asus_rcba_base + 0x3418);
writel(val & 0xFFFFFFF7, asus_rcba_base + 0x3418); /* enable the SMBus device */
}
static void asus_hides_smbus_lpc_ich6_resume(struct pci_dev *dev)
{
if (likely(!asus_hides_smbus || !asus_rcba_base))
return;
iounmap(asus_rcba_base);
asus_rcba_base = NULL;
dev_info(&dev->dev, "Enabled ICH6/i801 SMBus device\n");
}
static void asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
{
asus_hides_smbus_lpc_ich6_suspend(dev);
asus_hides_smbus_lpc_ich6_resume_early(dev);
asus_hides_smbus_lpc_ich6_resume(dev);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6);
DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6_suspend);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6_resume);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6_resume_early);
/*
* SiS 96x south bridge: BIOS typically hides SMBus device...
*/
static void quirk_sis_96x_smbus(struct pci_dev *dev)
{
u8 val = 0;
pci_read_config_byte(dev, 0x77, &val);
if (val & 0x10) {
dev_info(&dev->dev, "Enabling SiS 96x SMBus\n");
pci_write_config_byte(dev, 0x77, val & ~0x10);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_961, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_961, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus);
/*
* ... This is further complicated by the fact that some SiS96x south
* bridges pretend to be 85C503/5513 instead. In that case see if we
* spotted a compatible north bridge to make sure.
* (pci_find_device doesn't work yet)
*
* We can also enable the sis96x bit in the discovery register..
*/
#define SIS_DETECT_REGISTER 0x40
static void quirk_sis_503(struct pci_dev *dev)
{
u8 reg;
u16 devid;
pci_read_config_byte(dev, SIS_DETECT_REGISTER, ®);
pci_write_config_byte(dev, SIS_DETECT_REGISTER, reg | (1 << 6));
pci_read_config_word(dev, PCI_DEVICE_ID, &devid);
if (((devid & 0xfff0) != 0x0960) && (devid != 0x0018)) {
pci_write_config_byte(dev, SIS_DETECT_REGISTER, reg);
return;
}
/*
* Ok, it now shows up as a 96x.. run the 96x quirk by
* hand in case it has already been processed.
* (depends on link order, which is apparently not guaranteed)
*/
dev->device = devid;
quirk_sis_96x_smbus(dev);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503);
/*
* On ASUS A8V and A8V Deluxe boards, the onboard AC97 audio controller
* and MC97 modem controller are disabled when a second PCI soundcard is
* present. This patch, tweaking the VT8237 ISA bridge, enables them.
* -- bjd
*/
static void asus_hides_ac97_lpc(struct pci_dev *dev)
{
u8 val;
int asus_hides_ac97 = 0;
if (likely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
if (dev->device == PCI_DEVICE_ID_VIA_8237)
asus_hides_ac97 = 1;
}
if (!asus_hides_ac97)
return;
pci_read_config_byte(dev, 0x50, &val);
if (val & 0xc0) {
pci_write_config_byte(dev, 0x50, val & (~0xc0));
pci_read_config_byte(dev, 0x50, &val);
if (val & 0xc0)
dev_info(&dev->dev, "Onboard AC97/MC97 devices continue to play 'hide and seek'! 0x%x\n", val);
else
dev_info(&dev->dev, "Enabled onboard AC97/MC97 devices\n");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, asus_hides_ac97_lpc);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, asus_hides_ac97_lpc);
#if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE)
/*
* If we are using libata we can drive this chip properly but must
* do this early on to make the additional device appear during
* the PCI scanning.
*/
static void quirk_jmicron_ata(struct pci_dev *pdev)
{
u32 conf1, conf5, class;
u8 hdr;
/* Only poke fn 0 */
if (PCI_FUNC(pdev->devfn))
return;
pci_read_config_dword(pdev, 0x40, &conf1);
pci_read_config_dword(pdev, 0x80, &conf5);
conf1 &= ~0x00CFF302; /* Clear bit 1, 8, 9, 12-19, 22, 23 */
conf5 &= ~(1 << 24); /* Clear bit 24 */
switch (pdev->device) {
case PCI_DEVICE_ID_JMICRON_JMB360: /* SATA single port */
case PCI_DEVICE_ID_JMICRON_JMB362: /* SATA dual ports */
/* The controller should be in single function ahci mode */
conf1 |= 0x0002A100; /* Set 8, 13, 15, 17 */
break;
case PCI_DEVICE_ID_JMICRON_JMB365:
case PCI_DEVICE_ID_JMICRON_JMB366:
/* Redirect IDE second PATA port to the right spot */
conf5 |= (1 << 24);
/* Fall through */
case PCI_DEVICE_ID_JMICRON_JMB361:
case PCI_DEVICE_ID_JMICRON_JMB363:
/* Enable dual function mode, AHCI on fn 0, IDE fn1 */
/* Set the class codes correctly and then direct IDE 0 */
conf1 |= 0x00C2A1B3; /* Set 0, 1, 4, 5, 7, 8, 13, 15, 17, 22, 23 */
break;
case PCI_DEVICE_ID_JMICRON_JMB368:
/* The controller should be in single function IDE mode */
conf1 |= 0x00C00000; /* Set 22, 23 */
break;
}
pci_write_config_dword(pdev, 0x40, conf1);
pci_write_config_dword(pdev, 0x80, conf5);
/* Update pdev accordingly */
pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr);
pdev->hdr_type = hdr & 0x7f;
pdev->multifunction = !!(hdr & 0x80);
pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class);
pdev->class = class >> 8;
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB362, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, quirk_jmicron_ata);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, quirk_jmicron_ata);
#endif
#ifdef CONFIG_X86_IO_APIC
static void __init quirk_alder_ioapic(struct pci_dev *pdev)
{
int i;
if ((pdev->class >> 8) != 0xff00)
return;
/* the first BAR is the location of the IO APIC...we must
* not touch this (and it's already covered by the fixmap), so
* forcibly insert it into the resource tree */
if (pci_resource_start(pdev, 0) && pci_resource_len(pdev, 0))
insert_resource(&iomem_resource, &pdev->resource[0]);
/* The next five BARs all seem to be rubbish, so just clean
* them out */
for (i=1; i < 6; i++) {
memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);
#endif
static void __devinit quirk_pcie_mch(struct pci_dev *pdev)
{
pci_msi_off(pdev);
pdev->no_msi = 1;
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_pcie_mch);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_pcie_mch);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_pcie_mch);
/*
* It's possible for the MSI to get corrupted if shpc and acpi
* are used together on certain PXH-based systems.
*/
static void __devinit quirk_pcie_pxh(struct pci_dev *dev)
{
pci_msi_off(dev);
dev->no_msi = 1;
dev_warn(&dev->dev, "PXH quirk detected; SHPC device MSI disabled\n");
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHD_0, quirk_pcie_pxh);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHD_1, quirk_pcie_pxh);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_pcie_pxh);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_pcie_pxh);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pcie_pxh);
/*
* Some Intel PCI Express chipsets have trouble with downstream
* device power management.
*/
static void quirk_intel_pcie_pm(struct pci_dev * dev)
{
pci_pm_d3_delay = 120;
dev->no_d1d2 = 1;
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e2, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e3, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e4, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e5, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e6, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e7, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f7, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f8, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f9, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25fa, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2601, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2602, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2603, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2604, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2605, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2606, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2607, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2608, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2609, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm);
#ifdef CONFIG_X86_IO_APIC
/*
* Boot interrupts on some chipsets cannot be turned off. For these chipsets,
* remap the original interrupt in the linux kernel to the boot interrupt, so
* that a PCI device's interrupt handler is installed on the boot interrupt
* line instead.
*/
static void quirk_reroute_to_boot_interrupts_intel(struct pci_dev *dev)
{
if (noioapicquirk || noioapicreroute)
return;
dev->irq_reroute_variant = INTEL_IRQ_REROUTE_VARIANT;
dev_info(&dev->dev, "rerouting interrupts for [%04x:%04x]\n",
dev->vendor, dev->device);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80333_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80333_1, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80332_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80332_1, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80333_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80333_1, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80332_0, quirk_reroute_to_boot_interrupts_intel);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80332_1, quirk_reroute_to_boot_interrupts_intel);
/*
* On some chipsets we can disable the generation of legacy INTx boot
* interrupts.
*/
/*
* IO-APIC1 on 6300ESB generates boot interrupts, see intel order no
* 300641-004US, section 5.7.3.
*/
#define INTEL_6300_IOAPIC_ABAR 0x40
#define INTEL_6300_DISABLE_BOOT_IRQ (1<<14)
static void quirk_disable_intel_boot_interrupt(struct pci_dev *dev)
{
u16 pci_config_word;
if (noioapicquirk)
return;
pci_read_config_word(dev, INTEL_6300_IOAPIC_ABAR, &pci_config_word);
pci_config_word |= INTEL_6300_DISABLE_BOOT_IRQ;
pci_write_config_word(dev, INTEL_6300_IOAPIC_ABAR, pci_config_word);
dev_info(&dev->dev, "disabled boot interrupts on device [%04x:%04x]\n",
dev->vendor, dev->device);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, quirk_disable_intel_boot_interrupt);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_10, quirk_disable_intel_boot_interrupt);
/*
* disable boot interrupts on HT-1000
*/
#define BC_HT1000_FEATURE_REG 0x64
#define BC_HT1000_PIC_REGS_ENABLE (1<<0)
#define BC_HT1000_MAP_IDX 0xC00
#define BC_HT1000_MAP_DATA 0xC01
static void quirk_disable_broadcom_boot_interrupt(struct pci_dev *dev)
{
u32 pci_config_dword;
u8 irq;
if (noioapicquirk)
return;
pci_read_config_dword(dev, BC_HT1000_FEATURE_REG, &pci_config_dword);
pci_write_config_dword(dev, BC_HT1000_FEATURE_REG, pci_config_dword |
BC_HT1000_PIC_REGS_ENABLE);
for (irq = 0x10; irq < 0x10 + 32; irq++) {
outb(irq, BC_HT1000_MAP_IDX);
outb(0x00, BC_HT1000_MAP_DATA);
}
pci_write_config_dword(dev, BC_HT1000_FEATURE_REG, pci_config_dword);
dev_info(&dev->dev, "disabled boot interrupts on device [%04x:%04x]\n",
dev->vendor, dev->device);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000SB, quirk_disable_broadcom_boot_interrupt);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000SB, quirk_disable_broadcom_boot_interrupt);
/*
* disable boot interrupts on AMD and ATI chipsets
*/
/*
* NOIOAMODE needs to be disabled to disable "boot interrupts". For AMD 8131
* rev. A0 and B0, NOIOAMODE needs to be disabled anyway to fix IO-APIC mode
* (due to an erratum).
*/
#define AMD_813X_MISC 0x40
#define AMD_813X_NOIOAMODE (1<<0)
#define AMD_813X_REV_B2 0x13
static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev)
{
u32 pci_config_dword;
if (noioapicquirk)
return;
if (dev->revision == AMD_813X_REV_B2)
return;
pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword);
pci_config_dword &= ~AMD_813X_NOIOAMODE;
pci_write_config_dword(dev, AMD_813X_MISC, pci_config_dword);
dev_info(&dev->dev, "disabled boot interrupts on device [%04x:%04x]\n",
dev->vendor, dev->device);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_amd_813x_boot_interrupt);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE, quirk_disable_amd_813x_boot_interrupt);
#define AMD_8111_PCI_IRQ_ROUTING 0x56
static void quirk_disable_amd_8111_boot_interrupt(struct pci_dev *dev)
{
u16 pci_config_word;
if (noioapicquirk)
return;
pci_read_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, &pci_config_word);
if (!pci_config_word) {
dev_info(&dev->dev, "boot interrupts on device [%04x:%04x] "
"already disabled\n", dev->vendor, dev->device);
return;
}
pci_write_config_word(dev, AMD_8111_PCI_IRQ_ROUTING, 0);
dev_info(&dev->dev, "disabled boot interrupts on device [%04x:%04x]\n",
dev->vendor, dev->device);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS, quirk_disable_amd_8111_boot_interrupt);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS, quirk_disable_amd_8111_boot_interrupt);
#endif /* CONFIG_X86_IO_APIC */
/*
* Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size
* but the PIO transfers won't work if BAR0 falls at the odd 8 bytes.
* Re-allocate the region if needed...
*/
static void __init quirk_tc86c001_ide(struct pci_dev *dev)
{
struct resource *r = &dev->resource[0];
if (r->start & 0x8) {
r->start = 0;
r->end = 0xf;
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE,
quirk_tc86c001_ide);
static void __devinit quirk_netmos(struct pci_dev *dev)
{
unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4;
unsigned int num_serial = dev->subsystem_device & 0xf;
/*
* These Netmos parts are multiport serial devices with optional
* parallel ports. Even when parallel ports are present, they
* are identified as class SERIAL, which means the serial driver
* will claim them. To prevent this, mark them as class OTHER.
* These combo devices should be claimed by parport_serial.
*
* The subdevice ID is of the form 0x00PS, where <P> is the number
* of parallel ports and <S> is the number of serial ports.
*/
switch (dev->device) {
case PCI_DEVICE_ID_NETMOS_9835:
/* Well, this rule doesn't hold for the following 9835 device */
if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
dev->subsystem_device == 0x0299)
return;
case PCI_DEVICE_ID_NETMOS_9735:
case PCI_DEVICE_ID_NETMOS_9745:
case PCI_DEVICE_ID_NETMOS_9845:
case PCI_DEVICE_ID_NETMOS_9855:
if ((dev->class >> 8) == PCI_CLASS_COMMUNICATION_SERIAL &&
num_parallel) {
dev_info(&dev->dev, "Netmos %04x (%u parallel, "
"%u serial); changing class SERIAL to OTHER "
"(use parport_serial)\n",
dev->device, num_parallel, num_serial);
dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) |
(dev->class & 0xff);
}
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
{
u16 command, pmcsr;
u8 __iomem *csr;
u8 cmd_hi;
int pm;
switch (dev->device) {
/* PCI IDs taken from drivers/net/e100.c */
case 0x1029:
case 0x1030 ... 0x1034:
case 0x1038 ... 0x103E:
case 0x1050 ... 0x1057:
case 0x1059:
case 0x1064 ... 0x106B:
case 0x1091 ... 0x1095:
case 0x1209:
case 0x1229:
case 0x2449:
case 0x2459:
case 0x245D:
case 0x27DC:
break;
default:
return;
}
/*
* Some firmware hands off the e100 with interrupts enabled,
* which can cause a flood of interrupts if packets are
* received before the driver attaches to the device. So
* disable all e100 interrupts here. The driver will
* re-enable them when it's ready.
*/
pci_read_config_word(dev, PCI_COMMAND, &command);
if (!(command & PCI_COMMAND_MEMORY) || !pci_resource_start(dev, 0))
return;
/*
* Check that the device is in the D0 power state. If it's not,
* there is no point to look any further.
*/
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (pm) {
pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
return;
}
/* Convert from PCI bus to resource space. */
csr = ioremap(pci_resource_start(dev, 0), 8);
if (!csr) {
dev_warn(&dev->dev, "Can't map e100 registers\n");
return;
}
cmd_hi = readb(csr + 3);
if (cmd_hi == 0) {
dev_warn(&dev->dev, "Firmware left e100 interrupts enabled; "
"disabling\n");
writeb(1, csr + 3);
}
iounmap(csr);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
/*
* The 82575 and 82598 may experience data corruption issues when transitioning
* out of L0S. To prevent this we need to disable L0S on the pci-e link
*/
static void __devinit quirk_disable_aspm_l0s(struct pci_dev *dev)
{
dev_info(&dev->dev, "Disabling L0s\n");
pci_disable_link_state(dev, PCIE_LINK_STATE_L0S);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
{
/* rev 1 ncr53c810 chips don't set the class at all which means
* they don't get their resources remapped. Fix that here.
*/
if (dev->class == PCI_CLASS_NOT_DEFINED) {
dev_info(&dev->dev, "NCR 53c810 rev 1 detected; setting PCI class\n");
dev->class = PCI_CLASS_STORAGE_SCSI;
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
/* Enable 1k I/O space granularity on the Intel P64H2 */
static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev)
{
u16 en1k;
u8 io_base_lo, io_limit_lo;
unsigned long base, limit;
struct resource *res = dev->resource + PCI_BRIDGE_RESOURCES;
pci_read_config_word(dev, 0x40, &en1k);
if (en1k & 0x200) {
dev_info(&dev->dev, "Enable I/O Space to 1KB granularity\n");
pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo);
pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo);
base = (io_base_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8;
limit = (io_limit_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8;
if (base <= limit) {
res->start = base;
res->end = limit + 0x3ff;
}
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io);
/* Fix the IOBL_ADR for 1k I/O space granularity on the Intel P64H2
* The IOBL_ADR gets re-written to 4k boundaries in pci_setup_bridge()
* in drivers/pci/setup-bus.c
*/
static void __devinit quirk_p64h2_1k_io_fix_iobl(struct pci_dev *dev)
{
u16 en1k, iobl_adr, iobl_adr_1k;
struct resource *res = dev->resource + PCI_BRIDGE_RESOURCES;
pci_read_config_word(dev, 0x40, &en1k);
if (en1k & 0x200) {
pci_read_config_word(dev, PCI_IO_BASE, &iobl_adr);
iobl_adr_1k = iobl_adr | (res->start >> 8) | (res->end & 0xfc00);
if (iobl_adr != iobl_adr_1k) {
dev_info(&dev->dev, "Fixing P64H2 IOBL_ADR from 0x%x to 0x%x for 1KB granularity\n",
iobl_adr,iobl_adr_1k);
pci_write_config_word(dev, PCI_IO_BASE, iobl_adr_1k);
}
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io_fix_iobl);
/* Under some circumstances, AER is not linked with extended capabilities.
* Force it to be linked by setting the corresponding control bit in the
* config space.
*/
static void quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
{
uint8_t b;
if (pci_read_config_byte(dev, 0xf41, &b) == 0) {
if (!(b & 0x20)) {
pci_write_config_byte(dev, 0xf41, b | 0x20);
dev_info(&dev->dev,
"Linking AER extended capability\n");
}
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_pcie_aer_ext_cap);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_pcie_aer_ext_cap);
static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
{
/*
* Disable PCI Bus Parking and PCI Master read caching on CX700
* which causes unspecified timing errors with a VT6212L on the PCI
* bus leading to USB2.0 packet loss. The defaults are that these
* features are turned off but some BIOSes turn them on.
*/
uint8_t b;
if (pci_read_config_byte(dev, 0x76, &b) == 0) {
if (b & 0x40) {
/* Turn off PCI Bus Parking */
pci_write_config_byte(dev, 0x76, b ^ 0x40);
dev_info(&dev->dev,
"Disabling VIA CX700 PCI parking\n");
}
}
if (pci_read_config_byte(dev, 0x72, &b) == 0) {
if (b != 0) {
/* Turn off PCI Master read caching */
pci_write_config_byte(dev, 0x72, 0x0);
/* Set PCI Master Bus time-out to "1x16 PCLK" */
pci_write_config_byte(dev, 0x75, 0x1);
/* Disable "Read FIFO Timer" */
pci_write_config_byte(dev, 0x77, 0x0);
dev_info(&dev->dev,
"Disabling VIA CX700 PCI caching\n");
}
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching);
/*
* For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
* VPD end tag will hang the device. This problem was initially
* observed when a vpd entry was created in sysfs
* ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry
* will dump 32k of data. Reading a full 32k will cause an access
* beyond the VPD end tag causing the device to hang. Once the device
* is hung, the bnx2 driver will not be able to reset the device.
* We believe that it is legal to read beyond the end tag and
* therefore the solution is to limit the read/write length.
*/
static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
{
/*
* Only disable the VPD capability for 5706, 5706S, 5708,
* 5708S and 5709 rev. A
*/
if ((dev->device == PCI_DEVICE_ID_NX2_5706) ||
(dev->device == PCI_DEVICE_ID_NX2_5706S) ||
(dev->device == PCI_DEVICE_ID_NX2_5708) ||
(dev->device == PCI_DEVICE_ID_NX2_5708S) ||
((dev->device == PCI_DEVICE_ID_NX2_5709) &&
(dev->revision & 0xf0) == 0x0)) {
if (dev->vpd)
dev->vpd->len = 0x80;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5706,
quirk_brcm_570x_limit_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5706S,
quirk_brcm_570x_limit_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5708,
quirk_brcm_570x_limit_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5708S,
quirk_brcm_570x_limit_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5709,
quirk_brcm_570x_limit_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_NX2_5709S,
quirk_brcm_570x_limit_vpd);
/* Originally in EDAC sources for i82875P:
* Intel tells BIOS developers to hide device 6 which
* configures the overflow device access containing
* the DRBs - this is where we expose device 6.
* http://www.x86-secret.com/articles/tweak/pat/patsecrets-2.htm
*/
static void __devinit quirk_unhide_mch_dev6(struct pci_dev *dev)
{
u8 reg;
if (pci_read_config_byte(dev, 0xF4, ®) == 0 && !(reg & 0x02)) {
dev_info(&dev->dev, "Enabling MCH 'Overflow' Device\n");
pci_write_config_byte(dev, 0xF4, reg | 0x02);
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82865_HB,
quirk_unhide_mch_dev6);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82875_HB,
quirk_unhide_mch_dev6);
#ifdef CONFIG_PCI_MSI
/* Some chipsets do not support MSI. We cannot easily rely on setting
* PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
* some other busses controlled by the chipset even if Linux is not
* aware of it. Instead of setting the flag on all busses in the
* machine, simply disable MSI globally.
*/
static void __init quirk_disable_all_msi(struct pci_dev *dev)
{
pci_no_msi();
dev_warn(&dev->dev, "MSI quirk detected; MSI disabled\n");
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3336, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3364, quirk_disable_all_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8380_0, quirk_disable_all_msi);
/* Disable MSI on chipsets that are known to not support it */
static void __devinit quirk_disable_msi(struct pci_dev *dev)
{
if (dev->subordinate) {
dev_warn(&dev->dev, "MSI quirk detected; "
"subordinate MSI disabled\n");
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xa238, quirk_disable_msi);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x5a3f, quirk_disable_msi);
/* Go through the list of Hypertransport capabilities and
* return 1 if a HT MSI capability is found and enabled */
static int __devinit msi_ht_cap_enabled(struct pci_dev *dev)
{
int pos, ttl = 48;
pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
while (pos && ttl--) {
u8 flags;
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0)
{
dev_info(&dev->dev, "Found %s HT MSI Mapping\n",
flags & HT_MSI_FLAGS_ENABLE ?
"enabled" : "disabled");
return (flags & HT_MSI_FLAGS_ENABLE) != 0;
}
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
}
return 0;
}
/* Check the hypertransport MSI mapping to know whether MSI is enabled or not */
static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
{
if (dev->subordinate && !msi_ht_cap_enabled(dev)) {
dev_warn(&dev->dev, "MSI quirk detected; "
"subordinate MSI disabled\n");
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
}
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
quirk_msi_ht_cap);
/* The nVidia CK804 chipset may have 2 HT MSI mappings.
* MSI are supported if the MSI capability set in any of these mappings.
*/
static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
{
struct pci_dev *pdev;
if (!dev->subordinate)
return;
/* check HT MSI cap on this chipset and the root one.
* a single one having MSI is enough to be sure that MSI are supported.
*/
pdev = pci_get_slot(dev->bus, 0);
if (!pdev)
return;
if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
dev_warn(&dev->dev, "MSI quirk detected; "
"subordinate MSI disabled\n");
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
}
pci_dev_put(pdev);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);
/* Force enable MSI mapping capability on HT bridges */
static void __devinit ht_enable_msi_mapping(struct pci_dev *dev)
{
int pos, ttl = 48;
pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
while (pos && ttl--) {
u8 flags;
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0) {
dev_info(&dev->dev, "Enabling HT MSI Mapping\n");
pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
flags | HT_MSI_FLAGS_ENABLE);
}
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
ht_enable_msi_mapping);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
ht_enable_msi_mapping);
/* The P5N32-SLI motherboards from Asus have a problem with msi
* for the MCP55 NIC. It is not yet determined whether the msi problem
* also affects other devices. As for now, turn off msi for this device.
*/
static void __devinit nvenet_msi_disable(struct pci_dev *dev)
{
if (dmi_name_in_vendors("P5N32-SLI PREMIUM") ||
dmi_name_in_vendors("P5N32-E SLI")) {
dev_info(&dev->dev,
"Disabling msi for MCP55 NIC on P5N32-SLI\n");
dev->no_msi = 1;
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
PCI_DEVICE_ID_NVIDIA_NVENET_15,
nvenet_msi_disable);
static int __devinit ht_check_msi_mapping(struct pci_dev *dev)
{
int pos, ttl = 48;
int found = 0;
/* check if there is HT MSI cap or enabled on this device */
pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
while (pos && ttl--) {
u8 flags;
if (found < 1)
found = 1;
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0) {
if (flags & HT_MSI_FLAGS_ENABLE) {
if (found < 2) {
found = 2;
break;
}
}
}
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
}
return found;
}
static int __devinit host_bridge_with_leaf(struct pci_dev *host_bridge)
{
struct pci_dev *dev;
int pos;
int i, dev_no;
int found = 0;
dev_no = host_bridge->devfn >> 3;
for (i = dev_no + 1; i < 0x20; i++) {
dev = pci_get_slot(host_bridge->bus, PCI_DEVFN(i, 0));
if (!dev)
continue;
/* found next host bridge ?*/
pos = pci_find_ht_capability(dev, HT_CAPTYPE_SLAVE);
if (pos != 0) {
pci_dev_put(dev);
break;
}
if (ht_check_msi_mapping(dev)) {
found = 1;
pci_dev_put(dev);
break;
}
pci_dev_put(dev);
}
return found;
}
#define PCI_HT_CAP_SLAVE_CTRL0 4 /* link control */
#define PCI_HT_CAP_SLAVE_CTRL1 8 /* link control to */
static int __devinit is_end_of_ht_chain(struct pci_dev *dev)
{
int pos, ctrl_off;
int end = 0;
u16 flags, ctrl;
pos = pci_find_ht_capability(dev, HT_CAPTYPE_SLAVE);
if (!pos)
goto out;
pci_read_config_word(dev, pos + PCI_CAP_FLAGS, &flags);
ctrl_off = ((flags >> 10) & 1) ?
PCI_HT_CAP_SLAVE_CTRL0 : PCI_HT_CAP_SLAVE_CTRL1;
pci_read_config_word(dev, pos + ctrl_off, &ctrl);
if (ctrl & (1 << 6))
end = 1;
out:
return end;
}
static void __devinit nv_ht_enable_msi_mapping(struct pci_dev *dev)
{
struct pci_dev *host_bridge;
int pos;
int i, dev_no;
int found = 0;
dev_no = dev->devfn >> 3;
for (i = dev_no; i >= 0; i--) {
host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0));
if (!host_bridge)
continue;
pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
if (pos != 0) {
found = 1;
break;
}
pci_dev_put(host_bridge);
}
if (!found)
return;
/* don't enable end_device/host_bridge with leaf directly here */
if (host_bridge == dev && is_end_of_ht_chain(host_bridge) &&
host_bridge_with_leaf(host_bridge))
goto out;
/* root did that ! */
if (msi_ht_cap_enabled(host_bridge))
goto out;
ht_enable_msi_mapping(dev);
out:
pci_dev_put(host_bridge);
}
static void __devinit ht_disable_msi_mapping(struct pci_dev *dev)
{
int pos, ttl = 48;
pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
while (pos && ttl--) {
u8 flags;
if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
&flags) == 0) {
dev_info(&dev->dev, "Disabling HT MSI Mapping\n");
pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
flags & ~HT_MSI_FLAGS_ENABLE);
}
pos = pci_find_next_ht_capability(dev, pos,
HT_CAPTYPE_MSI_MAPPING);
}
}
static void __devinit __nv_msi_ht_cap_quirk(struct pci_dev *dev, int all)
{
struct pci_dev *host_bridge;
int pos;
int found;
if (!pci_msi_enabled())
return;
/* check if there is HT MSI cap or enabled on this device */
found = ht_check_msi_mapping(dev);
/* no HT MSI CAP */
if (found == 0)
return;
/*
* HT MSI mapping should be disabled on devices that are below
* a non-Hypertransport host bridge. Locate the host bridge...
*/
host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
if (host_bridge == NULL) {
dev_warn(&dev->dev,
"nv_msi_ht_cap_quirk didn't locate host bridge\n");
return;
}
pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
if (pos != 0) {
/* Host bridge is to HT */
if (found == 1) {
/* it is not enabled, try to enable it */
if (all)
ht_enable_msi_mapping(dev);
else
nv_ht_enable_msi_mapping(dev);
}
return;
}
/* HT MSI is not enabled */
if (found == 1)
return;
/* Host bridge is not to HT, disable HT MSI mapping on this device */
ht_disable_msi_mapping(dev);
}
static void __devinit nv_msi_ht_cap_quirk_all(struct pci_dev *dev)
{
return __nv_msi_ht_cap_quirk(dev, 1);
}
static void __devinit nv_msi_ht_cap_quirk_leaf(struct pci_dev *dev)
{
return __nv_msi_ht_cap_quirk(dev, 0);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk_leaf);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk_leaf);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk_all);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk_all);
static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
{
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
}
static void __devinit quirk_msi_intx_disable_ati_bug(struct pci_dev *dev)
{
struct pci_dev *p;
/* SB700 MSI issue will be fixed at HW level from revision A21,
* we need check PCI REVISION ID of SMBus controller to get SB700
* revision.
*/
p = pci_get_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
NULL);
if (!p)
return;
if ((p->revision < 0x3B) && (p->revision >= 0x30))
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
pci_dev_put(p);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5780,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5780S,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5714,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5714S,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5715,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
PCI_DEVICE_ID_TIGON3_5715S,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4390,
quirk_msi_intx_disable_ati_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4391,
quirk_msi_intx_disable_ati_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4392,
quirk_msi_intx_disable_ati_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4393,
quirk_msi_intx_disable_ati_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4394,
quirk_msi_intx_disable_ati_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4373,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4374,
quirk_msi_intx_disable_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,
quirk_msi_intx_disable_bug);
#endif /* CONFIG_PCI_MSI */
#ifdef CONFIG_PCI_IOV
/*
* For Intel 82576 SR-IOV NIC, if BIOS doesn't allocate resources for the
* SR-IOV BARs, zero the Flash BAR and program the SR-IOV BARs to use the
* old Flash Memory Space.
*/
static void __devinit quirk_i82576_sriov(struct pci_dev *dev)
{
int pos, flags;
u32 bar, start, size;
if (PAGE_SIZE > 0x10000)
return;
flags = pci_resource_flags(dev, 0);
if ((flags & PCI_BASE_ADDRESS_SPACE) !=
PCI_BASE_ADDRESS_SPACE_MEMORY ||
(flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) !=
PCI_BASE_ADDRESS_MEM_TYPE_32)
return;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
if (!pos)
return;
pci_read_config_dword(dev, pos + PCI_SRIOV_BAR, &bar);
if (bar & PCI_BASE_ADDRESS_MEM_MASK)
return;
start = pci_resource_start(dev, 1);
size = pci_resource_len(dev, 1);
if (!start || size != 0x400000 || start & (size - 1))
return;
pci_resource_flags(dev, 1) = 0;
pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
pci_write_config_dword(dev, pos + PCI_SRIOV_BAR, start);
pci_write_config_dword(dev, pos + PCI_SRIOV_BAR + 12, start + size / 2);
dev_info(&dev->dev, "use Flash Memory Space for SR-IOV BARs\n");
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c9, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e6, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e8, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150a, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150d, quirk_i82576_sriov);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1518, quirk_i82576_sriov);
#endif /* CONFIG_PCI_IOV */
#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
struct pci_fixup *end)
{
while (f < end) {
if ((f->vendor == dev->vendor || f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device || f->device == (u16) PCI_ANY_ID)) {
dev_dbg(&dev->dev, "calling %pF\n", f->hook);
f->hook(dev);
}
f++;
}
}
extern struct pci_fixup __start_pci_fixups_early[];
extern struct pci_fixup __end_pci_fixups_early[];
extern struct pci_fixup __start_pci_fixups_header[];
extern struct pci_fixup __end_pci_fixups_header[];
extern struct pci_fixup __start_pci_fixups_final[];
extern struct pci_fixup __end_pci_fixups_final[];
extern struct pci_fixup __start_pci_fixups_enable[];
extern struct pci_fixup __end_pci_fixups_enable[];
extern struct pci_fixup __start_pci_fixups_resume[];
extern struct pci_fixup __end_pci_fixups_resume[];
extern struct pci_fixup __start_pci_fixups_resume_early[];
extern struct pci_fixup __end_pci_fixups_resume_early[];
extern struct pci_fixup __start_pci_fixups_suspend[];
extern struct pci_fixup __end_pci_fixups_suspend[];
#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
#define VTUNCERRMSK_REG 0x1ac
#define VTD_MSK_SPEC_ERRORS (1 << 31)
/*
* This is a quirk for masking vt-d spec defined errors to platform error
* handling logic. With out this, platforms using Intel 7500, 5500 chipsets
* (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based
* on the RAS config settings of the platform) when a vt-d fault happens.
* The resulting SMI caused the system to hang.
*
* VT-d spec related errors are already handled by the VT-d OS code, so no
* need to report the same error through other channels.
*/
static void vtd_mask_spec_errors(struct pci_dev *dev)
{
u32 word;
pci_read_config_dword(dev, VTUNCERRMSK_REG, &word);
pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, vtd_mask_spec_errors);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
#endif
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
{
struct pci_fixup *start, *end;
switch(pass) {
case pci_fixup_early:
start = __start_pci_fixups_early;
end = __end_pci_fixups_early;
break;
case pci_fixup_header:
start = __start_pci_fixups_header;
end = __end_pci_fixups_header;
break;
case pci_fixup_final:
start = __start_pci_fixups_final;
end = __end_pci_fixups_final;
break;
case pci_fixup_enable:
start = __start_pci_fixups_enable;
end = __end_pci_fixups_enable;
break;
case pci_fixup_resume:
start = __start_pci_fixups_resume;
end = __end_pci_fixups_resume;
break;
case pci_fixup_resume_early:
start = __start_pci_fixups_resume_early;
end = __end_pci_fixups_resume_early;
break;
case pci_fixup_suspend:
start = __start_pci_fixups_suspend;
end = __end_pci_fixups_suspend;
break;
default:
/* stupid compiler warning, you would think with an enum... */
return;
}
pci_do_fixups(dev, start, end);
}
static int __init pci_apply_final_quirks(void)
{
struct pci_dev *dev = NULL;
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
pci_fixup_device(pci_fixup_final, dev);
}
return 0;
}
fs_initcall_sync(pci_apply_final_quirks);
#else
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
#endif
EXPORT_SYMBOL(pci_fixup_device);
| uwehermann/easybox-904-lte-firmware | linux/linux-2.6.32.32/drivers/pci/quirks.c | C | gpl-2.0 | 94,163 |
<?php include("./lib/template/mini_calendrier.php"); ?>
<div id="lecorps">
<?php include("./lib/template/menu_edt.php"); ?>
<div id="art-main">
<div class="art-sheet">
<div class="art-sheet-tl"></div>
<div class="art-sheet-tr"></div>
<div class="art-sheet-bl"></div>
<div class="art-sheet-br"></div>
<div class="art-sheet-tc"></div>
<div class="art-sheet-bc"></div>
<div class="art-sheet-cl"></div>
<div class="art-sheet-cr"></div>
<div class="art-sheet-cc"></div>
<div class="art-sheet-body">
<div class="art-nav">
<div class="l"></div>
<div class="r"></div>
<?php include("menu_top.php"); ?>
</div>
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content">
<div class="art-post">
<div class="art-post-tl"></div>
<div class="art-post-tr"></div>
<div class="art-post-bl"></div>
<div class="art-post-br"></div>
<div class="art-post-tc"></div>
<div class="art-post-bc"></div>
<div class="art-post-cl"></div>
<div class="art-post-cr"></div>
<div class="art-post-cc"></div>
<div class="art-post-body">
<div class="art-post-inner art-article">
<div class="art-postmetadataheader">
<h2 class="art-postheader">
Future interface of module EDT
</h2>
</div>
<div class="art-postcontent">
<!-- article-content -->
<p> This part of the software is under development. It is the new interface of module EDT, resulting of a complete refactorisation of the module. The objective is to pass all the module into object MVC.</p>
<div class="cleared"></div>
<!-- /article-content -->
</div>
<div class="cleared"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include("footer.php"); ?>
</div>
</div> | pollux1er/SajoscolApp | edt_organisation/lib/template/indexSuccess.php | PHP | gpl-2.0 | 2,906 |
<?php
/**
*
* @category modules
* @package news
* @author WebsiteBaker Project
* @copyright 2004-2009, Ryan Djurovich
* @copyright 2009-2011, Website Baker Org. e.V.
* @link http://www.websitebaker2.org/
* @license http://www.gnu.org/licenses/gpl.html
* @platform WebsiteBaker 2.8.x
* @requirements PHP 5.2.2 and higher
* @version $Id$
* @filesource $HeadURL$
* @lastmodified $Date$
*
*/
//Modul Description
$module_description = 'Den här sidtypen är designad för att skapa en nyhetssida.';
//Variables for the backend
$MOD_NEWS['SETTINGS'] = 'Inställningar';
//Variables for the frontend
$MOD_NEWS['TEXT_READ_MORE'] = 'Läs mer';
$MOD_NEWS['TEXT_POSTED_BY'] = 'Postat av';
$MOD_NEWS['TEXT_ON'] = 'den';
$MOD_NEWS['TEXT_LAST_CHANGED'] = 'Senaste ändring';
$MOD_NEWS['TEXT_AT'] = 'kl.';
$MOD_NEWS['TEXT_BACK'] = 'Tillbaka';
$MOD_NEWS['TEXT_COMMENTS'] = 'Kommentarer';
$MOD_NEWS['TEXT_COMMENT'] = 'kommentar';
$MOD_NEWS['TEXT_ADD_COMMENT'] = 'Kommentera';
$MOD_NEWS['TEXT_BY'] = 'Av';
$MOD_NEWS['PAGE_NOT_FOUND'] = 'Sidan kunde inte hittas';
$MOD_NEWS['NO_COMMENT_FOUND'] = 'No comment found';
$TEXT['UNKNOWN'] = 'Guest';
?> | marmotwb/2.8.x | wb/modules/news/languages/SE.php | PHP | gpl-2.0 | 1,238 |
/*
* drivers/media/video/omap/gfx_tiler.c
*
* Copyright (C) 2010 Texas Instruments.
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include "v4gfx.h"
#include "gfx_bc.h"
#ifdef CONFIG_TILER_OMAP
#include <mach/tiler.h>
#define TILER_ALLOCATE_V4L2
#endif
void v4gfx_tiler_buffer_free(struct v4gfx_device *vout, unsigned int count,
unsigned int startindex)
{
#ifdef CONFIG_TILER_OMAP
int i;
if (startindex < 0)
startindex = 0;
if (startindex + count > VIDEO_MAX_FRAME)
count = VIDEO_MAX_FRAME - startindex;
for (i = startindex; i < startindex + count; i++) {
if (vout->buf_phy_addr_alloced[i])
tiler_free(vout->buf_phy_addr_alloced[i]);
if (vout->buf_phy_uv_addr_alloced[i])
tiler_free(vout->buf_phy_uv_addr_alloced[i]);
vout->buf_phy_addr[i] = 0;
vout->buf_phy_addr_alloced[i] = 0;
vout->buf_phy_uv_addr[i] = 0;
vout->buf_phy_uv_addr_alloced[i] = 0;
}
#endif
}
/* Allocate the buffers for TILER space. Ideally, the buffers will be ONLY
in tiler space, with different rotated views available by just a convert.
*/
int v4gfx_tiler_buffer_setup(struct v4gfx_device *vout,
unsigned int *count, unsigned int startindex,
struct v4l2_pix_format *pix)
{
#ifdef CONFIG_TILER_OMAP
/* startindex is always passed as 0, possibly tidy up? */
int i, aligned = 1, bpp;
enum tiler_fmt fmt;
int rv = 0;
/* normalize buffers to allocate so we stay within bounds */
int start = (startindex < 0) ? 0 : startindex;
int n_alloc = (start + *count > VIDEO_MAX_FRAME) ?
VIDEO_MAX_FRAME - start : *count;
GFXLOG(1, V4L2DEV(vout), "+%s\n", __func__);
bpp = v4gfx_try_format(pix);
if (bpp <= 0) {
rv = bpp; /* error condition */
goto end;
}
GFXLOG(1, V4L2DEV(vout), "tiler buffer alloc: "
"count = %d, start = %d :\n", *count, startindex);
/* special allocation scheme for NV12 format */
if (V4L2_PIX_FMT_NV12 == pix->pixelformat) {
tiler_alloc_packed_nv12(&n_alloc, ALIGN(pix->width, 128),
pix->height,
(void **) vout->buf_phy_addr + start,
(void **) vout->buf_phy_uv_addr + start,
(void **) vout->buf_phy_addr_alloced + start,
(void **) vout->buf_phy_uv_addr_alloced + start,
aligned);
} else {
/* Only bpp of 1, 2, and 4 is supported by tiler */
fmt = (bpp == 1 ? TILFMT_8BIT :
bpp == 2 ? TILFMT_16BIT :
bpp == 4 ? TILFMT_32BIT : TILFMT_INVALID);
if (fmt == TILFMT_INVALID) {
rv = -ENOMEM;
goto end;
}
tiler_alloc_packed(&n_alloc, fmt, ALIGN(pix->width, 128 / bpp),
pix->height,
(void **) vout->buf_phy_addr + start,
(void **) vout->buf_phy_addr_alloced + start,
aligned);
}
GFXLOG(1, V4L2DEV(vout),
"allocated %d buffers\n", n_alloc);
if (n_alloc < *count) {
if (n_alloc && (startindex == -1 ||
V4L2_MEMORY_MMAP != vout->memory)) {
/* TODO: check this condition's logic */
v4gfx_tiler_buffer_free(vout, n_alloc, start);
*count = 0;
rv = -ENOMEM;
goto end;
}
}
for (i = start; i < start + n_alloc; i++) {
GFXLOG(1, V4L2DEV(vout),
"y=%08lx (%d) uv=%08lx (%d)\n",
vout->buf_phy_addr[i],
vout->buf_phy_addr_alloced[i] ? 1 : 0,
vout->buf_phy_uv_addr[i],
vout->buf_phy_uv_addr_alloced[i] ? 1 : 0);
}
*count = n_alloc;
end:
GFXLOG(1, V4L2DEV(vout), "-%s [%d]\n", __func__, rv);
return rv;
#else
return 0;
#endif
}
void v4gfx_tiler_image_incr(struct v4gfx_device *vout, int *cpu_pgwidth,
int *tiler_increment)
{
#ifdef CONFIG_TILER_OMAP
/* for NV12, Y buffer is 1bpp*/
if (V4L2_PIX_FMT_NV12 == vout->pix.pixelformat) {
*cpu_pgwidth =
(vout->pix.width + TILER_PAGE - 1) & ~(TILER_PAGE - 1);
*tiler_increment = 64 * TILER_WIDTH;
} else {
*cpu_pgwidth = (vout->pix.width * vout->bpp + TILER_PAGE - 1) &
~(TILER_PAGE - 1);
if (vout->bpp > 1)
*tiler_increment = 2 * 64 * TILER_WIDTH;
else
*tiler_increment = 64 * TILER_WIDTH;
}
#endif
}
void v4gfx_tiler_image_incr_uv(struct v4gfx_device *vout, int *tiler_increment)
{
#ifdef CONFIG_TILER_OMAP
if (vout->pix.pixelformat == V4L2_PIX_FMT_NV12)
*tiler_increment = 2 * 64 * TILER_WIDTH;
/* Otherwise do nothing */
#endif
}
| michaellass/lenovo_a1_07_kernel | drivers/media/video/omapgfx/gfx_tiler.c | C | gpl-2.0 | 4,322 |
package STEDT::Table::Mesoroots;
use base STEDT::Table;
use strict;
sub new {
my ($self, $dbh, $privs, $uid) = @_;
my $t = $self->SUPER::new($dbh, 'mesoroots', 'mesoroots.id', $privs); # dbh, table, key, privs
$t->query_from(q|mesoroots LEFT JOIN `users` ON mesoroots.uid = users.uid LEFT JOIN languagegroups ON mesoroots.grpid=languagegroups.grpid|);
$t->default_where('');
$t->order_by('mesoroots.tag');
$t->fields('mesoroots.id',
'mesoroots.tag',
'mesoroots.form',
'mesoroots.gloss',
'mesoroots.grpid',
'languagegroups.plg',
'languagegroups.grpno',
'mesoroots.old_tag',
'mesoroots.old_note',
'mesoroots.variant',
'users.username',
);
$t->field_visible_privs(
'users.username' => 1,
);
$t->searchable('mesoroots.id',
'mesoroots.tag',
'mesoroots.form',
'mesoroots.gloss',
'mesoroots.grpid',
'mesoroots.uid',
);
$t->field_editable_privs(
# none are editable: can edit them using the etymon view or (if admin) single-record view
);
# Stuff for searching
$t->search_form_items(
'mesoroots.grpid' => sub {
my $cgi = shift;
my $a = $dbh->selectall_arrayref("SELECT CONCAT(grpno, ' - ', plg), grpid FROM languagegroups WHERE plg != '' ORDER BY grp0,grp1,grp2,grp3,grp4");
unshift @$a, ['', ''];
push @$a, ['(undefined)', 0];
my @ids = map {$_->[1]} @$a;
my %labels;
@labels{@ids} = map {$_->[0]} @$a;
return $cgi->popup_menu(-name => 'mesoroots.grpid', -values=>[@ids],
-default=>'',
-labels=>\%labels);
},
'mesoroots.uid' => sub {
my $cgi = shift;
# get list of users who own mesoroots
my $users = $dbh->selectall_arrayref("SELECT DISTINCT uid, username FROM mesoroots LEFT JOIN users USING (uid) ORDER BY uid");
my @uids = map {$_->[0]} @$users;
my %usernames;
@usernames{@uids} = map {$_->[1] . ' (id:' . $_->[0] . ')'} @$users;
return $cgi->popup_menu(-name => 'mesoroots.uid', -values=>['', @uids],
-labels=>\%usernames,
-default=>'');
},
);
$t->wheres(
'mesoroots.tag' => sub {my ($k,$v) = @_;
return STEDT::Table::where_int($k,$v);
},
'mesoroots.grpid' => 'int',
'mesoroots.gloss' => 'word',
'mesoroots.uid' => 'int',
);
$t->save_hooks(
);
$t->reload_on_save(
'mesoroots.grpid'
);
#$t->allow_delete(1);
#$t->debug(1);
$t->search_limit(200);
return $t;
}
1;
| dwbruhn/stedt | rootcanal/perl/STEDT/Table/Mesoroots.pm | Perl | gpl-2.0 | 2,261 |
/**
* @file
* Provides Ajax page updating via jQuery $.ajax.
*
* Ajax is a method of making a request via JavaScript while viewing an HTML
* page. The request returns an array of commands encoded in JSON, which is
* then executed to make any changes that are necessary to the page.
*
* Drupal uses this file to enhance form elements with `#ajax['url']` and
* `#ajax['wrapper']` properties. If set, this file will automatically be
* included to provide Ajax capabilities.
*/
(function ($, window, Drupal, drupalSettings) {
'use strict';
/**
* Attaches the Ajax behavior to each Ajax form element.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Initialize all {@link Drupal.Ajax} objects declared in
* `drupalSettings.ajax` or initialize {@link Drupal.Ajax} objects from
* DOM elements having the `use-ajax-submit` or `use-ajax` css class.
* @prop {Drupal~behaviorDetach} detach
* During `unload` remove all {@link Drupal.Ajax} objects related to
* the removed content.
*/
Drupal.behaviors.AJAX = {
attach: function (context, settings) {
function loadAjaxBehavior(base) {
var element_settings = settings.ajax[base];
if (typeof element_settings.selector === 'undefined') {
element_settings.selector = '#' + base;
}
$(element_settings.selector).once('drupal-ajax').each(function () {
element_settings.element = this;
element_settings.base = base;
Drupal.ajax(element_settings);
});
}
// Load all Ajax behaviors specified in the settings.
for (var base in settings.ajax) {
if (settings.ajax.hasOwnProperty(base)) {
loadAjaxBehavior(base);
}
}
// Bind Ajax behaviors to all items showing the class.
$('.use-ajax').once('ajax').each(function () {
var element_settings = {};
// Clicked links look better with the throbber than the progress bar.
element_settings.progress = {type: 'throbber'};
// For anchor tags, these will go to the target of the anchor rather
// than the usual location.
var href = $(this).attr('href');
if (href) {
element_settings.url = href;
element_settings.event = 'click';
}
element_settings.dialogType = $(this).data('dialog-type');
element_settings.dialog = $(this).data('dialog-options');
element_settings.base = $(this).attr('id');
element_settings.element = this;
Drupal.ajax(element_settings);
});
// This class means to submit the form to the action using Ajax.
$('.use-ajax-submit').once('ajax').each(function () {
var element_settings = {};
// Ajax submits specified in this manner automatically submit to the
// normal form action.
element_settings.url = $(this.form).attr('action');
// Form submit button clicks need to tell the form what was clicked so
// it gets passed in the POST request.
element_settings.setClick = true;
// Form buttons use the 'click' event rather than mousedown.
element_settings.event = 'click';
// Clicked form buttons look better with the throbber than the progress
// bar.
element_settings.progress = {type: 'throbber'};
element_settings.base = $(this).attr('id');
element_settings.element = this;
Drupal.ajax(element_settings);
});
},
detach: function (context, settings, trigger) {
if (trigger === 'unload') {
Drupal.ajax.expired().forEach(function (instance) {
// Set this to null and allow garbage collection to reclaim
// the memory.
Drupal.ajax.instances[instance.instanceIndex] = null;
});
}
}
};
/**
* Extends Error to provide handling for Errors in Ajax.
*
* @constructor
*
* @augments Error
*
* @param {XMLHttpRequest} xmlhttp
* XMLHttpRequest object used for the failed request.
* @param {string} uri
* The URI where the error occurred.
* @param {string} customMessage
* The custom message.
*/
Drupal.AjaxError = function (xmlhttp, uri, customMessage) {
var statusCode;
var statusText;
var pathText;
var responseText;
var readyStateText;
if (xmlhttp.status) {
statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', {'!status': xmlhttp.status});
}
else {
statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.');
}
statusCode += '\n' + Drupal.t('Debugging information follows.');
pathText = '\n' + Drupal.t('Path: !uri', {'!uri': uri});
statusText = '';
// In some cases, when statusCode === 0, xmlhttp.statusText may not be
// defined. Unfortunately, testing for it with typeof, etc, doesn't seem to
// catch that and the test causes an exception. So we need to catch the
// exception here.
try {
statusText = '\n' + Drupal.t('StatusText: !statusText', {'!statusText': $.trim(xmlhttp.statusText)});
}
catch (e) {
// Empty.
}
responseText = '';
// Again, we don't have a way to know for sure whether accessing
// xmlhttp.responseText is going to throw an exception. So we'll catch it.
try {
responseText = '\n' + Drupal.t('ResponseText: !responseText', {'!responseText': $.trim(xmlhttp.responseText)});
}
catch (e) {
// Empty.
}
// Make the responseText more readable by stripping HTML tags and newlines.
responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi, '');
responseText = responseText.replace(/[\n]+\s+/g, '\n');
// We don't need readyState except for status == 0.
readyStateText = xmlhttp.status === 0 ? ('\n' + Drupal.t('ReadyState: !readyState', {'!readyState': xmlhttp.readyState})) : '';
customMessage = customMessage ? ('\n' + Drupal.t('CustomMessage: !customMessage', {'!customMessage': customMessage})) : '';
/**
* Formatted and translated error message.
*
* @type {string}
*/
this.message = statusCode + pathText + statusText + customMessage + responseText + readyStateText;
/**
* Used by some browsers to display a more accurate stack trace.
*
* @type {string}
*/
this.name = 'AjaxError';
};
Drupal.AjaxError.prototype = new Error();
Drupal.AjaxError.prototype.constructor = Drupal.AjaxError;
/**
* Provides Ajax page updating via jQuery $.ajax.
*
* This function is designed to improve developer experience by wrapping the
* initialization of {@link Drupal.Ajax} objects and storing all created
* objects in the {@link Drupal.ajax.instances} array.
*
* @example
* Drupal.behaviors.myCustomAJAXStuff = {
* attach: function (context, settings) {
*
* var ajaxSettings = {
* url: 'my/url/path',
* // If the old version of Drupal.ajax() needs to be used those
* // properties can be added
* base: 'myBase',
* element: $(context).find('.someElement')
* };
*
* var myAjaxObject = Drupal.ajax(ajaxSettings);
*
* // Declare a new Ajax command specifically for this Ajax object.
* myAjaxObject.commands.insert = function (ajax, response, status) {
* $('#my-wrapper').append(response.data);
* alert('New content was appended to #my-wrapper');
* };
*
* // This command will remove this Ajax object from the page.
* myAjaxObject.commands.destroyObject = function (ajax, response, status) {
* Drupal.ajax.instances[this.instanceIndex] = null;
* };
*
* // Programmatically trigger the Ajax request.
* myAjaxObject.execute();
* }
* };
*
* @param {object} settings
* The settings object passed to {@link Drupal.Ajax} constructor.
* @param {string} [settings.base]
* Base is passed to {@link Drupal.Ajax} constructor as the 'base'
* parameter.
* @param {HTMLElement} [settings.element]
* Element parameter of {@link Drupal.Ajax} constructor, element on which
* event listeners will be bound.
*
* @return {Drupal.Ajax}
* The created Ajax object.
*
* @see Drupal.AjaxCommands
*/
Drupal.ajax = function (settings) {
if (arguments.length !== 1) {
throw new Error('Drupal.ajax() function must be called with one configuration object only');
}
// Map those config keys to variables for the old Drupal.ajax function.
var base = settings.base || false;
var element = settings.element || false;
delete settings.base;
delete settings.element;
// By default do not display progress for ajax calls without an element.
if (!settings.progress && !element) {
settings.progress = false;
}
var ajax = new Drupal.Ajax(base, element, settings);
ajax.instanceIndex = Drupal.ajax.instances.length;
Drupal.ajax.instances.push(ajax);
return ajax;
};
/**
* Contains all created Ajax objects.
*
* @type {Array.<Drupal.Ajax|null>}
*/
Drupal.ajax.instances = [];
/**
* List all objects where the associated element is not in the DOM
*
* This method ignores {@link Drupal.Ajax} objects not bound to DOM elements
* when created with {@link Drupal.ajax}.
*
* @return {Array.<Drupal.Ajax>}
* The list of expired {@link Drupal.Ajax} objects.
*/
Drupal.ajax.expired = function () {
return Drupal.ajax.instances.filter(function (instance) {
return instance && instance.element !== false && !document.body.contains(instance.element);
});
};
/**
* Settings for an Ajax object.
*
* @typedef {object} Drupal.Ajax~element_settings
*
* @prop {string} url
* Target of the Ajax request.
* @prop {?string} [event]
* Event bound to settings.element which will trigger the Ajax request.
* @prop {bool} [keypress=true]
* Triggers a request on keypress events.
* @prop {?string} selector
* jQuery selector targeting the element to bind events to or used with
* {@link Drupal.AjaxCommands}.
* @prop {string} [effect='none']
* Name of the jQuery method to use for displaying new Ajax content.
* @prop {string|number} [speed='none']
* Speed with which to apply the effect.
* @prop {string} [method]
* Name of the jQuery method used to insert new content in the targeted
* element.
* @prop {object} [progress]
* Settings for the display of a user-friendly loader.
* @prop {string} [progress.type='throbber']
* Type of progress element, core provides `'bar'`, `'throbber'` and
* `'fullscreen'`.
* @prop {string} [progress.message=Drupal.t('Please wait...')]
* Custom message to be used with the bar indicator.
* @prop {object} [submit]
* Extra data to be sent with the Ajax request.
* @prop {bool} [submit.js=true]
* Allows the PHP side to know this comes from an Ajax request.
* @prop {object} [dialog]
* Options for {@link Drupal.dialog}.
* @prop {string} [dialogType]
* One of `'modal'` or `'dialog'`.
* @prop {string} [prevent]
* List of events on which to stop default action and stop propagation.
*/
/**
* Ajax constructor.
*
* The Ajax request returns an array of commands encoded in JSON, which is
* then executed to make any changes that are necessary to the page.
*
* Drupal uses this file to enhance form elements with `#ajax['url']` and
* `#ajax['wrapper']` properties. If set, this file will automatically be
* included to provide Ajax capabilities.
*
* @constructor
*
* @param {string} [base]
* Base parameter of {@link Drupal.Ajax} constructor
* @param {HTMLElement} [element]
* Element parameter of {@link Drupal.Ajax} constructor, element on which
* event listeners will be bound.
* @param {Drupal.Ajax~element_settings} element_settings
* Settings for this Ajax object.
*/
Drupal.Ajax = function (base, element, element_settings) {
var defaults = {
event: element ? 'mousedown' : null,
keypress: true,
selector: base ? '#' + base : null,
effect: 'none',
speed: 'none',
method: 'replaceWith',
progress: {
type: 'throbber',
message: Drupal.t('Please wait...')
},
submit: {
js: true
}
};
$.extend(this, defaults, element_settings);
/**
* @type {Drupal.AjaxCommands}
*/
this.commands = new Drupal.AjaxCommands();
/**
* @type {bool|number}
*/
this.instanceIndex = false;
// @todo Remove this after refactoring the PHP code to:
// - Call this 'selector'.
// - Include the '#' for ID-based selectors.
// - Support non-ID-based selectors.
if (this.wrapper) {
/**
* @type {string}
*/
this.wrapper = '#' + this.wrapper;
}
/**
* @type {HTMLElement}
*/
this.element = element;
/**
* @type {Drupal.Ajax~element_settings}
*/
this.element_settings = element_settings;
// If there isn't a form, jQuery.ajax() will be used instead, allowing us to
// bind Ajax to links as well.
if (this.element && this.element.form) {
/**
* @type {jQuery}
*/
this.$form = $(this.element.form);
}
// If no Ajax callback URL was given, use the link href or form action.
if (!this.url) {
var $element = $(this.element);
if ($element.is('a')) {
this.url = $element.attr('href');
}
else if (this.element && element.form) {
this.url = this.$form.attr('action');
}
}
// Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let
// the server detect when it needs to degrade gracefully.
// There are four scenarios to check for:
// 1. /nojs/
// 2. /nojs$ - The end of a URL string.
// 3. /nojs? - Followed by a query (e.g. path/nojs?destination=foobar).
// 4. /nojs# - Followed by a fragment (e.g.: path/nojs#myfragment).
var originalUrl = this.url;
/**
* Processed Ajax URL.
*
* @type {string}
*/
this.url = this.url.replace(/\/nojs(\/|$|\?|#)/g, '/ajax$1');
// If the 'nojs' version of the URL is trusted, also trust the 'ajax'
// version.
if (drupalSettings.ajaxTrustedUrl[originalUrl]) {
drupalSettings.ajaxTrustedUrl[this.url] = true;
}
// Set the options for the ajaxSubmit function.
// The 'this' variable will not persist inside of the options object.
var ajax = this;
/**
* Options for the jQuery.ajax function.
*
* @name Drupal.Ajax#options
*
* @type {object}
*
* @prop {string} url
* Ajax URL to be called.
* @prop {object} data
* Ajax payload.
* @prop {function} beforeSerialize
* Implement jQuery beforeSerialize function to call
* {@link Drupal.Ajax#beforeSerialize}.
* @prop {function} beforeSubmit
* Implement jQuery beforeSubmit function to call
* {@link Drupal.Ajax#beforeSubmit}.
* @prop {function} beforeSend
* Implement jQuery beforeSend function to call
* {@link Drupal.Ajax#beforeSend}.
* @prop {function} success
* Implement jQuery success function to call
* {@link Drupal.Ajax#success}.
* @prop {function} complete
* Implement jQuery success function to clean up ajax state and trigger an
* error if needed.
* @prop {string} dataType='json'
* Type of the response expected.
* @prop {string} type='POST'
* HTTP method to use for the Ajax request.
*/
ajax.options = {
url: ajax.url,
data: ajax.submit,
beforeSerialize: function (element_settings, options) {
return ajax.beforeSerialize(element_settings, options);
},
beforeSubmit: function (form_values, element_settings, options) {
ajax.ajaxing = true;
return ajax.beforeSubmit(form_values, element_settings, options);
},
beforeSend: function (xmlhttprequest, options) {
ajax.ajaxing = true;
return ajax.beforeSend(xmlhttprequest, options);
},
success: function (response, status, xmlhttprequest) {
// Sanity check for browser support (object expected).
// When using iFrame uploads, responses must be returned as a string.
if (typeof response === 'string') {
response = $.parseJSON(response);
}
// Prior to invoking the response's commands, verify that they can be
// trusted by checking for a response header. See
// \Drupal\Core\EventSubscriber\AjaxResponseSubscriber for details.
// - Empty responses are harmless so can bypass verification. This
// avoids an alert message for server-generated no-op responses that
// skip Ajax rendering.
// - Ajax objects with trusted URLs (e.g., ones defined server-side via
// #ajax) can bypass header verification. This is especially useful
// for Ajax with multipart forms. Because IFRAME transport is used,
// the response headers cannot be accessed for verification.
if (response !== null && !drupalSettings.ajaxTrustedUrl[ajax.url]) {
if (xmlhttprequest.getResponseHeader('X-Drupal-Ajax-Token') !== '1') {
var customMessage = Drupal.t('The response failed verification so will not be processed.');
return ajax.error(xmlhttprequest, ajax.url, customMessage);
}
}
return ajax.success(response, status);
},
complete: function (xmlhttprequest, status) {
ajax.ajaxing = false;
if (status === 'error' || status === 'parsererror') {
return ajax.error(xmlhttprequest, ajax.url);
}
},
dataType: 'json',
type: 'POST'
};
if (element_settings.dialog) {
ajax.options.data.dialogOptions = element_settings.dialog;
}
// Ensure that we have a valid URL by adding ? when no query parameter is
// yet available, otherwise append using &.
if (ajax.options.url.indexOf('?') === -1) {
ajax.options.url += '?';
}
else {
ajax.options.url += '&';
}
ajax.options.url += Drupal.ajax.WRAPPER_FORMAT + '=drupal_' + (element_settings.dialogType || 'ajax');
// Bind the ajaxSubmit function to the element event.
$(ajax.element).on(element_settings.event, function (event) {
if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) {
throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url}));
}
return ajax.eventResponse(this, event);
});
// If necessary, enable keyboard submission so that Ajax behaviors
// can be triggered through keyboard input as well as e.g. a mousedown
// action.
if (element_settings.keypress) {
$(ajax.element).on('keypress', function (event) {
return ajax.keypressResponse(this, event);
});
}
// If necessary, prevent the browser default action of an additional event.
// For example, prevent the browser default action of a click, even if the
// Ajax behavior binds to mousedown.
if (element_settings.prevent) {
$(ajax.element).on(element_settings.prevent, false);
}
};
/**
* URL query attribute to indicate the wrapper used to render a request.
*
* The wrapper format determines how the HTML is wrapped, for example in a
* modal dialog.
*
* @const {string}
*
* @default
*/
Drupal.ajax.WRAPPER_FORMAT = '_wrapper_format';
/**
* Request parameter to indicate that a request is a Drupal Ajax request.
*
* @const {string}
*
* @default
*/
Drupal.Ajax.AJAX_REQUEST_PARAMETER = '_drupal_ajax';
/**
* Execute the ajax request.
*
* Allows developers to execute an Ajax request manually without specifying
* an event to respond to.
*
* @return {object}
* Returns the jQuery.Deferred object underlying the Ajax request. If
* pre-serialization fails, the Deferred will be returned in the rejected
* state.
*/
Drupal.Ajax.prototype.execute = function () {
// Do not perform another ajax command if one is already in progress.
if (this.ajaxing) {
return;
}
try {
this.beforeSerialize(this.element, this.options);
// Return the jqXHR so that external code can hook into the Deferred API.
return $.ajax(this.options);
}
catch (e) {
// Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response.
this.ajaxing = false;
window.alert('An error occurred while attempting to process ' + this.options.url + ': ' + e.message);
// For consistency, return a rejected Deferred (i.e., jqXHR's superclass)
// so that calling code can take appropriate action.
return $.Deferred().reject();
}
};
/**
* Handle a key press.
*
* The Ajax object will, if instructed, bind to a key press response. This
* will test to see if the key press is valid to trigger this event and
* if it is, trigger it for us and prevent other keypresses from triggering.
* In this case we're handling RETURN and SPACEBAR keypresses (event codes 13
* and 32. RETURN is often used to submit a form when in a textfield, and
* SPACE is often used to activate an element without submitting.
*
* @param {HTMLElement} element
* Element the event was triggered on.
* @param {jQuery.Event} event
* Triggered event.
*/
Drupal.Ajax.prototype.keypressResponse = function (element, event) {
// Create a synonym for this to reduce code confusion.
var ajax = this;
// Detect enter key and space bar and allow the standard response for them,
// except for form elements of type 'text', 'tel', 'number' and 'textarea',
// where the spacebar activation causes inappropriate activation if
// #ajax['keypress'] is TRUE. On a text-type widget a space should always
// be a space.
if (event.which === 13 || (event.which === 32 && element.type !== 'text' &&
element.type !== 'textarea' && element.type !== 'tel' && element.type !== 'number')) {
event.preventDefault();
event.stopPropagation();
$(ajax.element_settings.element).trigger(ajax.element_settings.event);
}
};
/**
* Handle an event that triggers an Ajax response.
*
* When an event that triggers an Ajax response happens, this method will
* perform the actual Ajax call. It is bound to the event using
* bind() in the constructor, and it uses the options specified on the
* Ajax object.
*
* @param {HTMLElement} element
* Element the event was triggered on.
* @param {jQuery.Event} event
* Triggered event.
*/
Drupal.Ajax.prototype.eventResponse = function (element, event) {
event.preventDefault();
event.stopPropagation();
// Create a synonym for this to reduce code confusion.
var ajax = this;
// Do not perform another Ajax command if one is already in progress.
if (ajax.ajaxing) {
return;
}
try {
if (ajax.$form) {
// If setClick is set, we must set this to ensure that the button's
// value is passed.
if (ajax.setClick) {
// Mark the clicked button. 'form.clk' is a special variable for
// ajaxSubmit that tells the system which element got clicked to
// trigger the submit. Without it there would be no 'op' or
// equivalent.
element.form.clk = element;
}
ajax.$form.ajaxSubmit(ajax.options);
}
else {
ajax.beforeSerialize(ajax.element, ajax.options);
$.ajax(ajax.options);
}
}
catch (e) {
// Unset the ajax.ajaxing flag here because it won't be unset during
// the complete response.
ajax.ajaxing = false;
window.alert('An error occurred while attempting to process ' + ajax.options.url + ': ' + e.message);
}
};
/**
* Handler for the form serialization.
*
* Runs before the beforeSend() handler (see below), and unlike that one, runs
* before field data is collected.
*
* @param {object} [element]
* Ajax object's `element_settings`.
* @param {object} options
* jQuery.ajax options.
*/
Drupal.Ajax.prototype.beforeSerialize = function (element, options) {
// Allow detaching behaviors to update field values before collecting them.
// This is only needed when field values are added to the POST data, so only
// when there is a form such that this.$form.ajaxSubmit() is used instead of
// $.ajax(). When there is no form and $.ajax() is used, beforeSerialize()
// isn't called, but don't rely on that: explicitly check this.$form.
if (this.$form) {
var settings = this.settings || drupalSettings;
Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize');
}
// Inform Drupal that this is an AJAX request.
options.data[Drupal.Ajax.AJAX_REQUEST_PARAMETER] = 1;
// Allow Drupal to return new JavaScript and CSS files to load without
// returning the ones already loaded.
// @see \Drupal\Core\Theme\AjaxBasePageNegotiator
// @see \Drupal\Core\Asset\LibraryDependencyResolverInterface::getMinimalRepresentativeSubset()
// @see system_js_settings_alter()
var pageState = drupalSettings.ajaxPageState;
options.data['ajax_page_state[theme]'] = pageState.theme;
options.data['ajax_page_state[theme_token]'] = pageState.theme_token;
options.data['ajax_page_state[libraries]'] = pageState.libraries;
};
/**
* Modify form values prior to form submission.
*
* @param {Array.<object>} form_values
* Processed form values.
* @param {jQuery} element
* The form node as a jQuery object.
* @param {object} options
* jQuery.ajax options.
*/
Drupal.Ajax.prototype.beforeSubmit = function (form_values, element, options) {
// This function is left empty to make it simple to override for modules
// that wish to add functionality here.
};
/**
* Prepare the Ajax request before it is sent.
*
* @param {XMLHttpRequest} xmlhttprequest
* Native Ajax object.
* @param {object} options
* jQuery.ajax options.
*/
Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) {
// For forms without file inputs, the jQuery Form plugin serializes the
// form values, and then calls jQuery's $.ajax() function, which invokes
// this handler. In this circumstance, options.extraData is never used. For
// forms with file inputs, the jQuery Form plugin uses the browser's normal
// form submission mechanism, but captures the response in a hidden IFRAME.
// In this circumstance, it calls this handler first, and then appends
// hidden fields to the form to submit the values in options.extraData.
// There is no simple way to know which submission mechanism will be used,
// so we add to extraData regardless, and allow it to be ignored in the
// former case.
if (this.$form) {
options.extraData = options.extraData || {};
// Let the server know when the IFRAME submission mechanism is used. The
// server can use this information to wrap the JSON response in a
// TEXTAREA, as per http://jquery.malsup.com/form/#file-upload.
options.extraData.ajax_iframe_upload = '1';
// The triggering element is about to be disabled (see below), but if it
// contains a value (e.g., a checkbox, textfield, select, etc.), ensure
// that value is included in the submission. As per above, submissions
// that use $.ajax() are already serialized prior to the element being
// disabled, so this is only needed for IFRAME submissions.
var v = $.fieldValue(this.element);
if (v !== null) {
options.extraData[this.element.name] = v;
}
}
// Disable the element that received the change to prevent user interface
// interaction while the Ajax request is in progress. ajax.ajaxing prevents
// the element from triggering a new request, but does not prevent the user
// from changing its value.
$(this.element).prop('disabled', true);
if (!this.progress || !this.progress.type) {
return;
}
// Insert progress indicator.
var progressIndicatorMethod = 'setProgressIndicator' + this.progress.type.slice(0, 1).toUpperCase() + this.progress.type.slice(1).toLowerCase();
if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') {
this[progressIndicatorMethod].call(this);
}
};
/**
* Sets the progress bar progress indicator.
*/
Drupal.Ajax.prototype.setProgressIndicatorBar = function () {
var progressBar = new Drupal.ProgressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop);
if (this.progress.message) {
progressBar.setProgress(-1, this.progress.message);
}
if (this.progress.url) {
progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
}
this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar');
this.progress.object = progressBar;
$(this.element).after(this.progress.element);
};
/**
* Sets the throbber progress indicator.
*/
Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () {
this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber"> </div></div>');
if (this.progress.message) {
this.progress.element.find('.throbber').after('<div class="message">' + this.progress.message + '</div>');
}
$(this.element).after(this.progress.element);
};
/**
* Sets the fullscreen progress indicator.
*/
Drupal.Ajax.prototype.setProgressIndicatorFullscreen = function () {
this.progress.element = $('<div class="ajax-progress ajax-progress-fullscreen"> </div>');
$('body').after(this.progress.element);
};
/**
* Handler for the form redirection completion.
*
* @param {Array.<Drupal.AjaxCommands~commandDefinition>} response
* Drupal Ajax response.
* @param {number} status
* XMLHttpRequest status.
*/
Drupal.Ajax.prototype.success = function (response, status) {
// Remove the progress element.
if (this.progress.element) {
$(this.progress.element).remove();
}
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
$(this.element).prop('disabled', false);
// Save element's ancestors tree so if the element is removed from the dom
// we can try to refocus one of its parents. Using addBack reverse the
// result array, meaning that index 0 is the highest parent in the hierarchy
// in this situation it is usually a <form> element.
var elementParents = $(this.element).parents('[data-drupal-selector]').addBack().toArray();
// Track if any command is altering the focus so we can avoid changing the
// focus set by the Ajax command.
var focusChanged = false;
for (var i in response) {
if (response.hasOwnProperty(i) && response[i].command && this.commands[response[i].command]) {
this.commands[response[i].command](this, response[i], status);
if (response[i].command === 'invoke' && response[i].method === 'focus') {
focusChanged = true;
}
}
}
// If the focus hasn't be changed by the ajax commands, try to refocus the
// triggering element or one of its parents if that element does not exist
// anymore.
if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) {
var target = false;
for (var n = elementParents.length - 1; !target && n > 0; n--) {
target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]');
}
if (target) {
$(target).trigger('focus');
}
}
// Reattach behaviors, if they were detached in beforeSerialize(). The
// attachBehaviors() called on the new content from processing the response
// commands is not sufficient, because behaviors from the entire form need
// to be reattached.
if (this.$form) {
var settings = this.settings || drupalSettings;
Drupal.attachBehaviors(this.$form.get(0), settings);
}
// Remove any response-specific settings so they don't get used on the next
// call by mistake.
this.settings = null;
};
/**
* Build an effect object to apply an effect when adding new HTML.
*
* @param {object} response
* Drupal Ajax response.
* @param {string} [response.effect]
* Override the default value of {@link Drupal.Ajax#element_settings}.
* @param {string|number} [response.speed]
* Override the default value of {@link Drupal.Ajax#element_settings}.
*
* @return {object}
* Returns an object with `showEffect`, `hideEffect` and `showSpeed`
* properties.
*/
Drupal.Ajax.prototype.getEffect = function (response) {
var type = response.effect || this.effect;
var speed = response.speed || this.speed;
var effect = {};
if (type === 'none') {
effect.showEffect = 'show';
effect.hideEffect = 'hide';
effect.showSpeed = '';
}
else if (type === 'fade') {
effect.showEffect = 'fadeIn';
effect.hideEffect = 'fadeOut';
effect.showSpeed = speed;
}
else {
effect.showEffect = type + 'Toggle';
effect.hideEffect = type + 'Toggle';
effect.showSpeed = speed;
}
return effect;
};
/**
* Handler for the form redirection error.
*
* @param {object} xmlhttprequest
* Native XMLHttpRequest object.
* @param {string} uri
* Ajax Request URI.
* @param {string} [customMessage]
* Extra message to print with the Ajax error.
*/
Drupal.Ajax.prototype.error = function (xmlhttprequest, uri, customMessage) {
// Remove the progress element.
if (this.progress.element) {
$(this.progress.element).remove();
}
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
// Undo hide.
$(this.wrapper).show();
// Re-enable the element.
$(this.element).prop('disabled', false);
// Reattach behaviors, if they were detached in beforeSerialize().
if (this.$form) {
var settings = this.settings || drupalSettings;
Drupal.attachBehaviors(this.$form.get(0), settings);
}
throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage);
};
/**
* @typedef {object} Drupal.AjaxCommands~commandDefinition
*
* @prop {string} command
* @prop {string} [method]
* @prop {string} [selector]
* @prop {string} [data]
* @prop {object} [settings]
* @prop {bool} [asterisk]
* @prop {string} [text]
* @prop {string} [title]
* @prop {string} [url]
* @prop {object} [argument]
* @prop {string} [name]
* @prop {string} [value]
* @prop {string} [old]
* @prop {string} [new]
* @prop {bool} [merge]
* @prop {Array} [args]
*
* @see Drupal.AjaxCommands
*/
/**
* Provide a series of commands that the client will perform.
*
* @constructor
*/
Drupal.AjaxCommands = function () {};
Drupal.AjaxCommands.prototype = {
/**
* Command to insert new content into the DOM.
*
* @param {Drupal.Ajax} ajax
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.data
* The data to use with the jQuery method.
* @param {string} [response.method]
* The jQuery DOM manipulation method to be used.
* @param {string} [response.selector]
* A optional jQuery selector string.
* @param {object} [response.settings]
* An optional array of settings that will be used.
* @param {number} [status]
* The XMLHttpRequest status.
*/
insert: function (ajax, response, status) {
// Get information from the response. If it is not there, default to
// our presets.
var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper);
var method = response.method || ajax.method;
var effect = ajax.getEffect(response);
var settings;
// We don't know what response.data contains: it might be a string of text
// without HTML, so don't rely on jQuery correctly interpreting
// $(response.data) as new HTML rather than a CSS selector. Also, if
// response.data contains top-level text nodes, they get lost with either
// $(response.data) or $('<div></div>').replaceWith(response.data).
var $new_content_wrapped = $('<div></div>').html(response.data);
var $new_content = $new_content_wrapped.contents();
// For legacy reasons, the effects processing code assumes that
// $new_content consists of a single top-level element. Also, it has not
// been sufficiently tested whether attachBehaviors() can be successfully
// called with a context object that includes top-level text nodes.
// However, to give developers full control of the HTML appearing in the
// page, and to enable Ajax content to be inserted in places where <div>
// elements are not allowed (e.g., within <table>, <tr>, and <span>
// parents), we check if the new content satisfies the requirement
// of a single top-level element, and only use the container <div> created
// above when it doesn't. For more information, please see
// https://www.drupal.org/node/736066.
if ($new_content.length !== 1 || $new_content.get(0).nodeType !== 1) {
$new_content = $new_content_wrapped;
}
// If removing content from the wrapper, detach behaviors first.
switch (method) {
case 'html':
case 'replaceWith':
case 'replaceAll':
case 'empty':
case 'remove':
settings = response.settings || ajax.settings || drupalSettings;
Drupal.detachBehaviors($wrapper.get(0), settings);
}
// Add the new content to the page.
$wrapper[method]($new_content);
// Immediately hide the new content if we're using any effects.
if (effect.showEffect !== 'show') {
$new_content.hide();
}
// Determine which effect to use and what content will receive the
// effect, then show the new content.
if ($new_content.find('.ajax-new-content').length > 0) {
$new_content.find('.ajax-new-content').hide();
$new_content.show();
$new_content.find('.ajax-new-content')[effect.showEffect](effect.showSpeed);
}
else if (effect.showEffect !== 'show') {
$new_content[effect.showEffect](effect.showSpeed);
}
// Attach all JavaScript behaviors to the new content, if it was
// successfully added to the page, this if statement allows
// `#ajax['wrapper']` to be optional.
if ($new_content.parents('html').length > 0) {
// Apply any settings from the returned JSON if available.
settings = response.settings || ajax.settings || drupalSettings;
Drupal.attachBehaviors($new_content.get(0), settings);
}
},
/**
* Command to remove a chunk from the page.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.selector
* A jQuery selector string.
* @param {object} [response.settings]
* An optional array of settings that will be used.
* @param {number} [status]
* The XMLHttpRequest status.
*/
remove: function (ajax, response, status) {
var settings = response.settings || ajax.settings || drupalSettings;
$(response.selector).each(function () {
Drupal.detachBehaviors(this, settings);
})
.remove();
},
/**
* Command to mark a chunk changed.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The JSON response object from the Ajax request.
* @param {string} response.selector
* A jQuery selector string.
* @param {bool} [response.asterisk]
* An optional CSS selector. If specified, an asterisk will be
* appended to the HTML inside the provided selector.
* @param {number} [status]
* The request status.
*/
changed: function (ajax, response, status) {
var $element = $(response.selector);
if (!$element.hasClass('ajax-changed')) {
$element.addClass('ajax-changed');
if (response.asterisk) {
$element.find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> ');
}
}
},
/**
* Command to provide an alert.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The JSON response from the Ajax request.
* @param {string} response.text
* The text that will be displayed in an alert dialog.
* @param {number} [status]
* The XMLHttpRequest status.
*/
alert: function (ajax, response, status) {
window.alert(response.text, response.title);
},
/**
* Command to set the window.location, redirecting the browser.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.url
* The URL to redirect to.
* @param {number} [status]
* The XMLHttpRequest status.
*/
redirect: function (ajax, response, status) {
window.location = response.url;
},
/**
* Command to provide the jQuery css() function.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.selector
* A jQuery selector string.
* @param {object} response.argument
* An array of key/value pairs to set in the CSS for the selector.
* @param {number} [status]
* The XMLHttpRequest status.
*/
css: function (ajax, response, status) {
$(response.selector).css(response.argument);
},
/**
* Command to set the settings used for other commands in this response.
*
* This method will also remove expired `drupalSettings.ajax` settings.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {bool} response.merge
* Determines whether the additional settings should be merged to the
* global settings.
* @param {object} response.settings
* Contains additional settings to add to the global settings.
* @param {number} [status]
* The XMLHttpRequest status.
*/
settings: function (ajax, response, status) {
var ajaxSettings = drupalSettings.ajax;
// Clean up drupalSettings.ajax.
if (ajaxSettings) {
Drupal.ajax.expired().forEach(function (instance) {
// If the Ajax object has been created through drupalSettings.ajax
// it will have a selector. When there is no selector the object
// has been initialized with a special class name picked up by the
// Ajax behavior.
if (instance.selector) {
var selector = instance.selector.replace('#', '');
if (selector in ajaxSettings) {
delete ajaxSettings[selector];
}
}
});
}
if (response.merge) {
$.extend(true, drupalSettings, response.settings);
}
else {
ajax.settings = response.settings;
}
},
/**
* Command to attach data using jQuery's data API.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.name
* The name or key (in the key value pair) of the data attached to this
* selector.
* @param {string} response.selector
* A jQuery selector string.
* @param {string|object} response.value
* The value of to be attached.
* @param {number} [status]
* The XMLHttpRequest status.
*/
data: function (ajax, response, status) {
$(response.selector).data(response.name, response.value);
},
/**
* Command to apply a jQuery method.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {Array} response.args
* An array of arguments to the jQuery method, if any.
* @param {string} response.method
* The jQuery method to invoke.
* @param {string} response.selector
* A jQuery selector string.
* @param {number} [status]
* The XMLHttpRequest status.
*/
invoke: function (ajax, response, status) {
var $element = $(response.selector);
$element[response.method].apply($element, response.args);
},
/**
* Command to restripe a table.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.selector
* A jQuery selector string.
* @param {number} [status]
* The XMLHttpRequest status.
*/
restripe: function (ajax, response, status) {
// :even and :odd are reversed because jQuery counts from 0 and
// we count from 1, so we're out of sync.
// Match immediate children of the parent element to allow nesting.
$(response.selector).find('> tbody > tr:visible, > tr:visible')
.removeClass('odd even')
.filter(':even').addClass('odd').end()
.filter(':odd').addClass('even');
},
/**
* Command to update a form's build ID.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.old
* The old form build ID.
* @param {string} response.new
* The new form build ID.
* @param {number} [status]
* The XMLHttpRequest status.
*/
update_build_id: function (ajax, response, status) {
$('input[name="form_build_id"][value="' + response.old + '"]').val(response.new);
},
/**
* Command to add css.
*
* Uses the proprietary addImport method if available as browsers which
* support that method ignore @import statements in dynamically added
* stylesheets.
*
* @param {Drupal.Ajax} [ajax]
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* The response from the Ajax request.
* @param {string} response.data
* A string that contains the styles to be added.
* @param {number} [status]
* The XMLHttpRequest status.
*/
add_css: function (ajax, response, status) {
// Add the styles in the normal way.
$('head').prepend(response.data);
// Add imports in the styles using the addImport method if available.
var match;
var importMatch = /^@import url\("(.*)"\);$/igm;
if (document.styleSheets[0].addImport && importMatch.test(response.data)) {
importMatch.lastIndex = 0;
do {
match = importMatch.exec(response.data);
document.styleSheets[0].addImport(match[1]);
} while (match);
}
}
};
})(jQuery, window, Drupal, drupalSettings);
;
/**
* @file
* Adds an HTML element and method to trigger audio UAs to read system messages.
*
* Use {@link Drupal.announce} to indicate to screen reader users that an
* element on the page has changed state. For instance, if clicking a link
* loads 10 more items into a list, one might announce the change like this.
*
* @example
* $('#search-list')
* .on('itemInsert', function (event, data) {
* // Insert the new items.
* $(data.container.el).append(data.items.el);
* // Announce the change to the page contents.
* Drupal.announce(Drupal.t('@count items added to @container',
* {'@count': data.items.length, '@container': data.container.title}
* ));
* });
*/
(function (Drupal, debounce) {
'use strict';
var liveElement;
var announcements = [];
/**
* Builds a div element with the aria-live attribute and add it to the DOM.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the behavior for drupalAnnouce.
*/
Drupal.behaviors.drupalAnnounce = {
attach: function (context) {
// Create only one aria-live element.
if (!liveElement) {
liveElement = document.createElement('div');
liveElement.id = 'drupal-live-announce';
liveElement.className = 'visually-hidden';
liveElement.setAttribute('aria-live', 'polite');
liveElement.setAttribute('aria-busy', 'false');
document.body.appendChild(liveElement);
}
}
};
/**
* Concatenates announcements to a single string; appends to the live region.
*/
function announce() {
var text = [];
var priority = 'polite';
var announcement;
// Create an array of announcement strings to be joined and appended to the
// aria live region.
var il = announcements.length;
for (var i = 0; i < il; i++) {
announcement = announcements.pop();
text.unshift(announcement.text);
// If any of the announcements has a priority of assertive then the group
// of joined announcements will have this priority.
if (announcement.priority === 'assertive') {
priority = 'assertive';
}
}
if (text.length) {
// Clear the liveElement so that repeated strings will be read.
liveElement.innerHTML = '';
// Set the busy state to true until the node changes are complete.
liveElement.setAttribute('aria-busy', 'true');
// Set the priority to assertive, or default to polite.
liveElement.setAttribute('aria-live', priority);
// Print the text to the live region. Text should be run through
// Drupal.t() before being passed to Drupal.announce().
liveElement.innerHTML = text.join('\n');
// The live text area is updated. Allow the AT to announce the text.
liveElement.setAttribute('aria-busy', 'false');
}
}
/**
* Triggers audio UAs to read the supplied text.
*
* The aria-live region will only read the text that currently populates its
* text node. Replacing text quickly in rapid calls to announce results in
* only the text from the most recent call to {@link Drupal.announce} being
* read. By wrapping the call to announce in a debounce function, we allow for
* time for multiple calls to {@link Drupal.announce} to queue up their
* messages. These messages are then joined and append to the aria-live region
* as one text node.
*
* @param {string} text
* A string to be read by the UA.
* @param {string} [priority='polite']
* A string to indicate the priority of the message. Can be either
* 'polite' or 'assertive'.
*
* @return {function}
* The return of the call to debounce.
*
* @see http://www.w3.org/WAI/PF/aria-practices/#liveprops
*/
Drupal.announce = function (text, priority) {
// Save the text and priority into a closure variable. Multiple simultaneous
// announcements will be concatenated and read in sequence.
announcements.push({
text: text,
priority: priority
});
// Immediately invoke the function that debounce returns. 200 ms is right at
// the cusp where humans notice a pause, so we will wait
// at most this much time before the set of queued announcements is read.
return (debounce(announce, 200)());
};
}(Drupal, Drupal.debounce));
;
(function(){if(window.matchMedia&&window.matchMedia("all").addListener){return false}var e=window.matchMedia,i=e("only all").matches,n=false,t=0,a=[],r=function(i){clearTimeout(t);t=setTimeout(function(){for(var i=0,n=a.length;i<n;i++){var t=a[i].mql,r=a[i].listeners||[],o=e(t.media).matches;if(o!==t.matches){t.matches=o;for(var s=0,l=r.length;s<l;s++){r[s].call(window,t)}}}},30)};window.matchMedia=function(t){var o=e(t),s=[],l=0;o.addListener=function(e){if(!i){return}if(!n){n=true;window.addEventListener("resize",r,true)}if(l===0){l=a.push({mql:o,listeners:s})}s.push(e)};o.removeListener=function(e){for(var i=0,n=s.length;i<n;i++){if(s[i]===e){s.splice(i,1)}}};return o}})();
;
/**
* @file
* Manages elements that can offset the size of the viewport.
*
* Measures and reports viewport offset dimensions from elements like the
* toolbar that can potentially displace the positioning of other elements.
*/
/**
* @typedef {object} Drupal~displaceOffset
*
* @prop {number} top
* @prop {number} left
* @prop {number} right
* @prop {number} bottom
*/
/**
* Triggers when layout of the page changes.
*
* This is used to position fixed element on the page during page resize and
* Toolbar toggling.
*
* @event drupalViewportOffsetChange
*/
(function ($, Drupal, debounce) {
'use strict';
/**
* @name Drupal.displace.offsets
*
* @type {Drupal~displaceOffset}
*/
var offsets = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
/**
* Registers a resize handler on the window.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.drupalDisplace = {
attach: function () {
// Mark this behavior as processed on the first pass.
if (this.displaceProcessed) {
return;
}
this.displaceProcessed = true;
$(window).on('resize.drupalDisplace', debounce(displace, 200));
}
};
/**
* Informs listeners of the current offset dimensions.
*
* @function Drupal.displace
*
* @prop {Drupal~displaceOffset} offsets
*
* @param {bool} [broadcast]
* When true or undefined, causes the recalculated offsets values to be
* broadcast to listeners.
*
* @return {Drupal~displaceOffset}
* An object whose keys are the for sides an element -- top, right, bottom
* and left. The value of each key is the viewport displacement distance for
* that edge.
*
* @fires event:drupalViewportOffsetChange
*/
function displace(broadcast) {
offsets = Drupal.displace.offsets = calculateOffsets();
if (typeof broadcast === 'undefined' || broadcast) {
$(document).trigger('drupalViewportOffsetChange', offsets);
}
return offsets;
}
/**
* Determines the viewport offsets.
*
* @return {Drupal~displaceOffset}
* An object whose keys are the for sides an element -- top, right, bottom
* and left. The value of each key is the viewport displacement distance for
* that edge.
*/
function calculateOffsets() {
return {
top: calculateOffset('top'),
right: calculateOffset('right'),
bottom: calculateOffset('bottom'),
left: calculateOffset('left')
};
}
/**
* Gets a specific edge's offset.
*
* Any element with the attribute data-offset-{edge} e.g. data-offset-top will
* be considered in the viewport offset calculations. If the attribute has a
* numeric value, that value will be used. If no value is provided, one will
* be calculated using the element's dimensions and placement.
*
* @function Drupal.displace.calculateOffset
*
* @param {string} edge
* The name of the edge to calculate. Can be 'top', 'right',
* 'bottom' or 'left'.
*
* @return {number}
* The viewport displacement distance for the requested edge.
*/
function calculateOffset(edge) {
var edgeOffset = 0;
var displacingElements = document.querySelectorAll('[data-offset-' + edge + ']');
var n = displacingElements.length;
for (var i = 0; i < n; i++) {
var el = displacingElements[i];
// If the element is not visible, do consider its dimensions.
if (el.style.display === 'none') {
continue;
}
// If the offset data attribute contains a displacing value, use it.
var displacement = parseInt(el.getAttribute('data-offset-' + edge), 10);
// If the element's offset data attribute exits
// but is not a valid number then get the displacement
// dimensions directly from the element.
if (isNaN(displacement)) {
displacement = getRawOffset(el, edge);
}
// If the displacement value is larger than the current value for this
// edge, use the displacement value.
edgeOffset = Math.max(edgeOffset, displacement);
}
return edgeOffset;
}
/**
* Calculates displacement for element based on its dimensions and placement.
*
* @param {HTMLElement} el
* The jQuery element whose dimensions and placement will be measured.
*
* @param {string} edge
* The name of the edge of the viewport that the element is associated
* with.
*
* @return {number}
* The viewport displacement distance for the requested edge.
*/
function getRawOffset(el, edge) {
var $el = $(el);
var documentElement = document.documentElement;
var displacement = 0;
var horizontal = (edge === 'left' || edge === 'right');
// Get the offset of the element itself.
var placement = $el.offset()[horizontal ? 'left' : 'top'];
// Subtract scroll distance from placement to get the distance
// to the edge of the viewport.
placement -= window['scroll' + (horizontal ? 'X' : 'Y')] || document.documentElement['scroll' + (horizontal ? 'Left' : 'Top')] || 0;
// Find the displacement value according to the edge.
switch (edge) {
// Left and top elements displace as a sum of their own offset value
// plus their size.
case 'top':
// Total displacement is the sum of the elements placement and size.
displacement = placement + $el.outerHeight();
break;
case 'left':
// Total displacement is the sum of the elements placement and size.
displacement = placement + $el.outerWidth();
break;
// Right and bottom elements displace according to their left and
// top offset. Their size isn't important.
case 'bottom':
displacement = documentElement.clientHeight - placement;
break;
case 'right':
displacement = documentElement.clientWidth - placement;
break;
default:
displacement = 0;
}
return displacement;
}
/**
* Assign the displace function to a property of the Drupal global object.
*
* @ignore
*/
Drupal.displace = displace;
$.extend(Drupal.displace, {
/**
* Expose offsets to other scripts to avoid having to recalculate offsets.
*
* @ignore
*/
offsets: offsets,
/**
* Expose method to compute a single edge offsets.
*
* @ignore
*/
calculateOffset: calculateOffset
});
})(jQuery, Drupal, Drupal.debounce);
;
/**
* @file
* Builds a nested accordion widget.
*
* Invoke on an HTML list element with the jQuery plugin pattern.
*
* @example
* $('.toolbar-menu').drupalToolbarMenu();
*/
(function ($, Drupal, drupalSettings) {
'use strict';
/**
* Store the open menu tray.
*/
var activeItem = Drupal.url(drupalSettings.path.currentPath);
$.fn.drupalToolbarMenu = function () {
var ui = {
handleOpen: Drupal.t('Extend'),
handleClose: Drupal.t('Collapse')
};
/**
* Handle clicks from the disclosure button on an item with sub-items.
*
* @param {Object} event
* A jQuery Event object.
*/
function toggleClickHandler(event) {
var $toggle = $(event.target);
var $item = $toggle.closest('li');
// Toggle the list item.
toggleList($item);
// Close open sibling menus.
var $openItems = $item.siblings().filter('.open');
toggleList($openItems, false);
}
/**
* Handle clicks from a menu item link.
*
* @param {Object} event
* A jQuery Event object.
*/
function linkClickHandler(event) {
// If the toolbar is positioned fixed (and therefore hiding content
// underneath), then users expect clicks in the administration menu tray
// to take them to that destination but for the menu tray to be closed
// after clicking: otherwise the toolbar itself is obstructing the view
// of the destination they chose.
if (!Drupal.toolbar.models.toolbarModel.get('isFixed')) {
Drupal.toolbar.models.toolbarModel.set('activeTab', null);
}
// Stopping propagation to make sure that once a toolbar-box is clicked
// (the whitespace part), the page is not redirected anymore.
event.stopPropagation();
}
/**
* Toggle the open/close state of a list is a menu.
*
* @param {jQuery} $item
* The li item to be toggled.
*
* @param {Boolean} switcher
* A flag that forces toggleClass to add or a remove a class, rather than
* simply toggling its presence.
*/
function toggleList($item, switcher) {
var $toggle = $item.children('.toolbar-box').children('.toolbar-handle');
switcher = (typeof switcher !== 'undefined') ? switcher : !$item.hasClass('open');
// Toggle the item open state.
$item.toggleClass('open', switcher);
// Twist the toggle.
$toggle.toggleClass('open', switcher);
// Adjust the toggle text.
$toggle
.find('.action')
// Expand Structure, Collapse Structure.
.text((switcher) ? ui.handleClose : ui.handleOpen);
}
/**
* Add markup to the menu elements.
*
* Items with sub-elements have a list toggle attached to them. Menu item
* links and the corresponding list toggle are wrapped with in a div
* classed with .toolbar-box. The .toolbar-box div provides a positioning
* context for the item list toggle.
*
* @param {jQuery} $menu
* The root of the menu to be initialized.
*/
function initItems($menu) {
var options = {
class: 'toolbar-icon toolbar-handle',
action: ui.handleOpen,
text: ''
};
// Initialize items and their links.
$menu.find('li > a').wrap('<div class="toolbar-box">');
// Add a handle to each list item if it has a menu.
$menu.find('li').each(function (index, element) {
var $item = $(element);
if ($item.children('ul.toolbar-menu').length) {
var $box = $item.children('.toolbar-box');
options.text = Drupal.t('@label', {'@label': $box.find('a').text()});
$item.children('.toolbar-box')
.append(Drupal.theme('toolbarMenuItemToggle', options));
}
});
}
/**
* Adds a level class to each list based on its depth in the menu.
*
* This function is called recursively on each sub level of lists elements
* until the depth of the menu is exhausted.
*
* @param {jQuery} $lists
* A jQuery object of ul elements.
*
* @param {number} level
* The current level number to be assigned to the list elements.
*/
function markListLevels($lists, level) {
level = (!level) ? 1 : level;
var $lis = $lists.children('li').addClass('level-' + level);
$lists = $lis.children('ul');
if ($lists.length) {
markListLevels($lists, level + 1);
}
}
/**
* On page load, open the active menu item.
*
* Marks the trail of the active link in the menu back to the root of the
* menu with .menu-item--active-trail.
*
* @param {jQuery} $menu
* The root of the menu.
*/
function openActiveItem($menu) {
var pathItem = $menu.find('a[href="' + location.pathname + '"]');
if (pathItem.length && !activeItem) {
activeItem = location.pathname;
}
if (activeItem) {
var $activeItem = $menu.find('a[href="' + activeItem + '"]').addClass('menu-item--active');
var $activeTrail = $activeItem.parentsUntil('.root', 'li').addClass('menu-item--active-trail');
toggleList($activeTrail, true);
}
}
// Return the jQuery object.
return this.each(function (selector) {
var $menu = $(this).once('toolbar-menu');
if ($menu.length) {
// Bind event handlers.
$menu
.on('click.toolbar', '.toolbar-box', toggleClickHandler)
.on('click.toolbar', '.toolbar-box a', linkClickHandler);
$menu.addClass('root');
initItems($menu);
markListLevels($menu);
// Restore previous and active states.
openActiveItem($menu);
}
});
};
/**
* A toggle is an interactive element often bound to a click handler.
*
* @param {object} options
* Options for the button.
* @param {string} options.class
* Class to set on the button.
* @param {string} options.action
* Action for the button.
* @param {string} options.text
* Used as label for the button.
*
* @return {string}
* A string representing a DOM fragment.
*/
Drupal.theme.toolbarMenuItemToggle = function (options) {
return '<button class="' + options['class'] + '"><span class="action">' + options.action + '</span><span class="label">' + options.text + '</span></button>';
};
}(jQuery, Drupal, drupalSettings));
;
/**
* @file
* Defines the behavior of the Drupal administration toolbar.
*/
(function ($, Drupal, drupalSettings) {
'use strict';
// Merge run-time settings with the defaults.
var options = $.extend(
{
breakpoints: {
'toolbar.narrow': '',
'toolbar.standard': '',
'toolbar.wide': ''
}
},
drupalSettings.toolbar,
// Merge strings on top of drupalSettings so that they are not mutable.
{
strings: {
horizontal: Drupal.t('Horizontal orientation'),
vertical: Drupal.t('Vertical orientation')
}
}
);
/**
* Registers tabs with the toolbar.
*
* The Drupal toolbar allows modules to register top-level tabs. These may
* point directly to a resource or toggle the visibility of a tray.
*
* Modules register tabs with hook_toolbar().
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the toolbar rendering functionality to the toolbar element.
*/
Drupal.behaviors.toolbar = {
attach: function (context) {
// Verify that the user agent understands media queries. Complex admin
// toolbar layouts require media query support.
if (!window.matchMedia('only screen').matches) {
return;
}
// Process the administrative toolbar.
$(context).find('#toolbar-administration').once('toolbar').each(function () {
// Establish the toolbar models and views.
var model = Drupal.toolbar.models.toolbarModel = new Drupal.toolbar.ToolbarModel({
locked: JSON.parse(localStorage.getItem('Drupal.toolbar.trayVerticalLocked')) || false,
activeTab: document.getElementById(JSON.parse(localStorage.getItem('Drupal.toolbar.activeTabID')))
});
Drupal.toolbar.views.toolbarVisualView = new Drupal.toolbar.ToolbarVisualView({
el: this,
model: model,
strings: options.strings
});
Drupal.toolbar.views.toolbarAuralView = new Drupal.toolbar.ToolbarAuralView({
el: this,
model: model,
strings: options.strings
});
Drupal.toolbar.views.bodyVisualView = new Drupal.toolbar.BodyVisualView({
el: this,
model: model
});
// Render collapsible menus.
var menuModel = Drupal.toolbar.models.menuModel = new Drupal.toolbar.MenuModel();
Drupal.toolbar.views.menuVisualView = new Drupal.toolbar.MenuVisualView({
el: $(this).find('.toolbar-menu-administration').get(0),
model: menuModel,
strings: options.strings
});
// Handle the resolution of Drupal.toolbar.setSubtrees.
// This is handled with a deferred so that the function may be invoked
// asynchronously.
Drupal.toolbar.setSubtrees.done(function (subtrees) {
menuModel.set('subtrees', subtrees);
var theme = drupalSettings.ajaxPageState.theme;
localStorage.setItem('Drupal.toolbar.subtrees.' + theme, JSON.stringify(subtrees));
// Indicate on the toolbarModel that subtrees are now loaded.
model.set('areSubtreesLoaded', true);
});
// Attach a listener to the configured media query breakpoints.
for (var label in options.breakpoints) {
if (options.breakpoints.hasOwnProperty(label)) {
var mq = options.breakpoints[label];
var mql = Drupal.toolbar.mql[label] = window.matchMedia(mq);
// Curry the model and the label of the media query breakpoint to
// the mediaQueryChangeHandler function.
mql.addListener(Drupal.toolbar.mediaQueryChangeHandler.bind(null, model, label));
// Fire the mediaQueryChangeHandler for each configured breakpoint
// so that they process once.
Drupal.toolbar.mediaQueryChangeHandler.call(null, model, label, mql);
}
}
// Trigger an initial attempt to load menu subitems. This first attempt
// is made after the media query handlers have had an opportunity to
// process. The toolbar starts in the vertical orientation by default,
// unless the viewport is wide enough to accommodate a horizontal
// orientation. Thus we give the Toolbar a chance to determine if it
// should be set to horizontal orientation before attempting to load
// menu subtrees.
Drupal.toolbar.views.toolbarVisualView.loadSubtrees();
$(document)
// Update the model when the viewport offset changes.
.on('drupalViewportOffsetChange.toolbar', function (event, offsets) {
model.set('offsets', offsets);
});
// Broadcast model changes to other modules.
model
.on('change:orientation', function (model, orientation) {
$(document).trigger('drupalToolbarOrientationChange', orientation);
})
.on('change:activeTab', function (model, tab) {
$(document).trigger('drupalToolbarTabChange', tab);
})
.on('change:activeTray', function (model, tray) {
$(document).trigger('drupalToolbarTrayChange', tray);
});
// If the toolbar's orientation is horizontal and no active tab is
// defined then show the tray of the first toolbar tab by default (but
// not the first 'Home' toolbar tab).
if (Drupal.toolbar.models.toolbarModel.get('orientation') === 'horizontal' && Drupal.toolbar.models.toolbarModel.get('activeTab') === null) {
Drupal.toolbar.models.toolbarModel.set({
activeTab: $('.toolbar-bar .toolbar-tab:not(.home-toolbar-tab) a').get(0)
});
}
});
}
};
/**
* Toolbar methods of Backbone objects.
*
* @namespace
*/
Drupal.toolbar = {
/**
* A hash of View instances.
*
* @type {object.<string, Backbone.View>}
*/
views: {},
/**
* A hash of Model instances.
*
* @type {object.<string, Backbone.Model>}
*/
models: {},
/**
* A hash of MediaQueryList objects tracked by the toolbar.
*
* @type {object.<string, object>}
*/
mql: {},
/**
* Accepts a list of subtree menu elements.
*
* A deferred object that is resolved by an inlined JavaScript callback.
*
* @type {jQuery.Deferred}
*
* @see toolbar_subtrees_jsonp().
*/
setSubtrees: new $.Deferred(),
/**
* Respond to configured narrow media query changes.
*
* @param {Drupal.toolbar.ToolbarModel} model
* A toolbar model
* @param {string} label
* Media query label.
* @param {object} mql
* A MediaQueryList object.
*/
mediaQueryChangeHandler: function (model, label, mql) {
switch (label) {
case 'toolbar.narrow':
model.set({
isOriented: mql.matches,
isTrayToggleVisible: false
});
// If the toolbar doesn't have an explicit orientation yet, or if the
// narrow media query doesn't match then set the orientation to
// vertical.
if (!mql.matches || !model.get('orientation')) {
model.set({orientation: 'vertical'}, {validate: true});
}
break;
case 'toolbar.standard':
model.set({
isFixed: mql.matches
});
break;
case 'toolbar.wide':
model.set({
orientation: ((mql.matches) ? 'horizontal' : 'vertical')
}, {validate: true});
// The tray orientation toggle visibility does not need to be
// validated.
model.set({
isTrayToggleVisible: mql.matches
});
break;
default:
break;
}
}
};
/**
* A toggle is an interactive element often bound to a click handler.
*
* @return {string}
* A string representing a DOM fragment.
*/
Drupal.theme.toolbarOrientationToggle = function () {
return '<div class="toolbar-toggle-orientation"><div class="toolbar-lining">' +
'<button class="toolbar-icon" type="button"></button>' +
'</div></div>';
};
/**
* Ajax command to set the toolbar subtrees.
*
* @param {Drupal.Ajax} ajax
* {@link Drupal.Ajax} object created by {@link Drupal.ajax}.
* @param {object} response
* JSON response from the Ajax request.
* @param {number} [status]
* XMLHttpRequest status.
*/
Drupal.AjaxCommands.prototype.setToolbarSubtrees = function (ajax, response, status) {
Drupal.toolbar.setSubtrees.resolve(response.subtrees);
};
}(jQuery, Drupal, drupalSettings));
;
/**
* @file
* A Backbone Model for collapsible menus.
*/
(function (Backbone, Drupal) {
'use strict';
/**
* Backbone Model for collapsible menus.
*
* @constructor
*
* @augments Backbone.Model
*/
Drupal.toolbar.MenuModel = Backbone.Model.extend(/** @lends Drupal.toolbar.MenuModel# */{
/**
* @type {object}
*
* @prop {object} subtrees
*/
defaults: /** @lends Drupal.toolbar.MenuModel# */{
/**
* @type {object}
*/
subtrees: {}
}
});
}(Backbone, Drupal));
;
/**
* @file
* A Backbone Model for the toolbar.
*/
(function (Backbone, Drupal) {
'use strict';
/**
* Backbone model for the toolbar.
*
* @constructor
*
* @augments Backbone.Model
*/
Drupal.toolbar.ToolbarModel = Backbone.Model.extend(/** @lends Drupal.toolbar.ToolbarModel# */{
/**
* @type {object}
*
* @prop activeTab
* @prop activeTray
* @prop isOriented
* @prop isFixed
* @prop areSubtreesLoaded
* @prop isViewportOverflowConstrained
* @prop orientation
* @prop locked
* @prop isTrayToggleVisible
* @prop height
* @prop offsets
*/
defaults: /** @lends Drupal.toolbar.ToolbarModel# */{
/**
* The active toolbar tab. All other tabs should be inactive under
* normal circumstances. It will remain active across page loads. The
* active item is stored as an ID selector e.g. '#toolbar-item--1'.
*
* @type {string}
*/
activeTab: null,
/**
* Represents whether a tray is open or not. Stored as an ID selector e.g.
* '#toolbar-item--1-tray'.
*
* @type {string}
*/
activeTray: null,
/**
* Indicates whether the toolbar is displayed in an oriented fashion,
* either horizontal or vertical.
*
* @type {bool}
*/
isOriented: false,
/**
* Indicates whether the toolbar is positioned absolute (false) or fixed
* (true).
*
* @type {bool}
*/
isFixed: false,
/**
* Menu subtrees are loaded through an AJAX request only when the Toolbar
* is set to a vertical orientation.
*
* @type {bool}
*/
areSubtreesLoaded: false,
/**
* If the viewport overflow becomes constrained, isFixed must be true so
* that elements in the trays aren't lost off-screen and impossible to
* get to.
*
* @type {bool}
*/
isViewportOverflowConstrained: false,
/**
* The orientation of the active tray.
*
* @type {string}
*/
orientation: 'vertical',
/**
* A tray is locked if a user toggled it to vertical. Otherwise a tray
* will switch between vertical and horizontal orientation based on the
* configured breakpoints. The locked state will be maintained across page
* loads.
*
* @type {bool}
*/
locked: false,
/**
* Indicates whether the tray orientation toggle is visible.
*
* @type {bool}
*/
isTrayToggleVisible: false,
/**
* The height of the toolbar.
*
* @type {number}
*/
height: null,
/**
* The current viewport offsets determined by {@link Drupal.displace}. The
* offsets suggest how a module might position is components relative to
* the viewport.
*
* @type {object}
*
* @prop {number} top
* @prop {number} right
* @prop {number} bottom
* @prop {number} left
*/
offsets: {
top: 0,
right: 0,
bottom: 0,
left: 0
}
},
/**
* @inheritdoc
*
* @param {object} attributes
* Attributes for the toolbar.
* @param {object} options
* Options for the toolbar.
*
* @return {string|undefined}
* Returns an error message if validation failed.
*/
validate: function (attributes, options) {
// Prevent the orientation being set to horizontal if it is locked, unless
// override has not been passed as an option.
if (attributes.orientation === 'horizontal' && this.get('locked') && !options.override) {
return Drupal.t('The toolbar cannot be set to a horizontal orientation when it is locked.');
}
}
});
}(Backbone, Drupal));
;
/**
* @file
* A Backbone view for the body element.
*/
(function ($, Drupal, Backbone) {
'use strict';
Drupal.toolbar.BodyVisualView = Backbone.View.extend(/** @lends Drupal.toolbar.BodyVisualView# */{
/**
* Adjusts the body element with the toolbar position and dimension changes.
*
* @constructs
*
* @augments Backbone.View
*/
initialize: function () {
this.listenTo(this.model, 'change:orientation change:offsets change:activeTray change:isOriented change:isFixed change:isViewportOverflowConstrained', this.render);
},
/**
* @inheritdoc
*/
render: function () {
var $body = $('body');
var orientation = this.model.get('orientation');
var isOriented = this.model.get('isOriented');
var isViewportOverflowConstrained = this.model.get('isViewportOverflowConstrained');
$body
// We are using JavaScript to control media-query handling for two
// reasons: (1) Using JavaScript let's us leverage the breakpoint
// configurations and (2) the CSS is really complex if we try to hide
// some styling from browsers that don't understand CSS media queries.
// If we drive the CSS from classes added through JavaScript,
// then the CSS becomes simpler and more robust.
.toggleClass('toolbar-vertical', (orientation === 'vertical'))
.toggleClass('toolbar-horizontal', (isOriented && orientation === 'horizontal'))
// When the toolbar is fixed, it will not scroll with page scrolling.
.toggleClass('toolbar-fixed', (isViewportOverflowConstrained || this.model.get('isFixed')))
// Toggle the toolbar-tray-open class on the body element. The class is
// applied when a toolbar tray is active. Padding might be applied to
// the body element to prevent the tray from overlapping content.
.toggleClass('toolbar-tray-open', !!this.model.get('activeTray'))
// Apply padding to the top of the body to offset the placement of the
// toolbar bar element.
.css('padding-top', this.model.get('offsets').top);
}
});
}(jQuery, Drupal, Backbone));
;
/**
* @file
* A Backbone view for the collapsible menus.
*/
(function ($, Backbone, Drupal) {
'use strict';
Drupal.toolbar.MenuVisualView = Backbone.View.extend(/** @lends Drupal.toolbar.MenuVisualView# */{
/**
* Backbone View for collapsible menus.
*
* @constructs
*
* @augments Backbone.View
*/
initialize: function () {
this.listenTo(this.model, 'change:subtrees', this.render);
},
/**
* @inheritdoc
*/
render: function () {
var subtrees = this.model.get('subtrees');
// Add subtrees.
for (var id in subtrees) {
if (subtrees.hasOwnProperty(id)) {
this.$el
.find('#toolbar-link-' + id)
.once('toolbar-subtrees')
.after(subtrees[id]);
}
}
// Render the main menu as a nested, collapsible accordion.
if ('drupalToolbarMenu' in $.fn) {
this.$el
.children('.toolbar-menu')
.drupalToolbarMenu();
}
}
});
}(jQuery, Backbone, Drupal));
;
/**
* @file
* A Backbone view for the aural feedback of the toolbar.
*/
(function (Backbone, Drupal) {
'use strict';
Drupal.toolbar.ToolbarAuralView = Backbone.View.extend(/** @lends Drupal.toolbar.ToolbarAuralView# */{
/**
* Backbone view for the aural feedback of the toolbar.
*
* @constructs
*
* @augments Backbone.View
*
* @param {object} options
* Options for the view.
* @param {object} options.strings
* Various strings to use in the view.
*/
initialize: function (options) {
this.strings = options.strings;
this.listenTo(this.model, 'change:orientation', this.onOrientationChange);
this.listenTo(this.model, 'change:activeTray', this.onActiveTrayChange);
},
/**
* Announces an orientation change.
*
* @param {Drupal.toolbar.ToolbarModel} model
* The toolbar model in question.
* @param {string} orientation
* The new value of the orientation attribute in the model.
*/
onOrientationChange: function (model, orientation) {
Drupal.announce(Drupal.t('Tray orientation changed to @orientation.', {
'@orientation': orientation
}));
},
/**
* Announces a changed active tray.
*
* @param {Drupal.toolbar.ToolbarModel} model
* The toolbar model in question.
* @param {HTMLElement} tray
* The new value of the tray attribute in the model.
*/
onActiveTrayChange: function (model, tray) {
var relevantTray = (tray === null) ? model.previous('activeTray') : tray;
var action = (tray === null) ? Drupal.t('closed') : Drupal.t('opened');
var trayNameElement = relevantTray.querySelector('.toolbar-tray-name');
var text;
if (trayNameElement !== null) {
text = Drupal.t('Tray "@tray" @action.', {
'@tray': trayNameElement.textContent, '@action': action
});
}
else {
text = Drupal.t('Tray @action.', {'@action': action});
}
Drupal.announce(text);
}
});
}(Backbone, Drupal));
;
/**
* @file
* A Backbone view for the toolbar element. Listens to mouse & touch.
*/
(function ($, Drupal, drupalSettings, Backbone) {
'use strict';
Drupal.toolbar.ToolbarVisualView = Backbone.View.extend(/** @lends Drupal.toolbar.ToolbarVisualView# */{
/**
* Event map for the `ToolbarVisualView`.
*
* @return {object}
* A map of events.
*/
events: function () {
// Prevents delay and simulated mouse events.
var touchEndToClick = function (event) {
event.preventDefault();
event.target.click();
};
return {
'click .toolbar-bar .toolbar-tab .trigger': 'onTabClick',
'click .toolbar-toggle-orientation button': 'onOrientationToggleClick',
'touchend .toolbar-bar .toolbar-tab .trigger': touchEndToClick,
'touchend .toolbar-toggle-orientation button': touchEndToClick
};
},
/**
* Backbone view for the toolbar element. Listens to mouse & touch.
*
* @constructs
*
* @augments Backbone.View
*
* @param {object} options
* Options for the view object.
* @param {object} options.strings
* Various strings to use in the view.
*/
initialize: function (options) {
this.strings = options.strings;
this.listenTo(this.model, 'change:activeTab change:orientation change:isOriented change:isTrayToggleVisible', this.render);
this.listenTo(this.model, 'change:mqMatches', this.onMediaQueryChange);
this.listenTo(this.model, 'change:offsets', this.adjustPlacement);
// Add the tray orientation toggles.
this.$el
.find('.toolbar-tray .toolbar-lining')
.append(Drupal.theme('toolbarOrientationToggle'));
// Trigger an activeTab change so that listening scripts can respond on
// page load. This will call render.
this.model.trigger('change:activeTab');
},
/**
* @inheritdoc
*
* @return {Drupal.toolbar.ToolbarVisualView}
* The `ToolbarVisualView` instance.
*/
render: function () {
this.updateTabs();
this.updateTrayOrientation();
this.updateBarAttributes();
// Load the subtrees if the orientation of the toolbar is changed to
// vertical. This condition responds to the case that the toolbar switches
// from horizontal to vertical orientation. The toolbar starts in a
// vertical orientation by default and then switches to horizontal during
// initialization if the media query conditions are met. Simply checking
// that the orientation is vertical here would result in the subtrees
// always being loaded, even when the toolbar initialization ultimately
// results in a horizontal orientation.
//
// @see Drupal.behaviors.toolbar.attach() where admin menu subtrees
// loading is invoked during initialization after media query conditions
// have been processed.
if (this.model.changed.orientation === 'vertical' || this.model.changed.activeTab) {
this.loadSubtrees();
}
// Trigger a recalculation of viewport displacing elements. Use setTimeout
// to ensure this recalculation happens after changes to visual elements
// have processed.
window.setTimeout(function () {
Drupal.displace(true);
}, 0);
return this;
},
/**
* Responds to a toolbar tab click.
*
* @param {jQuery.Event} event
* The event triggered.
*/
onTabClick: function (event) {
// If this tab has a tray associated with it, it is considered an
// activatable tab.
if (event.target.hasAttribute('data-toolbar-tray')) {
var activeTab = this.model.get('activeTab');
var clickedTab = event.target;
// Set the event target as the active item if it is not already.
this.model.set('activeTab', (!activeTab || clickedTab !== activeTab) ? clickedTab : null);
event.preventDefault();
event.stopPropagation();
}
},
/**
* Toggles the orientation of a toolbar tray.
*
* @param {jQuery.Event} event
* The event triggered.
*/
onOrientationToggleClick: function (event) {
var orientation = this.model.get('orientation');
// Determine the toggle-to orientation.
var antiOrientation = (orientation === 'vertical') ? 'horizontal' : 'vertical';
var locked = antiOrientation === 'vertical';
// Remember the locked state.
if (locked) {
localStorage.setItem('Drupal.toolbar.trayVerticalLocked', 'true');
}
else {
localStorage.removeItem('Drupal.toolbar.trayVerticalLocked');
}
// Update the model.
this.model.set({
locked: locked,
orientation: antiOrientation
}, {
validate: true,
override: true
});
event.preventDefault();
event.stopPropagation();
},
/**
* Updates the display of the tabs: toggles a tab and the associated tray.
*/
updateTabs: function () {
var $tab = $(this.model.get('activeTab'));
// Deactivate the previous tab.
$(this.model.previous('activeTab'))
.removeClass('is-active')
.prop('aria-pressed', false);
// Deactivate the previous tray.
$(this.model.previous('activeTray'))
.removeClass('is-active');
// Activate the selected tab.
if ($tab.length > 0) {
$tab
.addClass('is-active')
// Mark the tab as pressed.
.prop('aria-pressed', true);
var name = $tab.attr('data-toolbar-tray');
// Store the active tab name or remove the setting.
var id = $tab.get(0).id;
if (id) {
localStorage.setItem('Drupal.toolbar.activeTabID', JSON.stringify(id));
}
// Activate the associated tray.
var $tray = this.$el.find('[data-toolbar-tray="' + name + '"].toolbar-tray');
if ($tray.length) {
$tray.addClass('is-active');
this.model.set('activeTray', $tray.get(0));
}
else {
// There is no active tray.
this.model.set('activeTray', null);
}
}
else {
// There is no active tray.
this.model.set('activeTray', null);
localStorage.removeItem('Drupal.toolbar.activeTabID');
}
},
/**
* Update the attributes of the toolbar bar element.
*/
updateBarAttributes: function () {
var isOriented = this.model.get('isOriented');
if (isOriented) {
this.$el.find('.toolbar-bar').attr('data-offset-top', '');
}
else {
this.$el.find('.toolbar-bar').removeAttr('data-offset-top');
}
// Toggle between a basic vertical view and a more sophisticated
// horizontal and vertical display of the toolbar bar and trays.
this.$el.toggleClass('toolbar-oriented', isOriented);
},
/**
* Updates the orientation of the active tray if necessary.
*/
updateTrayOrientation: function () {
var orientation = this.model.get('orientation');
// The antiOrientation is used to render the view of action buttons like
// the tray orientation toggle.
var antiOrientation = (orientation === 'vertical') ? 'horizontal' : 'vertical';
// Update the orientation of the trays.
var $trays = this.$el.find('.toolbar-tray')
.removeClass('toolbar-tray-horizontal toolbar-tray-vertical')
.addClass('toolbar-tray-' + orientation);
// Update the tray orientation toggle button.
var iconClass = 'toolbar-icon-toggle-' + orientation;
var iconAntiClass = 'toolbar-icon-toggle-' + antiOrientation;
var $orientationToggle = this.$el.find('.toolbar-toggle-orientation')
.toggle(this.model.get('isTrayToggleVisible'));
$orientationToggle.find('button')
.val(antiOrientation)
.attr('title', this.strings[antiOrientation])
.text(this.strings[antiOrientation])
.removeClass(iconClass)
.addClass(iconAntiClass);
// Update data offset attributes for the trays.
var dir = document.documentElement.dir;
var edge = (dir === 'rtl') ? 'right' : 'left';
// Remove data-offset attributes from the trays so they can be refreshed.
$trays.removeAttr('data-offset-left data-offset-right data-offset-top');
// If an active vertical tray exists, mark it as an offset element.
$trays.filter('.toolbar-tray-vertical.is-active').attr('data-offset-' + edge, '');
// If an active horizontal tray exists, mark it as an offset element.
$trays.filter('.toolbar-tray-horizontal.is-active').attr('data-offset-top', '');
},
/**
* Sets the tops of the trays so that they align with the bottom of the bar.
*/
adjustPlacement: function () {
var $trays = this.$el.find('.toolbar-tray');
if (!this.model.get('isOriented')) {
$trays.css('margin-top', 0);
$trays.removeClass('toolbar-tray-horizontal').addClass('toolbar-tray-vertical');
}
else {
// The toolbar container is invisible. Its placement is used to
// determine the container for the trays.
$trays.css('margin-top', this.$el.find('.toolbar-bar').outerHeight());
}
},
/**
* Calls the endpoint URI that builds an AJAX command with the rendered
* subtrees.
*
* The rendered admin menu subtrees HTML is cached on the client in
* localStorage until the cache of the admin menu subtrees on the server-
* side is invalidated. The subtreesHash is stored in localStorage as well
* and compared to the subtreesHash in drupalSettings to determine when the
* admin menu subtrees cache has been invalidated.
*/
loadSubtrees: function () {
var $activeTab = $(this.model.get('activeTab'));
var orientation = this.model.get('orientation');
// Only load and render the admin menu subtrees if:
// (1) They have not been loaded yet.
// (2) The active tab is the administration menu tab, indicated by the
// presence of the data-drupal-subtrees attribute.
// (3) The orientation of the tray is vertical.
if (!this.model.get('areSubtreesLoaded') && typeof $activeTab.data('drupal-subtrees') !== 'undefined' && orientation === 'vertical') {
var subtreesHash = drupalSettings.toolbar.subtreesHash;
var theme = drupalSettings.ajaxPageState.theme;
var endpoint = Drupal.url('toolbar/subtrees/' + subtreesHash);
var cachedSubtreesHash = localStorage.getItem('Drupal.toolbar.subtreesHash.' + theme);
var cachedSubtrees = JSON.parse(localStorage.getItem('Drupal.toolbar.subtrees.' + theme));
var isVertical = this.model.get('orientation') === 'vertical';
// If we have the subtrees in localStorage and the subtree hash has not
// changed, then use the cached data.
if (isVertical && subtreesHash === cachedSubtreesHash && cachedSubtrees) {
Drupal.toolbar.setSubtrees.resolve(cachedSubtrees);
}
// Only make the call to get the subtrees if the orientation of the
// toolbar is vertical.
else if (isVertical) {
// Remove the cached menu information.
localStorage.removeItem('Drupal.toolbar.subtreesHash.' + theme);
localStorage.removeItem('Drupal.toolbar.subtrees.' + theme);
// The AJAX response's command will trigger the resolve method of the
// Drupal.toolbar.setSubtrees Promise.
Drupal.ajax({url: endpoint}).execute();
// Cache the hash for the subtrees locally.
localStorage.setItem('Drupal.toolbar.subtreesHash.' + theme, subtreesHash);
}
}
}
});
}(jQuery, Drupal, drupalSettings, Backbone));
;
| schnitzel25/conta | sites/default/files/js/js_3YI8rlQtCphHC8k7Vs22nkB6_u47OqwXcD7P8Jm9QQg_BHuNkXbS1MEkV6lGkimSfQE6366BcKxzYtd8U65iUpM.js | JavaScript | gpl-2.0 | 96,793 |
\subsection{Data Structures}
Here are the data structures with brief descriptions:\begin{DoxyCompactList}
\item\contentsline{section}{{\bf s\_\-finfo} (File info struct. This is directly written as a file header in the file system )}{\pageref{structs__finfo}}{}
\item\contentsline{section}{{\bf s\_\-fpath} (File path specifier )}{\pageref{structs__fpath}}{}
\item\contentsline{section}{{\bf s\_\-fstream} (Stream struct )}{\pageref{structs__fstream}}{}
\end{DoxyCompactList}
| 12019/SOSSE | doxygen/latex/annotated.tex | TeX | gpl-2.0 | 476 |
/* OtherwiseNode.java --
Copyright (C) 2004 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., 59 Temple Place, Suite 330, Boston, MA
02111-1307 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 gnu.xml.transform;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Node;
/**
* A template node representing an XSL <code>otherwise</code> instruction.
*
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
final class OtherwiseNode
extends TemplateNode
{
OtherwiseNode(TemplateNode children, TemplateNode next)
{
super(children, next);
}
TemplateNode clone(Stylesheet stylesheet)
{
return new OtherwiseNode((children == null) ? null :
children.clone(stylesheet),
(next == null) ? null :
next.clone(stylesheet));
}
void doApply(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
Node parent, Node nextSibling)
throws TransformerException
{
if (children != null)
{
children.apply(stylesheet, mode,
context, pos, len,
parent, nextSibling);
}
if (next != null)
{
next.apply(stylesheet, mode,
context, pos, len,
parent, nextSibling);
}
}
public String toString()
{
StringBuffer buf = new StringBuffer(getClass().getName());
buf.append('[');
buf.append(']');
return buf.toString();
}
}
| unofficial-opensource-apple/gcc_40 | libjava/gnu/xml/transform/OtherwiseNode.java | Java | gpl-2.0 | 3,110 |
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=findutils
PKG_VERSION:=4.6.0
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
PKG_HASH:=ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d
PKG_MAINTAINER:=Daniel Dickinson <cshored@thecshore.com>
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/findutils/Default
TITLE:=GNU Find Utilities
SECTION:=utils
CATEGORY:=Utilities
URL:=https://www.gnu.org/software/findutils/
endef
define Package/findutils/description/Default
Replace busybox versions of findutils with full GNU versions.
This is normally not needed as busybox is smaller and provides
sufficient functionality, but some users may want or need
the full functionality of the GNU tools.
endef
define Package/findutils
$(call Package/findutils/Default)
TITLE+= (all)
DEPENDS:= \
+findutils-find \
+findutils-xargs \
+findutils-locate
endef
define Package/findutils-find
$(call Package/findutils/Default)
TITLE+= - find utility
ALTERNATIVES:=300:/usr/bin/find:/usr/libexec/findutils-find
endef
define Package/findutils-xargs
$(call Package/findutils/Default)
TITLE+= - xargs utility
ALTERNATIVES:=300:/usr/bin/xargs:/usr/libexec/findutils-xargs
endef
define Package/findutils-locate
$(call Package/findutils/Default)
TITLE+= - locate and updatedb utility
endef
CONFIGURE_ARGS += --localstatedir=/srv/var
CONFIGURE_VARS += ac_cv_path_SORT=sort
define Package/findutils/install
true
endef
define Package/findutils-find/install
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/find $(1)/usr/libexec/findutils-find
endef
define Package/findutils-xargs/install
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/xargs $(1)/usr/libexec/findutils-xargs
endef
define Package/findutils-locate/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/srv/var
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/locate $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/updatedb $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr/
endef
$(eval $(call BuildPackage,findutils))
$(eval $(call BuildPackage,findutils-find))
$(eval $(call BuildPackage,findutils-locate))
$(eval $(call BuildPackage,findutils-xargs))
| champtar/packages | utils/findutils/Makefile | Makefile | gpl-2.0 | 2,477 |
// StanfordLexicalizedParser -- a probabilistic lexicalized NL CFG parser
// Copyright (c) 2002, 2003, 2004, 2005 The Board of Trustees of
// The Leland Stanford Junior University. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// For more information, bug reports, fixes, contact:
// Christopher Manning
// Dept of Computer Science, Gates 1A
// Stanford CA 94305-9010
// USA
// parser-support@lists.stanford.edu
// http://nlp.stanford.edu/downloads/lex-parser.shtml
package edu.stanford.nlp.parser.lexparser;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import edu.stanford.nlp.io.NumberRangeFileFilter;
import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.ling.TaggedWord;
import edu.stanford.nlp.ling.Word;
import edu.stanford.nlp.parser.metrics.AbstractEval;
import edu.stanford.nlp.parser.metrics.UnlabeledAttachmentEval;
import edu.stanford.nlp.parser.metrics.Evalb;
import edu.stanford.nlp.parser.metrics.TaggingEval;
import edu.stanford.nlp.trees.LeftHeadFinder;
import edu.stanford.nlp.trees.MemoryTreebank;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeLengthComparator;
import edu.stanford.nlp.trees.TreeTransformer;
import edu.stanford.nlp.trees.Treebank;
import edu.stanford.nlp.trees.TreebankLanguagePack;
import java.util.function.Function;
import edu.stanford.nlp.util.Generics;
import edu.stanford.nlp.util.HashIndex;
import edu.stanford.nlp.util.Index;
import edu.stanford.nlp.util.Pair;
import edu.stanford.nlp.util.Timing;
import edu.stanford.nlp.util.StringUtils;
/**
* @author Dan Klein (original version)
* @author Christopher Manning (better features, ParserParams, serialization)
* @author Roger Levy (internationalization)
* @author Teg Grenager (grammar compaction, etc., tokenization, etc.)
* @author Galen Andrew (lattice parsing)
* @author Philip Resnik and Dan Zeman (n good parses)
*/
public class FactoredParser {
/* some documentation for Roger's convenience
* {pcfg,dep,combo}{PE,DE,TE} are precision/dep/tagging evals for the models
* parser is the PCFG parser
* dparser is the dependency parser
* bparser is the combining parser
* during testing:
* tree is the test tree (gold tree)
* binaryTree is the gold tree binarized
* tree2b is the best PCFG paser, binarized
* tree2 is the best PCFG parse (debinarized)
* tree3 is the dependency parse, binarized
* tree3db is the dependency parser, debinarized
* tree4 is the best combo parse, binarized and then debinarized
* tree4b is the best combo parse, binarized
*/
public static void main(String[] args) {
Options op = new Options(new EnglishTreebankParserParams());
// op.tlpParams may be changed to something else later, so don't use it till
// after options are parsed.
System.out.println(StringUtils.toInvocationString("FactoredParser", args));
String path = "/u/nlp/stuff/corpora/Treebank3/parsed/mrg/wsj";
int trainLow = 200, trainHigh = 2199, testLow = 2200, testHigh = 2219;
String serializeFile = null;
int i = 0;
while (i < args.length && args[i].startsWith("-")) {
if (args[i].equalsIgnoreCase("-path") && (i + 1 < args.length)) {
path = args[i + 1];
i += 2;
} else if (args[i].equalsIgnoreCase("-train") && (i + 2 < args.length)) {
trainLow = Integer.parseInt(args[i + 1]);
trainHigh = Integer.parseInt(args[i + 2]);
i += 3;
} else if (args[i].equalsIgnoreCase("-test") && (i + 2 < args.length)) {
testLow = Integer.parseInt(args[i + 1]);
testHigh = Integer.parseInt(args[i + 2]);
i += 3;
} else if (args[i].equalsIgnoreCase("-serialize") && (i + 1 < args.length)) {
serializeFile = args[i + 1];
i += 2;
} else if (args[i].equalsIgnoreCase("-tLPP") && (i + 1 < args.length)) {
try {
op.tlpParams = (TreebankLangParserParams) Class.forName(args[i + 1]).newInstance();
} catch (ClassNotFoundException e) {
System.err.println("Class not found: " + args[i + 1]);
throw new RuntimeException(e);
} catch (InstantiationException e) {
System.err.println("Couldn't instantiate: " + args[i + 1] + ": " + e.toString());
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
System.err.println("illegal access" + e);
throw new RuntimeException(e);
}
i += 2;
} else if (args[i].equals("-encoding")) {
// sets encoding for TreebankLangParserParams
op.tlpParams.setInputEncoding(args[i + 1]);
op.tlpParams.setOutputEncoding(args[i + 1]);
i += 2;
} else {
i = op.setOptionOrWarn(args, i);
}
}
// System.out.println(tlpParams.getClass());
TreebankLanguagePack tlp = op.tlpParams.treebankLanguagePack();
op.trainOptions.sisterSplitters = Generics.newHashSet(Arrays.asList(op.tlpParams.sisterSplitters()));
// BinarizerFactory.TreeAnnotator.setTreebankLang(tlpParams);
PrintWriter pw = op.tlpParams.pw();
op.testOptions.display();
op.trainOptions.display();
op.display();
op.tlpParams.display();
// setup tree transforms
Treebank trainTreebank = op.tlpParams.memoryTreebank();
MemoryTreebank testTreebank = op.tlpParams.testMemoryTreebank();
// Treebank blippTreebank = ((EnglishTreebankParserParams) tlpParams).diskTreebank();
// String blippPath = "/afs/ir.stanford.edu/data/linguistic-data/BLLIP-WSJ/";
// blippTreebank.loadPath(blippPath, "", true);
Timing.startTime();
System.err.print("Reading trees...");
testTreebank.loadPath(path, new NumberRangeFileFilter(testLow, testHigh, true));
if (op.testOptions.increasingLength) {
Collections.sort(testTreebank, new TreeLengthComparator());
}
trainTreebank.loadPath(path, new NumberRangeFileFilter(trainLow, trainHigh, true));
Timing.tick("done.");
System.err.print("Binarizing trees...");
TreeAnnotatorAndBinarizer binarizer;
if (!op.trainOptions.leftToRight) {
binarizer = new TreeAnnotatorAndBinarizer(op.tlpParams, op.forceCNF, !op.trainOptions.outsideFactor(), true, op);
} else {
binarizer = new TreeAnnotatorAndBinarizer(op.tlpParams.headFinder(), new LeftHeadFinder(), op.tlpParams, op.forceCNF, !op.trainOptions.outsideFactor(), true, op);
}
CollinsPuncTransformer collinsPuncTransformer = null;
if (op.trainOptions.collinsPunc) {
collinsPuncTransformer = new CollinsPuncTransformer(tlp);
}
TreeTransformer debinarizer = new Debinarizer(op.forceCNF);
List<Tree> binaryTrainTrees = new ArrayList<>();
if (op.trainOptions.selectiveSplit) {
op.trainOptions.splitters = ParentAnnotationStats.getSplitCategories(trainTreebank, op.trainOptions.tagSelectiveSplit, 0, op.trainOptions.selectiveSplitCutOff, op.trainOptions.tagSelectiveSplitCutOff, op.tlpParams.treebankLanguagePack());
if (op.trainOptions.deleteSplitters != null) {
List<String> deleted = new ArrayList<>();
for (String del : op.trainOptions.deleteSplitters) {
String baseDel = tlp.basicCategory(del);
boolean checkBasic = del.equals(baseDel);
for (Iterator<String> it = op.trainOptions.splitters.iterator(); it.hasNext(); ) {
String elem = it.next();
String baseElem = tlp.basicCategory(elem);
boolean delStr = checkBasic && baseElem.equals(baseDel) ||
elem.equals(del);
if (delStr) {
it.remove();
deleted.add(elem);
}
}
}
System.err.println("Removed from vertical splitters: " + deleted);
}
}
if (op.trainOptions.selectivePostSplit) {
TreeTransformer myTransformer = new TreeAnnotator(op.tlpParams.headFinder(), op.tlpParams, op);
Treebank annotatedTB = trainTreebank.transform(myTransformer);
op.trainOptions.postSplitters = ParentAnnotationStats.getSplitCategories(annotatedTB, true, 0, op.trainOptions.selectivePostSplitCutOff, op.trainOptions.tagSelectivePostSplitCutOff, op.tlpParams.treebankLanguagePack());
}
if (op.trainOptions.hSelSplit) {
binarizer.setDoSelectiveSplit(false);
for (Tree tree : trainTreebank) {
if (op.trainOptions.collinsPunc) {
tree = collinsPuncTransformer.transformTree(tree);
}
//tree.pennPrint(tlpParams.pw());
tree = binarizer.transformTree(tree);
//binaryTrainTrees.add(tree);
}
binarizer.setDoSelectiveSplit(true);
}
for (Tree tree : trainTreebank) {
if (op.trainOptions.collinsPunc) {
tree = collinsPuncTransformer.transformTree(tree);
}
tree = binarizer.transformTree(tree);
binaryTrainTrees.add(tree);
}
if (op.testOptions.verbose) {
binarizer.dumpStats();
}
List<Tree> binaryTestTrees = new ArrayList<>();
for (Tree tree : testTreebank) {
if (op.trainOptions.collinsPunc) {
tree = collinsPuncTransformer.transformTree(tree);
}
tree = binarizer.transformTree(tree);
binaryTestTrees.add(tree);
}
Timing.tick("done."); // binarization
BinaryGrammar bg = null;
UnaryGrammar ug = null;
DependencyGrammar dg = null;
// DependencyGrammar dgBLIPP = null;
Lexicon lex = null;
Index<String> stateIndex = new HashIndex<>();
// extract grammars
Extractor<Pair<UnaryGrammar,BinaryGrammar>> bgExtractor = new BinaryGrammarExtractor(op, stateIndex);
//Extractor bgExtractor = new SmoothedBinaryGrammarExtractor();//new BinaryGrammarExtractor();
// Extractor lexExtractor = new LexiconExtractor();
//Extractor dgExtractor = new DependencyMemGrammarExtractor();
if (op.doPCFG) {
System.err.print("Extracting PCFG...");
Pair<UnaryGrammar, BinaryGrammar> bgug = null;
if (op.trainOptions.cheatPCFG) {
List<Tree> allTrees = new ArrayList<>(binaryTrainTrees);
allTrees.addAll(binaryTestTrees);
bgug = bgExtractor.extract(allTrees);
} else {
bgug = bgExtractor.extract(binaryTrainTrees);
}
bg = bgug.second;
bg.splitRules();
ug = bgug.first;
ug.purgeRules();
Timing.tick("done.");
}
System.err.print("Extracting Lexicon...");
Index<String> wordIndex = new HashIndex<>();
Index<String> tagIndex = new HashIndex<>();
lex = op.tlpParams.lex(op, wordIndex, tagIndex);
lex.initializeTraining(binaryTrainTrees.size());
lex.train(binaryTrainTrees);
lex.finishTraining();
Timing.tick("done.");
if (op.doDep) {
System.err.print("Extracting Dependencies...");
binaryTrainTrees.clear();
Extractor<DependencyGrammar> dgExtractor = new MLEDependencyGrammarExtractor(op, wordIndex, tagIndex);
// dgBLIPP = (DependencyGrammar) dgExtractor.extract(new ConcatenationIterator(trainTreebank.iterator(),blippTreebank.iterator()),new TransformTreeDependency(tlpParams,true));
// DependencyGrammar dg1 = dgExtractor.extract(trainTreebank.iterator(), new TransformTreeDependency(op.tlpParams, true));
//dgBLIPP=(DependencyGrammar)dgExtractor.extract(blippTreebank.iterator(),new TransformTreeDependency(tlpParams));
//dg = (DependencyGrammar) dgExtractor.extract(new ConcatenationIterator(trainTreebank.iterator(),blippTreebank.iterator()),new TransformTreeDependency(tlpParams));
// dg=new DependencyGrammarCombination(dg1,dgBLIPP,2);
dg = dgExtractor.extract(binaryTrainTrees); //uses information whether the words are known or not, discards unknown words
Timing.tick("done.");
//System.out.print("Extracting Unknown Word Model...");
//UnknownWordModel uwm = (UnknownWordModel)uwmExtractor.extract(binaryTrainTrees);
//Timing.tick("done.");
System.out.print("Tuning Dependency Model...");
dg.tune(binaryTestTrees);
//System.out.println("TUNE DEPS: "+tuneDeps);
Timing.tick("done.");
}
BinaryGrammar boundBG = bg;
UnaryGrammar boundUG = ug;
GrammarProjection gp = new NullGrammarProjection(bg, ug);
// serialization
if (serializeFile != null) {
System.err.print("Serializing parser...");
LexicalizedParser parser = new LexicalizedParser(lex, bg, ug, dg, stateIndex, wordIndex, tagIndex, op);
parser.saveParserToSerialized(serializeFile);
Timing.tick("done.");
}
// test: pcfg-parse and output
ExhaustivePCFGParser parser = null;
if (op.doPCFG) {
parser = new ExhaustivePCFGParser(boundBG, boundUG, lex, op, stateIndex, wordIndex, tagIndex);
}
ExhaustiveDependencyParser dparser = ((op.doDep && ! op.testOptions.useFastFactored) ? new ExhaustiveDependencyParser(dg, lex, op, wordIndex, tagIndex) : null);
Scorer scorer = (op.doPCFG ? new TwinScorer(new ProjectionScorer(parser, gp, op), dparser) : null);
//Scorer scorer = parser;
BiLexPCFGParser bparser = null;
if (op.doPCFG && op.doDep) {
bparser = (op.testOptions.useN5) ? new BiLexPCFGParser.N5BiLexPCFGParser(scorer, parser, dparser, bg, ug, dg, lex, op, gp, stateIndex, wordIndex, tagIndex) : new BiLexPCFGParser(scorer, parser, dparser, bg, ug, dg, lex, op, gp, stateIndex, wordIndex, tagIndex);
}
Evalb pcfgPE = new Evalb("pcfg PE", true);
Evalb comboPE = new Evalb("combo PE", true);
AbstractEval pcfgCB = new Evalb.CBEval("pcfg CB", true);
AbstractEval pcfgTE = new TaggingEval("pcfg TE");
AbstractEval comboTE = new TaggingEval("combo TE");
AbstractEval pcfgTEnoPunct = new TaggingEval("pcfg nopunct TE");
AbstractEval comboTEnoPunct = new TaggingEval("combo nopunct TE");
AbstractEval depTE = new TaggingEval("depnd TE");
AbstractEval depDE = new UnlabeledAttachmentEval("depnd DE", true, null, tlp.punctuationWordRejectFilter());
AbstractEval comboDE = new UnlabeledAttachmentEval("combo DE", true, null, tlp.punctuationWordRejectFilter());
if (op.testOptions.evalb) {
EvalbFormatWriter.initEVALBfiles(op.tlpParams);
}
// int[] countByLength = new int[op.testOptions.maxLength+1];
// Use a reflection ruse, so one can run this without needing the
// tagger. Using a function rather than a MaxentTagger means we
// can distribute a version of the parser that doesn't include the
// entire tagger.
Function<List<? extends HasWord>,ArrayList<TaggedWord>> tagger = null;
if (op.testOptions.preTag) {
try {
Class[] argsClass = { String.class };
Object[] arguments = new Object[]{op.testOptions.taggerSerializedFile};
tagger = (Function<List<? extends HasWord>,ArrayList<TaggedWord>>) Class.forName("edu.stanford.nlp.tagger.maxent.MaxentTagger").getConstructor(argsClass).newInstance(arguments);
} catch (Exception e) {
System.err.println(e);
System.err.println("Warning: No pretagging of sentences will be done.");
}
}
for (int tNum = 0, ttSize = testTreebank.size(); tNum < ttSize; tNum++) {
Tree tree = testTreebank.get(tNum);
int testTreeLen = tree.yield().size();
if (testTreeLen > op.testOptions.maxLength) {
continue;
}
Tree binaryTree = binaryTestTrees.get(tNum);
// countByLength[testTreeLen]++;
System.out.println("-------------------------------------");
System.out.println("Number: " + (tNum + 1));
System.out.println("Length: " + testTreeLen);
//tree.pennPrint(pw);
// System.out.println("XXXX The binary tree is");
// binaryTree.pennPrint(pw);
//System.out.println("Here are the tags in the lexicon:");
//System.out.println(lex.showTags());
//System.out.println("Here's the tagnumberer:");
//System.out.println(Numberer.getGlobalNumberer("tags").toString());
long timeMil1 = System.currentTimeMillis();
Timing.tick("Starting parse.");
if (op.doPCFG) {
//System.err.println(op.testOptions.forceTags);
if (op.testOptions.forceTags) {
if (tagger != null) {
//System.out.println("Using a tagger to set tags");
//System.out.println("Tagged sentence as: " + tagger.processSentence(cutLast(wordify(binaryTree.yield()))).toString(false));
parser.parse(addLast(tagger.apply(cutLast(wordify(binaryTree.yield())))));
} else {
//System.out.println("Forcing tags to match input.");
parser.parse(cleanTags(binaryTree.taggedYield(), tlp));
}
} else {
// System.out.println("XXXX Parsing " + binaryTree.yield());
parser.parse(binaryTree.yieldHasWord());
}
//Timing.tick("Done with pcfg phase.");
}
if (op.doDep) {
dparser.parse(binaryTree.yieldHasWord());
//Timing.tick("Done with dependency phase.");
}
boolean bothPassed = false;
if (op.doPCFG && op.doDep) {
bothPassed = bparser.parse(binaryTree.yieldHasWord());
//Timing.tick("Done with combination phase.");
}
long timeMil2 = System.currentTimeMillis();
long elapsed = timeMil2 - timeMil1;
System.err.println("Time: " + ((int) (elapsed / 100)) / 10.00 + " sec.");
//System.out.println("PCFG Best Parse:");
Tree tree2b = null;
Tree tree2 = null;
//System.out.println("Got full best parse...");
if (op.doPCFG) {
tree2b = parser.getBestParse();
tree2 = debinarizer.transformTree(tree2b);
}
//System.out.println("Debinarized parse...");
//tree2.pennPrint();
//System.out.println("DepG Best Parse:");
Tree tree3 = null;
Tree tree3db = null;
if (op.doDep) {
tree3 = dparser.getBestParse();
// was: but wrong Tree tree3db = debinarizer.transformTree(tree2);
tree3db = debinarizer.transformTree(tree3);
tree3.pennPrint(pw);
}
//tree.pennPrint();
//((Tree)binaryTrainTrees.get(tNum)).pennPrint();
//System.out.println("Combo Best Parse:");
Tree tree4 = null;
if (op.doPCFG && op.doDep) {
try {
tree4 = bparser.getBestParse();
if (tree4 == null) {
tree4 = tree2b;
}
} catch (NullPointerException e) {
System.err.println("Blocked, using PCFG parse!");
tree4 = tree2b;
}
}
if (op.doPCFG && !bothPassed) {
tree4 = tree2b;
}
//tree4.pennPrint();
if (op.doDep) {
depDE.evaluate(tree3, binaryTree, pw);
depTE.evaluate(tree3db, tree, pw);
}
TreeTransformer tc = op.tlpParams.collinizer();
TreeTransformer tcEvalb = op.tlpParams.collinizerEvalb();
if (op.doPCFG) {
// System.out.println("XXXX Best PCFG was: ");
// tree2.pennPrint();
// System.out.println("XXXX Transformed best PCFG is: ");
// tc.transformTree(tree2).pennPrint();
//System.out.println("True Best Parse:");
//tree.pennPrint();
//tc.transformTree(tree).pennPrint();
pcfgPE.evaluate(tc.transformTree(tree2), tc.transformTree(tree), pw);
pcfgCB.evaluate(tc.transformTree(tree2), tc.transformTree(tree), pw);
Tree tree4b = null;
if (op.doDep) {
comboDE.evaluate((bothPassed ? tree4 : tree3), binaryTree, pw);
tree4b = tree4;
tree4 = debinarizer.transformTree(tree4);
if (op.nodePrune) {
NodePruner np = new NodePruner(parser, debinarizer);
tree4 = np.prune(tree4);
}
//tree4.pennPrint();
comboPE.evaluate(tc.transformTree(tree4), tc.transformTree(tree), pw);
}
//pcfgTE.evaluate(tree2, tree);
pcfgTE.evaluate(tcEvalb.transformTree(tree2), tcEvalb.transformTree(tree), pw);
pcfgTEnoPunct.evaluate(tc.transformTree(tree2), tc.transformTree(tree), pw);
if (op.doDep) {
comboTE.evaluate(tcEvalb.transformTree(tree4), tcEvalb.transformTree(tree), pw);
comboTEnoPunct.evaluate(tc.transformTree(tree4), tc.transformTree(tree), pw);
}
System.out.println("PCFG only: " + parser.scoreBinarizedTree(tree2b, 0));
//tc.transformTree(tree2).pennPrint();
tree2.pennPrint(pw);
if (op.doDep) {
System.out.println("Combo: " + parser.scoreBinarizedTree(tree4b, 0));
// tc.transformTree(tree4).pennPrint(pw);
tree4.pennPrint(pw);
}
System.out.println("Correct:" + parser.scoreBinarizedTree(binaryTree, 0));
/*
if (parser.scoreBinarizedTree(tree2b,true) < parser.scoreBinarizedTree(binaryTree,true)) {
System.out.println("SCORE INVERSION");
parser.validateBinarizedTree(binaryTree,0);
}
*/
tree.pennPrint(pw);
} // end if doPCFG
if (op.testOptions.evalb) {
if (op.doPCFG && op.doDep) {
EvalbFormatWriter.writeEVALBline(tcEvalb.transformTree(tree), tcEvalb.transformTree(tree4));
} else if (op.doPCFG) {
EvalbFormatWriter.writeEVALBline(tcEvalb.transformTree(tree), tcEvalb.transformTree(tree2));
} else if (op.doDep) {
EvalbFormatWriter.writeEVALBline(tcEvalb.transformTree(tree), tcEvalb.transformTree(tree3db));
}
}
} // end for each tree in test treebank
if (op.testOptions.evalb) {
EvalbFormatWriter.closeEVALBfiles();
}
// op.testOptions.display();
if (op.doPCFG) {
pcfgPE.display(false, pw);
System.out.println("Grammar size: " + stateIndex.size());
pcfgCB.display(false, pw);
if (op.doDep) {
comboPE.display(false, pw);
}
pcfgTE.display(false, pw);
pcfgTEnoPunct.display(false, pw);
if (op.doDep) {
comboTE.display(false, pw);
comboTEnoPunct.display(false, pw);
}
}
if (op.doDep) {
depTE.display(false, pw);
depDE.display(false, pw);
}
if (op.doPCFG && op.doDep) {
comboDE.display(false, pw);
}
// pcfgPE.printGoodBad();
}
private static List<TaggedWord> cleanTags(List<TaggedWord> twList, TreebankLanguagePack tlp) {
int sz = twList.size();
List<TaggedWord> l = new ArrayList<>(sz);
for (TaggedWord tw : twList) {
TaggedWord tw2 = new TaggedWord(tw.word(), tlp.basicCategory(tw.tag()));
l.add(tw2);
}
return l;
}
private static ArrayList<Word> wordify(List wList) {
ArrayList<Word> s = new ArrayList<>();
for (Object obj : wList) {
s.add(new Word(obj.toString()));
}
return s;
}
private static ArrayList<Word> cutLast(ArrayList<Word> s) {
return new ArrayList<>(s.subList(0, s.size() - 1));
}
private static ArrayList<Word> addLast(ArrayList<? extends Word> s) {
ArrayList<Word> s2 = new ArrayList<>(s);
//s2.add(new StringLabel(Lexicon.BOUNDARY));
s2.add(new Word(Lexicon.BOUNDARY));
return s2;
}
/**
* Not an instantiable class
*/
private FactoredParser() {
}
}
| hbbpb/stanford-corenlp-gv | src/edu/stanford/nlp/parser/lexparser/FactoredParser.java | Java | gpl-2.0 | 23,782 |
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
/*
COPYING CONDITIONS NOTICE:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation, and provided that the
following conditions are met:
* Redistributions of source code must retain this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below).
* Redistributions in binary form must reproduce this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below) in the documentation and/or other materials
provided with the distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
COPYRIGHT NOTICE:
TokuDB, Tokutek Fractal Tree Indexing Library.
Copyright (C) 2007-2013 Tokutek, Inc.
DISCLAIMER:
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.
UNIVERSITY PATENT NOTICE:
The technology is licensed by the Massachusetts Institute of
Technology, Rutgers State University of New Jersey, and the Research
Foundation of State University of New York at Stony Brook under
United States of America Serial No. 11/760379 and to the patents
and/or patent applications resulting from it.
PATENT MARKING NOTICE:
This software is covered by US Patent No. 8,185,551.
This software is covered by US Patent No. 8,489,638.
PATENT RIGHTS GRANT:
"THIS IMPLEMENTATION" means the copyrightable works distributed by
Tokutek as part of the Fractal Tree project.
"PATENT CLAIMS" means the claims of patents that are owned or
licensable by Tokutek, both currently or in the future; and that in
the absence of this license would be infringed by THIS
IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
"PATENT CHALLENGE" shall mean a challenge to the validity,
patentability, enforceability and/or non-infringement of any of the
PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
Tokutek hereby grants to you, for the term and geographical scope of
the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and
otherwise run, modify, and propagate the contents of THIS
IMPLEMENTATION, where such license applies only to the PATENT
CLAIMS. This grant does not include claims that would be infringed
only as a consequence of further modifications of THIS
IMPLEMENTATION. If you or your agent or licensee institute or order
or agree to the institution of patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that
THIS IMPLEMENTATION constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to you under this License shall terminate as of the date
such litigation is filed. If you or your agent or exclusive
licensee institute or order or agree to the institution of a PATENT
CHALLENGE, then Tokutek may terminate any rights granted to you
under this License.
*/
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
/* -*- mode: C; c-basic-offset: 4 -*- */
#define MYSQL_SERVER 1
#include "hatoku_defines.h"
#include <db.h>
#include "stdint.h"
#if defined(_WIN32)
#include "misc.h"
#endif
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "toku_os.h"
#include "toku_time.h"
#include "partitioned_counter.h"
/* We define DTRACE after mysql_priv.h in case it disabled dtrace in the main server */
#ifdef HAVE_DTRACE
#define _DTRACE_VERSION 1
#else
#endif
#include <mysql/plugin.h>
#include "hatoku_hton.h"
#include "ha_tokudb.h"
#undef PACKAGE
#undef VERSION
#undef HAVE_DTRACE
#undef _DTRACE_VERSION
#define TOKU_METADB_NAME "tokudb_meta"
typedef struct savepoint_info {
DB_TXN* txn;
tokudb_trx_data* trx;
bool in_sub_stmt;
} *SP_INFO, SP_INFO_T;
#if defined(MARIADB_BASE_VERSION)
ha_create_table_option tokudb_index_options[] = {
HA_IOPTION_BOOL("clustering", clustering, 0),
HA_IOPTION_END
};
#endif
static uchar *tokudb_get_key(TOKUDB_SHARE * share, size_t * length, my_bool not_used __attribute__ ((unused))) {
*length = share->table_name_length;
return (uchar *) share->table_name;
}
static handler *tokudb_create_handler(handlerton * hton, TABLE_SHARE * table, MEM_ROOT * mem_root);
static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer);
static void tokudb_cleanup_log_files(void);
static int tokudb_end(handlerton * hton, ha_panic_function type);
static bool tokudb_flush_logs(handlerton * hton);
static bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * print, enum ha_stat_type);
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
static void tokudb_handle_fatal_signal(handlerton *hton, THD *thd, int sig);
#endif
static int tokudb_close_connection(handlerton * hton, THD * thd);
static int tokudb_commit(handlerton * hton, THD * thd, bool all);
static int tokudb_rollback(handlerton * hton, THD * thd, bool all);
#if TOKU_INCLUDE_XA
static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all);
static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len);
static int tokudb_commit_by_xid(handlerton* hton, XID* xid);
static int tokudb_rollback_by_xid(handlerton* hton, XID* xid);
#endif
static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *savepoint);
static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint);
static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoint);
static int tokudb_discover_table(handlerton *hton, THD* thd, TABLE_SHARE *ts);
static int tokudb_discover_table_existence(handlerton *hton, const char *db, const char *name);
static int tokudb_discover(handlerton *hton, THD* thd, const char *db, const char *name, uchar **frmblob, size_t *frmlen);
static int tokudb_discover2(handlerton *hton, THD* thd, const char *db, const char *name, bool translate_name,uchar **frmblob, size_t *frmlen);
static int tokudb_discover3(handlerton *hton, THD* thd, const char *db, const char *name, char *path, uchar **frmblob, size_t *frmlen);
handlerton *tokudb_hton;
const char *ha_tokudb_ext = ".tokudb";
char *tokudb_data_dir;
ulong tokudb_debug;
DB_ENV *db_env;
HASH tokudb_open_tables;
pthread_mutex_t tokudb_mutex;
#if TOKU_THDVAR_MEMALLOC_BUG
static pthread_mutex_t tokudb_map_mutex;
static TREE tokudb_map;
struct tokudb_map_pair {
THD *thd;
char *last_lock_timeout;
};
#if 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
static int tokudb_map_pair_cmp(void *custom_arg, const void *a, const void *b) {
#else
static int tokudb_map_pair_cmp(const void *custom_arg, const void *a, const void *b) {
#endif
const struct tokudb_map_pair *a_key = (const struct tokudb_map_pair *) a;
const struct tokudb_map_pair *b_key = (const struct tokudb_map_pair *) b;
if (a_key->thd < b_key->thd)
return -1;
else if (a_key->thd > b_key->thd)
return +1;
else
return 0;
};
#endif
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
static my_bool tokudb_gdb_on_fatal;
static char *tokudb_gdb_path;
#endif
static PARTITIONED_COUNTER tokudb_primary_key_bytes_inserted;
void toku_hton_update_primary_key_bytes_inserted(uint64_t row_size) {
increment_partitioned_counter(tokudb_primary_key_bytes_inserted, row_size);
}
static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);
static ulong tokudb_cleaner_period;
static ulong tokudb_cleaner_iterations;
#define ASSERT_MSGLEN 1024
void toku_hton_assert_fail(const char* expr_as_string, const char * fun, const char * file, int line, int caller_errno) {
char msg[ASSERT_MSGLEN];
if (db_env) {
snprintf(msg, ASSERT_MSGLEN, "Handlerton: %s ", expr_as_string);
db_env->crash(db_env, msg, fun, file, line,caller_errno);
}
else {
snprintf(msg, ASSERT_MSGLEN, "Handlerton assertion failed, no env, %s, %d, %s, %s (errno=%d)\n", file, line, fun, expr_as_string, caller_errno);
perror(msg);
fflush(stderr);
}
abort();
}
//my_bool tokudb_shared_data = false;
static uint32_t tokudb_init_flags =
DB_CREATE | DB_THREAD | DB_PRIVATE |
DB_INIT_LOCK |
DB_INIT_MPOOL |
DB_INIT_TXN |
DB_INIT_LOG |
DB_RECOVER;
static uint32_t tokudb_env_flags = 0;
// static uint32_t tokudb_lock_type = DB_LOCK_DEFAULT;
// static ulong tokudb_log_buffer_size = 0;
// static ulong tokudb_log_file_size = 0;
static my_bool tokudb_directio = FALSE;
static my_bool tokudb_checkpoint_on_flush_logs = FALSE;
static ulonglong tokudb_cache_size = 0;
static ulonglong tokudb_max_lock_memory = 0;
static char *tokudb_home;
static char *tokudb_tmp_dir;
static char *tokudb_log_dir;
// static long tokudb_lock_scan_time = 0;
// static ulong tokudb_region_size = 0;
// static ulong tokudb_cache_parts = 1;
const char *tokudb_hton_name = "TokuDB";
static uint32_t tokudb_checkpointing_period;
static uint32_t tokudb_fsync_log_period;
uint32_t tokudb_write_status_frequency;
uint32_t tokudb_read_status_frequency;
#ifdef TOKUDB_VERSION
char *tokudb_version = (char*) TOKUDB_VERSION;
#else
char *tokudb_version;
#endif
static int tokudb_fs_reserve_percent; // file system reserve as a percentage of total disk space
#if defined(_WIN32)
extern "C" {
#include "ydb.h"
}
#endif
ha_create_table_option tokudb_table_options[]=
{
HA_TOPTION_SYSVAR("compression", row_format, row_format),
HA_TOPTION_END
};
// A flag set if the handlerton is in an initialized, usable state,
// plus a reader-write lock to protect it without serializing reads.
// Since we don't have static initializers for the opaque rwlock type,
// use constructor and destructor functions to create and destroy
// the lock before and after main(), respectively.
static int tokudb_hton_initialized;
static rw_lock_t tokudb_hton_initialized_lock;
static void create_tokudb_hton_intialized_lock(void) __attribute__((constructor));
static void create_tokudb_hton_intialized_lock(void) {
my_rwlock_init(&tokudb_hton_initialized_lock, 0);
}
static void destroy_tokudb_hton_initialized_lock(void) __attribute__((destructor));
static void destroy_tokudb_hton_initialized_lock(void) {
rwlock_destroy(&tokudb_hton_initialized_lock);
}
static SHOW_VAR *toku_global_status_variables = NULL;
static uint64_t toku_global_status_max_rows;
static TOKU_ENGINE_STATUS_ROW_S* toku_global_status_rows = NULL;
static void handle_ydb_error(int error) {
switch (error) {
case TOKUDB_HUGE_PAGES_ENABLED:
fprintf(stderr, "************************************************************\n");
fprintf(stderr, " \n");
fprintf(stderr, " @@@@@@@@@@@ \n");
fprintf(stderr, " @@' '@@ \n");
fprintf(stderr, " @@ _ _ @@ \n");
fprintf(stderr, " | (.) (.) | \n");
fprintf(stderr, " | ` | \n");
fprintf(stderr, " | > ' | \n");
fprintf(stderr, " | .----. | \n");
fprintf(stderr, " .. |.----.| .. \n");
fprintf(stderr, " .. ' ' .. \n");
fprintf(stderr, " .._______,. \n");
fprintf(stderr, " \n");
fprintf(stderr, " %s will not run with transparent huge pages enabled. \n", tokudb_hton_name);
fprintf(stderr, " Please disable them to continue. \n");
fprintf(stderr, " (echo never > /sys/kernel/mm/transparent_hugepage/enabled) \n");
fprintf(stderr, " \n");
fprintf(stderr, "************************************************************\n");
fflush(stderr);
break;
}
}
static int tokudb_init_func(void *p) {
TOKUDB_DBUG_ENTER("");
int r;
#if defined(_WIN64)
r = toku_ydb_init();
if (r) {
fprintf(stderr, "got error %d\n", r);
goto error;
}
#endif
// 3938: lock the handlerton's initialized status flag for writing
r = rw_wrlock(&tokudb_hton_initialized_lock);
assert(r == 0);
db_env = NULL;
tokudb_hton = (handlerton *) p;
tokudb_pthread_mutex_init(&tokudb_mutex, MY_MUTEX_INIT_FAST);
(void) my_hash_init(&tokudb_open_tables, table_alias_charset, 32, 0, 0, (my_hash_get_key) tokudb_get_key, 0, 0);
tokudb_hton->state = SHOW_OPTION_YES;
// tokudb_hton->flags= HTON_CAN_RECREATE; // QQQ this came from skeleton
tokudb_hton->flags = HTON_CLOSE_CURSORS_AT_COMMIT | HTON_SUPPORTS_EXTENDED_KEYS;
#if defined(TOKU_INCLUDE_EXTENDED_KEYS) && TOKU_INCLUDE_EXTENDED_KEYS
#if defined(HTON_SUPPORTS_EXTENDED_KEYS)
tokudb_hton->flags |= HTON_SUPPORTS_EXTENDED_KEYS;
#endif
#if defined(HTON_EXTENDED_KEYS)
tokudb_hton->flags |= HTON_EXTENDED_KEYS;
#endif
#endif
#if defined(HTON_SUPPORTS_CLUSTERED_KEYS)
tokudb_hton->flags |= HTON_SUPPORTS_CLUSTERED_KEYS;
#endif
#if defined(TOKU_USE_DB_TYPE_TOKUDB) && TOKU_USE_DB_TYPE_TOKUDB
tokudb_hton->db_type = DB_TYPE_TOKUDB;
#elif defined(TOKU_USE_DB_TYPE_UNKNOWN) && TOKU_USE_DB_TYPE_UNKNOWN
tokudb_hton->db_type = DB_TYPE_UNKNOWN;
#else
#error
#endif
tokudb_hton->create = tokudb_create_handler;
tokudb_hton->close_connection = tokudb_close_connection;
tokudb_hton->savepoint_offset = sizeof(SP_INFO_T);
tokudb_hton->savepoint_set = tokudb_savepoint;
tokudb_hton->savepoint_rollback = tokudb_rollback_to_savepoint;
tokudb_hton->savepoint_release = tokudb_release_savepoint;
tokudb_hton->discover_table = tokudb_discover_table;
tokudb_hton->discover_table_existence = tokudb_discover_table_existence;
#if defined(MYSQL_HANDLERTON_INCLUDE_DISCOVER2)
tokudb_hton->discover2 = tokudb_discover2;
#endif
tokudb_hton->commit = tokudb_commit;
tokudb_hton->rollback = tokudb_rollback;
#if TOKU_INCLUDE_XA
tokudb_hton->prepare=tokudb_xa_prepare;
tokudb_hton->recover=tokudb_xa_recover;
tokudb_hton->commit_by_xid=tokudb_commit_by_xid;
tokudb_hton->rollback_by_xid=tokudb_rollback_by_xid;
#endif
tokudb_hton->table_options= tokudb_table_options;
tokudb_hton->index_options= tokudb_index_options;
tokudb_hton->panic = tokudb_end;
tokudb_hton->flush_logs = tokudb_flush_logs;
tokudb_hton->show_status = tokudb_show_status;
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
tokudb_hton->handle_fatal_signal = tokudb_handle_fatal_signal;
#endif
#if defined(MARIADB_BASE_VERSION)
tokudb_hton->index_options = tokudb_index_options;
#endif
if (!tokudb_home)
tokudb_home = mysql_real_data_home;
DBUG_PRINT("info", ("tokudb_home: %s", tokudb_home));
if ((r = db_env_create(&db_env, 0))) {
DBUG_PRINT("info", ("db_env_create %d\n", r));
handle_ydb_error(r);
goto error;
}
DBUG_PRINT("info", ("tokudb_env_flags: 0x%x\n", tokudb_env_flags));
r = db_env->set_flags(db_env, tokudb_env_flags, 1);
if (r) { // QQQ
if (tokudb_debug & TOKUDB_DEBUG_INIT)
TOKUDB_TRACE("WARNING: flags=%x r=%d", tokudb_env_flags, r);
// goto error;
}
// config error handling
db_env->set_errcall(db_env, tokudb_print_error);
db_env->set_errpfx(db_env, tokudb_hton_name);
//
// set default comparison functions
//
r = db_env->set_default_bt_compare(db_env, tokudb_cmp_dbt_key);
if (r) {
DBUG_PRINT("info", ("set_default_bt_compare%d\n", r));
goto error;
}
{
char *tmp_dir = tokudb_tmp_dir;
char *data_dir = tokudb_data_dir;
if (data_dir == 0) {
data_dir = mysql_data_home;
}
if (tmp_dir == 0) {
tmp_dir = data_dir;
}
DBUG_PRINT("info", ("tokudb_data_dir: %s\n", data_dir));
db_env->set_data_dir(db_env, data_dir);
DBUG_PRINT("info", ("tokudb_tmp_dir: %s\n", tmp_dir));
db_env->set_tmp_dir(db_env, tmp_dir);
}
if (tokudb_log_dir) {
DBUG_PRINT("info", ("tokudb_log_dir: %s\n", tokudb_log_dir));
db_env->set_lg_dir(db_env, tokudb_log_dir);
}
// config the cache table size to min(1/2 of physical memory, 1/8 of the process address space)
if (tokudb_cache_size == 0) {
uint64_t physmem, maxdata;
physmem = toku_os_get_phys_memory_size();
tokudb_cache_size = physmem / 2;
r = toku_os_get_max_process_data_size(&maxdata);
if (r == 0) {
if (tokudb_cache_size > maxdata / 8)
tokudb_cache_size = maxdata / 8;
}
}
if (tokudb_cache_size) {
DBUG_PRINT("info", ("tokudb_cache_size: %lld\n", tokudb_cache_size));
r = db_env->set_cachesize(db_env, (uint32_t)(tokudb_cache_size >> 30), (uint32_t)(tokudb_cache_size % (1024L * 1024L * 1024L)), 1);
if (r) {
DBUG_PRINT("info", ("set_cachesize %d\n", r));
goto error;
}
}
if (tokudb_max_lock_memory == 0) {
tokudb_max_lock_memory = tokudb_cache_size/8;
}
if (tokudb_max_lock_memory) {
DBUG_PRINT("info", ("tokudb_max_lock_memory: %lld\n", tokudb_max_lock_memory));
r = db_env->set_lk_max_memory(db_env, tokudb_max_lock_memory);
if (r) {
DBUG_PRINT("info", ("set_lk_max_memory %d\n", r));
goto error;
}
}
uint32_t gbytes, bytes; int parts;
r = db_env->get_cachesize(db_env, &gbytes, &bytes, &parts);
if (tokudb_debug & TOKUDB_DEBUG_INIT)
TOKUDB_TRACE("tokudb_cache_size=%lld r=%d", ((unsigned long long) gbytes << 30) + bytes, r);
if (db_env->set_redzone) {
r = db_env->set_redzone(db_env, tokudb_fs_reserve_percent);
if (tokudb_debug & TOKUDB_DEBUG_INIT)
TOKUDB_TRACE("set_redzone r=%d", r);
}
if (tokudb_debug & TOKUDB_DEBUG_INIT)
TOKUDB_TRACE("env open:flags=%x", tokudb_init_flags);
r = db_env->set_generate_row_callback_for_put(db_env,generate_row_for_put);
assert(r == 0);
r = db_env->set_generate_row_callback_for_del(db_env,generate_row_for_del);
assert(r == 0);
db_env->set_update(db_env, tokudb_update_fun);
db_env_set_direct_io(tokudb_directio == TRUE);
db_env->change_fsync_log_period(db_env, tokudb_fsync_log_period);
db_env->set_lock_timeout_callback(db_env, tokudb_lock_timeout_callback);
db_env->set_loader_memory_size(db_env, tokudb_get_loader_memory_size_callback);
r = db_env->open(db_env, tokudb_home, tokudb_init_flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if (tokudb_debug & TOKUDB_DEBUG_INIT)
TOKUDB_TRACE("env opened:return=%d", r);
if (r) {
DBUG_PRINT("info", ("env->open %d", r));
goto error;
}
r = db_env->checkpointing_set_period(db_env, tokudb_checkpointing_period);
assert(r == 0);
r = db_env->cleaner_set_period(db_env, tokudb_cleaner_period);
assert(r == 0);
r = db_env->cleaner_set_iterations(db_env, tokudb_cleaner_iterations);
assert(r == 0);
r = db_env->set_lock_timeout(db_env, DEFAULT_TOKUDB_LOCK_TIMEOUT, tokudb_get_lock_wait_time_callback);
assert(r == 0);
db_env->set_killed_callback(db_env, DEFAULT_TOKUDB_KILLED_TIME, tokudb_get_killed_time_callback, tokudb_killed_callback);
r = db_env->get_engine_status_num_rows (db_env, &toku_global_status_max_rows);
assert(r == 0);
{
const myf mem_flags = MY_FAE|MY_WME|MY_ZEROFILL|MY_ALLOW_ZERO_PTR|MY_FREE_ON_ERROR;
toku_global_status_variables = (SHOW_VAR*)tokudb_my_malloc(sizeof(*toku_global_status_variables)*toku_global_status_max_rows, mem_flags);
toku_global_status_rows = (TOKU_ENGINE_STATUS_ROW_S*)tokudb_my_malloc(sizeof(*toku_global_status_rows)*toku_global_status_max_rows, mem_flags);
}
tokudb_primary_key_bytes_inserted = create_partitioned_counter();
#if TOKU_THDVAR_MEMALLOC_BUG
tokudb_pthread_mutex_init(&tokudb_map_mutex, MY_MUTEX_INIT_FAST);
init_tree(&tokudb_map, 0, 0, 0, tokudb_map_pair_cmp, true, NULL, NULL);
#endif
//3938: succeeded, set the init status flag and unlock
tokudb_hton_initialized = 1;
rw_unlock(&tokudb_hton_initialized_lock);
DBUG_RETURN(false);
error:
if (db_env) {
int rr= db_env->close(db_env, 0);
assert(rr==0);
db_env = 0;
}
// 3938: failed to initialized, drop the flag and lock
tokudb_hton_initialized = 0;
rw_unlock(&tokudb_hton_initialized_lock);
DBUG_RETURN(true);
}
static int tokudb_done_func(void *p) {
TOKUDB_DBUG_ENTER("");
tokudb_my_free(toku_global_status_variables);
toku_global_status_variables = NULL;
tokudb_my_free(toku_global_status_rows);
toku_global_status_rows = NULL;
my_hash_free(&tokudb_open_tables);
tokudb_pthread_mutex_destroy(&tokudb_mutex);
#if defined(_WIN64)
toku_ydb_destroy();
#endif
TOKUDB_DBUG_RETURN(0);
}
static handler *tokudb_create_handler(handlerton * hton, TABLE_SHARE * table, MEM_ROOT * mem_root) {
return new(mem_root) ha_tokudb(hton, table);
}
int tokudb_end(handlerton * hton, ha_panic_function type) {
TOKUDB_DBUG_ENTER("");
int error = 0;
// 3938: if we finalize the storage engine plugin, it is no longer
// initialized. grab a writer lock for the duration of the
// call, so we can drop the flag and destroy the mutexes
// in isolation.
rw_wrlock(&tokudb_hton_initialized_lock);
assert(tokudb_hton_initialized);
if (db_env) {
if (tokudb_init_flags & DB_INIT_LOG)
tokudb_cleanup_log_files();
error = db_env->close(db_env, 0); // Error is logged
assert(error==0);
db_env = NULL;
}
if (tokudb_primary_key_bytes_inserted) {
destroy_partitioned_counter(tokudb_primary_key_bytes_inserted);
tokudb_primary_key_bytes_inserted = NULL;
}
#if TOKU_THDVAR_MEMALLOC_BUG
tokudb_pthread_mutex_destroy(&tokudb_map_mutex);
delete_tree(&tokudb_map);
#endif
// 3938: drop the initialized flag and unlock
tokudb_hton_initialized = 0;
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_close_connection(handlerton * hton, THD * thd) {
int error = 0;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("trx %p", trx);
}
if (trx && trx->checkpoint_lock_taken) {
error = db_env->checkpointing_resume(db_env);
}
tokudb_my_free(trx);
#if TOKU_THDVAR_MEMALLOC_BUG
tokudb_pthread_mutex_lock(&tokudb_map_mutex);
struct tokudb_map_pair key = { thd, NULL };
struct tokudb_map_pair *found_key = (struct tokudb_map_pair *) tree_search(&tokudb_map, &key, NULL);
if (found_key) {
if (0) TOKUDB_TRACE("thd %p %p", thd, found_key->last_lock_timeout);
tokudb_my_free(found_key->last_lock_timeout);
tree_delete(&tokudb_map, found_key, sizeof *found_key, NULL);
}
tokudb_pthread_mutex_unlock(&tokudb_map_mutex);
#endif
return error;
}
bool tokudb_flush_logs(handlerton * hton) {
TOKUDB_DBUG_ENTER("");
int error;
bool result = 0;
if (tokudb_checkpoint_on_flush_logs) {
//
// take the checkpoint
//
error = db_env->txn_checkpoint(db_env, 0, 0, 0);
if (error) {
my_error(ER_ERROR_DURING_CHECKPOINT, MYF(0), error);
result = 1;
goto exit;
}
}
else {
error = db_env->log_flush(db_env, NULL);
assert(error == 0);
}
result = 0;
exit:
TOKUDB_DBUG_RETURN(result);
}
typedef struct txn_progress_info {
char status[200];
THD* thd;
} *TXN_PROGRESS_INFO;
static void txn_progress_func(TOKU_TXN_PROGRESS progress, void* extra) {
TXN_PROGRESS_INFO progress_info = (TXN_PROGRESS_INFO)extra;
int r = sprintf(progress_info->status,
"%sprocessing %s of transaction, %" PRId64 " out of %" PRId64,
progress->stalled_on_checkpoint ? "Writing committed changes to disk, " : "",
progress->is_commit ? "commit" : "abort",
progress->entries_processed,
progress->entries_total
);
assert(r >= 0);
thd_proc_info(progress_info->thd, progress_info->status);
}
static void commit_txn_with_progress(DB_TXN* txn, uint32_t flags, THD* thd) {
int r;
struct txn_progress_info info;
info.thd = thd;
r = txn->commit_with_progress(txn, flags, txn_progress_func, &info);
if (r != 0) {
sql_print_error("tried committing transaction %p and got error code %d", txn, r);
}
assert(r == 0);
}
static void abort_txn_with_progress(DB_TXN* txn, THD* thd) {
int r;
struct txn_progress_info info;
info.thd = thd;
r = txn->abort_with_progress(txn, txn_progress_func, &info);
if (r != 0) {
sql_print_error("tried aborting transaction %p and got error code %d", txn, r);
}
assert(r == 0);
}
static void tokudb_cleanup_handlers(tokudb_trx_data *trx, DB_TXN *txn) {
LIST *e;
while ((e = trx->handlers)) {
trx->handlers = list_delete(trx->handlers, e);
ha_tokudb *handler = (ha_tokudb *) e->data;
handler->cleanup_txn(txn);
}
}
static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
TOKUDB_DBUG_ENTER("");
DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt"));
uint32_t syncflag = THDVAR(thd, commit_sync) ? 0 : DB_TXN_NOSYNC;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn;
if (this_txn) {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("commit trx %u trx %p txn %p", all, trx, this_txn);
}
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_commit_before", DBUG_SUICIDE(););
tokudb_cleanup_handlers(trx, this_txn);
commit_txn_with_progress(this_txn, syncflag, thd);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_commit_after", DBUG_SUICIDE(););
if (this_txn == trx->sp_level) {
trx->sp_level = 0;
}
*txn = 0;
trx->sub_sp_level = NULL;
}
else if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("nothing to commit %d", all);
}
reset_stmt_progress(&trx->stmt_progress);
TOKUDB_DBUG_RETURN(0);
}
static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
TOKUDB_DBUG_ENTER("");
DBUG_PRINT("trans", ("aborting transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
DB_TXN **txn = all ? &trx->all : &trx->stmt;
DB_TXN *this_txn = *txn;
if (this_txn) {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("rollback %u trx %p txn %p", all, trx, this_txn);
}
tokudb_cleanup_handlers(trx, this_txn);
abort_txn_with_progress(this_txn, thd);
if (this_txn == trx->sp_level) {
trx->sp_level = 0;
}
*txn = 0;
trx->sub_sp_level = NULL;
}
else {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("abort0");
}
}
reset_stmt_progress(&trx->stmt_progress);
TOKUDB_DBUG_RETURN(0);
}
#if TOKU_INCLUDE_XA
static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
TOKUDB_DBUG_ENTER("");
int r = 0;
DBUG_PRINT("trans", ("preparing transaction %s", all ? "all" : "stmt"));
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
DB_TXN* txn = all ? trx->all : trx->stmt;
if (txn) {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("doing txn prepare:%d:%p", all, txn);
}
// a TOKU_XA_XID is identical to a MYSQL_XID
TOKU_XA_XID thd_xid;
thd_get_xid(thd, (MYSQL_XID*) &thd_xid);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_before", DBUG_SUICIDE(););
r = txn->xa_prepare(txn, &thd_xid);
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_after", DBUG_SUICIDE(););
}
else if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("nothing to prepare %d", all);
}
TOKUDB_DBUG_RETURN(r);
}
static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len) {
TOKUDB_DBUG_ENTER("");
int r = 0;
if (len == 0 || xid_list == NULL) {
TOKUDB_DBUG_RETURN(0);
}
long num_returned = 0;
r = db_env->txn_xa_recover(
db_env,
(TOKU_XA_XID*)xid_list,
len,
&num_returned,
DB_NEXT
);
assert(r == 0);
TOKUDB_DBUG_RETURN((int)num_returned);
}
static int tokudb_commit_by_xid(handlerton* hton, XID* xid) {
TOKUDB_DBUG_ENTER("");
int r = 0;
DB_TXN* txn = NULL;
TOKU_XA_XID* toku_xid = (TOKU_XA_XID*)xid;
r = db_env->get_txn_from_xid(db_env, toku_xid, &txn);
if (r) { goto cleanup; }
r = txn->commit(txn, 0);
if (r) { goto cleanup; }
r = 0;
cleanup:
TOKUDB_DBUG_RETURN(r);
}
static int tokudb_rollback_by_xid(handlerton* hton, XID* xid) {
TOKUDB_DBUG_ENTER("");
int r = 0;
DB_TXN* txn = NULL;
TOKU_XA_XID* toku_xid = (TOKU_XA_XID*)xid;
r = db_env->get_txn_from_xid(db_env, toku_xid, &txn);
if (r) { goto cleanup; }
r = txn->abort(txn);
if (r) { goto cleanup; }
r = 0;
cleanup:
TOKUDB_DBUG_RETURN(r);
}
#endif
static int tokudb_savepoint(handlerton * hton, THD * thd, void *savepoint) {
TOKUDB_DBUG_ENTER("");
int error;
SP_INFO save_info = (SP_INFO)savepoint;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
if (thd->in_sub_stmt) {
assert(trx->stmt);
error = txn_begin(db_env, trx->sub_sp_level, &(save_info->txn), DB_INHERIT_ISOLATION, thd);
if (error) {
goto cleanup;
}
trx->sub_sp_level = save_info->txn;
save_info->in_sub_stmt = true;
}
else {
error = txn_begin(db_env, trx->sp_level, &(save_info->txn), DB_INHERIT_ISOLATION, thd);
if (error) {
goto cleanup;
}
trx->sp_level = save_info->txn;
save_info->in_sub_stmt = false;
}
save_info->trx = trx;
error = 0;
cleanup:
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *savepoint) {
TOKUDB_DBUG_ENTER("");
int error;
SP_INFO save_info = (SP_INFO)savepoint;
DB_TXN* parent = NULL;
DB_TXN* txn_to_rollback = save_info->txn;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
parent = txn_to_rollback->parent;
if (!(error = txn_to_rollback->abort(txn_to_rollback))) {
if (save_info->in_sub_stmt) {
trx->sub_sp_level = parent;
}
else {
trx->sp_level = parent;
}
error = tokudb_savepoint(hton, thd, savepoint);
}
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_release_savepoint(handlerton * hton, THD * thd, void *savepoint) {
TOKUDB_DBUG_ENTER("");
int error;
SP_INFO save_info = (SP_INFO)savepoint;
DB_TXN* parent = NULL;
DB_TXN* txn_to_commit = save_info->txn;
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, hton->slot);
parent = txn_to_commit->parent;
if (!(error = txn_to_commit->commit(txn_to_commit, 0))) {
if (save_info->in_sub_stmt) {
trx->sub_sp_level = parent;
}
else {
trx->sp_level = parent;
}
save_info->txn = NULL;
}
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_discover_table(handlerton *hton, THD* thd, TABLE_SHARE *ts) {
uchar *frmblob = 0;
size_t frmlen;
int res= tokudb_discover3(hton, thd, ts->db.str, ts->table_name.str,
ts->normalized_path.str, &frmblob, &frmlen);
if (!res)
res= ts->init_from_binary_frm_image(thd, true, frmblob, frmlen);
my_free(frmblob);
// discover_table should returns HA_ERR_NO_SUCH_TABLE for "not exists"
return res == ENOENT ? HA_ERR_NO_SUCH_TABLE : res;
}
static int tokudb_discover_table_existence(handlerton *hton, const char *db, const char *name) {
uchar *frmblob = 0;
size_t frmlen;
int res= tokudb_discover(hton, current_thd, db, name, &frmblob, &frmlen);
my_free(frmblob);
return res != ENOENT;
}
static int tokudb_discover(handlerton *hton, THD* thd, const char *db, const char *name, uchar **frmblob, size_t *frmlen) {
return tokudb_discover2(hton, thd, db, name, true, frmblob, frmlen);
}
static int tokudb_discover2(handlerton *hton, THD* thd, const char *db, const char *name, bool translate_name,
uchar **frmblob, size_t *frmlen) {
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, db, name, "", translate_name ? 0 : FN_IS_TMP);
return tokudb_discover3(hton, thd, db, name, path, frmblob, frmlen);
}
static int tokudb_discover3(handlerton *hton, THD* thd, const char *db, const char *name, char *path,
uchar **frmblob, size_t *frmlen) {
TOKUDB_DBUG_ENTER("%s %s", db, name);
int error;
DB* status_db = NULL;
DB_TXN* txn = NULL;
HA_METADATA_KEY curr_key = hatoku_frm_data;
DBT key, value;
tokudb_trx_data *trx = NULL;
bool do_commit = false;
memset(&key, 0, sizeof(key));
memset(&value, 0, sizeof(&value));
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE && trx && trx->sub_sp_level) {
txn = trx->sub_sp_level;
}
else {
do_commit = true;
error = txn_begin(db_env, 0, &txn, 0, thd);
if (error) { goto cleanup; }
}
error = open_status_dictionary(&status_db, path, txn);
if (error) { goto cleanup; }
key.data = &curr_key;
key.size = sizeof(curr_key);
error = status_db->getf_set(
status_db,
txn,
0,
&key,
smart_dbt_callback_verify_frm,
&value
);
if (error) {
goto cleanup;
}
*frmblob = (uchar *)value.data;
*frmlen = value.size;
error = 0;
cleanup:
if (status_db) {
status_db->close(status_db,0);
}
if (do_commit && txn) {
commit_txn(txn,0);
}
TOKUDB_DBUG_RETURN(error);
}
#define STATPRINT(legend, val) if (legend != NULL && val != NULL) stat_print(thd, \
tokudb_hton_name, \
strlen(tokudb_hton_name), \
legend, \
strlen(legend), \
val, \
strlen(val))
extern sys_var *intern_find_sys_var(const char *str, uint length, bool no_error);
static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_ENTER("");
int error;
uint64_t panic;
const int panic_string_len = 1024;
char panic_string[panic_string_len] = {'\0'};
uint64_t num_rows;
uint64_t max_rows;
fs_redzone_state redzone_state;
const int bufsiz = 1024;
char buf[bufsiz];
#if MYSQL_VERSION_ID < 50500
{
sys_var * version = intern_find_sys_var("version", 0, false);
snprintf(buf, bufsiz, "%s", version->value_ptr(thd, (enum_var_type)0, (LEX_STRING*)NULL));
STATPRINT("Version", buf);
}
#endif
error = db_env->get_engine_status_num_rows (db_env, &max_rows);
TOKU_ENGINE_STATUS_ROW_S mystat[max_rows];
error = db_env->get_engine_status (db_env, mystat, max_rows, &num_rows, &redzone_state, &panic, panic_string, panic_string_len, TOKU_ENGINE_STATUS);
if (strlen(panic_string)) {
STATPRINT("Environment panic string", panic_string);
}
if (error == 0) {
if (panic) {
snprintf(buf, bufsiz, "%" PRIu64, panic);
STATPRINT("Environment panic", buf);
}
if(redzone_state == FS_BLOCKED) {
STATPRINT("*** URGENT WARNING ***", "FILE SYSTEM IS COMPLETELY FULL");
snprintf(buf, bufsiz, "FILE SYSTEM IS COMPLETELY FULL");
}
else if (redzone_state == FS_GREEN) {
snprintf(buf, bufsiz, "more than %d percent of total file system space", 2*tokudb_fs_reserve_percent);
}
else if (redzone_state == FS_YELLOW) {
snprintf(buf, bufsiz, "*** WARNING *** FILE SYSTEM IS GETTING FULL (less than %d percent free)", 2*tokudb_fs_reserve_percent);
}
else if (redzone_state == FS_RED){
snprintf(buf, bufsiz, "*** WARNING *** FILE SYSTEM IS GETTING VERY FULL (less than %d percent free): INSERTS ARE PROHIBITED", tokudb_fs_reserve_percent);
}
else {
snprintf(buf, bufsiz, "information unavailable, unknown redzone state %d", redzone_state);
}
STATPRINT ("disk free space", buf);
for (uint64_t row = 0; row < num_rows; row++) {
switch (mystat[row].type) {
case FS_STATE:
snprintf(buf, bufsiz, "%" PRIu64 "", mystat[row].value.num);
break;
case UINT64:
snprintf(buf, bufsiz, "%" PRIu64 "", mystat[row].value.num);
break;
case CHARSTR:
snprintf(buf, bufsiz, "%s", mystat[row].value.str);
break;
case UNIXTIME:
{
time_t t = mystat[row].value.num;
char tbuf[26];
snprintf(buf, bufsiz, "%.24s", ctime_r(&t, tbuf));
}
break;
case TOKUTIME:
{
double t = tokutime_to_seconds(mystat[row].value.num);
snprintf(buf, bufsiz, "%.6f", t);
}
break;
case PARCOUNT:
{
uint64_t v = read_partitioned_counter(mystat[row].value.parcount);
snprintf(buf, bufsiz, "%" PRIu64, v);
}
break;
default:
snprintf(buf, bufsiz, "UNKNOWN STATUS TYPE: %d", mystat[row].type);
break;
}
STATPRINT(mystat[row].legend, buf);
}
uint64_t bytes_inserted = read_partitioned_counter(tokudb_primary_key_bytes_inserted);
snprintf(buf, bufsiz, "%" PRIu64, bytes_inserted);
STATPRINT("handlerton: primary key bytes inserted", buf);
}
if (error) { my_errno = error; }
TOKUDB_DBUG_RETURN(error);
}
static void tokudb_checkpoint_lock(THD * thd) {
int error;
const char *old_proc_info;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) {
error = create_tokudb_trx_data_instance(&trx);
//
// can only fail due to memory allocation, so ok to assert
//
assert(!error);
thd_data_set(thd, tokudb_hton->slot, trx);
}
if (trx->checkpoint_lock_taken) {
goto cleanup;
}
//
// This can only fail if environment is not created, which is not possible
// in handlerton
//
old_proc_info = tokudb_thd_get_proc_info(thd);
thd_proc_info(thd, "Trying to grab checkpointing lock.");
error = db_env->checkpointing_postpone(db_env);
assert(!error);
thd_proc_info(thd, old_proc_info);
trx->checkpoint_lock_taken = true;
cleanup:
return;
}
static void tokudb_checkpoint_unlock(THD * thd) {
int error;
const char *old_proc_info;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) {
error = 0;
goto cleanup;
}
if (!trx->checkpoint_lock_taken) {
error = 0;
goto cleanup;
}
//
// at this point, we know the checkpoint lock has been taken
//
old_proc_info = tokudb_thd_get_proc_info(thd);
thd_proc_info(thd, "Trying to release checkpointing lock.");
error = db_env->checkpointing_resume(db_env);
assert(!error);
thd_proc_info(thd, old_proc_info);
trx->checkpoint_lock_taken = false;
cleanup:
return;
}
static bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * stat_print, enum ha_stat_type stat_type) {
switch (stat_type) {
case HA_ENGINE_STATUS:
return tokudb_show_engine_status(thd, stat_print);
break;
default:
break;
}
return false;
}
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
static void tokudb_handle_fatal_signal(handlerton *hton __attribute__ ((__unused__)), THD *thd __attribute__ ((__unused__)), int sig) {
if (tokudb_gdb_on_fatal) {
db_env_try_gdb_stack_trace(tokudb_gdb_path);
}
}
#endif
static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer) {
sql_print_error("%s: %s", db_errpfx, buffer);
}
static void tokudb_cleanup_log_files(void) {
TOKUDB_DBUG_ENTER("");
char **names;
int error;
if ((error = db_env->txn_checkpoint(db_env, 0, 0, 0)))
my_error(ER_ERROR_DURING_CHECKPOINT, MYF(0), error);
if ((error = db_env->log_archive(db_env, &names, 0)) != 0) {
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
db_env->err(db_env, error, "log_archive");
DBUG_VOID_RETURN;
}
if (names) {
char **np;
for (np = names; *np; ++np) {
#if 1
if (tokudb_debug)
TOKUDB_TRACE("cleanup:%s", *np);
#else
my_delete(*np, MYF(MY_WME));
#endif
}
free(names);
}
DBUG_VOID_RETURN;
}
// options flags
// PLUGIN_VAR_THDLOCAL Variable is per-connection
// PLUGIN_VAR_READONLY Server variable is read only
// PLUGIN_VAR_NOSYSVAR Not a server variable
// PLUGIN_VAR_NOCMDOPT Not a command line option
// PLUGIN_VAR_NOCMDARG No argument for cmd line
// PLUGIN_VAR_RQCMDARG Argument required for cmd line
// PLUGIN_VAR_OPCMDARG Argument optional for cmd line
// PLUGIN_VAR_MEMALLOC String needs memory allocated
// system variables
static void tokudb_cleaner_period_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) {
ulong * cleaner_period = (ulong *) var;
*cleaner_period = *(const ulonglong *) save;
int r = db_env->cleaner_set_period(db_env, *cleaner_period);
assert(r == 0);
}
#define DEFAULT_CLEANER_PERIOD 1
static MYSQL_SYSVAR_ULONG(cleaner_period, tokudb_cleaner_period,
0, "TokuDB cleaner_period",
NULL, tokudb_cleaner_period_update, DEFAULT_CLEANER_PERIOD,
0, ~0UL, 0);
static void tokudb_cleaner_iterations_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) {
ulong * cleaner_iterations = (ulong *) var;
*cleaner_iterations = *(const ulonglong *) save;
int r = db_env->cleaner_set_iterations(db_env, *cleaner_iterations);
assert(r == 0);
}
#define DEFAULT_CLEANER_ITERATIONS 5
static MYSQL_SYSVAR_ULONG(cleaner_iterations, tokudb_cleaner_iterations,
0, "TokuDB cleaner_iterations",
NULL, tokudb_cleaner_iterations_update, DEFAULT_CLEANER_ITERATIONS,
0, ~0UL, 0);
static void tokudb_checkpointing_period_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) {
uint * checkpointing_period = (uint *) var;
*checkpointing_period = *(const ulonglong *) save;
int r = db_env->checkpointing_set_period(db_env, *checkpointing_period);
assert(r == 0);
}
static MYSQL_SYSVAR_UINT(checkpointing_period, tokudb_checkpointing_period,
0, "TokuDB Checkpointing period",
NULL, tokudb_checkpointing_period_update, 60,
0, ~0U, 0);
static MYSQL_SYSVAR_BOOL(directio, tokudb_directio,
PLUGIN_VAR_READONLY,
"TokuDB Enable Direct I/O ",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(checkpoint_on_flush_logs, tokudb_checkpoint_on_flush_logs,
0,
"TokuDB Checkpoint on Flush Logs ",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_ULONGLONG(cache_size, tokudb_cache_size,
PLUGIN_VAR_READONLY, "TokuDB cache table size", NULL, NULL, 0,
0, ~0ULL, 0);
static MYSQL_SYSVAR_ULONGLONG(max_lock_memory, tokudb_max_lock_memory, PLUGIN_VAR_READONLY, "TokuDB max memory for locks", NULL, NULL, 0, 0, ~0ULL, 0);
static MYSQL_SYSVAR_ULONG(debug, tokudb_debug, 0, "TokuDB Debug", NULL, NULL, 0, 0, ~0UL, 0);
static MYSQL_SYSVAR_STR(log_dir, tokudb_log_dir, PLUGIN_VAR_READONLY, "TokuDB Log Directory", NULL, NULL, NULL);
static MYSQL_SYSVAR_STR(data_dir, tokudb_data_dir, PLUGIN_VAR_READONLY, "TokuDB Data Directory", NULL, NULL, NULL);
static MYSQL_SYSVAR_STR(version, tokudb_version, PLUGIN_VAR_READONLY, "TokuDB Version", NULL, NULL, NULL);
static MYSQL_SYSVAR_UINT(init_flags, tokudb_init_flags, PLUGIN_VAR_READONLY, "Sets TokuDB DB_ENV->open flags", NULL, NULL, tokudb_init_flags, 0, ~0U, 0);
static MYSQL_SYSVAR_UINT(write_status_frequency, tokudb_write_status_frequency, 0, "TokuDB frequency that show processlist updates status of writes", NULL, NULL, 1000, 0, ~0U, 0);
static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0, "TokuDB frequency that show processlist updates status of reads", NULL, NULL, 10000, 0, ~0U, 0);
static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0);
static MYSQL_SYSVAR_STR(tmp_dir, tokudb_tmp_dir, PLUGIN_VAR_READONLY, "Tokudb Tmp Dir", NULL, NULL, NULL);
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
static MYSQL_SYSVAR_STR(gdb_path, tokudb_gdb_path, PLUGIN_VAR_READONLY|PLUGIN_VAR_RQCMDARG, "TokuDB path to gdb for extra debug info on fatal signal", NULL, NULL, "/usr/bin/gdb");
static MYSQL_SYSVAR_BOOL(gdb_on_fatal, tokudb_gdb_on_fatal, 0, "TokuDB enable gdb debug info on fatal signal", NULL, NULL, true);
#endif
static void tokudb_fsync_log_period_update(THD *thd, struct st_mysql_sys_var *sys_var, void *var, const void *save) {
uint32 *period = (uint32 *) var;
*period = *(const ulonglong *) save;
db_env->change_fsync_log_period(db_env, *period);
}
static MYSQL_SYSVAR_UINT(fsync_log_period, tokudb_fsync_log_period, 0, "TokuDB fsync log period", NULL, tokudb_fsync_log_period_update, 0, 0, ~0U, 0);
static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(cache_size),
MYSQL_SYSVAR(max_lock_memory),
MYSQL_SYSVAR(data_dir),
MYSQL_SYSVAR(log_dir),
MYSQL_SYSVAR(debug),
MYSQL_SYSVAR(commit_sync),
MYSQL_SYSVAR(lock_timeout),
MYSQL_SYSVAR(cleaner_period),
MYSQL_SYSVAR(cleaner_iterations),
MYSQL_SYSVAR(pk_insert_mode),
MYSQL_SYSVAR(load_save_space),
MYSQL_SYSVAR(disable_slow_alter),
MYSQL_SYSVAR(disable_hot_alter),
MYSQL_SYSVAR(alter_print_error),
MYSQL_SYSVAR(create_index_online),
MYSQL_SYSVAR(disable_prefetching),
MYSQL_SYSVAR(version),
MYSQL_SYSVAR(init_flags),
MYSQL_SYSVAR(checkpointing_period),
MYSQL_SYSVAR(prelock_empty),
MYSQL_SYSVAR(checkpoint_lock),
MYSQL_SYSVAR(write_status_frequency),
MYSQL_SYSVAR(read_status_frequency),
MYSQL_SYSVAR(fs_reserve_percent),
MYSQL_SYSVAR(tmp_dir),
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(read_block_size),
MYSQL_SYSVAR(read_buf_size),
MYSQL_SYSVAR(row_format),
MYSQL_SYSVAR(directio),
MYSQL_SYSVAR(checkpoint_on_flush_logs),
#if TOKU_INCLUDE_UPSERT
MYSQL_SYSVAR(disable_slow_update),
MYSQL_SYSVAR(disable_slow_upsert),
#endif
MYSQL_SYSVAR(analyze_time),
MYSQL_SYSVAR(fsync_log_period),
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
MYSQL_SYSVAR(gdb_path),
MYSQL_SYSVAR(gdb_on_fatal),
#endif
MYSQL_SYSVAR(last_lock_timeout),
MYSQL_SYSVAR(lock_timeout_debug),
MYSQL_SYSVAR(loader_memory_size),
MYSQL_SYSVAR(hide_default_row_format),
MYSQL_SYSVAR(killed_time),
NULL
};
struct st_mysql_storage_engine tokudb_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION };
static struct st_mysql_information_schema tokudb_file_map_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_file_map_field_info[] = {
{"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"table_schema", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"table_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"table_dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
static int tokudb_file_map(TABLE *table, THD *thd) {
int error;
DB_TXN* txn = NULL;
DBC* tmp_cursor = NULL;
DBT curr_key;
DBT curr_val;
memset(&curr_key, 0, sizeof curr_key);
memset(&curr_val, 0, sizeof curr_val);
error = txn_begin(db_env, 0, &txn, DB_READ_UNCOMMITTED, thd);
if (error) {
goto cleanup;
}
error = db_env->get_cursor_for_directory(db_env, txn, &tmp_cursor);
if (error) {
goto cleanup;
}
while (error == 0) {
error = tmp_cursor->c_get(tmp_cursor, &curr_key, &curr_val, DB_NEXT);
if (!error) {
// We store the NULL terminator in the directory so it's included in the size.
// See #5789
// Recalculate and check just to be safe.
const char *dname = (const char *) curr_key.data;
size_t dname_len = strlen(dname);
assert(dname_len == curr_key.size - 1);
table->field[0]->store(dname, dname_len, system_charset_info);
const char *iname = (const char *) curr_val.data;
size_t iname_len = strlen(iname);
assert(iname_len == curr_val.size - 1);
table->field[1]->store(iname, iname_len, system_charset_info);
// denormalize the dname
const char *database_name = NULL;
size_t database_len = 0;
const char *table_name = NULL;
size_t table_len = 0;
const char *dictionary_name = NULL;
size_t dictionary_len = 0;
database_name = strchr(dname, '/');
if (database_name) {
database_name += 1;
table_name = strchr(database_name, '/');
if (table_name) {
database_len = table_name - database_name;
table_name += 1;
dictionary_name = strchr(table_name, '-');
if (dictionary_name) {
table_len = dictionary_name - table_name;
dictionary_name += 1;
dictionary_len = strlen(dictionary_name);
}
}
}
table->field[2]->store(database_name, database_len, system_charset_info);
table->field[3]->store(table_name, table_len, system_charset_info);
table->field[4]->store(dictionary_name, dictionary_len, system_charset_info);
error = schema_table_store_record(thd, table);
}
}
if (error == DB_NOTFOUND) {
error = 0;
}
cleanup:
if (tmp_cursor) {
int r = tmp_cursor->c_close(tmp_cursor);
assert(r == 0);
}
if (txn) {
commit_txn(txn, 0);
}
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_file_map_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_file_map_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
TABLE *table = tables->table;
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
error = tokudb_file_map(table, thd);
}
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_file_map_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_file_map_field_info;
schema->fill_table = tokudb_file_map_fill_table;
return 0;
}
static int tokudb_file_map_done(void *p) {
return 0;
}
static struct st_mysql_information_schema tokudb_fractal_tree_info_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_fractal_tree_info_field_info[] = {
{"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"bt_num_blocks_allocated", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"bt_num_blocks_in_use", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"bt_size_allocated", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"bt_size_in_use", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
static int tokudb_report_fractal_tree_info_for_db(const DBT *dname, const DBT *iname, TABLE *table, THD *thd) {
int error;
DB *db;
uint64_t bt_num_blocks_allocated;
uint64_t bt_num_blocks_in_use;
uint64_t bt_size_allocated;
uint64_t bt_size_in_use;
error = db_create(&db, db_env, 0);
if (error) {
goto exit;
}
error = db->open(db, NULL, (char *)dname->data, NULL, DB_BTREE, 0, 0666);
if (error) {
goto exit;
}
error = db->get_fractal_tree_info64(db,
&bt_num_blocks_allocated, &bt_num_blocks_in_use,
&bt_size_allocated, &bt_size_in_use);
{
int close_error = db->close(db, 0);
if (!error) {
error = close_error;
}
}
if (error) {
goto exit;
}
// We store the NULL terminator in the directory so it's included in the size.
// See #5789
// Recalculate and check just to be safe.
{
size_t dname_len = strlen((const char *)dname->data);
size_t iname_len = strlen((const char *)iname->data);
assert(dname_len == dname->size - 1);
assert(iname_len == iname->size - 1);
table->field[0]->store(
(char *)dname->data,
dname_len,
system_charset_info
);
table->field[1]->store(
(char *)iname->data,
iname_len,
system_charset_info
);
}
table->field[2]->store(bt_num_blocks_allocated, false);
table->field[3]->store(bt_num_blocks_in_use, false);
table->field[4]->store(bt_size_allocated, false);
table->field[5]->store(bt_size_in_use, false);
error = schema_table_store_record(thd, table);
exit:
return error;
}
static int tokudb_fractal_tree_info(TABLE *table, THD *thd) {
int error;
DB_TXN* txn = NULL;
DBC* tmp_cursor = NULL;
DBT curr_key;
DBT curr_val;
memset(&curr_key, 0, sizeof curr_key);
memset(&curr_val, 0, sizeof curr_val);
error = txn_begin(db_env, 0, &txn, DB_READ_UNCOMMITTED, thd);
if (error) {
goto cleanup;
}
error = db_env->get_cursor_for_directory(db_env, txn, &tmp_cursor);
if (error) {
goto cleanup;
}
while (error == 0) {
error = tmp_cursor->c_get(
tmp_cursor,
&curr_key,
&curr_val,
DB_NEXT
);
if (!error) {
error = tokudb_report_fractal_tree_info_for_db(&curr_key, &curr_val, table, thd);
}
}
if (error == DB_NOTFOUND) {
error = 0;
}
cleanup:
if (tmp_cursor) {
int r = tmp_cursor->c_close(tmp_cursor);
assert(r == 0);
}
if (txn) {
commit_txn(txn, 0);
}
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_fractal_tree_info_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_fractal_tree_info_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
TABLE *table = tables->table;
// 3938: Get a read lock on the status flag, since we must
// read it before safely proceeding
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
error = tokudb_fractal_tree_info(table, thd);
}
//3938: unlock the status flag lock
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_fractal_tree_info_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_fractal_tree_info_field_info;
schema->fill_table = tokudb_fractal_tree_info_fill_table;
return 0;
}
static int tokudb_fractal_tree_info_done(void *p) {
return 0;
}
static struct st_mysql_information_schema tokudb_fractal_tree_block_map_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_fractal_tree_block_map_field_info[] = {
{"dictionary_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"internal_file_name", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"checkpoint_count", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"blocknum", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"offset", 0, MYSQL_TYPE_LONGLONG, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
{"size", 0, MYSQL_TYPE_LONGLONG, 0, MY_I_S_MAYBE_NULL, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
struct tokudb_report_fractal_tree_block_map_iterator_extra {
int64_t num_rows;
int64_t i;
uint64_t *checkpoint_counts;
int64_t *blocknums;
int64_t *diskoffs;
int64_t *sizes;
};
// This iterator is called while holding the blocktable lock. We should be as quick as possible.
// We don't want to do one call to get the number of rows, release the blocktable lock, and then do another call to get all the rows because the number of rows may change if we don't hold the lock.
// As a compromise, we'll do some mallocs inside the lock on the first call, but everything else should be fast.
static int tokudb_report_fractal_tree_block_map_iterator(uint64_t checkpoint_count,
int64_t num_rows,
int64_t blocknum,
int64_t diskoff,
int64_t size,
void *iter_extra) {
struct tokudb_report_fractal_tree_block_map_iterator_extra *e = static_cast<struct tokudb_report_fractal_tree_block_map_iterator_extra *>(iter_extra);
assert(num_rows > 0);
if (e->num_rows == 0) {
e->checkpoint_counts = (uint64_t *) tokudb_my_malloc(num_rows * (sizeof *e->checkpoint_counts), MYF(MY_WME|MY_ZEROFILL|MY_FAE));
e->blocknums = (int64_t *) tokudb_my_malloc(num_rows * (sizeof *e->blocknums), MYF(MY_WME|MY_ZEROFILL|MY_FAE));
e->diskoffs = (int64_t *) tokudb_my_malloc(num_rows * (sizeof *e->diskoffs), MYF(MY_WME|MY_ZEROFILL|MY_FAE));
e->sizes = (int64_t *) tokudb_my_malloc(num_rows * (sizeof *e->sizes), MYF(MY_WME|MY_ZEROFILL|MY_FAE));
e->num_rows = num_rows;
}
e->checkpoint_counts[e->i] = checkpoint_count;
e->blocknums[e->i] = blocknum;
e->diskoffs[e->i] = diskoff;
e->sizes[e->i] = size;
++(e->i);
return 0;
}
static int tokudb_report_fractal_tree_block_map_for_db(const DBT *dname, const DBT *iname, TABLE *table, THD *thd) {
int error;
DB *db;
struct tokudb_report_fractal_tree_block_map_iterator_extra e = {}; // avoid struct initializers so that we can compile with older gcc versions
error = db_create(&db, db_env, 0);
if (error) {
goto exit;
}
error = db->open(db, NULL, (char *)dname->data, NULL, DB_BTREE, 0, 0666);
if (error) {
goto exit;
}
error = db->iterate_fractal_tree_block_map(db, tokudb_report_fractal_tree_block_map_iterator, &e);
{
int close_error = db->close(db, 0);
if (!error) {
error = close_error;
}
}
if (error) {
goto exit;
}
// If not, we should have gotten an error and skipped this section of code
assert(e.i == e.num_rows);
for (int64_t i = 0; error == 0 && i < e.num_rows; ++i) {
// We store the NULL terminator in the directory so it's included in the size.
// See #5789
// Recalculate and check just to be safe.
size_t dname_len = strlen((const char *)dname->data);
size_t iname_len = strlen((const char *)iname->data);
assert(dname_len == dname->size - 1);
assert(iname_len == iname->size - 1);
table->field[0]->store(
(char *)dname->data,
dname_len,
system_charset_info
);
table->field[1]->store(
(char *)iname->data,
iname_len,
system_charset_info
);
table->field[2]->store(e.checkpoint_counts[i], false);
table->field[3]->store(e.blocknums[i], false);
static const int64_t freelist_null = -1;
static const int64_t diskoff_unused = -2;
if (e.diskoffs[i] == diskoff_unused || e.diskoffs[i] == freelist_null) {
table->field[4]->set_null();
} else {
table->field[4]->set_notnull();
table->field[4]->store(e.diskoffs[i], false);
}
static const int64_t size_is_free = -1;
if (e.sizes[i] == size_is_free) {
table->field[5]->set_null();
} else {
table->field[5]->set_notnull();
table->field[5]->store(e.sizes[i], false);
}
error = schema_table_store_record(thd, table);
}
exit:
if (e.checkpoint_counts != NULL) {
tokudb_my_free(e.checkpoint_counts);
e.checkpoint_counts = NULL;
}
if (e.blocknums != NULL) {
tokudb_my_free(e.blocknums);
e.blocknums = NULL;
}
if (e.diskoffs != NULL) {
tokudb_my_free(e.diskoffs);
e.diskoffs = NULL;
}
if (e.sizes != NULL) {
tokudb_my_free(e.sizes);
e.sizes = NULL;
}
return error;
}
static int tokudb_fractal_tree_block_map(TABLE *table, THD *thd) {
int error;
DB_TXN* txn = NULL;
DBC* tmp_cursor = NULL;
DBT curr_key;
DBT curr_val;
memset(&curr_key, 0, sizeof curr_key);
memset(&curr_val, 0, sizeof curr_val);
error = txn_begin(db_env, 0, &txn, DB_READ_UNCOMMITTED, thd);
if (error) {
goto cleanup;
}
error = db_env->get_cursor_for_directory(db_env, txn, &tmp_cursor);
if (error) {
goto cleanup;
}
while (error == 0) {
error = tmp_cursor->c_get(
tmp_cursor,
&curr_key,
&curr_val,
DB_NEXT
);
if (!error) {
error = tokudb_report_fractal_tree_block_map_for_db(&curr_key, &curr_val, table, thd);
}
}
if (error == DB_NOTFOUND) {
error = 0;
}
cleanup:
if (tmp_cursor) {
int r = tmp_cursor->c_close(tmp_cursor);
assert(r == 0);
}
if (txn) {
commit_txn(txn, 0);
}
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_fractal_tree_block_map_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_fractal_tree_block_map_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
TABLE *table = tables->table;
// 3938: Get a read lock on the status flag, since we must
// read it before safely proceeding
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
error = tokudb_fractal_tree_block_map(table, thd);
}
//3938: unlock the status flag lock
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_fractal_tree_block_map_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_fractal_tree_block_map_field_info;
schema->fill_table = tokudb_fractal_tree_block_map_fill_table;
return 0;
}
static int tokudb_fractal_tree_block_map_done(void *p) {
return 0;
}
static void tokudb_pretty_key(const DB *db, const DBT *key, const char *default_key, String *out) {
if (key->data == NULL) {
out->append(default_key);
} else {
bool do_hexdump = true;
if (do_hexdump) {
// hexdump the key
const unsigned char *data = reinterpret_cast<const unsigned char *>(key->data);
for (size_t i = 0; i < key->size; i++) {
char str[3];
snprintf(str, sizeof str, "%2.2x", data[i]);
out->append(str);
}
}
}
}
static void tokudb_pretty_left_key(const DB *db, const DBT *key, String *out) {
tokudb_pretty_key(db, key, "-infinity", out);
}
static void tokudb_pretty_right_key(const DB *db, const DBT *key, String *out) {
tokudb_pretty_key(db, key, "+infinity", out);
}
static const char *tokudb_get_index_name(DB *db) {
if (db != NULL) {
return db->get_dname(db);
} else {
return "$ydb_internal";
}
}
static int tokudb_equal_key(const DBT *left_key, const DBT *right_key) {
if (left_key->data == NULL || right_key->data == NULL || left_key->size != right_key->size)
return 0;
else
return memcmp(left_key->data, right_key->data, left_key->size) == 0;
}
static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid) {
THD *thd = current_thd;
if (!thd)
return;
ulong lock_timeout_debug = THDVAR(thd, lock_timeout_debug);
if (lock_timeout_debug != 0) {
// generate a JSON document with the lock timeout info
String log_str;
log_str.append("{");
log_str.append("\"mysql_thread_id\":");
log_str.append_ulonglong(thd->thread_id);
log_str.append(", \"dbname\":");
log_str.append("\""); log_str.append(tokudb_get_index_name(db)); log_str.append("\"");
log_str.append(", \"requesting_txnid\":");
log_str.append_ulonglong(requesting_txnid);
log_str.append(", \"blocking_txnid\":");
log_str.append_ulonglong(blocking_txnid);
if (tokudb_equal_key(left_key, right_key)) {
String key_str;
tokudb_pretty_key(db, left_key, "?", &key_str);
log_str.append(", \"key\":");
log_str.append("\""); log_str.append(key_str); log_str.append("\"");
} else {
String left_str;
tokudb_pretty_left_key(db, left_key, &left_str);
log_str.append(", \"key_left\":");
log_str.append("\""); log_str.append(left_str); log_str.append("\"");
String right_str;
tokudb_pretty_right_key(db, right_key, &right_str);
log_str.append(", \"key_right\":");
log_str.append("\""); log_str.append(right_str); log_str.append("\"");
}
log_str.append("}");
// set last_lock_timeout
if (lock_timeout_debug & 1) {
char *old_lock_timeout = THDVAR(thd, last_lock_timeout);
char *new_lock_timeout = tokudb_my_strdup(log_str.c_ptr(), MY_FAE);
THDVAR(thd, last_lock_timeout) = new_lock_timeout;
tokudb_my_free(old_lock_timeout);
#if TOKU_THDVAR_MEMALLOC_BUG
if (0) TOKUDB_TRACE("thd %p %p %p", thd, old_lock_timeout, new_lock_timeout);
tokudb_pthread_mutex_lock(&tokudb_map_mutex);
struct tokudb_map_pair old_key = { thd, old_lock_timeout };
tree_delete(&tokudb_map, &old_key, sizeof old_key, NULL);
struct tokudb_map_pair new_key = { thd, new_lock_timeout };
tree_insert(&tokudb_map, &new_key, sizeof new_key, NULL);
tokudb_pthread_mutex_unlock(&tokudb_map_mutex);
#endif
}
// dump to stderr
if (lock_timeout_debug & 2) {
TOKUDB_TRACE("%s", log_str.c_ptr());
}
}
}
static struct st_mysql_information_schema tokudb_trx_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_trx_field_info[] = {
{"trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"trx_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
struct tokudb_trx_extra {
THD *thd;
TABLE *table;
};
static int tokudb_trx_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
struct tokudb_trx_extra *e = reinterpret_cast<struct tokudb_trx_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
table->field[0]->store(txn_id, false);
table->field[1]->store(client_id, false);
int error = schema_table_store_record(thd, table);
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_trx_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_trx_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
struct tokudb_trx_extra e = { thd, tables->table };
error = db_env->iterate_live_transactions(db_env, tokudb_trx_callback, &e);
}
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_trx_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_trx_field_info;
schema->fill_table = tokudb_trx_fill_table;
return 0;
}
static int tokudb_trx_done(void *p) {
return 0;
}
static struct st_mysql_information_schema tokudb_lock_waits_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_lock_waits_field_info[] = {
{"requesting_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"blocking_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"lock_waits_dname", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"lock_waits_key_left", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"lock_waits_key_right", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"lock_waits_start_time", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
struct tokudb_lock_waits_extra {
THD *thd;
TABLE *table;
};
static int tokudb_lock_waits_callback(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key,
uint64_t blocking_txnid, uint64_t start_time, void *extra) {
struct tokudb_lock_waits_extra *e = reinterpret_cast<struct tokudb_lock_waits_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
table->field[0]->store(requesting_txnid, false);
table->field[1]->store(blocking_txnid, false);
const char *dname = tokudb_get_index_name(db);
size_t dname_length = strlen(dname);
table->field[2]->store(dname, dname_length, system_charset_info);
String left_str;
tokudb_pretty_left_key(db, left_key, &left_str);
table->field[3]->store(left_str.ptr(), left_str.length(), system_charset_info);
String right_str;
tokudb_pretty_right_key(db, right_key, &right_str);
table->field[4]->store(right_str.ptr(), right_str.length(), system_charset_info);
table->field[5]->store(start_time, false);
int error = schema_table_store_record(thd, table);
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_lock_waits_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_lock_waits_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
struct tokudb_lock_waits_extra e = { thd, tables->table };
error = db_env->iterate_pending_lock_requests(db_env, tokudb_lock_waits_callback, &e);
}
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_lock_waits_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_lock_waits_field_info;
schema->fill_table = tokudb_lock_waits_fill_table;
return 0;
}
static int tokudb_lock_waits_done(void *p) {
return 0;
}
static struct st_mysql_information_schema tokudb_locks_information_schema = { MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
static ST_FIELD_INFO tokudb_locks_field_info[] = {
{"locks_trx_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"locks_mysql_thread_id", 0, MYSQL_TYPE_LONGLONG, 0, 0, NULL, SKIP_OPEN_TABLE },
{"locks_dname", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"locks_key_left", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{"locks_key_right", 256, MYSQL_TYPE_STRING, 0, 0, NULL, SKIP_OPEN_TABLE },
{NULL, 0, MYSQL_TYPE_NULL, 0, 0, NULL, SKIP_OPEN_TABLE}
};
struct tokudb_locks_extra {
THD *thd;
TABLE *table;
};
static int tokudb_locks_callback(uint64_t txn_id, uint64_t client_id, iterate_row_locks_callback iterate_locks, void *locks_extra, void *extra) {
struct tokudb_locks_extra *e = reinterpret_cast<struct tokudb_locks_extra *>(extra);
THD *thd = e->thd;
TABLE *table = e->table;
int error = 0;
DB *db;
DBT left_key, right_key;
while (error == 0 && iterate_locks(&db, &left_key, &right_key, locks_extra) == 0) {
table->field[0]->store(txn_id, false);
table->field[1]->store(client_id, false);
const char *dname = tokudb_get_index_name(db);
size_t dname_length = strlen(dname);
table->field[2]->store(dname, dname_length, system_charset_info);
String left_str;
tokudb_pretty_left_key(db, &left_key, &left_str);
table->field[3]->store(left_str.ptr(), left_str.length(), system_charset_info);
String right_str;
tokudb_pretty_right_key(db, &right_key, &right_str);
table->field[4]->store(right_str.ptr(), right_str.length(), system_charset_info);
error = schema_table_store_record(thd, table);
}
return error;
}
#if MYSQL_VERSION_ID >= 50600
static int tokudb_locks_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
static int tokudb_locks_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) {
#endif
TOKUDB_DBUG_ENTER("");
int error;
rw_rdlock(&tokudb_hton_initialized_lock);
if (!tokudb_hton_initialized) {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "TokuDB");
error = -1;
} else {
struct tokudb_locks_extra e = { thd, tables->table };
error = db_env->iterate_live_transactions(db_env, tokudb_locks_callback, &e);
}
rw_unlock(&tokudb_hton_initialized_lock);
TOKUDB_DBUG_RETURN(error);
}
static int tokudb_locks_init(void *p) {
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
schema->fields_info = tokudb_locks_field_info;
schema->fill_table = tokudb_locks_fill_table;
return 0;
}
static int tokudb_locks_done(void *p) {
return 0;
}
enum { TOKUDB_PLUGIN_VERSION = 0x0400 };
#define TOKUDB_PLUGIN_VERSION_STR "1024"
// Retrieves variables for information_schema.global_status.
// Names (columnname) are automatically converted to upper case, and prefixed with "TOKUDB_"
static int show_tokudb_vars(THD *thd, SHOW_VAR *var, char *buff) {
TOKUDB_DBUG_ENTER("");
int error;
uint64_t panic;
const int panic_string_len = 1024;
char panic_string[panic_string_len] = {'\0'};
fs_redzone_state redzone_state;
uint64_t num_rows;
error = db_env->get_engine_status (db_env, toku_global_status_rows, toku_global_status_max_rows, &num_rows, &redzone_state, &panic, panic_string, panic_string_len, TOKU_GLOBAL_STATUS);
//TODO: Maybe do something with the panic output?
if (error == 0) {
assert(num_rows <= toku_global_status_max_rows);
//TODO: Maybe enable some of the items here: (copied from engine status
//TODO: (optionally) add redzone state, panic, panic string, etc. Right now it's being ignored.
for (uint64_t row = 0; row < num_rows; row++) {
SHOW_VAR &status_var = toku_global_status_variables[row];
TOKU_ENGINE_STATUS_ROW_S &status_row = toku_global_status_rows[row];
status_var.name = status_row.columnname;
switch (status_row.type) {
case FS_STATE:
case UINT64:
status_var.type = SHOW_LONGLONG;
status_var.value = (char*)&status_row.value.num;
break;
case CHARSTR:
status_var.type = SHOW_CHAR;
status_var.value = (char*)status_row.value.str;
break;
case UNIXTIME:
{
status_var.type = SHOW_CHAR;
time_t t = status_row.value.num;
char tbuf[26];
// Reuse the memory in status_row. (It belongs to us).
snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "%.24s", ctime_r(&t, tbuf));
status_var.value = (char*)&status_row.value.datebuf[0];
}
break;
case TOKUTIME:
{
status_var.type = SHOW_DOUBLE;
double t = tokutime_to_seconds(status_row.value.num);
// Reuse the memory in status_row. (It belongs to us).
status_row.value.dnum = t;
status_var.value = (char*)&status_row.value.dnum;
}
break;
case PARCOUNT:
{
status_var.type = SHOW_LONGLONG;
uint64_t v = read_partitioned_counter(status_row.value.parcount);
// Reuse the memory in status_row. (It belongs to us).
status_row.value.num = v;
status_var.value = (char*)&status_row.value.num;
}
break;
default:
{
status_var.type = SHOW_CHAR;
// Reuse the memory in status_row.datebuf. (It belongs to us).
// UNKNOWN TYPE: %d fits in 26 bytes (sizeof datebuf) for any integer.
snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "UNKNOWN TYPE: %d", status_row.type);
status_var.value = (char*)&status_row.value.datebuf[0];
}
break;
}
}
// Sentinel value at end.
toku_global_status_variables[num_rows].type = SHOW_LONG;
toku_global_status_variables[num_rows].value = (char*)NullS;
toku_global_status_variables[num_rows].name = (char*)NullS;
var->type= SHOW_ARRAY;
var->value= (char *) toku_global_status_variables;
}
if (error) { my_errno = error; }
TOKUDB_DBUG_RETURN(error);
}
static SHOW_VAR toku_global_status_variables_export[]= {
{"Tokudb", (char*)&show_tokudb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
};
mysql_declare_plugin(tokudb)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&tokudb_storage_engine,
tokudb_hton_name,
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_init_func, /* plugin init */
tokudb_done_func, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
toku_global_status_variables_export, /* status variables */
tokudb_system_variables, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_trx_information_schema,
"TokuDB_trx",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_trx_init, /* plugin init */
tokudb_trx_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_lock_waits_information_schema,
"TokuDB_lock_waits",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_lock_waits_init, /* plugin init */
tokudb_lock_waits_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_locks_information_schema,
"TokuDB_locks",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_locks_init, /* plugin init */
tokudb_locks_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_file_map_information_schema,
"TokuDB_file_map",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_file_map_init, /* plugin init */
tokudb_file_map_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_fractal_tree_info_information_schema,
"TokuDB_fractal_tree_info",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_fractal_tree_info_init, /* plugin init */
tokudb_fractal_tree_info_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_fractal_tree_block_map_information_schema,
"TokuDB_fractal_tree_block_map",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_fractal_tree_block_map_init, /* plugin init */
tokudb_fractal_tree_block_map_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL, /* config options */
#if MYSQL_VERSION_ID >= 50521
0, /* flags */
#endif
}
mysql_declare_plugin_end;
#ifdef MARIA_PLUGIN_INTERFACE_VERSION
maria_declare_plugin(tokudb)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&tokudb_storage_engine,
tokudb_hton_name,
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_init_func, /* plugin init */
tokudb_done_func, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
toku_global_status_variables_export, /* status variables */
tokudb_system_variables, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_trx_information_schema,
"TokuDB_trx",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_trx_init, /* plugin init */
tokudb_trx_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_lock_waits_information_schema,
"TokuDB_lock_waits",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_lock_waits_init, /* plugin init */
tokudb_lock_waits_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_locks_information_schema,
"TokuDB_locks",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_locks_init, /* plugin init */
tokudb_locks_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_file_map_information_schema,
"TokuDB_file_map",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_file_map_init, /* plugin init */
tokudb_file_map_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_fractal_tree_info_information_schema,
"TokuDB_fractal_tree_info",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_fractal_tree_info_init, /* plugin init */
tokudb_fractal_tree_info_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&tokudb_fractal_tree_block_map_information_schema,
"TokuDB_fractal_tree_block_map",
"Tokutek Inc",
"Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology",
PLUGIN_LICENSE_GPL,
tokudb_fractal_tree_block_map_init, /* plugin init */
tokudb_fractal_tree_block_map_done, /* plugin deinit */
TOKUDB_PLUGIN_VERSION, /* 4.0.0 */
NULL, /* status variables */
NULL, /* system variables */
TOKUDB_PLUGIN_VERSION_STR, /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
}
maria_declare_plugin_end;
#endif
| SunguckLee/MariaDB | storage/tokudb/hatoku_hton.cc | C++ | gpl-2.0 | 90,471 |
//GoodGBX - 1.020.0.dat
char long_name[255];
#define DATROMS (2995+3501)
#define GBC_ROMS 2995
struct { int crc; int size; char name[255]; } MyDat[DATROMS]={
//GBC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{0x204e2ceb,1048486,"1942 (U) [C][b1]"},
{0x1d7640cb,1048576,"720 (U) [C][b1]"},
{0x2a0e4db1,1048576,"720 (U) [C][b2]"},
{0x9469d766,245760,"720 (U) [C][b3]"},
{0x3900677d,1048565,"Bardigun (J) [C][b1]"},
{0x418a57f7,524288,"Bardigun (J) [C][b2]"},
{0x71eaf856,1048576,"Bardigun (J) [C][b3]"},
{0x964cd4f4,1048576,"B-Daman Bakugaiden - Victory eno Michi (J) [C][b1]"},
{0x9e03ed9a,983040,"B-Daman Bakugaiden V - Final Mega Tune (J) [C][b1]"},
{0x23e4f4ff,188773,"Beat Mania GB (J) [C][b1]"},
{0x22cefe5a,215328,"Beat Mania GB (J) [C][b2]"},
{0xb7d3b4df,1048576,"Beat Mania GB (J) [C][b3]"},
{0x59beb372,1048576,"Beat Mania GB 2 (J) [C][b1]"},
{0x98887c26,819200,"Billy Bob's Huntin' 'n' Fishin' (U) [C][b1]"},
{0xa7415b80,262144,"Blades of Steel (U) [C][b1]"},
{0xbfdf7a8c,1048576,"Bomberman Quest (J) [C][b1]"},
{0xf4de6802,1048576,"Bomberman Quest (J) [C][b2]"},
{0x6319acf7,1048576,"Bomberman Quest (J) [C][b3]"},
{0x7a721a22,131072,"Buffy - The Vampire Slayer (U) [C][b1]"},
{0xe401ca3f,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][b1]"},
{0x6480c37a,1048577,"Bugs Bunny - Crazy Castle 3 (J) [C][b2]"},
{0x80e6706e,524288,"Bugs Bunny - Crazy Castle 3 (J) [C][b3]"},
{0xbc310b5f,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][b4]"},
{0x003388a5,524288,"Bugs Bunny - Operation Carrots (E) (M6) [C][b1]"},
{0xe245fa39,1048576,"Bugs Bunny - Operation Carrots (E) (M6) [C][b2]"},
{0x94d22458,1048576,"Bug's Life, A (E) [C][b1]"},
{0x0c1f8c96,1048576,"Bug's Life, A (U) [C][b1]"},
{0xad1388e1,1048576,"Burger Paradise (J) [C][b1]"},
{0xac5ab5f7,1048576,"Caesar's Palace II (U) [C][b1]"},
{0x7a6716dd,131072,"Centipede (U) [C][b1]"},
{0xddf9137b,524288,"Clay Pidgeon Shooting by Jim Bagley (PD) [C][b1]"},
{0xe097ce67,262144,"Donkey Kong 5 [C][b1]"},
{0x4c539cad,1048576,"Doraemon Kart 2 (J) [C][b1]"},
{0x0b996495,1048576,"Doraemon Kart 2 (J) [C][b2]"},
{0x15d99fd6,197283,"Dragon Quest Monsters (V1.16) (J) [C][b1]"},
{0xfc2c375d,1048576,"Duke Nukem (E) (M5) [C][b1]"},
{0xae6c2e6a,2097152,"F-1 World Grand Prix (E) (M4) [C][b1]"},
{0x7c6d77b6,1048888,"F-18 Thunder Strike (E) [C][b1]"},
{0x250e3495,1048576,"Fairy Kitty (J) [C][b1]"},
{0x94622f98,1048609,"Fairy Kitty (J) [C][b2]"},
{0xed20bfb6,1048576,"Fairy Kitty (J) [C][b3]"},
{0xb902b1cc,131072,"Frogger (U) [C][b1]"},
{0x222cb93e,524288,"Frogger (U) [C][b2]"},
{0xd3622d56,524288,"Gameboy Color Promotional Demo (J) [C][b1]"},
{0x42bdf31b,524288,"Gameboy Wars 2 (J) [C][b1]"},
{0x6d6ff69d,1048576,"Ganbare Goemon Teng (J) [C][b1]"},
{0x0f4421c2,1048576,"Gex - Enter the Gecko (U) [C][b1]"},
{0x4fd5228d,524288,"Ghosts 'N Goblins (U) [C][b1]"},
{0xaecb53e8,1048576,"Glocal Hexcite (J) [C][b1]"},
{0x36cb189d,262144,"Glocal Hexcite (J) [C][b2]"},
{0x30064931,524288,"Glocal Hexcite (J) [C][b3]"},
{0x432dc371,1048576,"Grinch, The (J) [C][b1]"},
{0xc0162de3,1048576,"Harvest Moon GB (E) [C][b1]"},
{0xc9d2ae9c,524800,"Harvest Moon GB (G) [C][b1]"},
{0xf6768930,1048576,"Hello Kitty Magical Museum (J) [C][b1]"},
{0x4ea5127d,262144,"Hexcite (U) [C][b1]"},
{0xb5839a21,131072,"Highway Racing, The (J) [C][b1]"},
{0x4bc200c0,1048576,"Hollywood Pinball (UE) (M4) [C][b1][t1]"},
{0x7ca952b6,1048576,"Hugo 2.5 (G) [C][b1]"},
{0xd11253c4,557056,"J. League Excite Stage GB (J) [C][b1]"},
{0x20bf6b3d,491520,"Joryu Janshi Ni Chousen (J) [C][b1]"},
{0xa1f14acf,1048576,"Joust & Defender (U) [C][b1]"},
{0x0b4a2e77,1048576,"Kadume Monsters (J) [C][b1]"},
{0x0c1dfd38,1376256,"Kanji Boy (J) [C][b1]"},
{0xaa8f041d,1048576,"Karamucho Sawag (J) [C][b1]"},
{0x312ca2a3,1048576,"Kaseki Reborn II Monster Digger (J) [C][b1]"},
{0x06c85ad1,1048576,"Ken Griffey Jrs' Slugfest (U) [C][b1]"},
{0x82a2dad8,1048576,"Legend of the River King GB (E) (Pack in Video) [C][b1]"},
{0x8aad7092,1048576,"Legend of the River King GB (E) (Pack in Video) [C][b2]"},
{0x1848bf49,1051452,"Legend of Zelda, The - Link's Awakening DX (V1.0) (J) [C][b1]"},
{0x68accfe1,524288,"Lodoss War GB (J) [C][b1]"},
{0x1448abaf,524288,"Luca's Puzzle Adventure (J) [C][b1]"},
{0x4dfab0e5,1048576,"Mahjong Quest (J) [C][b1]"},
{0x363f2de5,524288,"Medarot 2 - Kabuto (J) [C][b1]"},
{0x0984c1b7,524288,"Medarot 2 - Kuwagata (J) [C][b1]"},
{0x063ed122,524290,"Medarot 2 - Kuwagata (J) [C][b2]"},
{0x79b981c0,1048576,"Men In Black - The Series (U) [C][b1]"},
{0x6e9f1a49,1048576,"Men In Black - The Series (U) [C][b2]"},
{0x6570e700,4194304,"Metal Gear Solid (E) (M5) [C][b1]"},
{0xdcd5d5f4,524288,"Monopoly (J) [C][b2]"},
{0x2940d0f3,1058522,"Monster Race 2 (J) [C][b1]"},
{0x61dedc1b,327680,"Montezuma's Return (U) (M2) [C][b1]"},
{0xd200e702,524288,"Montezuma's Return (U) (M2) [C][b2]"},
{0x95a53a0d,950272,"Moon Patrol & Spy Hunter (U) [C][b1]"},
{0x0bdb132e,983040,"Moon Patrol & Spy Hunter (U) [C][b2]"},
{0x84f70ed4,589824,"Mortal Kombat 4 (E) (no blood) [C][b1]"},
{0xcf5e8397,1048576,"Mortal Kombat 4 (U) [C][b1]"},
{0x8479807a,1048576,"Mr. Driller (J) [C][b1][t1]"},
{0xa39bebe4,1048576,"NBA Jam '99 (UE) [C][b1]"},
{0x67d5dd41,294912,"NBA Showtime - NBA on NBC (U) [C][b1]"},
{0xab31bbf3,393216,"NBA Showtime - NBA on NBC (U) [C][b2]"},
{0xed14dd33,988936,"New Adventures of Mary-Kate and Ashley, The (U) [C][b1]"},
{0x93d05b98,398336,"Nobunaga's Ambition 2 (J) [C][b1]"},
{0xf657dab7,1048576,"Ojarumaru (J) [C][b1]"},
{0x1d2b74b2,1048576,"Oodorobou Jing Devil (J) [C][b1]"},
{0x37196d30,1048576,"Oodorobou Jing Devil (J) [C][b2]"},
{0xe7eb258e,1048576,"Othello 2000 (J) [C][b1]"},
{0x0fedda07,1048576,"Pitfall - Beyond the Jungle (U) [C][b1]"},
{0x84ad2dbe,1048576,"Pocket Bomberman (U) [C][b1]"},
{0xc0a1b10d,524288,"Pocket Bomberman (U) [C][b2]"},
{0xbdc55ac0,524288,"Pocket Bomberman (U) [C][b3]"},
{0xb7b8fc64,1048576,"Pocket Bomberman (U) [C][b4]"},
{0xb534fa23,262144,"Pocket Hanafuda (J) [C][b1]"},
{0xf5780f4b,2097152,"Pocket Monsters Crystal Glass (J) [C][b1]"},
{0xd639ebfa,1048571,"Pocket Monsters Gold (V1.0) (J) [C][b1]"},
{0x2304b7f7,89960,"Pocket Monsters Gold (V1.0) (J) [C][b2]"},
{0x2da2f083,1048576,"Pocket Monsters Gold (V1.0) (J) [C][b3]"},
{0xa6e448be,1048576,"Pocket Monsters Gold (V1.0) (J) [C][b4]"},
{0xc08001af,1048576,"Pocket Monsters Pinball (J) [C][b1]"},
{0x51f2584c,1048576,"Pocket Monsters Pinball (J) [C][b2]"},
{0x1d0f3a78,1048576,"Pocket Monsters Silver (V1.0) (J) [C][b1]"},
{0xb35a96dc,1048576,"Pocket Monsters Trading Card Game (J) [C][b1]"},
{0xdd19460e,1048576,"Pocket Monsters Trading Card Game (J) [C][b2]"},
{0x74a63c3d,1048576,"Pocket Monsters Trading Card Game (J) [C][b3]"},
{0x86adfde1,1048576,"Pocket Monsters Trading Card Game (J) [C][b4]"},
{0x5c263190,1048576,"Pocket Puyo Sun (J) [C][b1]"},
{0xede23e49,1048576,"Pocket Puyo Sun (J) [C][b2]"},
{0x6b7e36d2,1048585,"Pokemon Pinball (U) [C][b1]"},
{0xb6a4ea28,1048605,"Pokemon Trading Card Game (U) [C][b1]"},
{0x5846a2a2,1048576,"Power Quest (E) (M6) [C][b1]"},
{0xbcdc6d37,2097152,"Poyon's Dungeon Room (J) [C][b1]"},
{0x9f340610,1048576,"Quest for Camelot (U) (M3) [C][b1]"},
{0x2fdd46b3,524288,"Rats! (UE) (M2) [C][b1]"},
{0x5ac2a67e,1048576,"Robopon Star (J) [C][b1]"},
{0xa3d7c8c1,1048576,"Rockman X (J) [C][b1]"},
{0xf024f152,1048576,"R-Type DX (U) [C][b1]"},
{0xe437c06e,1048576,"Rugrats - Time Travelers (U) [C][b1]"},
{0x8d79efec,1048576,"Rugrats Movie, The (U) [C][b1]"},
{0x07aa8468,1048576,"Sanrio Timenet Future (J) [C][b1]"},
{0xd915b4c2,1048576,"Sanrio Timenet Past (J) [C][b1]"},
{0x4cd55ff7,458752,"Sanrio Timenet Past (J) [C][b2]"},
{0xc8e1c506,1048576,"Senkai Imonroku Junteitaisen (J) [C][b1]"},
{0xc6ce2427,32768,"SGB Pack (PD) [C][b1]"},
{0xcac1f6c0,847556,"Shadowgate Classic (V1.0) (E) (M5) [C][b1]"},
{0x9b5f3b08,1048576,"Shadowgate Classic (V1.0) (E) (M5) [C][b2]"},
{0x3f5a6bf8,524288,"Shanghai Pocket (J) [C][b1]"},
{0xcb6fb00b,1048576,"Shanghai Pocket (J) [C][b2]"},
{0x4171177a,524288,"Sonic 7 (Unl) [C][b1]"},
{0x5228a682,1048576,"Spy vs Spy (U) [C][b1]"},
{0xba2234b5,1048576,"Spy vs Spy (U) [C][b1][t1]"},
{0x5e01a520,1048576,"Street Fighter Alpha (E) [C][b1]"},
{0x8e04bd16,131072,"Super Breakout! (U) [C][b1]"},
{0xcded962b,524288,"Super Breakout! (U) [C][b2]"},
{0xd60d7cb9,2097152,"Super Fighters '99 (Unl) (J) [C][b1]"},
{0x2dcc03aa,1048576,"Super Mario Bros. DX (V1.0) (U) [C][b1]"},
{0x730ea73d,868352,"Super Robot Wars Link Battler (J) [C][b1]"},
{0x71987ef1,1048576,"Sweet Ange (J) [C][b1]"},
{0x9b7a916e,524288,"Sylvester and Tweety (E) (M3) [C][b1]"},
{0x22b37f16,950058,"Sylvester and Tweety (E) (M3) [C][b2]"},
{0x192fe094,1048576,"Sylvester and Tweety (E) (M3) [C][b3]"},
{0x4e8e08c7,524288,"Sylvester and Tweety (E) (M6) [C][b1]"},
{0x33d466ab,1048576,"Sylvester and Tweety (E) (M6) [C][b2]"},
{0x3f244d34,2097152,"Tarzan (U) [C][b1]"},
{0xef94e6fa,524288,"Tetris DX (JU) [C][b1]"},
{0x56a6586b,32805,"Titney High Colour Demo (PD) [C][b1]"},
{0x0649df69,2031616,"Tokimeki Sport (J) [C][b1]"},
{0xed82760d,1048576,"Tom & Jerry - Mouse Hunt (E) (M5) [C][b1][t1]"},
{0xfbf9f10d,1048576,"Tonka Raceway (U) [C][b1]"},
{0xddaf1c02,1048576,"Top Gear Pocket (U) [C][b1]"},
{0x254d2148,1048576,"Track & Field GB (J) [C][b1]"},
{0x3a7cb5ef,524288,"Turok 2 - Seeds of Evil (U) (M4) [C][b1]"},
{0x2ab63d00,1048576,"Turok 2 - Seeds of Evil (U) (M4) [C][b2]"},
{0x75faa0b5,262144,"V-Rally - Championship Edition (E) (M3) [C][b1]"},
{0x3fb66738,2097152,"Warioland 2 (J) [C][b1]"},
{0x4166c1df,2097152,"Warioland 2 (U) [C][b1]"},
{0x21039393,2097152,"Warioland 2 (U) [C][b2]"},
{0x14b60ce1,1048576,"World Soccer GB 2 (J) [C][b1]"},
{0x60e8f86c,1048576,"WWF Attitude (U) [C][b1]"},
{0x09de995b,528384,"Yoda Stories (U) [C][b1]"},
{0xa0503993,1047550,"R-Type DX (U) [C][b2]"},
{0x6c3ff6e7,1050732,"Spirou La Panque Mecanique (E) (M7) [C][b1]"},
{0xe038e666,2097152,"007 - The World is Not Enough (U) [C][!]"},
{0xe84191a8,1048576,"102 Dalmatians - Puppies to the Rescue (F) [C][!]"},
{0x725a3483,1048576,"102 Dalmatians - Puppies to the Rescue (G) [C][!]"},
{0x56b83539,1048576,"102 Dalmatians - Puppies to the Rescue (U) [C][!]"},
{0x720c7023,1048576,"10-Pin Bowling (U) [C][!]"},
{0x87431672,1048576,"1942 (U) [C][!]"},
{0x8cdab77f,1048576,"3D Pocket Pool (E) (M6) [C][!]"},
{0xf62ad75e,1048576,"4x4 World Trophy (E) (M5) [C][!]"},
{0x4d87d92f,65536,"58-in-1 (Menu) (Unl) [C]"},
{0xe633841f,1048576,"720 (U) [C][!]"},
{0xf13b91ab,65536,"72-in-1 (Menu) (Unl) [C]"},
{0x1226499e,1048576,"Action Man (U) [C][!]"},
{0x8ee043ea,1048576,"Adventures of Arle, The (J) [C][!]"},
{0xac52f6ef,2097152,"Adventures of Kite, The (J) [C][!]"},
{0xd0d3dfed,1048576,"Adventures of the Smurfs, The (M6) (E) [C][!]"},
{0x5dfff5e2,1048576,"Air Force Delta (J) [C][!]"},
{0xff31cc92,1048576,"Air Force Delta (U) [C][!]"},
{0x446573cd,1048576,"Aladdin (E) (M6) [C][!]"},
{0x6f9ef15e,1048576,"Alfred's Adventure (E) (M5) [C][!]"},
{0x85545d81,2097152,"Alice in Wonderland (E) (M4) [C][!]"},
{0x3199f65f,2097152,"Alice in Wonderland (U) [C][!]"},
{0xbec3c24b,1048576,"Aliens - Thanatos Encounter (U) [C][!]"},
{0xe17f59a5,1048576,"All-Star Baseball 2000 (U) [C][!]"},
{0xbc562466,1048576,"All-Star Baseball 2001 (U) [C][!]"},
{0x952b94e5,1048576,"All-Star Tennis 2000 (U) [C][!]"},
{0xc145c036,4194304,"Alone in the Dark - The New Nightmare (E) (M3) [C][!]"},
{0x7ff2042f,4194304,"Alone in the Dark - The New Nightmare (E) (M6) [C][!]"},
{0xc62a4c30,4194304,"Animal Breeder 3 (J) [C][!]"},
{0x83d838c3,4194304,"Animal Breeder 4 (J) [C][!]"},
{0x7fd46da1,1048576,"Animorphs (E) (M6) [C][!]"},
{0xb4f293cc,1048576,"Animorphs (U) [C][!]"},
{0x4839e0c1,1048576,"Antz (E) (M6) [C][!]"},
{0xf625a959,1048576,"Antz Racing (E) (M6) [C][!]"},
{0xd14b7b15,1048576,"Antz Racing (E) [C][!]"},
{0xdfdf90c0,1048576,"Antz Racing (U) [C][!]"},
{0xe243feb4,1048576,"Aqualife (J) [C][!]"},
{0xd952cbab,1048576,"Armada FX Racers (U) [C][!]"},
{0xea3b9c73,1048576,"Armorines - Project S.W.A.R.M. (E) (M2) [C][!]"},
{0x34411753,1048576,"Army Men (U) (M3) [C][!]"},
{0x2272baca,1048576,"Army Men 2 (U) [C][!]"},
{0xb0d1de8c,1048576,"Army Men Air Combat (U) [C][!]"},
{0x71b857ea,1048576,"Army Men Sarge's Heroes 2 (U) [C][!]"},
{0xf03599a3,1048576,"Arthur's Absolutely Fun Day! (U) [C][!]"},
{0x408dc5c6,1048576,"Asterix - Search for Dogmatix (E) (M6) [C][!]"},
{0x89d5d936,1048576,"Asteroids (U) [C][!]"},
{0x7967320e,2097152,"Atelier Elie (J) [C][!]"},
{0x6144fc66,2097152,"Atelier Marie (J) [C][!]"},
{0xd594d24b,2097152,"Atlantis - The Lost Empire (U) [C][!]"},
{0xbf99f8cb,4194304,"Austin Powers - Oh, Behave! (E) (M5) [C][!]"},
{0xbb89190e,4194304,"Austin Powers - Oh, Behave! (U) [C][!]"},
{0x693f50da,4194304,"Austin Powers - Welcome to My Underground Lair (E) (M5)[C][!]"},
{0xaba42b78,4194304,"Austin Powers - Welcome to My Underground Lair (U) [C][!]"},
{0xf9ccab09,2097152,"Azure Dreams (E) (M3) [C][!]"},
{0xc6f1abd4,1048576,"Azure Dreams (J) [C][!]"},
{0x71d52876,1048576,"Azure Dreams (U) [C][!]"},
{0xe25407f1,1048576,"Babe and Friends (U) [C][!]"},
{0xd33d6f7b,1048576,"Backgammon (E) (M4) [C][!]"},
{0x712a49b3,1048576,"Backgammon (J) [C][!]"},
{0xd514c9a0,1048576,"Bakuhashi Senki Metal Walker - Kkoute no Yuujyou (J) [C][!]"},
{0xa9050f72,524288,"Ballistic (U) [C][!]"},
{0xd2af64ce,262144,"Balloon Fight GB (J) [C][!]"},
{0x4068e981,1048576,"Barbie - Chasse Au Tresor Sous-Marine (F) [C][!]"},
{0x09ee93a8,1048576,"Barbie - Fashion Pack Games (U) [C][!]"},
{0x57f1a202,1048576,"Barbie - Magic Genie (U) [C][!]"},
{0x5e46d64a,1048576,"Barbie - Meeresabenteuer (G) [C][!]"},
{0xfdc8e7f1,1048576,"Barbie - Ocean Discovery (E) [C][!]"},
{0x746936c6,1048576,"Barbie - Ocean Discovery (U) [C][!]"},
{0x1fc972cc,1048576,"Barbie - Pet Rescue (U) [C][!]"},
{0xcd15ed36,1048576,"Barca Total 2000 (E) (M7) [C][!]"},
{0xddfcf4b7,1048576,"Bardigun (J) [C][!]"},
{0xb70028e4,1048576,"Bass Masters Classic (U) [C][!]"},
{0xe025067b,1048576,"Batman - Chaos in Gotham (E) (M6) [C][!]"},
{0xb241a4f3,1048576,"Batman - Chaos in Gotham (U) [C][!]"},
{0xf9d5b399,1048576,"Batman Beyond - Return of the Joker (E) (M3) [C][!]"},
{0xb32f4586,1048576,"Batman Beyond - Return of the Joker (U) [C][!]"},
{0xc99cf3c5,2097152,"Battle Fishers (J) [C][!]"},
{0x4431f8e7,1048576,"Battle Tanx (U) [C][!]"},
{0x8e6f8037,1048576,"Battleship (U) [C][!]"},
{0xddce76d6,1048576,"B-Daman Bakugaiden - Victory eno Michi (J) [C][!]"},
{0x547a9a69,2097152,"B-Daman Bakugaiden V - Final Mega Tune (J) [C][!]"},
{0x82d1a721,1048576,"Beach 'n Ball (E) (M5) [C][!]"},
{0x72895639,1048576,"Beast Wars (J) [C][!]"},
{0x6e988c07,1048576,"Beat Breaker (J) [C][!]"},
{0x0d9cb195,1048576,"Beat Mania GB (J) [C][!]"},
{0x645c4faf,1048576,"Beat Mania GB 2 (J) [C][!]"},
{0xb92a6d16,2097152,"Beat Mania GB Gotcha Mix 2 (J) [C][!]"},
{0xe4c410f0,1048576,"Beauty and the Beast (E) (M5) [C][!]"},
{0x6de1d581,1048576,"Beauty and the Beast (U) [C][!]"},
{0x51972995,2097152,"Benjamin Bluemchen - Ein verrueckter Tag im Zoo (G) [C][!]"},
{0x9c56977e,2097152,"Bey Blade (J) [C][!]"},
{0x1ec9db95,2097152,"Bey Blade 2 - Tournament Fighting (J) [C][!]"},
{0x08da3a14,32768,"BHGOS - Multicart Menu (PD)[C]"},
{0x4d39fbfe,1048576,"Bibi Blocksberg - Im Bann der Hexenkugel (G) [C][!]"},
{0x5be2517c,2097152,"Bikkuriman 2000 Charging Card GB (J) [C][!]"},
{0xfa1e6853,1048576,"Billy Bob's Huntin' 'n' Fishin' (U) [C][!]"},
{0xa663cf31,2097152,"Bionic Commando - Elite Forces (U) [C][!]"},
{0x4fbec464,1048576,"Bistro Recipe - Best Garum Version (J) [C][!]"},
{0x459a126b,1048576,"Bistro Recipe - Food Battle Version (J) [C][!]"},
{0xe44977dc,1048576,"Black Bass - Lure Fishing (U) [C][!]"},
{0xe823d051,1048576,"Black Bass - Lure Fishing (U) [C][f1]"},
{0x582fe338,1048576,"Black Onyx, The (J) [C][!]"},
{0x2dd5907f,1048576,"Blade (U) [C][!]"},
{0xa890adb2,1048576,"Blades of Steel (U) [C][!]"},
{0x2f91e17c,1048576,"Blaster Master Enemy Below (U) [C][!]"},
{0x748d1345,1048576,"Blue's Clues - Blue's Alphabet Book (U) [C][!]"},
{0xa7152869,2097152,"Boarder Zone (U) [C][!]"},
{0xea33fe3d,1048576,"Bob the Builder - Fix It Fun! (E) (M5) [C][!]"},
{0x93fa37bd,1048576,"Bob the Builder - Fix It Fun! (U) [C][!]"},
{0xc87120b5,2097152,"Boku no Camp (J) [C][!]"},
{0x9fc7a3b5,2097152,"Bokujo Monogatari GB 2 (J) (Chinese) [C][!]"},
{0xee993302,2097152,"Bokujo Monogatari GB 2 (J) [C][!]"},
{0x3a18b41f,2097152,"Bokujo Monogatari GB 3 - Boy Meets Girl (J) [C][!]"},
{0x545e0da2,2097152,"Bomberman Max - Ain Special Edition (J) [C][!]"},
{0x5ccb66cf,2097152,"Bomberman Max - Blue Champion (U) [C][!]"},
{0x7a44ce88,2097152,"Bomberman Max - Hero of Light (J) [C][!]"},
{0x4853f586,2097152,"Bomberman Max - Red Challenger (U) [C][!]"},
{0x48b60e8e,2097152,"Bomberman Max - Shadow of Darkness (J) [C][!]"},
{0x5a9b9ae6,2097152,"Bomberman Quest (E) (M3) [C][!]"},
{0x55210934,1048576,"Bomberman Quest (J) [C][!]"},
{0xa089c656,1048576,"Bomberman Quest (U) [C][!]"},
{0x06c28962,1048576,"Bomberman Quest (U) [C][BF]"},
{0x5d5d294a,2097152,"Brave Saga Shinshou Astaria (J) [C][!]"},
{0xa0f66d87,1048576,"Bubble Bobble (E) [C][!]"},
{0x388c6760,1048576,"Bubble Bobble (J) [C][!]"},
{0xc1b22246,1048576,"Bubble Bobble (U) (Metro 3D) [C][!]"},
{0x5692e262,1048576,"Buffy - The Vampire Slayer (U) [C][!]"},
{0xae839cae,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][!]"},
{0x7a2801fb,1048576,"Bugs Bunny - Crazy Castle 3 (U) [C][!]"},
{0x53155e60,1048576,"Bugs Bunny - Crazy Castle 4 (E) [C][!]"},
{0xd6387eaa,1048576,"Bugs Bunny - Crazy Castle 4 (J) [C][!]"},
{0x98dbffe0,1048576,"Bugs Bunny - Crazy Castle 4 (U) [C][!]"},
{0x11fb5617,1048576,"Bugs Bunny - Operation Carrots (E) (M3) [C][!]"},
{0xf0cc407f,1048576,"Bugs Bunny - Operation Carrots (E) (M6) [C][!]"},
{0xdb93e0f6,1048576,"Bug's Life, A (E) [C][!]"},
{0x8360047a,1048576,"Bug's Life, A (U) [C][!]"},
{0x95493475,2097152,"Bullet Battlers (J) [C][!]"},
{0x4039c187,2097152,"Bullet Battlers (J) [C][a1]"},
{0x5622b551,1048576,"Bundesliga Stars 2001 (G) [C][!]"},
{0xe52fbd12,1048576,"Burai Fighter (J) [C][!]"},
{0xb4a133ce,1048576,"Burai Fighter (J) [C][BF]"},
{0x9092b0eb,1048576,"Burger Paradise (J) [C][!]"},
{0x1abcedbe,1048576,"Burger Pocket (J) [C][!]"},
{0x8e818e6f,524288,"Bust-a-Move 4 (UE) [C][!]"},
{0xf8da0c4a,1048576,"Bust-a-Move Millennium (U) [C][!]"},
{0x841674b0,524288,"Buzz Lightyear of Star Command (F) [C][!]"},
{0xf06d296c,524288,"Buzz Lightyear of Star Command (G) [C][!]"},
{0x84e29b87,524288,"Buzz Lightyear of Star Command (U) [C][!]"},
{0x351ba5ea,1048576,"Caesar's Palace II (U) [C][!]"},
{0xb060b053,1048576,"Caesar's Palace II (U) [C][f1]"},
{0x824c3bf3,4194304,"Cannon Fodder (E) (M5) [C][!]"},
{0xb18cba2a,2097152,"Card Hero (J) [C][!]"},
{0xf78f7998,2097152,"Cardcaptor Sakura - Tomoe Shougakkou Undoukai (J) [C][!]"},
{0x89ba58ed,524288,"Cardcaptor Sakura (V1.0) (J) [C][!]"},
{0x43f28e22,524288,"Cardcaptor Sakura (V1.1) (J) [C][!]"},
{0xda8d6283,1048576,"Carl Lewis Athletics 2000 (U) [C][!]"},
{0xb447bc06,2097152,"Carmageddon (G) [C][!]"},
{0xbb482ed7,2097152,"Carmageddon (U) (M4) [C][!]"},
{0xe6b9f155,1048576,"Casper (E) (M3) [C][!]"},
{0xc775d653,1048576,"Casper (U) [C][!]"},
{0xd20dc670,1048576,"Caterpillar Construction Zone (U) [C][!]"},
{0x41e78645,1048576,"Catwoman (E) [C][!]"},
{0x099d6555,1048576,"Catz (E) [C][!]"},
{0x769a2c5a,1048576,"Catz (U) [C][!]"},
{0x255db8be,524288,"Centipede (E) (M6) [C][!]"},
{0x13ad07b1,1048576,"Centipede (U) [C][!]"},
{0xcbb336ed,1048576,"Championship Motocross 2001 with Ricky Carmichael (U) [C][!]"},
{0x6a0c272d,1048576,"Chase HQ - Secret Police (J) [C][!]"},
{0x7c7fdefc,1048576,"Chase HQ - Secret Police (U) (Metro 3D re-release) [C][!]"},
{0xcfdf816b,1048576,"Chase HQ - Secret Police (U) [C][!]"},
{0x1aab415d,1048576,"Checkmate (J) [C][!]"},
{0x9e988ffe,4194304,"Chee Chai Alien (J) [C][!]"},
{0x1c13dbb0,1048576,"Chessmaster, The (U) [C][!]"},
{0xf8bd2a01,1048576,"Chicken Run (U) (M5) [C][!]"},
{0x65610ca4,2097152,"Choro Q Hyper Custom Bull GB (J) [C][!]"},
{0xef2cfd99,1048576,"ClassKing Yamazaki (J) [C][!]"},
{0x5d8eed0d,2097152,"Cokemon Gold! v0.3 (Pokemon Gold Hack) [C]"},
{0xe93af9c8,2097152,"Colin McRae Rally (E) [C][!]"},
{0xfbe5de37,524288,"Columns - Tezuka Osamu Characters (J) [C][!]"},
{0x9e0799f4,1048576,"Come Rascal! (J) [C][!]"},
{0xd10b5645,2097152,"Command Master (J) [C][!]"},
{0x4af4cc9c,1048576,"Commander Keen (U) [C][!]"},
{0xa50be9a8,2097152,"Conker's Pocket Tales (U) (M3) [C][!]"},
{0x994314b3,1048576,"Conveni 21 (J) [C][!]"},
{0x04fe7790,1048576,"Cool Bricks (E) (M5) [C][!]"},
{0xe6c91fb8,524288,"Cool Hand (E) (M3) [C][!]"},
{0x834091ba,1048576,"CR Monster House (J) [C][!]"},
{0x53e02b87,1048576,"Crazy Bikers (E) [C][!]"},
{0x2f7aef51,1048576,"Dracula - Crazy Vampire (E) (M5) [C][!]"},
{0x4664a167,1048576,"Croc (UE) [C][!]"},
{0xc1d60129,1048576,"Croc 2 (U) [C]"},
{0xb7b91fe9,1048576,"Cross Country Racing (E) (M3) [C][!]"},
{0x9562e7e8,2097152,"Cruis'n Exotica (U) [C][!]"},
{0x909bb02d,2097152,"Crystalis (U) [C][!]"},
{0x9f883b0f,1048576,"Cubix Robots For Everyone - Race'n Robots (U) (M5) [C][!]"},
{0x44767443,1048576,"Cute Pet Shop (J) [C][!]"},
{0xe470cafa,1048576,"CyberTiger (U) [C][!]"},
{0xe86bf12e,1048576,"Cyborg Kuro Chan 2 (J) [C][!]"},
{0xf41bb392,1048576,"Da! Da! Da! - Totsuzen Card Battle De Uranai (J) [C][!]"},
{0x45ebf09c,1048576,"Daffy Duck - Fowl Play (U) [C][!]"},
{0xd9062e49,1048576,"Daikatana (E) (M3) (Eng-Fre-Ita) [C][!]"},
{0xf7e83313,1048576,"Daikatana (E) (M3) (Fre-Ger-Span) [C][!]"},
{0xe2071293,1048576,"Daikuno Gensan (J) [C][!]"},
{0xc64ff2b6,2097152,"Dance Dance Revolution (J) [C][!]"},
{0x565fec36,2097152,"Dance Dance Revolution 2 (J) [C][!]"},
{0x58f26f36,2097152,"Dance Dance Revolution 3 (J) [C][!]"},
{0x3263f692,1048576,"Dancing Furby (J) [C][!]"},
{0x25b480c3,1048576,"Das Geheimnis der Happy Hippo-Insel (G) [C][!]"},
{0xc958ad75,1048576,"Data Navi Professional Baseball (J) [C][!]"},
{0x2df6e230,1048576,"Dave Mirra Freestyle BMX (U) [C][!]"},
{0x402de378,1048576,"Deadly Skies (E) (M3) [C][!]"},
{0x0fd34427,1048576,"Dear Danielns Sweet Adventure (J) [C][!]"},
{0x40a715fb,1048576,"Deer Hunter (U) [C][!]"},
{0x71f798b5,1048576,"Deja Vu I & II (E) (M2) (Eng-Fre) [C][!]"},
{0xc6e7f3c6,1048576,"Deja Vu I & II (E) (M2) (Ger-Fre) [C][!]"},
{0xbaf2cc96,1048576,"Deja Vu I & II (J) [C][!]"},
{0xad0937f4,1048576,"Deja Vu I & II (U) [C][!]"},
{0xc5501fce,2097152,"Dejiko no Mahjong Party (J) [C][!]"},
{0x92c8b9b5,1048576,"Dekotora GB Special (J) [C][!]"},
{0x14375072,4194304,"Densha De Go! (J) [C][!]"},
{0xb72603fc,8388608,"Densha De Go! 2 (J) [C][!]"},
{0x3b5f24fc,1048576,"Detective Conan - Karakuri Temple (J) [C][!]"},
{0xe620fae2,1048576,"Detective Conan 2 - Kigantou Hihou Densetsu (J) [C][!]"},
{0x39a10855,2097152,"Devil Children - Shiro no Syo (J) [C][!]"},
{0xd24d6601,1048576,"Dexter's Laboratory - Robot Rampage (U) [C][!]"},
{0xfd11138e,1048576,"Die Maus - Verrueckte Olympiade (G) [C][!]"},
{0xe7bd4a49,1048576,"Die Maus (E) (M4) [C][!]"},
{0x714ec204,1048576,"Die Original Moorhuhn Jagd (G) [C][!]"},
{0x55b9af51,2097152,"Digital Devil Story - Black Children (J) [C][!]"},
{0xf90c4977,2097152,"Digital Devil Story - Red Children (J) [C][!]"},
{0xd9f071bb,2097152,"Dino Breeder 3 (J) [C][!]"},
{0xb0106777,2097152,"Dino Breeder 4 (J) [C][!]"},
{0xe0f7719e,32768,"Dino's Quest (Unl) (Beta) [C]"},
{0xb0bb0f10,32768,"Dino's Quest (Unl) (Beta) [C][f1]"},
{0x0aa8d0cc,2097152,"Dinosaur (E) (M5) [C][!]"},
{0x0b087fe7,2097152,"Dinosaur (U) [C][!]"},
{0x276ecaae,2097152,"Dinosaur (U) [C][a1][!]"},
{0xf4609fe3,1048576,"Dinosaur'Us (U) (M6) [C][!]"},
{0xce8dd179,1048576,"Dogz (E) [C][!]"},
{0xa8397183,1048576,"Dogz (U) [C][!]"},
{0x4fe9e966,2097152,"Dokapon !! Millenium Quest (J) [C][!]"},
{0x83e47a1a,4194304,"Doki Doki Densetsu - Mahoujin Guru Guru (J) [C][!]"},
{0xce8ae58c,2097152,"Don Quijote Pachinko (J) [C][!]"},
{0x333c124c,4194304,"Donald Duck - Daisy O Tsukue (J) [C][!]"},
{0x07a13b5b,4194304,"Donald Duck (E) (M5) [C][!]"},
{0xcb065eba,4194304,"Donkey Kong 2001 (J) [C][!]"},
{0x945c3653,4194304,"Donkey Kong Country (Mag Demo) (UE) (M5) [C][!]"},
{0xb1743477,4194304,"Donkey Kong Country (UE) (M5) [C][!]"},
{0x28d7e8d3,1048576,"Donkey Kong GB - Dinky Kong and Dixie Kong (J) [C][!]"},
{0x000553a6,1048576,"Donkey Kong GB - Dinky Kong and Dixie Kong (J) [C][f1]"},
{0xcf1a2038,1048576,"Doraemon Kart 2 (J) [C][!]"},
{0xd187cec4,1048576,"Doraemon Memories - Nobita no Omoide Daibouken (J) [C][!]"},
{0x67413f65,1048576,"Doraemon no Study Boy - Kanji Game (J) [C][!]"},
{0xa8a353d8,1048576,"Doraemon no Study Boy - KuKu Game (J) [C][!]"},
{0x3bbf9ea8,1048576,"Doraemon Quiz Boy (J) [C][!]"},
{0xf6d79a79,1048576,"Doraemon Walking Labyrinth (J) [C][!]"},
{0x04fab6c5,1048576,"Doraemon Walking Labyrinth (J) [C][p1][!]"},
{0xa9e62f1a,1048576,"Doug's Big Game (F) [C][!]"},
{0x08e3d065,1048576,"Doug's Big Game (U) [C][!]"},
{0x2fa46211,1048576,"Draemon Kimi to Pet no Monogatari (J) [C][!]"},
{0x0602dbe1,262144,"Dragon Dance (U) [C][!]"},
{0xa053b42e,2097152,"Dragon Quest 1 & 2 (J) [C][!]"},
{0xff18df33,2097152,"Dragon Quest 1 & 2 (J) [C][f1]"},
{0x21078c16,4194304,"Dragon Quest III (J) [C][!]"},
{0x2a82b63b,2097152,"Dragon Quest Monsters (G) [C][!]"},
{0xe941a4cd,2097152,"Dragon Quest Monsters (G) [C][BF]"},
{0x4702c4f1,2097152,"Dragon Quest Monsters (J) [C][!]"},
{0xd263d88d,2097152,"Dragon Quest Monsters (V1.16) (J) [C][!]"},
{0x68ba18d7,4194304,"Dragon Quest Monsters 2 - Iru's Adventure (J) [C][!]"},
{0x2c428a87,4194304,"Dragon Quest Monsters 2 - Ruka's Adventure (J) [C][!]"},
{0x137d7b45,1048576,"Dragon Tales - Dragon Wings (E) [C][!]"},
{0x191d31ec,1048576,"Dragon Tales - Dragon Wings (U) [C][!]"},
{0x71d693da,2097152,"Dragon Warrior I and II (U) [C][!]"},
{0x0fd9c59c,4194304,"Dragon Warrior III (U) [C][!]"},
{0xe56c35b1,2097152,"Dragon Warrior Monsters (U) [C][!]"},
{0x580254c6,2097152,"Dragon Warrior Monsters (U) [C][BF]"},
{0xb8b120e4,2097152,"Dragon Warrior Monsters (U) [C][f1]"},
{0xab7bfdd5,4194304,"Dragon Warrior Monsters 2 - Cobi's Journey (U) [C][!]"},
{0x35ec5fb2,4194304,"Dragon Warrior Monsters 2 - Tara's Adventure (U) [C][!]"},
{0xbf076ca5,4194304,"Dragon's Lair (U) (M6) [C][!]"},
{0xd4c7f6df,1048576,"Driver - You Are The Wheelman (U) (M5) [C][!]"},
{0x1e71b67e,262144,"Dropzone (U) [C][!]"},
{0x6471622c,1048576,"Drymouth (U) [C]"},
{0x5b4507d9,1048576,"Duffy Duck - Fowl Play (J) [C][!]"},
{0x846fc830,1048576,"Duke Nukem (E) (M5) [C][!]"},
{0xfb08dceb,2097152,"Dukes of Hazzard, The - Racing for Home (U) [C][!]"},
{0x2bcb5f78,4194304,"Dungeon Saviour (J) [C][!]"},
{0x3f1e076c,1048576,"DX Monopoly GB (J) [C][!]"},
{0x2e65daaf,1048576,"Earthworm Jim - Menace 2 the Galaxy (U) [C][!]"},
{0x484eba10,1048576,"ECW Hardcore Revolution (U) [C][!]"},
{0x2154763c,1048576,"Elevator Action EX (E) (M5) [C][!]"},
{0xb70c4ddb,1048576,"Elevator Action EX (J) [C][!]"},
{0x41228ee7,1048576,"Elmo in Grouchland (E) [C][!]"},
{0x2c4c2a5f,262144,"Elmo in Grouchland (U) [C][!]"},
{0x1833fb38,262144,"Elmo's 123s (U) [C][!]"},
{0xcc1fb2a9,262144,"Elmo's ABCs (U) [C][!]"},
{0x4caa8cd0,2097152,"Emperor's New Groove, The (E) (M5) [C][!]"},
{0x6ebad539,2097152,"Emperor's New Groove, The (U) [C][!]"},
{0x42670496,32768,"EMS Multi-ROM Menu V1.1 (PD) [a1][C]"},
{0x4005d541,1048576,"ESPN International Track & Field (U) [C][!]"},
{0x600f61f9,2097152,"ESPN National Hockey Night (U) [C][!]"},
{0x5a0b7c72,1048576,"European Super League (E) (M5) [C][!]"},
{0xdfd6a908,2097152,"Evel Knievel (E) (M7) [C][!]"},
{0x5c0e7b44,1048576,"Extreme Sports with The Berenstein Bears (U) [C][!]"},
{0x5e3844fb,1048576,"F.A. Premier League Stars 2001 (U) [C][!]"},
{0x5c10315e,2097152,"F1 Championship Season 2000 (E) (M5) [C][!]"},
{0xe115ddb1,4194304,"F-1 Racing Championship (E) (Beta) (M5) [C][!]"},
{0xfc537719,4194304,"F-1 Racing Championship (E) (M5) [C][!]"},
{0x8d9a9182,2097152,"F-1 World Grand Prix (E) (M4) [C][!]"},
{0xeef4a20b,1048576,"F-1 World Grand Prix 2 (E) (M4) [C][!]"},
{0x28453467,1048576,"F-1 World Grand Prix 2 (J) [C][!]"},
{0x410fa858,1048576,"F-18 Thunder Strike (E) [C][!]"},
{0xb59a51c4,1048576,"Fairy Kitty (J) [C][!]"},
{0x8b742fb5,1048576,"Ferret Story - Dear my Ferret (J) [C][!]"},
{0xe6bc2e8c,1048576,"FIFA 2000 (U) [C][!]"},
{0x5dfc61e8,1048576,"Fix & Foxi (E) (M3) [C][!]"},
{0xecccd908,1048576,"Flintstones, The - Burgertime in Bedrock (E) (M6) [C][!]"},
{0x14d8cc5d,1048576,"Flintstones, The - Burgertime in Bedrock (U) [C][!]"},
{0x08b9e4aa,1048576,"Flipper & Lopaka (E) (M10) [C][!]"},
{0x2dcd0a0a,1048576,"Force 21 (U) (M3) [C][!]"},
{0x703c057f,1048576,"Formula One 2000 (U) [C][!]"},
{0x06c8e50a,1048576,"Fort Boyard (E) (M7) [C][!]"},
{0x0b9678d2,65536,"FREME Tuner (U) [C]"},
{0x0158492e,65536,"FREME Tuner (U) [C][a1]"},
{0x98d0fcb0,1048576,"Friendly Pet Series 1 - Lovely Hamster (J) [C][!]"},
{0x866095c2,1048576,"Friendly Pet Series 2 - Lovely Rabbit (J) [C][!]"},
{0xfa4e9896,1048576,"Friendly Pet Series 3 - Lovely Puppy (J) [C][!]"},
{0xb6bf0672,524288,"Frogger (E) (M6) [C][!]"},
{0xaf46ea77,1048576,"Frogger (U) [C][!]"},
{0x6a2666aa,1048576,"Frogger 2 (U) [C][!]"},
{0xc693aa37,4194304,"From TV Animation - One Piece - Dream of Rufi's Pirates is Born (J) [C][!]"},
{0xf48e1643,1048576,"Front Line - The Next Mission (J) [C][!]"},
{0x6eea9243,1048576,"Front Row (J) [C][!]"},
{0x3b46e7c9,1048576,"Funk the 9 Ball (J) [C][!]"},
{0x2c97e90f,4194304,"Furai no Siren GB2 (J) [C][!]"},
{0xe3c4abc6,1048576,"Galaga - Destination Earth (U) [C][!]"},
{0x969c8961,1048576,"Game & Watch Gallery 2 (UE) [C][!]"},
{0x1ac625da,1048576,"Game & Watch Gallery 3 (U) [C][!]"},
{0x7e15b3dd,2097152,"Game of Life DX, The (J) [C][!]"},
{0xf5e9aa8c,524288,"Gameboy Color Promotional Demo (J) [C]"},
{0x149f807e,1048576,"Gameboy Gallery 3 (J) [C][!]"},
{0x6935fea1,1048576,"Gameboy Gallery 3 (U) [C][!]"},
{0xe3b0319e,1048576,"Gameboy Wars 2 (J) [C][!]"},
{0xc69dc37b,1048576,"Gameboy Wars 2 (J) [C][a1][!]"},
{0x308a4ccb,1048576,"Games Frenzy (E) (M3) [C][!]"},
{0x2ea8d9d4,1048576,"Ganbare Goemon - Hoshizorashi Dynamites Arawaru!! (J) [C][!]"},
{0xd829eb2f,1048576,"Ganbare Goemon Teng (J) [C][!]"},
{0x8f3902f2,524288,"GB Backup Station BIOS (U) [C][!]"},
{0x63a62540,32768,"GB Gamejack 16M (EMP Hack 1.6) (Unl) [C]"},
{0x27e1ea03,32768,"GB Gamejack 16M (Select Pallete) (Unl) [C]"},
{0xafa3e555,32768,"GB Gamejack 16M (Unl) [C]"},
{0xc44cb531,32768,"GB Gamejack 64M (Select Pallete) (Unl) [C]"},
{0xdfd9b8bf,32768,"GB Gamejack 64M (Unl) [C]"},
{0x0d616244,32768,"GB Gamejack Menu for GBC with Setup-Menu (Unl) [C]"},
{0x1c0368fa,2097152,"GB Harobots (J) [C][!]"},
{0xde7505c0,1048576,"Gem Gem Monster (J) [C][!]"},
{0x1d04b408,1048576,"Gem Gem Monster (J) [C][p1][!]"},
{0x918a40e7,1048576,"Gensoumaden Saiyuuki - Sabaku no Shikami (J) [C][!]"},
{0x9ebdb6c6,1048576,"Get Mushi Club - Minna no Konchu Daizukan (J) [C][!]"},
{0xdccc7514,1048576,"Gex - Enter the Gecko (U) [C][!]"},
{0x025f305d,2097152,"Gex 3 - Deep Pocket Gecko (E) [C][!]"},
{0x85a98c7d,2097152,"Gex 3 - Deep Pocket Gecko (U) [C][!]"},
{0xae024c23,1048576,"Ghosts 'N Goblins (U) [C][!]"},
{0xd8e357ba,1048576,"Gift (E) (Demo Version) [C][!]"},
{0x1b0034e8,1048576,"Gift (E) [C][!]"},
{0xb97a8cb8,1048576,"Gifty (E) (German release) [C][!]"},
{0xf1908391,1048576,"Glocal Hexcite (J) [C][!]"},
{0x73311cfa,2097152,"Go Go Goemon (J) [C][!]"},
{0x2e61c391,1048576,"Gobs of Games (U) (M3) [C][!]"},
{0xe7ebb394,1048576,"Godzilla - The Series - Monster Wars (U) [C][!]"},
{0xdd716efe,1048576,"Godzilla - The Series (E) (M3) [C][!]"},
{0xb16f1752,1048576,"Gold and Glory - The Road to El Dorado (E) (M6) [C][!]"},
{0xb7d49490,1048576,"Gold and Glory - The Road to El Dorado (U) [C][!]"},
{0x14d1adbe,1048576,"Golden Goal (E) (M7) [C][!]"},
{0x80444a86,2097152,"Golf Daisuki - Let's Play Golf (J) [C][!]"},
{0x38273bdd,524288,"Golf De Ohasuta (J) [C][!]"},
{0xe45e99d2,1048576,"Gonta's Okiraku Adventure (J) [C][!]"},
{0xd589c501,2097152,"Gran Duel (J) [C][!]"},
{0x7122136d,2097152,"Gran Duel Trial Version (J) [C][!]"},
{0x25ba9231,4194304,"Grand Theft Auto (E) (M5) [C][!]"},
{0x924de366,4194304,"Grand Theft Auto (U) [C][!]"},
{0xad563bd9,2097152,"Grand Theft Auto 2 (E) (M5) [C][!]"},
{0x68610203,2097152,"Grand Theft Auto 2 (U) [C][!]"},
{0x23223670,4194304,"Grandia - Parallel Trips (J) [C][!]"},
{0xb471c095,1048576,"Great Battle Pocket, The (J) [C][!]"},
{0xc38d52e7,1048576,"Gremlins (E) (Beta) (M6) [C][!]"},
{0x9ed6059a,1048576,"Grinch, The (E) (M3) [C][!]"},
{0xc5a47896,1048576,"Grinch, The (U) [C][!]"},
{0x03fbfc9e,1048576,"Guru Guru Town Hanamaru Kun (J) [C][!]"},
{0x7eaeeeac,1048576,"Guruguru Galakedaizu (J) [C][!]"},
{0x5f13a2d4,1048576,"Gute Zeiten Schlechte Zeiten Quiz (G) [C][!]"},
{0x70f3b431,1048576,"Halloween Racer (E) (M6) [C][!]"},
{0xd56d68ff,1048576,"Hamster Club - Awasete Chuu (J) [C][!]"},
{0x8a4d86a0,2097152,"Hamster Club (J) [C][!]"},
{0x2fb398f9,4194304,"Hamster Club 2 (J) [C][!]"},
{0xf520cb19,1048576,"Hamster Paradise (J) [C][!]"},
{0x14cac67c,4194304,"Hamster Paradise 3 (J) [C][!]"},
{0x542c78b6,2097152,"Hamu Suta Para 2 (J) [C][!]"},
{0xff454711,1048576,"Hamunaptra - The Lost City (J) [C][!]"},
{0xf519f4c3,1048576,"Hands of Time (E) [C][!]"},
{0x644bac84,1048576,"Harley Davidson - Race Across America (U) [C][!]"},
{0x4fd8b7c5,4194304,"Harry Potter and The Sorcerer's Stone (U) (M13) [C][!]"},
{0xc8a6f68a,1048576,"Harvest Moon GB (E) [C][!]"},
{0xd3896652,1048576,"Harvest Moon GB (G) [C][!]"},
{0xab5738a1,1048576,"Harvest Moon GB (U) [C][!]"},
{0x160ca990,2097152,"Harvest Moon GBC 2 (E) [C][!]"},
{0x32a04c29,2097152,"Harvest Moon GBC 2 (G) [C][!]"},
{0x08906220,2097152,"Harvest Moon GBC 2 (U) [C][!]"},
{0xa0d67417,2097152,"Harvest Moon GBC 3 (U) [C][!]"},
{0x12f74cd4,1048576,"Hello Kitty Beads Factory (J) [C][!]"},
{0x5174584f,1048576,"Hello Kitty Magical Museum (J) [C][!]"},
{0x937729f6,1048576,"Hello Kitty's Cube Frenzy (U) [C][!]"},
{0x45f4159b,1048576,"Hello Kitty's Sweet Adventure (J) [C][!]"},
{0xc0ede71f,1048576,"Hercules - The Legendary Journeys (U) (M6) [C][!]"},
{0xbb0672a6,1048576,"Heroes of Might and Magic (U) (M3) [C][!]"},
{0x53156d4d,1048576,"Heroes of Might and Magic II (U) (M3) [C][!]"},
{0x84084e5f,1048576,"Hexcite (U) [C][!]"},
{0x36e781cd,131072,"Highway Racing, The (J) [C][!]"},
{0xbdae91e8,1048576,"Hiryu no Ken Retsuden (J) [C][!]"},
{0x70f10315,1048576,"Hisshatsu Pachinko Boy (J) [C][!]"},
{0x27a53965,1048576,"Hole in One Golf (U) [C][!]"},
{0x77d7e5b7,1048576,"Hollywood Pinball (J) [C][!]"},
{0x8bd1f635,1048576,"Hollywood Pinball (UE) (M4) [C][!]"},
{0xabd8ceae,1048576,"Holy Magic Century (E) (M3) [C][!]"},
{0x05dcbd55,1048576,"Honkaku Hanafuda (J) [C][!]"},
{0x89140949,1048576,"Honkaku Taisen Shogi (Ayumu) (J) [C][!]"},
{0x72a5e820,1048576,"Hot Wheels Stunt Track Driver (U) [C][!]"},
{0xdd5d3713,1048576,"Hoyle Card Games (U) [C][!]"},
{0x413473b0,1048576,"Hoyle Casino (U) [C][!]"},
{0x685cafcc,1048576,"Hugo - Black Diamond Fever (E) (M11) [C][!]"},
{0xfab64b18,1048576,"Hugo 2.5 (G) [C][!]"},
{0xd23c6a75,1048576,"Hunter X Hunter - Kindan no Hihou (J) [C][!]"},
{0xa1361642,4194304,"Hunter X Hunter (J) [C][!]"},
{0x24846d65,1048576,"Hype - The Time Quest (E) (M8) [C][!]"},
{0xa9b8f072,1048576,"Hyper Winter Olympics 2000 (J) [C][!]"},
{0x61df88ca,2097152,"Ide Mahjong GB (J) [C][!]"},
{0x7fff1142,1048576,"Indiana Jones and the Infernal Machine (U) (M3) [C][!]"},
{0x1af0b489,1048576,"Inspector Gadget - Operation Madkactus (U) [C][!]"},
{0x3390b056,1048576,"Inspector Gadget (E) (M6) [C][!]"},
{0x12e00808,1048576,"International Karate (E) [C][!]"},
{0x57ea1ec8,2097152,"International Superstar Soccer 2000 (E) [C][!]"},
{0x1b76d115,1048576,"International Superstar Soccer 99 (U) [C][!]"},
{0x327ec81f,1048576,"International Track & Field (E) (M4) [C][!]"},
{0x803d5d57,1048576,"International Track & Field (U) [C][!]"},
{0xd826c75f,1048576,"International Track & Field - Summer Games (E) [C][!]"},
{0x39e34650,1048576,"Its a World Rally (J) [C][!]"},
{0xa3687e47,1048576,"Its a World Rally (J) [C][f1]"},
{0xb3f38f16,1048576,"J. League Excite Stage GB (J) [C][!]"},
{0xcff5325a,2097152,"Jack's Journey - an Elemental Tale (J) [C][!]"},
{0xaeb634c5,1048576,"Jagainu Kun (J) [C][!]"},
{0x32c8ee13,1048576,"Janosch - Das Grosse Panama Spiel (G) [C][!]"},
{0x73f4f6da,1048576,"Jay Und Die Spielzeugdiebe (G) [C][!]"},
{0xa41ed926,1048576,"Jeff Gordan XS Racing (U) [C][!]"},
{0xf0f9abe6,1048576,"Jeremy McGrath Supercross 2000 (U) [C][!]"},
{0x20c4ccf6,2097152,"Jet De Go! (J) [C][!]"},
{0x0fafa3f2,2097152,"Jim Henson's Muppets (E) (M7) [C][!]"},
{0x3c476c6f,2097152,"Jim Henson's Muppets (U) [C][!]"},
{0x27632f4f,1048576,"Jimmy White's Cueball (E) [C][!]"},
{0xc8d46e99,1048576,"Jinsei Tomedachi (J) [C][!]"},
{0x38d5aa6b,524288,"Joryu Janshi Ni Chousen (J) [C]"},
{0x9fa5cdb5,1048576,"Joryu Janshi Ni Chousen (J) [C][!]"},
{0x4c1ececb,1048576,"Joust & Defender (U) [C][!]"},
{0xb609ecea,4194304,"Jungle Book, The - Mowgli's Wild Adventure (E) (M5) [C][!]"},
{0x9b6b755f,4194304,"Jungle Book, The - Mowgli's Wild Adventure (U) (M5) [C][!]"},
{0x44827e74,2097152,"Jurassic Boy 2 (E) [C][!]"},
{0xca9dd8e9,2097199,"Jurassic Boy 2 (E) [C][a1]"},
{0x69f08c89,1048576,"K.O. - The Pro Boxing (J) [C][!]"},
{0x6d5b59c0,1048576,"Kadume Monsters (J) [C][!]"},
{0x77e13dbe,1048576,"Kaept'n Blaubaer - Die verrueckte Schatzsuche (G) [C][!]"},
{0x18caa513,4194304,"Kanji Boy (J) [C][!]"},
{0x81fd8918,4194304,"Kanji Boy 2 (J) [C][!]"},
{0x25efa1d7,1048576,"Kanji de Puzzle (J) [C][!]"},
{0x6c568e06,1048576,"Karamucho Owakari (J) [C][!]"},
{0xdd948071,1048576,"Karamucho Sawag (J) [C][!]"},
{0xaaba1ea4,2097152,"Karankoron (J) [C][!]"},
{0xbf80c897,1048576,"Kaseki Reborn II Monster Digger (J) [C][!]"},
{0xa262269f,1048576,"Katou 123 (J) [C][!]"},
{0x3791dca1,2097152,"Kawaii Pet Shop Monogatari 2 (J) [C][!]"},
{0xb868e846,1048576,"Keep the Balance (E) (M5) [C][!]"},
{0x710286ea,1048576,"Keiba Jou e Ikou Wide! (J) [C][!]"},
{0x6e39ebc4,1048576,"Kelly Club - Clubhouse Fun (U) [C][!]"},
{0x1e64d19c,1048576,"Ken Griffey Jrs' Slugfest (U) [C][!]"},
{0x6427cd7a,2097152,"Kidou Senkan Nadesco Ruri Ruri Mahjong (J) [C][!]"},
{0xde52ffdc,2097152,"Kindaichi Shounen no Jikenbo Juutoshime no Shoutaijou (J)[C][!]"},
{0x634b2d43,4194304,"King of Golf, The (J) [C][!]"},
{0x934f4b0a,2097152,"Kinsekae Tales (J) [C][!]"},
{0xc0face3d,1048576,"Kirby's Tilt 'n Tumble (J) [C][!]"},
{0xaddaff09,1048576,"Kirby's Tilt 'n Tumble (J) [C][f1]"},
{0xe541acf1,1048576,"Kirby's Tilt 'n Tumble (U) [C][!]"},
{0x343df2d8,1048576,"Kirby's Tilt 'n Tumble (U) [C][f1]"},
{0x783bc02d,1048576,"Kirikou (E) (M6) [C][!]"},
{0x14f91f86,1048576,"Kiwame GB II (J) [C][!]"},
{0x7181cbd0,1048576,"Klax (U) [C][!]"},
{0x577e1521,262144,"Klustar (E) (M5) [C][!]"},
{0x3f8d6041,262144,"Klustar (U) [C][!]"},
{0xa0d64934,1048576,"Knockout Kings (UE) [C][!]"},
{0x203f8727,1048576,"Konami GB Collection Volume 1 (E) [C][!]"},
{0xa6499792,1048576,"Konami GB Collection Volume 2 (E) [C][!]"},
{0xd4d6243d,1048576,"Konami GB Collection Volume 3 (E) [C][!]"},
{0x8800f1c9,1048576,"Konami GB Collection Volume 4 (E) [C][!]"},
{0x1c644040,1048576,"Konami Winter Games (E) [C][!]"},
{0xb6381744,2097152,"Konchu Hakase 2 (J) [C][!]"},
{0x430eb1e1,2097152,"KotoBattle (J) [C][!]"},
{0x3c39bcab,1048576,"Koukou Yakyuu High School Baseball (J) [C][!]"},
{0x6910ff3a,1048576,"Koushien Pocket (J) [C][!]"},
{0x392d630f,1048576,"Kuro Chan (J) [C][!]"},
{0x36b9a28c,1048576,"La Lellenda De La Cerda - Ed Charnega DX (Zelda Spain) (E) [C]"},
{0x016af0d7,1048576,"La Lellenda De La Cerda - Ed Charnega DX (Zelda Spain) (E) [C][a1]"},
{0x5a385226,1048576,"Land Before Time, The (E) (M5) [C][!]"},
{0xbce9cb16,1048576,"Land Before Time, The (U) [C][!]"},
{0xbef1cde4,524288,"Las Vegas Cool Hand (U) [C][!]"},
{0xbd9ba639,1048576,"Last Bible (J) [C][!]"},
{0x9caa00b5,1048576,"Last Bible 2 (J) [C][!]"},
{0xf90a3dae,1048576,"Laura (M8) (E) [C][!]"},
{0x1b49d07d,1048576,"Le Mans 24 Hours (E) (M5) [C][!]"},
{0x081d7fcb,1048576,"Legend of Soukoban, The (J) [C][!]"},
{0xf24d010a,1048576,"Legend of the River King 2 (E) [C][!]"},
{0x840fd525,1048576,"Legend of the River King 2 (U) [C][!]"},
{0x87ef9530,1048576,"Legend of the River King GB (E) (Pack in Video) [C][!]"},
{0x1241f3f5,1048576,"Legend of the River King GB (G) [C][!]"},
{0x7e821f47,1048576,"Legend of the River King GB (U) (Natsume) [C][!]"},
{0xf48824fe,1048576,"Legend of Zelda, The - Link's Awakening DX (F) [C][!]"},
{0xfed5959b,1048576,"Legend of Zelda, The - Link's Awakening DX (G) [C][!]"},
{0xd974abea,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (J) [C][!]"},
{0x97822948,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][!]"},
{0xbd8a1041,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.1) (J) [C][!]"},
{0xb38eb9de,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.1) (U) [C][!]"},
{0x5933e3fa,2097152,"Legend of Zelda, The - Oracle of Ages (E) (M5) [C][!]"},
{0x3272e6f9,1048576,"Legend of Zelda, The - Oracle of Ages (J) [C][!]"},
{0x3800a387,1048576,"Legend of Zelda, The - Oracle of Ages (U) [C][!]"},
{0xdbac1357,2097152,"Legend of Zelda, The - Oracle of Seasons (E) (M5) [C][!]"},
{0xe42538f0,1048576,"Legend of Zelda, The - Oracle of Seasons (J) [C][!]"},
{0xd7e9f5d7,1048576,"Legend of Zelda, The - Oracle of Seasons (U) [C][!]"},
{0x690c0373,1048576,"LEGO Alpha Team (E) (M10) [C][!]"},
{0x6d7ec41b,1048576,"LEGO Alpha Team (U) [C][!]"},
{0x921abb21,1048576,"LEGO Island 2 - The Brickster's Revenge (E) (M10) [C][!]"},
{0xb14fa7e7,1048576,"LEGO Island 2 - The Brickster's Revenge (U) (M3) [C][!]"},
{0x0a109f13,1048576,"LEGO Racers (E) (M10) [C][!]"},
{0x05cc01fb,1048576,"LEGO Stunt Rally (E) (M10) [C][!]"},
{0xda084760,1048576,"LEGO Stunt Rally (U) [C][!]"},
{0x97e5ce2f,4194304,"Lemmings & Oh No! More Lemmings (U) [C][!]"},
{0x1d66cb29,1048576,"Les Razmoket 100% Angelica (F) [C][!]"},
{0x2f8fef3f,1048576,"Les Razmoket Voyages Dans Le Temps (F) [C][!]"},
{0xd843f898,1048576,"Les Visiteurs (F) [C][!]"},
{0xc6859b34,1048576,"Lil' Monster (U) [C][!]"},
{0x6467fba0,1048576,"Lion King, The - Simba's Mighty Adventure (F) [C][!]"},
{0xd5b4b7bb,1048576,"Lion King, The - Simba's Mighty Adventure (U) [C][!]"},
{0xca38283d,1048576,"Little Magic (J) [C][!]"},
{0x9fec297e,1048576,"Little Mermaid II Pinball Frenzy, The (E) (M5) [C][!]"},
{0x364f9ccd,1048576,"Little Mermaid II Pinball Frenzy, The (U) (M5) [C][!]"},
{0x27310900,2097152,"Little Nicky (U) [C][!]"},
{0xf8bf3ee7,1048576,"LNF Stars 2001 (F) [C][!]"},
{0xeceab84e,1048576,"Lode Runner (J) [C][!]"},
{0x66e166bb,1048576,"Lodoss War GB (J) [C][!]"},
{0x49bfacc8,1048576,"Lodoss War GB (J) [C][p1][!]"},
{0xd67275f7,1048576,"Logical (U) (Sunsoft) [C][!]"},
{0x5eee76c4,1048576,"Logical (U) (THQ) [C][!]"},
{0x4ef3ddd7,1048576,"Looney Tunes (U) [C][!]"},
{0x54509d24,2097152,"Looney Tunes Collector - Alert! (U) (M3) [C][!]"},
{0x22952662,2097152,"Looney Tunes Collector - Martian Revenge! (E) (M6) [C][!]"},
{0x66792cde,1048576,"Looney Tunes Racing (U) [C][!]"},
{0x034d2686,2097152,"Love Hina Party (J) [C][!]"},
{0x1c877abd,4194304,"Love Hina Pocket (J) [C][!]"},
{0x3aebfad8,524288,"Luca's Puzzle Adventure (J) [C][!]"},
{0xaba69b40,524288,"Luca's Puzzle Adventure (J) [C][BF]"},
{0xce7f108a,1048576,"Lucky Luke - Desperado Train (E) (M6) [C][!]"},
{0x412fb57c,1048576,"Lucky Luke (E) (M4) [C][!]"},
{0x5bae3c04,2097152,"Lufia - The Legend Returns (U) [C][!]"},
{0xa666f54d,1048576,"M&M's Minis Madness (G) [C][!]"},
{0x8649d7a0,1048576,"M&M's Minis Madness (U) [C][!]"},
{0x83293b1b,1048576,"M&M's Minis Madness Demo (U) [C][!]"},
{0x66328695,2097152,"MacDonalds Monogatari (J) [C][!]"},
{0x2b7abba4,2097152,"Macross 7 - Ginga no Heart wo Furuwasero! (J) [C][!]"},
{0x482944aa,1048576,"Madden NFL 2000 (U) [C][!]"},
{0x160e9e3c,1048576,"Madden NFL 2001 (U) [C][!]"},
{0xde1338d2,1048576,"Madden NFL 2002 (U) [C][!]"},
{0x15e5d499,1048576,"Magical Chase (J) [C][!]"},
{0xea9ee203,1048576,"Magical Drop (E) (M3) [C][!]"},
{0xe4188a79,1048576,"Magical Drop (U) [C][!]"},
{0xf53cf66c,1048576,"Magical Tetris Challenge (U) [C][!]"},
{0x0a421839,1048576,"Magical Tetris Challenge (V1.0) (E) (M7) [C][!]"},
{0x5042450b,2097152,"Magi-Nation (U) [C][!]"},
{0x8ed4bbba,1048576,"Mahjong King (J) [C][!]"},
{0x7d83a5e8,1048576,"Mahjong Kobo (J) [C][!]"},
{0xc870b88f,1048576,"Mahjong Quest (J) [C][!]"},
{0x29a78a49,1048576,"Mahjong Quest (J) [C][BF]"},
{0x4ec78785,1048576,"Marble Madness (U) [C][!]"},
{0xa132417d,2097152,"Mario Golf (E) [C][!]"},
{0x4ca2191a,2097152,"Mario Golf (J) [C][!]"},
{0x905ad0cb,2097152,"Mario Golf (U) [C][!]"},
{0xa781c63c,2097152,"Mario Tennis (U) [C][!]"},
{0x19070962,2097152,"Mario Tennis GB (J) [C][!]"},
{0x5d85dfad,2097152,"Martian Alert! (E) (M6) [C][!]"},
{0x11b4788c,2097152,"Marvin Strikes Back (U) (M3) [C]"},
{0x46faa730,1048576,"Mary-Kate & Ashley - Get a Clue (U) [C][!]"},
{0x84a880b9,1048576,"Mary-Kate & Ashley - Pocket Planner (U) [C][!]"},
{0x35d6ddcc,1048576,"Mary-Kate & Ashley - Winners Circle (U) [C][!]"},
{0x909c870f,1048576,"Mask of Zorro, The (E) [C][!]"},
{0x2c92ad12,1048576,"Mask of Zorro, The (U) [C][!]"},
{0x515c1459,1048576,"Mat Hoffman's Pro BMX (U) [C][!]"},
{0xa3f23d7e,2097152,"Matchbox - Emergency Patrol (U) [C][!]"},
{0x142b6efb,1048576,"Maya the Bee - Garden Adventures (E) (M4) [C][!]"},
{0x983b1d26,1048576,"Maya the Bee and Her Friends (E) (M3) [C][!]"},
{0x315caa18,1048576,"Me Mail Bear Happy Mail Town (J) [C][!]"},
{0xbf6bd446,2097152,"Medarot 2 - Kabuto (J) [C][!]"},
{0x5b8ffd37,2097152,"Medarot 2 - Kuwagata (J) [C][!]"},
{0x159673db,2097152,"Medarot 2 - Parts Collection (J) [C][!]"},
{0xe655632c,4194304,"Medarot 3 - Kabuto (J) [C][!]"},
{0xc4b71879,4194304,"Medarot 3 - Kuwagata (V1.0) (J) [C][!]"},
{0xbc617834,4194304,"Medarot 3 - Kuwagata (V1.1) (J) [C][!]"},
{0xee2d977f,2097152,"Medarot 3 - Parts Collection (J) [C][!]"},
{0xc192a368,4194304,"Medarot 4 - Kabuto Version (J) [C][!]"},
{0x6a29b9d8,4194304,"Medarot 4 - Kuwagata Version (J) [C][!]"},
{0x4f03d80a,2097152,"Medarot Cardrobottle - Kabuto Version (J) [C][!]"},
{0xa3735f81,2097152,"Medarot Cardrobottle - Kuwagata Version (J) [C][!]"},
{0x3a4d94d5,1048576,"Mega Man Xtreme (U) [C][!]"},
{0x8fedb6d8,1048576,"Mega Man Xtreme 2 (U) [C][!]"},
{0x65b8b343,1048576,"Men In Black - The Series (U) [C][!]"},
{0xca675933,1048576,"Men In Black 2 (E) [C][!]"},
{0x8b63f36f,1048576,"Men In Black 2 (U) (M3) [C][!]"},
{0xc5290cee,1048576,"Merlin (E) (M6) [C][!]"},
{0x00733c77,1048576,"Meta Fight (J) [C][!]"},
{0xa76eed5b,2097152,"Meta Mode (J) [C][!]"},
{0x7831f84d,2097152,"Metal Gear - Ghost Babel (J) [C][!]"},
{0x16796957,4194304,"Metal Gear Solid (E) (M5) [C][!]"},
{0x04b0c5d6,2097152,"Metal Gear Solid (U) [C][!]"},
{0x3be68391,1048576,"Metal Walker (U) [C][!]"},
{0xd77971c0,1048576,"Mia Hamm Soccer Shootout (U) [C][!]"},
{0xd5e845f4,4194304,"Mickey's Racing Adventure (E) (M5) [C][!]"},
{0x11763934,4194304,"Mickey's Speedway USA (U) (M4) [C][!]"},
{0xeaf6e4f2,1048576,"Mickey's Tetris Adventure (J) [C][!]"},
{0x5dd337eb,2097152,"Micro Machines 1&2 - Twin Turbo (U) [C][!]"},
{0xb8064453,2097152,"Micro Machines V3 (U) [C][!]"},
{0xe66e093b,2097152,"Micro Maniacs (E) [C][!]"},
{0x0f02d708,1048576,"Microsoft - The Best of Entertainment Pack (E) [C][!]"},
{0xd2d88cfa,1048576,"Microsoft - The Best of Entertainment Pack (U) [C][!]"},
{0x504f55c5,1048576,"Microsoft Pinball (U) [C][!]"},
{0xee4cba24,1048576,"Microsoft Puzzle Collection (E) (M5) [C][!]"},
{0xb57dabae,1048576,"Millenium Winter Sports (U) [C][!]"},
{0x5cb4fc8a,1048576,"Minna no Shogi (J) [C][!]"},
{0x18216e26,1048576,"Missile Command (E) [C][!]"},
{0x47543c51,1048576,"Missile Command (U) [C][!]"},
{0x0af32baa,1048576,"Mission Impossible (E) (M5) [C][!]"},
{0x41230d11,1048576,"Mission Impossible (U) (M3) [C][!]"},
{0x7226ead0,2097152,"Mobile Trainer (J) [C][!]"},
{0xda7fb08f,2097152,"Momotaro Densetsu 1-2 (J) [C][!]"},
{0xbc1809ce,2097152,"Monkey Puncher (E) [C][!]"},
{0xb02564fc,2097152,"Monkey Puncher (J) [C][!]"},
{0xe48adf8d,2097152,"Monkore Knight (J) [C][!]"},
{0x0503e567,1048576,"Monopoly (J) [C][!]"},
{0x95ce6846,1048576,"Monopoly (J) [C][BF]"},
{0xe559a717,1048576,"Monopoly (U) [C][!]"},
{0x69b88f1e,2097152,"Monster Farm Battle Card (J) [C][!]"},
{0xb985f0d8,2097152,"Monster Race 2 (J) [C][!]"},
{0x50ddf120,2097152,"Monster Rancher Battle Card GB (U) [C][!]"},
{0x6c35e8f0,1048576,"Monster Rancher Explorer (U) [C][!]"},
{0x9cfa76c3,2097152,"Monster Tactics (J) [C][!]"},
{0x183dbb31,1048576,"Monsters Inc. (U) [C][!]"},
{0xde04772f,524288,"Montezuma's Return (U) (M2) [C][!]"},
{0x659693de,524288,"Montezuma's Return (E) (M5) [C][!]"},
{0xbd29ee6f,2097152,"Moomin's Adventure (J) [C][!]"},
{0x45543ba2,1048576,"Moomin's Tale (G) (M3) [C][!]"},
{0xf40199c9,1048576,"Moon Patrol & Spy Hunter (U) [C][!]"},
{0xed52ceaf,1048576,"Moorhuhn 2 (G) [C][!]"},
{0x87588725,1048576,"Mortal Kombat 4 (E) (no blood) [C][!]"},
{0x4eb71448,1048576,"Mortal Kombat 4 (U) [C][!]"},
{0x17d27fa9,1048576,"Motocross Maniacs 2 (U) [C][!]"},
{0x773729af,1048576,"Mr. Driller (J) [C][!]"},
{0x492c0ebf,1048576,"Mr. Driller (U) [C][!]"},
{0x4e37c741,1048576,"Mr. Nutz (E) (M6) [C][!]"},
{0xf2335da9,1048576,"Ms. Pac-Man & Pac-Man SCE (E) (Acclaim) [C][!]"},
{0x103e212d,524288,"Ms. Pac-Man & Pac-Man SCE (U) (Namco) [C][!]"},
{0xb7b2354b,1048576,"MTV Sports - Pure Ride (U) [C][!]"},
{0x744561f3,1048576,"MTV Sports - Skateboarding (U) [C][!]"},
{0x904663af,1048576,"MTV Sports - TJ Lavin's Ultimate BMX (U) [C][!]"},
{0xc997f45b,1048576,"Mummy Returns, The (U) [C][!]"},
{0x84fc838a,1048576,"Mummy, The (E) (M3) [C][!]"},
{0xc6ba9f27,1048576,"Mummy, The (U) [C][!]"},
{0xe2e4328b,1048576,"Muscle Ranking GB (J) [C][!]"},
{0x42de9092,2097152,"Muscle Ranking GB 2 (J) [C][!]"},
{0xe2f6253e,4194304,"Muscle Ranking GB 3 (J) [C][!]"},
{0xb9fa3ce4,1048576,"Nakayoshi Cooking Series - Oishii Pan Ya San (J) [C][!]"},
{0xe5ec7be5,1048576,"Nakayoshi Pet Series - Kawaii Hamster 2 (J) [C][!]"},
{0x1a382367,1048576,"Nakayoshi Pet Series 4 Kawaii Koneko (J) [C][!]"},
{0x54d90a4c,1048576,"NASCAR 2000 (E) [C][!]"},
{0x39c6b868,1048576,"NASCAR Challenge (U) [C][!]"},
{0xfa83b37c,1048576,"NASCAR Heat (U) [C][!]"},
{0xf39a5c4f,1048576,"NASCAR Racers (U) [C][!]"},
{0x001f4754,1048576,"NBA 3 on 3 Featuring Kobe Bryant (U) [C][!]"},
{0x5011a419,1048576,"NBA Hoopz (U) [C][!]"},
{0xbe949f74,1048576,"NBA In The Zone (U) [C][!]"},
{0xe6af6d07,2097152,"NBA In The Zone 2000 (E) [C][!]"},
{0xfdb38c49,2097152,"NBA In The Zone 2000 (U) [C][!]"},
{0x3aa75f1c,1048576,"NBA Jam 2001 (U) [C][!]"},
{0x84be0eed,1048576,"NBA Jam '99 (UE) [C][!]"},
{0x03f44abc,1048576,"NBA Jam '99 (UE) [C][BF]"},
{0x748564ae,1048576,"NBA Pro '99 (E) [C][!]"},
{0x7ae23888,1048576,"NBA Showtime - NBA on NBC (U) [C][!]"},
{0x5337ff55,2097152,"Neon Evangelion Mahjong (J) [C][!]"},
{0xdca4474e,1048576,"New Adventures of Mary-Kate and Ashley, The (U) [C][!]"},
{0x62f560d8,1048576,"New York Racer (E) (M6) [C][!]"},
{0xd731ded7,524288,"NFL Blitz (U) [C][!]"},
{0x090c7dac,1048576,"NFL Blitz 2000 (U) [C][!]"},
{0x61c653ae,1048576,"NFL Blitz 2001 (U) [C][!]"},
{0xbb625129,1048576,"NHL 2000 (U) [C][!]"},
{0x8bc5b62a,1048576,"NHL Blades of Steel 2000 (U) [C][!]"},
{0xa3f079d4,1048576,"Nicktoon's Racing (U) [C][!]"},
{0x4631d8bf,1048576,"Nintama Rantaro (J) [C][!]"},
{0xec823cc1,131072,"Nintendo Power Menu Program (J) [C]"},
{0x0f69f574,1048576,"No Fear - Downhill Mountain Biking (E) [C][!]"},
{0x233862d0,1048576,"Nobunaga's Ambition 2 (J) [C][!]"},
{0x845b4e44,1048576,"Noddy and the Birthday Party (E) (M4) [C][!]"},
{0x6628cdee,1048576,"Obelix (E) (M4) [C][!]"},
{0x5c260d5a,1048576,"Oddworld Adventures 2 (E) (M5) [C][!]"},
{0x840ef32f,262144,"Ohasta Yamachan & Reimondo (J) [C][!]"},
{0xe5c9569a,1048576,"Oishii Cake Okusan (J) [C][!]"},
{0xd86507c9,1048576,"Ojarumaru (J) [C][!]"},
{0xed7461d2,2097152,"Ojarumaru Tsukiyogaike (J) [C][!]"},
{0x3485761a,1048576,"O'Leary Manager 2000 (E) (M7) [C][!]"},
{0xd47c0dcf,1048576,"Oodorobou Jing Angel (J) [C][!]"},
{0x2a39a874,1048576,"Oodorobou Jing Devil (J) [C][!]"},
{0x948f4a96,2097152,"Oshare Nikki (J) [C][!]"},
{0xc7800576,1048576,"Othello 2000 (J) [C][!]"},
{0x3eac3d1c,1048576,"Ottifanten - Kommando Stoertebecker (G) [C][!]"},
{0x3f635a4f,1048576,"Owarai Yoiko no Game Dou - Oyaji Sagashite 3 Choume (J)[C][!]"},
{0x1e443d1b,1048576,"Pachi Pachi Pachisurou (J) [C][!]"},
{0x1a631bab,1048576,"Pachinko Hissho Guide - The King of Data (J) [C][!]"},
{0xf75e269e,1048576,"Pachislot CR Genjin (J) [C][!]"},
{0x3485ef86,262144,"Pac-Man & Pac-Attack SCE (U) (Namco) [C][!]"},
{0xf565647f,1048576,"Pac-Man & Pac-Panic SCE (E) (Acclaim) [C][!]"},
{0xc0a98305,1048576,"Paperboy (U) [C][!]"},
{0xda3a3278,1048576,"Papyrus (E) (M6) [C][!]"},
{0xafa1aac3,2097152,"Perfect Choro Q (J) [C][!]"},
{0x0601bef6,4194304,"Perfect Dark (U) (M5) [C][!]"},
{0x3e43f25f,2097152,"Phantom Zona (J) [C][!]"},
{0xfa09cebe,1048576,"Pitfall - Beyond the Jungle (J) [C][!]"},
{0xf911bb5d,1048576,"Pitfall - Beyond the Jungle (U) [C][!]"},
{0x375c35e0,1048576,"Player Manager 2001 (E) (M2) [C][!]"},
{0x911007e1,1048576,"Pocket Billiard (J) [C][!]"},
{0xfa2a66e9,1048576,"Pocket Bomberman (U) [C][!]"},
{0x26589b79,524288,"Pocket Bowling (J) [C][!]"},
{0x3ed30908,524288,"Pocket Bowling (U) [C][!]"},
{0x389cf56f,131072,"Pocket Color Block (J) [C][!]"},
{0x08dc0af4,1048576,"Pocket Color Mahjong (J) [C][!]"},
{0xc73eb10e,1048576,"Pocket Color Trump (J) [C][!]"},
{0x4d26e880,1048576,"Pocket Densya 2 (J) [C][!]"},
{0x2a273244,2097152,"Pocket Family GB 2 (J) [C][!]"},
{0xc424874e,2097152,"Pocket GI Stable (J) [C][!]"},
{0x2ac77c5a,1048576,"Pocket GT (J) [C][!]"},
{0xaf0c51b8,262144,"Pocket Hanafuda (J) [C][!]"},
{0xdee71d44,2097152,"Pocket King (J) [C][!]"},
{0x35a29628,1048576,"Pocket Lure Boy (J) [C][!]"},
{0xc78fba94,1048576,"Pocket Lure Boy (J) [C][p1][!]"},
{0x8edb9eb7,524288,"Pocket Monsters Adventure (J) [C][p1][!]"},
{0x270c4ecc,2097152,"Pocket Monsters Crystal Glass (J) [C][!]"},
{0xa6e53a50,2097152,"Pocket Monsters Crystal Glass (J) [C][f1]"},
{0xa690ed9f,2097152,"Pocket Monsters Crystal Glass (J) [C][p1][!]"},
{0xdd13f234,524288,"Pocket Monsters GO!GO!GO! (J) [C][p1][!]"},
{0xdc8c08e8,1048576,"Pocket Monsters Gold (V1 Bung Fix) (V1.0) (J) [C][f1]"},
{0xf4bb388e,1048576,"Pocket Monsters Gold (V1 Bung Fix) (V1.1) (J) [C][f1]"},
{0x524478d4,1048576,"Pocket Monsters Gold (V1.0) (J) [C][!]"},
{0x4ef7f2a5,1048576,"Pocket Monsters Gold (V1.1) (J) [C][!]"},
{0x13c70de9,1048576,"Pocket Monsters Pinball (J) [C][!]"},
{0x98eb4a17,1048576,"Pocket Monsters Silver (V1 Bung Fix) (V1.0) (J) [C][f1]"},
{0x5447746b,1048576,"Pocket Monsters Silver (V1 Bung Fix) (V1.1) (J) [C][f1]"},
{0xbe1b928a,1048576,"Pocket Monsters Silver (V1.0) (J) [C][!]"},
{0x0aea5383,1048576,"Pocket Monsters Silver (V1.1) (J) [C][!]"},
{0x1926f570,1048576,"Pocket Monsters Trading Card Game (J) [C][!]"},
{0xe09f8243,1048576,"Pocket Monsters Trading Card Game (J) [C][a1]"},
{0xd7eb280b,1048576,"Pocket Monsters Trading Card Game (J) [C][BF1]"},
{0x54cb23d9,1048576,"Pocket Monsters Trading Card Game (J) [C][BF2]"},
{0x6c933a14,2097152,"Pocket Monsters Trading Card GB 2 - Team Great Rocket Visit! (J) [C][!]"},
{0xd4ebba41,2097152,"Pocket Pro Wrestling Perfect Wrestler (J) [C][!]"},
{0x870db337,1048576,"Pocket Puyo Puyo 4 (J) [C][!]"},
{0x45661ec3,1048576,"Pocket Puyo Sun (J) [C][!]"},
{0xfbf97372,1048576,"Pocket Racing (E) [C][!]"},
{0xe8f5824f,2097152,"Pocket Soccer (E) (M6) [C][!]"},
{0x25eee713,32768,"Pocket Voice Multi-ROM Menu V2.0 (Unl) [C]"},
{0x88dfcac5,32768,"Pocket Voice Multi-ROM Menu V2.1 (Unl) [C]"},
{0xcf904f72,524288,"Pocket Voice V1.0 (Unl) [C]"},
{0xb604a804,524288,"Pocket Voice V1.1 (Unl) [C]"},
{0x22da549e,262144,"Pocket Voice V1.1 (Unl) [C][a1]"},
{0x6a808bcf,262144,"Pocket Voice V1.1 (Unl) [C][a2]"},
{0xb5d34632,262144,"Pocket Voice V1.2 (Unl) [C]"},
{0xc34621ad,524288,"Pocket Voice V2.0 (Unl) [C]"},
{0x964b7a10,1048576,"Pokemon Amarillo (Yellow) (S) [C][!]"},
{0x3358e30a,2097152,"Pokemon Crystal (E) [C][!]"},
{0x878b2aa7,2097152,"Pokemon Crystal (F) [C][!]"},
{0x616d85de,2097152,"Pokemon Crystal (G) [C][!]"},
{0xf9b4798e,2097152,"Pokemon Crystal (I) [C][!]"},
{0xff0a6f8a,2097152,"Pokemon Crystal (S) [C][!]"},
{0xee6f5188,2097152,"Pokemon Crystal (U) [C][!]"},
{0xc075b6c5,1048576,"Pokemon Cute V1.4 (Yellow Hack) [C]"},
{0x6bf7e4a6,2097152,"Pokemon de Panepon (J) [C][!]"},
{0x41e3723c,2097152,"Pokemon Diamond (U) [p1][C][!]"},
{0xe4243849,1048576,"Pokemon Dreamland V1.4 (Pocket Monsters Gold Hack) [C]"},
{0x7a01e45a,1048576,"Pokemon Gelb (Yellow) (G) [C][!]"},
{0x8b56fe33,1048576,"Pokemon Giallo (Yellow) (I) [C][!]"},
{0x37a70702,2097152,"Pokemon Gold (F) [C][!]"},
{0x4889dfaa,2097152,"Pokemon Gold (G) [C][!]"},
{0x4c184ce3,2097152,"Pokemon Gold (I) [C][!]"},
{0x3434a92b,2097152,"Pokemon Gold (S) [C][!]"},
{0x6bde3c3e,2097152,"Pokemon Gold (U) [C][!]"},
{0xd03426e9,1048576,"Pokemon Jaune (Yellow) (F) [C][!]"},
{0x004096b8,1048576,"Pokemon of the Past DX V1.0 (Zelda DX hack by PR) (U) [C]"},
{0x3bc57f8c,1048576,"Pokemon of the Past DX V1.1 (Zelda DX hack by PR) (U) [C]"},
{0x39c432a4,2097152,"Pokemon Pinball (E) (M5) [C][!]"},
{0x03ce8d9a,1048576,"Pokemon Pinball (U) [C][!]"},
{0x8206b1ce,2097152,"Pokemon Puzzle Challenge (E) (M5) [C][!]"},
{0xd06bba96,2097152,"Pokemon Puzzle Challenge (U) [C][!]"},
{0xe0c216ea,2097152,"Pokemon Silver (F) [C][!]"},
{0x96c9db95,2097152,"Pokemon Silver (G) [C][!]"},
{0xcba6d2d4,2097152,"Pokemon Silver (I) [C][!]"},
{0x1d9faac5,2097152,"Pokemon Silver (S) [C][!]"},
{0x8ad48636,2097152,"Pokemon Silver (U) [C][!]"},
{0x4523376e,2097152,"Pokemon Trading Card Game (E) (M3) (Eng-Ger-Fre) [C][!]"},
{0x966daef1,2097152,"Pokemon Trading Card Game (E) (M3) (Eng-Spa-Ita) [C][!]"},
{0x81069d53,1048576,"Pokemon Trading Card Game (U) [C][!]"},
{0x7d527d62,1048576,"Pokemon Yellow (U) [C][!]"},
{0x7aace6a6,1048576,"Pokemon Yellow (U) [C][BF]"},
{0xdd8b189e,1048576,"Polaris SnoCross (U) [C][!]"},
{0x71693f5c,1048576,"Polaris SnoCross (U) [C][BF]"},
{0x476bd39d,1048576,"Pong - The Next Level (U) [C][!]"},
{0xfc67f7e4,1048576,"Pop 'N' Pop (E) [C][!]"},
{0x1cffb764,1048576,"Pop 'N' Pop (J) [C][!]"},
{0x9b2429a7,1048576,"Pop'N Music - Animated Melody (J) [C][!]"},
{0x48c3c6ef,1048576,"Pop'N Music - Disney Tunes (J) [C][!]"},
{0x07e6ca95,1048576,"Pop'N Music (J) [C][!]"},
{0x913ac306,1048576,"Portal Runner (U) [C][!]"},
{0xc2a4a3eb,2097152,"Power Pro Kun 2 (J) [C][!]"},
{0x145540d8,2097152,"Power Pro Kun Pocket (V1.0) (J) [C][!]"},
{0x894d88f2,2097152,"Power Pro Kun Pocket (V1.1) (J) [C][!]"},
{0x2a6ef6a8,1048576,"Power Proyaku Kun Baseball (J) [C][!]"},
{0x30e1e567,1048576,"Power Quest (E) (M6) [C][!]"},
{0x99869172,1048576,"Power Rangers Light Speed Rescue (U) [C][!]"},
{0x17e51443,1048576,"Power Rangers Time Force (U) [C][!]"},
{0xae57d1c3,1048576,"Power Spike - Pro Beach Volleyball (U) [C][!]"},
{0x834caf7a,2097152,"Powerpuff Girls, The - Bad Mojo Jojo (U) [C][!]"},
{0xd8455984,2097152,"Powerpuff Girls, The - Battle Him (U) [C][!]"},
{0x9d47261a,2097152,"Powerpuff Girls, The - Paint the Townsville Green (U) [C][!]"},
{0x2f368da6,2097152,"Poyon's Dungeon Room (J) [C][!]"},
{0x5e312730,2097152,"Poyon's Dungeon Room 2 (J) [C][!]"},
{0x91def753,2097152,"Prince Naseem Boxing (E) (M3) [C][!]"},
{0xe6bec6d1,1048576,"Prince of Persia (E) (M5) [C][!]"},
{0x834a72c0,1048576,"Pro Darts (U) [C][!]"},
{0x1461d8d8,1048576,"Pro Mahjong Tsuwamono (J) [C][!]"},
{0xf03016f5,1048576,"Pro Mahjong Tsuwamono 2 (J) [C][!]"},
{0x04d3031a,1048576,"Pro Pool (E) (M3) [C][!]"},
{0x20cee2e8,524288,"Project S-11 (U) [C][!]"},
{0xa9a89dda,1048576,"Puchi Carat (E) [C][!]"},
{0xf0d0c36d,1048576,"Puchi Carat (J) [C][!]"},
{0xf55cdb79,1048576,"Pumuckl's Abenteuer bei den Piraten (G) [C][!]"},
{0x87fcec24,1048576,"Pumuckl's Abenteuer im Geisterschloss (G) [C][!]"},
{0x67350bc9,1048576,"Puyo Wars (J) [C][!]"},
{0xaf858234,1048576,"Puzz Loop (J) [C][!]"},
{0x79a35284,524288,"Puzzle Bobble 4 (J) [C][!]"},
{0x00fded94,1048576,"Puzzle Bobble Millennium (J) [C][!]"},
{0x73ed3042,1048576,"Puzzle De Shoubuyo Wootamachan (J) [C][!]"},
{0x06eb7a01,1048576,"Puzzle Master (U) [C][!]"},
{0x15b44d68,1048576,"Puzzled (E) (M3) [C][!]"},
{0xf03ffdaf,1048576,"Puzzled (U) [C][!]"},
{0x90f46d7e,1048576,"Q-bert (U) [C][!]"},
{0xd729db40,1048576,"Qix Adventure (E) [C][!]"},
{0x5acea4a9,1048576,"Qix Adventure (J) [C][!]"},
{0x98285775,1048576,"Quest - Fantasy Challenge (U) [C][!]"},
{0xce55a4de,1048576,"Quest for Camelot (E) (M6) [C][!]"},
{0xd903db7d,1048576,"Quest for Camelot (U) (M3) [C][!]"},
{0x9ac27645,2097152,"Quest RPG (U) [C][!]"},
{0x56d76ba2,1048576,"Qui Qui (J) [C][!]"},
{0x6decc6b3,1048576,"Rainbow Islands (E) (M5) [C][!]"},
{0xb029017f,524288,"Rampage - World Tour (U) [C][!]"},
{0x20b86f1e,1048576,"Rampage 2 - Universal Tour (U) [C][!]"},
{0xd5aeed2e,1048576,"Rampart (U) [C][!]"},
{0x17635ad1,524288,"Rats! (UE) (M2) [C][!]"},
{0xc430a89a,4194304,"Rayman (E) [C][!]"},
{0x3fde5bac,4194304,"Rayman (J) [C][!]"},
{0xeda12f0d,4194304,"Rayman (U) [C][!]"},
{0x5c201286,1048576,"Razor Freestyle Scooter (U) [C][!]"},
{0x345e20a4,2097152,"Ready 2 Rumble Boxing (U) [C][!]"},
{0xafff6bb9,524288,"Real Baseball - Continental League (J) [C][!]"},
{0x16b81c36,524288,"Real Baseball - Pacific League (J) [C][!]"},
{0x77a4dc63,1048576,"Rescue Heroes - Fire Frenzy (U) [C][!]"},
{0x22621803,524288,"Reservoir Rats (E) (M5) [C][!]"},
{0x6c432979,2097152,"Resident Evil Gaiden (E) [C][!]"},
{0x8e04849a,1048576,"Return of the Ninja (E) [C][!]"},
{0xa07da702,1048576,"Return of the Ninja (U) [C][!]"},
{0xd1a65d74,1048576,"Revelations - The Demon Slayer (U) [C][!]"},
{0xa6fa9f09,1048576,"Revelations - The Demon Slayer (U) [C][BF]"},
{0x73160e05,1048576,"Rhino Rumble (U) [C][!]"},
{0xab8c3a31,1048576,"Rip-Tide Racing (E) (M5) [C][!]"},
{0xf0b09ddb,1048576,"River Fishing 4 (J) [C][!]"},
{0x98c59706,1048576,"Road Champs BXS Stunt Biking (U) [C][!]"},
{0x11025eeb,1048576,"Road Rash (U) [C][!]"},
{0xfe2995a1,131072,"Roadsters '98 (U) [C][!]"},
{0x717b3525,1048576,"Roadsters Trophy (E) (M6) [C][!]"},
{0xd4f84329,1048576,"Robin Hood (E) (M6) [C][!]"},
{0x6c6423e2,1048576,"Robocop (U) (M6) [C][!]"},
{0xb28f32ac,1048576,"Robopon Star (J) [C][!]"},
{0xfa57ea6a,1048576,"Robopon Star (J) [C][BF]"},
{0xcb0b8003,1048576,"Robopon Sun (J) [C][!]"},
{0x89d389ba,1048576,"Robopon Sun (J) [C][BF]"},
{0x32caef11,1048576,"Robopon Sun (U) [C][!]"},
{0x87a29030,1048576,"Robot Ponkottsu Moon Version (J) [C][!]"},
{0xe99bdee6,1048576,"Robot Wars Metal Mayhem (E) (M6) [C][!]"},
{0x7025eb63,1048576,"Rocket Power - Gettin' Air (U) [C][!]"},
{0xc9a7aa7b,1048576,"Rocket Racer - La Glisse De L'Extreme (F) [C][!]"},
{0x919077ab,1048576,"Rockman X (J) [C][!]"},
{0x17913dd0,1048576,"Rockman X2 - Soul Eraser (J) [C][!]"},
{0x9aa5b021,1048576,"Rocky Mountain Trophy Hunter (U) [C][!]"},
{0x10dbde7c,1048576,"Roland Garros French Open (E) (M6) [C][!]"},
{0xa856c066,1048576,"Ronaldo V.Football (E) (M7) [C][!]"},
{0x49101556,1048576,"Roswell Conspiracies - Aliens, Myths & Legends (E) (M3) [C][!]"},
{0x1f5ec131,1048576,"Roswell Conspiracies - Aliens, Myths & Legends (U) (M3) [C][!]"},
{0x2e944775,262144,"Rox (E) [C][!]"},
{0x4bd73d99,262144,"Rox (J) [C][!]"},
{0x0b614307,2097152,"RPG Maker (J) [C][!]"},
{0x3623ebb6,1048576,"R-Type DX (J) [C][!]"},
{0xfc1d4089,1048576,"R-Type DX (U) [C][!]"},
{0x9c743f03,1048576,"Rugrats - Time Travelers (U) [C][!]"},
{0xfc6195ef,1048576,"Rugrats - Totally Angelica (U) [C][!]"},
{0x026c4794,1048576,"Rugrats - Typisch Angelica (G) [C][!]"},
{0x094494e9,1048576,"Rugrats in Paris - The Movie (F) [C][!]"},
{0x8b195237,1048576,"Rugrats in Paris - The Movie (U) [C][!]"},
{0xb4091600,1048576,"Rugrats Movie, The (U) [C][!]"},
{0x2cf48188,1048576,"Sabrina - The Animated Series - Spooked (U) [C][!]"},
{0x818f3af6,2097152,"Sabrina - The Animated Series - Zapped! (E) (M3) [C][!]"},
{0x5d39a9b0,2097152,"Sabrina - The Animated Series - Zapped! (U) [C][!]"},
{0xb5412c6f,1048576,"Sakata (J) [C][!]"},
{0xef503d50,4194304,"Sakura Wars (J) [C][!]"},
{0xef368f16,1048576,"San Francisco Rush 2049 (U) [C][!]"},
{0xe787b44c,1048576,"Sangokushi 2 (J) [C][!]"},
{0x8cfdc80f,1048576,"Sangokushi 2 (J) [C][p1][!]"},
{0xefe51e17,1048576,"Sanrio Timenet Future (J) [C][!]"},
{0x458b579d,1048576,"Sanrio Timenet Past (J) [C][!]"},
{0xe3704755,1048576,"Scooby-Doo! Classic Creep Capers (U) [C][!]"},
{0x365bf43f,1048576,"SD Hiryu Ex (J) [C][!]"},
{0xfd4e9a51,1048576,"SD Hiryu Ex (J) [C][BF]"},
{0x612f0529,1048576,"Sei Hai (J) [C][!]"},
{0x8804f856,1048576,"Sei Hai (J) [C][f1]"},
{0x0b1b928c,2097152,"Seme COM Dungeon - Druaga (J) [C][!]"},
{0x23fa5f53,1048576,"Senkai Imonroku Junteitaisen (J) [C][!]"},
{0x521a2f77,1048576,"Sgt. Rock - On The Front Line (U) [C][!]"},
{0xf6a876a5,1048576,"Shadowgate Classic (V1.0) (E) (M5) [C][!]"},
{0xd337f450,1048576,"Shadowgate Classic (V1.1) (E) (M5) [C][!]"},
{0x1bcd7d70,1048576,"Shadowgate Return (J) [C][!]"},
{0xefb9196d,1048576,"Shamus (U) [C][!]"},
{0xa5e3ece9,1048576,"Shanghai Pocket (J) [C][!]"},
{0x9401ba47,1048576,"Shanghai Pocket (V1.0) (U) [C][!]"},
{0xd8fac36c,1048576,"Shanghai Pocket (V1.1) (U) [C][!]"},
{0x709cda93,2097152,"Shaun Palmer's Pro Snowboarder (U) [C][!]"},
{0x85264877,2097152,"Shin Megami Tensei Trading Card Summoner (J) [C][!]"},
{0x3a96e868,1048576,"Shogi Oh (J) [C][!]"},
{0x28356950,1048576,"Shoubushi Densetsu Tetsuya Shinjuku Tenun hen (J) [C][!]"},
{0xa7748d2b,262144,"Shougi 2 (J) [C][!]"},
{0x387e6459,2097152,"Shrek Fairy Tale Freakdown (U) (M6) [C][!]"},
{0xebaf4888,1048576,"Simpsons, The - Night of the Living Treehouse of Horror (U) [C][!]"},
{0x6dd8ac91,1048576,"Sirubaniamorinonakama (J) [C][!]"},
{0x6f97b043,1048576,"Smurfs Nightmare, The (E) (M4) [C][!]"},
{0xd882eccc,1048576,"Snoopy Tennis (E) (M3) [C][!]"},
{0xc9c68471,1048576,"Snow White And The Seven Dwarfs (E) (M9) [C][!]"},
{0x846fea2b,1048576,"Snowboard Champion (J) [C][!]"},
{0x4ba47dbc,1048576,"Snowcross (E) (M6) [C][!]"},
{0x237ecef9,1048576,"Soccer Manager (E) (M4) [C][!]"},
{0x6aee0958,1048576,"Solomon - Cox Adventure of the White Tower (J) [C][!]"},
{0xdec1260e,524288,"Sonic 7 (Unl) [C]"},
{0x7ecbcd39,1049088,"Soreike! Anpanman 2 (J) [C][!]"},
{0x3ffcd45b,2097152,"Soul Getter (J) [C][!]"},
{0xdab7460c,1048576,"Space Invaders (U) [C][!]"},
{0xc016bc79,1048576,"Space Invaders X (J) [C][!]"},
{0x60dfa546,131072,"Space Invasion (Thalamus Interactive) V0.01 (E) [C]"},
{0x4f83b35e,1048576,"Space Marauder (U) [C][!]"},
{0x63353c0f,2097152,"Space Station Silicon Valley (E) (M7) [C][!]"},
{0xf606d369,2097152,"Space-Net Cosmo Blue (J) [C][!]"},
{0x01f96353,2097152,"Space-Net Cosmo Red (J) [C][!]"},
{0x72fcb0ad,2097152,"Spawn (U) [C][!]"},
{0xf4010cbd,2097152,"Spawn (U) [C][BF]"},
{0xae82afa4,1048576,"Speedy Gonzales - Aztec Adventure (U) [C][!]"},
{0xf6334dc5,1048576,"Spider-Man (F) [C][!]"},
{0x5a83dfc4,1048576,"Spider-Man (J) [C][!]"},
{0x34e2b3ba,1048576,"Spider-Man (U) [C][!]"},
{0xa7faaccf,1048576,"Spider-Man 2 - The Sinister Six (U) [C][!]"},
{0x3e9bc90b,1048576,"Spirou La Panque Mecanique (E) (M7) [C][!]"},
{0x81230564,1048576,"SpongeBob SquarePants - Legend of the Lost Spatula (U) [C][!]"},
{0x713c6c17,1048576,"Spy vs Spy (E) (M7) [C][!]"},
{0x0e783117,1048576,"Spy vs Spy (J) [C][!]"},
{0xfc551dab,1048576,"Spy vs Spy (J) [C][f1]"},
{0xf0463d51,1048576,"Spy vs Spy (U) [C][!]"},
{0x8c7ddbda,4194304,"Star Ocean - Bluesphere (J) [C][!]"},
{0xe584dfc2,1048576,"Star Wars Episode 1 - Obi-Wan's Adventures (E) (M5) [C][!]"},
{0x0e697582,1048576,"Star Wars Episode 1 - Obi-Wan's Adventures (U) [C][!]"},
{0x0ebc5758,2097152,"Star Wars Episode I Racer (UE) [C][!]"},
{0x816a4d94,1048576,"Stranded Kids (E) (M3) [C][!]"},
{0x28a3ab3a,1048576,"Street Fighter Alpha (E) [C][!]"},
{0x32739b34,1048576,"Street Fighter Alpha (J) [C][!]"},
{0xaa5f14d2,1048576,"Street Fighter Alpha (U) [C][!]"},
{0xeb273887,1048576,"Stuart Little - The Journey Home (U) [C][!]"},
{0x5c95d5a2,1048576,"Super B-Daman (J) [C][!]"},
{0xb7f77b6a,4194304,"Super Black Bass - Real Fight (J) [C][!]"},
{0xae466545,1048576,"Super Black Bass Pocket 3 (J) [C][!]"},
{0x34c8a4a5,262144,"Super Bombliss DX (U) [C][!]"},
{0x6833923d,524288,"Super Breakout! (E) (M6) [C][!]"},
{0x52f51cb5,1048576,"Super Breakout! (U) [C][!]"},
{0xdcdaa333,1048576,"Super Chinese Fighter EX (J) [C][!]"},
{0xdf50473f,1048576,"Super Doll Rika Chan Kisekae Daisakusen (J) [C][!]"},
{0x866b1212,1048576,"Super Mario Bros. DX (J) [C][!]"},
{0xa4cd26ff,1048576,"Super Mario Bros. DX (V1.0) (U) [C][!]"},
{0x90ab047b,1048576,"Super Mario Bros. DX (V1.1) (U) [C][!]"},
{0x00865161,1048576,"Super Real Fishing (J) [C][!]"},
{0x6e330fcd,2097152,"Super Robot Pinball (J) [C][!]"},
{0xcbb7159f,1048576,"Super Robot War Final Volume 1 (Unl) [p1][C]"},
{0xd24e592d,1048576,"Super Robot Wars Link Battler (J) [C][!]"},
{0x4d3e0f51,2097152,"Supercross Freestyle (E) (M5) [C][!]"},
{0x53b1e661,2097152,"Supreme Snowboarding (E) (M3) [C][!]"},
{0x19c2bd07,1048576,"Survival Kids (J) [C][!]"},
{0xea314903,1048576,"Survival Kids (J) [C][f1]"},
{0x61fa675c,1048576,"Survival Kids (J) [C][f2]"},
{0xc46aba56,1048576,"Survival Kids (U) [C][!]"},
{0xab8b25d8,1048576,"Survival Kids 2 (J) [C][!]"},
{0x0f7264ba,524288,"Suzuki Alstare Extreme (E) (M6) [C][!]"},
{0x4be9b159,1048576,"Sweet Ange (J) [C][!]"},
{0x7041929d,1048576,"SWiNG (G) [C][!]"},
{0x44d30b7a,1048576,"SWIV (E) (M5) [C][!]"},
{0xc6fe4497,2097152,"Sylvania Family (J) [C][!]"},
{0xf82d391f,2097152,"Sylvania Family 2 (J) [C][!]"},
{0x698d7be4,1048576,"Sylvester and Tweety (E) (M3) [C][!]"},
{0x6bb3b0dc,1048576,"Sylvester and Tweety (E) (M6) [C][!]"},
{0xf09f92d7,1048576,"Tabaluga (G) [C][!]"},
{0x95310c8b,1048576,"Taisen Tsume Shogi (J) [C][!]"},
{0x725cf31c,2097152,"Tales of Phantasia - Narikiri Dungeon (J) [C][!]"},
{0x81fb43e1,1048576,"Tango! (J) [C][!]"},
{0x39d04581,2097152,"Tarzan (G) [C][!]"},
{0xf2005973,2097152,"Tarzan (J) [C][!]"},
{0x4224f930,2097152,"Tarzan (U) [C][!]"},
{0x0fd9fff0,1048576,"Taxi 2 (F) [C][!]"},
{0x683752a0,1048576,"Tazmanian Devil - Munching Madness (E) (M5) [C][!]"},
{0x3611d0d8,1048576,"Tazmanian Devil - Munching Madness (U) (M5) [C][!]"},
{0xc07ebe70,1048576,"Tech Deck Skateboarding (U) [C][!]"},
{0x8f16393f,2097152,"Telefang - Power Version (J) [C][!]"},
{0xfb528f66,2097152,"Telefang - Speed Version (J) [C][!]"},
{0xbb894ec7,2097152,"Test Drive 2001 (U) [C][!]"},
{0x2f179045,1048576,"Test Drive 6 (Coke 'Destinations Toutes Sensations') (F)[C][!]"},
{0x5ce00547,1048576,"Test Drive 6 (U) [C][!]"},
{0xe32bb06f,1048576,"Test Drive Cycles (U) [C][!]"},
{0xe6d6ac8f,1048576,"Test Drive Le Mans (U) [C][!]"},
{0x0fdd5b9e,1048576,"Test Drive Off-Road 3 (U) [C][!]"},
{0x69989152,524288,"Tetris DX (JU) [C][!]"},
{0x1cbea1aa,1048576,"Three Lions (U) (M7) [C][!]"},
{0x648e44b8,262144,"Thunder Blast Man (J) [C][!]"},
{0xb5bececf,2097152,"Thunderbirds (F) [C][!]"},
{0xa6dfb1d9,1048576,"Tiger Woods PGA Tour 2000 (U) [C][!]"},
{0xb2205d49,1048576,"TinTin - Le Temple du Soleil (E) (M3) [C][!]"},
{0x6832f38a,1048576,"TinTin in Tibet (E) (M7) [C][!]"},
{0x7aa371ed,1048576,"Tiny Toons - Buster Saves the Day (E) (M5) [C][!]"},
{0x800efb3d,1048576,"Tiny Toons - Buster Saves the Day (U) [C][!]"},
{0x5a0d41aa,1048576,"Tiny Toons - Dizzy's Candy Quest (E) (M6) [C][!]"},
{0x1972cbf7,1048576,"Titeuf (E) (M6) [C][!]"},
{0x2f9f19de,1048576,"Titus the Fox (E) [C][!]"},
{0x00a14d18,1048576,"TNN Outdoors Fishing Champ (U) [C][!]"},
{0xb509892b,1048576,"Toca Touring Car Championship (U) [C][!]"},
{0x0a0f9289,1048576,"Toki Tori (U) [C][!]"},
{0x4be4a8ed,4194304,"Tokimeki Culture (J) [C][!]"},
{0x78e14fa9,4194304,"Tokimeki Sport (J) [C][!]"},
{0x9139e307,1048576,"Tokoro San no Setagaya Country Club (J) [C][!]"},
{0x3e17d04a,1048576,"Tom & Jerry - Mouse Hunt (E) (M5) [C][!]"},
{0x5fc6bec0,1048576,"Tom & Jerry - Mouse Hunt (U) [C][!]"},
{0xb97c0bd9,1048576,"Tom & Jerry (U) [C][!]"},
{0x9d9c84f4,2097152,"Tom & Jerry in Mouse Attacks! (E) (M7) [C][!]"},
{0x38ce3f76,2097152,"Tom & Jerry in Mouse Attacks! (U) [C][!]"},
{0xe72f2683,1048576,"Tom Clancy's Rainbow Six (U) (M3) [C][!]"},
{0x02c1035a,4194304,"Tomb Raider - Curse of the Sword (U) [C][!]"},
{0x2988fc78,4194304,"Tomb Raider (E) (M5) [C][!]"},
{0x58590868,4194304,"Tomb Raider (UE) (M5) (Beta) [C][!]"},
{0xa8628f7a,1048576,"Tonic Trouble (E) (M6) [C][!]"},
{0xe108b2c2,1048576,"Tonka Raceway (E) [C][!]"},
{0xa5af4b28,1048576,"Tonka Raceway (U) [C][!]"},
{0x8d8bb5c4,1048576,"Tony Hawk's Pro Skater (U) [C][!]"},
{0x2c27c61f,2097152,"Tony Hawk's Pro Skater 2 (U) [C][!]"},
{0xfd5290a1,1048576,"Tony Hawk's Pro Skater 3 (U) [C][!]"},
{0x3d6b598c,1048576,"Toobin' (U) [C][!]"},
{0x6573b88f,1048576,"Toonsylvania (E) (M6) [C][!]"},
{0xebcca3da,1048576,"Top Gear Pocket (J) [C][!]"},
{0x84499fc1,1048576,"Top Gear Pocket (U) [C][!]"},
{0x1845f25a,1048576,"Top Gear Pocket 2 (J) (Kemco) [C][!]"},
{0xefb87f80,1048576,"Top Gear Pocket 2 (U) (Vadical) [C][!]"},
{0x337e5dd3,1048576,"Top Gear Rally (U) [C][!]"},
{0xdcc60117,1048576,"Top Gear Rally (U) [C][BF]"},
{0x017773cd,1048576,"Top Gear Rally 2 (E) [C][!]"},
{0x283cf13a,1048576,"Top Gun - Firestorm (U) (M6) [C][!]"},
{0xc25ee35a,1048576,"Total Soccer 2000 (E) (M6) [C][!]"},
{0x0aeae8fb,4194304,"Totsugeki! Papparatai (J) [C][!]"},
{0x19eb4516,1048576,"Tottoko Hum Taru (J) [C][!]"},
{0xf1fbcf84,2097152,"Tottoko Hum Taru 2 (J) [C][!]"},
{0x4a5f1e2b,131072,"Touch Boy System ROM (Unl) [C]"},
{0x7b9b2468,1048576,"Towers - Lord Baniff's Deceit (U) [C][!]"},
{0x47aecb95,1048576,"Toy Story 2 (U) [C][!]"},
{0xf660ed94,2097152,"Toy Story Racing (E) (M3) [C][!]"},
{0xd911dd97,2097152,"Toy Story Racing (U) [C][!]"},
{0x77f76ebc,1048576,"Track & Field GB (J) [C][!]"},
{0xbf33a212,1048576,"Track & Field GB (J) [C][f1]"},
{0x4c7258d9,1048576,"Treasure World (J) [C][!]"},
{0x31740097,1048576,"Trick Boarder (J) [C][!]"},
{0xe856dc3d,1048576,"Trick Boarder (U) [C][!]"},
{0x74e04c07,1048576,"Triple Play 2001 (U) [C][!]"},
{0x0bab7a61,2097152,"Tri-Zenon (J) [C][!]"},
{0x260eed04,524288,"Trouballs (U) [C][!]"},
{0x1be00a6e,2097152,"Turi Sensei 2 (J) [C][!]"},
{0x786b5ab4,1048576,"Turok - Rage Wars (E) (M4) [C][!]"},
{0xf095b446,1048576,"Turok 2 - Seeds of Evil (J) [C][!]"},
{0x6eda6a3a,1048576,"Turok 2 - Seeds of Evil (U) (M4) [C][!]"},
{0x6d48765e,1048576,"Turok 3 - Shadow of Oblivion (E) (M4) [C][!]"},
{0x2f2c418b,1048576,"Turok 3 - Shadow of Oblivion (E) (M5) [C][!]"},
{0x9306edd0,1048576,"Tweenies - Doodles' Bones (E) (M4) [C][!]"},
{0x147f427a,1048576,"Tweety - The World Goes Around (J) [C][!]"},
{0x7361d6bc,1048576,"Tweety's Highflying Adventures (E) (M3) [C][!]"},
{0xce55ed18,1048576,"Tweety's Highflying Adventures (F) [C][!]"},
{0xd6881014,1048576,"Tyco RC Racin' Ratz (U) [C][!]"},
{0x4b314d4b,1048576,"UEFA 2000 (E) (M6) [C][!]"},
{0xd5f036ce,1048576,"Ultimate Fighting Championship (U) [C][!]"},
{0x6dcfdfe2,1048576,"Ultimate Paintball (U) [C][!]"},
{0xe84df1f0,1048576,"Ultimate Surfing (U) [C][!]"},
{0x1766e558,524288,"Ultra 3D Pinball - Thrillride (U) [C][!]"},
{0x70760cce,1048576,"Uno (E) (M6) [C][!]"},
{0xf026d509,1048576,"Uno (U) [C][!]"},
{0xa80eeead,1048576,"Unpanma (J) [C][!]"},
{0x81b2bb8d,1048576,"Vegas Games (E) (M3) [C][!]"},
{0x40b5ea96,1048576,"Vegas Games (U) [C][!]"},
{0xd1a188dc,1048576,"Vigilante 8 (U) [C][!]"},
{0xdbdd6d85,1048576,"VIP (E) (M5) [C][!]"},
{0xda300c6c,1048576,"V-Rally - Championship Edition (E) (M3) [C][!]"},
{0x1312b3f7,1048576,"V-Rally - Championship Edition (E) (M4) [C][!]"},
{0xfab9d941,1048576,"V-Rally - Championship Edition (J) [C][!]"},
{0x947d45ae,4194304,"VS Lemmings (J) [C][!]"},
{0x37ea6093,1048576,"Wacky Races (E) (M6) [C][!]"},
{0x543abb1b,1048576,"Wacky Races (U) [C][!]"},
{0x56beb694,2097152,"Walt Disney World Quest - Magical Racing Tour (U) [C][!]"},
{0xe93f1582,1048576,"Warau Inu no Bouken (J) [C][!]"},
{0xb30fdbf5,2097152,"Warioland 2 (J) [C][!]"},
{0xa13017d4,2097152,"Warioland 2 (J) [C][f1]"},
{0x047bdf80,2097152,"Warioland 2 (U) [C][!]"},
{0x359c31c4,2097152,"Warioland 2 (U) [C][f1]"},
{0x480d0259,2097152,"Warioland 3 (J) (M2) [C][!]"},
{0xcfa0df0f,2097152,"Warlocked (U) [C][!]"},
{0xef9f5bea,1048576,"Warriors of Might and Magic (U) [C][!]"},
{0x9f8620d1,1048576,"WCW Mayhem (U) [C][!]"},
{0x2267360b,4194304,"Welcome to Pia Carrot 2.2 (J) [C][!]"},
{0x4ac6907b,1048576,"Wendy - Every Witch Way (U) [C][!]"},
{0x9cbfaa3d,1048576,"Wetrix GB (E) [C][!]"},
{0x6215c5b3,1048576,"Wetrix GB (J) [C][!]"},
{0x6830b7af,1048576,"Who Wants to Be a Millionaire - 2nd Edition (U) [C][!]"},
{0x0e1465cb,1048576,"Wild Thornberrys Rambler, The (U) [C][!]"},
{0x6d59104f,1048576,"Wings of Fury (E) (M3) [C][!]"},
{0xc94a413a,1048576,"Wings of Fury (U) [C][!]"},
{0x1db0840c,2097152,"Winnie the Pooh - Adventures in the 100 Acre Wood (E)(M7)[C][!]"},
{0x476ede93,2097152,"Winnie the Pooh - Adventures in the 100 Acre Wood (J) [C][!]"},
{0x066a2196,2097152,"Winnie the Pooh - Adventures in the 100 Acre Wood (U) [C][!]"},
{0x7adc90e1,1048576,"Wizardry Empire (V1.0) (J) [C][!]"},
{0xfa82620f,1048576,"Wizardry Empire (V1.1) (J) [C][!]"},
{0x1a10552b,1048576,"Wizardry Empire I - Fukkatsu no Tsue (J) [C][!]"},
{0xa99a33dc,1048576,"Wizardry I - Proving Grounds of the Mad Overlord (J) [C][!]"},
{0xdd727f1a,1048576,"Wizardry II - Legacy of Llylgamyn (J) [C][!]"},
{0xd44d3596,1048576,"Wizardry III - Knights of Diamonds (J) [C][!]"},
{0x2612f8c4,1048576,"Woody Woodpecker - Escape from Buzz Buzzard's Park (E) (M5) [C][!]"},
{0xbd2d1f8b,1048576,"Woody Woodpecker - Escape from Buzz Buzzard's Park (U) [C][!]"},
{0xf59daa99,1048576,"Woody Woodpecker no Go! Go! Racing (J) [C][!]"},
{0xb0f43498,1048576,"Woody Woodpecker Racing (U) [C][!]"},
{0x1a0bf4d7,1048576,"World Destruction League Thunder Tanks (U) [C][!]"},
{0x6775b29e,2097152,"World Soccer Gameboy 2000 (J) [C][!]"},
{0xdd18db5f,1048576,"World Soccer GB 2 (J) [C][!]"},
{0xcb04f34d,1048576,"Worms Armageddon (E) (M6) [C][!]"},
{0xd5fdf68a,1048576,"WWF Attitude (U) [C][!]"},
{0x05cb3b90,1048576,"WWF Attitude (U) [C][f1]"},
{0x6c28bcb5,1048576,"WWF Betrayal (U) [C][!]"},
{0xfcba12ae,1048576,"WWF Wrestlemania 2000 (U) [C][!]"},
{0xf0de3ce7,1048576,"Xena - Warrior Princess (U) [C][!]"},
{0x104968e7,4194304,"Xin Tiao Hui Yi (Chinese) (Unl) [C][!]"},
{0x8162adc1,1048576,"X-Men - Mutant Academy (J) [C][!]"},
{0xec6278a3,1048576,"X-Men - Mutant Academy (U) [C][!]"},
{0x921999e2,1048576,"X-Men - Mutant Wars (U) [C][!]"},
{0x12fc1a6e,1048576,"X-Men - Wolverine's Rage (U) [C][!]"},
{0x19828751,4194304,"Xtreme Sports (U) [C][!]"},
{0xe101246f,1048576,"Xtreme Wheels (E) [C][!]"},
{0x129465db,1048576,"Xtreme Wheels (U) [C][!]"},
{0xaa05daf1,2097152,"Yakochu (J) [C][!]"},
{0xd6a26444,1048576,"Yar's Revenge - The Quotile Ultimatum (U) [C][!]"},
{0x6314da32,1048576,"Yoda Stories (U) [C][!]"},
{0xf817e978,1048576,"Yogi Bear - Great Ballon Blast (U) [C][!]"},
{0x2a783280,2097152,"Yongzhe Dou Elong 1 & 2 (Unl) [C]"},
{0x1371e872,1048576,"Yu-Gi-Oh! - Capsule (J) [C][!]"},
{0xba7182c3,4194304,"Yu-Gi-Oh! - Dark Duel Stories II - Duel Monsters (J) [C][!]"},
{0x9f9dbab4,4194304,"Yu-Gi-Oh! - Dark Duel Stories III (J) [C][!]"},
{0x298bd054,4194304,"Yu-Gi-Oh! 4 - Johnouchi Deck (J) [C][!]"},
{0xa4d06001,4194304,"Yu-Gi-Oh! 4 - Kaiba Deck (J) [C][!]"},
{0x4d6105f6,4194304,"Yu-Gi-Oh! 4 - Yugi Deck (J) [C][!]"},
{0x692d6794,1048576,"Z - Miracle of the Zone 2, The (J) [C][!]"},
{0x3cc6b1f9,1048576,"Zebco Fishing (U) [C][!]"},
{0xe47308dd,2097152,"Zelda Shi Kong Zhi Zhang (Encrypted) (Unl) [C]"},
{0xe96dbfb5,1048576,"Zidane - Football Generation (E) (M5) [C][!]"},
{0x38d91885,1048576,"Zoboomafoo - Playtime In Zobooland (U) [C][!]"},
{0xf36c874d,2097152,"Zoids (J) [C][!]"},
{0xc09f9e1b,2097152,"Zok Zok Heroes (J) [C][!]"},
{0xfd73992d,65536,"Carillon Player & FX Hammer V1.0 - 7645HZ Sample Player (PD)[C]"},
{0xc7be299e,65536,"Donkey Kong (NES Conversion) (PD) [a1][C]"},
{0x45f19cec,787288,"Fire Demo (PD) (no emulator runs) [C]"},
{0x4598b4b4,1048576,"Barbie - Magic Genie (Chinese) [C][p1][!]"},
{0x3be86e8d,2097152,"Bokujo Monogatari GB 3 - Boy Meets Girl (Chinese) (Unl) [C]"},
{0x26ced667,1048576,"Last Bible 2 (Chinese) [C][p1][!]"},
{0x0a80b185,1048576,"Survival Kids (U) [C][p1][T-Chinese][!]"},
{0x7ded5c71,1048576,"Baby Felix Halloween (E) (M6) [C][!]"},
{0x885634e6,1048576,"Bakuhashi Senki Metal Walker - Kkoute no Yuujyou (Chinese) (Unl) [C]"},
{0xbc306ea4,2097152,"Bakuten Shoot Bey Blade (J) [C]"},
{0x12f0c196,1048576,"Catwomen (U) [C][!]"},
{0x20faa0d1,1048576,"Chibi Maruko Chan (J) [C]"},
{0x48e1ba7d,4194304,"Cross Hunter - Monster Hunter Version (J) [C][!]"},
{0x623c1516,4194304,"Cross Hunter - Treasure Hunter Version (J) [C][!]"},
{0x858010e0,4194304,"Cross Hunter - X Hunter Version (J) [C][!]"},
{0x2bb01aad,1048576,"Daikatana (J) [C][!]"},
{0xb31a59bf,2097152,"Dance Dance Revolution Disney Mix (J) [C][!]"},
{0xe338c118,2097152,"Dance Dance Revolution Ohasuta (J) [C][!]"},
{0x753bdce4,1048576,"David Beckham Soccer (E) (M5) [C][!]"},
{0xcabdd802,2097152,"Detective Conan 3 - Norowareta Kouro (J) [C][!]"},
{0x3a9602e8,1048576,"Die Monster AG (G) [C][!]"},
{0x63948092,2097152,"Digital Monsters 3 (Chinese) (Unl) [C][!]"},
{0xebe0ecd6,1048576,"Diva Starz - Mall Mania (U) [C][!]"},
{0x4685909b,4194304,"Donald Duck (U) (M5) [C][!]"},
{0x9dad6e23,2097152,"Dragon Ball Z - Guerreros de Leyenda (F) [C][!]"},
{0x01d31c9e,4194304,"Dragon Quest III (Chinese) (Unl) [C]"},
{0xbd651350,4194304,"Dragon Quest Monsters 2 - Ruka's Adventure (Chinese) (Unl) [C]"},
{0x42ceb854,4194304,"DT - Lords of Genomes (J) [C][!]"},
{0x086106de,1048576,"E.T. Escape From Planet Earth (U) [C][!]"},
{0x84872999,1048576,"E.T. The Extra Terrestrial Digital Companion (U) [C]"},
{0x54617416,2097152,"Estpolis Denki Yomigaeru Densetsu (J) [C][!]"},
{0xcc777b98,1048576,"Extreme Ghostbusters (E) (M6) [C][!]"},
{0xd6abc1f8,4194304,"Fish Files, The (E) [C]"},
{0xa7317bb8,4194304,"From TV Animation - One Piece - Maboroshi no Grand Line Boukenhen! (J) [C][!]"},
{0x30c26262,1048576,"Gameboy Wars 3 (J) [C][!]"},
{0xbcdf9d53,524288,"GPSboy (U) [C]"},
{0x78206460,2097152,"Gaiamaster Dual Card Attackers (J) [C][!]"},
{0x053bc315,1048576,"Gremlins (E) (M6) [C]"},
{0x469f0284,2097152,"Hana Yori Dango - Another Love Story (J) [C][!]"},
{0x8cabdca4,2097152,"Hero Hero Kun (J) [C][!]"},
{0x2da2686a,4194304,"Harry Potter and The Sorceror's Stone (J) [C][!]"},
{0x018eed29,1048576,"Hello Kitty and Dear Daniel Dream Adventure (J) [C][!]"},
{0x159fe5e7,4194304,"Hello Kitty No Happy House (J) [C][!]"},
{0x558f4631,2097152,"J. League Excite Stage Tactics (J) [C][!]"},
{0xd60e1c0a,4194304,"Jankyusei (J) [C][!]"},
{0x6d50772d,1048576,"JumpStart Dino Adventure (U) [C]"},
{0x380f19ed,2097152,"Konchu Hakase 3 (J) [C][!]"},
{0xc30d7e03,2097152,"Legend of Zelda, The - Link's Awakening DX (J) [C][p1][T-Chinese][!]"},
{0x06887a34,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.2) (U) [C][!]"},
{0x29e193c5,262144,"Loppi Puzzle Magazine - Hirameku 2 (J) [C][!]"},
{0x69db3cd8,1048576,"Mary-Kate & Ashley - Crush Course (U) [C][!]"},
{0xf8a6fee2,4194304,"Medarot 5 - Kabuto Version (J) [C]"},
{0x549c9287,4194304,"Medarot 5 - Kabuto Version (J) [C][a1]"},
{0xa6a7d206,4194304,"Medarot 5 - Kuwagata Version (J) [C][!]"},
{0x35fc5b32,4194304,"Mobile Golf (J) [C][!]"},
{0xac5e477d,1048576,"Naminori Yarou (J) [C][!]"},
{0x8c195f49,1048576,"Nations, The - Land of Legends (E) (M2) [C][!]"},
{0xd65c8ba1,2097152,"Network Adventure Bugsite -Alpha- (J)[C][!]"},
{0x56f52663,2097152,"Network Adventure Bugsite -Beta- (J)[C][!]"},
{0xfbb97680,2097152,"New Addams Family Series, The (E) [C]"},
{0xf770878b,1048576,"NSYNC Get to the Show (U) [C][!]"},
{0xa92dcb79,1048576,"Planet of the Apes (E) (M6) [C]"},
{0x4b2b8b57,2097152,"Pocket Monsters Crystal Glass (Chinese) (Unl) [C]"},
{0x313a1c13,2097152,"Pocket Monsters Crystal Glass (Chinese) (Unl) [C][a1]"},
{0x1bfb531e,1048576,"Pocket Music (E) (M5) [C][!]"},
{0x7cc884b4,524288,"Pocket Voice V2.0 Demo 3e (Unl) [C]"},
{0x443fef63,524288,"Pocket Voice V2.0 Demo 4e (Unl) [C]"},
{0xcbb8f4bd,1048576,"Pokemon Blue (Chinese) (Unl) [C]"},
{0xcee9c818,1048576,"Pokemon Red (Chinese) (Unl) [C]"},
{0x8505d139,2097152,"Pooh and Tigger's Hunny Safari (E) (M6) [C]"},
{0x622690da,2097152,"Pooh and Tigger's Hunny Safari (U) [C][!]"},
{0x250015d4,4194304,"Rayman 2 - The Great Escape (E) (M5) [C][!]"},
{0xd0204f10,1048576,"Ronaldo V.Soccer (E) (M4) [C][!]"},
{0x47636a2c,4194304,"Sakura Wars GB 2 (J) [C][!]"},
{0x44a9ddfb,1048576,"Samurai Kid (J) [C][!]"},
{0xa744df64,1048576,"Santa Claus Junior (U) [C][!]"},
{0x998657b7,1048576,"Scrabble (U) [C][!]"},
{0xef10272e,4194304,"Shaman King Tyoh Senji Ryakketu Funbari Hen (J) [C][!]"},
{0x5730393d,4194304,"Shaman King Tyoh Senji Ryakketu Meramera Hen (J) [C][!]"},
{0xe994b59b,4194304,"Shantae (U) [C][!]"},
{0xd088eefd,1048576,"Snoopy Tennis (J) [C][!]"},
{0x90379c16,4194304,"Super Gals Kotobukiran (J) [C][!]"},
{0xba70d28f,1048576,"Titus the Fox (U) [C][!]"},
{0x269f0852,4194304,"Tomb Raider (Chinese) (Unl) [C][!]"},
{0x717a5d19,4194304,"Tomb Raider 2 (Chinese) (Unl) [C][!]"},
{0x096d0c27,1048576,"Toonsylvania (U) [C][!]"},
{0x6f2cbd1d,2097152,"Tsuriiko!! (J) [C][!]"},
{0x283742e4,1048576,"Universal Studios Monsters - Crazy Vampire Dracula (U) [C][!]"},
{0x219e42e3,4194304,"Utyujin Tanaka Tarou de RPG Maker (J) [C][!]"},
{0xd893d58f,1048576,"Yu-Gi-Oh! - Capsule (Chinese) [C][p1]"},
{0x803a56ae,4194304,"Yu-Gi-Oh! - Dark Duel Stories (U) [C][!]"},
{0x530705a1,2097152,"Zoids Hakugin no Raiger Zero (J) [C][!]"},
{0xea3ac4c4,524288,"Work Master 2 DEMO (v.1.9) (Unl) [C]"},
{0xcf80fe7a,524288,"Work Master 2 DEMO (v.1.99) (Unl) [C]"},
{0x8f96b796,524288,"Friendly Pet Jurassic Park 3 (Chinese) (Unl) [C]"},
{0x2180d649,2097152,"Bokujo Monogatari GB 3 - Boy Meets Girl (Chinese) (Unl) [C][a1]"},
{0xb7508147,524288,"Pocket Voice V2.0 Demo 2c (Unl) [C]"},
{0x9536fb32,1048576,"Alfred's Adventure (E) (M5) [C][h1]"},
{0x725cc3ee,1048576,"Alfred's Adventure (E) (M5) [C][h2]"},
{0x9615be9f,1048576,"Backgammon (E) (M4) [C][h1]"},
{0x4c3ff259,524288,"Bust-a-Move 4 (UE) [C][h1] (mono hack)"},
{0xa82e2147,4194304,"Cannon Fodder (E) (M5) [C][h1]"},
{0xa3b430ad,4194304,"Cannon Fodder (E) (M5) [C][h1][t1]"},
{0x81b86364,2097152,"Carmageddon (U) (M4) [C][h1]"},
{0xdaa17e4f,1048576,"Checkmate (J) [C][h1]"},
{0x46bc2e14,1048576,"Checkmate (J) [C][h2] (Diff Colors and No Coordinates)"},
{0x851e6c0a,1048576,"Chessmaster, The (U) [C][h1]"},
{0xcadc33fe,1048576,"Chessmaster, The (U) [C][h2]"},
{0x8a109f81,1048576,"Chessmaster, The (U) [C][h3]"},
{0xffbd6003,1048576,"Chessmaster, The (U) [C][h4] (New Figures and Diff Options)"},
{0x4b196a6f,2097152,"Conker's Pocket Tales (U) (M3) [C][h1]"},
{0x69e01b94,1048576,"Croc 2 (U) [C][h1]"},
{0x0fa25e36,32768,"Dan Laser Demo (PD) [C][h1]"},
{0x28ca1690,1048576,"Denki Blocks (E) (M5) [C][h1]"},
{0xe8af77cc,1048576,"Denki Blocks (E) (M5) [C][h2] (Intro Removed)"},
{0xe4f72e45,4194304,"Donkey Kong Country (Mag Demo) (UE) (M5) [C][h1]"},
{0x678c2998,2097152,"Dragon Quest Monsters (J) [C][h1]"},
{0xcc043ee8,2097152,"Dragon Warrior Monsters (U) [C][h1]"},
{0xefb4d531,1048576,"Elevator Action EX (J) [C][h1]"},
{0xcb12299c,2097152,"Evel Knievel (E) (M7) [C][h1]"},
{0x642a1219,262144,"Full Time Soccer (E) [C][h1]"},
{0xffd919a7,1048576,"Gambare Nippon Olympic 2000 (J) [C][h1]"},
{0x3580a61d,524288,"GB Backup Station BIOS (U) [C][h1]"},
{0xfe228544,32768,"GB Pack V1.3 (EMP Hack V1.6) (PD) [C][h1]"},
{0x3b00818e,1048576,"Gex - Enter the Gecko (U) [C][h1]"},
{0x400cca44,4194304,"Grand Theft Auto (E) (M5) [C][h1]"},
{0xcea157d0,2097152,"Grand Theft Auto 2 (E) (M5) [C][h1]"},
{0x9f5246a0,1048576,"Guruguru Galakedaizu (J) [C][h1]"},
{0x30da8b51,1048576,"Hollywood Pinball (UE) (M4) [C][h1]"},
{0x4acdf314,1048576,"International Track & Field (U) [C][h1] (Enables German)"},
{0xbac18728,1048576,"Jimmy White's Cueball (E) [C][h1]"},
{0xd451c751,262144,"Karate Joe (E) [C][h1]"},
{0x937514f0,262144,"Karate Joe (E) [C][h2]"},
{0x7ad63279,262144,"Karate Joe (E) [C][h2][t1]"},
{0x4f2f12cf,1048576,"Last Bible (J) [C][h1]"},
{0x3c746580,1048576,"Legend of Zelda, The - Link's Awakening DX (U) [C][h-SGB]"},
{0x218b98c7,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (J) [C][h1]"},
{0x7933bd37,2097152,"Legend of Zelda, The - Oracle of Ages (E) (M5) [C][h1] (GBA Version v0.3)"},
{0xc6928757,1048576,"Legend of Zelda, The - Oracle of Ages (J) [C][h1] (GBA Version V0.2)"},
{0x27f36a8e,1048576,"Legend of Zelda, The - Oracle of Ages (J) [C][h2] (GBA Version V0.3)"},
{0xa842ef65,1048576,"Legend of Zelda, The - Oracle of Ages (U) [C][h1] (GBA Version V0.2)"},
{0xefcc26f4,1048576,"Legend of Zelda, The - Oracle of Ages (U) [C][h2]"},
{0x2d812ff0,1048576,"Legend of Zelda, The - Oracle of Ages (U) [C][h3] (GBA Version V0.3)"},
{0xfbac4d9a,2097152,"Legend of Zelda, The - Oracle of Seasons (E) (M5) [C][h1] (GBA Version V0.3)"},
{0x9c966ff6,1048576,"Legend of Zelda, The - Oracle of Seasons (J) [C][h1] (GBA Version V0.2)"},
{0xf1a4b487,1048576,"Legend of Zelda, The - Oracle of Seasons (J) [C][h1] (GBA Version V0.3)"},
{0x2f9b3ee8,1048576,"Legend of Zelda, The - Oracle of Seasons (U) [C][h1] (GBA Version V0.2)"},
{0x6815f779,1048576,"Legend of Zelda, The - Oracle of Seasons (U) [C][h2]"},
{0xc26879a0,1048576,"Legend of Zelda, The - Oracle of Seasons (U) [C][h3] (GBA Version V0.3)"},
{0x781b242b,1048576,"LEGO Racers (E) (M10) [C][h1]"},
{0x81acfb80,1048576,"LEGO Stunt Rally (E) (M10) [C][h1]"},
{0xf1ea93bb,1048576,"Link Edition V1.0 (Pokemon Gelb) (G) [C][h1]"},
{0xd043cdee,1064960,"Lucky Luke - Desperado Train (E) (M6) [C][h1]"},
{0xfda878fc,1064960,"Lucky Luke - Desperado Train (E) (M6) [C][h1][t1]"},
{0xe0d465b6,1064960,"Lucky Luke - Desperado Train (E) (M6) [C][h1][t2]"},
{0x55921a06,1064960,"Lucky Luke - Desperado Train (E) (M6) [C][h2]"},
{0x0ea6a9e9,2097152,"Marvin Strikes Back (U) (M3) [C][h1]"},
{0xca5bd34b,4194304,"Metal Gear Solid (E) (M5) [C][h1]"},
{0x4908a1f5,2097152,"Monkey Puncher (E) [C][h1]"},
{0xcb3bbd15,2097152,"Moomin's Adventure (J) [C][h1]"},
{0x17beaf7c,1048576,"Mr. Driller (J) [C][h1]"},
{0x0b21662d,1048576,"Oak Vs Gio (V1.0) (Yellow hack) (U) [C][h1]"},
{0x3fa94d36,1048576,"Obelix (E) (M4) [C][h1]"},
{0xbfb266c6,1048576,"Ojarumaru (J) [C][h1]"},
{0x58fad706,262144,"Painter (E) [C][h1]"},
{0x3b9e6f54,262144,"Painter (E) [C][h2]"},
{0x11456408,262144,"Painter (E) [C][h2][t1]"},
{0x7b96b31e,32768,"Pattern Demo (PD) [C][h1]"},
{0xb290fa35,1048576,"Pikabomber v1.10 (Pocket Bomberman Hack) [C][h1]"},
{0x27491bea,1048576,"Pikamon Silver V1.5 (Pocket Mon. Silver) [C][h1]"},
{0x88975c3a,1048576,"Pikamon Silver V1.5 (Pocket Mon. Silver) [C][h1][T-Eng1.08_Vida]"},
{0xa9211df4,2097152,"Pikamon Silver v1.5 (Pokemon Silver Hack) [C][h1]"},
{0xc1a9a562,1048576,"Pocket Bomberman (U) [C][h1]"},
{0xffc70f81,2097152,"Pocket Monsters Gold (V1.0) (J) [C][h1]"},
{0x4462e6df,1048576,"Pocket Monsters Gold (V1.0) (J) [C][h2] (Sonic)"},
{0xe65672eb,1048576,"Pocket Monsters Pinball (J) [C][h1]"},
{0xc16b8d98,2097152,"Pocket Monsters Silver (V1.0) (J) [C][h1]"},
{0xb4dbe213,1048576,"Pocket Monsters Silver (V1.0) (J) [C][h2]"},
{0x270baff9,2097152,"Pokemon Crystal (U) [C][h1] (enable setting of time)"},
{0xdbadae5e,2097152,"Pokemon Dreamland v1.4 (Pokemon Gold Hack) [C][h1]"},
{0x16282679,1048576,"Pokemon Gelb (Yellow) (Font hack by Teralink) (G) [C][h1]"},
{0x85ba82b5,2097152,"Pokemon Gold (U) [C][h1] (Enable clock reset)"},
{0x0ace1c91,2097152,"Pokemon Puzzle Challenge (U) [C][h1]"},
{0x2f267222,1048576,"Pokemon Rocket Edition V1.0 (Gelb hack) (G) [C][h1]"},
{0xe191e8ae,1048576,"Pokemon Rocket Edition V1.0 (Yellow hack by Filb) (U) [C][h1]"},
{0xaa419c31,2097152,"Pokemon Silver (U) [C][h1] (Enable clock reset)"},
{0x6b875ae3,1048576,"Pokemon Trading Card Game (New Character hack) (U) [C][h1]"},
{0x3acadd26,1048576,"Pokemon Yellow (Link Edition V1.0 hack) (U) [C][h1]"},
{0x85d482e8,1048576,"Pokemon Yellow (New Chars & Story hack V1.2) (U) [C][h1]"},
{0x7a0fa30a,1048576,"Pokemon Yellow Upgrade V2.0 (Yellow hack) (U) [C][h1]"},
{0x536f1ddb,1048576,"Pokemon Z2 (V0.1) (Silver hack) (J) [C][h1]"},
{0xb2a3581d,1048576,"Pop 'N' Pop (E) [C][h1]"},
{0xdad6f6b4,1048576,"Power Quest (E) (M6) [C][h1]"},
{0xb053ab1f,1048576,"Qix Adventure (E) [C][h1]"},
{0x8a5fa98c,262144,"Race Time (E) [C][h1]"},
{0x85f7966c,1048576,"Robot Wars Metal Mayhem (E) (M6) [C][h1]"},
{0x716e695d,1048576,"Rockman X (J) [C][h1]"},
{0x9609aa88,1048576,"SD Hiryu Ex (J) [C][h1]"},
{0x28cdf5bc,32768,"SGB Pack (PD) [C][h1]"},
{0x33db5e78,1048576,"Shadowgate Classic (V1.0) (E) (M5) [C][h1]"},
{0xa171f894,131072,"Space Invasion (E) [C][h2][t1]"},
{0x36d1120b,131072,"Space Invasion (Rocket Games) (E) [C][h1]"},
{0xe620b13d,131072,"Space Invasion (Rocket Games) (E) [C][h2]"},
{0x66ae5972,1048576,"Street Fighter Alpha (E) [C][h1]"},
{0x17794020,1048576,"Super Chinese Fighter EX (J) [C][h1]"},
{0x50dae913,1048576,"Super Mario Bros. DX (J) [C][h1]"},
{0x17a95744,1048576,"Super Robot Wars Link Battler (J) [C][h1]"},
{0x128fc37f,1048576,"Super Robot Wars Link Battler (J) [C][h2]"},
{0x21aac06e,2097152,"Supercross Freestyle (E) (M5) [C][h1]"},
{0x36f5db1e,2097152,"Tarzan (U) [C][h1]"},
{0x3a9dba80,1048576,"Tom & Jerry - Mouse Hunt (E) (M5) [C][h1]"},
{0xd097dc17,524288,"Trouballs (U) [C][h1]"},
{0x9c8c73a6,524288,"Trouballs (U) [C][h2] (Intro Removed)"},
{0x3440ce0a,524288,"Trouballs (U) [C][h3] (Intro Removed)"},
{0xd8269843,524288,"Trouballs (U) [C][h4] (Intro Removed)"},
{0x47185e22,524288,"Turok 2 - Seeds of Evil (U) (M4) [C][h1]"},
{0x34348af7,1048576,"Vegas Games (U) [C][h1]"},
{0xbb816486,1048576,"Wizardry I - Proving Grounds of the Mad Overlord (J) [C][h1]"},
{0x683176b4,1048576,"Wizardry II - Legacy of Llylgamyn (J) [C][h1]"},
{0x4988d148,1048576,"Wizardry III - Knights of Diamonds (J) [C][h1]"},
{0xe759e002,1048576,"Woody Woodpecker Racing (U) [C][h1]"},
{0xe4ab2bed,2097152,"World Soccer Gameboy 2000 (J) [C][h1]"},
{0xb4ba03e6,1048576,"Xtreme Wheels (E) [C][h1]"},
{0xe0a06018,2097152,"Yakochu (J) [C][h1]"},
{0xb6438fd7,1048576,"Zopharmon Blue (Zophar's Domain 3rd Bday) [C][h1]"},
{0x986b5a67,1048576,"Zopharmon Red (Zophar's Domain 3rd Bday) [C][h1]"},
{0x91cfc037,2097152,"Pokemon Gold (U) [C][BF][h1] (Enable clock reset)"},
{0x70c57a3f,2097152,"Pokemon Silver (U) [C][BF][h1] (Enable clock reset)"},
{0xb769594f,1048576,"Bear in the Big Blue House (U) (M7) [C][h1]"},
{0x4efdb7f9,2097152,"Gex 3 - Deep Pocket Gecko (U) [C][h1]"},
{0x1003d58a,4194304,"Rayman 2 - The Great Escape (E) (M5) [C][h1]"},
{0x255fc765,1048576,"Pocket Monsters Silver (V1.0) (J) [C][h3]"},
{0x8525ec18,131072,"GB Backup Station BIOS (U) [C][o1]"},
{0xaf282efd,1048578,"Pocket Monsters Gold (V1.0) (J) [C][o1]"},
{0x8cdea8f6,1048578,"Pocket Monsters Gold (V1.0) (J) [C][o1][BF]"},
{0xcbcfb91e,1048578,"Pocket Monsters Silver (V1.0) (J) [C][o1]"},
{0x8728315f,1048578,"Pocket Monsters Silver (V1.0) (J) [C][o1][BF]"},
{0xa2cd9764,65536,"100000 Boys (LCP2000) (PD) [C]"},
{0x487b9c58,32768,"175 Sprite Parallax Starfield Demo (PD) [C]"},
{0x8f501a1a,32768,"2560 Colors Demo (PD) [C]"},
{0x7c19f4fa,32768,"2nd BNG Demo (Sonic&Knuckles) (PD) [C]"},
{0xfc141888,32768,"3D Wireframe Demo (PD) [C]"},
{0x2934f188,32768,"40x18 Wide Demo V1.1 (PD) [C]"},
{0x502d48fe,32768,"40x24 Text Demo by DarkFader (PD) [C]"},
{0x23f7b9cb,32768,"720 Simultaneous Sprites Demo (PD) [C]"},
{0x8bc9c589,262144,"7447 (Lik-Sang) (PD) [C]"},
{0xb95fc31d,32768,"99 Demo (PD) [C]"},
{0x908ada91,65536,"Abyss - Less is More Demo (PD) [C]"},
{0xdcc646a9,65536,"AGO Realtime Demo (LCP2000) (PD) [C]"},
{0xa7fed0f8,65536,"Alien Planet (Freedom GB Contest 2001 - 1st Place) (PD) [C]"},
{0x50139db7,32768,"All7 (PD) [C]"},
{0x754b6b6a,32768,"Alpha Wing (Bung) (PD) [C]"},
{0x4196f2cc,32768,"Amingo's Wild Journey (Bung V4) (PD) [C]"},
{0x2aa4f65b,32768,"Animal XXX1 (PD) [C]"},
{0x0e2de3f1,32768,"Animation Demo 1 (PD) [C]"},
{0xb11e129b,32768,"Animation Demo 2 (PD) [C]"},
{0x5971af91,32768,"APA Demo (PD) [C]"},
{0x8549b2f3,32768,"APA Demo 2 (PD) [C]"},
{0xc96d1124,262144,"Apache (Bung) (PD) [C]"},
{0xfb5d3e49,524288,"Aqueous Demo (PD) [C]"},
{0xba862b26,65536,"Arkanoid (Bung) (PD) [C]"},
{0x6555c0ae,524288,"artROM #1 v1.0 (PD) [C]"},
{0x58aae2c0,32768,"ATC - Air Traffic Control Simulation (PD) [C]"},
{0xd4255616,262144,"Back to Earth 3D (PD) [C]"},
{0x13a6b8a1,32768,"Backwards XXX (PD) [C]"},
{0x2b58263c,262144,"Ball (Bung) (PD) [C]"},
{0x143d5e83,131072,"Ballgame DX Demo (Oxyd clone) (Bung) (PD) [C]"},
{0xe2f861ab,131072,"Balloon Balloon (PD) [C]"},
{0xd0ba276d,32768,"Ballpark Title Screen (PD) [C]"},
{0xd861da6a,32768,"Beach (PD) [C]"},
{0x9ec16c24,524288,"Beauty Girls Volume 1 (Anna Kurnikova) (V1.0) (PD) [C]"},
{0x9162a9d3,524288,"Beauty Girls Volume 1 (Anna Kurnikova) (V1.01) (PD) [C]"},
{0x94ebcaa1,262144,"Berlin-Hotball-Paranoid Preview 1 by Aleksi Eeben (PD) [C]"},
{0x6a1aa843,262144,"Berlin-Hotball-Paranoid Preview 2 by Aleksi Eeben (PD) [C]"},
{0x7ecd9106,262144,"Berlin-Hotball-Paranoid Preview 3 by Aleksi Eeben (PD) [C]"},
{0xc182f337,262144,"Berlin-Hotball-Paranoid Preview 4 by Aleksi Eeben (PD) [C]"},
{0x5d5aa56e,262144,"Berlin-Hotball-Paranoid Preview 5 by Aleksi Eeben (PD) [C]"},
{0x662bceb6,32768,"Berzerk Legends (PD) [C]"},
{0xaccfd424,589824,"BHGOS - Overclocked Combo (PD) [C]"},
{0x03ce05d8,4194304,"BHGOS - Y2Kode Combo (PD) [C]"},
{0xd90d82fe,524288,"Binary Chaos (Y2kode) (PD) [C]"},
{0x5bafb998,1048576,"Bitte 8 Bit Demo by HITMEN (PD) [C]"},
{0xd3d8af78,32768,"BlackJack (PD) [C]"},
{0x0461e865,65536,"Blastah (Bung) (PD) [C]"},
{0x37e72667,65536,"Blastah (PD) [C]"},
{0xa50f364b,32768,"Blobz (Bung) (PD) [C]"},
{0x4d7c3acb,32768,"Block Badger (PD) [C]"},
{0x44ed44bd,32768,"BNG Demo (PD) [C]"},
{0x1e5d5ecc,32768,"Bomber (Bung V4) (PD) [C]"},
{0xd0735e9b,32768,"Boulder Dash (PD) [C]"},
{0x99ba49fe,32768,"Boulder Dash DX Demo (Bung) by DarkFader (PD) [C]"},
{0xc882cc27,32768,"Breakout (PD) [C]"},
{0x3eecf169,65536,"Breakout Demo (PD) [C]"},
{0xac8f3499,32768,"Brick Breaker DX (PD) [C]"},
{0x2a9abb39,32768,"Brickster (PD) [C]"},
{0x0d4185a4,131072,"Bubbles (PD) [C]"},
{0x9ff22917,32768,"Bump Demo (PD) [C]"},
{0xd099f9bb,131072,"Capman (Lik-Sang) (PD) [C]"},
{0xf8e2e81c,65536,"Carillion Demos - Chords (PD) [C]"},
{0x53994d0d,32768,"Carillion Demos - Fruitless (PD) [C]"},
{0x48b0098b,65536,"Carillion Demos - Oldschool (PD) [C]"},
{0x0228cc3e,65536,"Carillion Demos - Samplecheck (PD) [C]"},
{0xc5e6a678,32768,"Carillion Demos - Soundcheck (PD) [C]"},
{0xede371b6,32768,"Carillion Demos - Train (PD) [C]"},
{0x38b5a8fc,65536,"Carillon Editor V1.0 by Alexsi Eeben (PD) [C]"},
{0xefc67246,65536,"Carillon Editor V1.1 by Alexsi Eeben (PD) [C]"},
{0xa55838f4,65536,"Carillon Editor V1.2 by Alexsi Eeben (PD) [C]"},
{0xac71dbf7,65536,"Carillon Player & FX Hammer V1.0 - No Sample Player (PD) [C]"},
{0x615ff2de,16384,"Carillon Player V1.0 (16K) (PD) [C]"},
{0x7b2dbcf4,32768,"Carillon Player V1.0 (32K) (PD) [C]"},
{0x153dadbe,65536,"Carillon Player V1.2 (PD) [C]"},
{0x8b41235c,32768,"CARS (Bung V4) (PD) [C]"},
{0x16d5427d,524288,"Cat and Dog (PD) [C]"},
{0xd0fd44c4,65536,"Channel 49 - First Strike (Freedom GB Contest 2001) (PD) [C]"},
{0x70544978,32768,"Chaos89 by Charles Doty (PD) [C]"},
{0x5619fb89,32768,"Christmas Greetings (PD) [C]"},
{0xa3c0e143,131072,"Chuckie DX V0.33 (Y2kode) (PD) [C]"},
{0xdde733a6,32768,"Chunk Out (PD) [C]"},
{0x5e7b9287,32768,"Chunky World (Quang2000) (PD) [C]"},
{0x197b8075,32768,"Circuit Breaker (Bung) (PD) [C]"},
{0xea820c0f,32768,"Circular Canon (PD) [C]"},
{0xbda31b42,524288,"Clay Pidgeon Shooting by Jim Bagley (PD) [C]"},
{0x24678334,65536,"Clickomania by Ph0x (PD) [C]"},
{0xb6680c74,32768,"Clockworks (PD) [C]"},
{0xc75b03e3,65536,"CNCD Circle 1886 Demo (PD) [C]"},
{0xe25b2d0b,32768,"Code Demo (PD) [C]"},
{0x0338e1b4,65536,"Coffee Drop (Bung) (PD) [C]"},
{0x909a303a,32768,"Color Bar Demo (PD) [C]"},
{0xdd5bb56e,32768,"Color Fader Demo (1) (PD) [C]"},
{0xe59309b4,32768,"Color Fader Demo (2) (PD) [C]"},
{0x322e355c,131072,"Color Lines (Bung) (PD) [C]"},
{0x9d98c80e,32768,"Color Mines (Bung) (PD) [C]"},
{0xd5ef0014,32768,"Color Panel Demo (PD) [C]"},
{0xa1e8633f,32768,"Color Tuner V1.0 (PD) [C]"},
{0xae0ed2b7,32768,"Colors Demo (PD) [C]"},
{0x83f29781,32768,"COLumnOR Demo (PD) [C]"},
{0xf18f1f4f,65536,"Columns DX (PD) [C]"},
{0xca77bb38,65536,"Columns DX (PD) [C][a1]"},
{0x4fd9cf86,32768,"Combat Soccer (Bung) (PD) [C]"},
{0x79e16ba6,32768,"Consoleemul Christmas Greeting by Fagemul (PD) [C]"},
{0xb604d19d,32768,"Cosmic Attack (Bung V4) (PD) [C]"},
{0x9a300385,32768,"Cosmic Attack (Y2kode) (PD) [C]"},
{0xa2eeaa0b,32768,"Cowering Christmas Greeting by Fagemul (PD) [C]"},
{0x4906cfdf,131072,"Crazy Zone (1) (Bung) (PD) [C]"},
{0x55ebd26e,131072,"Crazy Zone (2) (Bung) (PD) [C]"},
{0xf004440c,262144,"Cube Raider by DarkFader (Bung) (PD) [C]"},
{0x445d2bd9,32768,"Cwan 4 (Checkers) (PD) [C]"},
{0x48fd4ce9,32768,"Cyber Squash (Freedom GB Contest 2001) (PD) [C]"},
{0xa1adc8bf,32768,"Cyberball (Bung) (PD) [C]"},
{0xc1de7488,32768,"Dark Intensions by DarkFader (Quang2000) (PD) [C]"},
{0x6b1525c4,32768,"Dark Soul Demo v0.1 (PD) [C]"},
{0xf9b47696,32768,"Darts 180 (PD) [C]"},
{0xbf55b3cc,16384,"DaVinci KB (PD) [C]"},
{0xc1f2435a,32768,"Deep Scan (PD) [C]"},
{0xfeb189b9,131072,"Defender of the Crown (PD) [C]"},
{0x8880acbc,131072,"Defender of the Crown (PD) [C][a1]"},
{0x4c30ef57,32768,"Demiforce Demo (PD) [C]"},
{0x1b65092f,32768,"Dick Demo (PD) [C]"},
{0xf329cff6,524288,"DigiBoy (PD) [C]"},
{0xcc16688f,262144,"DigiBoy (PD) [C][a1]"},
{0xfe4e98f8,524288,"DigiBoy (PD) [C][f1]"},
{0x12e36854,32768,"Digico Move (PD) [C]"},
{0x75c200d0,32768,"Dimension of Miracles (Quang2000) (PD) [C]"},
{0xb7ab9320,65536,"Dimensionless Sample (PD) [C]"},
{0xbf3b39b8,32768,"Doctor GB Menu (PD) [C]"},
{0x2b043e4a,32768,"Doctor GB Menu (PD) [C][a1]"},
{0xbe8c4320,32768,"Doctor GB Menu (PD) [C][a2]"},
{0xde912844,32768,"Doctor GB Menu V2.0 (PD) [C]"},
{0x83daaf64,32768,"Doctor GB Menu V2.0 (PD) [C][a1]"},
{0xc7b83b93,32768,"Doctor Sprite Demo (Bung) (PD) [C]"},
{0xafac8e13,90062,"Donkey Kong (NES Conversion) (PD) [C]"},
{0x7d982411,90072,"Donkey Kong 3 (NES Conversion) (PD) [C]"},
{0x92b12600,32768,"Dot Matrix Demo (Quang2000) (PD) [C]"},
{0x4ba5b7cf,32768,"Double Vision Demo (PD) [C]"},
{0x3627c5ba,131072,"Downward Spiral, The (Bung) (PD) [C]"},
{0x3c8117de,32768,"Dragonball Z Tetris Demo (PD) [C]"},
{0x48106fae,32768,"Dragon's Lair - Title Screen (PD) [C]"},
{0xbcd638a1,262144,"Drains (Lik-Sang) (PD) [C]"},
{0xa3bf876a,262144,"Drains (Lik-Sang) (Rev 2) (PD) [C]"},
{0xe90395e7,32768,"Draw V1.03 by JK (PD) [C]"},
{0x10b83264,131072,"Drunken Pooper (Y2kode) (PD) [C]"},
{0x3a576777,1048576,"Drymouth (Lik-Sang) (Y2kode) (PD) [C]"},
{0x060e74a8,32768,"Duel, The (Bung) (PD) [C]"},
{0xf113181f,32768,"Duux (Bung) (PD) [C]"},
{0x78bbf938,32768,"Dynamite!! (Quang2000) (PD) [C]"},
{0x6ba625d2,65536,"Egg Racer (Lik-Sang) (PD) [C]"},
{0xb023c11c,32768,"EMS Multi-ROM Menu V1.0 (PD) [C]"},
{0x0b15df0d,32768,"EMS Multi-ROM Menu V1.1 (PD) [C]"},
{0x371508a8,32768,"EMS Multi-ROM Menu V1.2 (PD) [C]"},
{0x69e4105a,32768,"Enlightenment BA1 Demo (PD) [C]"},
{0x55907773,32768,"Eskupelota (Bung V4) (PD) [C]"},
{0xb38c2585,32768,"Fall Down (Bung) (PD) [C]"},
{0x85aed8c2,65536,"Fatlicks Lardstyle (Bung) (PD) [C]"},
{0x4f322281,65536,"FC Emulator for GameBoy V0.00 by Kami (PD) [C]"},
{0xb15d97d7,65536,"FC Emulator for GameBoy V0.02 by Kami (PD) [C]"},
{0xeb0d8b50,65536,"FC Emulator for GameBoy V0.01 by Kami (PD) [C]"},
{0x65c5baad,32768,"Feel It XXX (PD) [C]"},
{0xaa292992,524288,"FGB-Demo v2.10 (PD) [C]"},
{0xc551b678,131072,"FGB-Demo vx.xx (PD) [C]"},
{0x254ca608,524288,"Final Blade by Aaron Pendley and Sam Gage (Y2kode) (PD) [C]"},
{0x80822f84,32768,"Fire Demo 1 (PD) [C]"},
{0xa94c050a,32768,"Fire Demo 2 (PD) [C]"},
{0x16c4ebd8,32769,"Fire Demo 3 (PD) [C]"},
{0x82d59ad8,32768,"Fire Demo 4 (PD) [C]"},
{0xd3de5b76,32768,"Fire Demo 5 (PD) [C]"},
{0x123b8216,65536,"Fire Gear (Bung) (PD) [C]"},
{0x40fd0005,65536,"Fire Gear (Bung) (PD) [C][a1]"},
{0x4fa93d9f,32768,"Fire Routine Example (PD) [C]"},
{0xf2b2ec57,65536,"Fli-Plasma (PD) [C]"},
{0x5bbdd058,32768,"Flood (PD) [C]"},
{0xc0d3881f,32768,"Fogen and Budfreak Made Me Do It (PD) [C]"},
{0x7b94f983,32768,"Font Demo (Jonathan Waugh) (PD) [C]"},
{0xddcd0b1b,32768,"Forgot Slip XXX (PD) [C]"},
{0x728dc814,32768,"Forward XXX (PD) [C]"},
{0xde9a099c,32768,"FREEART Intro V0.1 (PD) [C]"},
{0xc2545485,32768,"FREEART Intro V1 (PD) [C]"},
{0x48792bb7,32768,"FREEART Intro V2 (PD) [C]"},
{0x42258961,262144,"FREEART Intro V3 (PD) [C]"},
{0xc960e092,65536,"French D64 Demo (PD) [C]"},
{0xf2f408d7,65536,"Friki Race (Bung) (PD) [C]"},
{0x332f687d,65536,"Friki Race (Bung) (PD) [C][a1]"},
{0x6e67bb95,262144,"Frode (Bung) (PD) [C]"},
{0xc2a791c2,65536,"Frogs (PD) [C]"},
{0xfd442b7b,32768,"Frox by Flavour (PD) [C]"},
{0x4c619c49,32768,"Fruit Spin V1.0 (PD) [C]"},
{0x34ff080f,262144,"FX Shooter G - MiniRPG2 Story (Y2kode) (PD) [C]"},
{0x6987d1cf,32768,"Galaxy (PD) [C]"},
{0xe48f525b,32768,"Gameboy 3D Filled Demo (PD) [C]"},
{0x70aad957,32768,"Gameboy 3D Line Draw Demo (PD) [C]"},
{0x69b73a7b,32768,"Gameboy Asteroid - Treasure Hunt (Bung V4) (PD) [C]"},
{0x89dab13b,65536,"Bajki i Przypowiesci by Ignacy Krasicki (Polish) (PD) [C]"},
{0x35302f41,65536,"Dziady Czesc II by Adam Mickiewicz (Polish) (PD) [C]"},
{0xf3857477,2097152,"Dzieci kapitana Granta by Juliusz Verne (Polish) (PD) [C]"},
{0x9c1f652e,524288,"Faraon tom 1 by Boleslaw Prus (Polish) (PD) [C]"},
{0xc5c11f43,1048576,"Faraon tom 2 by Boleslaw Prus (Polish) (PD) [C]"},
{0xe08a6b0f,524288,"Faraon tom 3 by Boleslaw Prus (Polish) (PD) [C]"},
{0xddcc0aaa,262144,"Hamlet by William Shakespeare (Polish) (PD) [C]"},
{0x53680497,1048576,"Hobbit, The by J.R.R. Tolkien (Polish) (PD) [C]"},
{0xc56e9afd,1048576,"Kariera Nikodema Dyzmy by Tadeusz Dolega Mostowicz (Polish) (PD) [C]"},
{0x5010f829,131072,"Konstytucja Rzeczpospolitej Polskiej by Sejm III RP (Polish) (PD) [C]"},
{0x92c76263,262144,"Kronika Polska by Anonim Tak Zwany Gall (Polish) (PD) [C]"},
{0xc33b5ffc,1048576,"Krzyzacy tom 1 by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0xe898059e,1048576,"Krzyzacy tom 2 by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x9bc49c49,1048576,"Lalka tom 1 by Boleslaw Prus (Polish) (PD) [C]"},
{0x2314476b,1048576,"Lalka tom 2 by Boleslaw Prus (Polish) (PD) [C]"},
{0x1b68c366,131072,"Legendy Warszawskie by Artur Oppan (Polish) (PD) [C]"},
{0x5cb4fe2e,1048576,"Ludzie Bezdomni by Stefan Zeromski (Polish) (PD) [C]"},
{0xb7777427,262144,"Magiczne przygody Kubusia Puchatka (Polish) (PD) [C]"},
{0xfc7506de,131072,"Macbeth by William Shakespeare (Polish) (PD) [C]"},
{0x953f92d0,524288,"Mikolaja Doswiadczynskiego Przypadki by Ignacy Krasicki (Polish) (PD) [C]"},
{0x6c5eb8a2,1048576,"Ogniem i Mieczem tom I Powiesc by Henryk Sienkiewicz (Polish) (PD) [C][a1]"},
{0x878fa289,1048576,"Ogniem i Mieczem tom II Powiesc by Henryk Sienkiewicz (Polish) (PD) [C][a1]"},
{0x222fe5c1,262144,"Opowiadania by Edgar Alan Poe (Polish) (PD) [C]"},
{0xfa789c28,262144,"Opowiesc Wigilijna by Charles Dickens (Polish) (PD) [C]"},
{0xb55c3005,262144,"Othello by William Shakespeare (Polish) (PD) [C]"},
{0x15d94a26,524288,"Pan Tadeusz by Adam Mickiewicz (Polish) (PD) [C]"},
{0xc09b0c3a,2097152,"Pan Wolodyjowski by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x28c619f4,1048576,"Podroze Gulliwera by Jonathan Swift (Polish) (PD) [C]"},
{0x48fd038d,1048576,"Przedwiosnie by Stefan Zeromski (Polish) (PD) [C]"},
{0x26099866,1048576,"Przygody Hucka by Mark Twain (Polish) (PD) [C]"},
{0x23f19092,524288,"Przypadki Robinsona Kruzoe by Daniel Defoe (Polish) (PD) [C]"},
{0xfa044e4a,2097152,"Quo Vadis by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x7f684914,262144,"Romeo & Juliet by William Shakespeare (Polish) (PD) [C]"},
{0x8ad1d581,131072,"Skapiec by Moliere (Polish) (PD) [C]"},
{0x0b9275ff,262144,"Studium w Szkarlacie by Arthur Conan Doyle (Polish) (PD) [C]"},
{0xf5a92402,131072,"Swietoszek by Moliere (Polish) (PD) [C]"},
{0xbb59707c,1048576,"W Pustyni i W Puszczy by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x28b30c3e,524288,"Wampir by Wladyslaw Stanislaw Reymont (Polish) (PD) [C]"},
{0xea1cd207,262144,"Wesele by Stanislaw Wyspianski (Polish) (PD) [C]"},
{0xe57243eb,131072,"Zemsta by Alexsander Fredro (Polish) (PD) [C]"},
{0xff5cd142,1048576,"Znachor by Tadeusz Dolega Mostowicz (Polish) (PD) [C]"},
{0xb58e7707,131072,"Znikniecie Mlodego Lorda by Arthur Conan Doyle (Polish) (PD) [C]"},
{0xb63fde7c,262144,"Zywot Czlowieka Poczciwego by Mikolaj Rej (Polish) (PD) [C]"},
{0x1b7fe1e9,1048576,"Robinson Crusoe by Daniel Defoe (V1.3) (PD) [C]"},
{0xe8f1a2f8,32768,"Gameboy Book Reader V1.3 (PD) [C]"},
{0x57da4012,1048576,"Robinson Crusoe by Daniel Defoe (V1.4) (PD) [C]"},
{0x6a50558e,262144,"Time Machine, The (V1.4) (PD) [C]"},
{0x9de8173b,262144,"Time Machine, The (V1.4) (PD) [C][a1]"},
{0x65a00e03,524288,"Underground City, The by Jules Verne (V1.4) (PD) [C]"},
{0xdc62715a,32768,"Why He Was Whipped by Mrs Amy Terese Powelson (V1.4) (PD) [C]"},
{0x44fbb42c,1048576,"Robinson Crusoe by Daniel Defoe (V1.5) (PD) [C]"},
{0xc7f23e79,32768,"Why He Was Whipped by Mrs Amy Terese Powelson (V1.5) (PD) [C]"},
{0xefc8422f,1048576,"Lolita by Vladimir Nobokov (V1.6) (PD) [C]"},
{0x5bda7b51,524288,"Markurells i WadKoping by Hjalmar Bergman (V1.6) (Polish) (PD) [C]"},
{0xfe2dffd5,1048576,"Robinson Crusoe by Daniel Defoe (V1.6) (PD) [C]"},
{0x4acf8870,262144,"39 Steps, The by John Buchan (V1.6) (PD) [C]"},
{0x30840a39,524288,"Lost World, The by Sir Arthur Conan Doyle (V1.6) (PD) [C]"},
{0x2c026bdb,131072,"Theatre of Cruelty by Terry Pratchett (V1.6) (PD) [C]"},
{0xdabac518,1048576,"Robinson Crusoe by Daniel Defoe (V2.0) (PD) [C]"},
{0x84de3f6a,32768,"Why He Was Whipped by Mrs Amy Terese Powelson (V2.0) (PD) [C]"},
{0xfb8d635b,1048576,"Robinson Crusoe by Daniel Defoe (V2.3) (PD) [C]"},
{0x7a3c4263,65536,"Suddshwer (Korean) (V2.3) (PD) [C]"},
{0x9e4dba6a,524288,"Underground City, The by Jules Verne (V2.3) (PD) [C]"},
{0x91a73e40,65536,"Why He Was Whipped by Mrs Amy Terese Powelson (V2.3) (PD) [C]"},
{0x49a8d9bd,1048576,"Robinson Crusoe by Daniel Defoe (V2.3b) (PD) [C]"},
{0x4b3224b2,65536,"Suddshwer (Korean) (V2.3b) (PD) [C]"},
{0x947815cb,65536,"Why He Was Whipped by Mrs Amy Terese Powelson (V2.3b) (PD) [C]"},
{0x26b77e61,32768,"Gameboy Book Reader V3.0 (PD) [C]"},
{0xe3fa5a64,32768,"Gameboy Demo (PD) [C]"},
{0x58f9df1c,65536,"Gameboy Palette Changing Example - V1 (PD) [C]"},
{0x5f856a22,65536,"Gameboy Print to Screen Library V2.0 by Shen Mansell (PD) [C]"},
{0x46218b26,65536,"Gameboy Tile Loading Example - V1 (PD) [C]"},
{0x737f2c28,131072,"Garpster's Archaic Rooms of Paranoia (Bung) (PD) [C]"},
{0x07aca1c2,32768,"GAS Demo 1 (PD) [C]"},
{0x0ed93c0c,32768,"Gay Sex0rs (18+ Only) (PD) [C]"},
{0xdf840450,32768,"GB Basic (Royal Davinci version) (PD) [C]"},
{0x17b1285b,32768,"GB Basic V2.00 (PD) [C]"},
{0x6692fd14,32768,"GB Basic V2.10 (PD) [C]"},
{0x1a7832ae,32768,"GB Cart Mag-E-Zine Vol 1 Issue 1 October 2nd, 2000 (PD) [C]"},
{0x291d001a,32768,"GB Cart Mag-E-Zine Vol 1 Issue 2 November 3rd, 2000 (PD) [C]"},
{0xf6d47de3,131072,"GB Flyer (Lik-Sang) (PD) [C]"},
{0x247a915b,131072,"GB Hi-Colour Demo (PD) [C]"},
{0x32d90a27,32768,"GB Hi-Colour Demo 2 (PD) [C]"},
{0xc44d04d0,32768,"GB Lander V0.02 (PD) [C]"},
{0x31822b24,32768,"GB Pack V1.0 (PD) [C]"},
{0xf0f90407,32768,"GB Pack V1.1 (PD) [C]"},
{0x08d12870,32768,"GB Pack V1.2 (PD) [C]"},
{0x22246b90,32768,"GB Pack V1.3 (PD) [C]"},
{0x7bbc50d2,32768,"GB Pack Vx.x (16Mbit) (PD) [C][a1]"},
{0xb7be6e4a,65536,"GB Remote (PD) [C]"},
{0xf6a4cb13,32768,"GB Sound Manipulator V1.00 (PD) [C]"},
{0x475a6933,32768,"GB Sound Manipulator V1.01 (PD) [C]"},
{0xd82dc27a,65536,"GBC Checkerboard Demo (PD) [C]"},
{0xc8627a52,524288,"GBC Intro Collection (PD) [C]"},
{0x5889c2f5,131072,"GBC vs NGPC Movie (PD) [C]"},
{0x4c6a82e3,524288,"GBC XXX Number 1 (PD) [C]"},
{0x89c87c70,524288,"GBC XXX Number 2 (PD) [C]"},
{0xfed81417,524288,"GBC XXX Number 3 (PD) [C]"},
{0x42d46f16,32768,"GBC2GBA Gamepack V3.0 GBA (PD) [C]"},
{0x92910ad6,32768,"GBC-Link (PD) [C]"},
{0xf2af76a3,65536,"GBDK Code Examples - Bunglogo (PD) [C]"},
{0x3a13e70f,65536,"GBDK Code Examples - Hiscore (PD) [C]"},
{0xff48b461,65536,"GBDK Code Examples - Println (PD) [C]"},
{0x44a60b50,65536,"GBDK Code Examples - Savepic (PD) [C]"},
{0xdb3c1b2f,32768,"GB-FLIP Beta (Bung) (PD) [C]"},
{0x7eeb78e6,32768,"GB-FLIP Beta (Bung) (PD) [C][a1]"},
{0xb1fa5ceb,32768,"GB-FLIP Demo (Bung) (PD) [C]"},
{0x041ec976,524288,"GB-PDA V3.0 (PD) [C]"},
{0xceb47905,524288,"GB-PDA V4.0 (06-16-1999) (PD) [C]"},
{0x9724cfec,524288,"GB-PDA V4.0 (06-28-1999) (PD) [C]"},
{0xeb91b08b,524288,"GB-PDA V4.1 (01-14-2000) (PD) [C]"},
{0x2f5a0761,524288,"GB-PDA V4.1 (01-28-2000) (PD) [C]"},
{0x83589ae9,32768,"GBS Player V1.02 - Blades of Steel (PD) [C]"},
{0x5f3e659c,65536,"GBS Player V1.02 - Commander Keen (PD) [C]"},
{0xc9371a75,131072,"GBS Player V1.02 - Legend of Zelda - Oracle of Ages (PD) [C]"},
{0xf196e724,131072,"GBS Player V1.02 - Legend of Zelda - Oracle of Season (PD) [C]"},
{0x3d750a16,131072,"GBS Player V1.02 - Mario Tennis (PD) [C]"},
{0x7613b32a,131072,"GBS Player V1.02 - Metal Gear Solid (PD) [C]"},
{0x9b148375,32768,"GBS Player V1.02 - Tiny Toon Adventures - Wacky Sport (PD) [C]"},
{0x1eaf1dac,32768,"Genetic (PD) [C]"},
{0xd0fc7eff,32768,"GHX Example Sample (PD) [C]"},
{0xefe20bde,32768,"GHX Music - Melodic (PD) [C]"},
{0x17c06b1f,32768,"GHX Music - Near end (PD) [C]"},
{0xd2546da5,32768,"GHX Music - Walkabout (PD) [C]"},
{0x64483e84,32768,"GHX Music - Wonders (PD) [C]"},
{0x0fe5c6cd,32768,"GHX Walkabout (PD) [C]"},
{0x6a47fc01,32768,"Glowing Ember (PD) [C]"},
{0x14e79342,32768,"God Save The Queen (PD) [C]"},
{0xfe410123,32768,"Going In XXX (PD) [C]"},
{0x6b461455,32768,"Good Direction XXX (PD) [C]"},
{0x5aded71b,262144,"Graal V1.1 Adventure Demo (PD) [C]"},
{0x7c796b2a,2097152,"Gran Turismo 2 (PD) [C]"},
{0x461032e8,65536,"Grand Bleu, Le (Freedom GB Contest 2001) (PD) [C]"},
{0x2ed509d9,65536,"Green Beret (PD) [C]"},
{0x5ec58aaf,32768,"Greeting Card Demo 1 (PD) [C]"},
{0xa29d0c6e,32768,"Greeting Card Demo 2 (PD) [C]"},
{0x3113e172,524288,"Guess The Number 3 (PD) [C]"},
{0xe5ec31a5,65536,"Gunpey (PD) [C]"},
{0xb6ee732a,1048576,"Helitac Demo (PD) [C]"},
{0x133fca93,1048576,"Helitac V0.01 (PD) [C]"},
{0x83cc85f4,32768,"Hello World (PD) [C]"},
{0x965e17bf,32768,"Hello World Splash Demo (PD) [C]"},
{0x5cbf4042,32768,"Hentai for Color Demo (PD) [C]"},
{0x92d4c6ec,32768,"Hentai for Color Demo (PD) [C][a2]"},
{0x371495d2,32768,"Hentai for Color Demo (PD) [C][a3]"},
{0x570e49c4,32768,"Hentai for Color Demo (PD) [C][a1]"},
{0x048243e6,131072,"Hi-Color Demo (PD) [C]"},
{0x735b4ad6,262144,"Hi-Color Demo 2 (PD) [C]"},
{0x03aeb63d,65536,"Hi-Color Demo 3 (PD) [C]"},
{0xcb50d8bd,131072,"Hi-Color Demo 4 (PD) [C]"},
{0x7c5955ba,32768,"Hi-Color Demo 5 (PD) [C]"},
{0xf71aba8a,65536,"High Score Routines V2 by Shen Mansell (PD) [C]"},
{0x8ac67ed0,32768,"HighNoon (PD) [C]"},
{0xb3852cd0,32768,"Holiday Greetings (Bung) (PD) [C]"},
{0x221b0ab6,131072,"Horrible Demon 2, The (Lik-Sang) (PD) [C]"},
{0xf7218a94,262144,"Horrible Demon 3, The (Bung V4) (PD) [C]"},
{0x0ab36333,262144,"Horrible Demon 4, The (Freedom GB Contest 2001 - Grand Prize) (PD) [C]"},
{0x79ef1a66,32768,"Horse Race (PD) [C]"},
{0xfd48e218,32768,"Huelsi (Alpha 8) (PD) [C]"},
{0x04119342,32768,"Huelsi (Bung) (PD) [C]"},
{0xab39fc0f,32768,"Huelsi (PD) [C]"},
{0x69cca42b,524288,"Hungry are the Dead - Demo 3 by Berserker Industries (PD) [C]"},
{0x03f2f2b0,131072,"Hungry are the Dead (Bung) (PD) [C]"},
{0xce0e75f2,131072,"Hungry are the Dead (PD) [C]"},
{0x3e5be6bb,65536,"I Guardian (PD) [C]"},
{0x0940c051,32768,"IBM IR Keyboard (PD) [C]"},
{0xa1c9a4f7,65536,"Infinite BOBS Demo (PD) [C]"},
{0x83c3e427,65536,"Infinite BOBS Demo (PD) [C][a1]"},
{0x82818c1e,262144,"Infocom - BALLYHOO (PD) [C]"},
{0x2476a2a4,131072,"Infocom - Cutthroats (PD) [C]"},
{0xd513f2fe,131072,"Infocom - Deadline (PD) [C]"},
{0x67b9a83b,131072,"Infocom - Enchanter (PD) [C]"},
{0xd6f3955b,131072,"Infocom - Enchanter 2 - Sorcerer (PD) [C]"},
{0x6ab59ad2,131072,"Infocom - Hitchiker's Guide to the Galaxy, The (PD) [C]"},
{0x18206c25,131072,"Infocom - Hollywood Hijinx (PD) [C]"},
{0x59c1b06e,131072,"Infocom - Infidel (PD) [C]"},
{0xd163650d,262144,"Infocom - Leather Goddesses of Phobos, The (PD) [C]"},
{0x865930c2,262144,"Infocom - Lurking Horror, The (PD) [C]"},
{0x3fed8f80,262144,"Infocom - Moonmist (PD) [C]"},
{0x6750f818,131072,"Infocom - Planetfall (PD) [C]"},
{0x9dffb06d,262144,"Infocom - Plundered Hearts (PD) [C]"},
{0xcb33a052,131072,"Infocom - Seastalker (PD) [C]"},
{0x978af406,262144,"Infocom - Spellbreaker (Enchanter 3) (PD) [C]"},
{0xd9fbbbf9,131072,"Infocom - Starcross (PD) [C]"},
{0xa75d493e,262144,"Infocom - Stationfall (PD) [C]"},
{0x33f6b667,131072,"Infocom - Suspect (PD) [C]"},
{0x843f5956,131072,"Infocom - Suspended (PD) [C]"},
{0x36b5bb07,262144,"Infocom - Wishbringer (PD) [C]"},
{0xea6d3cdf,131072,"Infocom - Witness, The (PD) [C]"},
{0x932ccb0a,131072,"Infocom - Zork I - The Great Underground Empire (PD) [C]"},
{0x162e3e9e,131072,"Infocom - Zork II - The Wizard of Frobozz (PD) [C]"},
{0x94026713,131072,"Infocom - Zork III - The Dungeon Master (PD) [C]"},
{0x1b7e60dd,32768,"Infra-Read Demo (PD) [C]"},
{0x50128c1f,32768,"Infrared Investigator by Ken Kaarvik (PD) [C]"},
{0xfd096905,32768,"In-Game Rumble Demo (PD) [C]"},
{0x87f0bb59,65536,"Invasion DX (Bung) (PD) [C]"},
{0xcd765690,65536,"Invasion DX (Bung) (PD) [C][a1]"},
{0x8dfa2d66,65536,"Invasion DX (Lik-Sang) (PD) [C]"},
{0xf415fb4b,32768,"IR 0604 Controller (PD) [C]"},
{0x22a891ee,262144,"Iron Hike (Bung) (PD) [C]"},
{0x4eb3576c,65536,"IR-Viewer (PD) [C]"},
{0xdfd7af9c,32768,"Issac's First GB Demo (Quang2000) (PD) [C]"},
{0xb7590216,262144,"Jet Set Willy (Bung) (PD) [C]"},
{0xa17e25ce,65536,"Jet Set Willy V2 (Beta 2) (PD) [C]"},
{0xbee5ea3a,65536,"Jet Set Willy V2 (Beta 4) (PD) [C]"},
{0x36a93636,131072,"JetPak DX (Bung) (PD) [C]"},
{0x7bd323e5,131072,"JetPak DX (Bung) (PD) [C][a1]"},
{0xb16d6847,131072,"JetPak DX (PD) [C]"},
{0x879efab2,32768,"JetPak DX V0.05 (PD) [C]"},
{0x183c43a3,32768,"JetPak DX V0.05s (PD) [C]"},
{0xcab120df,32768,"JetPak DX V0.06 (PD) [C]"},
{0x68c7c116,32768,"JetPak DX V0.08 (PD) [C]"},
{0x4a6acade,524288,"Jewel Thief (PD) [C]"},
{0x06adaadb,32768,"Joshua Wise's Demo (Quang2000) (PD) [C]"},
{0xffe6edaa,65536,"Jumpik (Bung V4) (PD) [C]"},
{0x75c8ddf6,32768,"Jumping Jack Color (PD) [C]"},
{0x8df82284,65536,"Jumpman '86 (HimmelHopp) Demo by Par Johannesson (PD) [C]"},
{0x1accf367,65536,"Jumpman '86 (HimmelHopp) Demo by Par Johannesson (PD) [C][a1]"},
{0x46a647c1,131072,"Jumpman '86 by Par Johannesson (PD) [C]"},
{0x313c486a,65536,"Jumpman '86 by Par Johannesson (PD) [C][a1]"},
{0x061346dd,65536,"Jumpman '86 by Par Johannesson Release 2 (PD) [C]"},
{0xd1277eeb,32768,"Kc by Johnny 13 (PD) [C]"},
{0x872e19ab,65536,"Kemuria Adventure (Bung V4) (PD) [C]"},
{0x47ec88e8,32768,"Kenny and the Evil Blob (Bung V4) (PD) [C]"},
{0x29625dd5,32768,"King's Korner by Harold Toler (PD) [C]"},
{0xb5479316,262144,"Kitty Quest by Shen Mansell (Y2kode) (PD) [C]"},
{0x6e5d5d48,32768,"Klondike (Quang2000) (PD) [C]"},
{0x9e7cc0c2,32768,"Klondike (Quang2000) (PD) [C][a1]"},
{0xea451dbd,131072,"KOLOBOK ZOOM 1 (PD) [C]"},
{0x9d51be49,131072,"KOLOBOK ZOOM 2 (PD) [C]"},
{0x01d1395a,32768,"Kournikova (PD) [C]"},
{0xf1ce3058,32768,"Kyn (Bung) (PD) [C]"},
{0x2abcd052,32768,"Lab 3D (Martin5) Demo (Bung V4) (PD) [C]"},
{0xfa795a27,32768,"Laby Mon (Bung) (PD) [C]"},
{0x5dfb4368,16384,"Lake Effect Demo (PD) [C]"},
{0x1368aee2,32768,"Lawn Mover (Bung) (PD) [C]"},
{0xe483a9fa,32768,"Lawn Mover (Bung) (PD) [C][a1]"},
{0x81efcb07,32768,"Lawnboy (Bung) (PD) [C]"},
{0xfb70b00d,32768,"LawnBoy (PD) [C]"},
{0x798b34c1,32768,"LCD Game (Freedom GB Contest 2001) (PD) [C]"},
{0xf2259202,65536,"LEGO Remocon Test (PD) [C]"},
{0xdabd9ca7,65536,"Leisure Suit Nick (PD) [C]"},
{0x29cad87f,32768,"Lemon Player 2 Demo by Lemon Productions (PD) [C]"},
{0x98e42898,65536,"Lemon Tracker Player 2.1 (PD) [C]"},
{0x89c9f6c6,65536,"Lemon Tracker Player V2.95a (GBDK version) (PD) [C]"},
{0x6f83254d,32768,"Lemon Tracker Player V2.95a (RGBDS version) (PD) [C]"},
{0x02d91b28,65536,"Less Is More Demo (PD) [C]"},
{0x4f4c6956,32768,"Link Up Code Sample (PD) [C]"},
{0x7bf27c9a,32768,"Little Fantasy (Quang2000) (PD) [C]"},
{0x04dad7c5,32768,"Little Fantasy (Tomas Rychnovsky) (PD) [C]"},
{0x74d67471,32768,"Little Fantasy Demo (Tomas Rychnovsky) (PD) [C]"},
{0xdcce0b0c,131072,"Little Sound Dj V0.81 Demo by Johan Kotlinski (PD) [C]"},
{0x2aecbad6,131072,"Little Sound Dj V0.82 Demo by Johan Kotlinski (PD) [C]"},
{0xba0cb5ca,131072,"Little Sound Dj V0.83 Demo by Johan Kotlinski (PD) [C]"},
{0x7271246f,131072,"Little Sound Dj V0.90 Demo by Johan Kotlinski (PD) [C]"},
{0xd2037eab,131072,"Little Sound Dj V0.99 Demo by Johan Kotlinski (PD) [C]"},
{0xacb9a1a3,262144,"Little Sound Dj V1.02 Demo by Johan Kotlinski (PD) [C]"},
{0x51c53b39,262144,"Little Sound Dj V1.03 Demo by Johan Kotlinski (PD) [C]"},
{0x92c86839,524288,"Little Sound Dj V1.05 Demo by Johan Kotlinski (PD) [C]"},
{0x64fc9e56,524288,"Little Sound Dj V1.08 Demo by Johan Kotlinski (PD) [C]"},
{0xa75d1d00,131072,"Little Sound Dj V1.0b Demo by Johan Kotlinski (PD) [C]"},
{0x7d67f7a9,524288,"Little Sound Dj V1.21 Demo by Johan Kotlinski (PD) [C]"},
{0xce787872,524288,"Little Sound Dj V1.27 Demo by Johan Kotlinski (PD) [C]"},
{0x639e162e,524288,"Little Sound Dj V1.30b Demo by Johan Kotlinski (PD) [C]"},
{0x7b59df26,524288,"Little Sound Dj V1.31 Demo by Johan Kotlinski (PD) [C]"},
{0x9148f956,524288,"Little Sound Dj V1.32b Demo by Johan Kotlinski (PD) [C]"},
{0xce8797ef,524288,"Little Sound Dj V1.34b Player by Johan Kotlinski (PD) [C]"},
{0x4f842947,524288,"Little Sound Dj V1.35a Player by Johan Kotlinski (PD) [C]"},
{0xf33a054a,524288,"Little Sound Dj V1.35c Player by Johan Kotlinski (PD) [C]"},
{0x7f52da64,524288,"Little Sound Dj V1.35d Player by Johan Kotlinski (PD) [C]"},
{0xafde7a2b,131072,"Little Sound Dj Vx.xx Demo by Johan Kotlinski (PD) [C]"},
{0x184541b0,131072,"Little Sound Dj Vx.xx Demo by Johan Kotlinski (PD) [C][a1]"},
{0x823ea4d9,32768,"Lock (Bung) (PD) [C]"},
{0x4d2c2bd9,32768,"Logo Xmas (PD) [C]"},
{0x07a5d21d,65536,"Love Replica Demo (PD) [C]"},
{0x2bbaba96,131072,"Luigo Scroller (PD) [C]"},
{0x922d6bdd,262144,"Mad Mall (Lik-Sang) (PD) [C]"},
{0x1c605342,65536,"Magic Eye (PD) [C]"},
{0x96c29163,524288,"MainBlow (Bung V4) (PD) [C]"},
{0x83a3558a,524288,"Manga Slideshow (XXX) 1 - Girls, girls, girls... (PD) [C]"},
{0x64b4ba13,262144,"Manga Slideshow (XXX) 2 - More girls (PD) [C]"},
{0xdeddc55f,262144,"Maniac Miner (Bung) (PD) [C]"},
{0x83920b82,65536,"Marcbla 3D Demo (Bung V4) (PD) [C]"},
{0x98005ca0,65536,"Marcbla 3D Demo (PD) [C]"},
{0xf36e5e3d,65536,"Margo (Bung) (PD) [C]"},
{0x062ea71b,65536,"Mario Bob Demo (PD) [C]"},
{0x534e2957,90088,"Mario Bros (NES Conversion) (PD) [C]"},
{0x89ac3e71,65536,"Mario Brothers Demo (PD) [C]"},
{0x5b351f40,32768,"Mario Brothers Demo (V0.2) (PD) [C]"},
{0x6ec85bc5,32768,"Mario Clone (PD) [C]"},
{0x42805666,32768,"MathDrill 2.0 (PD) [C]"},
{0x4ff91daf,32768,"Matrix Hi-Color Demo (PD) [C]"},
{0x1e26866f,32768,"Maximum Body Count (PD) [C]"},
{0xfa8f5cb6,131072,"Maximum Body Count (PD) [C][a1]"},
{0x34fe9510,32768,"Maximum Body Count (PD) [C][a2]"},
{0x35657092,262144,"Maximum Body Count V2.95 (PD) [C]"},
{0x56d00ed1,32768,"Maze (Bung) (PD) [C]"},
{0xf2ec791d,32768,"MAZE (PD) [C]"},
{0xf17ca9e1,32768,"Maze by 'Jason' (PD) [C]"},
{0x6f2691e5,32768,"Maze Runner - Atari-Style Version (Quang2000) (PD) [C]"},
{0x14ce3a8c,32768,"Maze Runner (Quang2000) (PD) [C]"},
{0x74d74241,32768,"Maze V1.01 by Jeff Siebold (PD) [C]"},
{0x002ec1a7,65536,"Mean Mr Mustard (Lik-Sang) (PD) [C]"},
{0x5a929e2e,262144,"Megane Tengoku (J) (PD) [C]"},
{0x6b8c14d5,32768,"Merry XXX-mas Demo (PD) [C]"},
{0x7fb72992,32768,"MG-888 (PD) [C]"},
{0x8fa3aad1,262144,"Mig 21 (Bung) (PD) [C]"},
{0x930cd8fd,262144,"Mig 21 (Bung) (PD) [C][a1]"},
{0xd7c5ef58,262144,"Mig 21 (Bung) (PD) [C][a2]"},
{0x71a0b7a9,32768,"Minefield (Lik-Sang) (PD) [C]"},
{0x80d8dd5c,32768,"Mines (Bung) (PD) [C]"},
{0x3b9ba83e,32768,"Minesweeper for 'Windows' (Quang2000) (PD) [C]"},
{0x10179cf7,65536,"Mini Zork (PD) [C]"},
{0x806fb6d7,2097152,"Mode 7 Demo Kart by Sam Blanchard (PD) [C]"},
{0xfa8ff5ca,131072,"Moon Fighter (Bung V4) (PD) [C]"},
{0x157ab813,32768,"Mouse Trap (PD) [C]"},
{0x83b0e2fa,32768,"Moving Fox (PD) [C]"},
{0xe217a4eb,32768,"MPlay 2 Demo - Easy Driving (PD) [C][a1]"},
{0xe1e36e88,32768,"MPlay 2 Demo - Funky Test (PD) [C][a1]"},
{0x829f8090,32768,"MPlay 2 Demo - Gumby Boy (PD) [C][a1]"},
{0xcbb06737,32768,"MPlay 2 Demo - Room Service (PD) [C][a1]"},
{0x5a772609,32768,"MPlay 2 Demo - Showroom Music (PD) [C][a1]"},
{0x81970269,32768,"MPlay 2 Demo - Silly Song (PD) [C][a1]"},
{0x3afb45f3,32768,"MPlay 2 Demo - Tango Thud (PD) [C][a1]"},
{0x63d2ae19,32768,"MPlay 2 Demo - Yar's Revenge (PD) [C]"},
{0x0269c529,32768,"Mr. Dig (Bung V4) (PD) [C]"},
{0xee31588e,32768,"Music Box 1.3 ISAS-RGBDS Example (PD) [C]"},
{0x0e28ab97,32768,"Music Box 1.3 Tracker (PD) [C]"},
{0x602335e1,32768,"Music Box by BlackBox (PD) [C]"},
{0x77ce47c7,32768,"Music Box Example (PD) [C]"},
{0xe854d894,32768,"My GB is Your GB and Your GB is My GB (PD) [C]"},
{0x2e83da71,32768,"Mygame (Bung) (PD) [C]"},
{0x685052aa,131072,"Nam Attack (PD) [C]"},
{0x46d5f3db,32768,"Neo-Racer (Quang2000) (PD) [C]"},
{0xcc22677a,32768,"Nervous (PD) [C]"},
{0x93e1a6c0,65536,"NES Duck Hunt (PD) [C]"},
{0x8f6c9f17,65536,"NES Hogan's Alley (PD) [C]"},
{0x491bc75b,65536,"NES Popeye (PD) [C]"},
{0x346ab1d7,90088,"NES Tennis (PD) [C]"},
{0x0f02c87d,65536,"NES Urban Champion (PD) [C]"},
{0x0796c34c,65536,"NES Wild Gunman (PD) [C]"},
{0xc0d6b27f,32768,"Nibbler (PD) [C]"},
{0xdb4cd375,131072,"Nightmode (PD) [C]"},
{0xa0668163,32768,"Ninety (PD) [C]"},
{0x2173b4b2,32768,"NiNSslider (Bung) (PD) [C]"},
{0x0c1d0f97,32768,"NiNSslider (PD) [C]"},
{0x682e32be,32768,"NiNSslider (PD) [C][a1]"},
{0x8bcc6090,131072,"Noah's Arkaid (Bung) (PD) [C]"},
{0x14e0f59e,32768,"Noah's Arkaid (PD) [C]"},
{0xb509a1a0,65536,"NoDrop V1.0 (PD) [C]"},
{0x7d5da670,65536,"NoDrop V1.1 (PD) [C]"},
{0x768960ea,65536,"NoDrop V1.2 (PD) [C]"},
{0xa35cf7c3,65536,"NoDrop V1.3 (PD) [C]"},
{0x82dc882a,262144,"NoDrop V1.5 (PD) [C]"},
{0xc9227041,32768,"NTSC Color Test Bars (PD) [C]"},
{0x4871a6a2,32768,"OBGBTC (Tile Creator) (PD) [C]"},
{0x12aab026,32768,"Old School XXX (PD) [C]"},
{0xd1b243e6,32768,"Oxygen Intro (PD) [C]"},
{0xc29219fa,131072,"Oyoyo (Bung) (PD) [C]"},
{0x7b2ac8f0,131072,"Oyoyo (Bung) (PD) [C][a1]"},
{0xf77f700d,32768,"P9 Demo (PD) [C]"},
{0x84efb9f2,32768,"Pacman (Bung) (PD) [C]"},
{0x6e3b4dbf,32768,"Pac-Man (PD) [C]"},
{0xe8f943ce,32768,"Pacman by Jeff Frohwein (PD) [C]"},
{0x9569d52b,32768,"Pac-Man Demo (PD) [C]"},
{0x5d06028a,32768,"Pac-Man Demo 2 (PD) [C]"},
{0x1174fba2,32768,"Pacman Kids (Bung) (PD) [C]"},
{0x0463a42b,65536,"Pakman by Robsoft (PD) [C]"},
{0x47d7acdc,131072,"Pakus (Bung) (PD) [C]"},
{0xda9cb40f,131072,"Paragon 5 Album (PD) [C]"},
{0xda5350c9,32768,"Pattern Demo (PD) [C]"},
{0x146c4eb8,32768,"Perplex Deluxe (Y2kode) (PD) [C]"},
{0x5016fa9b,1048576,"Phoenix [Jim Bagley] (PD) [C]"},
{0xf39c8119,32768,"Pie Crust V1.0 (Quang2000) (PD) [C]"},
{0x7b08312f,131072,"Planet X (Bung) (PD) [C]"},
{0xb41a4800,32768,"Plasma Storm (Blue) (PD) [C]"},
{0x6163f319,32768,"Plum Wars (Bung) (PD) [C]"},
{0x3b42dc53,32768,"Pocket Enigma V1.3 (Bung V4) (PD) [C]"},
{0xe3d05f43,131072,"Pocket Panic (Bung) (PD) [C]"},
{0x2c2ce722,32768,"Pocket Panic (PD) [C]"},
{0x5b9dc17c,32768,"Poke Da Mon (Bung) (PD) [C]"},
{0x7491ce30,32768,"Pokemon Harrier (PD) [C]"},
{0x038165c5,65536,"Pong (Bung) (PD) [C]"},
{0x381cb531,32768,"Pothead Pong (PD) [C]"},
{0xca3753fa,1048576,"Pretty Fly for a White Guy (PD) [C]"},
{0xd727c225,524288,"Princess & the Pauper, The (Freedom GB Contest 2001 - 3rd Place) (PD) [C]"},
{0xf62220bf,32768,"Project XSTREAM (Bung) (PD) [C]"},
{0x4b137fc4,32768,"Project XSTREAM (Bung) (PD) [C][a1]"},
{0x1e61cace,32768,"Proof Demo (PD) [C]"},
{0x82135b73,65536,"Proxima (Freedom GB Contest 2001 - 2nd Place) (PD) [C]"},
{0x3f05f7ef,65536,"Proxima (PD) [C]"},
{0xc6a3b0c5,65536,"Proxima by Alan Obee (PD) [C]"},
{0xbd6e27a4,65536,"PSST (Bung) (PD) [C]"},
{0x365b937c,49152,"Pulsar (Freedom GB Contest 2001) (PD) [C]"},
{0xa39a0a84,131072,"Putty Squad Demo by Thalamus Interactive (PD) [C]"},
{0x722cce9e,131072,"Puzzlex 2 by Par Johannesson (PD) [C]"},
{0x20cbc3fa,32768,"Q-bert Demo (PD) [C]"},
{0xd5685707,32768,"Quizz (PD) [C]"},
{0x3fc85a03,65536,"Red Dreams (Freedom GB Contest 2001) (PD) [C]"},
{0x4e2b2bff,32768,"Red Top by Vodka, DCS & iOPOP (PD) [C]"},
{0x2a34b417,65536,"Remote Control (1) (PD) [C]"},
{0xe3bcb9f3,65536,"Remote Control (2) (PD) [C]"},
{0xb1bb7f0c,65536,"Remote Control (3) (PD) [C]"},
{0x340d2ec2,65536,"Remote Control (4) (PD) [C]"},
{0x94cf907f,32768,"Remote Control 2 (PD) [C]"},
{0xd10a2fba,32768,"Remote Control Detector (PD) [C]"},
{0xdda4c024,32768,"RemoteBoy (PD) [C]"},
{0x9b6326f9,65536,"REM-Scan NEC Format by TeamKNOx (PD) [C]"},
{0x50800f74,65536,"REM-Scan NEC Format by TeamKNOx (PD) [C][a1]"},
{0x2274d67c,65536,"REM-Scan NEC Format by TeamKNOx (PD) [C][a2]"},
{0xf05f689e,65536,"REM-Scan Sony Format by TeamKNOx (PD) [C]"},
{0xd13b97d7,65536,"REM-Scan Sony Format by TeamKNOx (PD) [C][a1]"},
{0x2e36f727,65536,"ReRoCon Infra-Red RC (PD) [C]"},
{0x038181ae,32768,"RGB Grafx Demo (PD) [C]"},
{0xab478c08,32768,"Right! (PD) [C]"},
{0x0123b238,262144,"RoboTech - Exit Planet Dust (Lik-Sang) (PD) [C]"},
{0x8888778f,262144,"RoboTech - Exit Planet Dust with Music (Lik-Sang) (PD) [C]"},
{0x0dc2fbe9,32768,"Rob's Pakman (PD) [C]"},
{0xc97a0132,32768,"Rogue Orange V1.0 (PD) [C]"},
{0x7ecfddf1,32768,"Rogue Orange V1.1 (PD) [C]"},
{0x1f901ba9,32768,"Rogue Orange V1.11 (Bung) (PD) [C]"},
{0xe2bf4b91,32768,"Rogue Orange V1.11 (PD) [C]"},
{0x02f98818,131072,"Romantic Dream (PD) [C]"},
{0x2e42d0b1,65536,"RoReCon (02-20-2000) (PD) [C]"},
{0x4416a41f,32768,"Rotagraph (PD) [C]"},
{0x5fd82320,65536,"Rotating Face Demo (PD) [C]"},
{0x1ed1cc7a,65536,"RPG Demo (Bung V4) (PD) [C]"},
{0x2d65180d,32768,"RS-232 Send-Receive Demo (PD) [C]"},
{0x281ccec5,32768,"Rushed Xmas greetings from Sack (PD) [C]"},
{0x9a5b2789,131072,"S World 2 (Bung V4) (PD) [C]"},
{0x14d4399c,32768,"Sabotage Color Demo (PD) [C]"},
{0xa06362d9,32768,"Same Or Not (PD) [C]"},
{0xb4f50ecc,32768,"Scramble (PD) [C]"},
{0x8b00d803,32768,"Scrolling Blue Demo (PD) [C]"},
{0x6e11eb46,32768,"Serpent Apocalypse V.6 (Quang2000) (PD) [C]"},
{0xca528573,32768,"Shao-lin's Road (PD) [C]"},
{0xa25991e1,65536,"Shape by Sack (PD) [C]"},
{0x38c35811,262144,"Shoot Demo (PD) [C]"},
{0xbd09359c,32768,"Short Little Demo (Y2kode) (PD) [C]"},
{0xbd18f3c4,114688,"SimBurgerKing (Freedom GB Contest 2001) (PD) [C]"},
{0x3cf5de3e,32768,"SIMON Clone (PD) [C]"},
{0x3528aee3,32768,"Ski Style (Bung) (PD) [C]"},
{0x043e461e,32768,"Skoardy (Bung) (PD) [C]"},
{0xacf2fe31,65536,"Slime's Adventure (Bung V4) (PD) [C]"},
{0x5f5158cb,65536,"Slugs (Lik-Sang) (PD) [C]"},
{0xd000237b,524288,"Slugs (PD) [C]"},
{0x8da09e11,32768,"Smooth Colour Fading Demo (PD) [C]"},
{0x68f3a2f0,32768,"SMYGB Demo (PD) [C]"},
{0xe14f741d,32768,"Snake (Bung) (PD) [C]"},
{0xdd99a6f4,32768,"SnakEat (Bung V4) (PD) [C]"},
{0x4dc142da,65536,"Snaps (PD) [C]"},
{0xe2db8996,32768,"Sneaky Snakes (Bung) (PD) [C]"},
{0x7c658476,32768,"Sonic the Hedgehog Demo (PD) [C]"},
{0x140b1684,32768,"Sony IR Keyboard (PD) [C]"},
{0x1ad015d4,131072,"SOS by R-Lab (PD) [C]"},
{0x0632d09b,131072,"South Park Xtreme Demo (PD) [C]"},
{0xb9497145,131072,"South Park Xtreme Demo (PD) [C][a1]"},
{0x4882c3a6,32768,"Southern Dreams - Slideshow (Lik-Sang) (PD) [C]"},
{0xdf590dea,32768,"Southern Dreams - SMART Demo (Quang2000) (PD) [C]"},
{0x28f667d8,32768,"SPA Scroller (PD) [C]"},
{0xbf43c375,65536,"Space (Bung) (PD) [C]"},
{0x4cbeb30e,32768,"Space Debris (Bung) (PD) [C]"},
{0x85e52c97,131072,"Space Faces (Bung V4) (PD) [C]"},
{0x0c0a777e,32768,"Space Fighter (V1.01) (PD) [C]"},
{0x19fa1b8e,262144,"Space Mission DX (Bung V4) (PD) [C]"},
{0x67c714bb,32768,"Splash 360 Demo (PD) [C]"},
{0x953b3019,32768,"Splash Demo (PD) [C]"},
{0xe7e32900,32768,"Spong (Bung) (PD) [C]"},
{0x8c69a793,32768,"Spr4col (Bung) (PD) [C]"},
{0x668ffa73,65536,"SQRXZ Color (V0.95) (PD) [C]"},
{0xc9a51bc4,65536,"SQRXZ Color (V0.96) (PD) [C]"},
{0x927c73b8,65536,"Stadin Brankkari (Party Version) (PD) [C]"},
{0x3c6d8611,65536,"Stadin Brankkari (PD) [C]"},
{0x3be84e3d,65536,"Stalker by Jorge Persiva (Y2kode) (PD) [C]"},
{0x996dbc97,32768,"Star Field Demo (PD) [C]"},
{0x964cfde5,32768,"Star Fighter by Jonathan Waugh (PD) [C]"},
{0xc72e6dfe,1048576,"Star Heritage (final) (Battery) (PD) [C]"},
{0xb39b4532,1048576,"Star Heritage (final) (Password) (PD) [C]"},
{0x23e25ed1,524288,"Star Heritage Demo Version by R-Lab (PD) [C]"},
{0xabcf049b,32768,"Star Tex (Quang2000) (PD) [C]"},
{0x5b47c6e9,32768,"Star Tex (Quang2000) (PD) [C][a1]"},
{0x1775be37,32768,"Starfight (PD) [C]"},
{0xdadb2a9b,32768,"Stereo Demo (PD) [C]"},
{0x93bf7bed,32768,"Stereo Demo (PD) [C][a1]"},
{0xd1ecfda4,65536,"Stoic Software's Tribute to the United States (PD) [C]"},
{0x9ecda78f,32768,"Stomp the Slime (Bung) (PD) [C]"},
{0x52f37f67,32768,"Stopwatch (PD) [C]"},
{0x397a2083,32768,"Stripped by Triad (PD) [C]"},
{0xb20d84c5,65536,"Super Ninja - a TornPocket Production (WIP) (Y2kode) (PD) [C]"},
{0x25f56322,32768,"Sword (pre Beta Alpha) (PD) [C]"},
{0x1a6854e7,32768,"SWorld (Lik-Sang) (PD) [C]"},
{0x6d56daf8,131072,"Tank Rush (Bung) (PD) [C]"},
{0x618f3bb9,131072,"Tanks! (Bung) (PD) [C]"},
{0xf078ba56,32768,"Tertrablox 2000 (Bung) (PD) [C]"},
{0x6b7e2c48,32768,"Tetris (PD) [C]"},
{0x0f5be7b5,65536,"Thrust (V13-02-2000) (PD) [C]"},
{0xff3f7f03,65536,"Thrust DX (PD) [C]"},
{0x3ae4553e,32768,"Tic-Tac-Toe Demo by Johnny13 (PD) [C]"},
{0xb295c08b,32768,"Tiles by Johnny13 (PD) [C]"},
{0x6044ed1b,32768,"Titney High Colour Demo (PD) [C]"},
{0x03516b3e,32768,"Tochi (Quang2000) (PD) [C]"},
{0x6b8e742f,32768,"Tricolore (PD) [C]"},
{0xf36fa8c4,32768,"Trid Ball (Quang2000) (PD) [C]"},
{0x172a77ad,65536,"TrueText Gameboy Text Library V1.0 by Shen Mansell (PD) [C]"},
{0xe2933cb3,32768,"Turret Duty (Bung) (PD) [C]"},
{0xc4655f0a,131072,"Tutti Demo Version (PD) [C]"},
{0x0424452c,32768,"Twist (Bung V4) (PD) [C]"},
{0xa769dcb8,32768,"Two Strange Guys HI-Color Pic (PD) [C]"},
{0x0e7d78d1,65536,"UGB Player Demo by Thalamus Interactive (PD) [C]"},
{0xcc92a0a8,1048576,"Ultima 3 by Sven Carlberg V0.993 (PD) [C]"},
{0x1e0f8c40,1048576,"Ultima 3 by Sven Carlberg V0.995 (PD) [C]"},
{0xf84833b8,1048576,"Ultima 3 by Sven Carlberg V0.99x (PD) [C]"},
{0xbb522d4d,1048576,"Ultima 3 by Sven Carlberg V0.99x (PD) [C][a1]"},
{0x83d560b1,1048576,"Ultima 3 by Sven Carlberg V0.99x (Y2kode) (PD) [C]"},
{0xde649282,131072,"Unholy 2, The by SkyBaby (PD) [C]"},
{0x9befbc6b,32768,"Vectrony Demo (PD) [C]"},
{0x902b6962,32768,"Vertical Mess Demo (PD) [C]"},
{0x599516ee,32768,"Video Poker (Bung) (PD) [C]"},
{0x464bd9b1,131072,"Vila Caldan Color (PD) [C]"},
{0x3aca89d7,32768,"Vila Caldan Color Demo (PD) [C]"},
{0x17d8275c,262144,"Vivian Demo (PD) [C]"},
{0xdb362294,65536,"VXL - Voxel Landscape Example (PD) [C]"},
{0x1bb399f2,1048576,"Walk (Bung) (PD) [C]"},
{0x563989d7,32768,"Wario Craft (PD) [C]"},
{0x6bde313e,65536,"Water Basketball (Bung) (PD) [C]"},
{0x1d9f6f9d,32768,"Water Lake Effect, The (PD) [C]"},
{0xfb8f10e8,32768,"Wave Scrolling Test Demo (PD) [C]"},
{0x92e9990d,32768,"Whackemon (Quang2000) (PD) [C]"},
{0x78fe29d7,32768,"Where's the Chip-Hop (Bung V4) (PD) [C]"},
{0x0ebdf1ed,131072,"Wiedzmin - tom by Andrzej Sapkowski (Polish) (PD) [C]"},
{0x6790b6b9,32768,"Willy Wonderworm (Bung) (PD) [C]"},
{0x5d34dabd,32768,"Willy Wonderworm (Bung) (PD) [C][a1]"},
{0x210bce6a,32768,"Willy Wonderworm (PD) [C]"},
{0xb5c23406,32768,"Willy Wonderworm (PD) [C][a1]"},
{0xa59909c5,32768,"Wings Demo (PD) [C]"},
{0x611e4286,32768,"Wired Demo by R-Lab (bugfixed version) (GBDev'2000 Winner) (PD) [C]"},
{0x01147b24,32768,"Wired Demo by R-Lab (Quang2000) (PD) [C]"},
{0x94ba2eed,32768,"WonderTopia (PD) [C]"},
{0xb7aeb25d,524288,"Work Master v1.00 - Multitask OS for Gameboy (PD) [C]"},
{0xdbbc515a,32768,"XaGoR Demo (Lik-Sang) (PD) [C]"},
{0xfdb44a36,131072,"Xevious Millennium (PD) [C]"},
{0x5ef51075,131072,"Xevious Sample (PD) [C]"},
{0x3be307df,32768,"Xmas Demo by FagEmul (PD) [C]"},
{0xc5e6fa3c,32768,"Xmas Demo for Consolemul by FagEmul (PD) [C]"},
{0x0029d215,32768,"Xmas Demo for Rc-Roms by FagEmul (PD) [C]"},
{0x5e128f90,524288,"Xmas2000 (PD) [C]"},
{0x5585d67c,65536,"XXX Files Part 1 (PD) [C]"},
{0x3cac01d6,131072,"XXX Files Part 2 (PD) [C]"},
{0x48aa7b23,32768,"Yuric Pic (PD) [C]"},
{0xfdb9c5e4,131072,"Ziarno Prawdy - Book by Andrzej Sapkowski (Polish) (PD) [C]"},
{0x03ab6883,131072,"JetPak DX (Bung) (PD) [C][a1][t1]"},
{0x2185de0c,131072,"JetPak DX (Bung) (PD) [C][a1][t2]"},
{0x22186513,262144,"Berlin 50 Levels Playable Preview (PD) [C]"},
{0xf9980176,524288,"Demotronic Final Demo (PD) [C]"},
{0x809b0950,32768,"Doctor GB Menu (PD) [C][a3]"},
{0x03fc3d03,262144,"Elemental Fighter By SkyRank Games (PD) [C]"},
{0x4971c561,65536,"Everyone is an Artist by J. Beuys (PD) [C]"},
{0x99c00a2b,65536,"Friki Race (Bung) (PD) [C][a2]"},
{0xeb37a319,32768,"Frox by Flavour (PD) [C][a1]"},
{0x772e11e8,32768,"FX Hammer Editor v11 by Aleksi Eeben (PD) [C]"},
{0xc72c1c79,32768,"Galaxia (PD) [C]"},
{0x93188935,131072,"Gameboy Book Reader V3.3 (PD) [C]"},
{0xf0acc0b7,131072,"Gameboy Book Reader V4.0 (PD) [C]"},
{0x1b1a7131,131072,"Gameboy Book Reader V4.3 (PD) [C]"},
{0xa72dc76b,65536,"GB Remote (PD) [C][a1]"},
{0x0cdfb20d,1048576,"GBC Intro Collection 2 (PD) [C]"},
{0x751b9626,32768,"GBCam (PD) [C]"},
{0xe1983dfd,262144,"Gear Effect By SkyRank Games (PD) [C]"},
{0x33d12baf,65536,"Grayscale Moving Heart Demo (PD) [C]"},
{0xe768857b,65536,"Grazyna by Adam Mickiewicz (Polish) (PD) [C]"},
{0x3c50d29f,32768,"Gridull Demo (PD) [C]"},
{0x1eee2569,65536,"HiColor Anime Pic (PD) [C]"},
{0xd39f4de0,32768,"HiColor Hiro Pic (PD) [C]"},
{0x22699627,262144,"Horrible Demon IV, The Beta 0.1 (PD) [C]"},
{0xc740b2eb,262144,"Horrible Demon IV, The Beta 0.1 (PD) [C][a1]"},
{0x2be91413,32768,"ISO Blast Demo (PD) [C]"},
{0x3aef87c7,524288,"Kodeks drogowy by Sejm III RP (Polish) (PD) [C]"},
{0xde476e57,131072,"Konrad Wallenrod by Adam Mickiewicz (Polish) (PD) [C]"},
{0xf9b0552d,1048576,"Korsarz z Saint-Malo by Claude Farree (Polish) (PD) [C]"},
{0x8d9bbaed,524288,"Kostnica by Graham Masterton (Polish) (PD) [C]"},
{0x6ca95d9b,524288,"Krolewicz i Zebrak by Mark Twain (Polish) (PD) [C]"},
{0x5e2fae49,131072,"LAWSON Loppi NP Menu (PD) [C]"},
{0x8019c6f5,262144,"LAWSON Loppi PMA 1 (PD) [C]"},
{0x9c932f0d,262144,"LAWSON Loppi PMA 3 (PD) [C]"},
{0xac77c6bb,262144,"LAWSON Loppi PMB 3 (PD) [C]"},
{0xfe020203,131345,"Little Sound Dj V1.00 Demo by Johan Kotlinski (PD) [C]"},
{0x0994fbef,524288,"Little Sound Dj V1.41b Player by Johan Kotlinski (PD) [C]"},
{0x537e80cd,32768,"MacGB Demo by DarkFader (PD) [C]"},
{0xe1addc57,524288,"Magiczne przygody Kubusia Puchatka (Polish) (PD) [C][a1]"},
{0xcf6ddedd,131072,"Medaliony by Zofia Nalkowska (Polish) (PD) [C]"},
{0xa5407b6c,131072,"Moralnosc pani Dulskiej by Gabriela Zapolska (Polish) (PD) [C]"},
{0x0126640c,65536,"Mouse Game (PD) [C]"},
{0xd6325bae,32768,"MPlay - PlayTest (PD) [C]"},
{0xfc090c02,32768,"MPlay - Puzzled (PD) [C]"},
{0xa687d05b,32768,"MPlay - Test01 (PD) [C]"},
{0x00881ef7,32768,"MPlay - Test02 (PD) [C]"},
{0x40e019d1,32768,"MPlay 2 Demo - Bugs (PD) [C]"},
{0x97c8b491,32768,"MPlay 2 Demo - Calypso Bar (PD) [C]"},
{0x0fa9dfc6,32768,"MPlay 2 Demo - China Nostalgia (PD) [C]"},
{0x14656b98,32768,"MPlay 2 Demo - Easy Driving (PD) [C]"},
{0xafd6430f,32768,"MPlay 2 Demo - Funky Test (PD) [C]"},
{0xdb779192,32768,"MPlay 2 Demo - Funny (PD) [C]"},
{0xb3b88c0b,32768,"MPlay 2 Demo - Girl (PD) [C]"},
{0x394143e8,32768,"MPlay 2 Demo - Gumby Boy (PD) [C]"},
{0x3c96388b,32768,"MPlay 2 Demo - Hard Day's Night, A (PD) [C]"},
{0xb64caf3d,32768,"MPlay 2 Demo - Level32 (PD) [C]"},
{0xc1d7c976,32768,"MPlay 2 Demo - Lost Dance (PD) [C]"},
{0xe0d79c84,32768,"MPlay 2 Demo - Room Service (PD) [C]"},
{0x1e741c2d,32768,"MPlay 2 Demo - Showroom Music (PD) [C]"},
{0x57764d8e,32768,"MPlay 2 Demo - Silly Song (PD) [C]"},
{0x996331d6,32768,"MPlay 2 Demo - Spookville (PD) [C]"},
{0x0dc14763,32768,"MPlay 2 Demo - Tango Thud (PD) [C]"},
{0x97071714,32768,"MPlay 2 Demo - Thing (PD) [C]"},
{0x699018d4,32768,"MPlay 2 Demo - Yar's Revenge (PD) [C][a1]"},
{0x393d8aeb,2097152,"Nad Niemnem by Eliza Orzeszkowa (Polish) (PD) [C]"},
{0x43e70163,131072,"Natsu Kanon Demo (PD) [C]"},
{0xd3b1e2e8,32768,"Netbox IR Keyboard by DarkFader (PD) [C]"},
{0x15b90432,524288,"Nie-Boska komedia by Zygmunt Krasinski (Polish) (PD) [C]"},
{0xceb32ab4,1048576,"Ogniem i Mieczem tom II Powiesc by Henryka Sienkiewicza (PD) [C]"},
{0xd98182c4,32768,"Open Source Pokemon Game, The Demo Release V0.1 (PD) [C]"},
{0x66134343,2097152,"Open Source Pokemon Game, The Demo Release V0.1.1 (PD) [C]"},
{0x67576288,1048576,"Pan Samochodzik 5 - Nowe Przygody Pana Samochodzika (PD) [C]"},
{0x952b0028,262144,"PaZeek By SkyRank Games (PD) [C]"},
{0x1a31f8c4,32768,"Pdroms.com Re-Opening Demo (PD) [C]"},
{0x2f264126,262144,"Pickpocket by iNKA and Psychad (Party Version) (PD) [C]"},
{0xf65c7c61,262144,"Pickpocket by iNKA and Psychad (PD) [C]"},
{0x7d4a8de7,262144,"Pierscien i roza by William Mekepeace Thackeray (Polish) (PD) [C]"},
{0x4fab2df0,524288,"Piesn o Rolandzie (Polish) (PD) [C]"},
{0xca39d902,524288,"Pietnastoletni Kapitan by Jules Verne (Polish) (PD) [C]"},
{0xfde35ffa,524288,"Podroze Pana Kleksa by Jan Brzechwa (Polish) (PD) [C]"},
{0xa67eff34,524288,"Popioly tom 1 by Stefan Zeromski (Polish) (PD) [C]"},
{0xd277e738,1048576,"Popioly tom 2 by Stefan Zeromski (Polish) (PD) [C]"},
{0xa81604f2,1048576,"Popioly tom 3 by Stefan Zeromski (Polish) (PD) [C]"},
{0xbda9b40b,1048576,"Potop tom 1 by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x8d9d38a9,2097152,"Potop tom 2 by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x6e455e13,1048576,"Potop tom 3 by Henryk Sienkiewicz (Polish) (PD) [C]"},
{0x29f47c95,1048576,"Powrot krola by J.R.R. Tolkien (Polish) (PD) [C]"},
{0x9a5a8e6a,32768,"Predetor Pic (PD) [C]"},
{0x2881b79b,32768,"Project F-19 Stealth (PD) [C]"},
{0x57b060e2,524288,"Przygody Piotrusia Pana by James Matthew Barrie (Polish) (PD) [C]"},
{0x9d5135f1,262144,"RPG Intro (PD) [C]"},
{0x4400496d,131072,"Rumble & Tumble By SkyRank Games (PD) [C]"},
{0x333855e1,32768,"Rumble Test by DarkFader (PD) [C]"},
{0x9ff8a690,65536,"Scroll Test Dungeon (PD) [C]"},
{0xb465c309,65536,"Scroll Test Garden (PD) [C]"},
{0x80579771,524288,"Shawshank Redemption, The by Stephan King (Polish) (PD) [C]"},
{0x62e6b647,65536,"SimBurgerKing Alpha 1 by Joshua Wise (PD) [C]"},
{0x0ea362ed,114688,"SimBurgerKing Alpha 2 by Joshua Wise (PD) [C]"},
{0x8e13269f,32768,"Sinewave Using All Available Tiles by Darkfader (PD) [C]"},
{0x997c2cd0,524288,"Sklepy cynamonowe by Bruno Schulz (Polish) (PD) [C]"},
{0xb245ff36,262144,"Sluby panienskie by Aleksander Fredro (Polish) (PD) [C]"},
{0xa32af3b9,65536,"Snoopy Puzzle (PD) [C]"},
{0xac56a2e0,1048576,"Stara basn by Jozef Ignacy Kraszewski (Polish) (PD) [C]"},
{0xc75b4c44,32768,"Subport Logo by Titney (PD) [C]"},
{0xef9cf4e1,32768,"Titantic 2000 Demo (PD) [C]"},
{0x28f23b56,131072,"Top Shelf Challenge (PD) [C]"},
{0xfca46d8d,524288,"Tryumf Pana Kleksa by Jan Brzechwa (Polish) (PD) [C]"},
{0xa4af78ea,32768,"Vertical Split Screen Test by DarkFader (PD) [C]"},
{0x213a6337,32768,"Walking Man (PD) [C]"},
{0x16fad54e,524288,"War Of The Worlds, The by H.G. Wells (V3.1) (PD) [C]"},
{0x2a1fc052,32768,"Watch Demo for GBC (PD) [C]"},
{0x404ab20f,32768,"Where's the Chip-Hop by Oyd11 (PD) [C]"},
{0x19c15e87,524288,"Wierna rzeka by Stefan Zeromski (Polish) (PD) [C]"},
{0xb5066d33,2097152,"Winnetou by Karol May (Polish) (PD) [C]"},
{0x29b66194,32768,"Work Master BIOS 2.2 (PD) [C]"},
{0xb1c349d5,32768,"Work Master BIOS 2.2R (PD) [C]"},
{0xe7ea920c,1048576,"Ziemia obiecana tom 1 by Wladyslaw Stanislaw Reymont (Polish) (PD) [C]"},
{0x78cd5c6b,1048576,"Ziemia obiecana tom 2 by Wladyslaw Stanislaw Reymont (Polish) (PD) [C]"},
{0x377fd091,65536,"16 Threads Demo by DarkFader (PD) [C]"},
{0xefe02c57,32768,"3D Red Rotating Cube by DarkFader (PD) [C]"},
{0xdece8739,32768,"40x18 Text Demo (Flickering) by DarkFader (PD) [C]"},
{0x78883874,32768,"40x24 Text Demo by DarkFader (PD) [C][a1]"},
{0x9c92f372,262144,"AIR Pocket Demo (PD) [C]"},
{0x632bbc71,262144,"AIR Pocket Sound (PD) [C]"},
{0x9bfeb3f3,524288,"Akademia Pana Kleksa by Jan Brzechwa (Polish) (PD) [C]"},
{0xc2dc4d96,32768,"Akino Hitoshi Demo (PD) [C]"},
{0x0bdb010d,65536,"Alien Planet (PD) [C][a1]"},
{0x43dc8a4a,131072,"Ballgame DX Demo (Oxyd clone) (PD) [C]"},
{0x1bf91884,2097152,"AIR Pocket OP Demo (PD) [C]"},
{0x5c10cbe5,1048576,"Ben Hur (Polish) (PD) [C]"},
{0xd931dc93,1048576,"Bible, The - Old Testament Books 09-18 (Polish) (PD) [C]"},
{0x8adcb56d,1048576,"Bible, The - Old Testament Books 19-23 (Polish) (PD) [C]"},
{0xd7cb1539,1048576,"Bible, The - Old Testament Books 24-39 (Polish) (PD) [C]"},
{0x1e67c48f,32768,"Boulder Dash DX by DarkFader (PD) [C]"},
{0x22835ce5,32768,"Britany Spears - Shammock by Titney (PD) [C]"},
{0x76bd47d7,32768,"Britany Spears Graphics by Titney (PD) [C]"},
{0x49349a65,32768,"Britany Spears Sitting by Titney (PD) [C]"},
{0x949eab23,32768,"Britany Spears Sultry by Titney (PD) [C]"},
{0xf5e32d4d,524288,"Carmen (Polish) (PD) [C]"},
{0x39ae76d9,32768,"CNCD Alt'02 Demo (PD) [C]"},
{0x63984872,524288,"Chlopi tom 1 by Chlopi Wladyslaw Stanislaw Reymont (PD) [C]"},
{0x33cc501a,524288,"Chlopi tom 2 by Chlopi Wladyslaw Stanislaw Reymont (PD) [C]"},
{0x00cd53f5,1048576,"Chlopi tom 3 by Chlopi Wladyslaw Stanislaw Reymont (PD) [C]"},
{0x2d6790a2,524288,"Chlopi tom 4 by Chlopi Wladyslaw Stanislaw Reymont (PD) [C]"},
{0xe9f5ea83,1048576,"Bible, The - Old Testament Books 01-08 (Polish) (PD) [C]"},
{0xb7e6c04e,131072,"Cud mniemany, czyli Krakowiacy i Gorale by Wojciech Boguslawski (Polish) (PD) [C]"},
{0x3d05bc36,1048576,"Don Quixote by Miguel Cervantes (Polish) (PD) [C]"},
{0xad00134b,2097152,"Druzyna pierscienia by J.R.R. Tolkien (Polish) (PD) [C]"},
{0x9a90c3c6,2097152,"Dwie wieze by J.R.R. Tolkien (Polish) (PD) [C]"},
{0x3bcb8a08,1048576,"Hamlet, King Lear, MacBeth, Othello, Romeo & Juliet (Polish) (PD) [C]"},
{0xa30ad68d,262144,"LAWSON Loppi PMA 2 (PD) [C]"},
{0xf25e5801,524288,"M5 Movie (PD) [C]"},
{0x7795b43b,262144,"LAWSON Loppi PMB 1 (PD) [C]"},
{0xa4b8d805,262144,"LAWSON Loppi PMB 2 (PD) [C]"},
{0xa24272cc,524288,"Little Sound Dj V1.40 Player by Johan Kotlinski (PD) [C]"},
{0xd31fb4a0,524288,"Little Sound Dj V1.43 Demo by Johan Kotlinski (PD) [C]"},
{0x1c9afdd4,524288,"Little Sound Dj V1.51b Player by Johan Kotlinski (PD) [C]"},
{0xa45f4f83,1048576,"Mistrz i Malgorzata by Michail Bulhakow (Polish) (PD) [C]"},
{0xb3f36d9d,1048576,"Nana by Emil Zola (Polish) (PD) [C]"},
{0xb87c881a,1048576,"Nedznicy tom 1 by Victor Hugo (Polish) (PD) [C]"},
{0x660dcc98,2097152,"Nedznicy tom 2 by Victor Hugo (Polish) (PD) [C]"},
{0xf0817ce4,1048576,"Ogniem i Mieczem tom I Powiesc by Henryka Sienkiewicza (PD) [C]"},
{0x7fcdf6a6,262144,"Pan Jowialski by Aleksander Fredro (Polish) (PD) [C]"},
{0xddeca6fa,524288,"Uncle Tom's Cabin by Harriet Beecher Stowe (Polish) (PD) [C]"},
{0x971fc9a0,1048576,"1942 (U) [C][t1]"},
{0xf0c5145d,1048576,"Action Man (U) [C][t1]"},
{0x0c6a7f43,1048576,"Action Man (U) [C][t2]"},
{0x26e83563,1048576,"Adventures of the Smurfs, The (M6) (E) [C][t1]"},
{0xbd3f0283,1048576,"Air Force Delta (U) [C][t1]"},
{0xc4930980,1048576,"Alfred's Adventure (E) (M5) [C][t1]"},
{0xc5604091,524288,"Antz (E) (M6) [C][t1]"},
{0x5afb5ff7,1048576,"Army Men (U) [C][t1]"},
{0x0aca1a27,1048576,"Asterix - Search for Dogmatix (E) (M6) [C][t1]"},
{0x8620f590,1048576,"Babe and Friends (U) [C][t1]"},
{0x6b5eebbf,524288,"Ballistic (U) [C][t1]"},
{0x8ca09928,1048576,"Batman - Chaos in Gotham (E) (M6) [C][t1]"},
{0x04489b6e,1048576,"Batman Beyond - Return of the Joker (U) [C][t1]"},
{0xc81aa335,1048576,"Battle Tanx (U) [C][t1]"},
{0xd05db7c8,2097152,"Bionic Commando - Elite Forces (U) [C][t1]"},
{0xf841422b,262144,"Blades of Steel (U) [C][t1]"},
{0xf979bf5f,2097152,"Bomberman Max - Blue Champion (U) [C][t1]"},
{0xfde24060,2097152,"Bomberman Max - Hero of Light (J) [C][t1]"},
{0xc0f08210,2097152,"Bomberman Max - Red Challenger (U) [C][t1]"},
{0x15673e18,2097152,"Bomberman Max - Shadow of Darkness (J) [C][t1]"},
{0xd34c537a,1048576,"Bubble Bobble (E) [C][t1]"},
{0x490ae005,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][t1]"},
{0xfdc1483a,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][t2]"},
{0xaa61915c,1048576,"Bugs Bunny - Crazy Castle 3 (J) [C][t3]"},
{0xae098af9,1048576,"Bugs Bunny - Crazy Castle 3 (U) [C][t1]"},
{0x6248673c,1048576,"Bugs Bunny - Crazy Castle 4 (E) [C][t1]"},
{0x9dd780a3,1048576,"Bugs Bunny - Crazy Castle 4 (J) [C][t1]"},
{0xd751102f,524288,"Bugs Bunny - Operation Carrots (E) (M6) [C][t1]"},
{0x5d25439b,1048576,"Bug's Life, A (E) [C][t1]"},
{0x5a2e6978,1048576,"Bug's Life, A (U) [C][t1]"},
{0x341f41c7,262144,"Burai Fighter (J) [C][t1]"},
{0x4fb49efc,524288,"Bust-a-Move 4 (UE) [C][t1]"},
{0x4e27d0fd,524288,"Buzz Lightyear of Star Command (U) [C][t1]"},
{0x12482228,4194304,"Cannon Fodder (E) (M5) [C][t1]"},
{0x956345bf,1048576,"Catwoman (E) [C][t1]"},
{0x490ed039,1048576,"Chase HQ - Secret Police (U) [C][t1]"},
{0x67b3e04e,1048576,"Chicken Run (U) (M5) [C][t1]"},
{0x09aeebc2,1048576,"Commander Keen (U) [C][t1]"},
{0x28fbedd8,1048576,"Commander Keen (U) [C][t2]"},
{0x9481ddb2,2097152,"Conker's Pocket Tales (U) (M3) [C][t1]"},
{0x4d1dc2ba,1048576,"Croc (UE) [C][t1]"},
{0xcc700170,1048576,"Croc 2 (U) [C][t1]"},
{0x1163e6f7,1048576,"Croc 2 (U) [C][t2]"},
{0x742ef649,1048576,"Daffy Duck - Fowl Play (U) [C][t1]"},
{0x60b52abd,1048576,"Dexter's Laboratory - Robot Rampage (U) [C][t1]"},
{0x57ece087,1048576,"Die Maus (E) (M4) [C][t1]"},
{0xf826ed3d,524288,"Die Maus (E) (M4) [C][t2]"},
{0x5f42b08f,1048576,"Die Original Moorhuhn Jagd (G) [C][t1]"},
{0xc75dec33,4194304,"Donald Duck (E) (M5) [C][t1]"},
{0x58870880,4194304,"Donkey Kong Country (Mag Demo) (UE) (M5) [C][t1]"},
{0x041815ab,4194304,"Donkey Kong Country (UE) (M5) [C][t1]"},
{0x5c61a104,1048576,"Donkey Kong GB - Dinky Kong and Dixie Kong (J) [C][t1]"},
{0x8cb25d16,1048576,"Doraemon Walking Labyrinth (J) [C][t1]"},
{0x0f4e4d4a,4194304,"Dragon's Lair (U) (M6) [C][t1]"},
{0x6c5f3220,1048576,"Driver - You Are The Wheelman (U) (M5) [C][t1]"},
{0x61841a19,262144,"Dropzone (U) [C][t1]"},
{0xd678aead,131072,"Dropzone (U) [C][t1][b1]"},
{0xf3ef4486,1048576,"Duke Nukem (E) (M5) [C][t1]"},
{0x6c55b6dd,1048576,"Earthworm Jim - Menace 2 the Galaxy (U) [C][t1]"},
{0xfb311a03,1048576,"Elevator Action EX (E) (M5) [C][t1]"},
{0x037e39ab,1048576,"Elevator Action EX (J) [C][t1]"},
{0x7d21cb40,262144,"Elmo in Grouchland (U) [C][t1]"},
{0x08c70e71,2097152,"Emperor's New Groove, The (U) [C][t1]"},
{0x0d55e1a8,2097152,"Evel Knievel (E) (M7) [C][t1]"},
{0x603a8bb8,1048576,"Fix & Foxi (E) (M3) [C][t1]"},
{0x54a1c5ac,1048576,"Flintstones, The - Burgertime in Bedrock (E) (M6) [C][t1]"},
{0x74130987,1048576,"Flintstones, The - Burgertime in Bedrock (E) (M6) [C][t1][b1]"},
{0x041eaf27,1048576,"Flipper & Lopaka (E) (M10) [C][t1]"},
{0x6c8672c8,131072,"Frogger (U) [C][t1]"},
{0x8818f73a,1048576,"Frogger 2 (U) [C][t1]"},
{0xe1fda06b,1048576,"Front Line - The Next Mission (J) [C][t1]"},
{0xb7ee72d4,1048576,"Game & Watch Gallery 3 (U) [C][t1]"},
{0xfa8e84de,1048576,"Gameboy Gallery 3 (J) [C][t1]"},
{0x29e3089b,1048576,"Gameboy Gallery 3 (U) [C][t1]"},
{0xf54e2de8,1048576,"Ganbare Goemon - Hoshizorashi Dynamites Arawaru!! (J) [C][t1]"},
{0x7a7564b1,1048576,"Gex - Enter the Gecko (U) [C][t1]"},
{0xd2d596fa,2097152,"Gex 3 - Deep Pocket Gecko (U) [C][t1]"},
{0xfad0d74a,524288,"Ghosts 'N Goblins (U) [C][t1]"},
{0x83929792,1048576,"Gift (E) [C][t1]"},
{0x3a0ee34a,1048576,"Gift (E) [C][t2]"},
{0x8b9d7dae,1048576,"Godzilla - The Series (E) (M3) [C][t1]"},
{0xc2eb3a0b,1048576,"Gold and Glory - The Road to El Dorado (U) [C][t1]"},
{0x8a9ed3fa,1048576,"Gold and Glory - The Road to El Dorado (U) [C][t2]"},
{0x89711982,4194304,"Grand Theft Auto (E) (M5) [C][t1]"},
{0x4d0b8b60,1048576,"Grinch, The (E) (M3) [C][t1]"},
{0x8e786bd4,1048576,"Grinch, The (U) [C][t1]"},
{0x1e2ed3d4,1048576,"Halloween Racer (E) (M6) [C][t1]"},
{0xaa7cd2c4,262144,"Hexcite (U) [C][t1]"},
{0x2988a075,131072,"Highway Racing, The (J) [C][t1]"},
{0x02377081,1048576,"Hollywood Pinball (UE) (M4) [C][t1]"},
{0x609e3045,524288,"Holy Magic Century (E) (M3) [C][t1]"},
{0xe7154078,262144,"Hugo 2.5 (G) [C][t1]"},
{0x8b6b8a52,1048576,"Indiana Jones and the Infernal Machine (U) [C][t1]"},
{0x0a667d73,1048576,"Inspector Gadget (E) (M6) [C][t1]"},
{0x5ecacff9,1048576,"Jeff Gordon XS Racing (U) [C][t1]"},
{0xf1a9a747,2097152,"Jim Henson's Muppets (E) (M7) [C][t1]"},
{0x7e5d13dc,2097152,"Jim Henson's Muppets (U) [C][t1]"},
{0x4bd67664,1048576,"Joust & Defender (U) [C][t1]"},
{0x93d61d06,4194304,"Jungle Book, The - Mowgli's Wild Adventure (U) (M5) [C][t1]"},
{0x1a7933cd,1048576,"Kaept'n Blaubaer - Die verrueckte Schatzsuche (G) [C][t1]"},
{0x2849ec29,1048576,"Kaept'n Blaubaer - Die verrueckte Schatzsuche (G) [C][t2]"},
{0xfbd9ae6a,1048576,"Kaept'n Blaubaer - Die verrueckte Schatzsuche (G) [C][t3]"},
{0xfff15e39,262144,"Karate Joe (E) [C][t1]"},
{0xd555d0ee,1048576,"Klax (U) [C][t1]"},
{0xa41857c1,1048576,"Klax (U) [C][t1][b1]"},
{0xd49fdf05,1048576,"Klax (U) [C][t2]"},
{0x047b7ae1,1048576,"Konami GB Collection Volume 1 (E) [C][t1]"},
{0x98f81c22,1048576,"Konami GB Collection Volume 2 (E) [C][t1]"},
{0x30588202,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][t1]"},
{0xf5b0ed65,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][t2]"},
{0xc2b89e2e,1048576,"Lion King, The - Simba's Mighty Adventure (U) [C][t1]"},
{0x61e35773,524288,"Little Magic (J) [C][t1]"},
{0xcbd4cf5f,131072,"Logical (U) (Sunsoft) [C][t1]"},
{0xab05be47,131072,"Logical (U) (THQ) [C][t1]"},
{0xbe4a3f33,1048576,"Looney Tunes (U) [C][t1]"},
{0xabd1d59d,1048576,"Lucky Luke - Desperado Train (E) (M6) [C][t1]"},
{0xa2f16b80,524288,"Lucky Luke (E) (M4) [C][t1]"},
{0x1fd73f4c,1048576,"M&M's Minis Madness (U) [C][t1]"},
{0x4ac94a23,1048576,"Marble Madness (U) [C][t1]"},
{0x3ac1fbc6,2097152,"Mario Golf (J) [C][t1]"},
{0x9da5915e,1048576,"Mary-Kate & Ashley - Get a Clue (U) [C][t1]"},
{0xd0d1e12e,1048576,"Mask of Zorro, The (U) [C][t1]"},
{0x7d29f5d3,524288,"Maya the Bee and Her Friends (E) (M3) [C][t1]"},
{0x7b48c9cc,1048576,"Mega Man Xtreme (U) [C][t1]"},
{0x8f354f24,1048576,"Men In Black 2 (U) (M3) [C][t1]"},
{0xee5140c2,1048576,"Merlin (E) (M6) [C][t1]"},
{0x5ca5506a,1048576,"Meta Fight (J) [C][t1]"},
{0xcd265c1f,524288,"Missile Command (U) [C][t1]"},
{0x9531ed78,524288,"Mission Impossible (E) (M5) [C][t1]"},
{0xb2ef233d,1048576,"Monster Rancher Explorer (U) [C][t1]"},
{0x279847c1,524288,"Montezuma's Return (U) (M2) [C][t1]"},
{0x84ac58d9,524288,"Montezuma's Return (E) (M5) [C][t1]"},
{0xb8f1ce20,1048576,"Moon Patrol & Spy Hunter (U) [C][t1]"},
{0xffeeb24f,1048576,"Moon Patrol & Spy Hunter (U) [C][t2]"},
{0x3033ff1f,1048576,"Motocross Maniacs 2 (U) [C][t1]"},
{0xe39b1d11,1048576,"Mr. Driller (E) (M5) [C][t1]"},
{0x6edd524c,1048576,"Mr. Driller (J) [C][t1]"},
{0x63d5a88b,1048576,"Mr. Nutz (E) (M6) [C][t1]"},
{0x98be20bb,1048576,"Mr. Nutz (E) (M6) [C][t2]"},
{0x134d1f96,524288,"Ms. Pac-Man & Pac-Man SCE (U) (Namco) [C][t1]"},
{0x71415564,1048576,"NASCAR Racers (U) [C][t1]"},
{0x90f4e61b,1048576,"New Adventures of Mary-Kate and Ashley, The (U) [C][t1]"},
{0xd709cd38,1048576,"Obelix (E) (M4) [C][t1]"},
{0xda048ae3,1048576,"Obelix (E) (M4) [C][t1][BF]"},
{0x8b8385df,262144,"Ohasta Yamachan & Reimondo (J) [C][t1]"},
{0xbeb4db56,1048576,"Ottifanten - Kommando Stoertebecker (G) [C][t1]"},
{0x605214ef,1048576,"Ottifanten - Kommando Stoertebecker (G) [C][t1][b1]"},
{0x85b99dc4,262144,"Pac-Man & Pac-Attack SCE (U) (Namco) [C][t1]"},
{0x091a480a,262144,"Pac-Man & Pac-Attack SCE (U) (Namco) [C][t2]"},
{0x37a3a579,262144,"Pac-Man & Pac-Attack SCE (U) (Namco) [C][t3]"},
{0x23d2c5c6,262144,"Painter (E) [C][t1]"},
{0x1df58d30,1048576,"Paperboy (U) [C][t1]"},
{0x2f951e91,1048576,"Papyrus (E) (M6) [C][t1]"},
{0x76ab2993,524288,"Pitfall - Beyond the Jungle (U) [C][t1]"},
{0x52960140,1048576,"Pitfall - Beyond the Jungle (U) [C][t2]"},
{0x6ef43f1c,524288,"Pocket Bomberman (U) [C][t1]"},
{0x014b40ce,1048576,"Pocket Bomberman (U) [C][t2]"},
{0x6967c49f,131072,"Pocket Color Block (J) [C][t1]"},
{0x8aee382a,131072,"Pocket Color Block (J) [C][t2]"},
{0xdb1509da,131072,"Pocket Color Block (J) [C][t3]"},
{0x372e4242,1048576,"Pocket Monsters Pinball (J) [C][t1]"},
{0x29122b5d,1048576,"Pocket Monsters Pinball (J) [C][t2]"},
{0x488fe0da,1048576,"Pocket Monsters Pinball (J) [C][t3]"},
{0x458d4765,1048576,"Pokemon Gelb (Yellow) (Trainer by Filb) (G) [C][t1]"},
{0x86232c62,1048576,"Pokemon Gelb (Yellow) (Trainer V1.6 by Filb) (G) [C][t1]"},
{0x80bdcaec,1048576,"Pokemon Pinball (U) [C][t1]"},
{0x78e2ff9c,1048576,"Pokemon Pinball (U) [C][t2]"},
{0x4f44840e,1048576,"Polaris SnoCross (U) [C][t1]"},
{0xee25fe8b,2097152,"Powerpuff Girls, The - Bad Mojo Jojo (U) [C][t1]"},
{0xb8961fe4,2097152,"Powerpuff Girls, The - Battle Him (U) [C][t1]"},
{0x1b07d84f,2097152,"Powerpuff Girls, The - Battle Him (U) [C][t2]"},
{0x6e2348e6,524288,"Prince of Persia (E) (M5) [C][t1]"},
{0xd95aedf8,524288,"Prince of Persia (E) (M5) [C][t2]"},
{0xcb3fd64d,524288,"Prince of Persia (E) (M5) [C][t3]"},
{0x6c5ebc4c,524288,"Project S-11 (U) [C][t1]"},
{0xd69952f7,1048576,"Puzzled (E) (M3) [C][t1]"},
{0xb707c473,1048576,"Qix Adventure (J) [C][t1]"},
{0xfc02b771,524288,"Quest - Fantasy Challenge (U) [C][t1]"},
{0xbb145171,524288,"Rats! (UE) (M2) [C][t1]"},
{0x87bd2419,4194304,"Rayman (E) [C][t1]"},
{0xae2ca38e,4194304,"Rayman (U) [C][t1]"},
{0xaef08e25,524288,"Reservoir Rats (E) (M5) [C][t1]"},
{0x176e1b37,1048576,"Rhino Rumble (U) [C][t1]"},
{0xc592d35d,131072,"Roadsters '98 (U) [C][t1]"},
{0xe95743d9,1048576,"Robin Hood (E) (M6) [C][t1]"},
{0x8cf71992,1048576,"Robin Hood (E) (M6) [C][t2]"},
{0x0b2b40d1,1048576,"Robocop (U) (M6) [C][t1]"},
{0x02bedec2,262144,"Rox (J) [C][t1]"},
{0xd38a8f12,1048576,"R-Type DX (U) [C][t1]"},
{0xec69c663,1048576,"R-Type DX (U) [C][t2]"},
{0x382ad2b3,1048576,"Rugrats - Time Travelers (U) [C][t1]"},
{0x27f304b1,1048576,"Rugrats Movie, The (U) [C][t1]"},
{0xfd2f06d5,2097152,"Sabrina - The Animated Series - Zapped! (U) [C][t1]"},
{0x354e3581,2097152,"Sabrina - The Animated Series - Zapped! (U) [C][t2]"},
{0x76a4c206,1048576,"SD Hiryu Ex (J) [C][t1]"},
{0xcafe030b,1048576,"Sgt. Rock - On The Front Line (U) [C][t1]"},
{0x9838f871,1048576,"Shamus (U) [C][t1]"},
{0x77557b6f,2097152,"Shrek Fairy Tale Freakdown (U) (M6) [C][t1]"},
{0x711d581a,1048576,"Simpsons, The - Night of the Living Treehouse of Horror (U) [C][t1]"},
{0xdf4ede58,262144,"Smurfs Nightmare, The (E) (M4) [C][t1]"},
{0xcfcf73f6,1048576,"Smurfs Nightmare, The (E) (M4) [C][t2]"},
{0x380897a5,1048576,"Space Invaders (U) [C][t1]"},
{0xf5a14631,262144,"Space Invaders (U) [C][t1][h1]"},
{0x96e794fc,1048576,"Space Invaders X (J) [C][t1]"},
{0x6676d766,131072,"Space Invasion (Rocket Games) (E) [C][t1]"},
{0x49e345cd,2097152,"Space Station Silicon Valley (E) (M7) [C][t1]"},
{0x518754ac,2097152,"Spawn (U) [C][t1]"},
{0x0bcea97d,2097152,"Spawn (U) [C][t1][BF]"},
{0x84514686,1048576,"Speedy Gonzales - Aztec Adventure (U) [C][t1]"},
{0xc17a6300,1048576,"Spider-Man (U) [C][t1]"},
{0xdee4f003,1048576,"Spirou La Panque Mecanique (E) (M7) [C][t1]"},
{0x4f4c1727,1048576,"Spy vs Spy (U) [C][t1]"},
{0x562bea64,1048576,"Star Wars Episode 1 - Obi-Wan's Adventures (E) (M5) [C][t1]"},
{0xf1f2a994,1048576,"Star Wars Episode 1 - Obi-Wan's Adventures (U) [C][t1]"},
{0xddc4aeac,2097152,"Star Wars Episode I Racer (UE) [C][t1]"},
{0xddafecee,1048576,"Street Fighter Alpha (E) [C][t1]"},
{0xf218d8f9,131072,"Super Breakout! (U) [C][t1]"},
{0xb03b01f0,1048576,"Super Mario Bros. DX (V1.0) (U) [C][t1]"},
{0x7de247e3,1048576,"Super Mario Bros. DX (V1.0) (U) [C][t2]"},
{0x7eeec30b,2097152,"Super Robot Pinball (J) [C][t1]"},
{0xa4bd4355,1048576,"Survival Kids (U) [C][t1]"},
{0x22a44173,1048576,"SWiNG (G) [C][t1]"},
{0xb808e8e5,1048576,"SWIV (E) (M5) [C][t1]"},
{0x8e63c8d5,2097152,"Tarzan (U) [C][t1]"},
{0x13236def,1048576,"Taxi 2 (F) [C][t1]"},
{0xebfebbda,1048576,"Tazmanian Devil - Munching Madness (E) (M5) [C][t1]"},
{0xe9add057,1048576,"Tazmanian Devil - Munching Madness (U) (M5) [C][t1]"},
{0x75a72120,262144,"Thunder Blast Man (J) [C][t1]"},
{0x6c8f17a9,1048576,"Titus the Fox (E) [C][t1]"},
{0xd9766dd9,1048576,"Tom & Jerry - Mouse Hunt (E) (M5) [C][t1]"},
{0xeb403878,524288,"Tom & Jerry (U) [C][t1]"},
{0x08d34ae6,2097152,"Tom & Jerry in Mouse Attacks! (E) (M7) [C][t1]"},
{0xd8370414,4194304,"Tomb Raider (UE) (M5) (Beta) [C][t1]"},
{0x9c669707,1048576,"Tonic Trouble (E) (M6) [C][t1]"},
{0xcb7f2bdf,1048576,"Tonka Raceway (E) [C][t1]"},
{0xc35be4d4,1048576,"Tonka Raceway (U) [C][t1]"},
{0xf8243df0,1048576,"Toobin' (U) [C][t1]"},
{0x93f75ff7,1048576,"Top Gear Pocket (U) [C][t1]"},
{0x1b031a95,1048576,"Top Gear Pocket 2 (J) (Kemco) [C][t1]"},
{0xc68ac950,1048576,"Top Gear Pocket 2 (U) (Vadical) [C][t1]"},
{0x0f0bca62,1048576,"Turok - Rage Wars (E) (M4) [C][t1]"},
{0xf73e58ad,1048576,"Turok 2 - Seeds of Evil (E) [C][t1]"},
{0x9c37f8da,1048576,"Tweety's Highflying Adventures (E) (M3) [C][t1]"},
{0x35bc8d18,524288,"Ultra 3D Pinball - Thrillride (U) [C][t1]"},
{0x2a1edd5f,1048576,"Vigilante 8 (U) [C][t1]"},
{0x8b8b36ff,1048576,"VIP (E) (M5) [C][t1]"},
{0x47d4a3db,524288,"V-Rally - Championship Edition (E) (M3) [C][t1][b1]"},
{0xcd9a6887,524288,"V-Rally - Championship Edition (E) (M4) [C][t1]"},
{0x36541c0f,4194304,"VS Lemmings (J) [C][t1]"},
{0x10703b05,1048576,"Wings of Fury (E) (M3) [C][t1]"},
{0x6978b1ee,524288,"Wings of Fury (U) [C][t1]"},
{0x988fd9b5,1048576,"Wings of Fury (U) [C][t2]"},
{0x2f78497b,1048576,"World Destruction League Thunder Tanks (U) [C][t1]"},
{0xbf7e169d,1048576,"Worms Armageddon (E) (M6) [C][t1]"},
{0x2018422a,1048576,"WWF Betrayal (U) [C][t1]"},
{0x392c2d33,1048576,"WWF Betrayal (U) [C][t1][b1]"},
{0xb5158d53,1048576,"X-Men - Mutant Wars (U) [C][t1]"},
{0x7f16b357,1048576,"Yar's Revenge - The Quotile Ultimatum (U) [C][t1]"},
{0xf54c8aea,1048576,"Yoda Stories (U) [C][t1]"},
{0xd4b8041a,1048576,"Zoboomafoo - Playtime In Zobooland (U) [C][t1]"},
{0x0a5a6830,1048576,"TinTin - Le Temple du Soleil (E) (M3) [C][t1][T-Polish_aRPi]"},
{0xb1a8ba45,1048576,"Kirikou (E) (M6) [C][t1]"},
{0xf49f6aad,1048576,"Adventures of Arle, The (J) [C][T-Eng0.1_DBTrans]"},
{0x12866706,1048576,"Adventures of Arle, The (J) [C][T-Eng1.0_Vida]"},
{0x3c2cdea0,1048576,"Batman Beyond - Return of The Joker (E) (M4) [C][T-Polish]"},
{0xe732e9c4,1048576,"Beast Wars (J) [C][T-Eng0.1]"},
{0x563774f9,2097152,"Bokujo Monogatari GB 2 (J) [C][T-Eng0.1]"},
{0x66df0ddd,4194304,"Donald Duck (E) (M5) [C][T-Polish_aRPi]"},
{0x86d3c2ad,1048576,"Driver - You Are The Wheelman (U) (M5) [C][T-Polish_aRPi]"},
{0xa72b9677,1048576,"Driver - You Are The Wheelman (U) (M5) [C][T-Polish1.1]"},
{0xdd4d1e78,1048576,"Gameboy Wars 2 (J) [C][T-Eng1]"},
{0xda9dd634,1048576,"Gameboy Wars 2 (J) [C][T-Eng2]"},
{0x3eaeeb02,1048576,"Gameboy Wars 2 (J) [C][T-Eng3]"},
{0x4065ae9e,1048576,"Hello Kitty Magical Museum (J) [C][T-Eng1.0_dokidoki]"},
{0xfbb4479b,1048576,"International Superstar Soccer 99 (U) [C][T-Port1.3_CBT]"},
{0x57cf3714,1048576,"International Superstar Soccer 99 (U) [C][T-Port1.3_CBT][a1]"},
{0x060861ad,1048576,"Legend of Zelda, The - Link's Awakening DX (U) [C][T-Port]"},
{0x3b82beef,1048576,"Legend of Zelda, The - Link's Awakening DX (U) [C][T-Spa]"},
{0x3262ffa4,1048576,"Legend of Zelda, The - Link's Awakening DX (U) [C][T-Spa][a1]"},
{0x069e5e61,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][T-Polish1]"},
{0xb5be8f00,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][T-Swedish0.3]"},
{0x64bccce8,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.1) (U) [C][T-Swedish0.3]"},
{0xf1ea3f69,1048576,"Little Magic (J) [C][T-Eng1.0_SGST]"},
{0xa1e0e54f,1048576,"Magical Chase (J) [C][T-Eng1.00_Gaijin Productions]"},
{0xbe2d6156,1048576,"Ottifanten - Kommando Stoertebecker (G) [C][T-Eng1.0_Matrix_Arcade_Divison]"},
{0xe7b6eea6,262144,"Pac-Man & Pac-Attack SCE (U) [C][T-Spa0.4_PaladinKnightsTrans]"},
{0x8fc9c42a,4194304,"Perfect Dark (U) (M5) [C][T-Polish]"},
{0xda775616,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng_Neo_Trans.]"},
{0x039080fc,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng0.1_M.C.P.C]"},
{0x951827ef,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng0.2_M.C.P.C]"},
{0xf0721425,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng0.3_M.C.P.C]"},
{0x0ef3a4a8,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng1.6_Team Trans.]"},
{0x601d644c,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng0.12_Kakkoii Translations]"},
{0xafb94110,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Spa0.4_GBT]"},
{0x74966dae,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.3_PR]"},
{0x254abd0e,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.4_PR]"},
{0x1052726a,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.8_PR]"},
{0xbb810d9f,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng_partial1]"},
{0x93247486,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng_partial2]"},
{0x471a2e84,1048579,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng_partial3]"},
{0xbc070d2a,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng_partial4]"},
{0xc14bcf98,2097152,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng_partial5]"},
{0xa059027d,1839395,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.0_Filb]"},
{0x26885111,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.35_PR]"},
{0x0578893e,1048578,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.6]"},
{0x2107b348,1048579,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.65_PR]"},
{0x04b2b943,1048579,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.8_PR]"},
{0x95f723b8,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.90_PR]"},
{0x9f867f08,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.91_PR]"},
{0x6d8decbd,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.92_PR]"},
{0xa4076056,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.94_PR]"},
{0x3a32754d,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.95_PR]"},
{0x48dafbdd,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.96_PR]"},
{0x30cac426,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.97_PR]"},
{0xf230b9e0,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng1.99_PR]"},
{0x670c289e,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng10%]"},
{0xbc4fc168,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.00_PR]"},
{0x8b159561,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.1_PR]"},
{0x0db4a2d4,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.15_PR]"},
{0xa291c854,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.2_PR]"},
{0x4d5a1d85,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.5_PR]"},
{0x47e13b6a,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.6_PR]"},
{0xa9eee750,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng2.70_PR]"},
{0xe8a93980,1048579,"Pocket Monsters Gold (V1.0) (J) [C][T-Eng25%_Chris]"},
{0x69ccbc6d,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Fre0.01]"},
{0xa093182d,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Ger]"},
{0x7195de64,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Port]"},
{0xbda95b4a,1839395,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.0_Filb]"},
{0x0ebf6177,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.35_PR]"},
{0x0aa6970e,1048579,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.65_PR]"},
{0x2f139d05,1048579,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.80_PR]"},
{0xbdc013de,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.9_PR]"},
{0xb7b14f6e,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.91_PR]"},
{0x45badcdb,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.92_PR]"},
{0x2d49fbe6,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.94_PR]"},
{0xb37ceefd,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.95_PR]"},
{0xc194606d,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.96_PR]"},
{0xb9845f96,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.97_PR]"},
{0x7b7e2250,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng1.99_PR]"},
{0x35015ad8,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.00_PR]"},
{0x6442f1fa,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.10_PR]"},
{0xe2e3c64f,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.15_PR]"},
{0x4dc6accf,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.20_PR]"},
{0x9bc10935,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.30_PR]"},
{0xca1dd995,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.40_PR]"},
{0xa20d791e,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.50_PR]"},
{0xa8b65ff1,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.60_PR]"},
{0x88e98ac9,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.70_PR]"},
{0x31551ff3,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Eng2.80_PR]"},
{0xa4404bd9,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Engx.xx_PR][a1]"},
{0xaf07fb77,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Fre0.01]"},
{0x29dd839d,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger1.0]"},
{0x4c511ae8,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger1.8_Filb]"},
{0x3fab4b42,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger1.85_Filb]"},
{0x8ee61997,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger1.9_Filb]"},
{0xba9a547f,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.00_Filb]"},
{0xe8ab5863,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.05_Filb]"},
{0x76a794e9,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.06_Filb]"},
{0xc82fdda9,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.1_Filb]"},
{0x7a6de1e8,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.2_Filb]"},
{0x31702b3b,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.21_Filb]"},
{0x0389797b,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.3_Filb]"},
{0x4526d525,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.4_Filb]"},
{0xdd5e3350,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.5_Filb]"},
{0x7f6e72e5,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Ger2.6_Filb]"},
{0xb2325ee7,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Port]"},
{0x25ae8157,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Spa1.5_GBT]"},
{0x44c590e4,1048576,"Pocket Monsters Pinball (J) [C][T-Eng]"},
{0x84e49edf,1048576,"Pocket Monsters Silver (J) [C][T-Eng]"},
{0x12ff5791,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_partial1]"},
{0xa6172b27,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_partial2]"},
{0xff564b71,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_partial3]"},
{0x1cff5da1,2097152,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_partial4]"},
{0x846c05ec,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_PRTrans]"},
{0xa7b4fc44,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng0.1]"},
{0xdee78ca5,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng0.99_Vida][BF]"},
{0xcd38556a,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng1.08_Vida]"},
{0xd518d17b,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng1.08_Vida][BF]"},
{0x4d15bdf2,1048576,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng95%]"},
{0x6b18c238,1048576,"Pocket Monsters Silver (V1.1) (J) [C][T-Eng0.1_Matrix]"},
{0xa0ef3bd9,1048576,"Pocket Monsters Silver (V1.1) (J) [C][T-Eng0.99_Vida]"},
{0x70d68a00,1048576,"Pocket Monsters Silver (V1.1) (J) [C][T-Eng1.08_Vida]"},
{0xd8d76d50,1048576,"Pocket Monsters Trading Card Game (J) [C][T-Eng]"},
{0x54ece68a,1048576,"Pocket Monsters Trading Card Game (J) [C][T-Eng_partial]"},
{0x87bebb61,1048576,"Pocket Monsters Yellow (V1.0) (J) [C][T-Eng_partial]"},
{0x2c106b71,2097152,"Pokemon Crystal (U) [C][T-Ger1.0_Filb&JamesR]"},
{0x4cadabad,2097152,"Pokemon Gold (U) [C][T-Ger1.0_Filb]"},
{0x5a6e3d3e,2097152,"Pokemon Gold (U) [C][T-Ger1.1_Filb]"},
{0xfb3571dd,2097152,"Pokemon Gold (U) [C][T-Ger1.2_Filb]"},
{0x07097503,2097152,"Pokemon Gold (U) [C][T-Ger1.3_Filb]"},
{0xb59cd280,2097152,"Pokemon Gold (U) [C][T-Spa0.6_GBT]"},
{0x21c5e9a3,1048576,"Pokemon Pinball (U) [C][T-Spa_partial]"},
{0xe335c86e,1048576,"Pokemon Pinball (U) [C][T-Spa1.0_GBT]"},
{0xedd361ed,1048576,"Pokemon Trading Card Game (U) [C][T-Ger0.50_Domino]"},
{0x1725ffb0,1048576,"Pokemon Trading Card Game (U) [C][T-Ger0.70_Domino]"},
{0xd19f066c,1048576,"Pokemon Trading Card Game (U) [C][T-Ger1.00_Domino]"},
{0xf98082ca,1048576,"Pokemon Trading Card Game (U) [C][T-Spa4.0_GBT]"},
{0x697f8d9b,1048576,"Pokemon Trading Card Game (U) [C][T-Spa5.0_GBT]"},
{0x08776cb0,1048576,"Pokemon Yellow (U) [C][T-Chinese]"},
{0xfdcf148c,1048576,"Pokemon Yellow (U) [C][T-Fre]"},
{0x1e809db7,1048576,"Pokemon Yellow (U) [C][T-Fre_Sky2048]"},
{0x3c246a55,1048576,"Pokemon Yellow (U) [C][T-Fre0.1]"},
{0x98af35fa,1048576,"Pokemon Yellow (U) [C][T-Frex.x_Sky2048]"},
{0x4603468f,1048576,"Pokemon Yellow (U) [C][T-Ger_Blackmail]"},
{0xeb4e1204,1048576,"Pokemon Yellow (U) [C][T-Ger1.0_Filb]"},
{0x51eb689b,1048576,"Pokemon Yellow (U) [C][T-Greek_GTI_Badge]"},
{0x227375ff,1048576,"Pokemon Yellow (U) [C][T-Greek_partial_Badge]"},
{0x0c244a3b,1048576,"Pokemon Yellow (U) [C][T-Port]"},
{0x53bc79ef,1048576,"Pokemon Yellow (U) [C][T-Spa]"},
{0x6ed9b44e,1048576,"Pokemon Yellow (U) [C][T-Spa0.41_Paladin Knights Translations]"},
{0x9cf68153,2097152,"Quest RPG (U) [C][T-Spa1.0_Paladin Knights Translations]"},
{0x7a7361ba,1048576,"Revelations - The Demon Slayer (U) [C][T-Polish]"},
{0xa8be32f6,2097152,"RPG Maker (J) [C][T-Eng0.25_Magecraft]"},
{0x6ef77aea,2097152,"RPG Maker (J) [C][T-Eng0.35_Magecraft]"},
{0xfebcac84,2097152,"RPG Maker (J) [C][T-Eng0.40_Magecraft]"},
{0x33438bdc,2097152,"RPG Maker (J) [C][T-Eng0.60_Magecraft]"},
{0x3c451e20,2097152,"RPG Maker (J) [C][T-Eng0.85_Magecraft]"},
{0xa518cb06,1048576,"Sangokushi 2 (J) [C][T-Chinese][p1]"},
{0x21934252,1048576,"Sanrio Timenet Past (J) [C][T-Eng0.8_Katalyst]"},
{0x8d9c11ae,2097152,"Soul Getter (J) [C][T-Eng0.1_Magecraft]"},
{0x5fcd6938,1048576,"Super Chinese Fighter EX (J) [C][T-Eng_Opus]"},
{0x99fb1903,1048576,"Super Chinese Fighter EX (J) [C][T-Eng_v0.99_SGST]"},
{0x3fdc2fd8,1048576,"Super Mario Bros. DX (V1.0) (U) [C][T-Spa0.99_PalKnightTrans]"},
{0x9fdd6156,1048576,"Super Mario Bros. DX (V1.1) (U) [C][T-Spa0.99_PalKnightTrans]"},
{0xdc8afc22,1048576,"Super Robot Wars Link Battler (J) [C][T-Chinese]"},
{0x11577833,524288,"Tetris DX (JU) [C][T-Spa0.9_Paladin Knights Translations]"},
{0x77926580,2097152,"Warioland 3 (J) (M2) [C][T-Spa_GBT]"},
{0xd1d3a32a,1048576,"Who Wants to Be a Millionaire - 2nd Edition (U) [C][T-Polish]"},
{0xa940a605,1048576,"Wings of Fury (E) (M3) [C][T-Polish_aRPi]"},
{0x079226d5,1048576,"Wizardry Empire (V1.0) (J) [C][T-Eng0.5_Magecraft]"},
{0x8561da9d,1048576,"Wizardry I - Proving Grounds of the Mad Overlord (J) [C][T-Eng_Opus]"},
{0x3ba7cb56,1048576,"Wizardry II - Legacy of Llylgamyn (J) [C][T-Eng_Opus]"},
{0xce3786ad,1048576,"Wizardry III - Knights of Diamonds (J) [C][T-Eng_Opus]"},
{0x37ad1808,1048576,"Worms Armageddon (E) (M6) [C][T-Polish]"},
{0xc30d7e03,2097152,"Legend of Zelda, The - Link's Awakening DX (J) [C][p1][T-Chinese][!]"},
{0xedaa8478,1048576,"Gameboy Wars 2 (J) [C][T-Eng4][h1]"},
{0xef87527c,1048576,"Pocket Monsters Gold (V1.0) (J) [C][T-Port][h1] (Sonic)"},
{0x8be20ab6,1048576,"Pokemon Yellow (U) [C][T-German1.0_Filb][h1]"},
{0x78414dea,1048576,"Dexter's Laboratory - Robot Rampage (U) [C][T-Fre99%_YF06]"},
{0x4f784793,2097152,"Digital Devil Story - Black Children (J) [C][T-Chinese]"},
{0x8f6af7b4,2097152,"Dragon Quest Monsters (J) [C][T-Chinese]"},
{0x8506d949,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.1) (U) [C][T-Norwegian0.01]"},
{0xd6f7fb77,1048576,"Pocket Monsters Gold (V1.1) (J) [C][T-Engx.xx_PR][a2]"},
{0x712a7ebe,2097152,"Pokemon Puzzle Challenge (U) [C][T-Swedish0.35]"},
{0x1d505ada,2097152,"Telefang - Power Version (J) [C][T-Chinese]"},
{0xa10e0b26,1048576,"Tintin in Tibet (E) (M7) [C][T-Polish_aRPi]"},
{0xfc8b8ea9,1048576,"Top Gear Rally 2 (E) [C][T-Polish_aRPi]"},
{0x3aafe7e0,1048576,"Yu-Gi-Oh! - Capsule (J) [C][T-Eng_metranslations]"},
{0x1fb12dc3,1048576,"Yu-Gi-Oh! - Capsule (J) [C][T-Eng_metranslations][a1]"},
{0x692e2bb4,1048576,"Mega Man Xtreme (U) [C][T-Swedish0.07]"},
{0x10dad9b7,1048576,"Mega Man Xtreme (U) [C][T-Swedish0.20]"},
{0x3e9064a3,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng]"},
{0x644ffc4d,1048579,"Pocket Monsters Silver (V1.0) (J) [C][T-Eng_partial5]"},
{0x37623ecd,2097152,"Pocket Monsters Trading Card GB 2 - Team Great Rocket Visit! (J) [C][T-Eng_metranslations]"},
{0xae453cc6,4194304,"Yu-Gi-Oh! - Dark Duel Stories II - Duel Monsters (J) [C][T-Eng30%_metranslations]"},
{0x1d7b435f,2097152,"AIR Pocket Sound Demo (PD) [C]"},
{0xc09a5c21,1048576,"Bible, The - New Testament Books (Polish) (PD) [C]"},
{0xd0019fe5,2097152,"Ksiega tysiaca i jednej nocy (Polish) (PD) [C]"},
{0x7fd127d4,524288,"Kordian by Juliusz Slowacki (Polish) (PD) [C]"},
{0xbf00e808,524288,"Homer's Iliad (Polish) (PD) [C]"},
{0x5bafbad0,262144,"King Lear by Shakespeare (Polish) (PD) [C]"},
{0x2aea0cfd,1048576,"Homer's Odyessy (Polish) (PD) [C]"},
{0x322d2d0a,2097152,"Pocket Monsters Crystal Glass (J) [C][T-Eng][a1]"},
{0xa998fa50,1048576,"Ultima 3 by Sven Carlberg V0.99x (PD) [C][a2]"},
{0x349c0d7a,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.0) (U) [C][T-Polish2]"},
{0x1ed2bb17,4194304,"Yu-Gi-Oh! - Dark Duel Stories II - Duel Monsters (J) [C][T-Eng30%_metranslations][a1]"},
{0xf046c458,2097152,"Dune by Frank Herbert (Polish) (PD) [C]"},
{0xc23d88c4,1048576,"Legend of Zelda, The - Link's Awakening DX (V1.2) (U) [C][T-Norwegian0.01]"},
{0xd97dc94d,524288,"Pocket Voice V2.0 Demo 1c (Unl) [C]"},
{0x733f71c9,524288,"Pocket Voice V2.0 Demo 4c (Unl) [C]"},
{0x62d758ed,1048576,"Pokemon Pinball (U) [C][T-Fre99%_YF06]"},
{0x3d281735,131072,"Antygona by Sofokles (PD)[C]"},
{0x2b5f3af5,3112960,"Donald Duck (E) (M5) [C][b1]"},
{0x7daf8dae,2840233,"Metal Gear - Ghost Babel (J) [C][b1]"},
{0xb19ae3db,2785280,"Yu-Gi-Oh! 4 - Yugi Deck (J) [C][b1]"},
{0xe7378f57,1050975,"Woody Woodpecker - Escape from Buzz Buzzard's Park (E) (M5) [C][b1]"},
{0x979a78f3,1048576,"V-Rally - Championship Edition (J) [C][b1]"},
{0x791f8c86,262144,"Super Mario Special 3 (Unl) [C][b2]"},
{0x18fd445d,2097152,"Super Mario Special 3 (Unl) [C][b1]"},
{0x637c5538,46516,"Spider-Man (U) [C][b1]"},
{0xa47c9638,1048576,"Polaris SnoCross (U) [C][b1]"},
//GB!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{0x75664f91,65536,"16-in-1 Super Card (Unl) [b1]"},
{0x0fc62a50,65536,"16-in-1 Super Card (Unl) [b2]"},
{0x6c03e738,65536,"16-in-1 Super Card (Unl) [b3]"},
{0x2e0c6df7,262144,"Ace Striker (J) [b1]"},
{0xe6a136db,131072,"Ace Striker (J) [b2]"},
{0xcac3ae13,131072,"Ace Striker (J) [b3]"},
{0xbd107861,131072,"Ace Striker (J) [b4]"},
{0x9b28a120,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U) [b1]"},
{0xaf7bb8b6,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U) [b2]"},
{0x55bfd1e4,72148,"Adventure Island (U) [b1]"},
{0x099dd9cb,262144,"Adventure Island 2 (UE) [b1]"},
{0x37d31930,262144,"Adventure Island 2 (UE) [b2]"},
{0x040cce7a,131072,"Adventures of Rocky and Bullwinkle, The (U) [b1]"},
{0x38762263,131072,"Adventures of Star Saver, The (U) [b1]"},
{0x1b6406b1,131072,"Adventures of Star Saver, The (U) [b2]"},
{0xafb2e11c,131072,"Adventures of Star Saver, The (U) [b3]"},
{0xdfd9efd6,131072,"Aero Star (J) [b1]"},
{0x265f6c6b,131072,"Aero Star (J) [b2]"},
{0x0bbf9ed4,97664,"Aguri Suzuki F-1 Super Driving (J) [b1]"},
{0xaaaac5c2,262144,"Aguri Suzuki F-1 Super Driving (J) [b2]"},
{0x4947447f,131584,"Aladdin (U) [S][b1]"},
{0x3b2b904a,131072,"Alfred Chicken (U) [a1][b1]"},
{0x651f5a15,131072,"Alfred Chicken (U) [a1][b2]"},
{0xed65978c,131072,"Alfred Chicken (U) [a1][b3]"},
{0xae31a96c,131072,"Alien 3 (U) [b1]"},
{0x8362d3de,131072,"Alien 3 (U) [b2]"},
{0xcbe62a55,131072,"Alien 3 (U) [b3]"},
{0x0fbc8ffa,33280,"Alien 3 (U) [b4]"},
{0x7c2dc542,131072,"Alien 3 (U) [b5]"},
{0x1b7c8697,131072,"Alien Olympics 2044 AD (U) [b1]"},
{0x8f0843e6,131072,"Altered Space (U) [b1]"},
{0x972851b6,131072,"Altered Space (U) [b2]"},
{0xeb21316d,65536,"Amazing Spider-Man, The (UE) [b1]"},
{0x5f376393,65536,"Amazing Spider-Man, The (UE) [b2]"},
{0x947f1bfc,65536,"Amazing Spider-Man, The (UE) [b3]"},
{0x9776eae0,262144,"America Oudan Ultra Quiz (J) [b1]"},
{0xabbf328e,262144,"America Oudan Ultra Quiz (J) [b2]"},
{0xfdbce9aa,524288,"Animal Breeder 2 (J) [S][b1]"},
{0x0ede19c4,262144,"Animaniacs (U) [S][b1]"},
{0x1a6684bb,262144,"Animaniacs (U) [S][b2]"},
{0x877cc25c,262144,"Aretha 3 (J) [b1]"},
{0x62e97fea,262144,"Aretha 3 (J) [b2]"},
{0x987670bc,21900,"Aretha 3 (J) [b3]"},
{0x19f29b16,131072,"Asterix (UE) (M5) [b1]"},
{0x8bc985b5,131072,"Asteroids & Missile Command (U) [S][b1]"},
{0x200b5bab,32768,"Asteroids (U) [b1]"},
{0xbabb1435,131072,"Atomic Punk (U) [b1]"},
{0x98857787,131072,"Atomic Punk (U) [b2]"},
{0x886576af,131072,"Atomic Punk (U) [b3]"},
{0x8181d148,131072,"Atomic Punk (U) [b4]"},
{0xfc4ec3bf,7300,"Atomic Punk (U) [b5]"},
{0xdea09dc2,262144,"Avenging Spirit (U) [b1]"},
{0x4de76498,65536,"Ayakashi no Siro (J) [b1]"},
{0x9668044b,131072,"Baby T-Rex (U) [b1]"},
{0x056bed49,32768,"Balloon Kid (JUE) [b1]"},
{0xaec344e3,131072,"Barbie - Game Girl (U) [b1]"},
{0x19be9379,131072,"Barbie - Game Girl (U) [b2]"},
{0x0372d188,131072,"Barbie - Game Girl (U) [b3]"},
{0xc97289e7,131072,"Baseball Kids (J) [b1]"},
{0xd5d07589,131072,"Baseball Kids (J) [b2]"},
{0x389fb124,131072,"Bases Loaded (U) [b1]"},
{0xc8efa182,131072,"Bases Loaded (U) [b2]"},
{0x813c7f92,131072,"Batman - Return of the Joker (J) [b1]"},
{0x67459dbd,131072,"Batman - Return of the Joker (J) [b2]"},
{0x52460827,131072,"Batman (JU) [b1]"},
{0xc28a5a03,131072,"Batman (JU) [b2]"},
{0x1104d414,262144,"Batman Forever (U) [b1]"},
{0x37657cd4,262144,"Batman Forever (U) [b2]"},
{0x608463fd,131072,"Battle Bull (J) [b1]"},
{0xa33361a8,262144,"Battle Crusher (J) [S][b1]"},
{0x3125ecd5,262144,"Battle Crusher (J) [S][b2]"},
{0xec92a790,262144,"Battle Crusher (J) [S][b3]"},
{0x238961ca,131072,"Battle of Kingdom (J) [b1]"},
{0xb360c651,262144,"Battle of Olympus, The (UE) (M5) [b1]"},
{0x67cac174,262144,"Battle of Olympus, The (UE) (M5) [b2]"},
{0x2dc9be3a,262144,"Battle of Olympus, The (UE) (M5) [b3]"},
{0x01a8538f,131072,"Battle Unit Zeoth (U) [b1]"},
{0xbecce184,262144,"Battletoads & Double Dragon (U) (Sony Imagesoft) [b1]"},
{0xbf4f8a98,262144,"Battletoads & Double Dragon (U) (Sony Imagesoft) [b2]"},
{0xcca3f6b2,262144,"Battletoads & Double Dragon (U) (Sony Imagesoft) [b3]"},
{0x06c9a7f6,262144,"BC Kid 2 (J) [S][b1]"},
{0x3d8925a0,262144,"BC Kid 2 (J) [S][b2]"},
{0x9334b633,262144,"Beach Volleyball (J) [S][b1]"},
{0x5cad60af,262144,"Beach Volleyball (J) [S][b2]"},
{0x2cc6cf1c,131072,"Beethoven's 2nd (U) [S][b1]"},
{0x0fd4ebce,131072,"Beethoven's 2nd (U) [S][b2]"},
{0x7bd9022f,131072,"Beetlejuice (U) [b1]"},
{0xf3929d6f,131072,"Beetlejuice (U) [b2]"},
{0x4651529e,262144,"Best of the Best - Championship Karate (U) [b1]"},
{0xb90d4e25,262144,"Best of the Best - Championship Karate (U) [b2]"},
{0xa1e31fc3,131072,"Bill and Ted's Excellent GB Adventure (UE) [b1]"},
{0xd39122d1,131072,"Bill and Ted's Excellent GB Adventure (UE) [b2]"},
{0x35e8c0fe,131072,"Bill and Ted's Excellent GB Adventure (UE) [b3]"},
{0x38707b29,262144,"Bionic Commando (J) [b1]"},
{0x7333b1dd,262144,"Bionic Commando (U) [b1]"},
{0xd1446c9b,262144,"Bionic Commando (U) [b2]"},
{0x75f32d85,262144,"Bionic Commando (U) [b3]"},
{0xff8094d2,262144,"Bionic Commando (U) [b4]"},
{0xdb814191,262144,"Bionic Commando (U) [b5]"},
{0xfde0e951,262144,"Bionic Commando (U) [b6]"},
{0x7979525c,262144,"Bionic Commando (U) [b7]"},
{0x8ddb7197,262144,"Bionic Commando (U) [b8]"},
{0xaa5c93c4,262133,"Bionic Commando (U) [b9]"},
{0x8bc43996,131072,"Blades of Steel (U) (GB) [b1]"},
{0x3a49852f,131072,"Blaster Master Boy (U) [b1]"},
{0x4be4603d,65536,"Blodia (J) [b1]"},
{0x235b8262,65536,"Blodia (J) [b2]"},
{0xdb132ae2,131072,"Blues Brothers, The (U) [b1]"},
{0xf8010e30,131072,"Blues Brothers, The (U) [b2]"},
{0x31f2406f,262144,"Boku Drakura Kun (J) [b1]"},
{0x3ca4a7cb,262144,"Boku Drakura Kun 3 (CV Legends) (Akumajo Dracula) (J) [S][b1]"},
{0xad6bbc46,262144,"Boku Drakura Kun 3 (CV Legends) (Akumajo Dracula) (J) [S][b2]"},
{0xfae86abb,32768,"Bomb Jack (U) [b1]"},
{0x709f7695,32769,"Bomb Jack (U) [b2]"},
{0xdd0087f3,131072,"Bomber Boy (J) [b1]"},
{0x239fad04,131070,"Bomber Boy (J) [b2]"},
{0xf6146642,131072,"Bomber Boy (J) [b3]"},
{0xd8f54c63,131072,"Bomber Boy (J) [b4]"},
{0x9fc54005,131072,"Bomber King - Scenario 2 (J) [b1]"},
{0x3d6d317b,131072,"Bomber King - Scenario 2 (J) [b2]"},
{0x44b852e1,131069,"Bomber King - Scenario 2 (J) [b3]"},
{0x1e7f15a9,131072,"Bomber King - Scenario 2 (J) [b4]"},
{0x98571d78,262146,"Bomberman GB (J) [S][b1]"},
{0x414859b0,147456,"Bomberman GB (J) [S][b2]"},
{0x989013ed,262146,"Bomberman GB (J) [S][b3]"},
{0x01e203d1,262144,"Bomberman GB (J) [S][b4]"},
{0x068be073,262144,"Bomberman GB (U) [S][b1]"},
{0x77545764,262144,"Bomberman GB (U) [S][b2]"},
{0x240a5d60,262144,"Bomberman GB (U) [S][b3]"},
{0x80b998fe,262144,"Bomberman GB (U) [S][b4]"},
{0xdfb65408,262144,"Bomberman GB (U) [S][b5]"},
{0x5a08409d,262144,"Bomberman GB 2 (J) [S][b1]"},
{0x61faa1d6,262144,"Bomberman GB 3 (J) [S][b1]"},
{0x6557a5ae,262144,"Bonk's Adventure (U) [b1]"},
{0xa4f891b3,262144,"Bonk's Adventure (U) [b2]"},
{0x3a67c02e,65536,"Bonk's Adventure (U) [b3]"},
{0x89557ad8,262144,"Booby Boys (J) [b1]"},
{0xadba5a98,262144,"Booby Boys (J) [b2]"},
{0x52e64623,262144,"Booby Boys (J) [b3]"},
{0x0ab92375,65536,"Boomer's Adventure in ASMIK World (J) [b1]"},
{0xec12f8f7,65536,"Boomer's Adventure in ASMIK World (U) [b1]"},
{0xc03cb58d,65534,"Boomer's Adventure in ASMIK World (U) [b2]"},
{0x0409c5c0,65536,"Boulder Dash (U) [b1]"},
{0x827f2bd5,32768,"Bounce by Jarvik7 (Bung) (PD) [b1]"},
{0x3a4555d5,65536,"Boxing (JU) [b1]"},
{0x19b6b44a,65536,"Boxing (JU) [b2]"},
{0x84b29b65,65536,"Boy and His Blob, A - Rescue of Princess Blobette (E)(Img)[b1]"},
{0x0bd281ca,131072,"Break Thru! (U) [b1]"},
{0x58632891,131072,"Bubble Bobble (J) [b1]"},
{0x92025049,131072,"Bubble Bobble Jr. (J) [b1]"},
{0xda0a4378,40068,"Bubble Bobble Part 2 (U) [b1]"},
{0xbff5cf6c,251600,"Bubsy 2 (U) [b1]"},
{0x87358c44,131072,"Bugs Bunny - Crazy Castle II (U) [b1]"},
{0x368d6c64,65536,"Bugs Bunny (U) [b1]"},
{0x20f7ae99,65536,"Bugs Bunny (U) [b2]"},
{0x2ab7d408,65536,"Bugs Bunny (U) [b3]"},
{0xfa9042b4,65536,"Burger Time Deluxe (JU) [b1]"},
{0x57fa2beb,65536,"Ca Da (J) [b1]"},
{0x29ebfb17,65536,"Ca Da (J) [b2]"},
{0xaa02a95b,65536,"Ca Da (J) [b3]"},
{0xaf33b851,131072,"Caesar's Palace (J) [b1]"},
{0x676e3556,131072,"Caesar's Palace (U) [b1]"},
{0x7a81b7c0,524288,"Captain Tsubasa (J) [S][b1]"},
{0x61e58eea,524288,"Captain Tsubasa (J) [S][b2]"},
{0x180d4d1e,524288,"Captain Tsubasa (J) [S][b3]"},
{0x6b79e13e,262144,"Captain Tsubasa VS (J) [b1]"},
{0x42685621,131072,"Casino Funpak (U) [b1]"},
{0x24e86ffa,131072,"Casper (U) [b1]"},
{0x93b593b9,131072,"Castle Quest (U) [b1]"},
{0x1cc553dc,131072,"Castle Quest (U) [b2]"},
{0xeb94f43e,131072,"Castle Quest (U) [b3]"},
{0xd35b8d2c,65536,"Castlevania - Legends (G) [S][b1]"},
{0x75bc70ac,262144,"Castlevania - Legends (U) [S][b1]"},
{0x43a9c0ca,262144,"Castlevania - Legends (U) [S][b2]"},
{0xb6196715,65536,"Castlevania - Legends (U) [S][b3]"},
{0xeb8bb03e,131072,"Castlevania 2 - Belmont's Revenge (U) [b1]"},
{0x41860004,65536,"Castlevania Adventure, The ('89) (U) [b1]"},
{0x32fb842f,65536,"Castlevania Adventure, The ('91) (UE) [b1]"},
{0xa698eee6,131072,"Chase HQ (V1.1) (U) [b1]"},
{0x988750f8,131072,"Chase HQ (V1.1) (U) [b2]"},
{0x5441bbea,65536,"Chessmaster, The (V1.1) (UE) [b1]"},
{0x66ab9c61,262144,"Chiki Race (J) [b1]"},
{0x1e3b8f10,262144,"Chiki Race (J) [b2]"},
{0xddfd5dee,262144,"Chiki Race (J) [b3]"},
{0x3947d66e,260733,"Chiki Race (J) [b4]"},
{0x42db76d1,1048576,"Chinese Fighter (J) [S][b1]"},
{0x8c48b657,131072,"Choplifter 2 (U) (LucasArts - Broderbund) [b1]"},
{0x6568b344,65536,"Contra - The Alien Wars (J) [b1]"},
{0x483f515f,131072,"Cool Spot (U) [b1]"},
{0xd61d7fbf,131072,"Cool Spot (U) [b2]"},
{0x7b07ff18,131072,"Cool World (U) [b1]"},
{0x18f9e21b,131072,"Cool World (U) [b2]"},
{0x709081b2,131072,"Cool World (U) [b3]"},
{0xc4ca32c2,131072,"Crayon Shin Chan 4 (J) [S][b1]"},
{0xe7d81610,131072,"Crayon Shin Chan 4 (J) [S][b2]"},
{0xc6879317,131072,"Crayon Shin Chan 4 (J) [S][b3]"},
{0x38dcb9b6,32768,"Crystal Quest (U) [b1]"},
{0x264b8f90,262144,"Cutthroat Island (U) [b1]"},
{0x8875f72a,262144,"Cutthroat Island (U) [b2]"},
{0xaf11a4ac,131072,"Cyber Formula GPX (J) [b1]"},
{0xebea5ea8,131072,"Cyber Formula GPX (J) [b2]"},
{0x898c648c,131072,"Cyber Formula GPX (J) [b3]"},
{0xed66688f,65536,"Cyraid (U) [b1]"},
{0xc53d6ef6,262144,"Daffy Duck - The Marvin Missions (J) [S][b1]"},
{0xf9b6dcc7,131072,"Daffy Duck - The Marvin Missions (UE) [b1]"},
{0xcb68d748,131072,"Daffy Duck - The Marvin Missions (UE) [b2]"},
{0x66c04bea,131072,"Daffy Duck - The Marvin Missions (UE) [b3]"},
{0x2b7fe439,131072,"Daffy Duck - The Marvin Missions (UE) [b4]"},
{0xeebe6e2a,131072,"Darkman (U) [b1]"},
{0x37aa82d9,131072,"Darkwing Duck (U) [b1]"},
{0xe402f5d5,131072,"Darkwing Duck (U) [b2]"},
{0x9df5195b,65536,"Daruman Busters (J) [b1]"},
{0x8aecaa33,131072,"Days of Thunder (U) [b1]"},
{0x579f2a98,65536,"Dead Heat Scramble (J) [b1]"},
{0x143731d2,65536,"Dead Heat Scramble (J) [b2]"},
{0xd044ffe9,131072,"Dennis the Menace (U) [b1]"},
{0x7330dc7d,262144,"Desert Strike - Return to the Gulf (E) (Ocean) [S][b1]"},
{0x99b24690,262144,"Desert Strike - Return to the Gulf (E) (Ocean) [S][b2]"},
{0x38fd17cb,131072,"Dick Tracy (U) [b1]"},
{0xc17fbacd,131072,"Dick Tracy (U) [b2]"},
{0x59358491,262144,"Die Maus (E) (M4) [b1]"},
{0x97612fda,131072,"Dig Dug (U) [b1]"},
{0x3fff5167,57880,"Dino Breeder 2 (J) [S][b1]"},
{0x0799d80d,524288,"Disney's Mulan (U) [S][b1]"},
{0xd0cd573d,131072,"Dodge Ball (J) [b1]"},
{0x0163f270,131072,"Dodge Boy (J) [b1]"},
{0x63e6b4ac,262144,"Dodge Danpei (J) [b1]"},
{0x64749e6a,262144,"Dodge Danpei (J) [b2]"},
{0xdbad3014,524288,"Donkey Kong (V1.0) (JU) [S][b1]"},
{0x534f2762,524288,"Donkey Kong (V1.0) (JU) [S][b2]"},
{0x9264756e,524288,"Donkey Kong (V1.0) (JU) [S][b3]"},
{0x317caf13,524288,"Donkey Kong Land (U) [S][b1]"},
{0xb6147de4,327680,"Donkey Kong Land (U) [S][b2]"},
{0xc9cc1cba,524288,"Donkey Kong Land 2 (UE) [S][b1]"},
{0x7deec62c,524288,"Donkey Kong Land 2 (UE) [S][b2]"},
{0x771965c0,524288,"Donkey Kong Land 3 (U) [S][b1]"},
{0xa094c6e9,131072,"Doraemon (J) [b1]"},
{0xc3909c44,32768,"Doraemon 2 (J) [b1]"},
{0x4b909c75,65536,"Dorakyura Densetsu (Castlevania Adventure) (J) [b1]"},
{0x0218aa35,65536,"Dorakyura Densetsu (Castlevania Adventure) (J) [b2]"},
{0x4b9ed30a,131072,"Double Dragon (U) [b1]"},
{0x1fa8aa9b,131072,"Double Dragon 3 (U) [b1]"},
{0x8c20be3f,131072,"Double Dragon 3 (U) [b2]"},
{0xce05b04c,131072,"Dr. Franken (U) [b1]"},
{0x337f9c04,262144,"Dr. Franken II (UE) (M7) [b1]"},
{0x93a30e18,262144,"Dr. Franken II (UE) (M7) [b2]"},
{0x3c659613,262144,"Dragon Ball Z - Goku Hishouden (J) [S][b1]"},
{0x68a71925,524288,"Dragon Ball Z - Goku Hishouden (J) [S][b2]"},
{0xdb49d135,262144,"Dragon Heart (U) [b1]"},
{0x48d61aba,262144,"Dragon Heart (U) [b2]"},
{0xd5261a21,524288,"Dragon Heart (U) [b3]"},
{0xdbaf18ff,524288,"Dragon Heart (U) [b4]"},
{0x2bb7aa37,131072,"Dragon Tail (J) [b1]"},
{0x0d5923d6,131072,"Dragon Tail (J) [b2]"},
{0xf2e79a99,131072,"Dragon's Lair - The Legend (E) (Elite Systems) [b1]"},
{0xb0699d09,131072,"Dragon's Lair - The Legend (E) (Elite Systems) [b2]"},
{0x9e1945de,131072,"Dungeonland (J) [b1]"},
{0x7318e16a,262144,"Earthworm Jim (U) [b1]"},
{0x41449e72,262144,"Earthworm Jim (U) [b2]"},
{0xa890d021,262144,"Earthworm Jim (U) [b3]"},
{0x54276292,65536,"Elevator Action (U) [b1]"},
{0xb63e9593,65538,"Elevator Action (U) [b2]"},
{0x93943e28,131072,"Elite Soccer (U) [S][b1]"},
{0x3578b6e9,65536,"F-1 Boy (J) [b1]"},
{0x56e9f82b,131072,"F-1 Race (V1.1) (JUE) [b1]"},
{0xa2c15a8f,131072,"F-15 Strike Eagle (U) [b1]"},
{0xea393b08,131072,"F-15 Strike Eagle (U) [b2]"},
{0x50ba447c,131072,"Faceball 2000 (U) [b1]"},
{0x394dd7c0,131072,"Fastest Lap (JU) [b1]"},
{0x089d4062,262144,"Fastest Lap (JU) [b2]"},
{0x7d3a83ad,262144,"Fastest Lap (JU) [b3]"},
{0x5ea05583,131072,"Felix the Cat (U) [b1]"},
{0xb0f27d2e,262144,"Fidgetts, The (J) [b1]"},
{0x86e105f4,262144,"Fidgetts, The (UE) (M7) [b1]"},
{0x2f41afa1,524288,"FIFA International Soccer (U) [S][b1]"},
{0x2d175825,524288,"FIFA Soccer '98 (U) [S][b1]"},
{0x1ba4ed54,524288,"FIFA Soccer '98 (U) [S][b2]"},
{0xa12d7f34,131072,"Fighbird GB (J) [a1][b1]"},
{0x4804161c,131072,"Fighting Simulator 2-in-1 (Flying Warriors) (U) [b1]"},
{0x662ef8db,262144,"Final Fantasy Adventure (U) [b1]"},
{0x1cb4e265,131072,"Final Fantasy Legend (Sa-Ga) (U) [b1]"},
{0x7e6f8849,262144,"Final Fantasy Legend II (Sa-Ga 2) (U) [b1]"},
{0x2e01afee,131072,"Final Fantasy Legend II (Sa-Ga 2) (U) [b2]"},
{0x3cb3afba,131072,"Fire Fighter (U) [b1]"},
{0xd9e8737f,139264,"Fire Fighter (U) [b2]"},
{0xecf09565,131072,"Flash, The (U) [b1]"},
{0x0b5f5353,262144,"Flintstones, The (U) [b1]"},
{0x61fdaa13,262144,"Flintstones, The (U) [b2]"},
{0xdc43203c,262144,"Flintstones, The (U) [b3]"},
{0xb40225a5,131072,"Football International (U) [b1]"},
{0xc7e38c86,131072,"Football International (U) [b2]"},
{0x94a0be14,131072,"Fortified Zone (Ikari no Yousai) (U) [b1]"},
{0x54b108c1,524288,"Frank Thomas' Big Hurt Baseball (U) [b1]"},
{0xfc43515a,65536,"Frommer's Personal Organizer (U) [b1]"},
{0x6d620ed5,65536,"Funny Field (J) [b1]"},
{0xe3baad2a,65536,"Funny Field (J) [b2]"},
{0xf0fd3a23,131072,"Funpack 4-in-1 Vol. 2 (JU) [b1]"},
{0x5d06adb3,131072,"Galaga & Galaxian (J) [S][b1]"},
{0xfbca00dd,131072,"Galaga & Galaxian (U) [S][b1]"},
{0x2fb7f65c,262144,"Game & Watch Gallery (V1.0) (U) [S][b1]"},
{0xc020c640,524288,"Game & Watch Gallery 2 (J) [S][b1]"},
{0xafe39006,1048576,"Gameboy Camera (UEA) [S][b1]"},
{0xd060f23d,131072,"Gameboy Gallery (U) [S][b1]"},
{0xbe02bcc1,131072,"Gameboy Gallery (U) [S][b2]"},
{0x90a6b2b6,524288,"Gameboy Wars Turbo (J) [S][b1]"},
{0xa7242f65,262144,"Gamera - Daikai Jukutyu Kessen (J) [S][b1]"},
{0x54007525,262144,"Gamera - Daikai Jukutyu Kessen (J) [S][b2]"},
{0xf1e1a916,262144,"Ganbare Goemon 2 (J) [S][b1]"},
{0x90b3ff10,262144,"Ganbare Goemon 2 (J) [S][b2]"},
{0xc6275e24,262144,"Gauntlet 2 (U) [b1]"},
{0xe4d4cd0e,262144,"Gauntlet 2 (U) [b2]"},
{0x5d35f60b,131072,"GB Basketball (Tip-Off) (J) [b1]"},
{0xc6fba21d,262144,"GB Genjin (Bonk) (J) [b1]"},
{0x4507c0ac,262144,"GB Genjin (Bonk) (J) [b2]"},
{0xbb6cd59c,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][b1]"},
{0x3265051c,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][b2]"},
{0x262368cd,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][b3]"},
{0x1ef971ad,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][b4]"},
{0x387f8c2c,25144,"GB Quiz for Kids (PD) [b1]"},
{0x414f38b5,32805,"GB Tic-Tac-Toe (PD) [b1]"},
{0x3c4fcf0f,131072,"Gear Works (U) [b1]"},
{0x4d69fb25,131072,"Gear Works (U) [b2]"},
{0x6fa74958,262144,"Gensan 2 (J) [b1]"},
{0x3230ed1c,262144,"Getaway, The (U) [b1]"},
{0xe7237f8a,262144,"Getaway, The (U) [b2]"},
{0x1fc87ebd,262144,"Getaway, The (U) [b3]"},
{0x7a31b42c,131614,"Ghostbusters 2 (J) [b1]"},
{0xcc7c50c6,131072,"Ghostbusters 2 (UE) [b1]"},
{0x6bc3fe7e,65536,"Ginga (J) [b1]"},
{0xef446dc6,262144,"Go Go Ackman (J) [S][b1]"},
{0xbd8c4b66,262144,"God Medicine (J) [b1]"},
{0xb786508f,262144,"God Medicine (J) [b2]"},
{0xcdc0f10e,131072,"Godzilla (U) [b1]"},
{0x3a300148,131072,"Godzilla (U) [b2]"},
{0x65e8cafe,262144,"Gojira (GB Godzilla) (J) [b1]"},
{0x771212ca,262144,"Gojira (GB Godzilla) (J) [b2]"},
{0x181f5154,262144,"Gojira (GB Godzilla) (J) [b3]"},
{0x19209ec6,262144,"Golf Classic (U) [S][b1]"},
{0x9310ccd0,475136,"Golf Classic (U) [S][b2]"},
{0x3cec1f4a,262144,"Gradius - The Interstellar Assault (U) [b1]"},
{0x7f3dc242,262144,"Gradius - The Interstellar Assault (U) [b2]"},
{0x5ecbb229,524288,"Gradius - The Interstellar Assault (U) [b3]"},
{0xc8e0f04f,270336,"Gradius - The Interstellar Assault (U) [b4]"},
{0x4405f351,65536,"Grand Prix (Sunsoft) (UE) [b1]"},
{0x900dcbff,196608,"Great Greed (U) [b1]"},
{0xf900a557,131072,"Gremlins 2 (JUE) [b1]"},
{0x0dc5d021,131072,"Gremlins 2 (JUE) [b2]"},
{0x1a63fe7b,262144,"Gurander Musashi RV (J) [S][b1]"},
{0x4aac2660,131072,"Hal Wrestling (U) [b1]"},
{0x47dc8b8e,131072,"Hal Wrestling (U) [b2]"},
{0x24b07fc0,262144,"Hammerin' Harry - Ghost Building Company (Gensan) (J) [b1]"},
{0xeed0c406,262144,"Hammerin' Harry - Ghost Building Company (Gensan) (J) [b2]"},
{0x0f8f946e,262144,"Hammerin' Harry - Ghost Building Company (Gensan) (J) [b3]"},
{0x8a99ff21,262144,"Hammerin' Harry - Ghost Building Company (U) [b1]"},
{0x3a8ccbe7,262144,"Hammerin' Harry - Ghost Building Company (U) [b2]"},
{0x980deb3a,524288,"Harvest Moon GB (U) [S][b1]"},
{0xbb2a6b85,524288,"Harvest Moon GB (U) [S][b2]"},
{0x10b15de4,65536,"Hatris (U) [b1]"},
{0x5ba718af,65536,"Hatris (U) [b2]"},
{0x30b77dad,32768,"Heiankyo Alien (J) [b1]"},
{0xbb9b73c6,524288,"Hercules (U) [S][b1]"},
{0xd9838459,524288,"Hercules (U) [S][b2]"},
{0x83fd2a07,262144,"Hercules Eikou (J) [b1]"},
{0x60ce3129,262144,"Hercules Eikou (J) [b2]"},
{0xd5073a03,131072,"High Stakes Gambling (U) [b1]"},
{0xf81e9bb4,131072,"Home Alone (U) [b1]"},
{0xe99789dd,131072,"Home Alone (U) [b2]"},
{0x8c0c9508,131072,"Home Alone 2 (U) [b1]"},
{0x108f7a04,131072,"Home Alone 2 (U) [b2]"},
{0xac3f4fdb,131072,"Hook (E) (Ocean) [b1]"},
{0x9756697b,131072,"Hudson Hawk (U) [b1]"},
{0x7431b6e4,524288,"Humans, The (U) [b1]"},
{0x15eaaad0,270336,"Humans, The (U) [b2]"},
{0x24dea638,262144,"Humans, The (U) [b3]"},
{0x90fdad7d,524288,"Hunchback of Notre Dame, The - Topsy Turvy Games (U) [S][b1]"},
{0x24d8629a,131072,"Hunt for Red October, The (J) [b1]"},
{0x79645a2b,64003,"Hybrid GBPlot (PD) [b1]"},
{0x08407b1b,262144,"Hyper Black Bass (J) [b1]"},
{0x02460313,131072,"Hyper Dunk (U) [b1]"},
{0x7fcd9b96,131072,"Hyper Dunk (U) [b2]"},
{0xa1205f6c,131072,"Hyper Dunk (U) [b3]"},
{0x8f9a13a6,131072,"Incredible Crash Dummies, The (U) [b1]"},
{0xc54a4386,131072,"Incredible Crash Dummies, The (U) [b2]"},
{0xc1500312,131072,"Indiana Jones and the Last Crusade (J) [b1]"},
{0xda5c1fa8,262144,"International Superstar Soccer (U) [S][b1]"},
{0x48fa3ea4,262144,"Irem Fighter (J) [b1]"},
{0x396d0bc3,131072,"Iron League (Strong Wind Chapter One) (J) [b1]"},
{0x760e383f,65536,"Ishido (U) [b1]"},
{0x1297ede4,131072,"Itchy & Scratchy - Minature Golf Madness (U) [b1]"},
{0xd0ffebe3,131072,"J. Cup Soccer (J) [b1]"},
{0x03e121db,131072,"J. League Fighting Soccer (J) [b1]"},
{0x1ea84494,131072,"Jack Nicklaus Golf (U) [b1]"},
{0x48f00909,524288,"James Bond 007 (U) [S][b1]"},
{0x7483f9ff,65536,"Jankenman (J) [b1]"},
{0x22c907fc,131072,"Jeep Jamboree (U) [b1]"},
{0xdbc9f4d6,131072,"Jeep Jamboree (U) [b2]"},
{0xd1817dc9,262144,"Jelly Boy (U) [b1]"},
{0x184cce25,262144,"Jelly Boy (U) [b2]"},
{0xbfb8c3c9,262144,"Jelly Boy (U) [b3]"},
{0x3dae0128,262144,"Jida Igeki (J) [b1]"},
{0x93740c1e,262144,"Jida Igeki (J) [b2]"},
{0x0901419d,65536,"Jimmy Connors Tennis (J) [b1]"},
{0x066b2acd,65536,"Jimmy Connors Tennis (J) [b2]"},
{0x7293c7c4,65536,"Jimmy Connors Tennis (J) [b3]"},
{0x050bbade,65536,"Jimmy Connors Tennis (U) [b1]"},
{0xdb1423d5,65536,"Jimmy Connors Tennis (U) [b2]"},
{0x4b2088e9,65536,"Jordan vs Bird (U) [b1]"},
{0xd7d430b1,229376,"Judge Dredd (U) [b1]"},
{0x3741dc77,262144,"Jungle Strike (U) [b1]"},
{0x991886dd,262144,"Jungle Strike (U) [b2]"},
{0x7ad106f3,262144,"Jungle Wars (J) [b1]"},
{0x6868594e,262144,"Jungle Wars (J) [b2]"},
{0x9b83e88c,524288,"Jurassic Park - Lost World, The (U) [S][b1]"},
{0xaf3adae4,524288,"Jurassic Park - Lost World, The (U) [S][b2]"},
{0x286f6727,262144,"Jurassic Park (E) (M5) [b1][h1]"},
{0x8eacab08,270336,"Jurassic Park (U) [b1]"},
{0xabdbdbe9,262144,"Jurassic Park (U) [b2]"},
{0x1caf7b9a,65536,"Jurassic Park (U) [b3]"},
{0x2bc552a9,262144,"Jurassic Park 2 - The Chaos Continues (UE) [S][b1]"},
{0x613b41ca,262144,"Jurassic Park 2 - The Chaos Continues (UE) [S][b2]"},
{0xb24f637a,524288,"Kaeruno Tameni (J) [b1]"},
{0xc278ff82,524288,"Kaeruno Tameni (J) [b2]"},
{0xb976d4f5,393216,"Kanjiro (J) [S][b1]"},
{0xe597f82e,458752,"Kanjiro (J) [S][b2]"},
{0x8aea0a36,524288,"Ken Griffey Jr. Presents Major League Baseball (U) [S][b1]"},
{0xb0081f49,524288,"Ken Griffey Jr. Presents Major League Baseball (U) [S][b2]"},
{0xf633f50d,131072,"Kid Icarus - Of Myths and Monsters (UE) [b1]"},
{0xed213f95,131072,"Kid Icarus - Of Myths and Monsters (UE) [b1][BF]"},
{0xd6f2a2c2,131072,"Kid Icarus - Of Myths and Monsters (UE) [b2]"},
{0x0fc865c6,131072,"Kid Icarus - Of Myths and Monsters (UE) [b3]"},
{0x7b30dfda,131072,"Kid Icarus - Of Myths and Monsters (UE) [b4]"},
{0x43503c0f,131072,"Kid Icarus - Of Myths and Monsters (UE) [b5]"},
{0xf2eddeb9,524288,"Killer Instinct (U) [S][b1]"},
{0xf7487285,163840,"Killer Instinct (U) [S][b2]"},
{0x6210eda6,524288,"Killer Instinct (U) [S][b3]"},
{0xd6ec97c9,524288,"King of Fighters '95, The (U) [S][b1]"},
{0x1ebbace1,65536,"King of the Zoo (J) [b1]"},
{0xc2c28ce6,524288,"Kirby 2 - Hoshinoka 2 (J) [S][b1]"},
{0x69d99d1d,524288,"Kirby's Block Ball (U) [S][b1]"},
{0xb7b3ee11,524288,"Kirby's Block Ball (U) [S][b2]"},
{0x5f20f345,262144,"Kirby's Dream Land (U) [b1]"},
{0x775ecdef,262144,"Kirby's Hoshinoka-Bi (Dream Land) (V1.0) (J) [b1]"},
{0x5d3003b8,262144,"Kirby's Pinball Land (J) [b1]"},
{0x4aaab286,262144,"Kirby's Pinball Land (U) [b1]"},
{0x17871990,262144,"Kirby's Pinball Land (U) [b2]"},
{0x676f2107,262144,"Kirby's Star Stacker (U) [S][b1]"},
{0xe5b6bd07,262144,"Kirby's Star Stacker (U) [S][b2]"},
{0xc304e4cc,65536,"Klax (U) (GB) [b1]"},
{0xa2dc86b1,524288,"Konami Collection 1 (J) [S][b1]"},
{0x3aaa2ede,131072,"Konami Golf (E) [b1]"},
{0x6c5f5714,32768,"Konami Golf (E) [b2]"},
{0x60439cc9,131072,"Konami Sports (J) [b1]"},
{0x53d4d0f6,131072,"Konami Sports (J) [b2]"},
{0x4c63aafd,32768,"Kwirk (UA) [b1]"},
{0xf6adcda4,32768,"Kwirk (UA) [b2]"},
{0xab4480f2,131072,"Lamborghini American Challenge (U) [b1]"},
{0xbbd2b370,131072,"Lamborghini American Challenge (U) [b2]"},
{0x9af32fce,131072,"Lamborghini American Challenge (U) [b3]"},
{0x331e646b,131072,"Lamborghini American Challenge (U) [b4]"},
{0x36c5651b,131072,"Last Action Hero (U) [b1]"},
{0x46b0b834,262144,"Last Bible (J) [b1]"},
{0x0fda3a78,262144,"Last Bible (J) [b2]"},
{0x5240349a,131072,"Lawnmower Man, The (U) [b1]"},
{0x2464c582,131072,"Lawnmower Man, The (U) [b2]"},
{0x0ff52620,131072,"Lawnmower Man, The (U) [b3]"},
{0xb0c1ce37,131072,"Lawnmower Man, The (U) [b4]"},
{0xb7494145,131072,"Lawnmower Man, The (U) [b5]"},
{0xe35138da,32768,"Lazlos' Leap (U) [b1]"},
{0x13881924,32768,"Lazlos' Leap (U) [b2]"},
{0xfa89219f,65536,"Lazlos' Leap (U) [b3]"},
{0x22c8becf,524288,"Legend of the River King (U) [S][b1]"},
{0xd8b2b04c,401976,"Legend of Zelda, The - Link Gets Laid (P3 hack) (1) [h1][b1]"},
{0x3e097fc8,509302,"Legend of Zelda, The - Link's Awakening (F) [b1]"},
{0xc52bf8b9,524288,"Legend of Zelda, The - Link's Awakening (J) [b1]"},
{0xe2d2bdd9,524119,"Legend of Zelda, The - Link's Awakening (J) [b2]"},
{0xc71e73f3,524288,"Legend of Zelda, The - Link's Awakening (V1.0) (U) [b1]"},
{0x6c30b480,131072,"Lemmings (E) [b1]"},
{0x90d437dd,131072,"Lemmings (E) [b2]"},
{0x8b81b476,131072,"Lemmings (E) [b3]"},
{0x7d304282,524288,"Lemmings 2, The Tribes (U) [b1]"},
{0xbb5d779f,524288,"Lemmings 2, The Tribes (U) [b2]"},
{0x9524466e,28570,"Lemmings 2, The Tribes (U) [b3]"},
{0x4cb3e7fe,524288,"Lion King, The (Disney Classics) (U) [b1]"},
{0xdae8b049,524288,"Lion King, The (Virgin) (U) [b1]"},
{0xee772051,262144,"Little Master (J) [b1]"},
{0x1972ba95,131072,"Lolo (J) [b1]"},
{0x991861c9,262144,"Lucky Luke (E) (M4) [b1]"},
{0x9474296b,65536,"Lucky Monkey (J) [b1]"},
{0x0f63038f,524288,"Lucle (J) [b1]"},
{0x90d6c3eb,524288,"Lucle (J) [b2]"},
{0x506b8126,458752,"Madden '95 (U) [S][b1]"},
{0x3ce2d89c,524288,"Madden '95 (U) [S][b2]"},
{0x77a30719,524288,"Madden '96 (U) [S][b1]"},
{0x22ce673d,524288,"Madden '96 (U) [S][b2]"},
{0x315923c5,131072,"Magical Talulutokun - Raiba Zone Panic (J) [b1]"},
{0x58434d57,54060,"Magnetic Soccer (U) [b1]"},
{0x6512d4a9,131072,"Magnetic Soccer (U) [b2]"},
{0xa37388bb,262144,"Mahoujin Guru Guru (J) [S][b1]"},
{0x3de54e33,262144,"Marble Madness (U) [b1]"},
{0xfb028049,262144,"Marble Madness (U) [b2]"},
{0x1ba9bd15,262144,"Marble Madness (U) [b3]"},
{0x4ed15a48,262144,"Mario's Picross (UE) [S][b1]"},
{0xc18ec1fd,262144,"Mario's Picross (UE) [S][b2]"},
{0xc4c158bd,524288,"Mario's Picross 2 (J) [S][b1]"},
{0xf0eb003a,524288,"Mario's Picross 2 (J) [S][b2]"},
{0x303823ef,131072,"Maru's Mission (U) [b1]"},
{0xbcd834ac,131072,"McDonaldland (U) [b1]"},
{0x483b3075,524288,"Medarot Kuwagata (V1.0) (J) [S][b1]"},
{0x6bd968d0,262144,"Mega Man (U) [b1]"},
{0x4e619361,262144,"Mega Man (U) [b2]"},
{0x55afca76,262144,"Mega Man 2 (E) [b1]"},
{0x93dfa971,262144,"Mega Man 2 (E) [b2]"},
{0x42de2ff7,262144,"Mega Man 3 (U) [b1]"},
{0x34cd6521,262144,"Mega Man 3 (U) [b2]"},
{0x060b89e6,524288,"Mega Man 4 (E) [b1]"},
{0x5461c39e,526833,"Mega Man 4 (E) [b2]"},
{0x837c542e,524288,"Mega Man 5 (U) [S][b1]"},
{0x896fa4a4,65536,"Megalit (U) [b1]"},
{0x7c38c1ad,65536,"Megalit (U) [b2]"},
{0x988717e6,131072,"Mercenary Force (UE) [b1]"},
{0x1566b21c,131072,"Metal Jack (J) [b1]"},
{0xf31f5033,131072,"Metal Jack (J) [b2]"},
{0xac2383a9,262144,"Metroid 2 - Return of Samus (UA) [b1]"},
{0x7eba88de,524288,"Mickey Mouse - Tokyo Disneyland (J) [S][b1]"},
{0xe9e93624,524288,"Mickey Mouse - Tokyo Disneyland (J) [S][b2]"},
{0xbcd4a226,131072,"Mickey Mouse II (J) [b1]"},
{0xa5d7cb10,229376,"Micro Machines (U) [b1]"},
{0xdb89f46f,450000,"Micro Machines (U) [b2]"},
{0xfb6921fc,524288,"Micro Machines (U) [b3]"},
{0x8d12481c,262144,"Midorin Omaki Baoo (J) [S][b1]"},
{0xf6681992,262144,"Mighty Morphin Power Rangers - The Movie (U) [S][b1]"},
{0x2d5ab1cc,262144,"Mighty Morphin Power Rangers (U) [S][b1]"},
{0xe039879c,262144,"Mighty Morphin Power Rangers (U) [S][b2]"},
{0x9e59f78a,262144,"Mighty Morphin Power Rangers (U) [S][b3]"},
{0x1b2b2dcd,131072,"Millipede - Centipede (UE) [S][b1]"},
{0xd4ac182d,131072,"Milon's Secret Castle (U) [b1]"},
{0xb1adfacd,131072,"Milon's Secret Castle (U) [b2]"},
{0xfb445d67,65536,"Miner 2049er (U) [b1]"},
{0x8012d0fe,524288,"Mini 4 Boy (J) [S][b1]"},
{0x355b3a6d,524288,"Mini 4 Boy (J) [S][b2]"},
{0xa040a439,131072,"Miracle Adventure of Esparks (J) [b1]"},
{0xc1cf869c,16384,"MMX MegAnime (PD) [b1]"},
{0x924e08ce,524288,"Mole Mania (Moguranya) (U) [S][b1]"},
{0xff504417,524288,"Mole Mania (Moguranya) (U) [S][b2]"},
{0xf49df990,262144,"Momotaro Dengeki (J) [b1]"},
{0xa239e66b,524288,"Momotaro Dengeki 2 (J) [S][b1]"},
{0xe542d957,524288,"Momotaro Dengeki 2 (J) [S][b2]"},
{0xa7fb3d45,524278,"Momotaro Dengeki 2 (J) [S][b3]"},
{0xe9bb57db,524288,"Momotaro Dengeki 2 (J) [S][b4]"},
{0xc1bfc156,262144,"Momotetu (J) [b1]"},
{0x3a7efad6,262144,"Momotetu (J) [b2]"},
{0xbc2eacbf,262144,"Monopoly (J) [b1]"},
{0xab7aeea1,262144,"Monopoly (J) [b2]"},
{0x8d2db1bf,262144,"Monster Maker 2 (J) [b1]"},
{0x1bdaa982,262144,"Monster Max (U) [b1]"},
{0x6f6010c1,262144,"Monster Max (U) [b2]"},
{0xf1f46638,131072,"Monster Truck Wars (U) [S][b1]"},
{0xdfb1e455,262144,"Mortal Kombat (U) [b1]"},
{0x5175f8e6,257029,"Mortal Kombat (U) [b1][BF]"},
{0x29099e8a,262144,"Mortal Kombat (U) [b2]"},
{0x1fecb73e,524288,"Mortal Kombat 3 (U) [b1]"},
{0x35946095,262144,"Mortal Kombat II (U) [S][b1]"},
{0x4fc1a2e1,262144,"Mortal Kombat II (U) [S][b2]"},
{0x9965f0ad,262144,"Mr. Nutz (U) [b1]"},
{0x75d77322,262144,"Mr. Nutz (U) [b2]"},
{0x7ec7284b,131072,"Musashi Road (J) [b1]"},
{0x9b346678,131072,"Musashi Road (J) [b2]"},
{0xc1f8008c,131072,"Mysterium (U) [b1]"},
{0xa0ba780d,262144,"Mystic Quest (G) [b1]"},
{0x8e4c736d,235122,"Mystic Quest (G) [b2]"},
{0xc735b09b,262144,"Mystic Quest (G) [b3]"},
{0x899f46ab,124416,"Mystic Quest (U) [b1]"},
{0xe8b0d952,262144,"Mystic Quest (U) [b2]"},
{0xc4c7f381,9216,"Mystical Ninja (U) [S][b1]"},
{0x05952688,131072,"Nail'N Scale (U) [b1]"},
{0x78a7ac6b,524288,"Namco Gallery Volume 2 (J) [S][b1]"},
{0xd704a0cf,32768,"NanoSynth (PD) [b1]"},
{0x7a8998ae,131072,"Navy Blue '90 (J) [b1]"},
{0xf2d06e69,131072,"Navy Blue '90 (J) [b2]"},
{0xbe9bfb0c,262144,"Navy Blue '98 (J) [b1]"},
{0x9a01d0cf,131072,"Navy Seals (U) [b1]"},
{0x2ddeb95b,131072,"Navy Seals (U) [b2]"},
{0x8ceed472,131072,"Navy Seals (U) [b3]"},
{0x5437ff0c,65536,"NBA All Star Challenge (U) [b1]"},
{0x642f6059,131072,"NBA All Star Challenge 2 (U) [b1]"},
{0xd35677ae,131072,"NBA All Star Challenge 2 (U) [b2]"},
{0xf044537c,131072,"NBA All Star Challenge 2 (U) [b3]"},
{0x52364e56,131072,"NBA All Star Challenge 2 (U) [b4]"},
{0x5d4d1b5d,131072,"NBA All Star Challenge 2 (U) [b5]"},
{0xd52f6a5c,262144,"NBA Jam (U) [b1]"},
{0xe2d7b440,262144,"NBA Jam (U) [b2]"},
{0x1204e6f3,524288,"Nectaris (J) [S][b1]"},
{0x58c58f62,524288,"Nectaris (J) [S][b1][BF]"},
{0x75f9200c,524800,"Nectaris (J) [S][b2]"},
{0xb7779925,524800,"Nectaris (J) [S][b2][T-Eng_transBRC]"},
{0x22fa3a83,262144,"Nekojara (J) [b1]"},
{0xefd5d9d0,131072,"Nemesis (J) [b1]"},
{0x18b2f1b8,131072,"Nemesis (J) [b2]"},
{0x46f286c4,262144,"Nemesis 2 (J) [b1]"},
{0x316cb13f,201860,"Nettou Garou 2 (J) [S][b1]"},
{0xc3f4caf9,524288,"Nettou King of Fighters '95 (J) [S][b1]"},
{0xd4bd2bdf,524288,"Nettou King of Fighters '95 (J) [S][b2]"},
{0x72903af2,524288,"Nettou King of Fighters '96 (J) [S][b1]"},
{0x9da35ed6,524288,"Nettou King of Fighters '96 (J) [S][b2]"},
{0x4b7b309f,524288,"Nettou World Heroes 2 Jet (J) [S][b1]"},
{0x42123f65,524288,"Nettou World Heroes 2 Jet (J) [S][b2]"},
{0x81aa419d,262144,"New SD Gundam (J) [S][b1]"},
{0xd85c55d6,229376,"New SD Gundam (J) [S][b2]"},
{0x73832911,262144,"New SD Gundam (J) [S][b3]"},
{0x78450fd2,262144,"New SD Gundam (J) [S][b4]"},
{0x5742455d,262144,"NFL Quarterback Club '96 (U) [b1]"},
{0xe735ee44,262144,"NFL Quarterback Club '96 (U) [b2]"},
{0x5ab90151,262144,"NFL Quarterback Club '96 (U) [b3]"},
{0x083efb78,131072,"Nigel Mansell's World Championship '92 (E) [b1]"},
{0x0b5874c2,131072,"Nigel Mansell's World Championship '92 (U) [b1]"},
{0x09e6b707,131072,"Nigel Mansell's World Championship '92 (U) [b2]"},
{0x852d266a,131072,"Nigel Mansell's World Championship '92 (U) [b3]"},
{0xbb1b1347,131072,"Nigel Mansell's World Championship '92 (U) [b4]"},
{0x59bf6170,131072,"Ninja Ryukenden (Ninja Gaiden) (J) [b1]"},
{0x22324538,131072,"Ninja Ryukenden (Ninja Gaiden) (J) [b2]"},
{0xa6537d16,229376,"Obelix (E) (M2) (Fre-Ger) [S][b1]"},
{0x33b19f36,524288,"Oddworld Adventures (UE) [b1]"},
{0x4d4bfb81,131072,"Oira Jajamaru Sekaidai Boken (J) [b1]"},
{0xe6758f56,131072,"Oira Jajamaru Sekaidai Boken (J) [b2]"},
{0x416f3ce8,131072,"On the Tiles - Franky, Joe & Dirk (E) [b1]"},
{0x4f06e5e6,131072,"Oni (J) [b1]"},
{0x47c704e0,131072,"Oni (J) [b2]"},
{0xf2b20a59,13140,"Oni Gashima Pachinko Ten (J) [b1]"},
{0x14754dd5,32768,"Othello (J) [b1]"},
{0x7e5e2c0e,131072,"Otoko Jyuku (J) [b1]"},
{0x5d4c08dc,131072,"Otoko Jyuku (J) [b2]"},
{0xa4ff402c,131072,"Otoko Jyuku (J) [b3]"},
{0x14b65e56,131072,"Out of Gas (U) [b1]"},
{0x6e0e1a28,131072,"Out to Lunch (U) [b1]"},
{0xe9d63962,524288,"Pachinko Data Card - Chou Ataru Kun (J) [S][b1]"},
{0xb7c7ea01,262144,"Pachislot Kids 3 (J) [b1]"},
{0x3aaacce9,65536,"Pac-Man (U) (Namco Hometek) [b1]"},
{0x426c6bf0,131072,"Pac-Panic (J) [S][b1]"},
{0xcc0c7dae,131072,"Pac-Panic (J) [S][b2]"},
{0x3c3665ba,262144,"Pagemaster, The (U) [S][b1]"},
{0xa5ea6f3e,65536,"Painter Momo Pie (J) [b1]"},
{0xae46b801,32768,"Palamedes (J) [b1]"},
{0xcdf6e3ad,262144,"Paperboy 2 (U) [b1]"},
{0x59cd568d,131072,"Parasol Stars (UE) [b1]"},
{0x37bf874b,262144,"Parodius Da! (J) [b1]"},
{0x7a063ed7,262144,"Parodius Da! (J) [b2]"},
{0x7755d559,131072,"Peetan (J) [b1]"},
{0x21d6f060,131072,"Peetan (J) [b2]"},
{0x12acb674,65536,"Penguin Kun Wars VS (J) [b1]"},
{0x278c29e6,524288,"PGA European Tour (U) [S][b1]"},
{0x8420b6cc,524288,"PGA European Tour (U) [S][b2]"},
{0xc188e57f,65536,"Pinball - Revenge of the Gator (U) [b1]"},
{0x34cc8d14,65536,"Pinball - Revenge of the Gator (U) [b2]"},
{0x5c5c3ce4,262144,"Pinball Deluxe (U) [b1]"},
{0x33d02ebf,131072,"Pinball Dreams (UE) [b1]"},
{0xf3665f99,131072,"Pinball Dreams (UE) [b2]"},
{0xee9faec4,262144,"Pinball Mania (U) [b1]"},
{0x78545be5,262080,"Pinocchio (U) (Black Pearl 1996) [b1]"},
{0xada98d0f,262144,"Pit Fighter (U) [b1]"},
{0x79fc1e7e,262144,"Pit Fighter (U) [b2]"},
{0xfbdd7e0b,131072,"Play Action Football (U) [b1]"},
{0x05be004e,458752,"Pocket Bomberman (J) [S][b1]"},
{0xcc65ed55,491520,"Pocket Bomberman (J) [S][b2]"},
{0xd189f2db,524288,"Pocket Bomberman (U) [S][b1]"},
{0x005284e6,524288,"Pocket Jockey (J) [S][b1]"},
{0x450f0f59,242470,"Pocket Kyorochan (J) [S][b1]"},
{0xed0f533b,360448,"Pocket Monsters Blue (J) [S][b1]"},
{0xdd94307f,163840,"Pocket Monsters Blue (J) [S][b1][BF]"},
{0x9f3a1668,524412,"Pocket Monsters Blue (J) [S][b1][T-Eng_partial]"},
{0x208f58f8,196608,"Pocket Monsters Red (V1.1) (J) [S][b1][BF]"},
{0x905db6d8,1048576,"Pocket Monsters Yellow (V1.0) (J) [S][b1]"},
{0xe75e7d8d,1048576,"Pokemon Blue (UA) [S][BF][b1]"},
{0x8f5e91af,1048576,"Pokemon Blue (UA) [S][h1][b1]"},
{0x4b51bff4,131072,"Popeye 2 (J) [b1]"},
{0x245cce0d,131072,"Popeye 2 (U) [b1]"},
{0x21462c75,131072,"Populous (UE) [b1]"},
{0x9cc61e36,131072,"Populous (UE) [b2]"},
{0x395d6ae3,131072,"Power Mission (U) [b1]"},
{0x54506550,131072,"Prehistorik Man (U) [b1]"},
{0x77424182,131072,"Prehistorik Man (U) [b2]"},
{0xa0abea74,65536,"Pri Pri (J) [b1]"},
{0xf9622a4b,262144,"Primal Rage (U) [b1]"},
{0x73148ea4,262144,"Primal Rage (U) [b2]"},
{0x07811739,131072,"Prince of Persia (U) [b1]"},
{0xa9d7f4fc,131072,"Prince of Persia (U) [b2]"},
{0x1e089d68,131072,"Prince of Persia (U) [b3]"},
{0x45ae0758,131072,"Prince of Persia (U) [b4]"},
{0xd091456b,131072,"Pro Soccer (J) [b1]"},
{0xd9308401,131072,"Probotector (E) [b1]"},
{0xf1f7b5e4,131072,"Probotector (E) [b2]"},
{0x165cf361,131072,"Probotector 2 (E) [S][b1]"},
{0x416ae3cf,524288,"Purikura Pocket (J) [S][b1]"},
{0x0a5fdd7c,262144,"Puyo Puyo (J) [S][b1]"},
{0x5a726cb4,262144,"Puyo Puyo (J) [S][b2]"},
{0xfe2a915b,65536,"Puzzle Boy 2 (J) [b1]"},
{0x36054aad,34816,"Puzznic (J) [b1]"},
{0xf4ac4db5,65536,"Puzznic (J) [b2]"},
{0x1910922a,32768,"Q Billion (J) [b1]"},
{0xbfacb932,229376,"Race Days (Dirty Racing & 4 Wheel Drive) (U) [b1]"},
{0x63fdc566,262144,"Race Days (Dirty Racing & 4 Wheel Drive) (U) [b2]"},
{0x3ac9c3d7,131072,"Race Drivin' (U) [b1]"},
{0xdec8a990,131072,"Race Drivin' (U) [b2]"},
{0xa99ddeb0,524288,"Racing Mini 4WD (J) [S][b1]"},
{0x3097d5f0,262144,"Raging Fighter (UE) [b1]"},
{0xaa20b7fc,262144,"Raging Fighter (UE) [b2]"},
{0x67cb864e,131072,"Rampart (U) [b1]"},
{0xedb6c6e2,262144,"Ranma Nibun no Ichi - Part 2 (J) [b1]"},
{0x348b7299,262144,"Ranma Nibun no Ichi - Part 2 (J) [b2]"},
{0x3975073b,262144,"Ranma Nibun no Ichi - Part 2 (J) [b3]"},
{0x8928a0c2,524288,"Real Bout Special (Fatal Fury) (J) [S][b1]"},
{0xcbfdba8a,32768,"Rei 3D Pyramid Demo (PD) [b1]"},
{0x9b5e2fa7,131072,"Robocop (J) [b1]"},
{0xda1e635e,131072,"Robocop (J) [b2]"},
{0x522878fd,131072,"Robocop 2 (U) [b1]"},
{0xdf76103d,131072,"Robocop 2 (U) [b2]"},
{0x6dc338af,524288,"Rock 'N Monster (J) [S][b1]"},
{0xcc131a94,262144,"Rockman 8 (Hong Kong) [p1][b1]"},
{0xeba09288,524288,"Rockman World 4 (J) [b1]"},
{0xbcf4928f,524288,"Rockman World 4 (J) [b2]"},
{0xa6152604,65536,"Rodland (J) [b1]"},
{0x7901dbb9,131072,"Rolan's Curse 2 (U) [b1]"},
{0x4d4f4d4e,131072,"Rolan's Curse 2 (U) [b2]"},
{0xca40c5f6,32768,"RPN Calculator (PD) [b1]"},
{0xbe0daa86,32768,"RPN Calculator (PD) [b2]"},
{0x6a573454,32768,"RPN Calculator (PD) [b3]"},
{0xd3e36e87,32768,"RPN Calculator (PD) [b4]"},
{0x5271ead2,131072,"Rubble Saver (J) [b1]"},
{0x4ae44e31,131072,"Rubble Saver (J) [b2]"},
{0x9f1867ae,32768,"Runtime - Test Rom (PD) [b1]"},
{0x98baf420,120288,"Sa-Ga (Final Fantasy Legend) (V1.1) (J) [b1]"},
{0x5c29cf84,262144,"Sa-Ga (Final Fantasy Legend) (V1.1) (J) [b2]"},
{0x46a38613,131072,"Sagaia (J) [b1]"},
{0x9a26b633,131072,"Sagaia (J) [b2]"},
{0x5d2baa52,262144,"Sailor Moon R (J) [b1]"},
{0x9a72d5c4,262144,"Sailor Moon R (J) [b2]"},
{0x85c9217e,524288,"Samurai Shodown (U) [S][b1]"},
{0xc04c9f7b,229376,"Samurai Shodown (U) [S][b2]"},
{0x07e06c42,524289,"Samurai Shodown (U) [S][b3]"},
{0xdd3db494,524288,"Samurai Shodown (U) [S][b4]"},
{0x0ea66791,262144,"Sangokushi (J) [b1]"},
{0xcc0a8a92,262144,"Sangokushi (J) [b2]"},
{0xd53389fa,65536,"Sanrio Carnival (J) [b1]"},
{0x18e269dc,262144,"Satoru Nakajima - F-1 Hero - The Graded Driver '92 (J) [b1]"},
{0x73b4201d,131072,"SD Command Gundam - G-Arms (J) [b1]"},
{0x0899b914,262144,"SD Gundam Gaiden - Lacroan Heroes (J) [b1]"},
{0x929fdc5c,524288,"SD Hiryu no Ken Gaiden (J) [S][b1]"},
{0xebd0a0e8,524288,"SD Hiryu no Ken Gaiden (J) [S][b2]"},
{0x72d0c744,524288,"SD Hiryu no Ken Gaiden (J) [S][b3]"},
{0x22aa9ca5,65536,"SD Lupin the Third (J) [b1]"},
{0x71a80d5b,262144,"SD Saint Seiya Paradise (J) [b1]"},
{0xfe541679,262144,"SeaQuest DSV (U) [S][b1]"},
{0x2769a202,262144,"SeaQuest DSV (U) [S][b2]"},
{0x5e17e782,262144,"SeaQuest DSV (U) [S][b3]"},
{0x90b8e2cc,262144,"SeaQuest DSV (U) [S][b4]"},
{0x08b3b1bc,10240,"Seiken Densetsu (J) [b1]"},
{0xdf921fb4,262144,"Sengoku Ninjakun - Ninja Taro (J) [b1]"},
{0x8ff389b5,131072,"Sensible Soccer (U) [b1]"},
{0x8d2c64d7,131072,"Sensible Soccer (U) [b2]"},
{0xea9ed812,32768,"Shanghai (J) [b1]"},
{0x6bcbfe54,32768,"Shi Sensyo - Match-Mania (J) [b1]"},
{0xe7948383,32768,"Shi Sensyo - Match-Mania (J) [b2]"},
{0x89102010,89600,"Simpsons, The - Bart & the Beanstalk (U) [b1]"},
{0x5676b41d,131072,"Simpsons, The - Bart & the Beanstalk (U) [b2]"},
{0xada89ebd,131072,"Simpsons, The - Escape from Camp Deadly (U) [b1]"},
{0x7910f1ae,131841,"Simpsons, The - Krusty's Funhouse (U) [b1]"},
{0xff9a8fb5,131072,"Simpsons, The - Krusty's Funhouse (U) [b2]"},
{0xa3710303,131072,"Simpsons, The - Krusty's Funhouse (U) [b3]"},
{0x2c42e03a,131072,"Simpsons, The - Krusty's Funhouse (U) [b4]"},
{0xf44cd1d0,131072,"Skate or Die - Bad 'N Rad (U) [b1]"},
{0xb7ff32a6,131072,"Skate or Die - Tour de Thrash (U) [b1]"},
{0x5a7558a6,262144,"Slam Dunk - Gakeppuchi no Kesshou League (J) [S][b1]"},
{0xd5f9e016,524288,"Slam Dunk 2 - Zengoku he no TIPOFF (J) [S][b1]"},
{0xe246bdff,524288,"Small Soldiers (U) [S][b1]"},
{0xabba681d,262144,"Smurfs 3, The (UE) [b1]"},
{0x60eee11f,131072,"Sneaky Snakes (UE) [b1]"},
{0x654c92bd,65536,"Snoopy - Magic Show (U) [b1]"},
{0xed6f83db,131072,"Snow Bros Jr. (U) [b1]"},
{0x26e20d19,131072,"Snow Bros Jr. (U) [b2]"},
{0xb0eec08b,131072,"Snow Bros Jr. (U) [b3]"},
{0x2fd47c30,131072,"Soccer (E) (M3) [S][b1]"},
{0xdf8ef44d,524288,"Sonic 6 (Unl) [b1]"},
{0x98da5726,32768,"Sound Demo (PD) [b1]"},
{0x64b238cc,32769,"South Pong (PD) [a1][b1]"},
{0xd6fa7c3f,32768,"South Pong (PD) [b1]"},
{0xe2001204,524288,"Space Invaders '94 (U) [S][b1]"},
{0xa2502b99,524288,"Space Invaders '94 (U) [S][b2]"},
{0x4390d8b2,262144,"Space Invaders '94 (U) [S][b3]"},
{0x38f7e468,65536,"Spartan X (Kung-Fu Master) (J) [b1]"},
{0xf05832fb,65536,"Spartan X (Kung-Fu Master) (J) [b2]"},
{0xf2d754ca,131072,"Speed Ball 2 - Brutal Deluxe (U) [b1]"},
{0x3e04034a,262144,"Speedy Gonzales (U) [b1]"},
{0xb6d4f546,262144,"Speedy Gonzales (U) [b2]"},
{0x11d6579f,262144,"Spirou (U) (M4) [S][b2]"},
{0xc7117b50,65536,"Splitz (U) [b1]"},
{0x53b98079,262144,"Sports Illustrated for Kids - Ultimate Triple Dare! (U) [b1]"},
{0x5c6d6609,32768,"Spot (U) [b1]"},
{0xd53ecbd6,32768,"Sprite Demo (PD) [b1]"},
{0x21c1ba20,32768,"Sprite Demo (PD) [b2]"},
{0x57e954ec,32768,"Sprite Demo 2 (PD) [b1]"},
{0x41b29bf8,65536,"Square Deal - The Game of Two Dimensional Poker (U) [b1]"},
{0xccaeb3aa,131072,"Star Hawk (U) [b1]"},
{0xbe45d85e,131072,"Star Hawk (U) [b2]"},
{0xb3257951,131072,"Star Hawk (U) [b3]"},
{0x11269559,262144,"Star Sweep (J) [S][b1]"},
{0x95db7756,262144,"Star Sweep (J) [S][b2]"},
{0xd0c694cc,131072,"Star Trek - Generations - Beyond the Nexus (E) [S][b1]"},
{0xf3d4b01e,131072,"Star Trek - Generations - Beyond the Nexus (E) [S][b2]"},
{0x6c5c2f70,131072,"Star Trek - Generations - Beyond the Nexus (E) [S][b3]"},
{0xd3c1fd29,131072,"Star Trek (U) [b1]"},
{0x02fbf442,524288,"Star Wars - Super Return of the Jedi (U) [S][b1]"},
{0xb742c032,524800,"Star Wars - Super Return of the Jedi (U) [S][b2]"},
{0x858819cc,370840,"Star Wars - Super Return of the Jedi (U) [S][b3]"},
{0x0a995162,524288,"Star Wars - Super Return of the Jedi (U) [S][b4]"},
{0xfb0bfe30,139264,"Star Wars - The Empire Strikes Back (U) (Capcom) [b1]"},
{0x6e5b375f,131072,"Star Wars - The Empire Strikes Back (U) (Capcom) [b2]"},
{0x42c2fa03,131072,"Star Wars (U) (Capcom) [b1]"},
{0x61d0ded1,131072,"Star Wars (U) (Capcom) [b2]"},
{0xc51be738,131072,"Star Wars (U) (Capcom) [b3]"},
{0xe4cda867,131072,"Stargate (U) [b1]"},
{0x6081943f,524288,"Street Fighter II (J) [S][b1]"},
{0xf433dc0e,524288,"Super 139-in-1 (Unl) [b1]"},
{0xe8ae796b,524288,"Super 139-in-1 (Unl) [b2]"},
{0xc9702c1e,524288,"Super 14-in-1 (partial dump) [p1][b1]"},
{0x54c8ca20,32768,"Super 51-in-1 (Unl) [b1]"},
{0x4f17eac7,2097152,"Super 51-in-1 (Unl) [b2]"},
{0x554c6336,262144,"Super 8-in-1 (Unl) [b1]"},
{0x73e4a8b0,262144,"Super Bikkuri (J) [b1]"},
{0xc4cd765e,12288,"Super Black Bass Pocket 2 (J) [S][b1]"},
{0x1a304de2,524288,"Super Bombliss (J) [S][b1]"},
{0xcd2110f3,229376,"Super Chinese Land 3 (J) [S][b1]"},
{0x4a319922,131072,"Super Hunchback (J) [b1]"},
{0xd32d9c2a,131072,"Super Hunchback (U) [b1]"},
{0x798d0742,131072,"Super James Pond (U) [b1]"},
{0xf1b0764e,131072,"Super James Pond (U) [b2]"},
{0xde34c723,131072,"Super Kick Off (U) [b2]"},
{0xe285d5b8,65536,"Super Mario Land (V1.0) (JUA) [b1]"},
{0xb3a2a6c3,65536,"Super Mario Land (V1.0) (JUA) [b2]"},
{0x3295f12e,524288,"Super Mario Land 2 - 6 Golden Coins (V1.0) (UE) [b1]"},
{0x08e3c2cd,195072,"Super Mario Land 3 - Wario Land (JUE) [b1]"},
{0xc03058c9,524288,"Super Mario Land 3 - Wario Land (JUE) [b2]"},
{0xc8784e23,131072,"Super Off Road (U) [b1]"},
{0xfd65d0f8,65536,"Super Pachinko Wars (J) [S][b1]"},
{0x56053590,129980,"Super RC Pro-Am (UE) [b1]"},
{0x193e0f77,524288,"Super Robot War 2G (J) [S][b1]"},
{0x2b826641,38592,"Super Robot War 2G (J) [S][p1][b1]"},
{0xd81cd41b,131072,"Super Street Basketball 2 (J) [S][b1]"},
{0xbf108ad1,131072,"Swamp Thing (U) [b1]"},
{0x6a912289,131072,"Swamp Thing (U) [b2]"},
{0x45af3832,131072,"T2 - The Arcade Game (U) [b1]"},
{0xf53f28fb,131072,"T2 - The Arcade Game (U) [b2]"},
{0x3cbbffc8,131072,"T2 - The Arcade Game (U) [b3]"},
{0xda329f74,491520,"Tamagotchi (J) [S][b1]"},
{0x18a2565e,524288,"Tamagotchi 2 (J) [S][b1]"},
{0x4a2141b8,524288,"Tamagotchi 3 (J) [S][b1]"},
{0x88a39f10,32768,"Tasmania Story (J) [b1]"},
{0xbbcc7dc8,262144,"Taz-Mania (U) [b1]"},
{0xa3436cfd,262144,"Tecmo Bowl (U) [b1]"},
{0xc8c88536,262144,"Tecmo Bowl (U) [b2]"},
{0x0fb442bc,262144,"Teenage Mutant Hero Turtles - Back from the Sewers (E) [b1]"},
{0x0e53dcf5,262144,"Teenage Mutant Ninja Turtles - Back From the Sewers (U) [b1]"},
{0xc1889040,131072,"Teenage Mutant Ninja Turtles - Fall of the Foot Clan (U) [b1]"},
{0x861bb6ae,131072,"Teenage Mutant Ninja Turtles - Fall of the Foot Clan (U) [b2]"},
{0xe7cc69a5,131072,"Teenage Mutant Ninja Turtles (J) [b1]"},
{0x6d41e49e,262144,"Teenage Mutant Ninja Turtles 2 (J) [b1]"},
{0x490f63e5,131072,"Teenage Mutant Ninja Turtles III - Radical Rescue (U) [b1]"},
{0xbe8ed909,17688,"Tenchi Wokurau (J) [p1][T-Chinese][b1]"},
{0xc43d8a0a,131072,"Tenjin Kaisen - Mercenary Force (J) [b1]"},
{0x65da91e8,131072,"Tenjin Kaisen - Mercenary Force (J) [b2]"},
{0xfbb9856e,131072,"Terminator 2 - Judgment Day (UE) [b1]"},
{0x4cca7913,131649,"Terminator 2 - Judgment Day (UE) [b2]"},
{0x08561201,131072,"Terminator 2 - Judgment Day (UE) [b3]"},
{0x4f7a5468,131072,"Terminator 2 - Judgment Day (UE) [b4]"},
{0x3809953c,524288,"Tetris Attack (V1.1) (U) [S][b1]"},
{0x90180167,131072,"Tetris Blast (U) [S][b1]"},
{0xeff98bef,131072,"Tetris Flash (J) [S][b1]"},
{0x9c1822cc,131072,"Tetris Flash (J) [S][b2]"},
{0x0412c153,262144,"Tetris Plus (U) [S][b1]"},
{0xa51918ca,262144,"TinTin in Tibet (U) [S][b1]"},
{0x741653be,131072,"Tiny Toon Adventures 2 - Montana's Movie Madness (U) [b1]"},
{0x2b0f2fe5,131072,"Tiny Toon Adventures 2 - Montana's Movie Madness (U) [b2]"},
{0x31ed9f67,262144,"Titus the Fox (U) [b1]"},
{0x97c94251,262144,"Titus the Fox (U) [b2]"},
{0x6665b84b,262144,"Titus the Fox (U) [b3]"},
{0xd02b4eb1,131072,"Top Gun 2 (U) [b1]"},
{0x3c4e29b4,262144,"Top Ranking Tennis (U) [b1]"},
{0x1eb53866,262144,"Top Ranking Tennis (U) [b2]"},
{0xa8bf149b,262144,"Top Ranking Tennis (U) [b3]"},
{0x35f9f6af,131072,"Total Carnage (U) [h1][b1]"},
{0xb7ffd053,131072,"Toxic Crusaders (U) [b1]"},
{0x760215c4,131072,"Toxic Crusaders (U) [b2]"},
{0x18ba4e41,524288,"Toy Story (U) [S][b1]"},
{0xd23f5878,131072,"Track Meet (U) [b1]"},
{0xf12d7caa,131072,"Track Meet (U) [b2]"},
{0xef62ce17,131072,"Trappers Tengoku (J) [b1]"},
{0x16ae7ce3,131072,"Trax (U) [b1]"},
{0x35bc5831,131072,"Trax (U) [b2]"},
{0xa949a611,262144,"True Lies (U) [b1]"},
{0x5a6dfc51,262144,"True Lies (U) [b2]"},
{0x793a6925,229220,"True Lies (U) [b3]"},
{0xc33342ee,131072,"Turn & Burn (U) [b1]"},
{0x6bb430c1,131072,"Turrican (UE) [b1]"},
{0xc0ea387a,131072,"Turrican (UE) [b2]"},
{0x2413acaa,131072,"Twin (J) [b1]"},
{0xd8c64fda,131072,"Twin (J) [b2]"},
{0xf76abc91,262144,"Uchuu Senkan Yamato (J) [b1]"},
{0x69047717,262144,"Uchuu Senkan Yamato (J) [b2]"},
{0x8e0f77a3,131072,"Ultima - Runes of Virtue (J) [b1]"},
{0xf658649e,131072,"Ultima - Runes of Virtue (J) [b2]"},
{0x1a10bf8a,262144,"Ultima - Runes of Virtue 2 (J) [b1]"},
{0xe8092061,131072,"Ultra Golf (U) [b1]"},
{0x3bdfd160,131072,"Ultra Golf (U) [b2]"},
{0x27984a3f,131072,"Ultraman (J) [b1]"},
{0xeafed9fa,262144,"Ultraman Gekiden (J) [S][b1]"},
{0x8bd00e25,262144,"Ultraman Gekiden (J) [S][b2]"},
{0xeb3d7e53,262144,"Undercover Cops (J) [b1]"},
{0x71c68c45,262144,"Undoukai (J) [b1]"},
{0x1f9f4669,262144,"Undoukai (J) [b2]"},
{0x61171087,262144,"Undoukai (J) [b3]"},
{0x19edfd96,262144,"Undoukai (J) [b4]"},
{0xeff37c83,131072,"Uno 2 - Small World (J) [S][b1]"},
{0x51181cc1,131072,"Vattle Guice (J) [b1]"},
{0x416c86e1,262144,"Velious II (J) [b1]"},
{0xef327af9,262144,"Velious II (J) [b2]"},
{0x350f459d,131072,"Versus Hero (J) [b1]"},
{0x0a6ae533,196608,"Viking Child (U) [b1]"},
{0x81b9841d,32768,"Volley Fire (J) [b1]"},
{0x6ef82dd3,262144,"V-Rally - Championship Edition (E) (M3) [b1]"},
{0xb27cab4e,262144,"Wario Blast (U) [S][b1]"},
{0xcbe2515e,1048576,"Warioland 2 (UE) [S][b1] (MBC1 hack)"},
{0xc7778b77,1048576,"Warioland 2 (UE) [S][b1]"},
{0xb89343ae,131072,"Wave Race (UE) [b1]"},
{0x3e196f11,98304,"Wayne's World (U) [b1]"},
{0xe8126d0c,262144,"Wayne's World (U) [b2]"},
{0xc4459071,262144,"Wayne's World (U) [b3]"},
{0xb6c5582b,131072,"Wheel of Fortune (Gluecksrad) (G) [b1]"},
{0xd5d2333d,131072,"Wheel of Fortune (Gluecksrad) (G) [b2]"},
{0x1be6cbb3,131072,"Wheel of Fortune (U) [b1]"},
{0x7fe9b63d,131072,"Who Framed Roger Rabbit (U) [b1]"},
{0xbba7e6e8,262144,"Wizardry Gaiden 1 - Suffering of the Queen (J) [b1]"},
{0xd8e5f348,262144,"Wizardry Gaiden 1 - Suffering of the Queen (J) [b2]"},
{0xb54274a3,131072,"World Beach Volleyball 1991 GB Cup (J) [b1]"},
{0x7427e4a3,131072,"World Circuit Series (U) [b1]"},
{0xf98f0b68,131072,"World Cup (J) [b1]"},
{0xeed443b5,131072,"World Cup (J) [b2]"},
{0x25778e71,262144,"World Cup USA '94 (UE) [b1]"},
{0x8f9bc273,524288,"World Heroes 2 Jet (U) [S][b1]"},
{0xb2560f55,524288,"World Heroes 2 Jet (U) [S][b2]"},
{0x83872104,524288,"World Heroes 2 Jet (U) [S][b3]"},
{0x6100426d,285795,"World Heroes 2 Jet (U) [S][b4]"},
{0x32417ec5,262144,"Worms (U) [b1]"},
{0x7151cea7,262144,"Worms (U) [b2]"},
{0x8e1b4a13,32768,"WOW Super Gameboy Peep-Show (PD) [b1]"},
{0x8eea057a,262144,"WWF Raw (U) [b1]"},
{0xae0c85fc,131072,"WWF Superstars (UE) [b1]"},
{0xf34e35e6,131072,"WWF Superstars (UE) [b2]"},
{0xc7eeb57a,262144,"WWF Warzone (U) [b1]"},
{0xe9dd3cc5,262144,"Yaiba (J) [b1]"},
{0x5a7471d1,262144,"Yaiba (J) [b2]"},
{0x4c09ab1d,262144,"Yaiba (J) [b3]"},
{0x7873454e,131072,"Yogi Bear in Yogi Bear's Goldrush (E) [b1]"},
{0xc3ee1a4c,131072,"Yogi Bear in Yogi Bear's Goldrush (E) [b2]"},
{0xf5568b8c,131072,"Yogi Bear in Yogi Bear's Goldrush (E) [b3]"},
{0xb2694517,131072,"Yogi Bear in Yogi Bear's Goldrush (E) [b4]"},
{0x988b5ab7,65536,"Yoshi (U) [b1]"},
{0xb2151edc,131072,"Yoshi's Cookie (U) [b1]"},
{0x6f365098,262144,"Yuuyuu 1 (J) [b1]"},
{0x6b0ae80d,524288,"Z - Miracle of the Zone, The (J) [S][b1]"},
{0x2625b02b,524288,"Z - Miracle of the Zone, The (J) [S][b2]"},
{0x49d44022,131072,"Zen Intergalactic Ninja (E) [b1]"},
{0x0157060b,65536,"Zoop (U) [b1]"},
{0x6e844f2b,262144,"Pac-In-Time (U) [S][b1]"},
{0xef791197,131072,"Alien vs Predator - The Last of His Clan (U) [b1]"},
{0x75cdd7e3,131072,"Brain Drain (E) [S][b1]"},
{0x9cede622,262144,"Hammerin' Harry - Ghost Building Company (U) [b3]"},
{0x85df6bd8,131072,"Itchy & Scratchy - Minature Golf Madness (U) [b2]"},
{0x84589266,524288,"Legend of the River King (U) [S][b2]"},
{0xcacfe686,131072,"Maru's Mission (U) [b2]"},
{0x56189fe1,524288,"Nectaris (J) [S][b1][T-Eng_transBRC]"},
{0xc2726f3f,262144,"Puro Stadium '91 (Pro Yakyu Stadium '91) (J) [b1]"},
{0xe5eaebb5,262144,"Spirou (U) (M4) [S][b1]"},
{0x03cf9702,131072,"Super Kick Off (U) [b1]"},
{0x905e8cb7,131072,"Tensai Bakabon (J) [b1]"},
{0x26b8cd85,131072,"WCW Main Event (U) [b1]"},
{0x351a8615,262144,"Mortal Kombat 3 (U) [b2]"},
{0x1eae0e10,524288,"Harvest Moon GB (U) [S][!]"},
{0xe0cd811a,32768,"128-in-1 Menu (1993) (Unl) [a1]"},
{0x11c6229f,131072,"128-in-1 Menu (1993) (Unl)"},
{0x1d0f279c,131072,"2nd Space (Game 2 of Sachen 4-in-1 Volume 6) (Unl) [!]"},
{0xb61cd120,131072,"3 Choume no Tama - Tama & Friends (J)"},
{0xcafe0d2b,65536,"3 Pun Yosou - Umaban Club (J)"},
{0x0e0216e6,131072,"4-in-1 Funpak (UE) [!]"},
{0x75004583,32768,"55 Game HK (Unl) [p1]"},
{0xe3c8b0c0,524288,"8-in-1 (Sachen) (Unl)"},
{0x7ff546df,262144,"Ace Striker (J)"},
{0x28fa451e,131072,"Addams Family, The (E) (M3) [!]"},
{0x4c749c14,131072,"Addams Family, The (J) [!]"},
{0xc170a732,131072,"Addams Family, The (U)"},
{0x64f4fa44,131072,"Adventure Island (U)"},
{0xf1071e08,131072,"Adventure Island 2 - Bikkuri Nekketou (J)"},
{0x783066cf,262144,"Adventure Island 2 (UE) [!]"},
{0x176d2eeb,262144,"Adventures of Lolo (U) [S][!]"},
{0x0b9de1dc,65536,"Adventures of Pinocchio, The (U)"},
{0xdafdee3c,131072,"Adventures of Rocky and Bullwinkle, The (U) (Beta1)"},
{0x362c841c,131072,"Adventures of Rocky and Bullwinkle, The (U) (Beta2)"},
{0x74c700a4,131072,"Adventures of Rocky and Bullwinkle, The (U)"},
{0x5d461374,131072,"Adventures of Star Saver, The (U) [!]"},
{0xdfa3b28a,131072,"Aero Star (J) [!]"},
{0xf6fd275e,131072,"Aero Star (U) [!]"},
{0x776d03dc,65536,"A-Force (Game 4 of Sachen 4-in-1 Volume 6) (Unl) [!]"},
{0xc0049d77,65536,"After Burst (J)"},
{0xe82692d9,262144,"Aguri Suzuki F-1 Super Driving (J)"},
{0x5bffcc28,131072,"Ah Harimanada (J) [!]"},
{0x898609b4,262144,"Akazukin Cha-Cha (J) [S]"},
{0xaf6bdc50,262144,"Aladdin (U) [S][!]"},
{0x283c58b7,262144,"Aladdin (U) [S][a1]"},
{0x1089098f,262144,"Alfred Chicken (J) [S]"},
{0x3b9c3bc6,131072,"Alfred Chicken (U) [!]"},
{0xe59049b2,131072,"Alien 3 (J) [!]"},
{0xeffb960b,131072,"Alien 3 (U)"},
{0x583c0e4e,131072,"Alien Olympics 2044 AD (U)"},
{0xe884682b,131072,"Alien vs Predator - The Last of His Clan (J)"},
{0x4bbcf652,131072,"Alien vs Predator - The Last of His Clan (U) [!]"},
{0x5cc01586,32768,"Alleyway (JUA) [!]"},
{0x24d5f785,131072,"Altered Space (E) [!]"},
{0xce36e36e,131072,"Altered Space (J)"},
{0x141675d3,131072,"Altered Space (U)"},
{0x3011d5ca,65536,"Amazing Penguin (U) [!]"},
{0x13dd233f,131072,"Amazing Spider-Man 2, The (UE) [!]"},
{0xcbb2f22c,131072,"Amazing Spider-Man 3, The - Invasion of the Spider-Slayers (U) [!]"},
{0x2a4eafe4,65536,"Amazing Spider-Man, The (UE) [!]"},
{0xd229ac62,65536,"Amazing Tater (U)"},
{0x3be275cd,262144,"America Oudan Ultra Quiz (J) [!]"},
{0x1b3231c8,262144,"America Oudan Ultra Quiz 2 (J) [!]"},
{0x80cac37c,262144,"America Oudan Ultra Quiz 3 (J) [!]"},
{0xa76043c8,262144,"America Oudan Ultra Quiz 4 (J) [!]"},
{0x60128aa8,32768,"Amida (J)"},
{0x1132c6bb,262144,"Angel Marlowe (J)"},
{0xc2eec22f,524288,"Animal Breeder (J) [S]"},
{0x8d573f37,524288,"Animal Breeder 2 (J) [S]"},
{0x673c815d,262144,"Animaniacs (U) [S][!]"},
{0x4a486435,524288,"Another Bible (J) [S]"},
{0xb4a5936e,131072,"Ant Soldiers (Sachen) (Unl) [!]"},
{0x08727760,262144,"Aoki Densetsu Shoot (J) [S][!]"},
{0x1db65649,131072,"Aretha (J)"},
{0x086e4fc5,262144,"Aretha 2 (J)"},
{0x430d3d6b,262144,"Aretha 3 (J)"},
{0xeefe1001,32768,"Artic Zone (Game 1 of Sachen 4-in-1 Volume 5) (Unl) [!]"},
{0x097ffe2c,131072,"Asterix (UE) (M5) [!]"},
{0x8259ac54,131072,"Asteroids & Missile Command (U) [S][!]"},
{0xc1f88833,32768,"Asteroids (U)"},
{0x61e48eef,65536,"Astro Rabby (J)"},
{0x471c237b,262144,"Athena no Hatena (J)"},
{0xc4720897,131072,"Atomic Punk (U) [!]"},
{0x23068679,131072,"Attack of the Killer Tomatoes (J)"},
{0xb5b38860,131072,"Attack of the Killer Tomatoes (U) [!]"},
{0xcf2ba5f7,262144,"Avenging Spirit (U)"},
{0xda90f5fc,65536,"Ayakashi no Siro (J) [!]"},
{0x84de5363,524288,"Ayanama Discovery SlideShow (V1.1) (Unl)"},
{0xd1c3f371,131072,"Bakenoh TV (J) [S]"},
{0x4e2fffe5,131072,"Bakenoh V3 (J)"},
{0xd4b655ec,131072,"Balloon Kid (JUE) [!]"},
{0xca0ba8e6,131072,"Balloon Kid (JUE) [BF]"},
{0x1b713de0,131072,"Bamse (E) (Swedish)"},
{0x3d13ec6a,131072,"Banishing Racer (J)"},
{0x94c26cdf,131072,"Barbie - Game Girl (U)"},
{0x6eea2526,65536,"Baseball (JU) [!]"},
{0xa503cb07,131072,"Baseball Kids (J)"},
{0xd37a2fdf,131072,"Bases Loaded (U) [!]"},
{0xde459a47,131072,"Batman - Return of the Joker (J)"},
{0x5124bbec,131072,"Batman - Return of the Joker (U) [!]"},
{0x77cd0351,131072,"Batman - The Animated Series (U) [BF]"},
{0xc8e578bf,131072,"Batman - The Animated Series (U)"},
{0x6c41d3cd,131072,"Batman (JU) [!]"},
{0xc2fd6244,262144,"Batman Forever (J)"},
{0xef3592cc,262144,"Batman Forever (U) [!]"},
{0xce34cca4,524288,"Battle Arena Toshinden (E) [S]"},
{0xdde161a5,524288,"Battle Arena Toshinden (J) [S]"},
{0x2d0c1073,524288,"Battle Arena Toshinden (U) [S][!]"},
{0xd4d1aea2,131072,"Battle Bull (E) [!]"},
{0x5c69e449,131072,"Battle Bull (J)"},
{0xea4eb1a1,262144,"Battle Crusher (J) [S]"},
{0xa99242c0,131072,"Battle Dodge Ball (J)"},
{0x35914deb,131072,"Battle of Kingdom (J)"},
{0xca450e93,262144,"Battle of Olympus, The (UE) (M5)"},
{0x7c787bc4,65536,"Battle Pingpong (J)"},
{0xa828fd4f,65536,"Battle Space (J)"},
{0xa1a1fe77,131072,"Battle Unit Zeoth (J)"},
{0xe67a92b3,131072,"Battle Unit Zeoth (U) [!]"},
{0x6c292739,262144,"Battle Zone & Super Breakout (U) [S]"},
{0xa37a814a,32768,"BattleCity (J) [p1][!]"},
{0xfef62da5,65536,"Battleship (U) (GB) [!]"},
{0x7b217082,262144,"Battletoads & Double Dragon (E) (Sony Imagesoft) [!]"},
{0xa727f9cd,262144,"Battletoads & Double Dragon (U) (Tradewest)"},
{0x331cf7de,131072,"Battletoads (J)"},
{0xb0c3361b,131072,"Battletoads (U) [!]"},
{0x7ffc34ea,131072,"Battletoads in Ragnarok's World (U) (Nintendo) [!]"},
{0xce316c68,131072,"Battletoads in Ragnarok's World (U) (Tradewest)"},
{0xc28ef062,262144,"BC Kid 2 (J) [S]"},
{0x20af727a,262144,"BC Kid 2 (J) [S][BF]"},
{0xabfb84df,262144,"Beach Volleyball (J) [S]"},
{0xaf1ae123,524288,"Beavis and Butthead (U) [!]"},
{0x637e54e3,131072,"Beethoven's 2nd (U) [S]"},
{0x13713993,131072,"Beethoven's 2nd (U) [S][BF]"},
{0x33574ecb,131072,"Beetlejuice (U)"},
{0x80485fda,131072,"Berlitz French Language Translator (U)"},
{0x058eeedb,131072,"Berlitz Spanish Language Translator (U)"},
{0xad3f851d,524288,"Berutomo Kurabu (J) [S][!]"},
{0xb20280e6,262144,"Best of the Best - Championship Karate (U) [!]"},
{0x86d11d10,262144,"Bikkuri Nekketu (J)"},
{0x5e8f656a,131072,"Bill and Ted's Excellent GB Adventure (UE) [!]"},
{0x71cf43ce,131072,"Bill Elliott's NASCAR Fast Tracks (U)"},
{0xa1e55dc2,65536,"Bionic Battler (U)"},
{0x3f4d5c84,262144,"Bionic Commando (J)"},
{0xc2763e73,131072,"Bishojyo Sensi SE (J)"},
{0x2db3dace,262144,"Black Bass - Lure Fishing (U) (GB) [!]"},
{0x3d4e1779,65536,"Black Forest Tale (Game 3 of Sachen 4-in-1 Volume 6) (Unl)[!]"},
{0xf7be0002,131072,"Blades of Steel (AE) (GB) [!]"},
{0xe81c9fb9,131072,"Blades of Steel (U) (GB) [!]"},
{0x3b2c7118,131072,"Blaster Master Boy (U)"},
{0xe9f9016f,131072,"Blaster Master Jr. (E)"},
{0x54b67501,131072,"Block Kuzushi (J) [S]"},
{0x425357fb,131072,"Block Kuzushi (J) [S][BF]"},
{0x51ff6e53,65536,"Blodia (J)"},
{0xf1c0fb1d,131072,"Blues Brothers, The - Jukebox Adventure (U)"},
{0xadb66eff,131072,"Blues Brothers, The (U) [!]"},
{0x7edb78ab,131072,"Bo Jackson Hit and Run (U) [!]"},
{0x70c8c799,131072,"Boggle Plus (U) [!]"},
{0xe8335398,262144,"Boku Drakura Kun (J)"},
{0x7582ae14,131072,"Boku Drakura Kun 2 (Castlevania 2) (J)"},
{0x4825b25f,262144,"Boku Drakura Kun 3 (CV Legends) (Akumajo Dracula) (J) [S][!]"},
{0xd3e2fd02,524288,"Bokujo Monogatari GB (V1.0) (J) [S]"},
{0x2a9b916e,524288,"Bokujo Monogatari GB (V1.0) (J) [S][BF]"},
{0xda218e44,524288,"Bokujo Monogatari GB (V1.1) (J) [S]"},
{0xc2a85d91,32768,"Bomb Disposer (Game 1 of Sachen 4-in-1 Volume 6) (Unl) [!]"},
{0x9bd8815e,32768,"Bomb Jack (U)"},
{0xef9595ac,131072,"Bomber Boy (J)"},
{0xb8fe9077,131072,"Bomber King - Scenario 2 (J)"},
{0x509a6b73,1048576,"Bomberman Collection (J) [S]"},
{0x94337d56,262144,"Bomberman GB (J) [S]"},
{0x291fd094,262146,"Bomberman GB (J) [S][BF1]"},
{0x7036a955,262144,"Bomberman GB (J) [S][BF2]"},
{0xf372d175,262144,"Bomberman GB (U) [S][!]"},
{0x1ff116e5,262144,"Bomberman GB (U) [S][BF]"},
{0x6157443b,262144,"Bomberman GB 2 (J) [S]"},
{0xf658b7a7,262144,"Bomberman GB 3 (J) [S]"},
{0x07e7a85f,262144,"Bomberman GB 3 (J) [S][a1]"},
{0xf63b5c06,262144,"Bomberman GB 3 (J) [S][BF]"},
{0xa7cdbb96,262144,"Bonk's Adventure (U) [!]"},
{0x5d131d5c,262144,"Bonk's Adventure (U) [BF]"},
{0xf1344b78,262144,"Bonk's Revenge (U) [S][!]"},
{0xec83c0b6,262144,"Booby Boys (J)"},
{0xa817450d,65536,"Boomer's Adventure in ASMIK World (J)"},
{0x105bc1c0,65536,"Boomer's Adventure in ASMIK World (U)"},
{0xcaae6b11,131072,"Boomer's Adventure in ASMIK World 2 (J)"},
{0xb5b3f85b,65536,"Boulder Dash (J)"},
{0x644aec3e,65536,"Boulder Dash (U) [!]"},
{0xef7e9fa0,65536,"Boxing (JU)"},
{0xc09cee99,32768,"Boxxle (V1.1) (U) [!]"},
{0xc08e9756,32768,"Boxxle 2 (U)"},
{0x3d0bac10,65536,"Boy and His Blob, A - Fushigina Bulobi (J)"},
{0x25f82bb1,65536,"Boy and His Blob, A - Rescue of Princess Blobette (E)(Img)[!]"},
{0x8210a03f,65536,"Boy and His Blob, A - Rescue of Princess Blobette (U)(Abs)[!]"},
{0xd808752b,65536,"Boy and His Blob, A - Rescue of Princess Blobette (U)(Abs)[BF]"},
{0x8a7fb0e6,131072,"Brain Drain (E) [S]"},
{0xe558aacd,131072,"Brain Drain (J) [S]"},
{0xaff0b159,131072,"Brain Drain (U) [S][!]"},
{0xfbb1f2a1,32768,"Brainbender (U) [!]"},
{0x00cd1876,131072,"Bram Stoker's Dracula (U)"},
{0x46e9fb29,131072,"Break Thru! (U) [BF]"},
{0x5b8f0df2,131072,"Break Thru! (U)"},
{0xad9b300c,131072,"Bubble Bobble (J)"},
{0xd516841d,131072,"Bubble Bobble (U) (GB) [!]"},
{0x39e261b9,131072,"Bubble Bobble Jr. (J)"},
{0x3a98fe03,131072,"Bubble Bobble Part 2 (U) [!]"},
{0x874d0d6f,32768,"Bubble Ghost (J)"},
{0x843068fd,32768,"Bubble Ghost (U) [!]"},
{0xa973e604,131072,"Bugs Bunny - Crazy Castle II (U) [!]"},
{0x403e1b7e,65536,"Bugs Bunny (U) [!]"},
{0xd2dbea8f,262144,"Bugs Bunny Collection (V1.0) (J) [S]"},
{0x8244220b,262144,"Bugs Bunny Collection (V1.1) (J) [S]"},
{0x5a1a20f3,65536,"Burai Fighter Deluxe (J)"},
{0x3c86f5db,65536,"Burai Fighter Deluxe (UE) [!]"},
{0x88219a49,65536,"Burger Time Deluxe (JU) [!]"},
{0x88f8c991,131072,"Burning Paper (J)"},
{0xb94724e6,131072,"Bust-a-Move 2 (U)"},
{0xe555c612,131072,"Bust-a-Move 3 (U)"},
{0xb4245ca3,131072,"Buster Brothers (U)"},
{0x9234eeab,65536,"Ca Da (J)"},
{0xa6c98122,65536,"Cadillac 2 (J)"},
{0x000aaa74,131072,"Caesar's Palace (J)"},
{0xd9f901a9,131072,"Caesar's Palace (U)"},
{0x8042afc5,262144,"Capcom Quiz (J)"},
{0x6b4fefb0,131072,"Captain Knick-Knack (Sachen) (Unl) [!]"},
{0x33a1e1cf,524288,"Captain Tsubasa (J) [S][!]"},
{0xa795e851,262144,"Captain Tsubasa VS (J)"},
{0xd05f4c90,65536,"Card Game (J)"},
{0x2a25e4d2,131584,"Casino Funpak (U) [!]"},
{0xe4b30634,131072,"Casper (U) (Bonsai Software) [S]"},
{0xe67a10e1,131072,"Casper (U) (Natsume) [!]"},
{0x2f752404,32768,"Castelian (E) [!]"},
{0xf2d739e4,32768,"Castelian (U)"},
{0x2f8aaf6f,131072,"Castle Quest (U) [!]"},
{0xe89eac54,262144,"Castlevania - Legends (G) [S]"},
{0xad9c17fb,262144,"Castlevania - Legends (U) [S]"},
{0x8875c8fe,131072,"Castlevania 2 - Belmont's Revenge (U) [!]"},
{0x216e6aa1,65536,"Castlevania Adventure, The ('89) (U) [!]"},
{0x6977c265,65536,"Castlevania Adventure, The ('91) (UE) [!]"},
{0xadb96150,32768,"Catrap (U) [!]"},
{0x44256a2f,131072,"Cave Noire (J)"},
{0x245afcdc,32768,"Centipede (E) (Accolade) [!]"},
{0xe957014f,131072,"Centipede (U) (Majesco)"},
{0xaa920298,65536,"Chacha Maru Panic (J)"},
{0x9dfd4bc0,131072,"Chachamaru Boukenki 3 - Abyss no Tou (J)"},
{0x59579caa,32768,"Challenger GB BIOS (Unl) [!]"},
{0x74d50b47,524288,"Chalvo 55 - Super Puzzle Action (J)"},
{0xef02beb6,131072,"Championship Pool (UE) [!]"},
{0xc58bb4f5,131072,"Chase HQ (J)"},
{0x0c1d2b68,65536,"Chessmaster, The (V1.0) (UE) [!]"},
{0x59ed370c,65536,"Chessmaster, The (V1.1) (UE) [!]"},
{0x886049f9,131072,"Chibi Maruko Chan - Maruko Deluxe Gekijou (J) [S]"},
{0xeab175ff,65536,"Chibi Maruko Chan - Okozukaidaisakusen (J)"},
{0xabff3314,131072,"Chibi Maruko Chan 2 - Deluxe Maruko World (J)"},
{0x44e933c8,131072,"Chibi Maruko Chan 3 - Mezase! Game Taishou no Maki (J)"},
{0xe55138be,131072,"Chibi Maruko Chan 4 - Korega Nihon Dayo Ouji Sama (J)"},
{0xeb33f601,32768,"Chiki Chiki Tengoku (J)"},
{0x7e40044a,131072,"Chiki Race (J) [!]"},
{0xb526a116,1048576,"Chinese Fighter (J) [S]"},
{0x7a102366,1048576,"Chinese Fighter (J) [S][BF]"},
{0x5109f484,131072,"Choplifter 2 (J)"},
{0x5e2e4e19,131072,"Choplifter 2 (U) (JVC - Broderbund)"},
{0x9c7d5e79,131072,"Choplifter 2 (U) (LucasArts - Broderbund)"},
{0x1b3b46ef,131072,"Choplifter 3 (UE) [!]"},
{0xc5951d9e,131072,"Chuck Rock (U) [!]"},
{0xe4271f4b,262144,"Chuugaku Eijukugo 350 (J)"},
{0xd3168eca,262144,"Chuugaku Eitango 1700 (J)"},
{0xaa133439,131072,"Cliffhanger (U)"},
{0x5f466d56,1048576,"Cokemon V0.8 (Pokemon Blue Hack)"},
{0x0627029c,1048576,"Cokemon V1.3 (Pokemon Blue Hack)"},
{0xa549a572,524288,"College Slam (U) [!]"},
{0xcde6de15,131072,"Contra - The Alien Wars (J)"},
{0xf1c81eb0,131072,"Contra - The Alien Wars (U) [S][!]"},
{0x7fc22df5,131072,"Contra Spirits (J) [S][!]"},
{0xe045b886,32768,"Cool Ball (E) [!]"},
{0x0ef6c31d,131072,"Cool Spot (U) [BF]"},
{0x1987eacc,131072,"Cool Spot (U)"},
{0xa193c0d0,131072,"Cool World (U)"},
{0x80b21df1,131072,"Cosmo Tank (J)"},
{0x2e767d25,131072,"Cosmo Tank (U)"},
{0x2699942c,131072,"Crayon Shin Chan (J)"},
{0xca6e0be0,131072,"Crayon Shin Chan 2 (J)"},
{0x24a12807,131072,"Crayon Shin Chan 3 - Ora no Gokigen Athletic (J)"},
{0x37d4aa8c,131072,"Crayon Shin Chan 4 (J) [S]"},
{0xdc723a9e,262144,"Crayon Shin Chan 5 (J) [S]"},
{0xcd6e3136,65536,"Crazy Burger (Sachen) (Unl) [!]"},
{0x51300cfd,32768,"Crystal Quest (U)"},
{0xc3eb82ef,262144,"Cult Master - Ultraman ni Miserarete (J)"},
{0xeebdd360,262144,"Cutthroat Island (U)"},
{0x72b42ea7,131072,"Cyber Formula GPX (J)"},
{0x9d00da55,65536,"Cyraid (U) [!]"},
{0xb6b51fce,32768,"Daedalean Opus (U)"},
{0x798d9489,262144,"Daffy Duck - The Marvin Missions (J) [S]"},
{0x13dd647d,131072,"Daffy Duck - The Marvin Missions (UE) [!]"},
{0xc47671f3,262144,"Daffy Duck - The Marvin Missions (UE) [S][!]"},
{0xc8f80d90,131072,"Daisenryaku Hiro (J)"},
{0xaabc00f6,32768,"Dan Laser (Sachen) (Unl) [!]"},
{0xff858da9,131072,"Darkman (U)"},
{0x238b9646,131072,"Darkwing Duck (U) [!]"},
{0x97be9341,65536,"Daruman Busters (J) [BF]"},
{0xa66f5c02,65536,"Daruman Busters (J)"},
{0xa8301bdd,65536,"Dead Heat Scramble (J)"},
{0x9e3e3656,65536,"Dead Heat Scramble (U)"},
{0x44e97af9,65536,"Deep - Final Mission (Sachen) (Unl) [!]"},
{0x1c829ce3,131072,"Defender-Joust (U) [S]"},
{0x896a30a8,131072,"Dennis (the Menace) (E) [!]"},
{0x7eb0cd32,131072,"Dennis the Menace (U) [!]"},
{0xb700f7f7,262144,"Desert Strike - Return to the Gulf (E) (Ocean) [S]"},
{0x6a702c32,262144,"Desert Strike - Return to the Gulf (U) (Malibu) [S][!]"},
{0x3945bc0d,262144,"Detective Conan (J) [S]"},
{0x1dc5c31a,262144,"Detective Conan 2 (J) [S]"},
{0x659e2283,65536,"Dexterity (U) [!]"},
{0xa308b86b,131072,"Dick Tracy (U)"},
{0x478f573c,262144,"Die Maus (E) (M4)"},
{0x6c742478,131072,"Dig Dug (U) [!]"},
{0x3f0aafec,262144,"Dino Breeder (V1.0) (J) [S]"},
{0x5b289ab4,262144,"Dino Breeder (V1.1) (J) [S]"},
{0x05a3ab7a,524288,"Dino Breeder 2 (J) [S]"},
{0x43af45b1,131072,"Dirty Racing (J)"},
{0xe285cf30,524288,"Disney's Mulan (U) [S]"},
{0xfb291e78,262144,"DMG Gariba Boui (J) [S]"},
{0x7eaf671a,131072,"Dodge Ball (J)"},
{0xf58dc358,131072,"Dodge Boy (J)"},
{0xba595897,262144,"Dodge Danpei (J)"},
{0xedab3378,524288,"Donkey Kong (V1.0) (JU) [S][!]"},
{0xf777a5d8,524288,"Donkey Kong (V1.1) (JU) [S][!]"},
{0x9aeca05c,524288,"Donkey Kong Land (J)"},
{0x49dc0d37,524288,"Donkey Kong Land (U) [S][!]"},
{0x2827e5d4,524288,"Donkey Kong Land 2 (UE) [S][!]"},
{0xb40c159c,524288,"Donkey Kong Land 3 (U) [S][!]"},
{0xa42524a3,131072,"Doraemon (J)"},
{0x843bd5bc,131072,"Doraemon 2 (J)"},
{0xb368e717,262144,"Doraemon DX 10 (J) [S]"},
{0xdd4e588f,262144,"Doraemon Kart (J) [S]"},
{0xa35b9ef5,65536,"Dorakyura Densetsu (Castlevania Adventure) (J)"},
{0xa0645e8a,131072,"Double Dragon (J)"},
{0x40a8bf12,131072,"Double Dragon (U) [!]"},
{0x5b96e474,131072,"Double Dragon 2 (U)"},
{0xfc970aef,131072,"Double Dragon 3 (U) [!]"},
{0xee28749d,131072,"Double Dribble - 5 on 5 (U) [!]"},
{0x252c32b5,131072,"Double Yakuman (J)"},
{0xa3d77a55,131072,"Double Yakuman 2 (J)"},
{0x34ac7268,131072,"Double Yakuman Jr (J)"},
{0x3d04b8e7,131072,"Dr. Franken (J)"},
{0xd409375b,131072,"Dr. Franken (U) [!]"},
{0xf13a60b8,262144,"Dr. Franken (U) [a1]"},
{0x0d62473d,262144,"Dr. Franken II (UE) (M7) [!]"},
{0x10c98dd1,32768,"Dr. Mario (V1.0) (JU) [!]"},
{0xf0225dd0,32768,"Dr. Mario (V1.1) (J)"},
{0x38da46d7,262144,"Dragon Ball Z - Goku Hishouden (J) [S]"},
{0xff3c027d,524288,"Dragon Ball Z Goku 2 (J) [S]"},
{0x8d089356,524288,"Dragon Heart (F)"},
{0x5129a518,524288,"Dragon Heart (U) [!]"},
{0x308a2465,32768,"Dragon Slayer (J)"},
{0x10dcbdc3,131072,"Dragon Slayer 2 (Dorasure Gaiden) (J) [!]"},
{0x1d1155af,131072,"Dragon Tail (J)"},
{0x00a14889,131072,"Dragon's Lair - The Legend (E) (Elite Systems) [!]"},
{0x7a38b5c3,131072,"Dragon's Lair - The Legend (U) (CSG Imagesoft) [!]"},
{0x73c994a0,131072,"Dragon's Lair (J)"},
{0x6cb45fc6,32768,"Dropzone (U) (GB)"},
{0xd25f3b3c,131072,"Duck Adventures (Game 4 of Sachen 4-in-1 Volume 1) (Unl) [!]"},
{0x5b5410f5,65536,"Duck Tales (J)"},
{0xac6483dc,65536,"Duck Tales (U) (Nintendo of America) [!]"},
{0x2bbbb54d,65536,"Duck Tales (U) (Nintendo) [!]"},
{0x169b00c1,131072,"Duck Tales 2 (E)"},
{0x2b693cde,131072,"Duck Tales 2 (J)"},
{0xb151509d,131072,"Duck Tales 2 (U) [!]"},
{0x11be4b45,131072,"Dungeonland (J)"},
{0x8f3e7f95,65536,"DX Baken Oh (J) [!]"},
{0xfadfd0f6,131072,"DX Bakenoh Z (V1.1) (J)"},
{0x9677d157,131072,"Dynablaster (E) [!]"},
{0x259ff267,262144,"Earthworm Jim (U) [!]"},
{0xcb89108f,262144,"Earthworm Jim (U) [a1]"},
{0xca20c594,262144,"Eijukugo Target 1000 (J)"},
{0x9c0d14c3,262144,"Eitango Center 1500 (J)"},
{0xf8406560,262144,"Eitango Target 1900 (J)"},
{0xb749a927,65536,"Elevator Action (U) [!]"},
{0xf54158a6,131072,"Elite Soccer (U) [S]"},
{0x800226a9,262144,"Exchanger (J) [S]"},
{0xe5541ff5,32768,"Explosive Brick '94 (Sachen) (Unl) [!]"},
{0x19608641,131072,"Extra Bases! (U) [!]"},
{0xfac1f53b,65536,"F-1 Boy (J) [!]"},
{0x9054413f,131072,"F-1 Race (G) [!]"},
{0x7e4febdf,131072,"F-1 Race (V1.0) (JUE) [!]"},
{0xab83bd70,131072,"F-1 Race (V1.1) (JUE) [!]"},
{0xf9e08783,131072,"F-1 Spirit (J) [!]"},
{0x045dee8c,131072,"F-15 Strike Eagle (U) [!]"},
{0x7d890cd0,131072,"Faceball 2000 (U) [!]"},
{0xcdfd660a,131072,"Fairy Tale's Club (J)"},
{0xd6ef1450,131072,"Family Jockey (J)"},
{0x0325e729,131072,"Family Jockey 2 (J)"},
{0x3d3c059e,131072,"Famista (J)"},
{0x241a6e4c,131072,"Famista 2 (J)"},
{0xbdc4ccc3,262144,"Famista 3 (J)"},
{0x59285f0a,131072,"Fastest Lap (JU) [!]"},
{0x8d1a9b16,131072,"Felix the Cat (U) [BF]"},
{0xf53f7f00,131072,"Felix the Cat (U)"},
{0xa7bdfec8,131072,"Ferrari - Grand Prix Challenge (J)"},
{0x954d2724,131072,"Ferrari - Grand Prix Challenge (U) [BF]"},
{0x87d0637b,65536,"Ginga (J)"},
{0xed6771db,131072,"Ferrari - Grand Prix Challenge (U) [!]"},
{0xffd4a9e3,262144,"Fidgetts, The (J)"},
{0xb3fd3e36,262144,"Fidgetts, The (UE) (M7) [!]"},
{0xe5989908,524288,"FIFA International Soccer (U) [S]"},
{0xce2eae31,524800,"FIFA Soccer '97 (U) [S]"},
{0xcdf6a5ac,524288,"FIFA Soccer '98 (U) [S]"},
{0x723eb882,131072,"Fighbird GB (J) [a1]"},
{0x4dafb6a9,131072,"Fighbird GB (J)"},
{0x52678ae8,131072,"Fighting Simulator 2-in-1 (Flying Warriors) (U) [!]"},
{0xa6b6e233,524288,"Final Fantasy 4 (Unl) (Chinese)"},
{0x18c78b3a,262144,"Final Fantasy Adventure (U) [!]"},
{0x8046148f,131072,"Final Fantasy Legend (Sa-Ga) (U) [!]"},
{0x58314182,262144,"Final Fantasy Legend II (Sa-Ga 2) (U) [!]"},
{0x3e454710,262144,"Final Fantasy Legend III (Sa-Ga 3) (U) [!]"},
{0xe94a6942,65536,"Final Reverse (J)"},
{0x275947f5,65536,"Fire Dragon (J) (Chinese)"},
{0xdc1f9237,131072,"Fire Fighter (U) [BF]"},
{0xc46bbd49,131072,"Fire Fighter (U)"},
{0x4b929719,65536,"Fish Dude (U)"},
{0x9a84b6cf,131072,"Fist of the North Star (U) [!]"},
{0x3b6cdda4,32768,"Flappy Special (J)"},
{0x6deb1f06,131072,"Flash, The (U) [!]"},
{0x71bf3256,262144,"Fleet Commander VS (J)"},
{0x508282d0,131072,"Flintstones, The - King Rock Treasure Island (U)"},
{0x503d3613,262144,"Flintstones, The (U) [!]"},
{0x198f147d,32768,"Flipull (J)"},
{0xa2f30b4b,32768,"Flipull (U) [!]"},
{0xe98fa051,262144,"Flipull (Unl) [p1]"},
{0xae6ad4c8,262144,"Flipull (Unl) [p2]"},
{0x6e659690,131072,"Football International (U)"},
{0x860ea816,262144,"Foreman for Real (J)"},
{0x77083ae0,262144,"Foreman for Real (U) [!]"},
{0x9a494ae6,524288,"Frank Thomas' Big Hurt Baseball (U) [!]"},
{0x10713b07,524288,"Frank Thomas' Big Hurt Baseball (U) [BF]"},
{0x0bef84a1,131072,"Frisky Tom (J) [S]"},
{0xca436939,65536,"Frommer's Personal Organizer (U)"},
{0x40242e35,262144,"Frommer's Travel Guide (U) [!]"},
{0xbfd87aa4,65536,"Funny Field (J)"},
{0x86f45343,131072,"Funpack 4-in-1 (JU)"},
{0x018b4a02,131072,"Funpack 4-in-1 Vol. 2 (JU)"},
{0x2962afb4,524288,"Furai no Siren (J) [S]"},
{0x150bc291,65536,"G1 King - 3 Biki no Yosouya (J)"},
{0xd06b3f8a,131072,"Galaga & Galaxian (E) [S][!]"},
{0x532036d5,131072,"Galaga & Galaxian (J) [S]"},
{0x6a6ecfec,131072,"Galaga & Galaxian (U) [S]"},
{0x53dcf5da,131072,"Galaga & Galaxian (U) [S][BF]"},
{0x96ecc1e0,262144,"Game & Watch Gallery (E) [S][!]"},
{0x99b2fe79,262144,"Game & Watch Gallery (V1.0) (U) [S]"},
{0x9e6cdc96,262144,"Game & Watch Gallery (V1.1) (U) [S][!]"},
{0x9359a183,524288,"Game & Watch Gallery 2 (J) [S]"},
{0xd2d6ee5b,1048576,"Game & Watch Gallery 2 (U) [S]"},
{0xcacb6d23,32768,"Game Genie (Unl)"},
{0xb0074acb,32768,"Game of Harmony, The (U)"},
{0x09f53d55,262144,"Game of Life, The - Jinsei Game (J) [S]"},
{0xd6909596,131072,"Game Shark (Unl)"},
{0x4640909f,1048576,"Gameboy Camera (UEA) [S][!]"},
{0xa1a3f786,1048576,"Gameboy Camera Gold - Zelda Edition (U) [S]"},
{0xa93e125b,262144,"Gameboy Gallery (J) [S]"},
{0x263fd152,131072,"Gameboy Gallery (U) [S]"},
{0x6b09508f,262144,"Gameboy Gallery 2 (A) [S][!]"},
{0x5691f050,32768,"Gameboy Smart Card (CCL dumper) (Unl) [a1]"},
{0x2d4ab235,33280,"Gameboy Smart Card (CCL dumper) (Unl) [a2]"},
{0x3ded272e,32768,"Gameboy Smart Card (CCL dumper) (Unl) [S]"},
{0x10e413e6,4096,"Gameboy Smart Card (CCL dumper) (Unl)"},
{0xff709f3e,262144,"Gameboy Wars (J)"},
{0x94563424,524288,"Gameboy Wars Turbo (J) [S]"},
{0x86d04bfb,262144,"Gameboy Wars Turbo (J) [S][a1]"},
{0x62769ec1,262144,"Gamera - Daikai Jukutyu Kessen (J) [S]"},
{0xb85d4bd8,262144,"Gamera - Daikai Jukutyu Kessen (J) [S][BF]"},
{0x33261c11,262144,"Ganbare Goemon (J)"},
{0x910afe24,262144,"Ganbare Goemon 2 (J) [S]"},
{0x6226d280,131072,"Ganbaruga (J)"},
{0x6a043abd,131072,"Garfield Labyrinth (U)"},
{0x0030e61f,131072,"Gargoyle's Quest - Ghosts'n Goblins (UE) [!]"},
{0xfe19069a,131072,"Gargoyle's Quest - Ghosts'n Goblins (UE) [BF]"},
{0x1907dac5,262144,"Gauntlet II (U)"},
{0x147e82ae,524288,"Gawa no Kawanushi 3 (J) [S]"},
{0xd9b24d21,131072,"GB Basketball (Tip-Off) (J)"},
{0x1e8808d1,32768,"GB Gamejack 16M (Unl) (GB)"},
{0x31728038,2097152,"GB Gamejack 16M Test (Unl)"},
{0x60c4c47f,32768,"GB Gamejack 16M V2.00 (Unl)"},
{0x5236e5f7,32768,"GB Gamejack 64M (Unl) (GB)"},
{0x690227f6,262144,"GB Genjin (Bonk) (J) [!]"},
{0x6f7ad5d9,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][!]"},
{0xa4a9f1ff,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][BF]"},
{0xb2eedd36,1048576,"GB Genjin Collection (J) [S]"},
{0x02029dca,1048576,"GB Genjin Collection (J) [S][a1]"},
{0xb08bb116,262144,"GB Genjin Land - Viva Chikkun Oukoku (J) [!]"},
{0xa2e210e9,131072,"GB Pachislot Hissyouhou Jr. (J)"},
{0x92ce5a8a,131072,"GB Taruru-To 2 (J) [BF]"},
{0xb2b72056,131072,"Gear Works (U) [!]"},
{0xa64a8710,65536,"Gem Gem (J)"},
{0x95e8fcb1,262144,"Genjin Cottu (J) [S]"},
{0x70819e03,262144,"Gensan 2 (J)"},
{0x74a52399,262144,"Gensan Quiz (J)"},
{0x7f62456b,131072,"George Foreman Boxing (U) [!]"},
{0x8f2bf517,262144,"Getaway, The (U)"},
{0x69b161bc,131072,"Ghostbusters 2 (J)"},
{0x5821ecd4,131072,"Ghostbusters 2 (UE) [!]"},
{0x61d80946,262144,"Go Go Ackman (J) [S]"},
{0x845735de,524288,"Go Go Hitchike (J) [S]"},
{0x5e4e030f,65536,"Go Go Tank (J) [BF]"},
{0x30ae39b6,65536,"Go Go Tank (J)"},
{0x65dfabcb,65536,"Go Go Tank (U) [!]"},
{0x2a4a2d2b,131072,"Go! Go! Kid (J)"},
{0x533fa979,131072,"Goal! (with Ireland) (E)"},
{0x00d4caf2,131072,"Goal! (with Venezuela) (U) [!]"},
{0xa1b29ab8,262144,"God Medicine (J)"},
{0x847e0772,524288,"God Medicine FB (J) [S]"},
{0xed204600,131072,"Godzilla (J)"},
{0xfe4f80b7,131072,"Godzilla (U) [!]"},
{0xc529a96a,262144,"Gojira (GB Godzilla) (J)"},
{0x6ed10383,131072,"Golf (JUA) [!]"},
{0xa6dadb1e,262144,"Golf Classic (U) [S]"},
{0x24cfcffa,524288,"Golf Classic (U) [S][BF]"},
{0xd03e59aa,65536,"Gourmet Paradise (U)"},
{0x90f87d57,262144,"Gradius - The Interstellar Assault (U)"},
{0x8c5dee4d,65536,"Grand Prix (Sunsoft) (UE) [!]"},
{0xc4cbf6b1,262144,"Great Greed (U) [!]"},
{0x3579e297,131072,"Gremlins 2 (JUE) [!]"},
{0xe97f2e9a,524288,"Gurander Musashi RV (J) [S]"},
{0x5e4a61d3,131072,"Hal Wrestling (U) [!]"},
{0xb02faa0b,131072,"Hal Wrestling (U) [a1]"},
{0x9e0d2b45,262144,"Hammerin' Harry - Ghost Building Company (Gensan) (J)"},
{0x9f09afe8,262144,"Hammerin' Harry - Ghost Building Company (U)"},
{0x0b467683,65536,"Hatris (U) [BF]"},
{0x7635f28b,65536,"Hatris (U)"},
{0x60727bf9,524288,"Hayaosi Kuizu - The King of Quiz (J) [S]"},
{0x78830daf,65536,"Head On (J)"},
{0x1526a96b,65536,"Heavyweight Championship Boxing (U) [!]"},
{0x08bf29c9,32768,"Heiankyo Alien (J) [p1][!]"},
{0x1495bbe5,32768,"Heiankyo Alien (U) [!]"},
{0x00a9001e,524288,"Hercules (U) [S]"},
{0x4f8a61bf,262144,"Hercules Eikou (J)"},
{0x6b17abe5,131072,"High Stakes Gambling (U) [!]"},
{0x41c17421,262144,"Hinsyutu Eibunpo (J)"},
{0x8ee95e0b,131072,"Hiryu Gaiden (J)"},
{0x2c77f399,131072,"Hit the Ice (UE) [!]"},
{0x59db5e75,131072,"Hitoride Dekirumon - Cooking Densetsu (J)"},
{0xc2c2ad19,131072,"Hoi Hoi - Gameboy Ban (J)"},
{0xe4b4febc,131072,"Hokuto no Ken - Fist of the North Star (J)"},
{0x7c3f3107,131072,"Home Alone (J)"},
{0x8efc8434,131072,"Home Alone (U) [!]"},
{0x4e305fb8,131072,"Home Alone (U) [BF]"},
{0xe8e430f1,131072,"Home Alone 2 (U) [!]"},
{0x6c407eed,65536,"Hon Shougi (J) [S]"},
{0x5ad83d68,32768,"Hong Kong (J)"},
{0x0d255d59,262144,"Honmei Boy (J)"},
{0x370a2c2f,131072,"Hook (E) (Ocean) [!]"},
{0x62d8173c,131072,"Hook (J)"},
{0x6765b61b,131072,"Hook (U) (Sony Imagesoft)"},
{0x754496bb,131072,"Houghton Mifflin Spell Checker and Calculator (U) [!]"},
{0x1cb6158c,131072,"Hudson Hawk (J)"},
{0xadff7bbd,131072,"Hudson Hawk (U) [!]"},
{0x74aa5e0f,131072,"Hugo (E) [S]"},
{0x67998fa4,131072,"Hugo 2 (G) [S][!]"},
{0x1df2e81d,262144,"Humans, The (U)"},
{0x3a4636ff,524288,"Hunchback of Notre Dame, The - Topsy Turvy Games (U) [S][!]"},
{0xc2e7be35,131072,"Hunt for Red October, The (J)"},
{0x5a61ee00,131072,"Hunt for Red October, The (U) [!]"},
{0xc364d55f,262144,"Hyper Black Bass (J)"},
{0x32a81a49,262144,"Hyper Black Bass '95 (J)"},
{0x02d09ce3,131072,"Hyper Dunk (U)"},
{0xb3a86164,32768,"Hyper Lode Runner (JU) [!]"},
{0x6d4fd9aa,131072,"Ikari no Yousai 2 (Fortified Zone 2) (J) [!]"},
{0x80ac487e,131072,"In Your Face (U)"},
{0xd81c08fa,131072,"Incredible Crash Dummies, The (U) [!]"},
{0xa4e5d461,131072,"Indiana Jones and the Last Crusade (J) [BF]"},
{0x8f234f49,131072,"Indiana Jones and the Last Crusade (J)"},
{0x9189921a,131072,"Indiana Jones and the Last Crusade (UE) [!]"},
{0xcad36c69,131072,"Indiana Jones and the Last Crusade (UE) [BF]"},
{0x6cc56612,262144,"Initial D Gaiden (J) [S][!]"},
{0x94757be8,262144,"International Superstar Soccer (U) [S]"},
{0xecd61f03,262144,"Irem Fighter (J)"},
{0x8e3c7e15,131072,"Iron League (Strong Wind Chapter One) (J)"},
{0x173232e5,524288,"Ironman - X-O Manowar in Heavy Metal (U) [S][!]"},
{0x85b98a77,65536,"Ishido (U) [!]"},
{0xab367915,32768,"Ishidou (Ishido) (J) [!]"},
{0xddb147e5,131072,"Itchy & Scratchy - Minature Golf Madness (U)"},
{0x1c4d3665,262144,"Itsudemo Nyanto Wonderful (J) [S][!]"},
{0x98259257,131072,"J. Cup Soccer (J)"},
{0xcdd02f22,262144,"J. League Big Wave Soccer (J) [S]"},
{0x17608642,131072,"J. League Fighting Soccer (J)"},
{0xf0321342,262144,"J. League Live '95 (J) [S]"},
{0x91e6bf74,524288,"J. League Supporter Soccer (J) [S]"},
{0xadb46f9c,131072,"J. League Winning Goal (J)"},
{0x654988b2,131072,"Jack Nicklaus Golf (U) [!]"},
{0xca3bc3ce,524288,"James Bond 007 (U) [S][!]"},
{0x37b3d081,65536,"Jankenman (J)"},
{0x0530e1cc,65536,"Janshirou (J)"},
{0x2812036b,131072,"Janshirou 2 (J)"},
{0x04daa03b,131072,"Jantaku Boy (J)"},
{0xa1e76a33,131072,"Jeep Jamboree (U) [!]"},
{0x7e6598bb,262144,"Jelly Boy (U)"},
{0x08725c79,131072,"Jeopardy (U) [!]"},
{0xe3843152,131072,"Jeopardy (U) [BF]"},
{0x3b523216,131072,"Jeopardy! - Sports Edition (U) [!]"},
{0xcd3df0c1,131072,"Jeopardy! - Teen Tournament (U) [S][!]"},
{0x6386c870,131072,"Jetsons, The (U)"},
{0x229e9113,262144,"Jida Igeki (J)"},
{0x435c4697,262144,"Jikuu Senki Mu (J)"},
{0x18671602,65536,"Jimmy Connors Tennis (J)"},
{0x9b7ebf91,65536,"Jimmy Connors Tennis (U) [!]"},
{0x590f4afc,131072,"Jinsei (J)"},
{0x9d335162,131072,"Jissen Mahjong Kyoshitsu (J) [S]"},
{0x5da86ed4,262144,"Joe & Mac (U) [!]"},
{0x3fcb174d,65536,"Jordan One-on-One (J)"},
{0xc90c5456,65536,"Jordan vs Bird (U)"},
{0x951b9907,262144,"Judge Dredd (J)"},
{0xb9d11656,262144,"Judge Dredd (U) [!]"},
{0xb64d27ee,131072,"Jungle Book. The (U) [!]"},
{0x763ababb,262144,"Jungle Strike (U)"},
{0x2ad46ac7,262144,"Jungle Wars (J)"},
{0x391f532a,524288,"Jurassic Park - Lost World, The (U) [S]"},
{0xb350bedf,262144,"Jurassic Park (U) [!]"},
{0xaf3d2e95,262144,"Jurassic Park 2 - The Chaos Continues (UE) [S][!]"},
{0x665fee83,524288,"Jurassic Park 3 (V1.1) (Unl) (Chinese) [BF]"},
{0x83fa30d0,524288,"Jurassic Park 3 (V1.1) (Unl) (Chinese)"},
{0x943059ba,262144,"Kabuto Jump (J)"},
{0xd4319169,131072,"Kachiu Mayoso Keiba Kizoku Ex 94 (J)"},
{0xc18cd57a,524288,"Kaeruno Tameni (J)"},
{0xb6d9d6c4,131072,"Kaguyahime (J)"},
{0x82e03e10,524288,"Kandume Monster (J) [S]"},
{0xe18aedaf,524288,"Kanjiro (J) [S]"},
{0x44f5a443,262144,"Kanyoku Kotowaza 210 (J)"},
{0xfa7ea8a0,262144,"Karamucho Ziken (J) [S]"},
{0x42e8ba89,524288,"Kaseki Reborn (J) [S]"},
{0xefbc23fc,131072,"Kattobi Road (J)"},
{0xa57e1ac1,131072,"Keiba Kizoku (J)"},
{0x326273b7,131072,"KeiTai Keiba 8 Special (J)"},
{0x0a9859c1,524288,"Ken Griffey Jr. Presents Major League Baseball (U) [S][!]"},
{0x12caa1ca,65536,"Kesamaru (J)"},
{0x8056344c,262144,"Kick Boxing, The (J)"},
{0xf27294b7,262144,"Kid Dracula (U) [!]"},
{0x0c042862,131072,"Kid Icarus - Of Myths and Monsters (UE) [!]"},
{0xbc78feab,131072,"Kid Icarus - Of Myths and Monsters (UE) [BF]"},
{0xbbff21b1,65536,"Kid Niki (J) [BF]"},
{0x004443e6,65536,"Kid Niki (J)"},
{0xac793b54,524288,"Killer Instinct (U) [S][!]"},
{0x1ff84e8c,524288,"King of Fighters '95, The (U) [S][!]"},
{0xd2d648c4,65536,"King of the Zoo (J)"},
{0x920202dc,131072,"Kingdom Crusade (U)"},
{0xf3ccadc3,131072,"Kingyo Chuuihou! 2 (J)"},
{0x48c2cd38,131072,"Kinnkuman DM (J)"},
{0x47f42f42,262144,"Kira Kira Kids (J) [S]"},
{0x4bedf22c,524288,"Kirby 2 - Hoshinoka 2 (J) [S]"},
{0xdf3bbcd7,524288,"Kirby no Block Ball (J) [S]"},
{0x7ad90b4b,524288,"Kirby's Block Ball (U) [S][!]"},
{0x40f25740,262144,"Kirby's Dream Land (U) [!]"},
{0x8dc07c35,524288,"Kirby's Dream Land 2 (U) [S][!]"},
{0x21035f95,262144,"Kirby's Hoshinoka-Bi (Dream Land) (V1.0) (J)"},
{0x04342c83,262144,"Kirby's Hoshinoka-Bi (Dream Land) (V1.1) (J)"},
{0x8b44fb7d,262144,"Kirby's Pinball Land (J)"},
{0x31cb6526,262144,"Kirby's Pinball Land (U) [!]"},
{0x91300898,262144,"Kirby's Star Stacker (U) [S][!]"},
{0x28e507b0,262144,"Kitarou (J) [S]"},
{0x909937cb,131072,"Kitchin Panic (J)"},
{0x13c9c5ff,262144,"Kiteretu Zyuraki (J) [BF]"},
{0xd53548b0,262144,"Kiteretu Zyuraki (J)"},
{0xb4955889,32768,"Klax (J) (GB)"},
{0x72660774,65536,"Klax (U) (GB) [!]"},
{0xc6f24d2f,131072,"Knight Quest (J)"},
{0xdf50f477,131072,"Knight Quest (U)"},
{0xf3e1e652,32768,"Koi Wa Kakehiki (J)"},
{0x53ff8041,524288,"Kokiatsu Boy (J) [S]"},
{0x8e367457,131072,"Konami Basketball (J)"},
{0x992cd78f,524288,"Konami Collection 1 (J) [S]"},
{0xc3b318cd,524288,"Konami Collection 2 (J) [S]"},
{0x1de9caf9,524288,"Konami Collection 3 (J) [S]"},
{0x3a43ea33,524288,"Konami Collection 4 (J) [S]"},
{0x0fdc9fb1,131072,"Konami Golf (E)"},
{0xd14dee07,131072,"Konami Ice Hockey (J)"},
{0xc16d4db2,131072,"Konami Golf (J)"},
{0x5721e7d6,131072,"Konami Sports (J)"},
{0xf6b3e291,524288,"Konchu Hakase (V1.0) (J) [S]"},
{0x05753790,524288,"Konchu Hakase (V1.1) (J) [S]"},
{0x39608c31,32768,"Korodice (J)"},
{0x84e30e6c,262144,"Koukou Nyuushi Deru Jun - Kanji Mondai no Seifuku (J)"},
{0x70468755,262144,"Koukou Nyuushi Rika - Anki Point 250 (J)"},
{0xf01d0b87,262144,"Kumano Putaru (J) [S]"},
{0xb77ac17b,65536,"Kung-Fu Master (Spartan X) (U) [BF]"},
{0x3340e600,65536,"Kung-Fu Master (Spartan X) (U)"},
{0x25b21acc,131072,"Kunio (J)"},
{0x21c98af2,32768,"Kwirk (UA) [!]"},
{0xe158d4db,32768,"Kyorchan Land (Hiro) (J)"},
{0x8059bc15,65536,"Kyoudai Jingi (Splitz) (J)"},
{0x675e1309,131072,"Lamborghini American Challenge (U) [!]"},
{0x10499af6,131072,"Last Action Hero (U)"},
{0xfe9dd4c0,262144,"Last Bible (J)"},
{0x52e15ff2,262144,"Last Bible 2 (J) [f1]"},
{0xf8e519d9,262144,"Last Bible 2 (J)"},
{0x134f91d7,131072,"Lawnmower Man, The (U) [!]"},
{0x31fb404b,65536,"Lazlos' Leap (U) [!]"},
{0x179c494e,131072,"Legend of Prince Valiant (U)"},
{0xa6e685dc,524288,"Legend of the River King (U) [S][!]"},
{0xbf2ab18b,524288,"Legend of Zelda, The - Link's Awakening (F)"},
{0x760ab4e7,524288,"Legend of Zelda, The - Link's Awakening (G) [!]"},
{0x39a6684e,524288,"Legend of Zelda, The - Link's Awakening (V1.0) (J)"},
{0x8cf27c90,524288,"Legend of Zelda, The - Link's Awakening (V1.0) (U) [!]"},
{0xea20b82a,524288,"Legend of Zelda, The - Link's Awakening (V1.1) (J)"},
{0x7d1b6cd6,524288,"Legend of Zelda, The - Link's Awakening (V1.1) (U) [!]"},
{0x34d08e7b,524288,"Legend of Zelda, The - Link's Awakening (V1.2) (U) [!]"},
{0x492edb36,131072,"Legend of Zerd, The (J)"},
{0x23467a35,131072,"Lemmings (E) [!]"},
{0x7d5cc03a,131072,"Lemmings (J)"},
{0xf2d1c19d,131072,"Lemmings (U) [!]"},
{0x9800bd49,524288,"Lemmings 2, The Tribes (U) [!]"},
{0x55fc585f,262144,"Les Aventures De Tintin - Le Temple Du Soleil (E)"},
{0x1f8d207c,131072,"Lethal Weapon (U) [!]"},
{0x8fc3ca73,524288,"Lion King, The (Disney Classics) (U) [!]"},
{0x3430d261,524288,"Lion King, The (Virgin) (U)"},
{0xe37e1832,131072,"Little Indian in Big City (U) [S]"},
{0x31cd9670,131072,"Little Master (J)"},
{0x187de7f8,262144,"Little Master 2 (J)"},
{0x00def37a,131072,"Little Mermaid, The (E) [!]"},
{0xd7c517e5,131072,"Little Mermaid, The (U) [!]"},
{0xdab91c7a,65536,"Lock 'N Chase (JU) [!]"},
{0xd6185941,131072,"Lolo (J)"},
{0x40e47da3,131072,"Looney Tunes (J)"},
{0xa662a8ef,131072,"Looney Tunes (U) [!]"},
{0x531a3e16,32768,"Loopz (U)"},
{0x538e0591,262144,"Lucky Luke (E) (M4)"},
{0xa2234eb1,65536,"Lucky Monkey (J)"},
{0xa3d5c8d7,524288,"Lucle (J)"},
{0x030d2054,131072,"Lunar Lander (J)"},
{0x016d230b,262144,"Mach Go Go Go (J) [S]"},
{0xd2585bbb,524288,"Madden '95 (U) [S]"},
{0xfd9dc1ad,524288,"Madden '96 (U) [S]"},
{0x88a837a2,524288,"Madden '97 (U) [S][!]"},
{0x0af9089e,131072,"Magic Ball (J) (Chinese)"},
{0xb1acbd28,32768,"Magic Maze (Sachen) (Unl) [!]"},
{0x9c4f54f1,131072,"Magical Talulutokun - Raiba Zone Panic (J)"},
{0xf157ae9e,65536,"Magical Tower (Game 2 of Sachen 4-in-1 Volume 5) (Unl) [!]"},
{0x9c318c64,131072,"Magnetic Soccer (U)"},
{0x2d439d0d,262144,"Mahoujin Guru Guru (J) [S]"},
{0xcfa358de,262144,"Makaimura Gaiden (J)"},
{0xdfa5da12,65536,"Malibu Beach Volleyball (U) [!]"},
{0xb9725e66,262144,"Marble Madness (U) (GB) [!]"},
{0x4627d88b,65536,"Mario & Yoshi (E) [!]"},
{0xf2d652ad,262144,"Mario's Picross (UE) [S][!]"},
{0x0f3ff7da,262144,"Marmalade Boy (J) [S]"},
{0x6e4f1eb3,131072,"Maru's Mission (U) [!]"},
{0x7cb70d3d,262144,"Masakari Densetsu Kintarou ACG (J)"},
{0xd8bab8e0,524288,"Masakari Densetsu Kintarou RPG Hen (J)"},
{0x71c804b3,131072,"Maskrider SD (J)"},
{0x4c0fb33e,32768,"Master Karateka (J)"},
{0x6f30a43a,262144,"Maui Mallard (U) [!]"},
{0x1b167f00,65536,"Max (UE) [!]"},
{0xb3e8028d,524288,"Mazekko Monster (J) [S]"},
{0xe5520693,524288,"Mazekko Monster 2 (J) [S]"},
{0x81de6c13,131072,"McDonaldland (U) [!]"},
{0x98494bf2,131072,"McDonaldland (U) [BF]"},
{0x1bab9900,524288,"Medarot Kabuto (V1.0) (J) [S]"},
{0x12a3982d,524288,"Medarot Kabuto (V1.1) (J) [S]"},
{0xbc0588c4,524288,"Medarot Kuwagata (V1.0) (J) [S]"},
{0x5e77e82e,524288,"Medarot Kuwagata (V1.1) (J) [S]"},
{0x2ea4b976,262144,"Mega Man (E) [!]"},
{0x47e70e08,262144,"Mega Man (U) [!]"},
{0x5e90cb48,262144,"Mega Man 2 (E) [!]"},
{0xe496f686,262144,"Mega Man 2 (U) [!]"},
{0x03b0d4ec,262144,"Mega Man 3 (E) [!]"},
{0x5175d761,262144,"Mega Man 3 (U) [!]"},
{0x973fcf4c,524288,"Mega Man 4 (E)"},
{0xabcea00d,524288,"Mega Man 4 (U) [!]"},
{0x72e6d21d,524288,"Mega Man 5 (U) [S][!]"},
{0xd12ac4fe,524288,"Mega Man 5 (U) [S][a1]"},
{0xc764b1f2,131072,"Megalit (J)"},
{0xf315b842,65536,"Megalit (U) [!]"},
{0x9bb5ba03,131072,"Mercenary Force (UE) [!]"},
{0xf3cc5e62,131072,"Metal Jack (J) [!]"},
{0xbf6866dc,131072,"Metal Masters (U)"},
{0xdee05370,262144,"Metroid 2 - Return of Samus (UA) [!]"},
{0x9039cbdb,65536,"Mi Tu De Lu (Puzzle Path) (Unl)"},
{0xf0482567,131072,"Mickey Mouse - Magic Wand (U) [S][!]"},
{0x77d69349,524288,"Mickey Mouse - Tokyo Disneyland (J) [S]"},
{0x4ca75d4d,65536,"Mickey Mouse (J)"},
{0xfc50dee7,131072,"Mickey Mouse (U) [!]"},
{0xdfee8bcc,131072,"Mickey Mouse II (J)"},
{0x0d30b3a1,131072,"Mickey Mouse IV (J)"},
{0x44cd01dd,131072,"Mickey Mouse V (J)"},
{0xe72db762,131072,"Mickey's Dangerous Chase (E) [!]"},
{0x0ab490c8,131072,"Mickey's Dangerous Chase (J)"},
{0x7b822d8f,131072,"Mickey's Dangerous Chase (U) [!]"},
{0x23e9d625,262144,"Mickey's Ultimate Challenge (U)"},
{0x2088f85f,262144,"Micro Machines (U) [!]"},
{0x24666c4d,524288,"Micro Machines 2 (U)"},
{0x1dd93d95,262144,"Midorin Omaki Baoo (J) [S]"},
{0x86a1c549,262144,"Mighty Morphin Power Rangers - The Movie (U) [S]"},
{0xc60d032a,262144,"Mighty Morphin Power Rangers (U) [S][!]"},
{0xdae94370,262144,"Mighty Morphin Power Rangers (U) [S][BF]"},
{0xced936f8,32768,"Migrain (J)"},
{0x73b80b16,131072,"Mikeneko Holmes (J)"},
{0xb14c3b31,131072,"Millipede - Centipede (UE) [S][!]"},
{0xf188c94c,131072,"Milon no Meikyuu Kumikyoku (J)"},
{0x62b4cc8c,131072,"Milon's Secret Castle (U)"},
{0x1a6bd577,65536,"Miner 2049er (U) [!]"},
{0x5532b3d1,32768,"Minesweeper (J)"},
{0x149ddaed,524800,"Mini 4 Boy (J) [S]"},
{0xd6962241,524288,"Mini 4 Boy II - Final Evolution (J) [S]"},
{0x33cd7550,65536,"Mini Putt (J)"},
{0xb3ad9b76,131072,"Miracle Adventure of Esparks (J)"},
{0x3a6cd4d8,32768,"Missile Command (U) (GB) [!]"},
{0xc7f7f0ac,131072,"Mobile Police Patlabor (J)"},
{0x79e05789,262144,"Mogu Mogu Q (J) [S][!]"},
{0xe1e3629f,32768,"Mogura De Pon! (J)"},
{0x82fca204,524288,"Moguranya (Mole Mania) (J) [S]"},
{0x2c36c74c,524288,"Mole Mania (Moguranya) (U) [S][!]"},
{0xad376905,1048576,"Momotaro Collection (J) [S]"},
{0x8eadec49,1048576,"Momotaro Collection 2 (J) [S]"},
{0xf09b34ab,262144,"Momotaro Dengeki (J)"},
{0x3c1c5eb4,524288,"Momotaro Dengeki 2 (J) [S]"},
{0xba5611ef,262144,"Momotaro Densetsu Gaiden (J)"},
{0x218265b3,524288,"Momotetsu Jr. (J) [S]"},
{0x4ca6d91a,262144,"Momotetu (J)"},
{0x987b621e,262144,"Monopoly (E)"},
{0xd8ac08b5,262144,"Monopoly (J)"},
{0xfd90f0d6,131072,"Monopoly (U) (GB) [!]"},
{0x5284543a,262144,"Monster Go! Go! Go! (Unl) [p1]"},
{0x56ba6a71,131072,"Monster Maker - Barcode Saga (J)"},
{0x725ee86c,131072,"Monster Maker (J)"},
{0x66e708fc,262144,"Monster Maker 2 (J)"},
{0x300b1d2d,262144,"Monster Max (U)"},
{0xad529057,524288,"Monster Race (J) [S]"},
{0xbd3039e5,524288,"Monster Race Other (J) [S]"},
{0x7b484ca2,65536,"Monster Truck (J) [BF]"},
{0xabf9b517,65536,"Monster Truck (J)"},
{0x186c109b,131072,"Monster Truck Wars (U) [S][!]"},
{0xe7ac155b,262144,"Montezuma's Return (E) (M5) [S][!]"},
{0x160fa9ef,262144,"Mortal Kombat (J)"},
{0x90eb0929,262144,"Mortal Kombat (U) [!]"},
{0x7b440ab8,262144,"Mortal Kombat (U) [BF]"},
{0xbf9c65fb,524288,"Mortal Kombat 3 (U) [!]"},
{0xf724b5ce,1048576,"Mortal Kombat I & II (J) [a1]"},
{0xb1a8dfd0,1048576,"Mortal Kombat I & II (J)"},
{0x339f1694,1048576,"Mortal Kombat I & II (U) [a1]"},
{0x57ba5d56,262144,"Mortal Kombat II (J) [S]"},
{0xbfaeadd0,262144,"Mortal Kombat II (U) [S][!]"},
{0xe2697678,32768,"Motocross Maniacs (E) [!]"},
{0xda6053c3,32768,"Motocross Maniacs (J)"},
{0x318dbde1,32768,"Motocross Maniacs (U) [!]"},
{0x4083b8b8,65536,"Mouse Trap Hotel (U) [BF]"},
{0x6edf07e5,65536,"Mouse Trap Hotel (U)"},
{0xcf84ac77,65536,"Mr. Do! (E) [!]"},
{0xa1122fc0,65536,"Mr. Do! (U)"},
{0xeadaf1e7,131072,"Mr. Gono no Baken Tekichu Jyutsu (J)"},
{0x03b64a35,262144,"Mr. Nutz (U)"},
{0x0e5bb1c4,65536,"Ms. Pac-Man (U) [!]"},
{0x7a7ba056,65536,"Ms. Pac-Man (U) [BF]"},
{0x97bd3e8f,131072,"Muhammad Ali's Boxing (U)"},
{0x01aee24b,131072,"Musashi Road (J)"},
{0x3420edea,131072,"Mysterium (J)"},
{0x3b94187d,131072,"Mysterium (U) [BF]"},
{0xeb225e96,131072,"Mysterium (U)"},
{0xb6e134af,262144,"Mystic Quest (F)"},
{0x0351b9a6,262144,"Mystic Quest (G) [!]"},
{0x57d95c92,262144,"Mystic Quest (U) [!]"},
{0xfafb343c,262144,"Mystical Ninja (U) [S][!]"},
{0xa1813cd5,262144,"Mystical Ninja (U) [S][a1][!]"},
{0xb4dd8e6a,131072,"Nada Asatarou no Powerful Mahjong - Tsugi no Itte 100 Dai (J)"},
{0x44badbb7,131072,"Nail'N Scale (U)"},
{0xec3257b3,131072,"Namco Classics (J)"},
{0x1902c6bd,524288,"Namco Gallery Volume 1 (J) [S]"},
{0x7e8cd4b5,524288,"Namco Gallery Volume 1 (J) [S][BF]"},
{0xa69b9260,524288,"Namco Gallery Volume 2 (J) [S]"},
{0x7740341e,524288,"Namco Gallery Volume 3 (J) [S]"},
{0xafd897d9,65536,"NanoLoop Music Generator (E) [!]"},
{0x3e30b63d,131072,"Nanonote (J)"},
{0xafd8c47c,65536,"Navy Blue (J)"},
{0x8cfeb2e2,131072,"Navy Blue '90 (J)"},
{0x2cbe5381,262144,"Navy Blue '98 (J)"},
{0x296ceacb,131072,"Navy Seals (U) [!]"},
{0xf25ba8bf,65536,"NBA All Star Challenge (U) [!]"},
{0xdf9db013,131072,"NBA All Star Challenge 2 (J) [!]"},
{0xc27c0289,131072,"NBA All Star Challenge 2 (U) [!]"},
{0x0ca07cda,262144,"NBA Jam (U)"},
{0x32909f62,524288,"NBA Jam Tournament Edition (J) [!]"},
{0x27d74c50,524288,"NBA Jam Tournament Edition (UE) [!]"},
{0x8885c7cd,524288,"NBA Live 96 (U) [S]"},
{0x3d6d309b,131072,"Nekojara (J)"},
{0xfd74b7f6,131584,"Nemesis ('90) (UE) [!]"},
{0x19930ea5,131072,"Nemesis ('91) (UE) [!]"},
{0xb338dae7,131072,"Nemesis (J)"},
{0xc3e62a35,262144,"Nemesis 2 - The Return of the Hero (U) [!]"},
{0xac5b062d,262144,"Nemesis 2 (J)"},
{0xaa98687f,524288,"Nettou Garou 2 (J) [S]"},
{0x8712f17b,524288,"Nettou King of Fighters '95 (J) [S]"},
{0xaa476500,524288,"Nettou King of Fighters '95 (J) [S][a1]"},
{0xc4d94fcb,524288,"Nettou King of Fighters '95 (J) [S][a2]"},
{0xfecdae42,524288,"Nettou King of Fighters '96 (J) [S]"},
{0xac61ef47,1048576,"Nettou King of Fighters '97 (J) [S][p1]"},
{0x50cf7de7,1048576,"Nettou King of Fighters '97 (J) [S][p1][BF]"},
{0xea0e9651,1048576,"Nettou King of Fighters '97 (J) [S][p2]"},
{0x20b56df6,1048576,"Nettou King of Fighters '97 (J) [S][p3]"},
{0x4a306276,524288,"Nettou Samurai (J) [S]"},
{0x0a12f53c,524288,"Nettou World Heroes 2 Jet (J) [S]"},
{0x82150e4a,65536,"New Chessmaster, The (J)"},
{0x5e1c3e8d,65536,"New Chessmaster, The (M2) (JU)"},
{0xc7ffc203,65536,"New Chessmaster, The (U)"},
{0xe5a78b9b,262144,"New SD Gundam (J) [S]"},
{0x4c3d1508,32768,"NFL Football (U) [!]"},
{0xc7838830,131072,"NFL Quarterback Club (1993) (U) [!]"},
{0xeecb703c,262144,"NFL Quarterback Club (J) [!]"},
{0x06f04370,262144,"NFL Quarterback Club 2 (U) [!]"},
{0xd583bc4e,262144,"NFL Quarterback Club '96 (U)"},
{0xbcabd2d2,524288,"NHL Hockey 95 (U) [S][!]"},
{0x15cd2b63,524288,"NHL Hockey 96 (U) [S][!]"},
{0xd983ff48,262144,"Nichibutsu Mahjong - Yoshimoto Gekijou (J)"},
{0xe1b202db,131072,"Nigel Mansell's World Championship '92 (E)"},
{0x0d0958a3,131072,"Nigel Mansell's World Championship '92 (U)"},
{0x03e84d7d,131072,"Nigel Mansell's World Championship '93 (U)"},
{0xe497842e,262144,"Nihon Daiyou Soccer (J) [S]"},
{0xcf133379,262144,"Nihonshi Target 201 (J)"},
{0x59d3e2ad,65536,"Ninja Boy (U) [!]"},
{0x1e14e981,262144,"Ninja Boy 2 (U) [BF]"},
{0x64c06d94,262144,"Ninja Boy 2 (U)"},
{0xd2be3397,131072,"Ninja Ryukenden (Ninja Gaiden) (J)"},
{0xb864a3b6,131072,"Ninja Spirit (J)"},
{0xc53ebfbd,131072,"Ninja Taro (U) [!]"},
{0xb50119eb,524288,"Ninku (J) [S]"},
{0x7f818772,524288,"Ninku Dai 2 - Ninku Sensou Hen (J) [S]"},
{0x0e37e462,524288,"Nintama Eawase (J) [S]"},
{0xbd223184,262144,"Nintama Rantaro (J) [S]"},
{0x96c24e13,131072,"Nintendo World Cup (U) [!]"},
{0x8803186a,131072,"Nobunaga's Ambition (J)"},
{0x5a843008,131072,"Nobunaga's Ambition (U) [!]"},
{0x6cd63b0b,131072,"Nontan to Issyo - Kurukuru Puzzle (J)"},
{0x8bbcc8bb,262144,"Noobow (J)"},
{0x91ec9567,1048576,"Oak's Dream 2 V1.3 (Pokemon Red Hack)"},
{0x5143e227,262144,"Obelix (E) (M2) (Fre-Ger) [S]"},
{0x6510c0e2,524288,"Oddworld Adventures (UE) [!]"},
{0xbe81bd61,524288,"Olympic Games (U) [S]"},
{0xcaf5b372,131072,"On the Tiles - Franky, Joe & Dirk (E) [!]"},
{0xb7f48649,131072,"Oni (J)"},
{0x2f895df5,262144,"Oni 2 - Innin Densetsu (J) [!]"},
{0x58b3b877,229376,"Oni 2 - Innin Densetsu (J) [BF]"},
{0x6cd62fdb,262144,"Oni 3 - Kuro no Hakaishin (J) [!]"},
{0xbeff4f57,262144,"Oni 4 - Kishin no Ketsuzoku (J) [!]"},
{0xaf030940,262144,"Oni 5 - Innin wo Tsugumono (J) [S][!]"},
{0xf54ec8eb,131072,"Oni Gashima Pachinko Ten (J) [!]"},
{0x2ebbc1ae,131072,"Operation C (U) [!]"},
{0x3faa9306,65536,"Optimus Prime - Terror of the Monstercons (Mario hack) (Unl)"},
{0x54913227,65536,"Osawagase Penguin Boy (J) [!]"},
{0xc17a002e,32768,"Othello (J)"},
{0x64d13a6d,65536,"Othello World (J) [S][!]"},
{0x98500521,262144,"Otogi Banasi Tai (J) [S]"},
{0x2f0f7f63,131072,"Otoko Jyuku (J)"},
{0x0c228a78,262144,"Otto's Ottifanten (E)"},
{0x8afcc4b0,262144,"Out Burst (J) [!]"},
{0x1b67e8b1,131072,"Out of Gas (U) [!]"},
{0x69a5e681,262144,"Pachinko CR Daiku no Gen San GB (J) [S]"},
{0x955b25ba,1048576,"Pachinko Data Card - Chou Ataru Kun (J) [S]"},
{0x52adb7f9,524288,"Pachinko Gaiden (J) [S]"},
{0x47658ade,65536,"Pachinko Time (J)"},
{0xbe4718e8,524288,"Pachio Kun - Game Gallery (J)"},
{0x3690c99c,131072,"Pachio Kun - Puzzle Castle (J)"},
{0x9a3e2dc2,131072,"Pachio Kun (J)"},
{0x3e8d0ae9,131072,"Pachio Kun 2 (J)"},
{0xc6dd7d92,131072,"Pachio Kun 3 (J)"},
{0x6ee0f7b9,131072,"Pachislot Hisshou Guide GB (J) [S]"},
{0x8c21a77d,131072,"Pachislot Kids (J)"},
{0xdeace430,131072,"Pachislot Kids 2 (J)"},
{0x40fc1186,262144,"Pachislot Kids 3 (J)"},
{0x92c9141f,131072,"Pachislot World Cup 94 (J)"},
{0x50a15dc8,262144,"Pac-In-Time (E) [S][!]"},
{0x1a5a38da,262144,"Pac-In-Time (J) [S]"},
{0x8690b691,262144,"Pac-In-Time (U) [S]"},
{0x65998f48,65536,"Pac-Man (J)"},
{0xb681e243,65536,"Pac-Man (U) (Namco Hometek) [!]"},
{0x0509069c,65536,"Pac-Man (U) (Namco)"},
{0xdb641f82,32768,"PacoPaco Pocket (V1.1) (J)"},
{0xaaebd509,131072,"Pac-Panic (J) [S]"},
{0x57bad9b1,131072,"Pac-Panic (J) [S][BF]"},
{0xc9be96d3,262144,"Pagemaster, The (U) [S][!]"},
{0xcdfa71e5,262144,"Pagemaster, The (U) [S][a1]"},
{0x3b19c3b2,262144,"Pagemaster, The (U) [S][BF]"},
{0x600d7ddf,65536,"Painter Momo Pie (J) [BF]"},
{0xfb79ef58,65536,"Painter Momo Pie (J)"},
{0x4b993d0d,32768,"Palamedes (J)"},
{0x526942e1,32768,"Palamedes (UE) [!]"},
{0xd000a116,65536,"Panel Action Bingo (U)"},
{0x9ae199df,131072,"Pang (U)"},
{0x46de32ba,65536,"Paperboy (U) (GB) [!]"},
{0x8ee404ca,262144,"Paperboy 2 (U)"},
{0x798f324a,131072,"Papuwakunn (J)"},
{0xc35ad128,131072,"Parasol Stars (UE) [!]"},
{0xae97ec53,65536,"Parasoru Hembei (J)"},
{0x85748525,262144,"Parodius (UE) [!]"},
{0x1791e952,262144,"Parodius Da! (J)"},
{0xf4cab596,524288,"Parts Collection - Medarot Kuma (J) [S]"},
{0x89f94482,524288,"Parts Collection 2 (J) [S]"},
{0x2e123f5b,262144,"Pawapuro Baseball (V1.0) (J) [S]"},
{0x71bea855,262144,"Pawapuro Baseball (V1.1) (J) [S]"},
{0xd0040f49,131072,"Peetan (J)"},
{0x7b852074,262144,"Pen Anime Sample 1 (J)"},
{0xc169606d,65536,"Penguin Kun Wars VS (J)"},
{0xa9e62e88,32768,"Penguin Land (J)"},
{0xeecff7f3,65536,"Penguin Wars (U)"},
{0xeafddefc,262144,"Penta Dragon (J) [BF]"},
{0x1e2efaee,262144,"Penta Dragon (J)"},
{0x7d7def64,524288,"PGA European Tour (U) [S][!]"},
{0x6ff72043,524288,"PGA Tour '96 (U) [S]"},
{0xe742561e,262144,"Phantasm (J)"},
{0xf5aa5902,524288,"Picross 2 (J) [S]"},
{0x2f56b2df,1048576,"Pikamon V1.5 (Red Hack)"},
{0x1b3a89c6,65536,"Pinball - Revenge of the Gator (J)"},
{0x79804305,65536,"Pinball - Revenge of the Gator (U) [!]"},
{0x02864c32,262144,"Pinball Deluxe (U)"},
{0xf056a911,262144,"Pinball Fantasies (U)"},
{0xedc8d122,262144,"Pinball Mania (U)"},
{0x740552ed,65536,"Pinball Party (J)"},
{0xa8dd80c6,262144,"Pingu - Sekai de 1 Ban Genkina Penguin (J)"},
{0x2d924e46,262144,"Pinocchio (U) (Black Pearl 1996) [!]"},
{0x085c4a02,262144,"Pinocchio (U) (Nintendo 1995)"},
{0x2cb7d00a,262144,"Pinocchio (U) [BF]"},
{0xd8b4aea4,32768,"Pipe Dream (J)"},
{0xf59cedea,32768,"Pipe Dream (U) [!]"},
{0x0680bfc3,262144,"Pit Fighter (U) [!]"},
{0xef88fad1,32768,"Pitman (J) [a1]"},
{0xa0b68136,32768,"Pitman (J)"},
{0x983caf46,131072,"Play Action Football (U) [!]"},
{0xce58c63d,524288,"Pocahontas (U) [S]"},
{0x2c88f996,131072,"Pocket Bass Fishing (J)"},
{0x17114316,131072,"Pocket Battle (J)"},
{0x212b47a5,524288,"Pocket Bomberman (J) [S]"},
{0x0fd1ae54,524288,"Pocket Bomberman (U) [S]"},
{0x73e8ef96,1048576,"Pocket Camera (V1.1) (J) [S]"},
{0x34e62c8b,262144,"Pocket Collection (J) [S]"},
{0x845bb677,524288,"Pocket Densya (J) [S]"},
{0x48993d4f,524288,"Pocket Family (J) [S]"},
{0x755152bb,131072,"Pocket Golf (J)"},
{0x490f8c46,524288,"Pocket Jockey (J) [S]"},
{0xc034ece1,262144,"Pocket Kyorochan (J) [S]"},
{0xd570a9df,524288,"Pocket Love (J) [S]"},
{0x9f8440b5,1048576,"Pocket Love 2 (J) [S]"},
{0x90f026d4,131072,"Pocket Mahjang (J)"},
{0xe4468d14,524288,"Pocket Monsters Blue (J) [S]"},
{0xdb02f066,524288,"Pocket Monsters Blue (J) [S][BF]"},
{0xbaeacd2b,524288,"Pocket Monsters Green (V1.0) (J) [S]"},
{0x86493ce6,524288,"Pocket Monsters Green (V1.0) (J) [S][BF1]"},
{0xe05a7e7f,524288,"Pocket Monsters Green (V1.0) (J) [S][BF2]"},
{0x37ae8dc4,524288,"Pocket Monsters Green (V1.1) (J) [S]"},
{0xb7d71d6a,1048576,"Pocket Monsters Red (V1.0) (J) [S] (Chinese)"},
{0x13652705,524288,"Pocket Monsters Red (V1.0) (J) [S]"},
{0xb77be1e0,524288,"Pocket Monsters Red (V1.1) (J) [S]"},
{0xe80479b6,524288,"Pocket Monsters Red (V1.1) (J) [S][BF]"},
{0x4ec85504,1048576,"Pocket Monsters Yellow (V1.0) (J) [S]"},
{0xf8c76ce6,1048576,"Pocket Monsters Yellow (V1.0) (J) [S][BF1]"},
{0xa5a31b25,1048576,"Pocket Monsters Yellow (V1.0) (J) [S][BF2]"},
{0xa2545d33,1048576,"Pocket Monsters Yellow (V1.1) (J) [S]"},
{0xfd3da7ff,1048576,"Pocket Monsters Yellow (V1.2) (J) [S]"},
{0x43e47a81,262144,"Pocket Puyo Puyo 2 (J) [S]"},
{0x2fa1bde6,262144,"Pocket Shougi (J) [S]"},
{0xd68c9f79,524288,"Pocket Sonar (J)"},
{0xf855d91c,65536,"Pocket Stadium (J) [BF]"},
{0xc7bd9228,65536,"Pocket Stadium (J)"},
{0xd4d84ca9,32768,"Pocket Voice Multi-ROM Menu V0.1 (Unl)"},
{0x1e1d8fb3,32768,"Pocket Voice Multi-ROM Menu V1.0 (Unl)"},
{0x20418ff9,32768,"Pocket Voice Multi-ROM Menu V2.0 (Unl)"},
{0x1e000a65,1048576,"Pokemon - The Johto Journeys (Red Hack) by MB Hacks"},
{0xd42c95b5,1048576,"Pokemon Amsterdam by Ruliz & AGP V0.10 (Pokemon Red Hack) [S]"},
{0xd95416f9,1048576,"Pokemon Azul (Blue) (S) [S]"},
{0xd6cc5177,1048576,"Pokemon Azul (Blue) (S) [S][BF]"},
{0xf58d56f5,1048576,"Pokemon Black - Special Palace Edition 1 (Red Hack) by MB Hacks"},
{0x9c336307,1048576,"Pokemon Blau (Blue) (G) [S][!]"},
{0x3aca6219,1048576,"Pokemon Blau (Blue) (G) [S][BF]"},
{0x50e2fc1d,1048576,"Pokemon Bleu (Blue) (F) [S]"},
{0x4d0984a9,1048576,"Pokemon Blu (Blue) (I) [S][!]"},
{0xd6da8a1a,1048576,"Pokemon Blue (UA) [S][!]"},
{0xc0d79ecf,1048576,"Pokemon Blue (UA) [S][BF1]"},
{0x23757859,1048576,"Pokemon Blue (UA) [S][BF2]"},
{0x23868fa5,1048576,"Pokemon Blue Before Elite (Blue Hack)"},
{0xd20a2c73,1048576,"Pokemon Blue Edition - Enhanced V0.4beta (Blue Hack)"},
{0x2559b2ad,1048576,"Pokemon Breeders Edition V6 (Blue Hack)"},
{0xcd463c1f,1048576,"Pokemon Generations (Red Hack)"},
{0x2a268399,1048576,"Pokemon Girl V1.0 (Red Hack)"},
{0x5d96a36f,1048576,"Pokemon Green (U) [p1][!]"},
{0xe3bd0b6e,1048576,"Pokemon II V1.0 (Red Hack)"},
{0x4764ebd7,65536,"Pokemon Land V0.3 (Super Mario Land Hack)"},
{0x81962488,524288,"Pokemon of the Past V0.1 (Zelda hack by PR) (U)"},
{0xf4be68e3,1048576,"Pokemon Pink Version (Red Hack) by MB Hacks"},
{0x9c9cdf8a,1048576,"Pokemon Red (Advanced) (U) [S][!]"},
{0x9f7fdd53,1048576,"Pokemon Red (U) [S][!]"},
{0x3bbf1b08,1048576,"Pokemon Red (U) [S][BF]"},
{0x07150f92,1048576,"Pokemon Rocket - James Version V1.1 (Blue hack) (U)"},
{0x509d13ef,1048576,"Pokemon Rocket - Jessie Version V1.0 (Red hack) (U)"},
{0x2ca5a427,1048576,"Pokemon Rocket - Jessie Version V1.1 (Red hack) (U)"},
{0x914142c3,1048576,"Pokemon Rocket - Jessie Version V1.2 (Red hack) (U)"},
{0xd8507d8a,1048576,"Pokemon Rojo (Red) (S) [S]"},
{0x91dcec6c,1048576,"Pokemon Rojo (Red) (S) [S][BF]"},
{0x2945aceb,1048576,"Pokemon Rosso (Red) (I) [S][!]"},
{0x89197825,1048576,"Pokemon Rot (Red) (G) [S][!]"},
{0xbc60c7a8,1048576,"Pokemon Rot (Red) (G) [S][BF]"},
{0xf612c80b,1048576,"Pokemon Rot (Red) (G) [S][BF][a1]"},
{0x337fce11,1048576,"Pokemon Rouge (Red) (F) [S]"},
{0x970677c7,1048576,"Pokemon White Version (Blue Hack) by MB Hacks"},
{0x61c34232,262144,"Ponkonyan (J) [S]"},
{0x058b3dab,65536,"Ponta to Hinako no Chindouchuu - Yuujou Hen (J)"},
{0xd07db274,131072,"Pop 'N Twinbee (E) [!]"},
{0x7f545b40,32768,"Pop Up (U) [!]"},
{0x2fb4da21,131072,"Popeye (J)"},
{0x4372ed68,131072,"Popeye 2 (J)"},
{0x729c2e40,131072,"Popeye 2 (U) (1993)"},
{0x3d0bb6d1,131072,"Popeye 2 (U) [BF]"},
{0xc07ed722,131072,"Popeye 2 (U)"},
{0xf327167e,131072,"Populous (J)"},
{0x453057ac,131072,"Populous (UE) [!]"},
{0x46cb2f33,131072,"Power Mission (U)"},
{0x0e2a1414,131072,"Power Mission (V1.0) (J)"},
{0xe30ef8ab,131072,"Power Mission (V1.1) (J)"},
{0x48c1ee22,524288,"Power Quest - Gekitou Power Modeler (J) [S]"},
{0xcf8aeee8,65536,"Power Racer (U) [!]"},
{0xc5204156,131072,"Prehistorik Man (U)"},
{0x55da3515,65536,"Pri Pri (J)"},
{0xc95d927b,262144,"Primal Rage (U)"},
{0x1d16d689,131072,"Prince of Persia (J)"},
{0x2bd995f1,131072,"Prince of Persia (U)"},
{0xdb8f4cf7,131072,"Prince YehRude (J) (Chinese)"},
{0xa2a6a863,32768,"Pro Action Replay (Unl) [!]"},
{0x71c98c70,32768,"Pro Action Replay (Unl) [f1]"},
{0x6f5b6748,131072,"Pro Mahjong Kiwame GB (J) [S]"},
{0xa6f3bee2,131072,"Pro Soccer (J)"},
{0xf27c06da,131072,"Pro Wrestling (J)"},
{0xc9acc4f4,131072,"Probotector (E) [!]"},
{0xb5090e43,131072,"Probotector 2 (E) [S]"},
{0x5916713e,131072,"Punisher, The (U)"},
{0xacc589fc,524288,"Purikura Pocket (J) [S]"},
{0xd145ea23,524288,"Purikura Pocket 2 (J) [S]"},
{0xceb62411,1048576,"Purikura Pocket 3 (J) [S]"},
{0x420881ae,131072,"Puro Stadium '91 (Pro Yakyu Stadium '91) (J) [!]"},
{0x71559ba0,262144,"Puro Stadium '92 (Pro Yakyu Stadium '92) (J)"},
{0x9e372d13,262144,"Puyo Puyo (J) [S]"},
{0x10235e38,131072,"Puzzle Bobble GB (J) [S]"},
{0x2ae2d71c,32768,"Puzzle Boy (J)"},
{0xe5463a1d,65536,"Puzzle Boy 2 (J)"},
{0x952920ba,262144,"Puzzle Nintama Rantarou (J) [S]"},
{0x9f0f3606,32768,"Puzzle Road (J)"},
{0x916e638d,65536,"Puzznic (J)"},
{0xabef175b,65536,"Pyramids of Ra (U)"},
{0x979ed154,32768,"Q Billion (J)"},
{0x7202e973,32768,"Q Billion (U) [!]"},
{0xefe75f7f,65536,"Q-bert II (J) [BF]"},
{0xe9ba4bad,65536,"Q-bert II (J)"},
{0xb0109545,65536,"Q-bert II (UEA) [!]"},
{0x949887ba,65536,"Q-bert II (UEA) [BF]"},
{0x9185e89e,65536,"Qix (JU) [!]"},
{0xaef48678,65536,"Qix (JU) [p1]"},
{0x40e5adc9,65536,"Quarth (J)"},
{0xbfb112ad,65536,"Quarth (U) [!]"},
{0xd8c33dcd,262144,"Quiz Sekaiha Show by Shobai (J)"},
{0x442420b3,262144,"Race Days (Dirty Racing & 4 Wheel Drive) (U) [a1]"},
{0xb9ab5319,262144,"Race Days (Dirty Racing & 4 Wheel Drive) (U)"},
{0x6775ccd6,131072,"Race Drivin' (U) [!]"},
{0x97ebd21d,1048576,"Racing Mini 4WD - Let's Go!! MAX (J) [S]"},
{0xfc0c180b,524288,"Racing Mini 4WD (J) [S]"},
{0x7c7e6d1c,131072,"Radar Mission (J)"},
{0x581da9c9,131072,"Radar Mission (UE) [!]"},
{0x1ef3bedb,262144,"Raging Fighter (UE) [!]"},
{0x7d03727d,65536,"Raijinou (J)"},
{0xa19ca3c1,65536,"Railway (Game 3 of Sachen 4-in-1 Volume 5) (Unl) [!]"},
{0x10f447f0,131072,"Rainbow Prince (J) (Chinese)"},
{0x96a4c720,131072,"Rampart (J)"},
{0x6d347812,131072,"Rampart (U)"},
{0x613e657a,262144,"Ranma Nibun no Ichi - Kakugeki!! (J)"},
{0xd9d57151,262144,"Ranma Nibun no Ichi - Part 2 (J)"},
{0x94838a81,262144,"Ray Earth (J) [S]"},
{0x00202dfa,262144,"Ray Earth 2 (J) [S]"},
{0xa00a9468,131072,"Ray Thunder (J) [!]"},
{0xf4031d4c,524288,"Real Bout Special (Fatal Fury) (J) [S]"},
{0xe1592b83,131072,"Real Ghostbusters, The (U) [!]"},
{0xae0122aa,131072,"Red Arremer (J)"},
{0x10bd83ba,262144,"Rekishi Masters 512 (J)"},
{0x7e262a4d,262144,"Rekishi Nendai Anki Point 240 (J)"},
{0x504cbd1d,262144,"Ren & Stimpy - Veediots (U) [!]"},
{0x2085aad9,262144,"Ren & Stimpy Show, The - Space Cadet Adventures (U) [!]"},
{0x52f5e960,32768,"Renjyu Club (J) [S]"},
{0x2350922b,65536,"Rentaiou (J)"},
{0x8a546dec,524288,"Retrieve (J) [S]"},
{0xfb5d24e0,131072,"Riddick Bowe Boxing (U)"},
{0xfd3d5ba7,131072,"Ring Rage (J)"},
{0xbce5dfb7,131072,"Ring Rage (U) [!]"},
{0x04453e78,131072,"Roadster (J)"},
{0x0b2071a3,262144,"Robin Hood - Prince of Thieves (G)"},
{0xe5c8c2b1,262144,"Robin Hood - Prince of Thieves (U)"},
{0x06d6980b,131072,"Robocop (J)"},
{0x6088b426,131072,"Robocop (U) [!]"},
{0x157ce6e5,131072,"Robocop 2 (J)"},
{0x4365a789,131072,"Robocop 2 (U)"},
{0xf82d7223,131072,"Robocop vs Terminator (U) [!]"},
{0x1f0b4a28,131072,"Robocop vs Terminator (U) [BF]"},
{0x630299c1,524288,"Rock 'N Monster (J) [S]"},
{0x3be6ac04,262144,"Rockman World (J)"},
{0xc34d265e,262144,"Rockman World 2 (J)"},
{0xe904484f,262144,"Rockman World 3 (J)"},
{0x16aec559,524288,"Rockman World 4 (J)"},
{0xeeabd3c6,524288,"Rockman World 5 (J) [S]"},
{0x2355be94,65536,"Rodland (J)"},
{0xecc2f2c0,65536,"Rodland (U)"},
{0x38c126aa,262144,"Roger Clemens MVP Baseball (J) [!]"},
{0x9da8595b,262144,"Roger Clemens MVP Baseball (U) [!]"},
{0x1a602590,65536,"Rolan's Curse (U) [!]"},
{0x2704fa7a,65536,"Rolan's Curse (U) [BF]"},
{0x2754f360,131072,"Rolan's Curse 2 (U) [!]"},
{0xe4988910,131072,"R-Type (J) [!]"},
{0xe0f23fc0,131072,"R-Type (U) [!]"},
{0x6002e291,131072,"R-Type 2 (J) [!]"},
{0x2fe2a72d,131072,"R-Type 2 (U)"},
{0xe8aea452,131072,"Rubble Saver (J)"},
{0x92c95f2d,65536,"Rubble Saver 2 (J)"},
{0x124a0d06,524288,"Rugrats Movie, The (U) [S]"},
{0x131b09f2,131072,"Sa-Ga (Final Fantasy Legend) (V1.0) (J)"},
{0x1953820f,131072,"Sa-Ga (Final Fantasy Legend) (V1.1) (J)"},
{0x18055bb9,262144,"Sa-Ga 2 (Final Fantasy Legend II) (V1.0) (J)"},
{0xf6cfcfb1,262144,"Sa-Ga 2 (Final Fantasy Legend II) (V1.1) (J)"},
{0x575d6d9d,262144,"Sa-Ga 3 (Final Fantasy Legend III) (J)"},
{0xe43da090,131072,"Sagaia (J)"},
{0xea759875,262144,"Sailor Moon R (J)"},
{0xbfd24c2a,131072,"Saiyuuki (J)"},
{0x70393c0f,262144,"Same Game (J) [S]"},
{0x69292ee6,524288,"Samurai Shodown (U) [S]"},
{0x3e3b715f,262144,"Sangokushi (J) [p1]"},
{0x83706e92,262144,"Sangokushi (J)"},
{0x48d8ab7a,65536,"Sanrio Carnival (J)"},
{0x758c7b2a,65536,"Sanrio Carnival 2 (J)"},
{0xb6ef042e,262144,"Satoru Nakajima - F-1 Hero - The Graded Driver '92 (J)"},
{0xe00ebc44,131072,"Satoru Nakajima - F-1 Hero '91 (J)"},
{0x4a0f5972,131072,"Scotland Yard (J)"},
{0x39058153,131072,"SD Command Gundam - G-Arms (J) [!]"},
{0x016a0552,131072,"SD Gundam - SD Sengokuden Kunitori Monogatari (J) [!]"},
{0xc9dbba10,131072,"SD Gundam Gaiden - Lacroan Heroes (J) [!]"},
{0xc4d09768,524288,"SD Hiryu no Ken Gaiden (J) [S][!]"},
{0xadb511ca,1048576,"SD Hiryu no Ken Gaiden 2 (J) [S][!]"},
{0xf0b73db4,65536,"SD Lupin the Third (J) [!]"},
{0xd6fe3c56,262144,"SD Saint Seiya Paradise (J)"},
{0x5b7c6faa,262144,"SD Sen Goku Den 2 (J) [!]"},
{0x7c61426c,262144,"SD Sen Goku Den 3 (J) [!]"},
{0xba091b91,131072,"Sea Battle (E)"},
{0x31a3bd99,262144,"SeaQuest DSV (U) [S][!]"},
{0x19056889,262144,"SeaQuest DSV (U) [S][BF]"},
{0x79afe59e,65536,"Seaside Volley (J)"},
{0xd771c1b6,262144,"Seiken Densetsu (J)"},
{0x799c5cdb,131072,"Selection (J)"},
{0xa6027919,524288,"Selection 1&2 (J) [S]"},
{0xd09073f6,262144,"Selection 2 (J)"},
{0x6bae3a41,131072,"Sengoku Ninjakun - Ninja Taro (J)"},
{0xbef1fe2b,32768,"Serpent (J)"},
{0x74d466d7,32768,"Serpent (U)"},
{0xbcc18e24,131072,"Shadow Warriors (E)"},
{0x7c29672b,32768,"Shanghai (J)"},
{0x580fcb18,32768,"Shanghai (U) [!]"},
{0x6b8eff2c,262144,"Shanghai Pocket (J) [S]"},
{0x7ed43fe6,524288,"Shaq Fu (U)"},
{0x0cdd8b04,32768,"Shi Sensyo - Match-Mania (J)"},
{0x5d43a385,1048576,"Shikakui Atama wo Maruku Suru - Joushiki no Sho (J)"},
{0x3c907f2c,1048576,"Shikakui Atama wo Maruku Suru - Nanmon no Sho (J)"},
{0xc34ae38f,262144,"Shikakui Atama wo Maruku Suru - Rika Battle Hen (J)"},
{0x0dadb829,262144,"Shikakui Atama wo Maruku Suru - Sansu Battle (V1.0) (J)"},
{0x74821248,262144,"Shikakui Atama wo Maruku Suru - Sansu Battle (V1.1) (J)"},
{0xf141b2dc,262144,"Shikakui Atama wo Maruku Suru (V1.0) (J)"},
{0x195bee90,65536,"Shikinjyo (J) [BF]"},
{0xf8ec3a41,65536,"Shikinjyo (J)"},
{0xa8a43013,131072,"Shin Nihon Pro Wrestling Tokon Sanjushi (J)"},
{0x47095204,262144,"Shinri Game 2, The (J)"},
{0xfb2fe362,262144,"Shinri Game, The (J)"},
{0x56410442,65536,"Shippo De Bun (J)"},
{0xb3063db5,131072,"Shonen Ashibe - Yuuenchi Panic (J)"},
{0xab3477c4,524288,"Shou Hyper Fish (J) [S]"},
{0x4fb44cb4,131072,"Shougi (J)"},
{0xa074bf7e,262144,"Shougi Saikyo (J) [S]"},
{0x9a1e30b4,65536,"Side Pocket (U) [!]"},
{0x3ba099ec,65536,"Side Pocket (U) [BF]"},
{0x8bd567d1,262144,"Sika Kokugo (J)"},
{0x7aa4e0bb,131072,"Simpsons, The - Bart & the Beanstalk (J)"},
{0x517a614c,131072,"Simpsons, The - Bart & the Beanstalk (U)"},
{0x6819cf0d,131072,"Simpsons, The - Bart vs the Juggernauts (U) [!]"},
{0x0fd66b1a,131072,"Simpsons, The - Escape from Camp Deadly (J)"},
{0x5546a382,131072,"Simpsons, The - Escape from Camp Deadly (U) [!]"},
{0x0ba318b1,131072,"Simpsons, The - Escape from Camp Deadly (U) [BF]"},
{0x1cedb141,131072,"Simpsons, The - Krusty's Funhouse (U)"},
{0xac1fb27a,131072,"Skate or Die - Bad 'N Rad (E) [!]"},
{0x4db7c817,131072,"Skate or Die - Bad 'N Rad (U)"},
{0x02b77c09,131072,"Skate or Die - Tour de Thrash (U)"},
{0x395fe571,65536,"Sky Ace (Game 3 of Sachen 4-in-1 Volume 7) (Unl) [!]"},
{0xae478a6f,262144,"Slam Dunk - Gakeppuchi no Kesshou League (J) [S][!]"},
{0xcb35900a,524288,"Slam Dunk 2 - Zengoku he no TIPOFF (J) [S][!]"},
{0xdbf106d1,524288,"Small Soldiers (U) [S]"},
{0xcb2c7198,131072,"Smurfs 2, The (U)"},
{0x8ef938c4,262144,"Smurfs 3, The (UE) [!]"},
{0xcdff161f,131072,"Smurfs, The (V1.0) (E) [!]"},
{0x8b5bcde7,131072,"Smurfs, The (V1.1) (UE) [S][!]"},
{0x7bf40d7d,131072,"Sneaky Snakes (UE) [!]"},
{0x4892984d,65536,"Snoopy - Magic Show (J)"},
{0x2b7a5034,65536,"Snoopy - Magic Show (U) [!]"},
{0x8900a7c0,131072,"Snoopy no Hajimete no Otsukai (J) [S][!]"},
{0xe5a22f5a,131072,"Snow Bros Jr. (J)"},
{0xd45a1daa,131072,"Snow Bros Jr. (U) [!]"},
{0xc36b199b,131072,"Soccer (E) (M3) [S][!]"},
{0xbe51a876,131072,"Soccer (J)"},
{0x23f64e82,65536,"Soccer Boy (J)"},
{0x6f87b543,65536,"Soccer Mania (JU) [!]"},
{0x11817103,65536,"Solar Striker (JU) [!]"},
{0x7c5aec86,131072,"Soldam (J)"},
{0x1119484a,65536,"Solitaire (J)"},
{0x35a5234a,131072,"Solitaire Funpack (U) [!]"},
{0x901bff2e,65536,"Solomon's Club (J)"},
{0xcea9622a,65536,"Solomon's Club (UE) [a1]"},
{0x5fed0068,262144,"Sonic 3D Blast 5 (Unl)"},
{0xaa4e9379,524288,"Sonic 6 (Unl)"},
{0xd50d6d0a,32768,"Soukoban (J)"},
{0xd9da6741,32768,"Soukoban 2 (J)"},
{0x868b57b2,32768,"Space Invaders (J)"},
{0x891b8f04,524288,"Space Invaders '94 (U) [S][!]"},
{0x7f0f5762,524288,"Space Invaders '94 (U) [S][a1]"},
{0x6ee7ca79,65536,"Spanky's Quest (U) (Natsume) [!]"},
{0xe9ef8136,65536,"Spanky's Quest (U) (Taito)"},
{0x8c7fa1f7,65536,"Spartan X (Kung-Fu Master) (J) [BF]"},
{0xca7b4229,65536,"Spartan X (Kung-Fu Master) (J)"},
{0xfd06e22d,131072,"Speed Ball 2 - Brutal Deluxe (U) [!]"},
{0xb2e6a1c5,262144,"Speedy Gonzales (J)"},
{0x27cde8d6,262144,"Speedy Gonzales (U) [!]"},
{0xbfc0042d,131072,"Spider-Man and the X-Men - Arcade's Revenge (U) [BF]"},
{0x1009c6c0,131072,"Spider-Man and the X-Men - Arcade's Revenge (U)"},
{0x735b29e2,262144,"Spirou (U) (M4) [S]"},
{0x35415a00,262144,"Spirou (U) (M4) [S][a1]"},
{0x24dd09e0,524288,"Sports Collection (J)"},
{0x235171c4,524288,"Sports Illustrated Championship Football & Baseball (U) [!]"},
{0xf0d76d49,262144,"Sports Illustrated for Kids - Ultimate Triple Dare! (U) [!]"},
{0x552a53b9,131072,"Spot - The Cool Adventure (J)"},
{0xa26cab1c,131584,"Spot - The Cool Adventure (U)"},
{0x2ca58280,32768,"Spot (J)"},
{0xfcd61b98,32768,"Spot (U) [!]"},
{0x70e5ed99,65536,"Spud's Adventure (U)"},
{0x6d40e5a2,131072,"Spy vs Spy - Operation Boobytrap (U) (Kemco 1992) [S][!]"},
{0x36645203,131072,"Spy vs Spy - Operation Boobytrap (U) (Kemco 1996) [S]"},
{0x8b882745,65536,"Square Deal - The Game of Two Dimensional Poker (U) [!]"},
{0xb4fa9cf2,524288,"SS Spinner - Yo for it (J) [S]"},
{0xe032e502,131072,"Star Hawk (U) [!]"},
{0xd6fd967c,262144,"Star Sweep (J) [S]"},
{0xd925d15d,131072,"Star Trek - Generations - Beyond the Nexus (E) [S]"},
{0x9f2d11c6,131072,"Star Trek - Generations - Beyond the Nexus (U) [!]"},
{0x3a5a56cb,131072,"Star Trek - The Next Generation (U) [!]"},
{0x605de43a,131072,"Star Trek (U) [!]"},
{0x6cb73dc7,524288,"Star Wars - Super Return of the Jedi (U) [S][!]"},
{0x05c488f5,524288,"Star Wars - Super Return of the Jedi (U) [S][BF]"},
{0x8515e78d,131072,"Star Wars - The Empire Strikes Back (U) (Capcom) [BF]"},
{0xa0fff8e7,131072,"Star Wars - The Empire Strikes Back (U) (Capcom)"},
{0x240c589d,131072,"Star Wars - The Empire Strikes Back (U) (UBI Soft) [!]"},
{0x1e3305c0,131072,"Star Wars (U) (Capcom) [BF]"},
{0xb01da1ae,131072,"Star Wars (U) (Capcom)"},
{0x7e3f6bbe,131072,"Star Wars (U) (UBI Soft)"},
{0x5d8deb5b,131072,"Star Wars (V1.1) (U) (Nintendo) [!]"},
{0x4789295c,131072,"Stargate (U) [!]"},
{0x86107477,131072,"Stop That Roach! (U)"},
{0xc775f488,524288,"Street Fighter II (J) [S]"},
{0x54a0aaa3,524288,"Street Fighter II (UE) [S][!]"},
{0x5bbacaa8,131072,"Street Racer (J)"},
{0xfcfb4ce4,131072,"Street Racer (U) [!]"},
{0x7751e066,32768,"Street Rider (Game 1 of Sachen 4-in-1 Volume 1) (Unl) [!]"},
{0x45e3e8f2,524288,"Study Boy Kokugo 2 (J)"},
{0xbadc7cee,131072,"Sumo Fighter (U) [!]"},
{0x31a227ed,131072,"Super Battle Tank (U)"},
{0xfc516de2,262144,"Super Bikkuri (J) [BF]"},
{0xc1e1a041,262144,"Super Bikkuri (J)"},
{0x6b497842,524288,"Super Black Bass (U) [S][!]"},
{0x8a7c1678,1048576,"Super Black Bass Pocket (J) [S]"},
{0x68a553b6,1048576,"Super Black Bass Pocket 2 (J) [S]"},
{0x239711ec,524288,"Super Bomberman B-Daman (J) [S] (HUC-1 chip)"},
{0x7a07adcd,524288,"Super Bomberman B-Daman (J) [S]"},
{0xb503ffad,131072,"Super Bombliss (J) [S]"},
{0x037d966a,65536,"Super Chinese Land (J)"},
{0x7d1d8fdc,1048576,"Super Chinese Land 1-2-3 (J) [S]"},
{0x88508483,262144,"Super Chinese Land 2 (J)"},
{0xe01caf0b,262144,"Super Chinese Land 3 (J) [S]"},
{0xf9620cff,262144,"Super Chinese Land 3 Dash (J) [S]"},
{0x695f4600,524288,"Super Donkey Kong (J) [S]"},
{0x2359d61e,131072,"Super Hunchback (E)"},
{0xf20078c2,131072,"Super Hunchback (J)"},
{0x1a45706e,131072,"Super Hunchback (U)"},
{0x4b1dfe3d,131072,"Super Kick Off (U)"},
{0xd9f3eb9f,131072,"Super Mario 4 (Unl)"},
{0x90776841,65536,"Super Mario Land (V1.0) (JUA) [!]"},
{0x2c27ec70,65536,"Super Mario Land (V1.1) (JUA) [!]"},
{0xd5ec24e4,524288,"Super Mario Land 2 - 6 Golden Coins (V1.0) (UE) [!]"},
{0xbd0285f4,524288,"Super Mario Land 2 - 6 Golden Coins (V1.0) (UE) [BF]"},
{0x635a9112,524288,"Super Mario Land 2 - 6 Golden Coins (V1.2) (UE) [!]"},
{0xa715daf5,524288,"Super Mario Land 2 - 6 Tsu no Kinka (V1.0) (J)"},
{0xc0fdeb7d,524288,"Super Mario Land 2 - 6 Tsu no Kinka (V1.2) (J) [a1]"},
{0x29e0911a,524288,"Super Mario Land 2 - 6 Tsu no Kinka (V1.2) (J)"},
{0x40be3889,524288,"Super Mario Land 3 - Wario Land (JUE) [!]"},
{0xe94ac677,131072,"Super Mario Land 4 (J) [!]"},
{0x0c83f4fd,256953,"Super Mario Quest (Final Fantasy hack V0.2 by PR) (U)"},
{0x3497ab07,256957,"Super Mario Quest (Final Fantasy hack V0.5 by PR) (U)"},
{0xe8b4891f,262144,"Super Momotaro Dentetsu 2 (J)"},
{0x3e2810be,131072,"Super Off Road (U) [!]"},
{0x35ef33d8,131072,"Super Off Road (U) [BF]"},
{0xcde0ff00,262144,"Super Pachinko Wars (J) [S]"},
{0x7960f33f,131072,"Super RC Pro-Am (UE) [!]"},
{0x7dd9d7d6,131072,"Super Robot War (J)"},
{0xdf8b2b20,524288,"Super Robot War 2G (J) [S]"},
{0x82a26c13,524288,"Super Robot War 2G (J) [S][a1]"},
{0x06155099,524288,"Super Robot War 2G (J) [S][a2]"},
{0xb88f0974,1048576,"Super Robot War 2G (J) [S][p1]"},
{0x3874b7a2,131072,"Super Scrabble (U) [!]"},
{0x984d0f7f,65536,"Super Snaky (J) [S]"},
{0xa269559f,131072,"Super Street Basketball (J)"},
{0x8090c9cc,131072,"Super Street Basketball 2 (J) [S]"},
{0x358e0091,131072,"Superman (U) [S][!]"},
{0x76ae62c8,131072,"Swamp Thing (U) [!]"},
{0x5b7ff38c,262144,"Sword of Hope 2, The (U) [S][!]"},
{0xc7e48c7c,131072,"Sword of Hope, The (E) (Swedish) [!]"},
{0x498e0e9f,131072,"Sword of Hope, The (G)"},
{0x7e923846,131072,"Sword of Hope, The (U) [!]"},
{0x2868aabf,131072,"Sword of Su Zi, The - Trial Version (V1.1) (Unl)"},
{0x7ec795fa,131072,"T2 - The Arcade Game (J)"},
{0x00f09c7f,131072,"T2 - The Arcade Game (U) [!]"},
{0x96555e9a,262144,"Taachiyan (J) [S]"},
{0x62a31de6,65536,"Taikyoku Renju (J)"},
{0xc5acce7c,65536,"Tail Gator (U) [!]"},
{0xd29ddc91,131072,"Tale Spin (E)"},
{0xde383e73,131072,"Tale Spin (U)"},
{0x084c2401,524288,"Tamagotchi (F) [S]"},
{0xefc0f266,524288,"Tamagotchi (J) [S]"},
{0x677c0ee4,524288,"Tamagotchi (J) [S][BF]"},
{0xdbf1bd20,524288,"Tamagotchi (UE) [S][!]"},
{0x19889c43,524288,"Tamagotchi 2 (J) [S]"},
{0x6db395e6,524288,"Tamagotchi 2 (J) [S][BF]"},
{0x9694d69d,524288,"Tamagotchi 3 (J) [S]"},
{0x69f29cf2,131072,"Taruru-To (J)"},
{0x0aad5217,131072,"Taruru-To 2 (J)"},
{0xc2f50fb3,131072,"Tarzan (U) [!]"},
{0x9ea867a7,32768,"Tasmania Story (J)"},
{0xa33c4fff,32768,"Tasmania Story (U) [!]"},
{0x7625e5a5,524288,"Tatsujin Techou (J)"},
{0x7a4784f3,131072,"Taz-Mania (E)"},
{0x22d07cf6,262144,"Taz-Mania (U)"},
{0x4ccb65e0,131072,"Taz-Mania 2 (U) [!]"},
{0x28b85584,524288,"TDL Fantasy Tour (J) [S]"},
{0xcfd74e34,262144,"Tecmo Bowl (J)"},
{0xe4f29760,262144,"Tecmo Bowl (U)"},
{0xcf24506c,262144,"Teenage Mutant Hero Turtles - Back From the Sewers (E) [!]"},
{0x9f3245f3,131072,"Teenage Mutant Hero Turtles III - Radical Rescue (E) [!]"},
{0x44f51c73,262144,"Teenage Mutant Ninja Turtles - Back From the Sewers (U) [!]"},
{0xdca70cbb,262144,"Teenage Mutant Ninja Turtles - Back From the Sewers (U) [a1]"},
{0x5a6984c3,131072,"Teenage Mutant Ninja Turtles - Fall of the Foot Clan (U) [!]"},
{0x74078236,131072,"Teenage Mutant Ninja Turtles (J) [!]"},
{0x84e6fb25,262144,"Teenage Mutant Ninja Turtles 2 (J)"},
{0x55153bb5,131072,"Teenage Mutant Ninja Turtles 3 - Radical Rescue (J)"},
{0x58832bbc,131072,"Teenage Mutant Ninja Turtles III - Radical Rescue (U)"},
{0x7b903a6f,65536,"Tekichu Rush (J)"},
{0x22d8889e,131072,"Tekkaman Blade (J) [!]"},
{0xb8da8eb5,131072,"Tekkyufight! (J)"},
{0xa9018354,262144,"Tenchi Wokurau (J)"},
{0xb71396a6,131072,"Tenjin Kaisen - Mercenary Force (J)"},
{0x211c4611,262144,"Tenjin Kaisen 2 (J)"},
{0x5009215f,32768,"Tennis (JUA) [!]"},
{0xac044e9a,131072,"Tensai Bakabon (J)"},
{0x21848101,131072,"Terminator 2 - Judgment Day (UE) [!]"},
{0xc77e316f,32768,"Tesserae (U) [!]"},
{0x63f9407d,32768,"Tetris (V1.0) (JU) [!]"},
{0x46df91ad,32768,"Tetris (V1.1) (JU) [!]"},
{0xaa4a1edb,131072,"Tetris 2 (U) [!]"},
{0xea19a9d9,131072,"Tetris 2 (UE) [S][!]"},
{0xb76c769b,524288,"Tetris Attack (V1.0) (U) [!]"},
{0x5ee45a4d,524288,"Tetris Attack (V1.1) (U) [S]"},
{0x7be5a73f,131072,"Tetris Blast (U) [S][!]"},
{0x9dfcb385,131072,"Tetris Flash (J) [S]"},
{0x2ec9120a,262144,"Tetris Plus (J) [S]"},
{0xdafc3bff,262144,"Tetris Plus (U) [S][!]"},
{0xeffb6d09,262144,"Tetris Plus (U) [S][BF]"},
{0x149e9393,131072,"Thunderbirds (J)"},
{0xe0f7a702,524288,"Tiny One Gameboy (V1.1) (J)"},
{0x11a06fe3,524288,"Tiny One Gameboy Special Use - 5-3 Bright Season (V1.1) (J)"},
{0xd3904be9,131072,"Tiny Toon Adventures - Wacky Sports (U) [!]"},
{0xd731bda2,131072,"Tiny Toon Adventures - Wacky Sports (U) [a1]"},
{0xeaf523ec,131072,"Tip Off (UE) [!]"},
{0xfb13462b,131072,"Tiny Toon Adventures - Bab's Big Break (J)"},
{0x9b5e6219,131072,"Tiny Toon Adventures - Bab's Big Break (U) [!]"},
{0xc5c7868d,131072,"Tiny Toon Adventures 2 - Montana's Movie Madness (U) [!]"},
{0x0fd47f8a,131072,"Tiny Toon Adventures 2 (J)"},
{0x3fa10931,131072,"Tiny Toon Adventures 3 (J)"},
{0x814fa146,262144,"Titus the Fox (U)"},
{0x61a0803b,65536,"To-Heart Columns (J)"},
{0x9db7dcc3,131072,"Tokio Senki (J)"},
{0x56afca4c,262144,"Tokoro Jr. (J) [S][!]"},
{0xc2dbd1aa,131072,"Tom & Jerry - Frantic Antics (U)"},
{0xca836e6d,131072,"Tom & Jerry (J)"},
{0x0636d89e,131072,"Tom & Jerry (U)"},
{0xdd19a9ec,131072,"Tom & Jerry Part 2 (J)"},
{0x0506c12b,131072,"Top Gun 2 (U) [!]"},
{0xd577d8e0,262144,"Top Ranking Tennis (U) [!]"},
{0x1fb35885,131072,"Torpedo Range (J)"},
{0xed9882a9,131072,"Torpedo Range (UE) [!]"},
{0x3700927f,131072,"Total Carnage (U) (Nintendo) [!]"},
{0x9b5b7bff,131072,"Totsugeki Tank (J)"},
{0x8f9e28ad,262144,"Tottemo Luckyman (J) [S]"},
{0xf924bdb1,131072,"Tower of Druaga, The (J)"},
{0xea59c6e3,131072,"Toxic Crusaders (U)"},
{0xd34287cc,524288,"Toy Story (U) [S][!]"},
{0xc0ef39f0,131072,"Track & Field (U)"},
{0x48d37cd2,131072,"Track Meet (J)"},
{0x7b5dc3e4,131072,"Track Meet (U)"},
{0x1c2fc6bf,32768,"Trap & Turn (Sachen) (Unl) [!]"},
{0xafefd085,131072,"Trappers Tengoku (J)"},
{0x4a38be7d,131072,"Trax (U) [!]"},
{0x11568e64,262144,"Trip World (J)"},
{0xedec63e6,262144,"True Lies (U) [!]"},
{0xfd16ac45,32768,"Trump Boy (J) [a1]"},
{0x694c66cb,32768,"Trump Boy (J)"},
{0x39157849,65536,"Trump Boy 2 (J)"},
{0x8341be0f,131072,"Trump Collection GB (J)"},
{0xceee6a61,131072,"Tsume Go Series 1 - Fujisawa Hideyuki Meiyo Kisei (J) [S]"},
{0x43e2a5c0,65536,"Tsume Shougi - Hyaku Ban Shoubu (J)"},
{0xd5434c94,131072,"Tsume Shougi - Kanki 5 Dan (J) [S]"},
{0x6403af06,65536,"Tsume Shougi - Mondai Teikyou Shougi Sekai (J)"},
{0xc97daaca,65536,"Tsumego (J)"},
{0x881afd62,131072,"Tumble Pop (J)"},
{0x8a3aab31,131072,"Tumble Pop (U)"},
{0xdc324100,524288,"Turi Sensei (J) [S]"},
{0x901a0147,131072,"Turn & Burn (U) [BF]"},
{0xb6c09e36,131072,"Twin (J)"},
{0x91394bd8,131072,"Turn & Burn (U) [!]"},
{0x518c2d2f,262144,"Turok - Battle of the Bionosaurs (UE) (M4) [!]"},
{0x2359bf0c,131072,"Turrican (UE) [!]"},
{0x18f64779,262144,"TV Champion (J) [S]"},
{0x017fd6f5,131072,"Twin-Bee Da!! (J)"},
{0xd7e52d4e,524288,"Two Hearts (Beta) (J)"},
{0x5bf747f8,262144,"Uchuu Senkan Yamato (J) [!]"},
{0xd2f94181,131072,"Ultima - Runes of Virtue (J) [!]"},
{0xc44a0f1e,131072,"Ultima - Runes of Virtue (U)"},
{0x796fd6a5,262144,"Ultima - Runes of Virtue 2 (J) [!]"},
{0xc449fbbf,262144,"Ultima - Runes of Virtue 2 (U)"},
{0x12de9bac,131072,"Ultra Golf (U)"},
{0x5944c3ed,131072,"Ultraman (J)"},
{0x468d1a2e,131072,"Ultraman Ball (J) [S][!]"},
{0x91eda860,65536,"Ultraman Club 1 (J) [!]"},
{0xb904230d,262144,"Ultraman Gekiden (J) [S]"},
{0x19ff5b3e,524288,"Umi no Nushitsuri 2 (J) [S]"},
{0xf71752dd,262144,"Undercover Cops (J) [BF]"},
{0xb7af37f5,262144,"Undercover Cops (J)"},
{0x82511a8f,262144,"Undoukai (J)"},
{0x99ae9d06,262144,"Universal Soldier (U)"},
{0xa37c022d,262144,"Uno - Small World (J) [!]"},
{0xa7ad65ef,131072,"Uno 2 - Small World (J) [S][!]"},
{0xf7e1c9c5,65536,"Uoozu (J) [!]"},
{0x89625945,524288,"Urban Strike (U) [S][!]"},
{0x56800c6b,262144,"Urusei Yatsura (J) [!]"},
{0xf2119a2d,65536,"Valations (J)"},
{0x956b603c,131072,"Vattle Guice (J) [!]"},
{0xc8be05d8,524288,"Vegas Stakes (U) [S][!]"},
{0x0817aa32,65536,"Velious (J)"},
{0xb55eb427,131072,"Velious II (J)"},
{0x449cf2e4,131072,"Versus Hero (J)"},
{0x642aee97,32768,"Vex Block (Sachen) (Unl) [!]"},
{0x220bbcb6,131072,"Virtual Wars (J)"},
{0x89a7aeca,262144,"Vitamina Kingdom (J)"},
{0x0d06ea32,32768,"Volley Fire (J)"},
{0xd149652b,262144,"V-Rally - Championship Edition (E) (M3) [!]"},
{0x20ae389a,65536,"VS Battler (J)"},
{0xe69a6f0a,131072,"Wapiko no Waku Waku Stamp Ralley! - Kingyo Chuuihou! (J)"},
{0x927b57a1,262144,"Wario Blast (U) [S][!]"},
{0x853dd162,262144,"Wario Blast (U) [S][BF]"},
{0x4b08a38a,1048576,"Warioland 2 (UE) [S] (MBC1 hack)"},
{0x9c54358d,1048576,"Warioland 2 (UE) [S][!]"},
{0xecf1b801,65536,"Warrior (J)"},
{0xf5d364db,262144,"Wars (J)"},
{0x4786fd6e,262144,"Water World (U)"},
{0xa6595506,131072,"Wave Race (UE) [!]"},
{0x829ea425,262144,"Wayne's World (U)"},
{0x974e712b,131072,"WCW Main Event (U) [!]"},
{0x9812a6c6,262144,"Wedding Peach (J) [S][!]"},
{0xf6e2baae,262144,"Welcome Nakayosi Park (J) [!]"},
{0xc811560b,131072,"We're Back - A Dinosaur's Story (U)"},
{0xe8b26577,131072,"Wheel of Fortune (Gluecksrad) (G) [!]"},
{0x8408fe48,131072,"Wheel of Fortune (U) [!]"},
{0x3116b0da,131072,"Wheel of Fortune (U) [a1]"},
{0x88bf466b,131072,"Who Framed Roger Rabbit (U) [BF]"},
{0xb93138fa,131072,"Who Framed Roger Rabbit (U) [!]"},
{0x72462125,65536,"WildSnake (U) [S]"},
{0x14e91757,131072,"Winner's Horse (J) [!]"},
{0x99afd62c,131072,"Winter Gold (U) [BF]"},
{0x3c4cd245,131072,"Winter Gold (U)"},
{0x4d640e73,262144,"Wizardry Gaiden 1 - Suffering of the Queen (J) [!]"},
{0xf6826d12,262144,"Wizardry Gaiden 2 - Curse of the Ancient Emperor (J) [!]"},
{0x59ffaeca,524288,"Wizardry Gaiden 3 - Scripture of the Dark (J) [BF]"},
{0x104eb503,65536,"Wizards & Warriors Chapter X - The Fortress of Fear (UE) [!]"},
{0x075a8231,131072,"Wordtris (U) [!]"},
{0x6dce0366,131072,"Wordtris (U) [BF]"},
{0xc5e037d1,65536,"Wordzap (U) [BF]"},
{0xe8e57b50,65536,"Wordzap (U)"},
{0xeaa9a468,131072,"World Beach Volleyball 1991 GB Cup (J) [BF]"},
{0xa2894581,131072,"World Beach Volleyball 1991 GB Cup (J)"},
{0x47feadf2,32768,"World Bowling (J)"},
{0x896e76a2,32768,"World Bowling (U)"},
{0x77c3aa0b,131072,"World Circuit Series (U)"},
{0x50c2ada1,131072,"World Cup (J)"},
{0x6a3272b1,524288,"World Cup '98 (UE) [S][!]"},
{0xfdefa88d,131072,"World Cup Striker (J)"},
{0x9d27f9de,262144,"World Cup USA '94 (J)"},
{0x60231f83,262144,"World Cup USA '94 (UE) [!]"},
{0x67303954,524288,"World Heroes 2 Jet (U) [S][!]"},
{0x2914e23d,131072,"World Ice Hockey (J) [BF]"},
{0x4e345023,131072,"World Ice Hockey (J)"},
{0x57d21ef4,524288,"World Soccer GB (J) [S]"},
{0x66130a7a,65536,"Worm Visitor (Game 4 of Sachen 4-in-1 Volume 5) (Unl) [!]"},
{0x2ebc40c2,262144,"Worms (U) [!]"},
{0x3ab55613,131072,"WWF - King of the Ring (J)"},
{0x7f0cd87c,131072,"WWF - King of the Ring (U) [!]"},
{0x63faab12,262144,"WWF Raw (U) [BF]"},
{0x1889552f,262144,"WWF Raw (U)"},
{0xf28e5aa1,131072,"WWF Superstars (J)"},
{0xadbc4e0a,131072,"WWF Superstars (UE) [!]"},
{0xca12d752,131072,"WWF Superstars 2 (J)"},
{0x8ece1c04,131072,"WWF Superstars 2 (U) [!]"},
{0x6015b7e1,262144,"WWF Warzone (U)"},
{0x75e1d268,262144,"Xekkusu (J) [!]"},
{0x2feb70d2,131072,"Xenon 2 (J)"},
{0xde398678,131072,"Xenon 2 (U)"},
{0xa197bdb7,524288,"Xerd!! (J)"},
{0xa6905fb2,131072,"Xiang Pu -- Dong Hai Dao Chang Suo (Sumo Fighter) (J)"},
{0x022eb849,131072,"XVII Olympic Winter Games, The - Lillehammer 1994 (U) [BF]"},
{0x1a98f0a4,131072,"XVII Olympic Winter Games, The - Lillehammer 1994 (U)"},
{0xcc19768e,262144,"Yaiba (J) [!]"},
{0xd185b939,524288,"Yaka Sekaishi (J)"},
{0x90cb60c1,32768,"YakyuMan (J)"},
{0xa09c1790,524288,"Yamakawa Nihon (J)"},
{0x402d4d47,65536,"Yannick Noah Tennis (F)"},
{0x5b66e143,32768,"Yie Ar Kung Fu (V1.1) (Unl)"},
{0x6e7bb436,131072,"Yogi Bear in Yogi Bear's Goldrush (E) [!]"},
{0xa86bd81b,131072,"Yogi Bear in Yogi Bear's Goldrush (U) [!]"},
{0xc8e01c7c,262144,"Yojijukugo 288 (J)"},
{0x46af90da,262144,"Yoku Tsukawareru Eiken 2 Kyuu Level no Kaiwa Hyougen 333 (J)"},
{0xf2f4bcca,65536,"Yoshi (U) [!]"},
{0x75336712,131072,"Yoshi's Cookie (U) [!]"},
{0xa37255fe,131072,"Yossi no Cookie (J)"},
{0x9b6fcc76,65536,"Yossi no Tamago (J)"},
{0x3beb7239,524288,"Yossy no Panepon (J)"},
{0x8875ec54,1048576,"Yugio (J) [S]"},
{0x7103b4ac,262144,"Yuuyuu 1 (J)"},
{0x6a6d7350,262144,"Yuuyuu 2 (J)"},
{0x25c618f6,262144,"Yuuyuu 3 (J)"},
{0x3e7c6b2b,262144,"Yuuyuu 4 (J) [S]"},
{0xa67cd2cc,262144,"Yuu-Yuu Hakusho 3 (J)"},
{0x26d2d5c2,524288,"Z - Miracle of the Zone, The (J) [S]"},
{0xdc010f04,262144,"Z Kai - Chuga Kueitango 1132 Translator (J)"},
{0xd792f747,262144,"Z Kai - Eigo Kobun 285 Translator (J)"},
{0x3fac5c42,262144,"Z Kai - Etan 1500 Translator (J)"},
{0x12e738ea,262144,"Z Kai - Jukugo 1017 Translator (J)"},
{0xb3114619,262144,"Z Kai - Kyukyoku no Kobun Tango (J) [a1]"},
{0x99062c13,262144,"Z Kai - Kyukyoku no Kobun Tango (J)"},
{0x995d0838,1048576,"Zankurou Musouken (J) [S][!]"},
{0x7bfd1cff,131072,"ZAS (J)"},
{0x642c7ebe,131072,"Zen Intergalactic Ninja (E)"},
{0x88190730,131072,"Zen Intergalactic Ninja (U)"},
{0x119bcad5,262144,"Zennichi Jet Japan Pro Wrestling (J) [S]"},
{0x7279b3c4,65536,"Zipball (Game 4 of Sachen 4-in-1 Volume 9) (Unl) [!]"},
{0x684d1484,32768,"Zipball (Unl)"},
{0xc32dca06,65536,"Zoids (J)"},
{0xfc6f3bc2,32768,"Zoo Block (Sachen) (Unl) [!]"},
{0xae13e227,131072,"Zool (E) (Gremlin) [!]"},
{0xef54b46e,131072,"Zool (U) (Gametek) [!]"},
{0x10e1a10c,65536,"Zoop (J)"},
{0x14f8b6bb,65536,"Zoop (U) [!]"},
{0x96d343cf,524288,"Last Bible 2 (Chinese) [p1][!]"},
{0xc5571f88,1048576,"Pokemon Blue (Chinese) [S][p1][!]"},
{0x727d5509,131072,"Prehistorik Man (J) [S]"},
{0x44257f02,524288,"SD Gundam Gaiden - Lacroan Heroes (Chinese) [p1][!]"},
{0xb07a2745,65536,"Splitz (J)"},
{0x7e054a88,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U)"},
{0xce457dfd,262144,"Batman Forever (U) [BF]"},
{0x41dbb5fb,262144,"Bionic Commando (U) [!]"},
{0x1bcad99d,524288,"Bugs Bunny - Crazy Castle 3 (J) [f1]"},
{0x67a45d19,131072,"Chase HQ (V1.1) (U) [!]"},
{0x35d9be0e,131072,"Days of Thunder (U) [!]"},
{0x3ef2e823,131072,"DX Bakenoh Z (V1.0) (J)"},
{0xbead8ae4,65536,"Elevator Action (J) [!]"},
{0xaf4a5de1,524288,"FIFA Soccer '96 (U) [S]"},
{0xe3b59b7e,131072,"Fortified Zone (Ikari no Yousai) (U)"},
{0x1c2ba2a1,131072,"Ikari no Yousai (Fortified Zone) (J)"},
{0x9c6a4918,131072,"Kachiu Mayoso Keiba Kizoku Ex 95 (J)"},
{0xfc20ebf0,131072,"Legend (J)"},
{0x17533700,262144,"Mario's Picross (J) [S]"},
{0x85c984f2,262144,"Mogu Mogu Gombo (J) [S]"},
{0xd3741a3a,131072,"Ninja Gaiden Shadow (U)"},
{0x2d08d27f,131072,"Oira Jajamaru Sekaidai Boken (J) [!]"},
{0x6da713e3,131072,"Pinball Dreams (UE) [!]"},
{0xf8c2504d,1048576,"Pocket Monsters Green (Chinese Blue Hack) (J) [S]"},
{0xd622859a,1048576,"Pocket Monsters Yellow (V1.0) (Chinese) (Unl) [S]"},
{0x796fbb66,65536,"Racing Damashii (J) [!]"},
{0x4e05537e,65536,"Ranma Nibun no Ichi (J)"},
{0xb7a0cdd1,524288,"Rockman World 4 (J) (hacked Megaman)"},
{0x0d4c02a7,262144,"Sanrio Uranai Party (J)"},
{0x87f0cfad,262144,"Shikakui Atama wo Maruku Suru - Shakai Battle (J)"},
{0x701ccdb3,65536,"Solomon's Club (UE) [!]"},
{0xf8fc0b41,262144,"Takahashimeijin no Bouken Jima 3 (J)"},
{0x5d2bd778,262144,"TinTin in Tibet (U) [S]"},
{0xc88e751d,262144,"Turok - Battle of the Bionosaurs (J)"},
{0x32c94538,524288,"Wizardry Gaiden 3 - Scripture of the Dark (J) [!]"},
{0xb14920f0,2097152,"Animaster GB (J) [!]"},
{0xe6607e29,32768,"Othello (UE) [!]"},
{0x57dc27ab,524288,"Gawa no Kawanushi 3 (J) [S][p1][!]"},
{0x96bdcb9c,540672,"Mortal Kombat I & II (U) [!]"},
{0x47e86daf,1048576,"Mortal Kombat I & II (U) [f1]"},
{0x8c17aae6,1048576,"Pocket Monsters Yellow (Chinese) (Unl) [S][!]"},
{0x07b1be0b,1048576,"Super Minna no Konchu Daizukan II (Unl)"},
{0x600a6ad5,262144,"Bubsy 2 (U) [!]"},
{0x78bf3633,131072,"Caesar's Palace (E) (M5)"},
{0x4e17d08a,131072,"Gargoyle's Quest - Ghosts'n Goblins (F)"},
{0xa3164516,262144,"Bubsy 2 (U) [h1]"},
{0xc66fc56f,262144,"Aguri Suzuki F-1 Super Driving (J) [h1]"},
{0xb61e47b4,131072,"Amazing Spider-Man 2, The (UE) [h1]"},
{0xe994484d,131072,"Amazing Spider-Man 2, The (UE) [h2]"},
{0xa1cb2933,65536,"Amazing Spider-Man, The (UE) [h1]"},
{0x7b23e05c,262144,"Animaniacs (U) [S][h1]"},
{0x08108068,262144,"Animaniacs (U) [S][h2]"},
{0xe928c629,524288,"Battle Arena Toshinden (J) [S][h1]"},
{0x1884cb21,131072,"Battle Unit Zeoth (J) [h1]"},
{0x7cbde1a9,262144,"Bionic Commando (J) [h1]"},
{0xbde5077e,131072,"Block Kuzushi (J) [S][h1]"},
{0xb0b5a5de,1048576,"Bokemob V2.2 (Pokemon Blue Hack) [h1]"},
{0x46631a03,1048576,"Bokemob v2.5 (Pokemon Blue Hack) [h1]"},
{0x4389fb4b,131072,"Boku Drakura Kun 2 (Castlevania 2) (J) [h1]"},
{0xdf72a7ef,65536,"Boomer's Adventure in ASMIK World (J) [h1]"},
{0xe11202c7,65536,"Boomer's Adventure in ASMIK World (U) [h1]"},
{0x8b5d3ec1,65536,"Boomer's Adventure in ASMIK World (U) [h2]"},
{0x6f848e69,131072,"Boomer's Adventure in ASMIK World 2 (J) [h1]"},
{0xe446121c,131072,"Bubble Bobble (U) (GB) [h1]"},
{0x23ea8d35,32768,"Bubble Ghost (U) [h1]"},
{0xa50bd433,32768,"Bubble Ghost (U) [h2]"},
{0xf04675ad,65536,"Bugs Bunny (U) [h1]"},
{0xb61f5352,524288,"Captain Tsubasa (J) [S][h1]"},
{0xb3f577bc,262144,"Captain Tsubasa VS (J) [h1]"},
{0x3fe36a93,131072,"Casino Funpak (U) [h1]"},
{0x14598061,131072,"Casino Funpak (U) [h2]"},
{0x3d0f9750,32768,"Castelian (U) [h1]"},
{0x02349cb4,131072,"Castle Quest (U) [h1]"},
{0x3e2c6d68,131072,"Castle Quest (U) [h2]"},
{0xfd1f0679,262144,"Cave Noire (J) [h1]"},
{0xc0a682c8,65536,"Chacha Maru Panic (J) [h1]"},
{0x5aaa2d5d,65536,"Chibi Maruko Chan - Okozukaidaisakusen (J) [h1]"},
{0x6b9c4cdf,262144,"Chiki Race (J) [h1]"},
{0x2814c76f,131072,"Chuck Rock (U) [h1]"},
{0x9e784cd2,131072,"Chuck Rock (U) [h2]"},
{0xbf2ab01f,131072,"Chuck Rock (U) [h3]"},
{0x3b7c6a1d,131072,"Chuck Rock (U) [h4]"},
{0x5690de6c,131072,"Chuck Rock (U) [h5]"},
{0xaaa41a14,131072,"Chuck Rock (U) [h6]"},
{0x431e7467,131072,"Chuck Rock (U) [h7]"},
{0xab3c7bb9,131072,"Chuck Rock (U) [h8]"},
{0x734502ab,262144,"Daffy Duck - The Marvin Missions (J) [S][h1]"},
{0xf1c6b5ed,262144,"Daisenryaku Hiro (J) [h1]"},
{0xa0d3a21b,262144,"Daisenryaku Hiro (J) [h2]"},
{0xc3171dd8,524288,"Donkey Kong Land (U) [S][h1]"},
{0x9c14b87b,524288,"Donkey Kong Land (U) [S][h2]"},
{0x9f72cbb7,131072,"Doraemon (J) [h1]"},
{0xce29eae5,131072,"Doraemon 2 (J) [h1]"},
{0x20a48781,131072,"Double Dragon (J) [h1]"},
{0x0e1de7ff,32768,"Dr. Hatio V1.0 (Dr. Mario Hack) [h1]"},
{0xd24b141c,32768,"Dr. Mario (V1.0) (JU) [h1]"},
{0xd676691b,32768,"Dr. Mario (V1.0) (JU) [h2]"},
{0xa6353c07,262144,"Dragon Slayer 2 (Dorasure Gaiden) (J) [h1]"},
{0x9f07e00c,131072,"Dragon's Lair (J) [h1]"},
{0x2f1f6e71,131072,"Duck Tales 2 (U) [h1]"},
{0x46141ef6,1048576,"Dude, Where's My Char v0.01 (Pokemon Blue Hack) [h1]"},
{0x819fd93c,262144,"Exchanger (J) [S][h1]"},
{0xb604565f,262144,"F-1 Pole Position (U) [h1]"},
{0x9aaa0e38,262144,"F-1 Pole Position (U) [h2]"},
{0xf9444f7f,262144,"F-1 Pole Position (U) [h3]"},
{0xf8cc4dfd,131072,"F-1 Spirit (J) [h1]"},
{0x34d0eb55,131072,"Final Fantasy Legend (Sa-Ga) (U) [h1]"},
{0x5cd18d2e,262144,"Final Fantasy Legend II (Sa-Ga 2) (U) [h1]"},
{0x3bb2d561,262144,"Final Fantasy Legend II (Sa-Ga 2) (U) [h2]"},
{0xadb58ca4,262144,"Final Fantasy Legend II (Sa-Ga 2) (U) [h3]"},
{0xfa154fd6,262144,"Final Fantasy Legend III (Sa-Ga 3) (U) [h1]"},
{0xafb75ca9,262144,"Final Fantasy Legend III (Sa-Ga 3) (U) [h2]"},
{0xc6f02ec9,262144,"Final Fantasy Legend III (Sa-Ga 3) (U) [h3]"},
{0xb94722f2,262144,"Flintstones, The (U) [h1]"},
{0x3d0cf664,262144,"Foreman for Real (U) [h1]"},
{0x81cd6254,8192,"Game Genie V1.17 (Unl) [h1]"},
{0xd9f7f72d,131072,"Gargoyle's Quest - Ghosts'n Goblins (UE) [h1]"},
{0xa771f632,262144,"GB Genjin 2 (Bonk's Revenge) (J) [S][h1]"},
{0x271ff1b3,262144,"Go Go Ackman (J) [S][h1]"},
{0x4240b81c,262144,"Go Go Ackman (J) [S][h2]"},
{0x1acc359f,131072,"Home Alone 2 (U) [h1]"},
{0x819f1072,131072,"Houghton Mifflin Spell Checker and Calculator (U) [h1]"},
{0x13bf0573,131072,"Houghton Mifflin Spell Checker and Calculator (U) [h2]"},
{0x10e42f20,131072,"Jungle Book. The (U) [h1]"},
{0xa055ed80,262144,"Jurassic Park 2 - The Chaos Continues (UE) [S][h1]"},
{0xf5e08610,131072,"Kid Icarus - Of Myths and Monsters (UE) [h1]"},
{0x3b9b4ceb,131072,"Kid Icarus - Of Myths and Monsters (UE) [h2]"},
{0x9c19c0c2,131072,"Kid Icarus - Of Myths and Monsters (UE) [h3]"},
{0x574c0084,262144,"Knal Fantasy Adventure (Rev 1) (Final Fantasy Adv Hack) (U) [h1]"},
{0x3fc8db0e,65536,"Kung-Fu Master (Spartan X) (U) [h1]"},
{0x967c1fad,524288,"Legend of Zelda, The - Link Gets Laid (P3 hack) (1) [h1]"},
{0x0bc927bc,524288,"Legend of Zelda, The - Link Gets Laid (P3 hack) (2) [h1]"},
{0x7f989f50,524288,"Legend of Zelda, The - Link Gets Laid (P3 hack) (3) [h1]"},
{0x28965e82,262144,"Metroid 2 - Samus Bares All (P3 Hack) [h1]"},
{0x6c7c652d,131072,"Miracle Adventure of Esparks (J) [h1]"},
{0x08f13b2f,524288,"Momotaro Dengeki 2 (J) [S][h1]"},
{0xd91de820,32768,"Motocross Maniacs (J) [h1]"},
{0x8ffd9e61,262144,"Mystic Quest (U) [h1]"},
{0xe8bc8f03,524288,"Nettou Garou 2 (J) [S][h1]"},
{0x78c44066,524288,"Nettou King of Fighters '95 (J) [S][h1]"},
{0x039c27bd,524288,"Nettou King of Fighters '96 (J) [S][h1]"},
{0x63e41242,1048576,"Oak's Dream V0.15 (Pokemon Blue hack) (U) [S][h1]"},
{0x4510d5ed,131072,"Out of Gas (U) [h1]"},
{0xb847ca23,466126,"Pikabomber v0.10 (Bomberman GB Hack) [h1]"},
{0x0b17d36b,524288,"Pikabomber v1.10 (Pocket Bomberman Hack) [h1]"},
{0xdf2fd2ba,1048576,"Pokemon - Aqua v2.4 (Pokemon Red Hack) [h1]"},
{0x5bc7bf93,1048576,"Pokemon - Revolution v2.0 (Pokemon Red Hack) [h1]"},
{0x1d7c0fd6,1048576,"Pokemon Blue (UA) [S][h1] (Sonic the Hedgehog)"},
{0x29cd1812,1048576,"Pokemon Blue Upgrade V2.0 (Blue hack) (U) [S][h1]"},
{0x01f04aaa,1048576,"Pokemon Meowth (Blue Hack) [h1]"},
{0x64b3d034,1048576,"Pokemon Meowth (Red Hack) [h1]"},
{0x934cbf91,1048610,"Pokemon Neo - Adventure v2.8 (Pokemon Red Hack) [h1]"},
{0xf7ac3553,1048576,"Pokemon Neo - Rocket v2.1 (Pokemon Blue Hack) [h1]"},
{0xb2309279,1048576,"Pokemon Red Upgrade V2.0 (Red hack) (U) [S][h1]"},
{0xabb17913,2097152,"Pokemon Red-Blue 2-in-1 (Unl) [S][h1]"},
{0x45b3a0d2,2097152,"Pokemon Red-Blue 2-in-1 (Unl) [S][h1][a1]"},
{0xb22d7ac4,1048576,"Pokemon Trep Edition V0.01 (Blue hack) (U) [S][h1]"},
{0x69715097,1048576,"Pokemon Z V3.0 (Red hack) (U) [S][h1]"},
{0x74de3a9d,65536,"Q-bert II (UEA) [h1]"},
{0xa0a04c07,65536,"Qix (JU) [h1] (Hi-score patch)"},
{0x7e8c53eb,262144,"Ranma Nibun no Ichi - Kakugeki!! (J) [h1]"},
{0x88edc83d,131072,"Road Rash (U) [h1]"},
{0xb1f7970a,131072,"Road Rash (U) [h2]"},
{0x4f09238a,131072,"Road Rash (U) [h3]"},
{0x7c4e55cc,524288,"Rockman World 4 (J) [h1]"},
{0x59b7091e,131072,"R-Type 2 (U) [h1]"},
{0x65b1a2c1,131072,"Sagaia (J) [h1]"},
{0xe05843d3,131072,"Saiyuuki (J) [h1]"},
{0xd4d0870c,131072,"Satoru Nakajima - F-1 Hero '91 (J) [h1]"},
{0x7b54c00e,131072,"Simpsons, The - Bart vs the Juggernauts (U) [h1]"},
{0x01fbc9f6,131072,"Simpsons, The - Krusty's Funhouse (J) [h1]"},
{0x0fd0896c,131072,"Smurfs, The (V1.0) (E) [h1]"},
{0xc837c92a,131072,"Smurfs, The (V1.0) (E) [h2]"},
{0xc38b2391,131072,"Smurfs, The (V1.0) (E) [h3]"},
{0xe8dc982b,131072,"Snow Bros Jr. (J) [h1]"},
{0x9eb673e6,65536,"Solar Striker (JU) [h1]"},
{0x9bb6aa01,65536,"Spanky's Quest (U) (Natsume) [h1]"},
{0xb963e379,65536,"Spanky's Quest (U) (Natsume) [h2]"},
{0xa371df71,131072,"Speed Ball 2 - Brutal Deluxe (U) [h1]"},
{0xa91369f7,262144,"Speedy Gonzales (U) [h1]"},
{0xa1c6841e,262144,"Speedy Gonzales (U) [h2]"},
{0x815c408f,524288,"Star Wars - Super Return of the Jedi (U) [S][h1]"},
{0x74c4d70a,262144,"Super Chinese Land 3 Dash (J) [S][h1]"},
{0xca6367be,131072,"Super Mario 4 (Unl) [h1]"},
{0xf025bc56,131072,"Super Mario 4 (Unl) [h2]"},
{0xf5962ac6,131072,"Super Mario 4 (Unl) [h3]"},
{0xd4a9b338,1048576,"Super Mario Bros. DX (Mono Hack) (V1.0) (U) [h1]"},
{0x2eee5e26,65536,"Super Mario Land (V1.1) (JUA) [h1]"},
{0x493a869e,65536,"Super Mario Land (V1.1) (JUA) [h2]"},
{0xf71f26d0,524288,"Super Mario Land 2 - 6 Golden Coins (V1.0) (UE) [h1]"},
{0x074a875f,524288,"Super Mario Land 3 - Wario Land (JUE) [h1]"},
{0x07072e53,65536,"Super Pika Land (Super Mario hack V0.5 by PR) [h1]"},
{0x94315c53,65536,"Super Pika Land (Super Mario hack V1.0 by PR) [h1]"},
{0x1d8b4edf,65536,"Super Pika Land (Super Mario hack V1.5 by PR) [h1]"},
{0x800c8f35,65536,"Super Pika Land (Super Mario hack V2.0 by PR) [h1]"},
{0x8cc49088,131072,"Super Pika Land (Super Mario hack Vx.x by PR) [a1][h1]"},
{0x9ef4afdd,65536,"Super Pika Land (Super Mario hack Vx.x by PR) [h1]"},
{0xed8a73fb,131072,"Teenage Mutant Ninja Turtles - Fall of the Foot Clan (U) [h1]"},
{0x864cb0a0,131072,"Teenage Mutant Ninja Turtles 3 - Radical Rescue (J) [h1]"},
{0xdf32e098,131072,"Tom & Jerry Part 2 (J) [h1]"},
{0x87d5c1c3,131072,"Total Carnage (U) [h1]"},
{0xb9b05901,262144,"V-Rally - Championship Edition (E) (M3) [h1]"},
{0xd77bd2e2,131072,"World Beach Volleyball 1991 GB Cup (J) [h1]"},
{0x6224f18c,262144,"World Cup USA '94 (UE) [h1]"},
{0xfde13d25,1048576,"Gameboy Camera (UAE) [S][h1]"},
{0x8a8ca2b9,65536,"Boy and His Blob, A - Rescue of Princess Blobette (U)(Abs)[h1]"},
{0xd46965d6,1048576,"Pokemon Red (U) [S][h1]"},
{0xcb11e76d,65536,"Super Pikaland by PR_Trans (Mario hack) [h1]"},
{0x0374eaaf,131072,"Batman - Return of the Joker (J) [h1]"},
{0xd685098d,32769,"Alleyway (JUA) [o1]"},
{0x2d687a16,262144,"Amazing Spider-Man 3, The - Invasion of the Spider-Slayers (U) [o1]"},
{0xfc2556a0,262144,"Aretha (J) [o1]"},
{0x4f8f1d7d,262144,"Aretha (J) [o2]"},
{0x276a6b92,131072,"Battleship (U) (GB) [o1]"},
{0x0ce26be8,66048,"Battleship (U) (GB) [o2]"},
{0x48db80b2,270336,"Best of the Best - Championship Karate (U) [o1]"},
{0xe38ea075,270336,"Best of the Best - Championship Karate (U) [o2]"},
{0x198b409e,131073,"Blades of Steel (U) (GB) [o1]"},
{0xa09e5089,32769,"Bomb Jack (U) [o1]"},
{0x96e4cc7a,655360,"Bomberman GB (J) [S][o1]"},
{0x838c719f,262146,"Bomberman GB (J) [S][o2]"},
{0xc7162745,262144,"Bubble Bobble Part 2 (U) [o1]"},
{0x1fef71e0,131073,"Bubble Bobble Part 2 (U) [o2]"},
{0xc06cf1ed,139264,"Castlevania 2 - Belmont's Revenge (U) [o1]"},
{0x4621b29b,262144,"Cave Noire (J) [o1]"},
{0x65d50364,262144,"Cave Noire (J) [o2]"},
{0x2d24a214,262144,"Cave Noire (J) [o3]"},
{0xf999d21e,262144,"Chiki Race (J) [o1]"},
{0x5c9bb1de,262144,"Chiki Race (J) [o2]"},
{0x51ca510c,131073,"Choplifter 3 (UE) [o1]"},
{0x1a1b6a0d,262144,"Choplifter 3 (UE) [o2]"},
{0x69953653,262144,"Daisenryaku Hiro (J) [o1]"},
{0x6135f956,262144,"Daisenryaku Hiro (J) [o2]"},
{0xe2ab56b5,262656,"Desert Strike - Return to the Gulf (E) (Ocean) [S][o1]"},
{0xd8644d8d,262144,"Dragon Slayer 2 (Dorasure Gaiden) (J) [o1]"},
{0xd392ffc8,262144,"Dragon Slayer 2 (Dorasure Gaiden) (J) [o1][h1]"},
{0xad1f068f,262144,"Dragon Slayer 2 (Dorasure Gaiden) (J) [o2]"},
{0x34160c9f,65538,"Elevator Action (U) [o1]"},
{0x3419731d,262144,"F-1 Race (V1.1) (JUE) [o1]"},
{0x55de2dd1,139264,"Faceball 2000 (U) [o1]"},
{0x5d423271,262144,"Fastest Lap (JU) [o1]"},
{0x0bb4fcfe,262144,"Fire Fighter (U) [o1]"},
{0x6dd6bb45,139264,"Fire Fighter (U) [o2]"},
{0xd4a7cd0d,32768,"Game Genie V1.17x (Unl) [o1]"},
{0xa8c022bc,270336,"Gauntlet 2 (U) [o1]"},
{0x943db6ca,262144,"Golf (JUA) [o1]"},
{0x0c6e3574,262144,"Golf (JUA) [o2]"},
{0xfb7bcb59,262144,"Golf (JUA) [o3]"},
{0xb63f7f49,524288,"Golf Classic (U) [S][o1]"},
{0x061d751c,270336,"Gradius - The Interstellar Assault (U) [o1]"},
{0x843bbef1,270336,"Humans, The (U) [o1]"},
{0x05193c99,270336,"Humans, The (U) [o2]"},
{0xc4d84b2e,139264,"Incredible Crash Dummies, The (U) [o1]"},
{0x68bea5b3,262144,"Incredible Crash Dummies, The (U) [o2]"},
{0x0bc05c1e,236352,"Jurassic Park (U) [o1]"},
{0x774fc218,262144,"Kid Icarus - Of Myths and Monsters (UE) [o1]"},
{0x9529e3a5,262144,"Legend (J) [o1]"},
{0x98e92fc6,262144,"Legend (J) [o2]"},
{0x69c1825e,262144,"Little Master (J) [o1]"},
{0x110295d0,66048,"Mario & Yoshi (E) [o1]"},
{0x11a64fbe,65538,"Mario & Yoshi (E) [o2]"},
{0xcbe980a5,262146,"Mega Man 2 (E) [o1]"},
{0x85a1c904,262144,"Mercenary Force (UE) [o1]"},
{0xa67bb0d8,524288,"Micro Machines (U) [o1]"},
{0xf0e16369,524288,"Micro Machines (U) [o3]"},
{0xee3d0ac9,139264,"Milon's Secret Castle (U) [o1]"},
{0xf112b855,139264,"Milon's Secret Castle (U) [o2]"},
{0x14eb03c7,262144,"Nekojara (J) [o1]"},
{0x6894cb7e,262144,"Nekojara (J) [o2]"},
{0xb13fd260,262144,"Ninja Taro (U) [o1]"},
{0x60d36049,139264,"Ninja Taro (U) [o2]"},
{0x84102a6d,73728,"Paperboy (U) [o1]"},
{0x6ddfa19c,262144,"Pocket Mahjang (J) [o1]"},
{0x26e8182d,139264,"Popeye 2 (U) [o1]"},
{0xf46a5d02,262144,"Puro Stadium '91 (Pro Yakyu Stadium '91) (J) [o1]"},
{0xd63eeeeb,262144,"Sa-Ga (Final Fantasy Legend) (V1.1) (J) [o1]"},
{0x080f1643,262144,"Sa-Ga (Final Fantasy Legend) (V1.1) (J) [o2]"},
{0xb4cf385a,262144,"SD Gundam Gaiden - Lacroan Heroes (J) [o1]"},
{0x423239b2,262144,"Sengoku Ninjakun - Ninja Taro (J) [o1]"},
{0xd6b0002e,139264,"Smurfs, The (V1.1) (UE) [S][o1]"},
{0xbfa0e0a3,32769,"South Pong (PD) [o1]"},
{0x23a22b48,139264,"Star Wars - The Empire Strikes Back (U) (Capcom) [o1]"},
{0x7ae3ef0c,524288,"Super Bombliss (J) [S][o1]"},
{0x069c777a,524288,"Super Bombliss (J) [S][o2]"},
{0x36a6fe3f,177588,"Super Mario 4 (Unl) [h1][o1]"},
{0x824e7873,262144,"Super Robot War (J) [o1]"},
{0x201e7477,262144,"Super Robot War (J) [o2]"},
{0x55aeb65b,262144,"Sword of Hope, The (U) [o1]"},
{0x6dac1ca3,131073,"Sword of Hope, The (U) [o2]"},
{0x182d42ff,33280,"Tennis (JUA) [o1]"},
{0xf0ce6707,208856,"Tom & Jerry (U) [o1]"},
{0xee7f641b,262144,"Torpedo Range (J) [o1]"},
{0xda521d4c,262144,"Torpedo Range (J) [o2]"},
{0xb742dc3c,262144,"Velious II (J) [o1]"},
{0x461b9277,524288,"XVII Olympic Winter Games, The - Lillehammer 1994 (U) [o1]"},
{0xe3d9365d,524288,"Flappy Special (J) [o1]"},
{0x2975eb4b,450000,"Micro Machines (U) [o2]"},
{0x0746b172,32768,"Adventure V0.1 (PD)"},
{0x2a5f8775,32768,"Adventure V0.2 (PD)"},
{0x715afdc0,32768,"Adventure V0.3 (PD)"},
{0x1e755cf5,32768,"American Jesus (PD)"},
{0x71736fa9,32768,"Ant Hill (Bung) (PD) [a1]"},
{0xc220f791,32768,"Ant Hill (Bung) (PD)"},
{0xff24ed7d,131072,"Ant Soldiers (Demo) (PD)"},
{0x5056e805,32768,"Apocalypse Now Demo (PD) [a1]"},
{0xb4a584af,32768,"Apocalypse Now Demo (PD)"},
{0xca88b489,32768,"Apple Demo (PD)"},
{0x1b319ad3,2097152,"Armageddon Video Trailer (GBTK Video) (1) (PD)"},
{0x87894863,2097152,"Armageddon Video Trailer (GBTK Video) (2) (PD)"},
{0x1ad8528f,32768,"ASCII Wars (V1.1) (PD)"},
{0x7aba98d2,32768,"Ash Demo (PD)"},
{0xa963db6e,524288,"Asukatti Slide Show (PD)"},
{0xbb2acf13,32768,"Atari 2600 Boxing (PD)"},
{0x9de36835,32768,"Balloon Man (PD)"},
{0x4c9b5d3b,32768,"BBS Demo (Quang2000) (PD)"},
{0xa729d9fc,32768,"Big Scroller Demo (PD)"},
{0xcf8e38a5,32768,"Blastroids (PD)"},
{0x9e9165c2,32768,"Bounce (Quang2000) (PD)"},
{0x6f62f388,32768,"Bounce by Jarvik7 (Bung) (PD)"},
{0x08ee11bd,65536,"Boxes (Bung) (PD)"},
{0xdfacb455,65536,"Boxes (PD)"},
{0xdbface65,32768,"Bung Cart Slideshow (PD)"},
{0x5b9d40ee,32768,"Bung Trivia 1 (PD)"},
{0x86b13d7c,32768,"Bung Trivia 2 (PD)"},
{0xb61d7e20,32768,"Car (Bung) (PD)"},
{0x6d6510e6,32768,"Card Shuffle (PD)"},
{0x3a3fe1d0,32768,"Chapter 4 Link Test (PD)"},
{0x64d048e0,131072,"Chip the Chick (PD)"},
{0x138d44ea,32768,"Clock (PD)"},
{0xe5671fb4,32768,"Clown Demo (1) (PD)"},
{0xea3e2a6c,32768,"Clown Demo (2) (PD)"},
{0x71e40027,32768,"Clown Demo (PD)"},
{0x70b2a4ff,32768,"Collision Detection 1.0 (PD)"},
{0xde190a81,32768,"Collision Detection 1.20 (PD)"},
{0x4acb4cd3,32768,"Collision Detection 1.40 (PD)"},
{0x445e9196,32768,"Collision Detection 1.50 (PD)"},
{0x55a37ad1,32768,"Collision Detection 1.60 (PD)"},
{0xc8e01222,32768,"Collision Detection 1.61 (PD)"},
{0x0411c465,32768,"Color Collapse (PD)"},
{0x02bca193,32768,"Commando (PD)"},
{0xcbe00b80,32768,"Commando Death (PD)"},
{0x9fbd92c5,32768,"Crash (PD)"},
{0xfa86dff6,32768,"Cricket (PD)"},
{0x3f47ed05,32768,"Dan Laser Demo (PD)"},
{0x7656ed0c,131072,"Dawn Demo (PD)"},
{0xc8acc076,32768,"Dirty Pair Flash Picture (PD)"},
{0x6473ac4b,32768,"Distortion Demo by Anders Granlund (PD)"},
{0x90cc4679,32768,"Dog Demo (PD)"},
{0xbb6e47ec,32768,"Doodlebug (PD)"},
{0xc7d76f59,32768,"Downhill Ski (PD)"},
{0xf15065f7,32768,"DragonEagle's GBDK Printer Library (PD)"},
{0xcc8686e0,32768,"Dungeon Escape (1) (PD)"},
{0x857f4396,32768,"Dungeon Escape (3) (PD)"},
{0xef967254,131072,"Effigy (Bung V4) (PD)"},
{0x1828f608,32768,"Emulators Unlimited Demo (PD)"},
{0x6d84a0b9,32768,"EVA Pong (PD)"},
{0xe08ba6fd,32768,"F-1 Racing 2000 Demo (PD)"},
{0x133680a6,32768,"Flare Squip (PD) [a1]"},
{0x7a086503,32768,"Flare Squip (PD)"},
{0x31ca2f78,32768,"Fogel V0.45 (PD)"},
{0xcfedc76d,32768,"Gabe Edit V0.1 (PD)"},
{0x3c3de96b,32768,"Galaga Demo (PD)"},
{0xba8970cd,32768,"Gameboy Printer Emulator V1.0 by Jeff Frohwein (PD)"},
{0x10871d19,32768,"Gameboy Stop Watch (PD)"},
{0x2dd6d4bc,32768,"GameDepot.com Credits Scroll (PD)"},
{0x7377a635,32768,"GAY (Tennis) (PD)"},
{0x41e35edc,32768,"GB ALS V1.0f (PD)"},
{0x1bee795f,32768,"GB Basic V1.06 (PD)"},
{0xd33905a6,32768,"GB Basic V1.21 (PD)"},
{0x508b4f38,16384,"GB Basic V1.22 (PD) [a1]"},
{0xd48af9b4,32768,"GB Basic V1.22 (PD)"},
{0x35c3994d,32768,"GB Cart Mag-E-Zine Vol 1 Issue 1 October 2nd, 2000 (PD)"},
{0xb21d7bcd,65536,"GB Clock V1.0 (PD)"},
{0xb2a9cf4d,65536,"GB Clock V1.1 (PD)"},
{0xe983e4ca,65536,"GB Clock V1.2 (PD)"},
{0xde9436dd,32768,"GB Debug V1.3 (PD) [a1]"},
{0x0c0e7300,16384,"GB Debug V1.3 (PD)"},
{0xaf829534,32768,"GB Demo V1.1 (PD)"},
{0x3ed9534e,32768,"GB Demo V1.2 (PD)"},
{0x7f646c3e,32768,"GB DTMF Generator (PD)"},
{0x84f49fbe,32768,"GB Lander (PD)"},
{0xc436f50b,32768,"GB Pack V1.3 (PD) (GB)"},
{0xd0616672,32768,"GB Pack Vx.x (16Mbit) (PD) [a1]"},
{0xa0c8e9ad,32768,"GB Pack Vx.x (16Mbit) (PD) [a2]"},
{0x1bddf36f,32768,"GB Pack Vx.x (16Mbit) (PD)"},
{0x3de7419e,32768,"GB Pack Vx.x (4Mbit) (PD)"},
{0x7f9d0dc0,32768,"GB Printer Test Demo (PD)"},
{0xd26f958d,65536,"GB Pyritz Inc (PD)"},
{0x425640a9,32768,"GB Quiz for Kids (PD)"},
{0x7c1ef796,32768,"GB Sound Xperimenter V1.0 (PD)"},
{0xa1ec117d,32768,"GB Sound Xperimenter V1.3 (PD)"},
{0xb3acde3f,32768,"GB Tic-Tac-Toe (PD) [a1]"},
{0x775ae755,32768,"GB Tic-Tac-Toe (PD)"},
{0xe1f453fc,32768,"GBS Player V1.00 - Adventures of Lolo (PD)"},
{0x1ac49058,32768,"GBS Player V1.00 - Alien 3 (PD)"},
{0xee114794,32768,"GBS Player V1.00 - Altered Space (PD)"},
{0x28b254d7,32768,"GBS Player V1.00 - Balloon Kid (PD)"},
{0x568c1d0b,32768,"GBS Player V1.00 - Batman - Return of The Joker (PD)"},
{0x2a188c53,32768,"GBS Player V1.00 - Batman - The Animated Series (PD)"},
{0x4b2eb184,32768,"GBS Player V1.00 - Batman (PD)"},
{0x4dfe1262,32768,"GBS Player V1.00 - Battletoads (PD)"},
{0xd72db89f,32768,"GBS Player V1.00 - Bionic Command (PD)"},
{0x443e20b1,32768,"GBS Player V1.00 - Bonk's Adventure (PD)"},
{0x49b949c6,32768,"GBS Player V1.00 - Bubble Ghost (PD)"},
{0x97318580,32768,"GBS Player V1.00 - Castlevania 2 - Belmont's Revenge (PD)"},
{0x19a9f3f1,32768,"GBS Player V1.00 - Castlevania Adventure (PD)"},
{0xb45d7910,65536,"GBS Player V1.00 - Castlevania Legends (PD)"},
{0x40125bf4,32768,"GBS Player V1.00 - Dennis The Menace (PD)"},
{0x0f3edc56,32768,"GBS Player V1.00 - Donkey Kong Land (PD)"},
{0xdcdf9a09,32768,"GBS Player V1.00 - Dr. Franken (PD) [a1]"},
{0x19692466,32768,"GBS Player V1.00 - Dr. Franken (PD)"},
{0x721346f2,32768,"GBS Player V1.00 - Dr. Franken II (PD) [a1]"},
{0xb4cd041a,32768,"GBS Player V1.00 - Dr. Franken II (PD)"},
{0x707f5973,32768,"GBS Player V1.00 - Dr. Mario (PD)"},
{0x352714f7,32768,"GBS Player V1.00 - Fidgetts, The (PD)"},
{0xa241b00e,32768,"GBS Player V1.00 - Final Fantasy (PD)"},
{0xf93059f2,32768,"GBS Player V1.00 - Final Fantasy 2 (PD)"},
{0xeb4b5b10,32768,"GBS Player V1.00 - Final Fantasy 3 (PD)"},
{0x1d343e33,32768,"GBS Player V1.00 - Final Fantasy Adventure (PD)"},
{0x55d7eb86,32768,"GBS Player V1.00 - Gargoyle's Quest (PD)"},
{0x27b630cb,65536,"GBS Player V1.00 - Gradius - The Interstellar Assault (PD)"},
{0x8bf02d06,32768,"GBS Player V1.00 - Kaeru no Tameni (PD)"},
{0x1a24a27b,65536,"GBS Player V1.00 - Kid Dracula (PD)"},
{0xb98550ef,32768,"GBS Player V1.00 - Kirby's Dreamland (PD)"},
{0x4605d442,65536,"GBS Player V1.00 - Kirby's Dreamland 2 (PD)"},
{0x3c594503,65536,"GBS Player V1.00 - Legend of Zelda - Link's Awakening (PD)"},
{0xc80145a4,32768,"GBS Player V1.00 - Metroid 2 - Return of Samus (PD)"},
{0xaa791e97,32768,"GBS Player V1.00 - Monster Max (PD)"},
{0x0fc30b87,65536,"GBS Player V1.00 - Motocross Maniacs 2 (PD)"},
{0x1514dd1d,32768,"GBS Player V1.00 - Nemesis (PD)"},
{0x86be503f,32768,"GBS Player V1.00 - Ninja Gaiden Shadow (PD)"},
{0x092ed3ec,32768,"GBS Player V1.00 - Operation C (PD)"},
{0x6cf46b9c,32768,"GBS Player V1.00 - Parasol Stars (PD)"},
{0xc4807d72,65536,"GBS Player V1.00 - Parodius (PD)"},
{0x3a19fefc,65536,"GBS Player V1.00 - Pokemon Blue (PD)"},
{0xd2987103,65536,"GBS Player V1.00 - Pokemon Trading Card Game (PD)"},
{0x3b127895,32768,"GBS Player V1.00 - Quarth (PD)"},
{0x59e256c6,32768,"GBS Player V1.00 - Radar Mission (PD)"},
{0xc2fc53ab,32768,"GBS Player V1.00 - Ranma Nibun no Ichi - Part 2 (PD)"},
{0x03206056,32768,"GBS Player V1.00 - R-Type (PD)"},
{0x31818897,32768,"GBS Player V1.00 - R-Type 2 (PD)"},
{0x22dbbfdb,32768,"GBS Player V1.00 - Snow Bros. Jr. (PD)"},
{0x2d002645,32768,"GBS Player V1.00 - Solar Striker (PD)"},
{0xf948a84d,32768,"GBS Player V1.00 - Super Mario Land (PD)"},
{0x2e4d19d4,32768,"GBS Player V1.00 - Super Mario Land 2 - 6 Golden Coins (PD) [a1]"},
{0xcea3d9fd,32768,"GBS Player V1.00 - Super Mario Land 2 - 6 Golden Coins (PD)"},
{0x7ed39068,32768,"GBS Player V1.00 - Super Mario Land 3 - Wario Land (PD)"},
{0xe6cf0e7f,32768,"GBS Player V1.00 - Super Mario Land 3 - Warioland (PD)"},
{0x19cd2ef8,32768,"GBS Player V1.00 - Super RC Pro-Am (PD)"},
{0x39841437,32768,"GBS Player V1.00 - Tetris (PD)"},
{0xb59a3049,32768,"GBS Player V1.00 - Tiny Toon Adventures (PD)"},
{0xcf30bb33,32768,"GBS Player V1.00 - Tiny Toon Adventures 2 (PD)"},
{0x7ac713f2,32768,"GBS Player V1.00 - Twin-Bee (PD)"},
{0x8800a503,131072,"GBS Player V1.00 - Warioland 2 (PD)"},
{0x83407e85,32768,"GBS Player V1.00 - WWF Superstars (PD)"},
{0x68f15b7a,32768,"GBS Player V1.01 - Aladdin (PD)"},
{0xa6efcfa1,32768,"GBS Player V1.01 - Daffy Duck - The Marvin Missions (PD)"},
{0xcde39b9e,131072,"GBS Player V1.01 - Drymouth (PD)"},
{0xca417f3c,32768,"GBS Player V1.01 - Duck Tales (PD)"},
{0x05fed0aa,32768,"GBS Player V1.01 - Duck Tales 2 (PD)"},
{0x9dc02fae,65536,"GBS Player V1.01 - Furai no Siren (PD)"},
{0x253a9387,32768,"GBS Player V1.01 - Gremlins 2 - The New Batch (PD)"},
{0xbf1fb001,65536,"GBS Player V1.01 - Mega Man (PD)"},
{0x855a77e0,32768,"GBS Player V1.01 - Mega Man 2 (PD)"},
{0xd1d6ab1a,32768,"GBS Player V1.01 - Mega Man 3 (PD)"},
{0x231ff200,65536,"GBS Player V1.01 - Mega Man 4 (PD)"},
{0x01281896,65536,"GBS Player V1.01 - Mega Man 5 (PD)"},
{0x552ddee3,32768,"GBS Player V1.01 - Metroid 2 - Return of Samus (PD)"},
{0x69266f5c,32768,"GBS Player V1.01 - Popeye 2 (PD)"},
{0x9ed2f9b3,32768,"GBS Player V1.01 - Rolan's Curse (PD)"},
{0xa9c0e857,32768,"GBS Player V1.01 - Rolan's Curse 2 (PD)"},
{0x5f76c261,32768,"GBS Player V1.01 - Super Hunchback (PD)"},
{0xa1a09f12,32768,"GBS Player V1.01 - Tail Gator (PD)"},
{0x2cb6c048,32768,"GBS Player V1.01 - Trax (PD)"},
{0xa1e8bc99,65536,"GBS Player V1.01 - Trip World (PD)"},
{0x393b5915,32768,"Gen13 (X-rated) (PD)"},
{0xbdbea9fa,32768,"Ghostbusters Logo Demo (PD)"},
{0x4d71e074,32768,"GHunter (V0.5) (PD)"},
{0x7dc62e02,32768,"Goth Chick (PD)"},
{0x2979a8e9,32768,"Greeting Card Demo 3 (PD)"},
{0x62c06245,32768,"Greeting Card Demo 4 (PD)"},
{0x8c64ac58,32768,"Greeting Card Demo 6 (PD)"},
{0x397c4adc,32768,"Guess The Number 1 (PD)"},
{0xf4aded70,32768,"Guess The Number 2 (PD)"},
{0xa154cfce,262144,"Hangman (PD)"},
{0x6b9e11d9,32768,"Happy Birthday HOME Demo (PD)"},
{0x58ab027f,32768,"Hello World Demo (PD)"},
{0x938ea371,32768,"Hello World With Input Demo (PD)"},
{0xf05f2af2,32768,"Hentai Animation (PD)"},
{0x7fea2f69,32768,"Hero Zero GFX-CON (PD)"},
{0x013129c6,32768,"Hero Zero Sample - Disasm (PD)"},
{0x91a1ba0b,32768,"Hero Zero Sample - Lines 1 (PD)"},
{0x8ecc271d,32768,"Hero Zero Sample - Lines 2 (PD)"},
{0x8a408e63,32768,"Hero Zero Sample - Lines 3 (PD)"},
{0x7e4e5685,32768,"Horrible Demon, The (Bung) (PD) [a1]"},
{0xa99c57f9,32768,"Horrible Demon, The (Bung) (PD)"},
{0x23fee115,32768,"Horrible Demon, The (PD)"},
{0x9ac04932,32768,"Horrid Demon, The (Bung) (PD)"},
{0xb0417673,262144,"Hybrid GBPlot (PD)"},
{0x41def6a7,32768,"IDSA Invaders (PD)"},
{0x78efe9eb,262144,"Infocom - BALLYHOO (1) (PD)"},
{0x21ebc3c3,262144,"Infocom - BALLYHOO (2) (PD)"},
{0x5dec1a30,131072,"Infocom - BALLYHOO (3) (PD)"},
{0xe025ecf6,262144,"Infocom - BALLYHOO (4) (PD)"},
{0xb9b8407d,262144,"Infocom - BALLYHOO (5) (PD)"},
{0xafdbc8dd,131072,"Infocom - Cutthroats (1) (PD)"},
{0xaba10888,131072,"Infocom - Cutthroats (2) (PD)"},
{0xbd37a36d,131072,"Infocom - Cutthroats (3) (PD)"},
{0x62aff22f,131072,"Infocom - Deadline (1) (PD)"},
{0xaa4906f5,131072,"Infocom - Deadline (2) (PD)"},
{0x5f15805b,131072,"Infocom - Deadline (3) (PD)"},
{0x060bc616,131072,"Infocom - Enchanter (1) (PD)"},
{0xd655910c,131072,"Infocom - Enchanter (2) (PD)"},
{0x42c5e24c,131072,"Infocom - Enchanter (3) (PD)"},
{0xb521397e,131072,"Infocom - Hitchiker's Guide to the Galaxy, The (1) (PD)"},
{0xf368dc8c,131072,"Infocom - Hitchiker's Guide to the Galaxy, The (2) (PD)"},
{0x59dd81e3,131072,"Infocom - Hitchiker's Guide to the Galaxy, The (3) (PD)"},
{0x86b1eac0,131072,"Infocom - Hollywood Hijinx (1) (PD)"},
{0x784c93d8,131072,"Infocom - Hollywood Hijinx (2) (PD)"},
{0x5d5f3cd1,131072,"Infocom - Hollywood Hijinx (3) (PD)"},
{0x30b5b8fc,131072,"Infocom - Infidel (1) (PD)"},
{0x36506a59,131072,"Infocom - Infidel (2) (PD)"},
{0x999d0af6,262144,"Infocom - Leather Goddesses of Phobos, The (1) (PD)"},
{0x0bb32620,131072,"Infocom - Leather Goddesses of Phobos, The (2) (PD)"},
{0xe8efa0c0,262144,"Infocom - Leather Goddesses of Phobos, The (3) (PD)"},
{0x7116a89b,262144,"Infocom - Leather Goddesses of Phobos, The (4) (PD)"},
{0x8360eb16,262144,"Infocom - Lurking Horror, The (1) (PD)"},
{0x2a7c5014,262144,"Infocom - Lurking Horror, The (2) (PD)"},
{0xa14dc4c8,131072,"Infocom - Lurking Horror, The (3) (PD)"},
{0xf6c728d9,262144,"Infocom - Lurking Horror, The (4) (PD)"},
{0xc9de9552,262144,"Infocom - Moonmist (1) (PD)"},
{0x98f0339f,131072,"Infocom - Moonmist (2) (PD)"},
{0xb191a4b4,262144,"Infocom - Moonmist (3) (PD)"},
{0xeaf51f01,131072,"Infocom - Planetfall (1) (PD)"},
{0x9f7fab35,131072,"Infocom - Planetfall (2) (PD)"},
{0x6c1b9a6b,131072,"Infocom - Sorcerer (Enchanter 2) (1) (PD)"},
{0xeda18737,131072,"Infocom - Sorcerer (Enchanter 2) (2) (PD)"},
{0x453ac640,262144,"Infocom - Spellbreaker (Enchanter 3) (1) (PD)"},
{0x4996ae1b,131072,"Infocom - Spellbreaker (Enchanter 3) (2) (PD)"},
{0x9257429c,262144,"Infocom - Spellbreaker (Enchanter 3) (3) (PD)"},
{0xe7f08153,262144,"Infocom - Spellbreaker (Enchanter 3) (4) (PD)"},
{0x27295a87,131072,"Infocom - Starcross (1) (PD)"},
{0xe6e51e7c,131072,"Infocom - Starcross (2) (PD)"},
{0xe0eae993,131072,"Infocom - Suspect (1) (PD)"},
{0x310b0c77,131072,"Infocom - Suspect (2) (PD)"},
{0x529be597,131072,"Infocom - Suspended (1) (PD)"},
{0x4a62fe1f,131072,"Infocom - Suspended (2) (PD)"},
{0x4c53c4a3,262144,"Infocom - Wishbringer (1) (PD)"},
{0x413dcbd0,131072,"Infocom - Wishbringer (2) (PD)"},
{0x5e5513f1,262144,"Infocom - Wishbringer (3) (PD)"},
{0xaf71504e,131072,"Infocom - Witness, The (1) (PD)"},
{0x271a029b,131072,"Infocom - Witness, The (2) (PD)"},
{0x3527b539,131072,"Infocom - Zork I - The Great Underground Empire (1) (PD)"},
{0x335dd738,131072,"Infocom - Zork I - The Great Underground Empire (2) (PD)"},
{0xcd8df291,131072,"Infocom - Zork I - The Great Underground Empire (3) (PD)"},
{0x1450e174,131072,"Infocom - Zork II - The Wizard of Frobozz (1) (PD)"},
{0x70487d4d,131072,"Infocom - Zork II - The Wizard of Frobozz (2) (PD)"},
{0xbf3dd952,131072,"Infocom - Zork III - The Dungeon Master (1) (PD)"},
{0x020dfe8e,131072,"Infocom - Zork III - The Dungeon Master (2) (PD)"},
{0xefdcafcf,32768,"Interrupts Demo (PD)"},
{0xe8b433a8,32768,"James Bond Demo (PD)"},
{0x3e50a080,32768,"JetPac V0.01 (Different Controls) (PD)"},
{0xb1d1f4e2,32768,"JetPac V0.01 (PD)"},
{0xbcc96acf,32768,"JetPac V0.02 (PD)"},
{0x6567ef98,32768,"JetPac V0.03 (PD) [a1]"},
{0xb7538bd6,32768,"JetPac V0.03 (PD)"},
{0xcef0fb8d,32768,"JetPac V0.04 (PD)"},
{0x0bd33517,32768,"Joy of Interrupts (PD)"},
{0x58c6c9dd,32768,"Joy Rider Demo (PD)"},
{0xc2f4be4e,32768,"Joypad Test V0.1 (PD)"},
{0x0c3e84e3,32768,"Jumping Jack (PD)"},
{0x05cb3f18,32768,"Kasumi Scroller (PD)"},
{0xb77ba5ae,32768,"Ken Kameda's World Demo (PD)"},
{0x47893b7f,32768,"Kirby XXL Demo (PD)"},
{0x723465dd,32768,"Labyrinth (Bung) (PD) [a1]"},
{0x22fd7011,32768,"Labyrinth (Bung) (PD)"},
{0x7535285f,32768,"Ladeks (PD)"},
{0x09062445,32768,"Lamborghini 2 Demo (PD) [a1]"},
{0x1371dd03,32768,"Landscape Demo (PD)"},
{0x723f54c3,65536,"Lemon Player Demo by Lemon Productions (PD)"},
{0xb47317e4,32768,"Life (PD)"},
{0x7cf546e1,32768,"Life 2 (PD)"},
{0x9bc72a6a,32768,"Lik Sang MP3 Demo (PD)"},
{0xff1c4bcb,32768,"Login Password Demo (PD)"},
{0xf6641be4,32768,"Log-X (Bung V4) (PD)"},
{0x9d333610,32768,"Mango Cat Animation Demo (PD)"},
{0x7bfdc800,32768,"Mango Dxcp Scroller Demo (PD)"},
{0x6ae7cc11,32768,"Mango Dycp Scroller Demo (PD)"},
{0x48273daa,32768,"Mango Flex Demo (PD)"},
{0x171edd12,32768,"Mango Muzak Demo (PD)"},
{0x02a5dd62,32768,"Mango Plot Demo (PD)"},
{0x8722dea4,32768,"Mango Toons Demo (PD)"},
{0x18276e73,32768,"Master Your Multiplication (PD)"},
{0x4692e63d,1048576,"Matrix Video, The (PD)"},
{0x99ab44e4,32768,"Mega Man X PCX2GB Demo (PD)"},
{0xcf053fd7,32768,"Megamania Demo (PD)"},
{0xb49f1926,32768,"Merry Christmas! Demo (PD)"},
{0x651e8084,32768,"Mines (Bung) (PD)"},
{0x5ba0b0fb,32768,"Minesweeper (PD)"},
{0x3adee509,32768,"Missing Files (E-Mag Article) (PD)"},
{0x6127ea3e,524288,"MMX El-Hazard Movie (PD) [a1]"},
{0xf95d3d56,524288,"MMX El-Hazard Movie (PD) [a2]"},
{0xd22060bb,524288,"MMX El-Hazard Movie (PD)"},
{0xafb2a546,32768,"MMX Image Slideshow (PD)"},
{0x5a5bfc79,32768,"MMX MegAnime (PD)"},
{0x4a6a5310,32768,"MMX PCX-to-GB Demo (PD) [a1]"},
{0xb41ebb1d,32768,"MMX PCX-to-GB Demo (PD)"},
{0x1c005183,524288,"MMX T2 Demo (PD)"},
{0x83821eeb,262144,"Motoko no Ken (PD)"},
{0xcc936616,32768,"Multi Puzzle (PD)"},
{0x6407f5cf,32768,"Multi Sprite Demo (PD)"},
{0xd9aace03,65536,"Multikart 2 V1.1 (GB BASIC & Debugger) (PD)"},
{0xbfffc784,65536,"Multikart 2 V1.3 (GB BASIC & Debugger) (PD)"},
{0x6eb34883,32768,"N64 Controller (PD)"},
{0xe27d56e1,65536,"NanoLoop Demo (PD)"},
{0x8c86e3ea,32768,"NanoSynth (PD)"},
{0x302a7f51,32768,"NanoVoice Demo (PD)"},
{0xafc6b6a8,262144,"Neon Genesis Evangelion - Rei Demo 1 (PD)"},
{0x3fda45f3,32768,"Nick's GAME1 (PD)"},
{0x652da1aa,32768,"Night Driving - Atari 2600 (PD)"},
{0xf1270b43,32768,"Nuku7 Demo (7-Shades Pic) (PD)"},
{0xd09c6572,32768,"Obsession's SokoBan (V1.1) (PD)"},
{0x4da8036c,32768,"Obsession's SokoBan (V1.2) (PD)"},
{0x88cc6acd,32768,"Paddle Mission (PD)"},
{0xe0b9921e,32768,"Phreak-boy (PD)"},
{0x00065fb1,32768,"PI Speak Demo (PD)"},
{0xba117b47,32768,"Pika Killa (Quang2000) (PD)"},
{0x23aa539f,32768,"Pikachu Scroller 1 (PD)"},
{0x11ec8963,32768,"Pikachu Scroller 2 (PD)"},
{0x11e538b1,65536,"Planet Console Ad (PD)"},
{0x4342e599,131072,"Plumpy (PD)"},
{0x975f9540,32768,"Poke Mission '97 (Beta) (PD)"},
{0x260d1044,32768,"Poke Mission '97 (Final) (PD)"},
{0xa391ce5f,32768,"Poke Mission '97 (PD)"},
{0x50a457ac,32768,"Poke Mission '97 (V1.01) (PD)"},
{0x4c3e4483,32768,"Pong (PD)"},
{0x3f20126e,524288,"Punk Demo (PD)"},
{0x5ace1276,32768,"Puzz (Bung) (PD)"},
{0x30e7bf4b,32768,"Puzzle (1) (PD)"},
{0x8a4f91c8,32768,"Puzzle (2) (PD)"},
{0xcd40c5b7,32768,"Puzzle (3) (PD)"},
{0x65d08472,32768,"Puzzle X (Bung) (PD)"},
{0xb4ab2de6,32768,"Puzzle X (PD) [a1]"},
{0x18d4f088,32768,"Puzzle X (PD) [a2]"},
{0xe248c528,32768,"Puzzle X (PD)"},
{0x9bf07f7d,32768,"Quick Push (PD)"},
{0xef0c85f1,32768,"Random Number Generator (PD)"},
{0x68429b2f,32768,"Raster Bars Test (PD)"},
{0xe08d0942,32768,"Raven 2 Demo (PD) [a1]"},
{0xd240aa93,32768,"Raven 2 Demo (PD)"},
{0x184f6e90,65536,"Raven 3 (PD)"},
{0x50471e16,32768,"Rei 3D Pyramid Demo (PD)"},
{0xf524e6ce,32768,"Robot War (PD)"},
{0x35938cbe,32768,"Rotation (PD)"},
{0x2bf17c20,32768,"RPN Calculator (PD)"},
{0x97279f9a,32768,"Sailor Moon Demo (PD)"},
{0x5fd5b876,262144,"Sailor Super V Movie (PD)"},
{0xf8ad7dec,262144,"Sakigake Memorial (PD)"},
{0x7a4e8c4f,32768,"Scrolling Demo 2 (PD)"},
{0x929c4538,32768,"Segmond First Demo (PD)"},
{0x2e07baf0,32768,"SGB Pack (PD) (GB) [a1]"},
{0xea41cbca,32768,"SGB Pack (PD) (GB) [a2]"},
{0x88f164a1,32768,"SGB Pack (PD) (GB)"},
{0x13d27881,32768,"Showdown in Neo Tokyo (PD)"},
{0xb3f5dc58,32768,"Shutdown (PD)"},
{0x76bb8bae,32768,"Sierpinski Gasket (PD)"},
{0x1c56c44c,524288,"Simple Dictionary V1.2 (PD)"},
{0xc1831316,32768,"Simple Parallax Scroller (PD)"},
{0x9ebf0dcc,32768,"Slippy (PD)"},
{0x1327c6c5,32768,"Song Pro Demo (PD)"},
{0x73447cb3,32768,"Sound Demo (PD)"},
{0x05d34411,32768,"Sound Test (PD) [a1]"},
{0x4e5a9e26,32768,"Sound Test (PD)"},
{0x9c28fe73,131072,"South Park Xtreme Demo (GB) (PD)"},
{0x7febc515,32768,"South Pong (PD)"},
{0xcd6398dd,32768,"Space Demo (2) (PD)"},
{0x7a4ee4f9,32768,"Space Demo (PD)"},
{0x999abe51,32768,"Space Invaders (PD)"},
{0xa6fc740c,32768,"Speed Finger V0.01 (Bung) (PD)"},
{0x9a45c417,32768,"Speed Finger V0.02 (Bung) (PD)"},
{0xe9ec7087,32768,"Sprite Demo (PD)"},
{0x2a9ad766,32768,"Sprite Demo 2 (PD)"},
{0x6025e612,32768,"Sprite Demo Test (PD)"},
{0x74c02ee6,32768,"Sprite1 Demo (PD)"},
{0x6f2ec87e,32768,"Sprite2 Demo (PD)"},
{0x91a0413d,32768,"Sprite3 Demo (PD)"},
{0x09a2be8f,32768,"Sprite4 Demo (PD)"},
{0x6b8aebcc,32768,"Sprite4a Demo (PD)"},
{0xd9334ddf,32768,"SQRXZ (V1.1) (PD)"},
{0x85a9e0db,32768,"StarFisher (PD)"},
{0x597b1b70,524288,"Super Ayanami D (PD)"},
{0x6fd98165,32768,"Swedish Flag Demo (PD)"},
{0x8c3edf21,32768,"Terminal & Basic Graphics Demo (PD)"},
{0xca9c9710,1048576,"Terminator 2 Video (PD)"},
{0x5efb3370,32768,"Test (V1.1) (PD)"},
{0x17aba5d6,32768,"Test Game Pack (PD)"},
{0xae902c4b,32768,"Test Game Pack (scrolling picture) (PD)"},
{0xada57d37,32768,"Testrand (side-side) (PD)"},
{0x92dc091e,32768,"Testrand (up-down) (PD)"},
{0x3aa0695d,65536,"They Came from Outer Space (PD) [S]"},
{0x32f964d1,524288,"To-Heart Slideshow Green (PD)"},
{0xb2db2832,524288,"To-Heart Slideshow Red (PD)"},
{0x8c7cdd40,32768,"Tunnel (V0.1) (PD)"},
{0x3d7ce579,32768,"Unix (PD)"},
{0xc9dca59c,65536,"Versatility (PD)"},
{0x8df7df40,32768,"VGB Lord Demo (PD)"},
{0xa803ab80,32768,"Vila Caldan V0.1 (PD)"},
{0xa5e43ce5,32768,"Viper (Bung) (PD)"},
{0x561c5fc3,32768,"Wario Walking Demo (PD)"},
{0x0f53d6ac,32768,"WD 3D Demo (PD)"},
{0x7395f49f,32768,"WD Checkercube Demo V0.1 (PD)"},
{0x1ae6b0cd,32768,"WOW Super Gameboy Peep-Show (PD)"},
{0xcb5d02fd,65536,"Yar's Revenge - The Quotile Ultimatum (PD)"},
{0xfc17d1f1,32768,"You Pressed Demo (PD)"},
{0x1ae74cc8,65536,"ZipGB V0.001 ALPHA (PD)"},
{0xd9c315e7,32768,"Zoomar Demo V2 (PD)"},
{0x76d26c54,32768,"Zoomar Demo V3 (2) (PD)"},
{0xf6e79989,32768,"GB Electric Drum (PD)"},
{0xa7752f4c,32768,"BLEM! (PD)"},
{0x1da7f24a,32768,"Books of the Bible (Freedom GB Contest 2001) (PD)"},
{0x7e350676,32768,"Dungeon Escape (2) (PD)"},
{0x3649d08b,65536,"GB Tracker V990220 (PD)"},
{0xfcfa0b8b,32768,"GBS Player V1.00 - The Fidgetts (PD)"},
{0x39d6331c,32768,"Lamborghini 2 Demo (PD)"},
{0xc182f628,32768,"Runtime - Test Rom (PD)"},
{0x38b754ec,32768,"SunTsu7's Monty Python Greeting (PD)"},
{0xa8adab6a,32768,"Zoomar Demo V3 (1) (PD)"},
{0x3cd7aa0d,32768,"Distortion Demo by Anders Granlund (PD) [a1]"},
{0x9f8d4f0b,32768,"Greyscale Moving Globe Demo (PD)"},
{0x5f7c431e,32768,"Obj Put0 Demo (PD)"},
{0x44653ae3,32768,"Sound Output Demo 1 (PD)"},
{0x40974b5c,32768,"Tam Bitmap Demo (PD)"},
{0x329df849,524288,"TSS Grayscale Movie (PD)"},
{0xeb2a6c89,131072,"WanWan (PD)"},
{0xdacfc143,32768,"BG Put0 Demo (PD)"},
{0x77a71690,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U) [t1]"},
{0x846b73a4,131072,"Adventure Island (U) [t1]"},
{0xb99d6e2e,131072,"Adventures of Star Saver, The (U) [t1]"},
{0x9676491e,32768,"Alleyway (JUA) [t1]"},
{0x23fbc95a,131072,"Amazing Spider-Man 3, The - Invasion of the Spider-Slayers (U) [t1]"},
{0xc505c150,131072,"Asteroids & Missile Command (U) [S][t1]"},
{0x542c69c3,524288,"Bubsy 2 (U) [t1]"},
{0x041cdd0c,524288,"Bubsy 2 (U) [t2]"},
{0xa079c953,65536,"Burger Time Deluxe (JU) [t1]"},
{0xc2a1dbe3,131072,"Bust-a-Move 2 (U) [t1]"},
{0x9c27e92c,131072,"Bust-a-Move 2 (U) [t2]"},
{0x92959f40,131072,"Defender-Joust (U) [S][t1] (Joust Lives)"},
{0x6c7ef44f,131072,"Defender-Joust (U) [S][t2] (Defender Lives)"},
{0x4dc53c2e,131072,"Defender-Joust (U) [S][t3] (Defender Bombs)"},
{0x328a8ef2,262144,"Gameboy Gallery (J) [S][t1]"},
{0xeb80bfd2,131072,"Incredible Crash Dummies, The (U) [t1]"},
{0x7563c122,262144,"Judge Dredd (U) [t1]"},
{0xc0eb61fe,131072,"Jungle Book. The (U) [t1]"},
{0x388f80cb,524288,"Kirby's Block Ball (U) [S][t1]"},
{0x79a96ddf,262144,"Mega Man 3 (U) [t1]"},
{0xccd8d832,65536,"Mr. Do! (U) [t1]"},
{0x44620e03,524288,"Namco Gallery Volume 2 (J) [S][t1]"},
{0xa5e6d02e,65536,"Paperboy (U) (GB) [t1]"},
{0x31aa2d87,131072,"Prince of Persia (U) [t1]"},
{0x9d89d267,65536,"Snoopy - Magic Show (U) [t1]"},
{0x4456d578,262144,"Speedy Gonzales (U) [t1]"},
{0x58eafbe5,131072,"Super Mario Land (V1.1) (JUA) [t1]"},
{0x04593076,65536,"They Came from Outer Space (PD) [S][t1]"},
{0xe2c49415,524288,"True Lies (U) [t1]"},
{0xe0c5f046,262144,"True Lies (U) [t2]"},
{0xbd566e44,65536,"Head On (J) [t1]"},
{0xd50b7a20,131072,"Snow Bros Jr. (U) [t1]"},
{0x8c826da4,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U) [t2]"},
{0xa428b80f,65536,"After Burst (J) [t1]"},
{0x53d6cc70,131072,"Addams Family, The (U) [t1]"},
{0xfaeb2fc9,262144,"Aladdin (U) [S][t2]"},
{0xd735cfcd,131072,"Alien 3 (U) [t1]"},
{0x0dfcb094,131072,"Asterix (UE) (M5) [t1]"},
{0xeb752234,32768,"Asteroids (U) [t1]"},
{0x87015796,65536,"Astro Rabby (J) [t1]"},
{0x67f09f08,65536,"Ayakashi no Siro (J) [t1]"},
{0xaa3a02ec,131072,"Banishing Racer (J) [t1]"},
{0x0a6e35d9,131072,"Atomic Punk (U) [t1]"},
{0x63a602d9,131072,"Barbie - Game Girl (U) [t1]"},
{0xbdb9e155,131072,"Batman (JU) [t1]"},
{0xfe5c689b,32768,"BattleCity (J) [t1]"},
{0xbd20ecc9,131072,"Beetlejuice (U) [t1]"},
{0x1c998292,131072,"Bill and Ted's Excellent GB Adventure (UE) [t1]"},
{0x4fe4788e,262144,"Bionic Commando (J) [t1]"},
{0x30b6cc04,32768,"Bomb Jack (U) [t1]"},
{0x1a78271d,65536,"Boulder Dash (U) [t1]"},
{0xe5767a8b,524288,"Aladdin (U) [S][t1]"},
{0x74232244,131072,"Aero Star (U) [T-Fre]"},
{0xd94f768d,32768,"Bomb Jack (U) [T-Port]"},
{0x3d348238,262144,"Bomberman GB 3 (J) [S][T-Eng1.00_MakoKnight]"},
{0x0365011a,65536,"Chessmaster, The (V1.1) (UE) [T-Port1.0_Brgames]"},
{0xff97468d,131072,"Daisenryaku Hiro (J) [T-Eng1.00_Gaijin Productions]"},
{0xf58b88c9,524288,"Dragon Ball Z Goku 2 (J) [S][T-Chinese]"},
{0x73bd62e0,524288,"Gameboy Wars Turbo (J) [S][T-Eng]"},
{0xa84a08fc,262144,"Gamera - Daikai Jukutyu Kessen (J) [S][T-Eng]"},
{0x9e3ce318,262144,"Gamera - Daikai Jukutyu Kessen (J) [S][T-Eng0.991]"},
{0x0fc10c91,131072,"Garfield Labyrinth (U) [T-Port]"},
{0x3b18c9fb,262144,"Jida Igeki (J) [T-Eng]"},
{0x17919fc2,524288,"Legend of Zelda, The - Link's Awakening (V1.0) (U) [T-Italian]"},
{0x704d3f06,524288,"Mario's Picross 2 (J) [S][T-Eng]"},
{0x5d4c54a5,262144,"Momotaro Dengeki (J) [T-Eng0.91_Toma]"},
{0x72db7936,262144,"Momotaro Dengeki (J) [T-Eng1]"},
{0xce9ede14,262144,"Momotaro Dengeki (J) [T-Eng2]"},
{0xc2e62e0d,262144,"Oni 4 - Kishin no Ketsuzoku (J) [T-Eng0.30_akujin]"},
{0x45abc6c3,524288,"Picross 2 (J) [S][T-Eng]"},
{0x515322a3,524288,"Pocket Monsters Blue (J) [S][T-Eng]"},
{0x287130cc,524288,"Pocket Monsters Blue (J) [S][T-Eng_partial1]"},
{0x29da6919,1048576,"Pocket Monsters Blue (J) [S][T-Eng_partial2]"},
{0x46885ec0,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng]"},
{0xd7eae9a2,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng_BGTrans]"},
{0xa86f449a,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng_LandaR]"},
{0x26b87107,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng0.01_LandaR]"},
{0xe4583418,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng0.02_LandaR]"},
{0xfa26c76e,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng0.03_LandaR]"},
{0x1dc45d3b,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng0.5_DWTRANS]"},
{0x70c8d460,524288,"Pocket Monsters Green (V1.0) (J) [S][T-Eng3.1_Vida]"},
{0x72c95aff,524288,"Pocket Monsters Green (V1.1) (J) [S][T-Eng3.1_Vida]"},
{0x5bf275e1,524288,"Pocket Monsters Green (V1.1) (J) [S][T-English_v0.5_DWTRANS]"},
{0xcc9e3167,1048576,"Pocket Monsters Yellow (V1.0) (J) [S][T-Eng]"},
{0x1e0deed5,1048576,"Pocket Monsters Yellow (V1.0) (J) [S][T-Eng][a1]"},
{0x4c62adc7,1048576,"Pokemon Blue (UA) [S][T-Port]"},
{0xb56fee0f,1048576,"Pokemon Blue (UA) [S][T-Spa]"},
{0x6bc938e7,1048576,"Pokemon Red (U) [S][T-Dutch]"},
{0x819417d2,1048576,"Pokemon Red (U) [S][T-Norwegian2000.05.06_Just4Fun]"},
{0x3b1c9cbb,262144,"Ray Earth (J) [S][T-Eng]"},
{0x92f945da,524288,"Rockman World 5 (J) [S][T-Eng_partial]"},
{0x5a41520c,524288,"Rockman World 5 (J) [S][T-Eng_partial][a1]"},
{0x302c1d6c,262144,"Sa-Ga 2 (Final Fantasy Legend II) (V1.0) (J) [T-Eng]"},
{0xb36e068c,262144,"Sangokushi (J) [T-Chinese][p1]"},
{0x55fdce57,65536,"Sanrio Carnival (J) [T-Eng1.2_Six Feet Under]"},
{0xb232a7ed,65536,"Sanrio Carnival (J) [T-Eng1.x_Six Feet Under]"},
{0xfd58f758,262144,"SD Saint Seiya Paradise (J) [T-Spa1.0b]"},
{0x5aa96c27,65536,"Super Mario Land (V1.1) (JUA) [T-Port]"},
{0xb0a4e40e,131072,"Super Robot War (J) [T-Chinese]"},
{0x482a0a71,524288,"Tenchi Wokurau (J) [p1][T-Chinese][!]"},
{0xac1c4cfe,32768,"Tetris (V1.1) (JU) [T-Port]"},
{0xbd43f605,131072,"Mickey's Dangerous Chase (U) [T-Fre99%_YF06]"},
{0xf25237b0,65536,"Bugs Bunny (U) [T-Port]"},
{0x4e05098b,1048576,"Pocket Monsters Red (V1.0) (J) [S][T-Eng_partial]"},
{0x34af6a0d,1048576,"Pokemon Green (U) [p1][T-Fre10%_YF06]"},
{0xebfc4ef6,1048576,"Pokemon Red (U) [S][T-Norwegian2000.10.02_Just4Fun]"},
{0x2b85a983,524288,"Another Bible (J) [S][T-Eng1.01]"},
{0xbf7cdd4f,131072,"Bomber Boy (J) [t1]"},
{0x18cdedac,131072,"Blades of Steel (U) (GB) [t1]"},
{0x736a488a,131072,"Bubble Bobble Part 2 (U) [t1]"},
{0x66c1ab42,524288,"Donkey Kong Land 2 (UE) [S][T-Fre99%_YF06]"},
{0xc498f7cb,524288,"Donkey Kong Land 3 (U) [S][T-Fre99%_YF06]"},
{0xef30ada1,524288,"Legend of Zelda, The - Link's Awakening (V1.1) (U) [T-Hungarian0.01]"},
{0x87b72aa6,524288,"Legend of Zelda, The - Link's Awakening (V1.2) (U) [T-Hungarian0.01]"},
{0xb414c109,524288,"Pocket Monsters Green (Chinese) (Unl) [S]"},
{0x1b76b3d2,131072,"Alien vs Predator - The Last of His Clan (J) [t1]"},
{0x6780c0ff,131072,"Addams Family, The - Pugsley's Scavenger Hunt (U) [b3]"},
{0xd47bf469,131072,"Asteroids & Missile Command (U) [S][b2]"},
{0x59c46139,262144,"Bonk's Adventure (U) [b1][t1]"},
{0x0ee0860f,131072,"Bubble Bobble Part 2 (U) [b2]"},
{0x58f5cfaa,139264,"Choplifter 2 (U) (JVC - Broderbund) [o1]"},
{0xe2e546de,131072,"Cool World (U) [b4]"},
{0x38464b75,262144,"Final Fantasy Legend III (Sa-Ga 3) (U) [b1]"},
{0xd9dc38ee,262144,"Jurassic Park (E) (M5) [b2]"},
{0x91280680,32768,"Kwirk (UA) [b3]"},
{0xca0a3f31,131072,"NBA All Star Challenge 2 (U) [b6]"},
{0x156ac361,131072,"Super Kick Off (U) [b3]"},
{0x6869856a,341640,"Super Mario Land 3 - Wario Land (JUE) [b3]"},
{0x2fa0fccf,131073,"Turrican (UE) [b3]"},
{0x96fe243c,1048576,"Warioland 2 (UE) [S][b2]"},
{0xfd497e24,1048576,"Warioland 2 (UE) [S][b3]"},
{0xb4900ada,262144,"Yuuyuu 3 (J) [b1]"},
{0x560a5b48,131072,"Last Action Hero (U) [b2]"},
{0xdaca4ed8,262144,"Marble Madness (U) [b4]"},
{0x44806e76,131584,"Home Alone 2 (crc-2) [U][!]"},
{0x0e08f59b,131072,"Spot - The Cool Adventure (crc-2) [U]"},
{0x5110e971,131072,"Nemesis ('90) (UE) (crc-2) [!]"},
};
int DAT_LookFor(int CRC32)
{
int i;
for(i=0;i<DATROMS;i++) if(MyDat[i].crc==CRC32) return i;
return -1;
}
| zodttd/gameboy4iphone | Z/gp32_good.h | C | gpl-2.0 | 363,975 |
/*
* rbc.h
* ctc local
*
* Created by Dmitry Alexeev on Nov 3, 2014
* Copyright 2014 ETH Zurich. All rights reserved.
*
*/
#pragma once
#include <cuda_runtime.h>
using namespace std;
namespace CudaRBC
{
struct Params
{
float kbT, p, lmax, q, Cq, totArea0, totVolume0,
ka, kv, gammaT, gammaC, sinTheta0, cosTheta0, kb, l0;
float sint0kb, cost0kb, kbToverp;
int nvertices, ntriangles;
};
struct Extent
{
float xmin, ymin, zmin;
float xmax, ymax, zmax;
};
static Params params;
static __constant__ Params devParams;
/* blocking, initializes params */
void setup(int& nvertices, Extent& host_extent);
int get_nvertices();
/* A * (x, 1) */
void initialize(float *device_xyzuvw, const float (*transform)[4]);
/* non-synchronizing */
void forces_nohost(cudaStream_t stream, int ncells, const float * const device_xyzuvw, float * const device_axayaz);
/*non-synchronizing, extent not initialized */
void extent_nohost(cudaStream_t stream, int ncells, const float * const xyzuvw, Extent * device_extent, int n = -1);
/* get me a pointer to YOUR plain array - no allocation on my side */
void get_triangle_indexing(int (*&host_triplets_ptr)[3], int& ntriangles);
};
| aecon/uDeviceX | cuda-rbc/rbc-cuda.h | C | gpl-2.0 | 1,245 |
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
// Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process
// This class defines all the logic for Dolphin auto-update checking. UI-specific elements have to
// be defined in a backend specific subclass.
class AutoUpdateChecker
{
public:
// Initiates a check for updates in the background. Calls the OnUpdateAvailable callback if an
// update is available, does "nothing" otherwise.
void CheckForUpdate();
static bool SystemSupportsAutoUpdates();
struct NewVersionInformation
{
// Name (5.0-1234) and revision hash of the new version.
std::string new_shortrev;
std::string new_hash;
// The full changelog in HTML format.
std::string changelog_html;
// Internals, to be passed to the updater binary.
std::string this_manifest_url;
std::string next_manifest_url;
std::string content_store_url;
};
// Starts the updater process, which will wait in the background until the current process exits.
enum class RestartMode
{
NO_RESTART_AFTER_UPDATE = 0,
RESTART_AFTER_UPDATE,
};
void TriggerUpdate(const NewVersionInformation& info, RestartMode restart_mode);
protected:
virtual void OnUpdateAvailable(const NewVersionInformation& info) = 0;
};
| pierrewillenbrock/dolphin | Source/Core/UICommon/AutoUpdate.h | C | gpl-2.0 | 1,391 |
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
/**
* This class contains all the function that are called using AJAX
*/
class CRM_Core_Page_AJAX_Location {
/**
* FIXME: we should make this method like getLocBlock() OR use the same method and
* remove this one.
*
* Function to obtain the location of given contact-id.
* This method is used by on-behalf-of form to dynamically generate poulate the
* location field values for selected permissioned contact.
*/
function getPermissionedLocation() {
$cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
if ($_GET['ufId']) {
$ufId = CRM_Utils_Type::escape($_GET['ufId'], 'Integer');
}
elseif ($_GET['relContact']) {
$relContact = CRM_Utils_Type::escape($_GET['relContact'], 'Integer');
}
$values = array();
$entityBlock = array('contact_id' => $cid);
$location = CRM_Core_BAO_Location::getValues($entityBlock);
$config = CRM_Core_Config::singleton();
$addressSequence = array_flip($config->addressSequence());
if ($relContact) {
$elements = array(
"phone_1_phone" =>
$location['phone'][1]['phone'],
"email_1_email" =>
$location['email'][1]['email'],
);
if (array_key_exists('street_address', $addressSequence)) {
$elements["address_1_street_address"] = $location['address'][1]['street_address'];
}
if (array_key_exists('supplemental_address_1', $addressSequence)) {
$elements['address_1_supplemental_address_1'] = $location['address'][1]['supplemental_address_1'];
}
if (array_key_exists('supplemental_address_2', $addressSequence)) {
$elements['address_1_supplemental_address_2'] = $location['address'][1]['supplemental_address_2'];
}
if (array_key_exists('city', $addressSequence)) {
$elements['address_1_city'] = $location['address'][1]['city'];
}
if (array_key_exists('postal_code', $addressSequence)) {
$elements['address_1_postal_code'] = $location['address'][1]['postal_code'];
$elements['address_1_postal_code_suffix'] = $location['address'][1]['postal_code_suffix'];
}
if (array_key_exists('country', $addressSequence)) {
$elements['address_1_country_id'] = $location['address'][1]['country_id'];
}
if (array_key_exists('state_province', $addressSequence)) {
$elements['address_1_state_province_id'] = $location['address'][1]['state_province_id'];
}
}
else {
$profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE,
NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
);
$website = CRM_Core_BAO_Website::getValues($entityBlock, $values);
foreach ($location as $fld => $values) {
if (is_array($values) && !empty($values)) {
$locType = $values[1]['location_type_id'];
if ($fld == 'email') {
$elements["onbehalf_{$fld}-{$locType}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
unset($profileFields["{$fld}-{$locType}"]);
}
elseif ($fld == 'phone') {
$phoneTypeId = $values[1]['phone_type_id'];
$elements["onbehalf_{$fld}-{$locType}-{$phoneTypeId}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
unset($profileFields["{$fld}-{$locType}-{$phoneTypeId}"]);
}
elseif ($fld == 'im') {
$providerId = $values[1]['provider_id'];
$elements["onbehalf_{$fld}-{$locType}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
$elements["onbehalf_{$fld}-{$locType}provider_id"] = array(
'type' => 'Select',
'value' => $location[$fld][1]['provider_id'],
);
unset($profileFields["{$fld}-{$locType}-{$providerId}"]);
}
}
}
if (!empty($website)) {
foreach ($website as $key => $val) {
$websiteTypeId = $values[1]['website_type_id'];
$elements["onbehalf_url-1"] = array(
'type' => 'Text',
'value' => $website[1]['url'],
);
$elements["onbehalf_url-1-website_type_id"] = array(
'type' => 'Select',
'value' => $website[1]['website_type_id'],
);
unset($profileFields["url-1"]);
}
}
$locTypeId = $location['address'][1]['location_type_id'];
$addressFields = array(
'street_address',
'supplemental_address_1',
'supplemental_address_2',
'city',
'postal_code',
'country',
'state_province',
);
foreach ($addressFields as $field) {
if (array_key_exists($field, $addressSequence)) {
$addField = $field;
if (in_array($field, array(
'state_province', 'country'))) {
$addField = "{$field}_id";
}
$elements["onbehalf_{$field}-{$locTypeId}"] = array(
'type' => 'Text',
'value' => $location['address'][1][$addField],
);
unset($profileFields["{$field}-{$locTypeId}"]);
}
}
//set custom field defaults
$defaults = array();
CRM_Core_BAO_UFGroup::setProfileDefaults($cid, $profileFields, $defaults, TRUE, NULL, NULL, TRUE);
if (!empty($defaults)) {
foreach ($profileFields as $key => $val) {
if (array_key_exists($key, $defaults)) {
$htmlType = CRM_Utils_Array::value('html_type', $val);
if ($htmlType == 'Radio') {
$elements["onbehalf[{$key}]"]['type'] = $htmlType;
$elements["onbehalf[{$key}]"]['value'] = $defaults[$key];
}
elseif ($htmlType == 'CheckBox') {
foreach ($defaults[$key] as $k => $v) {
$elements["onbehalf[{$key}][{$k}]"]['type'] = $htmlType;
$elements["onbehalf[{$key}][{$k}]"]['value'] = $v;
}
}
elseif ($htmlType == 'Multi-Select') {
foreach ($defaults[$key] as $k => $v) {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
$elements["onbehalf_{$key}"]['value'][$k] = $v;
}
}
elseif ($htmlType == 'Autocomplete-Select') {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
$elements["onbehalf_{$key}"]['value'] = $defaults[$key];
$elements["onbehalf_{$key}"]['id'] = $defaults["{$key}_id"];
}
else {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
$elements["onbehalf_{$key}"]['value'] = $defaults[$key];
}
}
else {
$elements["onbehalf_{$key}"]['value'] = '';
}
}
}
}
echo json_encode($elements);
CRM_Utils_System::civiExit();
}
function jqState($config) {
if (!isset($_GET['_value']) ||
empty($_GET['_value'])
) {
CRM_Utils_System::civiExit();
}
$result = CRM_Core_PseudoConstant::stateProvinceForCountry($_GET['_value']);
$elements = array(array('name' => ts('- select a state -'),
'value' => '',
));
foreach ($result as $id => $name) {
$elements[] = array(
'name' => $name,
'value' => $id,
);
}
echo json_encode($elements);
CRM_Utils_System::civiExit();
}
function jqCounty($config) {
if (CRM_Utils_System::isNull($_GET['_value'])) {
$elements = array(array('name' => ts('- select state -'),
'value' => '',
));
}
else {
$result = CRM_Core_PseudoConstant::countyForState($_GET['_value']);
$elements = array(array('name' => ts('- select -'),
'value' => '',
));
foreach ($result as $id => $name) {
$elements[] = array(
'name' => $name,
'value' => $id,
);
}
if ($elements == array(
array('name' => ts('- select -'), 'value' => ''))) {
$elements = array(array('name' => ts('- no counties -'),
'value' => '',
));
}
}
echo json_encode($elements);
CRM_Utils_System::civiExit();
}
function getLocBlock() {
// i wish i could retrieve loc block info based on loc_block_id,
// Anyway, lets retrieve an event which has loc_block_id set to 'lbid'.
if ($_POST['lbid']) {
$params = array('1' => array($_POST['lbid'], 'Integer'));
$eventId = CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_event WHERE loc_block_id=%1 LIMIT 1', $params);
}
// now lets use the event-id obtained above, to retrieve loc block information.
if ($eventId) {
$params = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
// second parameter is of no use, but since required, lets use the same variable.
$location = CRM_Core_BAO_Location::getValues($params, $params);
}
$result = array();
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'address_options', TRUE, NULL, TRUE
);
// lets output only required fields.
foreach ($addressOptions as $element => $isSet) {
if ($isSet && (!in_array($element, array(
'im', 'openid')))) {
if (in_array($element, array(
'country', 'state_province', 'county'))) {
$element .= '_id';
}
elseif ($element == 'address_name') {
$element = 'name';
}
$fld = "address[1][{$element}]";
$value = CRM_Utils_Array::value($element, $location['address'][1]);
$value = $value ? $value : "";
$result[str_replace(array(
'][', '[', "]"), array('_', '_', ''), $fld)] = $value;
}
}
foreach (array(
'email', 'phone_type_id', 'phone') as $element) {
$block = ($element == 'phone_type_id') ? 'phone' : $element;
for ($i = 1; $i < 3; $i++) {
$fld = "{$block}[{$i}][{$element}]";
$value = CRM_Utils_Array::value($element, $location[$block][$i]);
$value = $value ? $value : "";
$result[str_replace(array(
'][', '[', "]"), array('_', '_', ''), $fld)] = $value;
}
}
// set the message if loc block is being used by more than one event.
$result['count_loc_used'] = CRM_Event_BAO_Event::countEventsUsingLocBlockId($_POST['lbid']);
echo json_encode($result);
CRM_Utils_System::civiExit();
}
}
| TheCraftyCanvas/folkshuln | sites/all/modules/civicrm/CRM/Core/Page/AJAX/Location.php | PHP | gpl-2.0 | 12,375 |
// $Id$
// QtLobby released under the GPLv3, see COPYING for details.
#include "TLDList.h"
QMap<QString, QString>* TLDList::TLDMap;
TLDList::TLDList( QObject* parent) : QObject(parent){
if ( TLDMap == NULL ) {
TLDMap = new QMap<QString, QString>;
QString TLDString = tr("AC:Ascension Island\n"
"AD:Andorra\n"
"AE:United Arab Emirates\n"
"AERO:Aircraft-related\n"
"AF:Afghanistan\n"
"AG:Antigua and Barbuda\n"
"AI:Anguilla\n"
"AL:Albania\n"
"AM:Armenia\n"
"AN:Netherland Antilles\n"
"AO:Angola\n"
"AQ:Antarctica\n"
"AR:Argentina\n"
"ARPA:Address and Routing Parameter Area\n"
"AS:American Samoa\n"
"AT:Austria\n"
"AU:Australia\n"
"AW:Aruba\n"
"AZ:Azerbaijan\n"
"BA:Bosnia-Herzegovina\n"
"BB:Barbados\n"
"BE:Belgium\n"
"BF:Burkina Faso\n"
"BG:Bulgaria\n"
"BH:Bahrain\n"
"BI:Burundi\n"
"BIz:Business\n"
"BJ:Benin\n"
"BM:Bermuda\n"
"BN:Brunei Darussalam\n"
"BO:Bolivia\n"
"BR:Brazil\n"
"BS:Bahamas\n"
"BT:Bhutan\n"
"BW:Botswana\n"
"BY:Belarus\n"
"BZ:Belize\n"
"CA:Canada\n"
"CC:Cocos (Keeling) Islands\n"
"CD:Democratic Republic of Congo\n"
"CF:Central African Republic\n"
"CG:Congo\n"
"CH:Switzerland\n"
"CI:Ivory Coast\n"
"CK:Cook Islands\n"
"CL:Chile\n"
"CM:Cameroon\n"
"CN:China\n"
"CO:Colombia\n"
"COM:Commercial\n"
"COOP:Cooperative-related\n"
"CR:Costa Rica\n"
"CU:Cuba\n"
"CV:Cape Verde\n"
"CX:Christmas Island\n"
"CY:Cyprus\n"
"CZ:Czech Republic\n"
"DE:Germany\n"
"DJ:Djibouti\n"
"DK:Denmark\n"
"DM:Dominica\n"
"DO:Dominican Republic\n"
"DZ:Algeria\n"
"EC:Ecuador\n"
"EDU:Educational\n"
"EE:Estonia\n"
"EG:Egypt\n"
"ES:Spain\n"
"ET:Ethiopia\n"
"FI:Finland\n"
"FJ:Fiji\n"
"FK:Falkland Islands (Malvinas)\n"
"FM:Micronesia\n"
"FO:Faroe Islands\n"
"FR:France\n"
"GB:Great Britan\n"
"GA:Gabon\n"
"GD:Grenada\n"
"GE:Georgia\n"
"GF:French Guyana\n"
"GH:Ghana\n"
"GI:Gibraltar\n"
"GL:Greenland\n"
"GM:Gambia\n"
"GN:Guinea\n"
"GOV:Government\n"
"GP:Guadeloupe (French)\n"
"GQ:Equatorial Guinea\n"
"GR:Greece\n"
"GT:Guatemala\n"
"GU:Guam (US)\n"
"GY:Guyana\n"
"HK:Hong Kong\n"
"HM:Heard and McDonald Islands\n"
"HN:Honduras\n"
"HR:Croatia (Hrvatska)\n"
"HU:Hungary\n"
"ID:Indonesia\n"
"IE:Ireland\n"
"IL:Israel\n"
"IN:India\n"
"INFO:General-purpose TLD\n"
"INT:International\n"
"IO:British Indian Ocean Territory\n"
"IR:Islamic Republic of Iran\n"
"IS:Iceland\n"
"IT:Italy\n"
"JM:Jamaica\n"
"JO:Jordan\n"
"JP:Japan\n"
"KE:Kenya\n"
"KG:Kyrgyzstan\n"
"KH:Cambodia\n"
"KI:Kiribati\n"
"KM:Comoros\n"
"KN:Saint Kitts Nevis Anguilla\n"
"KR:South Korea\n"
"KW:Kuwait\n"
"KY:Cayman Islands\n"
"KZ:Kazakhstan\n"
"LA:Laos (People's Democratic Republic)\n"
"LB:Lebanon\n"
"LC:Saint Lucia\n"
"LI:Liechtenstein\n"
"LK:Sri Lanka\n"
"LR:Liberia\n"
"LS:Lesotho\n"
"LT:Lithuania\n"
"LU:Luxembourg\n"
"LV:Latvia\n"
"LY:Libya (Libyan Arab Jamahiriya)\n"
"MA:Morocco\n"
"MC:Monaco\n"
"MD:Moldavia\n"
"MG:Madagascar\n"
"MH:Marshall Islands\n"
"MIL:US Military\n"
"MK:Macedonia\n"
"ML:Mali\n"
"MM:Myanmar\n"
"MN:Mongolia\n"
"MO:Macau\n"
"MP:Northern Mariana Islands\n"
"MQ:Martinique (French)\n"
"MR:Mauritania\n"
"MS:Montserrat\n"
"MT:Malta\n"
"MU:Mauritius\n"
"MUseum:Museum-related\n"
"MV:Maldives\n"
"MW:Malawi\n"
"MX:Mexico\n"
"MY:Malaysia\n"
"MZ:Mozambique\n"
"NA:Namibia\n"
"NAME:Personal name\n"
"NC:New Caledonia (French)\n"
"NE:Niger\n"
"NET:Network Infrastructure\n"
"NF:Norfolk Island\n"
"NG:Nigeria\n"
"NI:Nicaragua\n"
"NL:Netherlands\n"
"NO:Norway\n"
"NP:Nepal\n"
"NR:Nauru\n"
"NU:Niue\n"
"NZ:New Zealand\n"
"OM:Oman\n"
"ORG:Nonprofit\n"
"PA:Panama\n"
"PE:Peru\n"
"PF:French Polynesia\n"
"PF:Polynesia (French)\n"
"PG:Papua New Guinea\n"
"PH:Philippines\n"
"PK:Pakistan\n"
"PL:Poland\n"
"PM:Saint Pierre and Miquelon\n"
"PN:Pitcairn\n"
"PR:Puerto Rico (US)\n"
"PRo:Professional domain\n"
"PS:Palestina\n"
"PT:Portugal\n"
"PW:Palau\n"
"PY:Paraguay\n"
"QA:Qatar\n"
"RE:Reunion (French)\n"
"RO:Romania\n"
"RU:Russian Federation\n"
"RW:Rwanda\n"
"SA:Saudi Arabia\n"
"SB:Solomon Islands\n"
"SC:Seychelles\n"
"SE:Sweden\n"
"SG:Singapore\n"
"SH:Saint Helena\n"
"SI:Slovenia\n"
"SK:Slovak Republic (Slovakia)\n"
"SL:Sierra Leone\n"
"SM:San Marino\n"
"SN:Senegal\n"
"SO:Somalia\n"
"SR:Surinam\n"
"ST:Saint Tome and Principe\n"
"SU:Soviet Union\n"
"SV:El Salvador\n"
"SZ:Swaziland\n"
"TC:Turks and Caicos Islands\n"
"TD:Chad\n"
"TF:French Southern Territories\n"
"TG:Togo\n"
"TH:Thailand\n"
"TJ:Tajikistan\n"
"TK:Tokelau\n"
"TM:Turkmenistan\n"
"TN:Tunisia\n"
"TO:Tonga\n"
"TP:East Timor\n"
"TR:Turkey\n"
"TT:Trinidad and Tobago\n"
"TV:Tuvalu\n"
"TW:Taiwan\n"
"TZ:Tanzania\n"
"UA:Ukraine\n"
"UG:Uganda\n"
"UK:United Kingdom\n"
"US:United States of America\n"
"UY:Uruguay\n"
"UZ:Uzbekistan\n"
"VA:Vatican City State\n"
"VC:Saint Vincent and the Grenadines\n"
"VE:Venezuela\n"
"VG:Virgin Islands (British)\n"
"VI:Virgin Islands (US)\n"
"VN:Vietnam\n"
"VU:Vanuatu\n"
"WS:Samoa\n"
"YE:Yemen\n"
"YU:Yugoslavia\n"
"ZA:South Africa\n"
"ZM:Zambia\n"
"ZR:Zaire\n"
"ZW:Zimbabwe\n"
"XX:?\n"
);
QStringList list = TLDString.split( "\n" );
foreach( QString s, list ) {
TLDMap->insert( s.section( ":", 0, 0 ), s.section( ":", 1, 1 ) );
}
}
}
TLDList::~TLDList() {
}
| tizbac/qtlobby | src/TLDList.cpp | C++ | gpl-2.0 | 9,013 |
// qtractorAtomic.h
//
/****************************************************************************
Copyright (C) 2005-2021, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
#ifndef __qtractorAtomic_h
#define __qtractorAtomic_h
#define HAVE_QATOMIC_H
#if defined(HAVE_QATOMIC_H)
# include <qatomic.h>
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(HAVE_QATOMIC_H)
typedef QAtomicInt qtractorAtomic;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
#define ATOMIC_GET(a) ((a)->loadRelaxed())
#define ATOMIC_SET(a,v) ((a)->storeRelaxed(v))
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#define ATOMIC_GET(a) ((a)->load())
#define ATOMIC_SET(a,v) ((a)->store(v))
#else
#define ATOMIC_GET(a) ((int) *(a))
#define ATOMIC_SET(a,v) (*(a) = (v))
#endif
static inline int ATOMIC_CAS ( qtractorAtomic *pVal,
int iOldValue, int iNewValue )
{
return pVal->testAndSetOrdered(iOldValue, iNewValue);
}
#else // !HAVE_QATOMIC_H
#if defined(__GNUC__)
#if defined(__powerpc__) || defined(__powerpc64__)
static inline int ATOMIC_CAS1 (
volatile int *pValue, int iOldValue, int iNewValue )
{
register int result;
asm volatile (
"# ATOMIC_CAS1 \n"
" lwarx r0, 0, %1 \n"
" cmpw r0, %2 \n"
" bne- 1f \n"
" sync \n"
" stwcx. %3, 0, %1 \n"
" bne- 1f \n"
" li %0, 1 \n"
" b 2f \n"
"1: \n"
" li %0, 0 \n"
"2: \n"
: "=r" (result)
: "r" (pValue), "r" (iOldValue), "r" (iNewValue)
: "r0"
);
return result;
}
#elif defined(__i386__) || defined(__x86_64__)
static inline int ATOMIC_CAS1 (
volatile int *pValue, int iOldValue, int iNewValue )
{
register char result;
asm volatile (
"# ATOMIC_CAS1 \n"
"lock ; cmpxchgl %2, %3 \n"
"sete %1 \n"
: "=a" (iNewValue), "=qm" (result)
: "r" (iNewValue), "m" (*pValue), "0" (iOldValue)
: "memory"
);
return result;
}
#else
# error "qtractorAtomic.h: unsupported target compiler processor (GNUC)."
#endif
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
static inline int ATOMIC_CAS1 (
volatile int *pValue, int iOldValue, int iNewValue )
{
register char result;
__asm {
push ebx
push esi
mov esi, pValue
mov eax, iOldValue
mov ebx, iNewValue
lock cmpxchg dword ptr [esi], ebx
sete result
pop esi
pop ebx
}
return result;
}
#else
# error "qtractorAtomic.h: unsupported target compiler processor (WIN32)."
#endif
typedef struct { volatile int value; } qtractorAtomic;
#define ATOMIC_GET(a) ((a)->value)
#define ATOMIC_SET(a,v) ((a)->value = (v))
static inline int ATOMIC_CAS ( qtractorAtomic *pVal,
int iOldValue, int iNewValue )
{
return ATOMIC_CAS1(&(pVal->value), iOldValue, iNewValue);
}
#endif // !HAVE_QATOMIC_H
// Strict test-and-set primite.
static inline int ATOMIC_TAS ( qtractorAtomic *pVal )
{
return ATOMIC_CAS(pVal, 0, 1);
}
// Strict test-and-add primitive.
static inline int ATOMIC_ADD ( qtractorAtomic *pVal, int iAddValue )
{
volatile int iOldValue, iNewValue;
do {
iOldValue = ATOMIC_GET(pVal);
iNewValue = iOldValue + iAddValue;
} while (!ATOMIC_CAS(pVal, iOldValue, iNewValue));
return iNewValue;
}
#define ATOMIC_INC(a) ATOMIC_ADD((a), (+1))
#define ATOMIC_DEC(a) ATOMIC_ADD((a), (-1))
// Special test-and-zero primitive (invented here:)
static inline int ATOMIC_TAZ ( qtractorAtomic *pVal )
{
volatile int iOldValue;
do {
iOldValue = ATOMIC_GET(pVal);
} while (iOldValue && !ATOMIC_CAS(pVal, iOldValue, 0));
return iOldValue;
}
#if defined(__cplusplus)
}
#endif
#endif // __qtractorAtomic_h
// end of qtractorAtomic.h
| rncbc/qtractor | src/qtractorAtomic.h | C | gpl-2.0 | 4,341 |
Timeline Component Integration
==========
This component will not function properly without the the following hook and container classes.
1. Right after the opening body tag, in your WordPress theme template, add the following hook. Aesop uses this hook to inject markup.
### Pre 1.0.5
`do_action(‘aesop_inside_body_top’);`
### 1.0.5+
`do_action(‘ase_theme_body_inside_top’);`
2. Add this CSS class to your article/container div that holds the actual post.
`.aesop-entry-content` | AesopInteractive/ase-code-snippet-library | filters/timeline/integrations.md | Markdown | gpl-2.0 | 495 |
/*
* max8698.h -- Voltage regulation for the Maxim 8698
*
* Copyright (C) 2009 Samsung Electrnoics
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef REGULATOR_MAX8698
#define REGULATOR_MAX8698
#include <linux/regulator/machine.h>
enum {
MAX8698_LDO1 = 1,
MAX8698_LDO2,
MAX8698_LDO3,
MAX8698_LDO4,
MAX8698_LDO5,
MAX8698_LDO6,
MAX8698_LDO7,
MAX8698_LDO8,
MAX8698_LDO9,
MAX8698_DCDC1,
MAX8698_DCDC2,
MAX8698_DCDC3,
};
/**
* max8698_subdev_data - regulator data
* @id: regulator Id
* @initdata: regulator init data (contraints, supplies, ...)
*/
/* old structure
struct max8698_subdev_data {
int id;
struct regulator_init_data *initdata;
};*/
struct max8698_subdev_data {
int id;
// const char *name;
void *platform_data;
};
/**
* max8698_platform_data - platform data for max8698
* @num_regulators: number of regultors used
* @regulators: regulator used
*/
struct max8698_platform_data {
int num_regulators;
struct max8698_subdev_data *regulators;
};
#endif
| skeeterslint/linux-2.6.29 | include/linux/regulator/max8698.h | C | gpl-2.0 | 1,704 |
<?php
namespace Drupal\webform_node;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
/**
* Prevents webform_node module from being uninstalled whilst any webform nodes exist.
*/
class WebformNodeUninstallValidator implements ModuleUninstallValidatorInterface {
use StringTranslationTrait;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a WebformNodeUninstallValidator.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) {
$this->entityTypeManager = $entity_type_manager;
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
public function validate($module) {
$reasons = [];
if ($module === 'webform_node') {
// The webform node type is provided by the Webform node module. Prevent
// uninstall if there are any nodes of that type.
if ($this->hasWebformNodes()) {
$reasons[] = $this->t('To uninstall Webform node, delete all content that has the Webform content type.');
}
}
return $reasons;
}
/**
* Determines if there is any webform nodes or not.
*
* @return bool
* TRUE if there are webform nodes, FALSE otherwise.
*/
protected function hasWebformNodes() {
$nodes = $this->entityTypeManager->getStorage('node')->getQuery()
->condition('type', 'webform')
->accessCheck(FALSE)
->range(0, 1)
->execute();
return !empty($nodes);
}
}
| YaManicKill/viewfield | web/modules/webform/modules/webform_node/src/WebformNodeUninstallValidator.php | PHP | gpl-2.0 | 1,995 |
<?php
/**
* Custom template tags for this theme.
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package testwp_ssass
*/
if ( ! function_exists( 'testwp_ssass_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*/
function testwp_ssass_paging_nav() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'testwp_ssass' ); ?></h1>
<div class="nav-links">
<?php if ( get_next_posts_link() ) : ?>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'testwp_ssass' ) ); ?></div>
<?php endif; ?>
<?php if ( get_previous_posts_link() ) : ?>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'testwp_ssass' ) ); ?></div>
<?php endif; ?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
if ( ! function_exists( 'testwp_ssass_post_nav' ) ) :
/**
* Display navigation to next/previous post when applicable.
*/
function testwp_ssass_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
<nav class="navigation post-navigation" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'testwp_ssass' ); ?></h1>
<div class="nav-links">
<?php
previous_post_link( '<div class="nav-previous">%link</div>', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'testwp_ssass' ) );
next_post_link( '<div class="nav-next">%link</div>', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'testwp_ssass' ) );
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
if ( ! function_exists( 'testwp_ssass_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function testwp_ssass_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
_x( 'Posted on %s', 'post date', 'testwp_ssass' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
$byline = sprintf(
_x( 'by %s', 'post author', 'testwp_ssass' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
}
endif;
if ( ! function_exists( 'testwp_ssass_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function testwp_ssass_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' == get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'testwp_ssass' ) );
if ( $categories_list && testwp_ssass_categorized_blog() ) {
printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'testwp_ssass' ) . '</span>', $categories_list );
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'testwp_ssass' ) );
if ( $tags_list ) {
printf( '<span class="tags-links">' . __( 'Tagged %1$s', 'testwp_ssass' ) . '</span>', $tags_list );
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link( __( 'Leave a comment', 'testwp_ssass' ), __( '1 Comment', 'testwp_ssass' ), __( '% Comments', 'testwp_ssass' ) );
echo '</span>';
}
edit_post_link( __( 'Edit', 'testwp_ssass' ), '<span class="edit-link">', '</span>' );
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function testwp_ssass_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'testwp_ssass_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'testwp_ssass_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so testwp_ssass_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so testwp_ssass_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in testwp_ssass_categorized_blog.
*/
function testwp_ssass_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'testwp_ssass_categories' );
}
add_action( 'edit_category', 'testwp_ssass_category_transient_flusher' );
add_action( 'save_post', 'testwp_ssass_category_transient_flusher' );
| stoicattempt/testwp_ssass | wp-content/themes/testwp_ssass/inc/template-tags.php | PHP | gpl-2.0 | 5,871 |
#system_notice_area_dismiss{
color: #FFFFFF;
cursor: pointer;
}
.system_notice_area_style1 {
background: #00C348;
border: 1px solid green;
}
.system_notice_area_style0 {
background: #FA5A6A;
border: 1px solid brown;
}
.bottonWidth{
width:120px;
}
.img{
width:20px;
height: 20px;
}
#bottomBorderNone{
border-bottom:none;
}
.submit{
background:#25A6E1;
background:-moz-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#25A6E1),color-stop(100%,#188BC0));
background:-webkit-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-o-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:-ms-linear-gradient(top,#25A6E1 0%,#188BC0 100%);
background:linear-gradient(top,#25A6E1 0%,#188BC0 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#25A6E1",endColorstr="#188BC0",GradientType=0);
padding:1px 13px;
color:#ffffff;
font-family:"Helvetica Neue",sans-serif;
font-size:15px;
cursor:pointer;
}
| JaredOlson/MuskegonFun | wp-content/plugins/contact-form-manager/css/xyz_cfm_styles.css | CSS | gpl-2.0 | 1,009 |
<?php
/**
* Represents the view for the public-facing component of the plugin.
*
* This typically includes any information, if any, that is rendered to the
* frontend of the theme when the plugin is activated.
*
* @package Changelog
* @author averta < >
* @license GPL-2.0+
* @link http://example.com
* @copyright 2014
*/
?>
<!-- This file is used to markup the public facing aspect of the plugin. -->
| M4Gd/changelog | public/views/public.php | PHP | gpl-2.0 | 427 |
<?php $orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 4, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() )
{
echo '<div id="related_posts" class="bottom-single-related"><h3 class="rs">Также рекомендуем прочитать</h3><ul>';
while( $my_query->have_posts() ) {
$my_query->the_post();
$thumb2 = get_post_thumbnail_id();$img_url2 = wp_get_attachment_url( $thumb2,'index-blog' );$image2 = aq_resize( $img_url2, 150,150,true );
?>
<li>
<?php if ($image){ ?>
<img src="<?php echo $image2; ?>">
<?php } ?>
<h2><a href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></li>
<?php } echo '</ul></div>'; } }
$post = $orig_post;
wp_reset_query();
?> | achyutdahal/1234 | wp-content/themes/urbannews32/framework/includes/related-img.php | PHP | gpl-2.0 | 1,123 |
<?php
/**
* @package Joomla.Administrator
* @subpackage com_config
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Config\Administrator\View\Component;
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;
/**
* View for the component configuration
*
* @since 3.2
*/
class HtmlView extends BaseHtmlView
{
/**
* The model state
*
* @var \Joomla\CMS\Object\CMSObject
* @since 3.2
*/
public $state;
/**
* The form object
*
* @var \Joomla\CMS\Form\Form
* @since 3.2
*/
public $form;
/**
* An object with the information for the component
*
* @var \Joomla\CMS\Component\ComponentRecord
* @since 3.2
*/
public $component;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @see \JViewLegacy::loadTemplate()
* @since 3.2
*/
public function display($tpl = null)
{
$form = null;
$component = null;
try
{
$component = $this->get('component');
if (!$component->enabled)
{
return false;
}
$form = $this->get('form');
$user = Factory::getUser();
}
catch (\Exception $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
return false;
}
$this->fieldsets = $form ? $form->getFieldsets() : null;
$this->formControl = $form ? $form->getFormControl() : null;
// Don't show permissions fieldset if not authorised.
if (!$user->authorise('core.admin', $component->option) && isset($this->fieldsets['permissions']))
{
unset($this->fieldsets['permissions']);
}
$this->form = &$form;
$this->component = &$component;
$this->components = ConfigHelper::getComponentsWithConfig();
$this->userIsSuperAdmin = $user->authorise('core.admin');
$this->currentComponent = Factory::getApplication()->input->get('component');
$this->return = Factory::getApplication()->input->get('return', '', 'base64');
$this->addToolbar();
return parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.2
*/
protected function addToolbar()
{
ToolbarHelper::title(Text::_($this->component->option . '_configuration'), 'sliders-h config');
ToolbarHelper::apply('component.apply');
ToolbarHelper::divider();
ToolbarHelper::save('component.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('component.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
$helpUrl = $this->form->getData()->get('helpURL');
$helpKey = (string) $this->form->getXml()->config->help['key'];
$helpKey = $helpKey ?: 'JHELP_COMPONENTS_' . strtoupper($this->currentComponent) . '_OPTIONS';
ToolbarHelper::help($helpKey, (boolean) $helpUrl, null, $this->currentComponent);
}
}
| bembelimen/joomla-cms | administrator/components/com_config/src/View/Component/HtmlView.php | PHP | gpl-2.0 | 3,193 |
#=====================================================================
# SQL-Ledger ERP
# Copyright (c) 2006
#
# Author: DWS Systems Inc.
# Web: http://www.sql-ledger.com
#
#======================================================================
#
# module for preparing Income Statement and Balance Sheet
#
#======================================================================
require "$form->{path}/arap.pl";
use SL::PE;
use SL::RP;
1;
# end of main
# this is for our long dates
# $locale->text('January')
# $locale->text('February')
# $locale->text('March')
# $locale->text('April')
# $locale->text('May ')
# $locale->text('June')
# $locale->text('July')
# $locale->text('August')
# $locale->text('September')
# $locale->text('October')
# $locale->text('November')
# $locale->text('December')
# this is for our short month
# $locale->text('Jan')
# $locale->text('Feb')
# $locale->text('Mar')
# $locale->text('Apr')
# $locale->text('May')
# $locale->text('Jun')
# $locale->text('Jul')
# $locale->text('Aug')
# $locale->text('Sep')
# $locale->text('Oct')
# $locale->text('Nov')
# $locale->text('Dec')
# $locale->text('Balance Sheet')
# $locale->text('Income Statement')
# $locale->text('Trial Balance')
# $locale->text('AR Aging')
# $locale->text('AP Aging')
# $locale->text('Tax collected')
# $locale->text('Tax paid')
# $locale->text('Receipts')
# $locale->text('Payments')
# $locale->text('Project Transactions')
# $locale->text('Non-taxable Sales')
# $locale->text('Non-taxable Purchases')
sub report {
%report = ( balance_sheet => { title => 'Balance Sheet' },
income_statement => { title => 'Income Statement' },
trial_balance => { title => 'Trial Balance' },
ar_aging => { title => 'AR Aging', vc => 'customer' },
ap_aging => { title => 'AP Aging', vc => 'vendor' },
tax_collected => { title => 'Tax collected', vc => 'customer' },
tax_paid => { title => 'Tax paid' },
nontaxable_sales => { title => 'Non-taxable Sales', vc => 'customer' },
nontaxable_purchases => { title => 'Non-taxable Purchases' },
receipts => { title => 'Receipts', vc => 'customer' },
payments => { title => 'Payments' },
projects => { title => 'Project Transactions' },
reminder => { title => 'Reminder', vc => 'customer' },
);
$form->{title} = $locale->text($report{$form->{report}}->{title});
$form->{nextsub} = "generate_$form->{report}";
$gifi = qq|
<tr>
<th align=right>|.$locale->text('Accounts').qq|</th>
<td><input name=accounttype class=radio type=radio value=standard checked> |.$locale->text('Standard').qq|
<input name=accounttype class=radio type=radio value=gifi> |.$locale->text('GIFI').qq|
</td>
</tr>
|;
RP->create_links(\%myconfig, \%$form, $report{$form->{report}}->{vc});
# departments
if (@{ $form->{all_department} }) {
$form->{selectdepartment} = "<option>\n";
for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="|.$form->quote($_->{description}).qq|--$_->{id}">$_->{description}\n| }
}
$department = qq|
<tr>
<th align=right nowrap>|.$locale->text('Department').qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
</tr>
| if $form->{selectdepartment};
if (@{ $form->{all_years} }) {
# accounting years
$selectaccountingyear = "<option>\n";
for (@{ $form->{all_years} }) { $selectaccountingyear .= qq|<option>$_\n| }
$selectaccountingmonth = "<option>\n";
for (sort keys %{ $form->{all_month} }) { $selectaccountingmonth .= qq|<option value=$_>|.$locale->text($form->{all_month}{$_}).qq|\n| }
$selectfrom = qq|
<tr>
<th align=right>|.$locale->text('Period').qq|</th>
<td colspan=3>
<select name=month>$selectaccountingmonth</select>
<select name=year>$selectaccountingyear</select>
<input name=interval class=radio type=radio value=0 checked> |.$locale->text('Current').qq|
<input name=interval class=radio type=radio value=1> |.$locale->text('Month').qq|
<input name=interval class=radio type=radio value=3> |.$locale->text('Quarter').qq|
<input name=interval class=radio type=radio value=12> |.$locale->text('Year').qq|
</td>
</tr>
|;
$selectto = qq|
<tr>
<th align=right></th>
<td>
<select name=month>$selectaccountingmonth</select>
<select name=year>$selectaccountingyear</select>
</td>
</tr>
|;
}
$summary = qq|
<tr>
<th></th>
<td><input name=summary type=radio class=radio value=1 checked> |.$locale->text('Summary').qq|
<input name=summary type=radio class=radio value=0> |.$locale->text('Detail').qq|
</td>
</tr>
|;
# projects
if (@{ $form->{all_project} }) {
$form->{selectproject} = "<option>\n";
for (@{ $form->{all_project} }) { $form->{selectproject} .= qq|<option value="|.$form->quote($_->{projectnumber}).qq|--$_->{id}">$_->{projectnumber}\n| }
$project = qq|
<tr>
<th align=right nowrap>|.$locale->text('Project').qq|</th>
<td colspan=3><select name=projectnumber>$form->{selectproject}</select></td>
</tr>|;
}
if (@{ $form->{all_language} }) {
$form->{selectlanguage} = "\n";
for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|$_->{code}--$_->{description}\n| }
$lang = qq|
<tr>
<th align=right nowrap>|.$locale->text('Language').qq|</th>
<td colspan=3><select name=language_code>|.$form->select_option($form->{selectlanguage}, $myconfig{countrycode}, undef, 1).qq|</select></td>
</tr>|;
}
$form->{decimalplaces} = $form->{precision};
$method{accrual} = "checked" if $form->{method} eq 'accrual';
$method{cash} = "checked" if $form->{method} eq 'cash';
if ($form->{report} eq 'balance_sheet' || $form->{report} eq 'income_statement') {
$form->{currencies} = $form->get_currencies(undef, \%myconfig);
if ($form->{currencies}) {
@curr = split /:/, $form->{currencies};
$form->{defaultcurrency} = $curr[0];
for (@curr) { $form->{selectcurrency} .= "$_\n" }
$curr = qq|
<tr>
<th align=right>|.$locale->text('Currency').qq|</th>
<td><select name=currency>|
.$form->select_option($form->{selectcurrency}, $form->{defaultcurrency})
.qq|</select></td>
</tr>|
.$form->hide_form(defaultcurrency);
}
}
$method = qq|
<tr>
<th align=right>|.$locale->text('Method').qq|</th>
<td colspan=3><input name=method class=radio type=radio value=accrual $method{accrual}> |.$locale->text('Accrual').qq|
<input name=method class=radio type=radio value=cash $method{cash}> |.$locale->text('Cash').qq|</td>
</tr>
|;
$form->header;
print qq|
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr>
<th class=listtop>$form->{title}</th>
</tr>
<tr height="5"></tr>
<tr>
<td>
<table>
$department
|;
if ($form->{report} eq "projects") {
print qq|
$project
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectfrom
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
<td><input name=l_heading class=checkbox type=checkbox value=Y> |.$locale->text('Heading').qq|
<input name=l_subtotal class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|</td>
</tr>
|;
}
if ($form->{report} eq "income_statement") {
print qq|
$project
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
|;
if ($selectfrom) {
print qq|
<tr>
<th align=right>|.$locale->text('Period').qq|</th>
<td colspan=3>
<select name=frommonth>$selectaccountingmonth</select>
<select name=fromyear>$selectaccountingyear</select>
<input name=interval class=radio type=radio value=0 checked> |.$locale->text('Current').qq|
<input name=interval class=radio type=radio value=1> |.$locale->text('Month').qq|
<input name=interval class=radio type=radio value=3> |.$locale->text('Quarter').qq|
<input name=interval class=radio type=radio value=12> |.$locale->text('Year').qq|
</td>
</tr>
|;
}
print qq|
<tr>
<th align=right>|.$locale->text('Compare to').qq|</th>
</tr>
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=comparefromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"> <b>|.$locale->text('To').qq|</b> <input name=comparetodate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
|;
if ($selectto) {
print qq|
<tr>
<th align=right>|.$locale->text('Period').qq|</th>
<td>
<select name=comparemonth>$selectaccountingmonth</select>
<select name=compareyear>$selectaccountingyear</select>
</td>
</tr>
|;
}
print qq|
$curr
<tr>
<th align=right>|.$locale->text('Decimalplaces').qq|</th>
<td><input name=decimalplaces size=3 value=$form->{decimalplaces}></td>
</tr>
$lang
</table>
</td>
</tr>
<tr>
<td>
<table>
$method
<tr>
<th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
<td colspan=3><input name=l_heading class=checkbox type=checkbox value=Y> |.$locale->text('Heading').qq|
<input name=l_subtotal class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|
<input name=l_accno class=checkbox type=checkbox value=Y> |.$locale->text('Account Number').qq|</td>
</tr>
|;
}
if ($form->{report} eq "balance_sheet") {
print qq|
<tr>
<th align=right>|.$locale->text('as at').qq|</th>
<td><input name=asofdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{asofdate}></td>
|;
if ($selectfrom) {
print qq|
<td>
<select name=asofmonth>$selectaccountingmonth</select>
<select name=asofyear>$selectaccountingyear</select>
</td>
|;
}
print qq|
</tr>
<th align=right nowrap>|.$locale->text('Compare to').qq|</th>
<td><input name=compareasofdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
<td>
|;
if ($selectto) {
print qq|
<select name=compareasofmonth>$selectaccountingmonth</select>
<select name=compareasofyear>$selectaccountingyear</select>
</td>
|;
}
print qq|
</tr>
<tr>
$curr
<th align=right>|.$locale->text('Decimalplaces').qq|</th>
<td><input name=decimalplaces size=3 value=$form->{precision}></td>
</tr>
$lang
</table>
</td>
</tr>
<tr>
<td>
<table>
$method
<tr>
<th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
<td><input name=l_heading class=checkbox type=checkbox value=Y> |.$locale->text('Heading').qq|
<input name=l_subtotal class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|
<input name=l_accno class=checkbox type=checkbox value=Y> |.$locale->text('Account Number').qq|</td>
</tr>
|;
}
if ($form->{report} eq "trial_balance") {
print qq|
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectfrom
$lang
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
<td><input name=l_heading class=checkbox type=checkbox value=Y> |.$locale->text('Heading').qq|
<input name=l_subtotal class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|
<input name=all_accounts class=checkbox type=checkbox value=Y> |.$locale->text('All Accounts').qq|</td>
</tr>
|;
}
if ($form->{report} =~ /^tax_/) {
$gifi = "";
$form->{db} = ($form->{report} =~ /_collected/) ? "ar" : "ap";
RP->get_taxaccounts(\%myconfig, \%$form);
$form->{nextsub} = "generate_tax_report";
print qq|
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectfrom
$summary
<tr>
<th align=right>|.$locale->text('Report for').qq|</th>
<td colspan=3>
|;
$checked = "checked";
foreach $ref (@{ $form->{taxaccounts} }) {
print qq|<input name=accno class=radio type=radio value="|.$form->quote($ref->{accno}).qq|" $checked> $ref->{description}
<input name="$ref->{accno}_description" type=hidden value="|.$form->quote($ref->{description}).qq|">|;
$checked = "";
}
print qq|
<input type=hidden name=db value=$form->{db}>
<input type=hidden name=sort value=transdate>
</td>
</tr>
|;
if (@{ $form->{gifi_taxaccounts} }) {
print qq|
<tr>
<th align=right>|.$locale->text('GIFI').qq|</th>
<td colspan=3>
|;
foreach $ref (@{ $form->{gifi_taxaccounts} }) {
print qq|<input name=accno class=radio type=radio value="|.$form->quote("gifi_$ref->{accno}").qq|"> $ref->{description}
<input name="gifi_$ref->{accno}_description" type=hidden value="|.$form->quote($ref->{description}).qq|">|;
}
print qq|
</td>
</tr>
|;
}
if ($form->{db} eq 'ar') {
$vc = qq|
<td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Customer').qq|</td>
<td><input name="l_customernumber" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Customer Number').qq|</td>|;
}
if ($form->{db} eq 'ap') {
$vc = qq|
<td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Vendor').qq|</td>
<td><input name="l_vendornumber" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Vendor Number').qq|</td>|;
}
print qq|
$method
</table>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<th align=right>|.$locale->text('Include in Report').qq|</th>
<td>
<table>
<tr>
<td><input name="l_id" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('ID').qq|</td>
<td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Invoice').qq|</td>
<td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Date').qq|</td>
<td><input name="l_description" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Description').qq|</td>
</tr>
<tr>
$vc
<td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Amount').qq|</td>
<td><input name="l_tax" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Tax').qq|</td>
</tr>
<tr>
<td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Subtotal').qq|</td>
</tr>
</table>
</td>
</tr>
|;
}
if ($form->{report} =~ /^nontaxable_/) {
$gifi = "";
$form->{db} = ($form->{report} =~ /_sales/) ? "ar" : "ap";
$form->{nextsub} = "generate_tax_report";
if ($form->{db} eq 'ar') {
$vc = qq|
<td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Customer').qq|</td>
<td><input name="l_customernumber" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Customer Number').qq|</td>|;
}
if ($form->{db} eq 'ap') {
$vc = qq|
<td><input name="l_name" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Vendor').qq|</td>
<td><input name="l_vendornumber" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Vendor Number').qq|</td>|;
}
print qq|
<input type=hidden name=db value=$form->{db}>
<input type=hidden name=sort value=transdate>
<input type=hidden name=report value=$form->{report}>
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectfrom
$summary
$method
<tr>
<th align=right>|.$locale->text('Include in Report').qq|</th>
<td colspan=3>
<table>
<tr>
<td><input name="l_id" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('ID').qq|</td>
<td><input name="l_invnumber" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Invoice').qq|</td>
<td><input name="l_transdate" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Date').qq|</td>
<td><input name="l_description" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Description').qq|</td>
</tr>
<tr>
$vc
<td><input name="l_netamount" class=checkbox type=checkbox value=Y checked></td>
<td>|.$locale->text('Amount').qq|</td>
</tr>
<tr>
<td><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
<td>|.$locale->text('Subtotal').qq|</td>
</tr>
</table>
</td>
</tr>
|;
}
if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
$gifi = "";
if ($form->{report} eq 'ar_aging') {
$vclabel = $locale->text('Customer');
$vcnumber = $locale->text('Customer Number');
$form->{vc} = 'customer';
$form->{sort} = "customernumber" if $form->{namesbynumber};
} else {
$vclabel = $locale->text('Vendor');
$vcnumber = $locale->text('Vendor Number');
$form->{vc} = 'vendor';
}
$form->{sort} = ($form->{namesbynumber}) ? "$form->{vc}number" : "name";
$form->{type} = "statement";
$form->{format} ||= $myconfig{outputformat};
$form->{media} ||= $myconfig{printer};
# setup vc selection
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP", undef, undef, undef, 1);
if (@{ $form->{"all_$form->{vc}"} }) {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><select name=$form->{vc}><option>\n|;
for (@{ $form->{"all_$form->{vc}"} }) { $vc .= qq|<option value="|.$form->quote($_->{name}).qq|--$_->{id}">$_->{name}\n| }
$vc .= qq|</select>
</td>
</tr>
|;
} else {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><input name=$form->{vc} size=35>
</td>
</tr>
<tr>
<th align=right nowrap>$vcnumber</th>
<td colspan=3><input name="$form->{vc}number" size=35>
</td>
</tr>
|;
}
print qq|
$vc
<tr>
<th align=right>|.$locale->text('To').qq|</th>
<td><input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectto
<input type=hidden name=action value="$form->{nextsub}">
$summary
<tr>
<table>
<tr>
<th>|.$locale->text('Include in Report').qq|</th>
<td>
<table>
<tr>
<td nowrap><input name=overdue type=radio class=radio value=0 checked> |.$locale->text('Aged').qq|</td>
<td nowrap><input name=overdue type=radio class=radio value=1> |.$locale->text('Overdue').qq|</td>
</tr>
<tr>
<td nowrap width=70><input name=c0 type=checkbox class=checkbox value=1 checked> |.$locale->text('Current').qq|</td>
<td nowrap width=70><input name=c30 type=checkbox class=checkbox value=1 checked> 30</td>
<td nowrap width=70><input name=c60 type=checkbox class=checkbox value=1 checked> 60</td>
<td nowrap width=70><input name=c90 type=checkbox class=checkbox value=1 checked> 90</td>
</tr>
<tr>
<td nowrap width=70><input name=c15 type=checkbox class=checkbox value=1> 15</td>
<td nowrap width=70><input name=c45 type=checkbox class=checkbox value=1> 45</td>
<td nowrap width=70><input name=c75 type=checkbox class=checkbox value=1> 75</td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
|;
$form->hide_form(qw(nextsub type format media sort));
}
if ($form->{report} eq 'reminder') {
$gifi = "";
$vclabel = $locale->text('Customer');
$vcnumber = $locale->text('Customer Number');
$form->{vc} = 'customer';
$form->{sort} = "customernumber" if $form->{namesbynumber};
$form->{sort} = ($form->{namesbynumber}) ? "$form->{vc}number" : "name";
$form->{type} = "reminder";
$form->{format} ||= $myconfig{outputformat};
$form->{media} ||= $myconfig{printer};
# setup vc selection
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP", undef, undef, undef, 1);
if (@{ $form->{"all_$form->{vc}"} }) {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><select name=$form->{vc}><option>\n|;
for (@{ $form->{"all_$form->{vc}"} }) { $vc .= qq|<option value="|.$form->quote($_->{name}).qq|--$_->{id}">$_->{name}\n| }
$vc .= qq|</select>
</td>
</tr>
|;
} else {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><input name=$form->{vc} size=35>
</td>
</tr>
<tr>
<th align=right nowrap>$vcnumber</th>
<td colspan=3><input name="$form->{vc}number" size=35>
</td>
</tr>
|;
}
print qq|
$vc
<input type=hidden name=action value="$form->{nextsub}">
|;
$form->hide_form(qw(type format media sort));
}
# above action can be removed if there is more than one input field
if ($form->{report} =~ /(receipts|payments)$/) {
$form->{nextsub} = "list_payments";
$gifi = "";
$form->{db} = ($form->{report} =~ /payments/) ? "ap" : "ar";
$form->{vc} = ($form->{db} eq 'ar') ? 'customer' : 'vendor';
RP->paymentaccounts(\%myconfig, \%$form);
$selectpaymentaccount = "\n";
foreach $ref (@{ $form->{PR} }) {
$form->{paymentaccounts} .= "$ref->{accno} ";
$selectpaymentaccount .= qq|$ref->{accno}--$ref->{description}\n|;
}
chop $form->{paymentaccounts};
$form->hide_form(qw(paymentaccounts));
if ($form->{vc} eq 'customer') {
$vclabel = $locale->text('Customer');
$vcnumber = $locale->text('Customer Number');
$form->all_vc(\%myconfig, $form->{vc}, "AR");
} else {
$form->all_vc(\%myconfig, $form->{vc}, "AP");
$vclabel = $locale->text('Vendor');
$vcnumber = $locale->text('Vendor Number');
}
# setup vc selection
if ($@{ $form->{"all_$form->{vc}"} }) {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><select name=$form->{vc}><option>\n|;
for (@{ $form->{"all_$form->{vc}"} }) { $vc .= qq|<option value="|.$form->quote($_->{name}).qq|--$_->{id}">$_->{name}\n| }
$vc .= qq|</select>
</td>
</tr>
|;
} else {
$vc = qq|
<tr>
<th align=right nowrap>$vclabel</th>
<td colspan=2><input name=$form->{vc} size=35>
</td>
</tr>
<tr>
<th align=right nowrap>$vcnumber</th>
<td colspan=3><input name="$form->{vc}number" size=35>
</td>
</tr>
|;
}
print qq|
<tr>
<th align=right nowrap>|.$locale->text('Account').qq|</th>
<td colspan=3><select name=account>|
.$form->select_option($selectpaymentaccount)
.qq|</select>
</td>
</tr>
$vc
<tr>
<th align=right nowrap>|.$locale->text('Description').qq|</th>
<td colspan=3><input name=description size=35></td>
</tr>
<tr>
<th align=right nowrap>|.$locale->text('Source').qq|</th>
<td colspan=3><input name=source></td>
</tr>
<tr>
<th align=right nowrap>|.$locale->text('Memo').qq|</th>
<td colspan=3><input name=memo size=30></td>
</tr>
<tr>
<th align=right>|.$locale->text('From').qq|</th>
<td colspan=3><input name=fromdate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)" value=$form->{fromdate}> <b>|.$locale->text('To').qq|</b> <input name=todate size=11 class=date title="$myconfig{dateformat}" onChange="validateDate(this)"></td>
</tr>
$selectfrom
<tr>
<th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
<td>
<table width=100%>
<tr>
<td align=right><input type=checkbox class=checkbox name=fx_transaction value=1 checked> |.$locale->text('Exchange Rate Difference').qq|</td>
</tr>
|;
@a = ();
push @a, qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |.$locale->text('Date');
push @a, qq|<input name="l_reference" class=checkbox type=checkbox value=Y checked> |.$locale->text('Reference');
push @a, qq|<input name="l_name" class=checkbox type=checkbox value=Y checked> |.$locale->text($vclabel);
push @a, qq|<input name="l_$form->{vc}number" class=checkbox type=checkbox value=Y> |.$locale->text($vcnumber);
push @a, qq|<input name="l_description" class=checkbox type=checkbox value=Y checked> |.$locale->text('Description');
push @a, qq|<input name="l_paid" class=checkbox type=checkbox value=Y checked> |.$locale->text('Amount');
push @a, qq|<input name="l_source" class=checkbox type=checkbox value=Y checked> |.$locale->text('Source');
push @a, qq|<input name="l_memo" class=checkbox type=checkbox value=Y checked> |.$locale->text('Memo');
while (@a) {
print qq|<tr>\n|;
for (1 .. 5) {
print qq|<td nowrap>|. shift @a;
print qq|</td>\n|;
}
print qq|</tr>\n|;
}
print qq|
<tr>
<td><input name=l_subtotal class=checkbox type=checkbox value=Y> |.$locale->text('Subtotal').qq|</td>
</tr>
</table>
</td>
</tr>
|;
$form->{sort} = 'transdate';
$form->hide_form(qw(vc db sort));
}
print qq|
$gifi
</table>
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
<br>
<input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
|;
$form->hide_form(qw(title nextsub path login));
print qq|
</form>
|;
if ($form->{menubar}) {
require "$form->{path}/menu.pl";
&menubar;
}
print qq|
</body>
</html>
|;
}
sub continue { &{$form->{nextsub}} };
sub generate_income_statement {
$form->{padding} = " ";
$form->{bold} = "<strong>";
$form->{endbold} = "</strong>";
$form->{br} = "<br>";
RP->income_statement(\%myconfig, \%$form);
($form->{department}) = split /--/, $form->{department};
($form->{projectnumber}) = split /--/, $form->{projectnumber};
$form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
$form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
# if there are any dates construct a where
if ($form->{fromdate} || $form->{todate}) {
unless ($form->{todate}) {
$form->{todate} = $form->current_date(\%myconfig);
}
$longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
$shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
$longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
$shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
$form->{this_period} = "$shortfromdate<br>\n$shorttodate";
$form->{period} = $locale->text('for Period').qq|<br>\n$longfromdate |.$locale->text('To').qq| $longtodate|;
}
if ($form->{comparefromdate} || $form->{comparetodate}) {
$longcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 1);
$shortcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 0);
$longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
$shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
$form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
$form->{period} .= "<br>\n$longcomparefromdate ".$locale->text('To').qq| $longcomparetodate|;
}
# setup variables for the form
$form->format_string(qw(company address businessnumber));
$form->{address} =~ s/\n/<br>/g;
$form->{templates} = $myconfig{templates};
$form->{IN} = "income_statement.html";
$form->parse_template;
}
sub generate_balance_sheet {
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{endbold} = "</b>";
$form->{br} = "<br>";
RP->balance_sheet(\%myconfig, \%$form);
$form->{asofdate} = $form->current_date(\%myconfig) unless $form->{asofdate};
$form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
($form->{department}) = split /--/, $form->{department};
# define Current Earnings account
$padding = ($form->{l_heading}) ? $form->{padding} : "";
push(@{$form->{equity_account}}, $padding.$locale->text('Current Earnings'));
$form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
$form->{last_period} = $locale->date(\%myconfig, $form->{compareasofdate}, 0);
$form->{IN} = "balance_sheet.html";
# setup company variables for the form
$form->format_string(qw(company address businessnumber));
$form->{address} =~ s/\n/<br>/g;
$form->{templates} = $myconfig{templates};
$form->parse_template;
}
sub generate_projects {
$form->{nextsub} = "generate_projects";
$form->{title} = $locale->text('Project Transactions');
RP->trial_balance(\%myconfig, \%$form);
&list_accounts;
}
# Antonio Gallardo
#
# D.S. Feb 16, 2001
# included links to display transactions for period entered
# added headers and subtotals
#
sub generate_trial_balance {
# get for each account initial balance, debits and credits
RP->trial_balance(\%myconfig, \%$form);
$form->{nextsub} = "generate_trial_balance";
$form->{title} = $locale->text('Trial Balance') . " / $form->{company}";
$form->{callback} = "$form->{script}?action=generate_trial_balance";
for (qw(login path nextsub fromdate todate month year interval l_heading l_subtotal all_accounts accounttype)) { $form->{callback} .= "&$_=$form->{$_}" }
for (qw(department title)) { $form->{callback} .= "&$_=".$form->escape($form->{$_},1) }
$form->{callback} = $form->escape($form->{callback});
&list_accounts;
}
sub list_accounts {
$title = $form->escape($form->{title});
if ($form->{department}) {
($department) = split /--/, $form->{department};
$options = $locale->text('Department')." : $department<br>";
$department = $form->escape($form->{department});
}
if ($form->{projectnumber}) {
($projectnumber) = split /--/, $form->{projectnumber};
$options .= $locale->text('Project Number')." : $projectnumber<br>";
$projectnumber = $form->escape($form->{projectnumber});
}
# if there are any dates
if ($form->{fromdate} || $form->{todate}) {
if ($form->{fromdate}) {
$fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
}
if ($form->{todate}) {
$todate = $locale->date(\%myconfig, $form->{todate}, 1);
}
$form->{period} = "$fromdate - $todate";
} else {
$form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
}
$options .= $form->{period};
@column_index = qw(accno description begbalance debit credit endbalance);
$column_header{accno} = qq|<th class=listheading width=10%>|.$locale->text('Account').qq|</th>|;
$column_header{description} = qq|<th class=listheading>|.$locale->text('Description').qq|</th>|;
$column_header{debit} = qq|<th class=listheading width=10%>|.$locale->text('Debit').qq|</th>|;
$column_header{credit} = qq|<th class=listheading width=10%>|.$locale->text('Credit').qq|</th>|;
$column_header{begbalance} = qq|<th class=listheading width=10%>|.$locale->text('Beginning Balance').qq|</th>|;
$column_header{endbalance} = qq|<th class=listheading width=10%>|.$locale->text('Ending Balance').qq|</th>|;
if ($form->{accounttype} eq 'gifi') {
$column_header{accno} = qq|<th class=listheading>|.$locale->text('GIFI').qq|</th>|;
}
$form->header;
print qq|
<body>
<table width=100%>
<tr>
<th class=listtop>$form->{title}</th>
</tr>
<tr height="5"></tr>
<tr>
<td>$options</td>
</tr>
<tr>
<td>
<table width=100%>
<tr>|;
for (@column_index) { print "$column_header{$_}\n" }
print qq|
</tr>
|;
# sort the whole thing by account numbers and display
foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
$description = $form->escape($ref->{description});
$href = qq|ca.pl?path=$form->{path}&action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&prevreport=$form->{callback}|;
if ($form->{accounttype} eq 'gifi') {
$href .= "&gifi_accno=$ref->{accno}&gifi_description=$description";
$na = $locale->text('N/A');
if (!$ref->{accno}) {
for (qw(accno description)) { $ref->{$_} = $na }
}
} else {
$href .= "&accno=$ref->{accno}&description=$description";
}
$ml = ($ref->{category} =~ /(A|E)/) ? -1 : 1;
$ml *= -1 if $ref->{contra};
$debit = $form->format_amount(\%myconfig, $ref->{debit}, $form->{precision}, " ");
$credit = $form->format_amount(\%myconfig, $ref->{credit}, $form->{precision}, " ");
$begbalance = $form->format_amount(\%myconfig, $ref->{balance} * $ml, $form->{precision}, " ");
$endbalance = $form->format_amount(\%myconfig, ($ref->{balance} + $ref->{amount}) * $ml, $form->{precision}, " ");
if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
if ($subtotal) {
for (qw(accno begbalance endbalance)) { $column_data{$_} = "<th> </th>" }
$subtotalbegbalance = $form->format_amount(\%myconfig, $subtotalbegbalance, $form->{precision}, " ");
$subtotalendbalance = $form->format_amount(\%myconfig, $subtotalendbalance, $form->{precision}, " ");
$subtotaldebit = $form->format_amount(\%myconfig, $subtotaldebit, $form->{precision}, " ");
$subtotalcredit = $form->format_amount(\%myconfig, $subtotalcredit, $form->{precision}, " ");
$column_data{description} = "<th class=listsubtotal>$subtotaldescription</th>";
$column_data{begbalance} = "<th align=right class=listsubtotal>$subtotalbegbalance</th>";
$column_data{endbalance} = "<th align=right class=listsubtotal>$subtotalendbalance</th>";
$column_data{debit} = "<th align=right class=listsubtotal>$subtotaldebit</th>";
$column_data{credit} = "<th align=right class=listsubtotal>$subtotalcredit</th>";
print qq|
<tr class=listsubtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
}
if ($ref->{charttype} eq "H") {
$subtotal = 1;
$subtotaldescription = $ref->{description};
$subtotaldebit = $ref->{debit};
$subtotalcredit = $ref->{credit};
$subtotalbegbalance = 0;
$subtotalendbalance = 0;
if ($form->{l_heading}) {
if (! $form->{all_accounts}) {
if (($subtotaldebit + $subtotalcredit) == 0) {
$subtotal = 0;
next;
}
}
} else {
$subtotal = 0;
if ($form->{all_accounts} || ($form->{l_subtotal} && (($subtotaldebit + $subtotalcredit) != 0))) {
$subtotal = 1;
}
next;
}
for (qw(accno debit credit begbalance endbalance)) { $column_data{$_} = "<th> </th>" }
$column_data{description} = "<th class=listheading>$ref->{description}</th>";
}
if ($ref->{charttype} eq "A") {
$column_data{accno} = "<td><a href=$href>$ref->{accno}</a></td>";
$column_data{description} = "<td>$ref->{description}</td>";
$column_data{debit} = "<td align=right>$debit</td>";
$column_data{credit} = "<td align=right>$credit</td>";
$column_data{begbalance} = "<td align=right>$begbalance</td>";
$column_data{endbalance} = "<td align=right>$endbalance</td>";
$totaldebit += $ref->{debit};
$totalcredit += $ref->{credit};
$cml = ($ref->{contra}) ? -1 : 1;
$subtotalbegbalance += $ref->{balance} * $ml * $cml;
$subtotalendbalance += ($ref->{balance} + $ref->{amount}) * $ml * $cml;
}
if ($ref->{charttype} eq "H") {
print qq|
<tr class=listheading>
|;
}
if ($ref->{charttype} eq "A") {
$i++; $i %= 2;
print qq|
<tr class=listrow$i>
|;
}
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
# print last subtotal
if ($subtotal && $form->{l_subtotal}) {
for (qw(accno begbalance endbalance)) { $column_data{$_} = "<th> </th>" }
$subtotalbegbalance = $form->format_amount(\%myconfig, $subtotalbegbalance, $form->{precision}, " ");
$subtotalendbalance = $form->format_amount(\%myconfig, $subtotalendbalance, $form->{precision}, " ");
$subtotaldebit = $form->format_amount(\%myconfig, $subtotaldebit, $form->{precision}, " ");
$subtotalcredit = $form->format_amount(\%myconfig, $subtotalcredit, $form->{precision}, " ");
$column_data{description} = "<th class=listsubtotal>$subtotaldescription</th>";
$column_data{begbalance} = "<th align=right class=listsubtotal>$subtotalbegbalance</th>";
$column_data{endbalance} = "<th align=right class=listsubtotal>$subtotalendbalance</th>";
$column_data{debit} = "<th align=right class=listsubtotal>$subtotaldebit</th>";
$column_data{credit} = "<th align=right class=listsubtotal>$subtotalcredit</th>";
print qq|
<tr class=listsubtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
$totaldebit = $form->format_amount(\%myconfig, $totaldebit, $form->{precision}, " ");
$totalcredit = $form->format_amount(\%myconfig, $totalcredit, $form->{precision}, " ");
for (qw(accno description begbalance endbalance)) { $column_data{$_} = "<th> </th>" }
$column_data{debit} = qq|<th align=right class=listtotal>$totaldebit</th>|;
$column_data{credit} = qq|<th align=right class=listtotal>$totalcredit</th>|;
print qq|
<tr class=listtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
</table>
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
</body>
</html>
|;
}
sub generate_ar_aging {
# split customer
($form->{customer}) = split(/--/, $form->{customer});
$customer = $form->escape($form->{customer},1);
$title = $form->escape($form->{title},1);
$media = $form->escape($form->{media},1);
$form->{vc} = "customer";
$form->{arap} = "ar";
RP->aging(\%myconfig, \%$form);
$form->{callback} = qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{login}&todate=$form->{todate}&customer=$customer&title=$title&type=$form->{type}&format=$form->{format}&media=$media&summary=$form->{summary}|;
&aging;
}
sub generate_ap_aging {
# split vendor
($form->{vendor}) = split(/--/, $form->{vendor});
$vendor = $form->escape($form->{vendor},1);
$title = $form->escape($form->{title},1);
$media = $form->escape($form->{media},1);
$form->{vc} = "vendor";
$form->{arap} = "ap";
RP->aging(\%myconfig, \%$form);
$form->{callback} = qq|$form->{script}?path=$form->{path}&action=generate_ap_aging&login=$form->{login}&todate=$form->{todate}&vendor=$vendor&title=$title&type=$form->{type}&format=$form->{format}&media=$media&summary=$form->{summary}|;
&aging;
}
sub aging {
$form->header;
$vcnumber = ($form->{vc} eq 'customer') ? $locale->text('Customer Number') : $locale->text('Vendor Number');
$form->{allbox} = ($form->{allbox}) ? "checked" : "";
$action = ($form->{deselect}) ? "deselect_all" : "select_all";
$column_header{statement} = qq|<th class=listheading width=1%><input name="allbox" type=checkbox class=checkbox value="1" $form->{allbox} onChange="CheckAll(); javascript:document.forms[0].submit()"><input type=hidden name=action value="$action"></th>|;
$column_header{vc} = qq|<th class=listheading width=60%>|.$locale->text(ucfirst $form->{vc}).qq|</th>|;
$column_header{"$form->{vc}number"} = qq|<th class=listheading>$vcnumber</th>|;
$column_header{language} = qq|<th class=listheading>|.$locale->text('Language').qq|</th>|;
$column_header{invnumber} = qq|<th class=listheading>|.$locale->text('Invoice').qq|</th>|;
$column_header{ordnumber} = qq|<th class=listheading>|.$locale->text('Order').qq|</th>|;
$column_header{transdate} = qq|<th class=listheading nowrap>|.$locale->text('Date').qq|</th>|;
$column_header{duedate} = qq|<th class=listheading nowrap>|.$locale->text('Due Date').qq|</th>|;
$column_header{c0} = qq|<th class=listheading width=10% nowrap>|.$locale->text('Current').qq|</th>|;
$column_header{c15} = qq|<th class=listheading width=10% nowrap>15</th>|;
$column_header{c30} = qq|<th class=listheading width=10% nowrap>30</th>|;
$column_header{c45} = qq|<th class=listheading width=10% nowrap>45</th>|;
$column_header{c60} = qq|<th class=listheading width=10% nowrap>60</th>|;
$column_header{c75} = qq|<th class=listheading width=10% nowrap>75</th>|;
$column_header{c90} = qq|<th class=listheading width=10% nowrap>90</th>|;
$column_header{total} = qq|<th class=listheading width=10% nowrap>|.$locale->text('Total').qq|</th>|;
@column_index = qw(statement vc);
push @column_index, "$form->{vc}number";
if (@{ $form->{all_language} } && $form->{arap} eq 'ar') {
push @column_index, "language";
$form->{selectlanguage} = qq|\n|;
for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|$_->{code}--$_->{description}\n| }
}
if (!$form->{summary}) {
push @column_index, qw(invnumber ordnumber transdate duedate);
}
@c = qw(c0 c15 c30 c45 c60 c75 c90);
for (@c) {
if ($form->{$_}) {
push @column_index, $_;
$form->{callback} .= "&$_=$form->{$_}";
}
}
push @column_index, "total";
$option = $locale->text('Aged');
if ($form->{overdue}) {
$option= $locale->text('Aged Overdue');
$form->{callback} .= "&overdue=$form->{overdue}";
}
if ($form->{department}) {
$option .= "\n<br>" if $option;
($department) = split /--/, $form->{department};
$option .= $locale->text('Department')." : $department";
$department = $form->escape($form->{department},1);
$form->{callback} .= "&department=$department";
}
if ($form->{arap} eq 'ar') {
if ($form->{customer}) {
$option .= "\n<br>" if $option;
$option .= $form->{customer};
}
}
if ($form->{arap} eq 'ap') {
shift @column_index;
if ($form->{vendor}) {
$option .= "\n<br>" if $option;
$option .= $form->{vendor};
}
}
$todate = $locale->date(\%myconfig, $form->{todate}, 1);
$option .= "\n<br>" if $option;
$option .= $locale->text('for Period')." ".$locale->text('To')." $todate";
$title = "$form->{title} / $form->{company}";
print qq|
<script language="JavaScript">
<!--
function CheckAll() {
var frm = document.forms[0]
var el = frm.elements
var re = /statement_/;
for (i = 0; i < el.length; i++) {
if (el[i].type == 'checkbox' && re.test(el[i].name)) {
el[i].checked = frm.allbox.checked
}
}
}
// -->
</script>
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr>
<th class=listtop>$title</th>
</tr>
<tr height="5"></tr>
<tr>
<td>$option</td>
</tr>
<tr>
<td>
<table width=100%>
|;
$vc_id = 0;
$i = 0;
$k = 0;
$l = $#{ $form->{AG} };
foreach $ref (@{ $form->{AG} }) {
if ($curr ne $ref->{curr}) {
$vc_id = 0;
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
if ($curr) {
for (@c) {
$column_data{$_} = qq|<th align=right>|.$form->format_amount(\%myconfig, $c{$_}{total}, $form->{precision}, " ").qq|</th>|;
$c{$_}{total} = 0;
$c{$_}{subtotal} = 0;
}
$column_data{total} = qq|<th align=right>|.$form->format_amount(\%myconfig, $total, $form->{precision}, " ").qq|</th>|;
for (qw(vc statement language)) { $column_data{$_} = qq|<td> </td>| }
print qq|
<tr class=listtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
$total = 0;
}
print qq|
<tr>
<td></td>
<th>$ref->{curr}</th>
</tr>
<tr class=listheading>
|;
for (@column_index) { print "$column_header{$_}\n" }
print qq|
</tr>
|;
}
$curr = $ref->{curr};
$k++;
if ($vc_id != $ref->{vc_id}) {
$i++;
$column_data{vc} = qq|<td><a href=ct.pl?path=$form->{path}&login=$form->{login}&action=edit&id=$ref->{vc_id}&db=$form->{vc}&callback=$callback>$ref->{name}</a></td>|;
$column_data{"$form->{vc}number"} = qq|<td>$ref->{"$form->{vc}number"}</td>|;
if ($form->{selectlanguage}) {
$column_data{language} = qq|<td><select name="language_code_$i">|.$form->select_option($form->{selectlanguage}, $form->{"language_code_$i"}, undef, 1).qq|</select></td>|;
}
$column_data{statement} = qq|<td><input name="statement_$i" type=checkbox class=checkbox value=1 $ref->{checked}>
<input type=hidden name="$form->{vc}_id_$i" value=$ref->{vc_id}>
<input type=hidden name="curr_$i" value="|.$form->quote($ref->{curr}).qq|">
</td>|;
$linetotal = 0;
}
$vc_id = $ref->{vc_id};
for (@c) {
$ref->{$_} = $form->round_amount($ref->{$_} / $ref->{exchangerate}, $form->{precision});
$c{$_}{total} += $ref->{$_};
$c{$_}{subtotal} += $ref->{$_};
$linetotal += $ref->{$_};
$total += $ref->{$_};
$column_data{$_} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{$_}, $form->{precision}, " ").qq|</td>|;
}
$column_data{total} = qq|<td align=right>|.$form->format_amount(\%myconfig, $linetotal, $form->{precision}, " ").qq|</td>|;
$href = qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&callback=|.$form->escape($form->{callback});
$column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
$column_data{ordnumber} = qq|<td>$ref->{ordnumber}</td>|;
for (qw(transdate duedate)) { $column_data{$_} = qq|<td nowrap>$ref->{$_}</td>| }
if (!$form->{summary}) {
$j++; $j %= 2;
print qq|
<tr class=listrow$j>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
for (qw(vc statement language)) { $column_data{$_} = qq|<td> </td>| }
}
# print subtotal
if ($l > 0) {
if ($k <= $l) {
$nextid = $form->{AG}->[$k]->{vc_id};
$nextcurr = $form->{AG}->[$k]->{curr};
} else {
$nextid = 0;
$nextcurr = "";
}
}
if ($vc_id != $nextid || $curr ne $nextcurr) {
for (@c) {
$c{$_}{subtotal} = $form->format_amount(\%myconfig, $c{$_}{subtotal}, $form->{precision}, " ");
}
if ($form->{summary}) {
for (@c) {
$column_data{$_} = qq|<td align=right>$c{$_}{subtotal}</th>|;
$c{$_}{subtotal} = 0;
}
$j++; $j %= 2;
print qq|
<tr class=listrow$j>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
} else {
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
for (@c) {
$column_data{$_} = qq|<th class=listsubtotal align=right>$c{$_}{subtotal}</th>|;
$c{$_}{subtotal} = 0;
}
# print subtotals
print qq|
<tr class=listsubtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
}
}
print qq|
</tr>
<tr class=listtotal>
|;
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
for (@c) {
$column_data{$_} = qq|<th align=right class=listtotal>|.$form->format_amount(\%myconfig, $c{$_}{total}, $form->{precision}, " ").qq|</th>|;
}
$column_data{total} = qq|<th align=right class=listtotal>|.$form->format_amount(\%myconfig, $total, $form->{precision}, " ").qq|</th>|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
<input type=hidden name=rowcount value=$i>
</table>
</td>
</tr>
<tr>
<td>
|;
&print_options if ($form->{arap} eq 'ar');
print qq|
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
|;
if ($form->{arap} eq 'ar') {
$form->hide_form(qw(todate title summary overdue callback arap vc department path login type report));
$form->hide_form(@c, "$form->{vc}");
%button = ('Select all' => { ndx => 1, key => 'A', value => $locale->text('Select all') },
'Deselect all' => { ndx => 2, key => 'A', value => $locale->text('Deselect all') },
'Print' => { ndx => 3, key => 'P', value => $locale->text('Print') },
'E-mail' => { ndx => 5, key => 'E', value => $locale->text('E-mail') },
);
if ($form->{deselect}) {
delete $button{'Select all'};
} else {
delete $button{'Deselect all'};
}
for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
}
if ($form->{menubar}) {
require "$form->{path}/menu.pl";
&menubar;
}
print qq|
</form>
</body>
</html>
|;
}
sub select_all { &{ "select_all_$form->{type}" } }
sub select_all_statement {
RP->aging(\%myconfig, \%$form);
for (@{ $form->{AG} }) { $_->{checked} = "checked" }
$form->{allbox} = "checked";
$form->{deselect} = 1;
&aging;
}
sub select_all_reminder {
RP->reminder(\%myconfig, \%$form);
for (@{ $form->{AG} }) { $form->{"ndx_$_->{id}"} = "checked" }
$form->{allbox} = "checked";
$form->{deselect} = 1;
&reminder;
}
sub deselect_all { &{ "deselect_all_$form->{type}" } }
sub deselect_all_statement {
RP->aging(\%myconfig, \%$form);
for (@{ $form->{AG} }) { $_->{checked} = "" }
$form->{allbox} = "";
&aging;
}
sub deselect_all_reminder {
RP->reminder(\%myconfig, \%$form);
for (@{ $form->{AG} }) { $_->{checked} = "" }
$form->{allbox} = "";
&reminder;
}
sub generate_reminder {
# split customer
($form->{customer}) = split(/--/, $form->{customer});
$form->{vc} = "customer";
$form->{arap} = "ar";
$form->{initcallback} = qq|$form->{script}?action=generate_reminder|;
RP->reminder(\%myconfig, \%$form);
&reminder;
}
sub reminder {
$form->{callback} = $form->{initcallback};
for (qw(path login type format)) { $form->{callback} .= "&$_=$form->{$_}" }
for (qw(title media report)) { $form->{callback} .= qq|&$_=|.$form->escape($form->{$_},1) }
$form->{callback} .= qq|&$form->{vc}=|.$form->escape($form->{"$form->{vc}"},1);
$vcnumber = $locale->text('Customer Number');
$form->{allbox} = ($form->{allbox}) ? "checked" : "";
$action = ($form->{deselect}) ? "deselect_all" : "select_all";
$column_header{ndx} = qq|<th class=listheading width=1%><input name="allbox" type=checkbox class=checkbox value="1" $form->{allbox} onChange="CheckAll(); javascript:document.forms[0].submit()"><input type=hidden name=action value="$action"></th>|;
$column_header{vc} = qq|<th class=listheading width=60%>|.$locale->text(ucfirst $form->{vc}).qq|</th>|;
$column_header{"$form->{vc}number"} = qq|<th class=listheading>$vcnumber</th>|;
$column_header{level} = qq|<th class=listheading>|.$locale->text('Level').qq|</th>|;
$column_header{language} = qq|<th class=listheading>|.$locale->text('Language').qq|</th>|;
$column_header{invnumber} = qq|<th class=listheading>|.$locale->text('Invoice').qq|</th>|;
$column_header{ordnumber} = qq|<th class=listheading>|.$locale->text('Order').qq|</th>|;
$column_header{transdate} = qq|<th class=listheading nowrap>|.$locale->text('Date').qq|</th>|;
$column_header{duedate} = qq|<th class=listheading nowrap>|.$locale->text('Due Date').qq|</th>|;
$column_header{due} = qq|<th class=listheading nowrap>|.$locale->text('Due').qq|</th>|;
@column_index = qw(ndx vc);
push @column_index, "$form->{vc}number";
push @column_index, "level";
$form->{selectlevel} = "\n1\n2\n3";
if (@{ $form->{all_language} }) {
push @column_index, "language";
$form->{selectlanguage} = qq|\n|;
$form->{language_code} ||= "";
for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|$_->{code}--$_->{description}\n| }
}
push @column_index, qw(invnumber ordnumber transdate duedate due);
if ($form->{department}) {
$option .= "\n<br>" if $option;
($department) = split /--/, $form->{department};
$option .= $locale->text('Department')." : $department";
$department = $form->escape($form->{department},1);
$form->{callback} .= "&department=$department";
}
if ($form->{customer}) {
$option .= "\n<br>" if $option;
$option .= $form->{customer};
}
$title = "$form->{title} / $form->{company}";
$form->header;
print qq|
<script language="JavaScript">
<!--
function CheckAll() {
var frm = document.forms[0]
var el = frm.elements
var re = /statement_/;
for (i = 0; i < el.length; i++) {
if (el[i].type == 'checkbox' && re.test(el[i].name)) {
el[i].checked = frm.allbox.checked
}
}
}
// -->
</script>
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr>
<th class=listtop>$title</th>
</tr>
<tr height="5"></tr>
<tr>
<td>$option</td>
</tr>
<tr>
<td>
<table width=100%>
|;
$curr = "";
$form->{ids} = "";
$callback = $form->escape($form->{callback},1);
for $ref (@{ $form->{AG} }) {
if ($curr ne $ref->{curr}) {
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
if ($curr) {
print qq|
<tr class=listtotal>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
print qq|
<tr>
<td></td>
<th>$ref->{curr}</th>
</tr>
<tr class=listheading>
|;
for (@column_index) { print "$column_header{$_}\n" }
print qq|
</tr>
|;
}
$curr = $ref->{curr};
$column_data{vc} = qq|<td><a href=ct.pl?path=$form->{path}&login=$form->{login}&action=edit&id=$ref->{vc_id}&db=$form->{vc}&callback=$callback>$ref->{name}</a></td>
<input type=hidden name="vc_$ref->{id}" value="$ref->{vc_id}">|;
$column_data{"$form->{vc}number"} = qq|<td>$ref->{"$form->{vc}number"}</td>|;
if (exists $form->{"level_$ref->{id}"}) {
$ref->{level} = $form->{"level_$ref->{id}"};
}
$column_data{level} = qq|<td><select name="level_$ref->{id}">|.$form->select_option($form->{selectlevel}, $ref->{level}).qq|</select></td>|;
if ($form->{selectlanguage}) {
if (exists $form->{"language_code_$ref->{id}"}) {
$ref->{language_code} = $form->{"language_code_$ref->{id}"};
}
$column_data{language} = qq|<td><select name="language_code_$ref->{id}">|.$form->select_option($form->{selectlanguage}, $ref->{language_code}, undef, 1).qq|</select></td>|;
}
$checked = ($form->{"ndx_$ref->{id}"}) ? "checked" : "";
$column_data{ndx} = qq|<td><input name="ndx_$ref->{id}" type=checkbox class=checkbox value=1 $checked></td>|;
$form->{ids} .= "$ref->{id} ";
$href = qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&callback=|.$form->escape($form->{callback});
$column_data{invnumber} = qq|<td><a href=$href>$ref->{invnumber}</a></td>|;
$column_data{ordnumber} = qq|<td>$ref->{ordnumber}</td>|;
for (qw(transdate duedate)) { $column_data{$_} = qq|<td nowrap>$ref->{$_}</td>| }
$column_data{due} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{due} / $ref->{exchangerate}, $form->{precision}).qq|</td>|;
$j++; $j %= 2;
print qq|
<tr class=listrow$j>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
for (qw(vc ndx language level)) { $column_data{$_} = qq|<td> </td>| }
$column_data{"$form->{vc}number"} = qq|<td> </td>|;
}
print qq|
</tr>
<tr class=listtotal>
|;
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
</table>
</td>
</tr>
<tr>
<td>
|;
&print_options;
print qq|
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
|;
chop $form->{ids};
$form->hide_form(qw(title initcallback callback vc department path login ids));
$form->hide_form($form->{vc});
$form->hide_form(qw(type report));
%button = ('Select all' => { ndx => 1, key => 'A', value => $locale->text('Select all') },
'Deselect all' => { ndx => 2, key => 'A', value => $locale->text('Deselect all') },
'Preview' => { ndx => 3, key => 'V', value => $locale->text('Preview') },
'Print' => { ndx => 4, key => 'P', value => $locale->text('Print') },
'E-mail' => { ndx => 5, key => 'E', value => $locale->text('E-mail') },
'Save Level' => { ndx => 6, key => 'L', value => $locale->text('Save Level') },
);
if ($form->{deselect}) {
delete $button{'Select all'};
} else {
delete $button{'Deselect all'};
}
for (sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button) { $form->print_button(\%button, $_) }
if ($form->{menubar}) {
require "$form->{path}/menu.pl";
&menubar;
}
print qq|
</form>
</body>
</html>
|;
}
sub save_level {
if (RP->save_level(\%myconfig, \%$form)) {
$form->redirect;
}
$form->error($locale->text('Could not save reminder level!'));
}
sub print_options {
$form->{copies} ||= 1;
$form->{PD}{$form->{type}} = "selected";
if ($myconfig{printer}) {
$form->{format} ||= "postscript";
} else {
$form->{format} ||= "pdf";
}
$form->{media} ||= $myconfig{printer};
$form->{sendmode} = "attachment";
$form->{format} = "pdf" if ($latex && $form->{media} eq 'email');
if ($form->{media} eq 'email') {
$media = qq|<select name=sendmode>
<option value=attachment>|.$locale->text('Attachment').qq|
<option value=inline>|.$locale->text('In-line')
.qq|</select>|;
if ($form->{selectlanguage}) {
$lang = qq|<select name="language_code_1">|.$form->select_option($form->{selectlanguage}, $form->{language_code_1}, undef, 1).qq|</select>|;
}
} else {
$media = qq|<select name=media>
<option value=screen>|.$locale->text('Screen');
if (%printer && $latex) {
for (sort keys %printer) { $media .= qq|
<option value="$_">$_| }
}
}
$format = qq|<select name=format>
<option value="html">html|;
$formname{statement} = $locale->text('Statement');
$formname{reminder} = $locale->text('Reminder');
$type = qq|<select name=type>
<option value="$form->{type}" $form->{PD}{$form->{type}}>$formname{$form->{type}}
</select>|;
$media .= qq|</select>|;
$media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
if ($latex) {
$format .= qq|
<option value="postscript">|.$locale->text('Postscript').qq|
<option value="pdf">|.$locale->text('PDF');
}
$format .= qq|</select>|;
$format =~ s/(<option value="\Q$form->{format}\E")/$1 selected/;
print qq|
<table>
<tr>
<td>$type</td>
<td>$lang</td>
<td>$format</td>
<td>$media</td>
|;
if (%printer && $latex && $form->{media} ne 'email') {
print qq|
<td nowrap>|.$locale->text('Copies').qq|
<input name=copies size=2 value=$form->{copies}></td>
|;
}
$form->{selectlanguage} = $form->escape($form->{selectlanguage},1);
$form->hide_form(qw(selectlanguage));
print qq|
</tr>
</table>
|;
}
sub e_mail {
# get name and email addresses
for $i (1 .. $form->{rowcount}) {
if ($form->{"statement_$i"}) {
$form->{"$form->{vc}_id"} = $form->{"$form->{vc}_id_$i"};
$form->{"statement_1"} = 1;
$form->{"language_code_1"} = $form->{"language_code_$i"};
$form->{"curr_1"} = $form->{"curr_$i"};
RP->get_customer(\%myconfig, \%$form);
$selected = 1;
last;
}
}
$form->error($locale->text('Nothing selected!')) unless $selected;
if ($myconfig{role} =~ /(admin|manager)/) {
$bcc = qq|
<th align=right nowrap=true>|.$locale->text('Bcc').qq|</th>
<td><input name=bcc size=30 value="$form->{bcc}"></td>
|;
}
$title = $locale->text('E-mail Statement to')." $form->{$form->{vc}}";
$form->{media} = "email";
$form->header;
print qq|
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr class=listtop>
<th>$title</th>
</tr>
<tr height="5"></tr>
<tr>
<td>
<table width=100%>
<tr>
<th align=right nowrap>|.$locale->text('E-mail').qq|</th>
<td><input name=email size=30 value="$form->{email}"></td>
<th align=right nowrap>|.$locale->text('Cc').qq|</th>
<td><input name=cc size=30 value="$form->{cc}"></td>
</tr>
<tr>
<th align=right nowrap>|.$locale->text('Subject').qq|</th>
<td><input name=subject size=30 value="|.$form->quote($form->{subject}).qq|"></td>
$bcc
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width=100%>
<tr>
<th align=left nowrap>|.$locale->text('Message').qq|</th>
</tr>
<tr>
<td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
|;
&print_options;
for (qw(email cc bcc subject message type sendmode format action nextsub)) { delete $form->{$_} }
$form->hide_form;
print qq|
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
<input type=hidden name=nextsub value=send_email>
<br>
<input name=action class=submit type=submit value="|.$locale->text('Continue').qq|">
</form>
</body>
</html>
|;
}
sub send_email {
$form->{OUT} = "$sendmail";
$form->isblank("email", $locale->text('E-mail address missing!'));
RP->aging(\%myconfig, \%$form);
$form->{subject} = $locale->text('Statement').qq| - $form->{todate}| unless $form->{subject};
&print_form;
$form->redirect($locale->text('Statement sent to')." $form->{$form->{vc}}");
}
sub print { &{ "print_$form->{type}" } }
sub print_statement {
if ($form->{media} !~ /(screen|email)/) {
$form->error($locale->text('Select postscript or PDF!')) if ($form->{format} !~ /(postscript|pdf)/);
}
for $i (1 .. $form->{rowcount}) {
if ($form->{"statement_$i"}) {
$form->{"$form->{vc}_id"} = $form->{"$form->{vc}_id_$i"};
$language_code = $form->{"language_code_$i"};
$curr = $form->{"curr_$i"};
$selected = 1;
last;
}
}
$form->error($locale->text('Nothing selected!')) unless $selected;
if ($form->{media} !~ /(screen|email)/) {
$form->{OUT} = "| $printer{$form->{media}}";
$form->{"$form->{vc}_id"} = "";
$SIG{INT} = 'IGNORE';
} else {
$form->{"statement_1"} = 1;
$form->{"language_code_1"} = $language_code;
$form->{"curr_1"} = $curr;
}
RP->aging(\%myconfig, \%$form);
@c = qw(c0 c15 c30 c45 c60 c75 c90);
$item = $c[0];
@{$ag} = ();
for (@c) {
if ($form->{$_}) {
$item = $_;
}
push @{ $ag{$item} }, $_;
}
for (keys %ag) {
shift @{ $ag{$_} };
}
for (keys %ag) {
for $item (@{ $ag{$_} }) {
$c{$_} += $c{$item};
}
}
for (@c) {
# $column_data{$_} = qq|<th align=right>|.$form->format_amount(\%myconfig, $c{$_}{total}, $form->{precision}, " ").qq|</th>|;
}
&print_form;
$form->redirect($locale->text('Statements sent to printer!')) if ($form->{media} !~ /(screen|email)/);
}
sub print_reminder {
@ids = split / /, $form->{ids};
for (@ids) {
if ($form->{"ndx_$_"}) {
$selected = "ndx_$_";
last;
}
}
$form->error($locale->text('Nothing selected!')) unless $selected;
if ($form->{media} eq 'screen') {
for (@ids) {
$form->{"ndx_$_"} = "";
}
$form->{$selected} = 1;
}
if ($form->{media} !~ /(screen|email)/) {
$form->{"$form->{vc}_id"} = "";
$SIG{INT} = 'IGNORE';
}
RP->reminder(\%myconfig, \%$form);
if ($form->{media} !~ /(screen|email)/) {
$form->{OUT} = qq~| $form->{"$form->{media}_printer"}~;
}
&do_print_reminder;
if ($form->{callback}) {
for (split / /, $form->{ids}) {
if ($form->{"ndx_$_"}) {
$form->{callback} .= qq|&ndx_$_=1&level_$_=$form->{"level_$_"}&language_code_$_=|.$form->escape($form->{"language_code_$_"},1);
}
}
}
$form->redirect($locale->text('Reminders sent to printer!')) if ($form->{media} !~ /(screen|email)/);
}
sub do_print_reminder {
$out = $form->{OUT};
$form->{todate} ||= $form->current_date(\%myconfig);
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
$form->{templates} = "$myconfig{templates}";
for (qw(name email)) { $form->{"user$_"} = $myconfig{$_} }
# setup variables for the form
$form->format_string(qw(company address businessnumber username useremail tel fax));
@a = qw(name address1 address2 city state zipcode country contact typeofcontact salutation firstname lastname);
push @a, "$form->{vc}number", "$form->{vc}phone", "$form->{vc}fax", "$form->{vc}taxnumber";
push @a, 'email' if ! $form->{media} eq 'email';
push @a, map { "shipto$_" } qw(name address1 address2 city state zipcode country contact phone fax email);
while (@{ $form->{AG} }) {
$ref = shift @{ $form->{AG} };
$form->{OUT} = $out;
if ($form->{"ndx_$ref->{id}"}) {
for (@a) { $form->{$_} = $ref->{$_} }
$form->format_string(@a);
$form->{IN} = qq|$form->{type}$form->{"level_$ref->{id}"}.html|;
if ($form->{format} =~ /(ps|pdf)/) {
$form->{IN} =~ s/html$/tex/;
}
$form->{$form->{vc}} = $form->{name};
$form->{"$form->{vc}_id"} = $ref->{vc_id};
$form->{language_code} = $form->{"language_code_$ref->{id}"};
$form->{currency} = $ref->{curr};
for (qw(invnumber ordnumber ponumber notes invdate duedate invdescription)) { $form->{$_} = () }
$ref->{invdate} = $ref->{transdate};
my @a = qw(invnumber ordnumber ponumber notes invdate duedate invdescription);
for (@a) { $form->{"${_}_1"} = $ref->{$_} }
$form->format_string(map { "${_}_1" } qw(invnumber ordnumber ponumber notes invdescription));
for (@a) { $form->{$_} = $form->{"${_}_1"} }
$ref->{exchangerate} ||= 1;
$form->{due} = $form->format_amount(\%myconfig, $ref->{due} / $ref->{exchangerate}, $form->{precision});
$form->parse_template(\%myconfig, $userspath);
}
}
}
sub print_form {
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
$form->{templates} = "$myconfig{templates}";
for (qw(name email)) { $form->{"user$_"} = $myconfig{$_} }
# setup variables for the form
$form->format_string(qw(company address businessnumber username useremail tel fax));
$form->{IN} = "$form->{type}.html";
if ($form->{format} =~ /(postscript|pdf)/) {
$form->{IN} =~ s/html$/tex/;
}
@a = qw(name address1 address2 city state zipcode country contact typeofcontact salutation firstname lastname);
push @a, "$form->{vc}number", "$form->{vc}phone", "$form->{vc}fax", "$form->{vc}taxnumber";
push @a, 'email' if ! $form->{media} eq 'email';
push @a, map { "shipto$_" } qw(name address1 address2 city state zipcode country contact phone fax email);
$i = 0;
while (@{ $form->{AG} }) {
$ref = shift @{ $form->{AG} };
if ($vc_id != $ref->{vc_id}) {
$vc_id = $ref->{vc_id};
$i++;
if ($form->{"statement_$i"}) {
for (@a) { $form->{$_} = $ref->{$_} }
$form->format_string(@a);
$form->{$form->{vc}} = $form->{name};
$form->{"$form->{vc}_id"} = $ref->{vc_id};
$form->{language_code} = $form->{"language_code_$i"};
$form->{currency} = $form->{"curr_$i"};
for (qw(invnumber ordnumber ponumber notes invdate duedate invdescription)) { $form->{$_} = () }
$form->{total} = 0;
foreach $item (qw(c0 c15 c30 c45 c60 c75 c90)) {
$form->{$item} = ();
$form->{"${item}total"} = 0;
}
&statement_details($ref) if $ref->{curr} eq $form->{currency};
while ($ref) {
if (scalar (@{ $form->{AG} }) > 0) {
# one or more left to go
if ($vc_id == $form->{AG}->[0]->{vc_id}) {
$ref = shift @{ $form->{AG} };
&statement_details($ref) if $ref->{curr} eq $form->{currency};
# any more?
$ref = scalar (@{ $form->{AG} });
} else {
$ref = 0;
}
} else {
# set initial ref to 0
$ref = 0;
}
}
for ("c0", "c15", "c30", "c45", "c60", "c75", "c90", "") { $form->{"${_}total"} = $form->format_amount(\%myconfig, $form->{"${_}total"}, $form->{precision}) }
$form->parse_template(\%myconfig, $userspath);
}
}
}
}
sub statement_details {
my ($ref) = @_;
$ref->{invdate} = $ref->{transdate};
my @a = qw(invnumber ordnumber ponumber notes invdate duedate invdescription);
for (@a) { $form->{"${_}_1"} = $ref->{$_} }
$form->format_string(qw(invnumber_1 ordnumber_1 ponumber_1 notes_1 invdescription_1));
for (@a) { push @{ $form->{$_} }, $form->{"${_}_1"} }
foreach $item (qw(c0 c15 c30 c45 c60 c75 c90)) {
eval { $ref->{$item} = $form->round_amount($ref->{$item} / $ref->{exchangerate}, $form->{precision}) };
$form->{"${item}total"} += $ref->{$item};
$form->{total} += $ref->{$item};
push @{ $form->{$item} }, $form->format_amount(\%myconfig, $ref->{$item}, $form->{precision});
}
}
sub generate_tax_report {
RP->tax_report(\%myconfig, \%$form);
$descvar = "$form->{accno}_description";
$description = $form->escape($form->{$descvar});
if ($form->{accno} =~ /^gifi_/) {
$descvar = "gifi_$form->{accno}_description";
$description = $form->escape($form->{$descvar});
}
$department = $form->escape($form->{department});
# construct href
$href = "$form->{script}?path=$form->{path}&direction=$form->{direction}&oldsort=$form->{oldsort}&action=generate_tax_report&login=$form->{login}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&summary=$form->{summary}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
# construct callback
$description = $form->escape($form->{$descvar},1);
$department = $form->escape($form->{department},1);
$form->sort_order();
$callback = "$form->{script}?path=$form->{path}&direction=$form->{direction}&oldsort=$form->{oldsort}&action=generate_tax_report&login=$form->{login}&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&summary=$form->{summary}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
$form->{title} = $locale->text('GIFI')." - " if ($form->{accno} =~ /^gifi_/);
$title = $form->escape($form->{title});
$href .= "&title=$title";
$title = $form->escape($form->{title},1);
$callback .= "&title=$title";
$form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} / $form->{company}|;
if ($form->{db} eq 'ar') {
$name = $locale->text('Customer');
$vcnumber = $locale->text('Customer Number');
$invoice = 'is.pl';
$arap = 'ar.pl';
$form->{vc} = "customer";
}
if ($form->{db} eq 'ap') {
$name = $locale->text('Vendor');
$vcnumber = $locale->text('Vendor Number');
$invoice = 'ir.pl';
$arap = 'ap.pl';
$form->{vc} = "vendor";
}
@columns = qw(id transdate invnumber description name);
push @columns, "$form->{vc}number";
push @columns, qw(netamount tax);
@columns = $form->sort_columns(@columns);
foreach $item (@columns) {
if ($form->{"l_$item"} eq "Y") {
push @column_index, $item;
# add column to href and callback
$callback .= "&l_$item=Y";
$href .= "&l_$item=Y";
}
}
if ($form->{l_subtotal} eq 'Y') {
$callback .= "&l_subtotal=Y";
$href .= "&l_subtotal=Y";
}
if ($form->{department}) {
($department) = split /--/, $form->{department};
$option = $locale->text('Department')." : $department";
}
# if there are any dates
if ($form->{fromdate} || $form->{todate}) {
if ($form->{fromdate}) {
$fromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
}
if ($form->{todate}) {
$todate = $locale->date(\%myconfig, $form->{todate}, 1);
}
$form->{period} = "$fromdate - $todate";
} else {
$form->{period} = $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
}
$option .= "<br>" if $option;
$option .= $locale->text('Cash') if ($form->{method} eq 'cash');
$option .= $locale->text('Accrual') if ($form->{method} eq 'accrual');
$option .= "<br>$form->{period}";
$column_header{id} = qq|<th><a class=listheading href=$href&sort=id>|.$locale->text('ID').qq|</th>|;
$column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>|.$locale->text('Invoice').qq|</th>|;
$column_header{transdate} = qq|<th nowrap><a class=listheading href=$href&sort=transdate>|.$locale->text('Date').qq|</th>|;
$column_header{netamount} = qq|<th class=listheading>|.$locale->text('Amount').qq|</th>|;
$column_header{tax} = qq|<th class=listheading>|.$locale->text('Tax').qq|</th>|;
$column_header{name} = qq|<th><a class=listheading href=$href&sort=name>$name</th>|;
$column_header{"$form->{vc}number"} = qq|<th><a class=listheading href=$href&sort=$form->{vc}number>$vcnumber</th>|;
$column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</th>|;
$form->header;
print qq|
<body>
<table width=100%>
<tr>
<th class=listtop colspan=$colspan>$form->{title}</th>
</tr>
<tr height="5"></tr>
<tr>
<td>$option</td>
</tr>
<tr>
<td>
<table width=100%>
<tr class=listheading>
|;
for (@column_index) { print "$column_header{$_}\n" }
print qq|
</tr>
|;
# add sort and escape callback
$callback = $form->escape($callback . "&sort=$form->{sort}");
if (@{ $form->{TR} }) {
$sameitem = $form->{TR}->[0]->{$form->{sort}};
}
foreach $ref (@{ $form->{TR} }) {
$module = ($ref->{invoice}) ? $invoice : $arap;
$module = 'ps.pl' if $ref->{till};
if ($form->{l_subtotal} eq 'Y') {
if ($sameitem ne $ref->{$form->{sort}}) {
&tax_subtotal;
$sameitem = $ref->{$form->{sort}};
}
}
$totalnetamount += $ref->{netamount};
$totaltax += $ref->{tax};
$subtotalnetamount += $ref->{netamount};
$subtotaltax += $ref->{tax};
for (qw(netamount tax)) { $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, $form->{precision}, " "); }
$column_data{id} = qq|<td>$ref->{id}</td>|;
$column_data{invnumber} = qq|<td><a href=$module?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{login}&callback=$callback>$ref->{invnumber}</a></td>|;
$column_data{transdate} = qq|<td nowrap>$ref->{transdate}</td>|;
for (qw(id partnumber description)) { $column_data{$_} = qq|<td>$ref->{$_}</td>| }
$column_data{"$form->{vc}number"} = qq|<td>$ref->{"$form->{vc}number"}</td>|;
$column_data{name} = qq|<td><a href=ct.pl?path=$form->{path}&login=$form->{login}&action=edit&id=$ref->{vc_id}&db=$form->{vc}&callback=$callback>$ref->{name}</a></td>|;
for (qw(netamount tax)) { $column_data{$_} = qq|<td align=right>$ref->{$_}</td>| }
$i++; $i %= 2;
print qq|
<tr class=listrow$i>
|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
|;
}
if ($form->{l_subtotal} eq 'Y') {
&tax_subtotal;
}
for (@column_index) { $column_data{$_} = qq|<th> </th>| }
print qq|
</tr>
<tr class=listtotal>
|;
$totalnetamount = $form->format_amount(\%myconfig, $totalnetamount, $form->{precision}, " ");
$totaltax = $form->format_amount(\%myconfig, $totaltax, $form->{precision}, " ");
$column_data{netamount} = qq|<th class=listtotal align=right>$totalnetamount</th>|;
$column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
for (@column_index) { print "$column_data{$_}\n" }
print qq|
</tr>
</table>
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
</body>
</html>
|;
}
sub tax_subtotal {
for (@column_index) { $column_data{$_} = "<td> </td>" }
$subtotalnetamount = $form->format_amount(\%myconfig, $subtotalnetamount, $form->{precision}, " ");
$subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, $form->{precision}, " ");
$column_data{netamount} = "<th class=listsubtotal align=right>$subtotalnetamount</th>";
$column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
$subtotalnetamount = 0;
$subtotaltax = 0;
print qq|
<tr class=listsubtotal>
|;
for (@column_index) { print "\n$column_data{$_}" }
print qq|
</tr>
|;
}
sub list_payments {
if ($form->{account}) {
($form->{paymentaccounts}) = split /--/, $form->{account};
}
if ($form->{department}) {
($department, $form->{department_id}) = split /--/, $form->{department};
$option = $locale->text('Department')." : $department";
}
RP->payments(\%myconfig, \%$form);
@columns = (qw(transdate reference description name));
@columns = $form->sort_columns(@columns);
push @columns, "$form->{vc}number";
push @columns, (qw(paid source memo));
if ($form->{till}) {
@columns = (qw(transdate reference name));
@columns = $form->sort_columns(@columns);
push @columns, "$form->{vc}number";
push @columns, (qw(description paid curr source till));
if ($myconfig{role} ne 'user') {
push @columns, "employee";
}
}
# construct href
$form->{paymentaccounts} =~ s/ /%20/g;
$href = "$form->{script}?action=list_payments";
@a = (qw(path direction sort oldsort till login fromdate todate fx_transaction db l_subtotal prepayment paymentaccounts vc db));
for (@a) { $href .= "&$_=$form->{$_}" }
$href .= "&title=".$form->escape($form->{title});
$form->sort_order();
$callback = "$form->{script}?action=list_payments";
for (@a) { $callback .= "&$_=$form->{$_}" }
$callback .= "&title=".$form->escape($form->{title},1);
if ($form->{account}) {
$callback .= "&account=".$form->escape($form->{account},1);
$href .= "&account=".$form->escape($form->{account});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Account')." : $form->{account}";
}
if ($form->{department}) {
$callback .= "&department=".$form->escape($form->{department},1);
$href .= "&department=".$form->escape($form->{department});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Department')." : $form->{department}";
}
%vc = ( customer => { name => 'Customer', 'number' => 'Customer Number' },
vendor => { name => 'Vendor', 'number' => 'Vendor Number' }
);
if ($form->{$form->{vc}}) {
$callback .= "&$form->{vc}=".$form->escape($form->{$form->{vc}},1);
$href .= "&$form->{vc}=".$form->escape($form->{$form->{vc}});
$option .= "\n<br>" if ($option);
$option .= $locale->text($vc{$form->{vc}}{name})." : $form->{$form->{vc}}";
}
if ($form->{"$form->{vc}number"}) {
$callback .= qq|&$form->{vc}number=|.$form->escape($form->{"$form->{vc}number"},1);
$href .= qq|&$form->{vc}number=|.$form->escape($form->{"$form->{vc}number"});
$option .= "\n<br>" if ($option);
$option .= $locale->text($vc{$form->{vc}}{number}).qq| : $form->{"$form->{vc}number"}|;
}
if ($form->{reference}) {
$callback .= "&reference=".$form->escape($form->{reference},1);
$href .= "&reference=".$form->escape($form->{reference});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Reference')." : $form->{reference}";
}
if ($form->{description}) {
$callback .= "&description=".$form->escape($form->{description},1);
$href .= "&description=".$form->escape($form->{description});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Description')." : $form->{description}";
}
if ($form->{source}) {
$callback .= "&source=".$form->escape($form->{source},1);
$href .= "&source=".$form->escape($form->{source});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Source')." : $form->{source}";
}
if ($form->{memo}) {
$callback .= "&memo=".$form->escape($form->{memo},1);
$href .= "&memo=".$form->escape($form->{memo});
$option .= "\n<br>" if ($option);
$option .= $locale->text('Memo')." : $form->{memo}";
}
if ($form->{fromdate}) {
$callback .= "&fromdate=$form->{fromdate}";
$href .= "&fromdate=$form->{fromdate}";
$option .= "\n<br>" if ($option);
$option .= $locale->text('From')." ".$locale->date(\%myconfig, $form->{fromdate}, 1);
}
if ($form->{todate}) {
$callback .= "&todate=$form->{todate}";
$href .= "&todate=$form->{todate}";
$option .= "\n<br>" if ($option);
$option .= $locale->text('To')." ".$locale->date(\%myconfig, $form->{todate}, 1);
}
@column_index = ();
for (@columns) {
if ($form->{"l_$_"} eq 'Y') {
push @column_index, $_;
$callback .= "&l_$_=Y";
$href .= "&l_$_=Y";
}
}
$colspan = $#column_index + 1;
$form->{callback} = $callback;
$callback = $form->escape($form->{callback});
$column_header{name} = "<th><a class=listheading href=$href&sort=name>".$locale->text($vc{$form->{vc}}{name})."</a></th>";
$column_header{"$form->{vc}number"} = "<th><a class=listheading href=$href&sort=$form->{vc}number>".$locale->text($vc{$form->{vc}}{number})."</a></th>";
$column_header{reference} = "<th><a class=listheading href=$href&sort=reference>".$locale->text('Reference')."</a></th>";
$column_header{description} = "<th><a class=listheading href=$href&sort=description>".$locale->text('Description')."</a></th>";
$column_header{transdate} = "<th nowrap><a class=listheading href=$href&sort=transdate>".$locale->text('Date')."</a></th>";
$column_header{paid} = "<th class=listheading>".$locale->text('Amount')."</a></th>";
$column_header{curr} = "<th class=listheading>".$locale->text('Curr')."</a></th>";
$column_header{source} = "<th><a class=listheading href=$href&sort=source>".$locale->text('Source')."</a></th>";
$column_header{memo} = "<th><a class=listheading href=$href&sort=memo>".$locale->text('Memo')."</a></th>";
$employee = ($form->{db} eq 'ar') ? $locale->text('Salesperson') : $locale->text('Employee');
$column_header{employee} = "<th><a class=listheading href=$href&sort=employee>$employee</a></th>";
$column_header{till} = "<th><a class=listheading href=$href&sort=till>".$locale->text('Till')."</a></th>";
$title = "$form->{title} / $form->{company}";
$form->header;
print qq|
<body>
<table width=100%>
<tr>
<th class=listtop>$title</th>
</tr>
<tr height="5"></tr>
<tr>
<td>$option</td>
</tr>
<tr>
<td>
<table width=100%>
<tr class=listheading>
|;
for (@column_index) { print "\n$column_header{$_}" }
print qq|
</tr>
|;
$isir = ($form->{db} eq 'ar') ? 'is' : 'ir';
foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) {
next unless @{ $form->{$ref->{id}} };
print qq|
<tr>
<th colspan=$colspan align=left>$ref->{accno}--$ref->{description}</th>
</tr>
|;
if (@{ $form->{$ref->{id}} }) {
$sameitem = $form->{$ref->{id}}[0]->{$form->{sort}};
}
foreach $payment (@{ $form->{$ref->{id}} }) {
if ($form->{l_subtotal}) {
if ($payment->{$form->{sort}} ne $sameitem) {
# print subtotal
&payment_subtotal;
}
}
next if ($form->{till} && ! $payment->{till});
$href = ($payment->{vcid}) ? "<a href=ct.pl?action=edit&id=$payment->{vcid}&db=$form->{vc}&login=$form->{login}&path=$form->{path}&callback=$callback>" : "";
$column_data{name} = "<td>$href$payment->{name}</a> </td>";
$column_data{"$form->{vc}number"} = qq|<td>$payment->{"$form->{vc}number"} </td>|;
$column_data{description} = "<td>$payment->{description} </td>";
$column_data{transdate} = "<td nowrap>$payment->{transdate} </td>";
$column_data{paid} = "<td align=right>".$form->format_amount(\%myconfig, $payment->{paid}, $form->{precision}, " ")."</td>";
$column_data{curr} = "<td>$payment->{curr}</td>";
if ($payment->{module} eq 'gl') {
$module = $payment->{module};
} else {
if ($payment->{invoice}) {
$module = ($payment->{till}) ? 'ps' : $isir;
} else {
$module = $form->{db};
}
}
$href = "<a href=${module}.pl?action=edit&id=$payment->{trans_id}&login=$form->{login}&path=$form->{path}&callback=$callback>";
$column_data{source} = "<td>$payment->{source} </td>";
$column_data{reference} = "<td>$href$payment->{reference} </a></td>";
$column_data{memo} = "<td>$payment->{memo} </td>";
$column_data{employee} = "<td>$payment->{employee} </td>";
$column_data{till} = "<td>$payment->{till} </td>";
$subtotalpaid += $payment->{paid};
$accounttotalpaid += $payment->{paid};
$totalpaid += $payment->{paid};
$i++; $i %= 2;
print qq|
<tr class=listrow$i>
|;
for (@column_index) { print "\n$column_data{$_}" }
print qq|
</tr>
|;
$sameitem = $payment->{$form->{sort}};
}
&payment_subtotal if $form->{l_subtotal};
# print account totals
for (@column_index) { $column_data{$_} = "<td> </td>" }
$column_data{paid} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $accounttotalpaid, $form->{precision}, " ")."</th>";
print qq|
<tr class=listtotal>
|;
for (@column_index) { print "\n$column_data{$_}" }
print qq|
</tr>
|;
$accounttotalpaid = 0;
}
# print total
for (@column_index) { $column_data{$_} = "<td> </td>" }
$column_data{paid} = "<th class=listtotal align=right>".$form->format_amount(\%myconfig, $totalpaid, $form->{precision}, " ")."</th>";
print qq|
<tr class=listtotal>
|;
for (@column_index) { print "\n$column_data{$_}" }
print qq|
</tr>
</table>
</td>
</tr>
<tr>
<td><hr size=3 noshade></td>
</tr>
</table>
|;
################
# &print_report_options;
if ($form->{menubar}) {
require "$form->{path}/menu.pl";
&menubar;
}
print qq|
</body>
</html>
|;
}
sub payment_subtotal {
if ($subtotalpaid != 0) {
for (@column_index) { $column_data{$_} = "<td> </td>" }
$column_data{paid} = "<th class=listsubtotal align=right>".$form->format_amount(\%myconfig, $subtotalpaid, $form->{precision}, " ")."</th>";
print qq|
<tr class=listsubtotal>
|;
for (@column_index) { print "\n$column_data{$_}" }
print qq|
</tr>
|;
}
$subtotalpaid = 0;
}
sub print_report_options {
$form->{format} ||= "pdf";
$form->{media} ||= "screen";
$media = qq|<select name=media>
<option value=screen $form->{MD}{screen}>|.$locale->text('Screen').qq|
<option value=file $form->{MD}{file}>|.$locale->text('File');
$format = qq|<select name=format>
<option value=csv $form->{DF}{csv}>CSV|;
$media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
$media .= qq|</select>|;
if ($latex) {
$format .= qq|
<option value=pdf $form->{DF}{pdf}>|.$locale->text('PDF').qq|
<option value=postscript $form->{DF}{postscript}>|.$locale->text('Postscript');
}
$format .= qq|</select>|;
print qq|
<form method=post action=$form->{script}>
<table>
<tr>
<td>$format</td>
<td>$media</td>
|;
print qq|
</tr>
</table>
<p>
<input class=submit type=submit name=action value="|.$locale->text('Print Report').qq|">|;
$form->{action} = "print_report";
$form->{nextsub} = "";
$form->hide_form;
print qq|
</form>
|;
}
sub print_report {
$form->debug;
}
| sweitmann/rma-community-version | bin/lynx/rp.pl | Perl | gpl-2.0 | 89,744 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.10">
<LINK rel="stylesheet" type="text/css" href="cascmd_en.css">
<TITLE>Zeros of an expression : zeros</TITLE>
</HEAD>
<BODY >
<A HREF="cascmd_en106.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="cascmd_en108.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
<HR>
<H3 CLASS="subsection"><A NAME="htoc121">2.12.11</A> Zeros of an expression : <TT>zeros</TT></H3><P><A NAME="@default172"></A>
<TT>zeros</TT> takes as argument an expression depending on <I>x</I>.<BR>
<TT>zeros</TT> returns a list of values of <I>x</I> where the expression
vanishes. The list may be incomplete in exact mode if the expression
is not polynomial or if intermediate
factorizations have irreducible factors of order strictly
greater than 2.<BR>
In real mode, (complex box unchecked in the Cas configuration
or <TT>complex_mode:=0</TT>), only reals zeros are returned. In
(<TT>complex_mode:=1</TT>) reals and complex zeros are returned. See
also <TT>cZeros</TT> to get complex zeros in real mode.<BR>
Input in real mode :
</P><DIV CLASS="center"><TT>zeros(x</TT><CODE><TT>^</TT></CODE><TT>2+4)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[]</TT></DIV><P>
Input in complex mode :
</P><DIV CLASS="center"><TT>zeros(x</TT><CODE><TT>^</TT></CODE><TT>2+4)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[-2*i,2*i]</TT></DIV><P>
Input in real mode :
</P><DIV CLASS="center"><TT>zeros(ln(x)</TT><CODE><TT>^</TT></CODE><TT>2-2)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[exp(sqrt(2)),exp(-(sqrt(2)))]</TT></DIV><P>
Input in real mode :
</P><DIV CLASS="center"><TT>zeros(ln(y)</TT><CODE><TT>^</TT></CODE><TT>2-2,y)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[exp(sqrt(2)),exp(-(sqrt(2)))]</TT></DIV><P>
Input in real mode :
</P><DIV CLASS="center"><TT>zeros(x*(exp(x))</TT><CODE><TT>^</TT></CODE><TT>2-2*x-2*(exp(x))</TT><CODE><TT>^</TT></CODE><TT>2+4)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[[log(sqrt(2)),2]</TT></DIV><HR>
<A HREF="cascmd_en106.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="cascmd_en108.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
| hiplayer/giac | giac/giac-1.2.2/doc/en/cascmd_en/cascmd_en107.html | HTML | gpl-2.0 | 2,505 |
package com.oinux.lanmitm.service;
import com.oinux.lanmitm.R;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
public class BaseService extends Service {
public static final int HTTP_SERVER_NOTICE = 1;
public static final int HIJACK_NOTICE = 2;
public static final int SNIFFER_NOTICE = 3;
public static final int INJECT_NOTICE = 4;
public static final int ARPSPOOF_NOTICE = 0;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@SuppressWarnings("deprecation")
protected void notice(String tickerText, int id, Class<?> cls) {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification n = new Notification(R.drawable.ic_launch_notice,
getString(R.string.app_name), System.currentTimeMillis());
n.flags = Notification.FLAG_NO_CLEAR;
Intent intent = new Intent(this, cls);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(this,
R.string.app_name, intent, PendingIntent.FLAG_UPDATE_CURRENT);
n.setLatestEventInfo(this, this.getString(R.string.app_name),
tickerText, contentIntent);
nm.notify(id, n);
}
}
| vaginessa/Lanmitm | src/com/oinux/lanmitm/service/BaseService.java | Java | gpl-2.0 | 1,380 |
<?php
/**
* This is the model class for table "message".
*
* The followings are the available columns in table 'message':
* @property integer $msg_id
* @property string $subject
* @property string $msg_content
* @property string $msg_uploads
* @property integer $user_id
* @property string $msg_time
* @property string $msg_date
* @property integer $is_read
*/
class Message extends CActiveRecord
{
/* PROPERTY FOR RECEIVING THE FILE FROM FORM*/
public $msg_uploads;
public $to;
public $attribute_id;
/**
* Returns the static model of the specified AR class.
* @return Message the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'message';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('subject, msg_content, msg_time, msg_date,to', 'required'),
array('user_id, is_read, sender_id, user_id, is_task, is_deleted', 'numerical', 'integerOnly'=>true),
array('subject, msg_uploads', 'length', 'max'=>120),
array('msg_content', 'length'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('msg_id, subject, msg_content, msg_uploads, user_id, msg_time, msg_date, is_read', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'msg_id' => 'Msg',
'subject' => 'Subject',
'msg_content' => 'Msg Content',
'msg_uploads' => 'Msg Uploads',
'user_id' => 'User',
'msg_time' => 'Msg Time',
'msg_date' => 'Msg Date',
'is_read' => 'Is Read',
'is_task' => 'Is Task'
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('msg_id',$this->msg_id);
$criteria->compare('subject',$this->subject,true);
$criteria->compare('msg_content',$this->msg_content,true);
$criteria->compare('msg_uploads',$this->msg_uploads,true);
$criteria->compare('user_id',$this->user_id);
$criteria->compare('msg_time',$this->msg_time,true);
$criteria->compare('msg_date',$this->msg_date,true);
$criteria->compare('is_read',$this->is_read);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
public function actionSearch($term)
{
if(Yii::app()->request->isAjaxRequest && !empty($term))
{
$variants = array();
$criteria = new CDbCriteria;
$criteria->select='tag';
$criteria->addSearchCondition('tag',$term.'%',false);
$tags = tagsModel::model()->findAll($criteria);
if(!empty($tags))
{
foreach($tags as $tag)
{
$variants[] = $tag->attributes['tag'];
}
}
echo CJSON::encode($variants);
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
// functions
public function setMsg()
{
$connection = Yii::app()->db;
$sql="SELECT * FROM user";
$command = $connection->createCommand($sql);
$results = $command->queryAll();
return $results;
}
public function setGroup()
{
$connection = Yii::app()->db;
$sql="SELECT * FROM groups";
$command = $connection->createCommand($sql);
$results = $command->queryAll();
return $results;
}
public function getMsg($id)
{
$i=0;
$connection = Yii::app()->db;
$sql="SELECT t1.message_id,t1.user_id FROM message_user AS t1 INNER JOIN message AS t2 ON t1.message_id = t2.msg_id WHERE t2.is_task IS NULL ORDER BY t2.msg_id DESC";
$command = $connection->createCommand($sql);
$results = $command->queryAll();
$data=array();
foreach($results as $temp)
{
//print_r($temp['user_id']);
$msg=$temp['message_id'];
$value1 = explode(",",$temp['user_id']);
//print_r($value1);
foreach($value1 as $value2)
{
//print_r($value2);
if($value2==$id)
{
//echo 'message';
//print_r($msg);
$data[$i]=$msg;
$i++;
}
}
}
return $data;
}
public function getTasks($id,$status)
{
$i=0;
$connection = Yii::app()->db;
$sql="SELECT t1.message_id,t1.user_id FROM message_user AS t1 INNER JOIN message AS t2 ON t1.message_id = t2.msg_id WHERE t2.is_task IS NOT NULL ORDER BY t2.msg_id DESC";
$command = $connection->createCommand($sql);
$results = $command->queryAll();
$data=array();
foreach($results as $temp)
{
//print_r($temp['user_id']);
$msg=$temp['message_id'];
$task=TaskAssignToPatients::model()->findByAttributes(array('id'=>$msgids->is_task,'status'=>$status));
if($task != NULL )
{
$value1 = explode(",",$temp['user_id']);
//print_r($value1);
foreach($value1 as $value2)
{
//print_r($value2);
if($value2==$id)
{
$data[$i]=$msg;
$i++;
}
}
}
else if($status=='T')
{$value1 = explode(",",$temp['user_id']);
//print_r($value1);
foreach($value1 as $value2)
{
//print_r($value2);
if($value2==$id)
{
$data[$i]=$msg;
$i++;
}
}
}
}
return $data;
}
public function getMsgcontent($msgid)
{
$connection = Yii::app()->db;
$sql="SELECT * FROM message WHERE msg_id =".$msgid;
$command = $connection->createCommand($sql);
$users= $command->queryAll();
return $users;
}
public function getMsgvalue($msgid)
{
$connection = Yii::app()->db;
$sql="SELECT t1.subject, t1.msg_id, t1.msg_date,t1.user_id,t1.sender_id FROM message AS t1,message_user AS t2 WHERE t1.msg_id=t2.message_id AND t1.user_id=113 AND t1.is_task IS NULL";
$command = $connection->createCommand($sql);
$users= $command->queryAll();
return $users;
}
public function getTaskvalue($msgid)
{
$connection = Yii::app()->db;
$sql="SELECT * FROM message WHERE msg_id =".$msgid." AND is_task!='NULL'";
$command = $connection->createCommand($sql);
$users= $command->queryAll();
return $users;
}
// TO set Isread
public function setRead($msgid)
{
$connection = Yii::app()->db;
$sql="UPDATE message SET is_read = 1 WHERE msg_id =".$msgid;
$command = $connection->createCommand($sql);
$command->queryAll();
}
public function getUnreadMessages()
{
/* $command = Yii::app()->dbadvert->createCommand()
->select ('*')
->from('message')
->where('is_read=0')
->limit(14,0)
->order('msg_date desc')
->queryAll();
return $command;*/
$connection = Yii::app()->db;
$sql = 'SELECT * FROM `message` WHERE `is_read`=0 ORDER BY `message`.`msg_date` ASC LIMIT 0 , 30';
$command = $connection->createCommand($sql);
$uread_messages = $command->queryAll();
//For getting total number of messages
$sql = 'SELECT * FROM `message` WHERE `is_read`=0';
$command = $connection->createCommand($sql);
$total = $command->queryAll();
$total = sizeof($total);
return array ($uread_messages,$total);
}
public function getSysMessages()
{
/* $command = Yii::app()->dbadvert->createCommand()
->select ('*')
->from('message')
->where('is_read=0')
->limit(14,0)
->order('msg_date desc')
->queryAll();
return $command;*/
$connection = Yii::app()->sys_db;
$sql = 'SELECT * FROM `messages` WHERE `is_read`=0 ORDER BY `messages`.`date` ASC LIMIT 0 , 30';
$command = $connection->createCommand($sql);
$uread_messages = $command->queryAll();
//For getting total number of messages
$sql = 'SELECT * FROM `messages` WHERE `is_read`=0';
$command = $connection->createCommand($sql);
$total = $command->queryAll();
$total = sizeof($total);
return array ($uread_messages,$total);
}
// For Message Forward
public function messageForward()
{
$model=new Message;
if(isset($_POST['Message']))
{
$model->attributes=$_POST['Message'];
if($model->save())
{
$insert_id = Yii::app()->db->getLastInsertID();
$list = implode(",", $_POST['msg']);
//DB Insertion
$connection = Yii::app()->db;
$command = $connection->createCommand();
$results = $command->insert('message_user',array('user_id'=>$list,'message_id'=>$insert_id));
}
}
}
//To Delete user id from List of Message-User
public function deleteMessage($uid,$mid)
{
$connection = Yii::app()->db;
$sql="SELECT user_id FROM message_user WHERE message_id =".$mid;
$command = $connection->createCommand($sql);
$results = $command->queryAll();
foreach($results as $temp)
{
//print_r($temp['user_id');
//$msg=$temp['message_id'];
$list='';
$value1 = explode(",",$temp['user_id']);
foreach($value1 as $value2)
{
if($value2!=$uid)
{
$list .=$value2.',';
}}
$list1=trim($list,',');
$connection = Yii::app()->db;
$sql="UPDATE message_user SET user_id = '".$list1."' WHERE message_id =".$mid;
$command = $connection->createCommand($sql);
$command->execute();
}
}
// To get message Contents field by field
public function getMsgcontentView($msgid,$variable)
{
$connection = Yii::app()->db;
$sql="SELECT * FROM message WHERE msg_id =".$msgid;
$command = $connection->createCommand($sql);
$users= $command->queryAll();
foreach($users as $users1)
return $users1[$variable];
}
//To get Patient Name for Message
public function getName($id)
{
$users = Yii::app()->dbadvert->createCommand()
->select('patient_lname')
->from('patients')
->where('patient_id='.$id)
->queryAll();
foreach($users as $users1)
return $users1['patient_lname'];
}
//For Sent Message List
public function getSentmessage()
{
$connection = Yii::app()->db;
$sql="SELECT * FROM message_user ORDER BY id DESC";
$command = $connection->createCommand($sql);
$results = $command->queryAll();
return $results;
}
public function getUserName($id)
{
$connection = Yii::app()->db;
$sql="SELECT username FROM blog_user WHERE id=".$id;
$command = $connection->createCommand($sql);
$results = $command->queryAll();
foreach($results as $users1)
return $users1['username'];
}
public function getPhoto($id)
{
$connection = Yii::app()->db;
$sql="SELECT photo FROM user_details WHERE user_id =".$id;
$command = $connection->createCommand($sql);
$result=$command->queryAll();
if(count($result) == 0)
return '<img src="users/user.jpg" width="48" height="51" />';
else
return '<img src="users/'.$id.'/'.$result[0]['photo'].'.jpg" width="48" height="51" />';
}
public function getPhototask($id)
{
$connection = Yii::app()->db;
$sql="SELECT photo FROM user_details WHERE user_id =".$id;
$command = $connection->createCommand($sql);
$result=$command->queryAll();
if(count($result) == 0)
return '<img src="users/user.jpg" width="48" height="51" />';
else
return '<img src="users/'.$id.'/'.$result[0]['photo'].'.jpg" width="100" height="100" />';
}
public function getUserPhototask($id)
{
$connection = Yii::app()->db;
$sql="SELECT photo FROM user_details WHERE user_id =".$id;
$command = $connection->createCommand($sql);
$result=$command->queryAll();
if(count($result) == 0)
return '<img src="users/user.jpg" width="43" height="43" />';
else
return '<img src="users/'.$id.'/'.$result[0]['photo'].'.jpg" width="43" height="43" />';
}
// Reccurssive Function For Reply Ajax Link and disply Div, Rajith
public function getReply1($rid)
{
$next = Reply::model()->findByAttributes(array('uid'=>Yii::app()->user->id,'rid'=>$rid));
if($next!=NULL)
{
$details = Message::model()->findByAttributes(array('msg_id'=>$next->mid));
echo '<div >';
echo CHtml::ajaxLink('From ::- '.Message::model()->getUserName($details->sender_id).' Subject ::- '.$details->subject,Yii::app()->createUrl('Message/message_details' ),
array('type' =>'GET','data' => array('msg'=>$next->mid),
'dataType' => 'text','update' =>'#'.$next->mid));
echo '</div>';
echo '<div id='.$next->mid.'></div>';
Message::model()->getReply($next->mid);
}
else
{
return ;
}
}
public function getReply($mid)
{
$next = Reply::model()->findAll(array('order'=>'rid DESC', 'condition'=>'(uid=:x or sid=:y) and mid=:z', 'params'=>array(':x'=>Yii::app()->user->id,':y'=>Yii::app()->user->id,':z'=>$mid)));
if($next!=NULL)
{
$i=0;
foreach($next as $next1)
{
if($i!=0)
{
$details = Message::model()->findByAttributes(array('msg_id'=>$next1['rid']));
echo '<div class="msgacc_Con">';
echo CHtml::ajaxLink(' <strong>From</strong> : '.Message::model()->getUserName($details->sender_id).'<br/><strong>Subject</strong> : '.$details->subject,Yii::app()->createUrl('Message/message_details' ),
array('type' =>'GET','data' => array('msg'=>$next1['rid']),
'dataType' => 'text','update' =>'#'.$next1['rid']));
echo '</div>';
echo '<div id='.$next1['rid'].'></div>';
}
$i++;
}
$details = Message::model()->findByAttributes(array('msg_id'=>$mid));
echo '<div class="msgacc_Con">';
echo CHtml::ajaxLink(' <strong>From</strong> : '.Message::model()->getUserName($details->sender_id).' <br/><strong>Subject</strong> : '.$details->subject,Yii::app()->createUrl('Message/message_details' ),
array('type' =>'GET','data' => array('msg'=>$mid),
'dataType' => 'text','update' =>'#'.$mid));
echo '</div>';
echo '<div id='.$mid.'></div>';
}
else
{
return ;
}
}
// Reccurssive Function For Reply ID, Rajith
public function getReplyid1($mid)
{
$next = Reply::model()->findByAttributes(array('uid'=>Yii::app()->user->id,'mid'=>$mid));
if($next!=NULL)
{
$rid=Message::model()->getReplyid($next->rid);
return $rid;
}
return $mid;
}
public function getReplycount($mid)
{
$next = Reply::model()->findAll(array('order'=>'rid DESC', 'condition'=>'(uid=:x or sid=:y) and mid=:z', 'params'=>array(':x'=>Yii::app()->user->id,':y'=>Yii::app()->user->id,':z'=>$mid)));
if($next!=NULL)
{
return count($next);
}
else
{
return 0;
}
}
public function getReplyid($mid)
{
$next = Reply::model()->findAll(array('order'=>'rid DESC', 'condition'=>'(uid=:x or sid=:y) and mid=:z', 'params'=>array(':x'=>Yii::app()->user->id,':y'=>Yii::app()->user->id,':z'=>$mid)));
if($next!=NULL)
{
return $next[0]['rid'];
}
else
{
return $mid;
}
}
// Sort for task- Rajith
public function sorts($t,$status,$page)
{
switch($t)
{
case 0:
$subject='msg_id DESC';
break;
case 1:
$subject='subject';
break;
case 2:
$subject='subject DESC';
break;
}
$i=0;
$messageids=NULL;
$connection = Yii::app()->db;
$sql="SELECT t1.msg_id,t1.is_task FROM message AS t1 INNER JOIN message_user AS t2 ON t1.msg_id = t2.message_id WHERE t1.is_task IS NOT NULL AND t2.user_id =".Yii::app()->user->id." ORDER BY t1.".$subject;
$command = $connection->createCommand($sql);
$msgids = $command->queryAll();
if($msgids!=NULL)
{
foreach($msgids as $msgids1)
{
//only for T
if($status=='T')
{
$messageids[$i]=$msgids1['msg_id'];
$i++;
}
else
{
$task=TaskAssignToPatients::model()->findByAttributes(array('id'=>$msgids1['is_task'],'status'=>$status));
if($task != NULL )
{
$messageids[$i]=$msgids1['msg_id'];
$i++;
}
}
}
}
return $messageids;
}
public function sortsUsertask($t,$status,$user_id)
{
switch($t)
{
case 0:
$subject='msg_id DESC';
break;
case 1:
$subject='subject';
break;
case 2:
$subject='subject DESC';
break;
}
$i=0;
$messageids=NULL;
$connection = Yii::app()->db;
$sql="SELECT t1.msg_id,t1.is_task FROM message AS t1 INNER JOIN message_user AS t2 ON t1.msg_id = t2.message_id WHERE t1.is_task IS NOT NULL AND t2.user_id =".$user_id." ORDER BY t1.".$subject;
$command = $connection->createCommand($sql);
$msgids = $command->queryAll();
if($msgids!=NULL)
{
foreach($msgids as $msgids1)
{
//only for T
if($status=='T')
{
$messageids[$i]=$msgids1['msg_id'];
$i++;
}
else
{
$task=TaskAssignToPatients::model()->findByAttributes(array('id'=>$msgids1['is_task'],'status'=>$status));
if($task != NULL )
{
$messageids[$i]=$msgids1['msg_id'];
$i++;
}
}
}
}
return $messageids;
}
public function sortsAgencytask($t,$status)
{
switch($t)
{
case 0:
$subject='id DESC';
break;
case 1:
$subject='subject';
break;
case 2:
$subject='id DESC';
break;
}
$i=0;
$messageids=NULL;
//$msgids=TaskAssignToPatients::model()->findAll(array('order'=>$subject, 'condition'=>'is_task!=:z', 'params'=>array(':z'=>'')));
$msgids=TaskAssignToPatients::model()->findAll(array('order'=>$subject));
return $msgids;
}
} | napoleon789/qlkh | osv/protected/models/Message.php | PHP | gpl-2.0 | 18,568 |
<?php
class NFe_APIChildResource {
// @var string Parent Keys
private $_parentKeys;
// @var string Fabricator
private $_fabricator;
function __construct( $parentKeys = array(), $className ) {
$this->_fabricator = $className;
$this->_parentKeys = $parentKeys;
}
function mergeParams( $attributes ) {
return array_merge( $attributes, $this->_parentKeys );
}
private function configureParentKeys($object) {
foreach ($this->_parentKeys as $key => $value) {
$object[$key] = $value;
}
return $object;
}
public function create( $attributes = array() ) {
$result = call_user_func_array( $this->_fabricator . '::create', array( $this->mergeparams($attributes), $this->_parentKeys ) );
if ($result) {
$this->configureParentKeys( $result );
}
return $result;
}
public function search( $options = array() ) {
$results = call_user_func_array($this->_fabricator . '::search', array( $this->mergeParams($options), $this->_parentKeys ));
if ( $results && $results->total() ) {
$modifiedResults = $results->results();
for ( $i = 0; $i < count($modifiedResults); $i++ ) {
$modifiedResults[$i] = $this->configureParentKeys( $modifiedResults[$i] );
}
$results->set($modifiedResults, $results->total());
}
return $results;
}
public function fetch( $key = array() ) {
if ( is_string($key) ) {
$key = array( "id" => $key );
}
$result = call_user_func_array($this->_fabricator . '::fetch', array( $this->mergeParams($key), $this->_parentKeys ));
if ( $result ) {
$this->configureParentKeys( $result );
}
return $result;
}
}
| nfe/woo-nfe | li/client-php/lib/NFe/APIChildResource.php | PHP | gpl-2.0 | 1,755 |
# Copyright (C) 2019 Fassio Blatter
from stopeight import analyzer
version=analyzer.version
from stopeight.util.editor.data import ScribbleData
def legal_segments(data):
from stopeight.matrix import Vectors
from stopeight.analyzer import legal_segments
return legal_segments(Vectors(data)).__array__().view(ScribbleData)
legal_segments.__annotations__ = {'data':ScribbleData,'return':ScribbleData}
| specpose/stopeight | stopeight/util/editor/modules/analyzer.py | Python | gpl-2.0 | 413 |
<?php
if (is_category('stem')) {
get_template_part('templates/content', 'stem');
} else {
get_template_part('templates/content', 'category');
}
?>
| JulienMelissas/EdNC | wp-content/themes/ednc-roots/category.php | PHP | gpl-2.0 | 151 |
/*
CMTP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation;
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 OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED.
*/
#include <linux/export.h>
#include <linux/types.h>
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/skbuff.h>
#include <linux/socket.h>
#include <linux/ioctl.h>
#include <linux/file.h>
#include <linux/compat.h>
#include <linux/gfp.h>
#include <linux/uaccess.h>
#include <net/sock.h>
#include <linux/isdn/capilli.h>
#include "cmtp.h"
static int cmtp_sock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
BT_DBG("sock %p sk %p", sock, sk);
if (!sk)
return 0;
sock_orphan(sk);
sock_put(sk);
return 0;
}
static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct cmtp_connadd_req ca;
struct cmtp_conndel_req cd;
struct cmtp_connlist_req cl;
struct cmtp_conninfo ci;
struct socket *nsock;
void __user *argp = (void __user *)arg;
int err;
BT_DBG("cmd %x arg %lx", cmd, arg);
switch (cmd) {
case CMTPCONNADD:
if (!capable(CAP_NET_ADMIN))
return -EACCES;
if (copy_from_user(&ca, argp, sizeof(ca)))
return -EFAULT;
nsock = sockfd_lookup(ca.sock, &err);
if (!nsock)
return err;
if (nsock->sk->sk_state != BT_CONNECTED) {
sockfd_put(nsock);
return -EBADFD;
}
err = cmtp_add_connection(&ca, nsock);
if (!err) {
if (copy_to_user(argp, &ca, sizeof(ca)))
err = -EFAULT;
} else
sockfd_put(nsock);
return err;
case CMTPCONNDEL:
if (!capable(CAP_NET_ADMIN))
return -EACCES;
if (copy_from_user(&cd, argp, sizeof(cd)))
return -EFAULT;
return cmtp_del_connection(&cd);
case CMTPGETCONNLIST:
if (copy_from_user(&cl, argp, sizeof(cl)))
return -EFAULT;
if (cl.cnum <= 0)
return -EINVAL;
err = cmtp_get_connlist(&cl);
if (!err && copy_to_user(argp, &cl, sizeof(cl)))
return -EFAULT;
return err;
case CMTPGETCONNINFO:
if (copy_from_user(&ci, argp, sizeof(ci)))
return -EFAULT;
err = cmtp_get_conninfo(&ci);
if (!err && copy_to_user(argp, &ci, sizeof(ci)))
return -EFAULT;
return err;
}
return -EINVAL;
}
#ifdef CONFIG_COMPAT
static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
if (cmd == CMTPGETCONNLIST) {
struct cmtp_connlist_req cl;
uint32_t uci;
int err;
if (get_user(cl.cnum, (uint32_t __user *) arg) ||
get_user(uci, (u32 __user *) (arg + 4)))
return -EFAULT;
cl.ci = compat_ptr(uci);
if (cl.cnum <= 0)
return -EINVAL;
err = cmtp_get_connlist(&cl);
if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
err = -EFAULT;
return err;
}
return cmtp_sock_ioctl(sock, cmd, arg);
}
#endif
static const struct proto_ops cmtp_sock_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = cmtp_sock_release,
.ioctl = cmtp_sock_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = cmtp_sock_compat_ioctl,
#endif
.bind = sock_no_bind,
.getname = sock_no_getname,
.sendmsg = sock_no_sendmsg,
.recvmsg = sock_no_recvmsg,
.poll = sock_no_poll,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,
.getsockopt = sock_no_getsockopt,
.connect = sock_no_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.mmap = sock_no_mmap
};
static struct proto cmtp_proto = {
.name = "CMTP",
.owner = THIS_MODULE,
.obj_size = sizeof(struct bt_sock)
};
static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct sock *sk;
BT_DBG("sock %p", sock);
if (sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto);
if (!sk)
return -ENOMEM;
sock_init_data(sock, sk);
sock->ops = &cmtp_sock_ops;
sock->state = SS_UNCONNECTED;
sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_protocol = protocol;
sk->sk_state = BT_OPEN;
return 0;
}
static const struct net_proto_family cmtp_sock_family_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.create = cmtp_sock_create
};
int cmtp_init_sockets(void)
{
int err;
err = proto_register(&cmtp_proto, 0);
if (err < 0)
return err;
err = bt_sock_register(BTPROTO_CMTP, &cmtp_sock_family_ops);
if (err < 0)
goto error;
return 0;
error:
BT_ERR("Can't register CMTP socket");
proto_unregister(&cmtp_proto);
return err;
}
void cmtp_cleanup_sockets(void)
{
if (bt_sock_unregister(BTPROTO_CMTP) < 0)
BT_ERR("Can't unregister CMTP socket");
proto_unregister(&cmtp_proto);
}
| 12019/Dorimanx-SG2-I9100-Kernel | net/bluetooth/cmtp/sock.c | C | gpl-2.0 | 5,532 |
/*
*
* function: Á¬Ïß½Ó¿Ú
*
* Date:2015-12-05
*
* Author: Bill Wang
*/
#ifndef _LOGIC_WH_PORT_H_
#define _LOGIC_WH_PORT_H_
#include <assert.h>
typedef struct structPort
{
int moduleId;
int paraId;
bool operator < (const structPort &port) const
{
if( moduleId < port.moduleId ) { //СÓÚÖ±½Ó·µ»Øtrue
return true;
}else if( moduleId > port.moduleId ) { //´óÓÚ·µ»Øfalse
return false;
}else {
//Èç¹ûmoduleIdÒ»Ñù£¬¼ÌÐø±È½ÏparaId£¬²»¿ÉÄܶ¼Ò»Ñù
if( paraId < port.paraId )
return true;
else if (paraId > port.paraId)
return false;
else
return false;
}
}
}whPort; //Ò»¸ö³ö¿Ú¶¨Ò壬ÍêÈ«¶¨ÒåÒ»¸öport
#endif | billhhh/whBK | logic/logic_whPort.h | C | gpl-2.0 | 651 |
/* NicEdit - Micro Inline WYSIWYG
* Copyright 2007-2008 Brian Kirchoff
*
* NicEdit is distributed under the terms of the MIT license
* For more information visit http://nicedit.com/
* Do not remove this copyright message
*/
var bkExtend = function(){
var args = arguments;
if (args.length == 1) args = [this, args[0]];
for (var prop in args[1]) args[0][prop] = args[1][prop];
return args[0];
};
function bkClass() { }
bkClass.prototype.construct = function() {};
bkClass.extend = function(def) {
var classDef = function() {
if (arguments[0] !== bkClass) { return this.construct.apply(this, arguments); }
};
var proto = new this(bkClass);
bkExtend(proto,def);
classDef.prototype = proto;
classDef.extend = this.extend;
return classDef;
};
var bkElement = bkClass.extend({
construct : function(elm,d) {
if(typeof(elm) == "string") {
elm = (d || document).createElement(elm);
}
elm = $BK(elm);
return elm;
},
appendTo : function(elm) {
elm.appendChild(this);
return this;
},
appendBefore : function(elm) {
elm.parentNode.insertBefore(this,elm);
return this;
},
addEvent : function(type, fn) {
bkLib.addEvent(this,type,fn);
return this;
},
setContent : function(c) {
this.innerHTML = c;
return this;
},
pos : function() {
var curleft = curtop = 0;
var o = obj = this;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
var b = (!window.opera) ? parseInt(this.getStyle('border-width') || this.style.border) || 0 : 0;
return [curleft+b,curtop+b+this.offsetHeight];
},
noSelect : function() {
bkLib.noSelect(this);
return this;
},
parentTag : function(t) {
var elm = this;
do {
if(elm && elm.nodeName && elm.nodeName.toUpperCase() == t) {
return elm;
}
elm = elm.parentNode;
} while(elm);
return false;
},
hasClass : function(cls) {
return this.className.match(new RegExp('(\\s|^)nicEdit-'+cls+'(\\s|$)'));
},
addClass : function(cls) {
if (!this.hasClass(cls)) { this.className += " nicEdit-"+cls };
return this;
},
removeClass : function(cls) {
if (this.hasClass(cls)) {
this.className = this.className.replace(new RegExp('(\\s|^)nicEdit-'+cls+'(\\s|$)'),' ');
}
return this;
},
setStyle : function(st) {
var elmStyle = this.style;
for(var itm in st) {
switch(itm) {
case 'float':
elmStyle['cssFloat'] = elmStyle['styleFloat'] = st[itm];
break;
case 'opacity':
elmStyle.opacity = st[itm];
elmStyle.filter = "alpha(opacity=" + Math.round(st[itm]*100) + ")";
break;
case 'className':
this.className = st[itm];
break;
default:
//if(document.compatMode || itm != "cursor") { // Nasty Workaround for IE 5.5
elmStyle[itm] = st[itm];
//}
}
}
return this;
},
getStyle : function( cssRule, d ) {
var doc = (!d) ? document.defaultView : d;
if(this.nodeType == 1)
return (doc && doc.getComputedStyle) ? doc.getComputedStyle( this, null ).getPropertyValue(cssRule) : this.currentStyle[ bkLib.camelize(cssRule) ];
},
remove : function() {
this.parentNode.removeChild(this);
return this;
},
setAttributes : function(at) {
for(var itm in at) {
this[itm] = at[itm];
}
return this;
}
});
var bkLib = {
isMSIE : (navigator.appVersion.indexOf("MSIE") != -1),
addEvent : function(obj, type, fn) {
(obj.addEventListener) ? obj.addEventListener( type, fn, false ) : obj.attachEvent("on"+type, fn);
},
toArray : function(iterable) {
var length = iterable.length, results = new Array(length);
while (length--) { results[length] = iterable[length] };
return results;
},
noSelect : function(element) {
if(element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
element.setAttribute('unselectable','on');
}
for(var i=0;i<element.childNodes.length;i++) {
bkLib.noSelect(element.childNodes[i]);
}
},
camelize : function(s) {
return s.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
},
inArray : function(arr,item) {
return (bkLib.search(arr,item) != null);
},
search : function(arr,itm) {
for(var i=0; i < arr.length; i++) {
if(arr[i] == itm)
return i;
}
return null;
},
cancelEvent : function(e) {
e = e || window.event;
if(e.preventDefault && e.stopPropagation) {
e.preventDefault();
e.stopPropagation();
}
return false;
},
domLoad : [],
domLoaded : function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
for (i = 0;i < bkLib.domLoad.length;i++) bkLib.domLoad[i]();
},
onDomLoaded : function(fireThis) {
this.domLoad.push(fireThis);
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", bkLib.domLoaded, null);
} else if(bkLib.isMSIE) {
document.write("<style>.nicEdit-main p { margin: 0; }</style><scr"+"ipt id=__ie_onload defer " + ((location.protocol == "https:") ? "src='javascript:void(0)'" : "src=//0") + "><\/scr"+"ipt>");
$BK("__ie_onload").onreadystatechange = function() {
if (this.readyState == "complete"){bkLib.domLoaded();}
};
}
window.onload = bkLib.domLoaded;
}
};
function $BK(elm) {
if(typeof(elm) == "string") {
elm = document.getElementById(elm);
}
return (elm && !elm.appendTo) ? bkExtend(elm,bkElement.prototype) : elm;
}
var bkEvent = {
addEvent : function(evType, evFunc) {
if(evFunc) {
this.eventList = this.eventList || {};
this.eventList[evType] = this.eventList[evType] || [];
this.eventList[evType].push(evFunc);
}
return this;
},
fireEvent : function() {
var args = bkLib.toArray(arguments), evType = args.shift();
if(this.eventList && this.eventList[evType]) {
for(var i=0;i<this.eventList[evType].length;i++) {
this.eventList[evType][i].apply(this,args);
}
}
}
};
function __(s) {
return s;
}
Function.prototype.closure = function() {
var __method = this, args = bkLib.toArray(arguments), obj = args.shift();
return function() { if(typeof(bkLib) != 'undefined') { return __method.apply(obj,args.concat(bkLib.toArray(arguments))); } };
}
Function.prototype.closureListener = function() {
var __method = this, args = bkLib.toArray(arguments), object = args.shift();
return function(e) {
e = e || window.event;
if(e.target) { var target = e.target; } else { var target = e.srcElement };
return __method.apply(object, [e,target].concat(args) );
};
}
/* START CONFIG */
var nicEditorConfig = bkClass.extend({
buttons : {
'bold' : {name : __('Click to Bold'), command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},
'italic' : {name : __('Click to Italic'), command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},
'underline' : {name : __('Click to Underline'), command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},
'left' : {name : __('Left Align'), command : 'justifyleft', noActive : true},
'center' : {name : __('Center Align'), command : 'justifycenter', noActive : true},
'right' : {name : __('Right Align'), command : 'justifyright', noActive : true},
'justify' : {name : __('Justify Align'), command : 'justifyfull', noActive : true},
'ol' : {name : __('Insert Ordered List'), command : 'insertorderedlist', tags : ['OL']},
'ul' : {name : __('Insert Unordered List'), command : 'insertunorderedlist', tags : ['UL']},
'subscript' : {name : __('Click to Subscript'), command : 'subscript', tags : ['SUB']},
'superscript' : {name : __('Click to Superscript'), command : 'superscript', tags : ['SUP']},
'strikethrough' : {name : __('Click to Strike Through'), command : 'strikeThrough', css : {'text-decoration' : 'line-through'}},
'removeformat' : {name : __('Remove Formatting'), command : 'removeformat', noActive : true},
'indent' : {name : __('Indent Text'), command : 'indent', noActive : true},
'outdent' : {name : __('Remove Indent'), command : 'outdent', noActive : true},
'hr' : {name : __('Horizontal Rule'), command : 'insertHorizontalRule', noActive : true}
},
iconsPath : '../nicEditorIcons.gif',
buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','bgcolor'],
iconList : {"xhtml":1,"bgcolor":2,"forecolor":3,"bold":4,"center":5,"hr":6,"indent":7,"italic":8,"justify":9,"left":10,"ol":11,"outdent":12,"removeformat":13,"right":14,"save":25,"strikethrough":16,"subscript":17,"superscript":18,"ul":19,"underline":20,"image":21,"link":22,"unlink":23,"close":24,"arrow":26,"upload":27}
});
/* END CONFIG */
var nicEditors = {
nicPlugins : [],
editors : [],
registerPlugin : function(plugin,options) {
this.nicPlugins.push({p : plugin, o : options});
},
allTextAreas : function(nicOptions) {
var textareas = document.getElementsByTagName("textarea");
for(var i=0;i<textareas.length;i++) {
nicEditors.editors.push(new nicEditor(nicOptions).panelInstance(textareas[i]));
}
return nicEditors.editors;
},
findEditor : function(e) {
var editors = nicEditors.editors;
for(var i=0;i<editors.length;i++) {
if(editors[i].instanceById(e)) {
return editors[i].instanceById(e);
}
}
}
};
var nicEditor = bkClass.extend({
construct : function(o) {
this.options = new nicEditorConfig();
bkExtend(this.options,o);
this.nicInstances = new Array();
this.loadedPlugins = new Array();
var plugins = nicEditors.nicPlugins;
for(var i=0;i<plugins.length;i++) {
this.loadedPlugins.push(new plugins[i].p(this,plugins[i].o));
}
nicEditors.editors.push(this);
bkLib.addEvent(document.body,'mousedown', this.selectCheck.closureListener(this) );
},
panelInstance : function(e,o) {
e = this.checkReplace($BK(e));
var panelElm = new bkElement('DIV').setStyle({width : (parseInt(e.getStyle('width')) || e.clientWidth)+'px'}).appendBefore(e);
this.setPanel(panelElm);
return this.addInstance(e,o);
},
checkReplace : function(e) {
var r = nicEditors.findEditor(e);
if(r) {
r.removeInstance(e);
r.removePanel();
}
return e;
},
addInstance : function(e,o) {
e = this.checkReplace($BK(e));
if( e.contentEditable || !!window.opera ) {
var newInstance = new nicEditorInstance(e,o,this);
} else {
var newInstance = new nicEditorIFrameInstance(e,o,this);
}
this.nicInstances.push(newInstance);
return this;
},
removeInstance : function(e) {
e = $BK(e);
var instances = this.nicInstances;
for(var i=0;i<instances.length;i++) {
if(instances[i].e == e) {
instances[i].remove();
this.nicInstances.splice(i,1);
}
}
},
removePanel : function(e) {
if(this.nicPanel) {
this.nicPanel.remove();
this.nicPanel = null;
}
},
instanceById : function(e) {
e = $BK(e);
var instances = this.nicInstances;
for(var i=0;i<instances.length;i++) {
if(instances[i].e == e) {
return instances[i];
}
}
},
setPanel : function(e) {
this.nicPanel = new nicEditorPanel($BK(e),this.options,this);
this.fireEvent('panel',this.nicPanel);
return this;
},
nicCommand : function(cmd,args) {
if(this.selectedInstance) {
this.selectedInstance.nicCommand(cmd,args);
}
},
getIcon : function(iconName,options) {
var icon = this.options.iconList[iconName];
var file = (options.iconFiles) ? options.iconFiles[iconName] : '';
return {backgroundImage : "url('"+((icon) ? this.options.iconsPath : file)+"')", backgroundPosition : ((icon) ? ((icon-1)*-18) : 0)+'px 0px'};
},
selectCheck : function(e,t) {
var found = false;
do{
if(t.className && t.className.indexOf('nicEdit') != -1) {
return false;
}
} while(t = t.parentNode);
this.fireEvent('blur',this.selectedInstance,t);
this.lastSelectedInstance = this.selectedInstance;
this.selectedInstance = null;
return false;
}
});
nicEditor = nicEditor.extend(bkEvent);
var nicEditorInstance = bkClass.extend({
isSelected : false,
construct : function(e,options,nicEditor) {
this.ne = nicEditor;
this.elm = this.e = e;
this.options = options || {};
newX = parseInt(e.getStyle('width')) || e.clientWidth;
newY = parseInt(e.getStyle('height')) || e.clientHeight;
this.initialHeight = newY-8;
var isTextarea = (e.nodeName.toLowerCase() == "textarea");
if(isTextarea || this.options.hasPanel) {
var ie7s = (bkLib.isMSIE && !((typeof document.body.style.maxHeight != "undefined") && document.compatMode == "CSS1Compat"))
var s = {width: newX+'px', border : '1px solid #ccc', borderTop : 0, overflowY : 'auto', overflowX: 'hidden' };
s[(ie7s) ? 'height' : 'maxHeight'] = (this.ne.options.maxHeight) ? this.ne.options.maxHeight+'px' : null;
this.editorContain = new bkElement('DIV').setStyle(s).appendBefore(e);
var editorElm = new bkElement('DIV').setStyle({width : (newX-8)+'px', margin: '4px', minHeight : newY+'px'}).addClass('main').appendTo(this.editorContain);
e.setStyle({display : 'none'});
editorElm.innerHTML = e.innerHTML;
if(isTextarea) {
editorElm.setContent(e.value);
this.copyElm = e;
var f = e.parentTag('FORM');
if(f) { bkLib.addEvent( f, 'submit', this.saveContent.closure(this)); }
}
editorElm.setStyle((ie7s) ? {height : newY+'px'} : {overflow: 'hidden'});
this.elm = editorElm;
}
this.ne.addEvent('blur',this.blur.closure(this));
this.init();
this.blur();
},
init : function() {
this.elm.setAttribute('contentEditable','true');
if(this.getContent() == "") {
this.setContent('<br />');
}
this.instanceDoc = document.defaultView;
this.elm.addEvent('mousedown',this.selected.closureListener(this)).addEvent('keypress',this.keyDown.closureListener(this)).addEvent('focus',this.selected.closure(this)).addEvent('blur',this.blur.closure(this)).addEvent('keyup',this.selected.closure(this));
this.ne.fireEvent('add',this);
},
remove : function() {
this.saveContent();
if(this.copyElm || this.options.hasPanel) {
this.editorContain.remove();
this.e.setStyle({'display' : 'block'});
this.ne.removePanel();
}
this.disable();
this.ne.fireEvent('remove',this);
},
disable : function() {
this.elm.setAttribute('contentEditable','false');
},
getSel : function() {
return (window.getSelection) ? window.getSelection() : document.selection;
},
getRng : function() {
var s = this.getSel();
if(!s || s.rangeCount === 0) { return; }
return (s.rangeCount > 0) ? s.getRangeAt(0) : s.createRange();
},
selRng : function(rng,s) {
if(window.getSelection) {
s.removeAllRanges();
s.addRange(rng);
} else {
rng.select();
}
},
selElm : function() {
var r = this.getRng();
if(!r) { return; }
if(r.startContainer) {
var contain = r.startContainer;
if(r.cloneContents().childNodes.length == 1) {
for(var i=0;i<contain.childNodes.length;i++) {
var rng = contain.childNodes[i].ownerDocument.createRange();
rng.selectNode(contain.childNodes[i]);
if(r.compareBoundaryPoints(Range.START_TO_START,rng) != 1 &&
r.compareBoundaryPoints(Range.END_TO_END,rng) != -1) {
return $BK(contain.childNodes[i]);
}
}
}
return $BK(contain);
} else {
return $BK((this.getSel().type == "Control") ? r.item(0) : r.parentElement());
}
},
saveRng : function() {
this.savedRange = this.getRng();
this.savedSel = this.getSel();
},
restoreRng : function() {
if(this.savedRange) {
this.selRng(this.savedRange,this.savedSel);
}
},
keyDown : function(e,t) {
if(e.ctrlKey) {
this.ne.fireEvent('key',this,e);
}
},
selected : function(e,t) {
if(!t && !(t = this.selElm)) { t = this.selElm(); }
if(!e.ctrlKey) {
var selInstance = this.ne.selectedInstance;
if(selInstance != this) {
if(selInstance) {
this.ne.fireEvent('blur',selInstance,t);
}
this.ne.selectedInstance = this;
this.ne.fireEvent('focus',selInstance,t);
}
this.ne.fireEvent('selected',selInstance,t);
this.isFocused = true;
this.elm.addClass('selected');
}
return false;
},
blur : function() {
this.isFocused = false;
this.elm.removeClass('selected');
},
saveContent : function() {
if(this.copyElm || this.options.hasPanel) {
this.ne.fireEvent('save',this);
(this.copyElm) ? this.copyElm.value = this.getContent() : this.e.innerHTML = this.getContent();
}
},
getElm : function() {
return this.elm;
},
getContent : function() {
this.content = this.getElm().innerHTML;
this.ne.fireEvent('get',this);
return this.content;
},
setContent : function(e) {
this.content = e;
this.ne.fireEvent('set',this);
this.elm.innerHTML = this.content;
},
nicCommand : function(cmd,args) {
document.execCommand(cmd,false,args);
}
});
var nicEditorIFrameInstance = nicEditorInstance.extend({
savedStyles : [],
init : function() {
var c = this.elm.innerHTML.replace(/^\s+|\s+$/g, '');
this.elm.innerHTML = '';
(!c) ? c = "<br />" : c;
this.initialContent = c;
this.elmFrame = new bkElement('iframe').setAttributes({'src' : 'javascript:;', 'frameBorder' : 0, 'allowTransparency' : 'true', 'scrolling' : 'no'}).setStyle({height: '100px', width: '100%'}).addClass('frame').appendTo(this.elm);
if(this.copyElm) { this.elmFrame.setStyle({width : (this.elm.offsetWidth-4)+'px'}); }
var styleList = ['font-size','font-family','font-weight','color'];
for(itm in styleList) {
this.savedStyles[bkLib.camelize(itm)] = this.elm.getStyle(itm);
}
setTimeout(this.initFrame.closure(this),50);
},
disable : function() {
this.elm.innerHTML = this.getContent();
},
initFrame : function() {
var fd = $BK(this.elmFrame.contentWindow.document);
fd.designMode = "on";
fd.open();
var css = this.ne.options.externalCSS;
fd.write('<html><head>'+((css) ? '<link href="'+css+'" rel="stylesheet" type="text/css" />' : '')+'</head><body id="nicEditContent" style="margin: 0 !important; background-color: transparent !important;">'+this.initialContent+'</body></html>');
fd.close();
this.frameDoc = fd;
this.frameWin = $BK(this.elmFrame.contentWindow);
this.frameContent = $BK(this.frameWin.document.body).setStyle(this.savedStyles);
this.instanceDoc = this.frameWin.document.defaultView;
this.heightUpdate();
this.frameDoc.addEvent('mousedown', this.selected.closureListener(this)).addEvent('keyup',this.heightUpdate.closureListener(this)).addEvent('keydown',this.keyDown.closureListener(this)).addEvent('keyup',this.selected.closure(this));
this.ne.fireEvent('add',this);
},
getElm : function() {
return this.frameContent;
},
setContent : function(c) {
this.content = c;
this.ne.fireEvent('set',this);
this.frameContent.innerHTML = this.content;
this.heightUpdate();
},
getSel : function() {
return (this.frameWin) ? this.frameWin.getSelection() : this.frameDoc.selection;
},
heightUpdate : function() {
this.elmFrame.style.height = Math.max(this.frameContent.offsetHeight,this.initialHeight)+'px';
},
nicCommand : function(cmd,args) {
this.frameDoc.execCommand(cmd,false,args);
setTimeout(this.heightUpdate.closure(this),100);
}
});
var nicEditorPanel = bkClass.extend({
construct : function(e,options,nicEditor) {
this.elm = e;
this.options = options;
this.ne = nicEditor;
this.panelButtons = new Array();
this.buttonList = bkExtend([],this.ne.options.buttonList);
this.panelContain = new bkElement('DIV').setStyle({overflow : 'hidden', width : '100%', border : '1px solid #cccccc', backgroundColor : '#efefef'}).addClass('panelContain');
this.panelElm = new bkElement('DIV').setStyle({margin : '2px', marginTop : '0px', zoom : 1, overflow : 'hidden'}).addClass('panel').appendTo(this.panelContain);
this.panelContain.appendTo(e);
var opt = this.ne.options;
var buttons = opt.buttons;
for(button in buttons) {
this.addButton(button,opt,true);
}
this.reorder();
e.noSelect();
},
addButton : function(buttonName,options,noOrder) {
var button = options.buttons[buttonName];
var type = (button['type']) ? eval('(typeof('+button['type']+') == "undefined") ? null : '+button['type']+';') : nicEditorButton;
var hasButton = bkLib.inArray(this.buttonList,buttonName);
if(type && (hasButton || this.ne.options.fullPanel)) {
this.panelButtons.push(new type(this.panelElm,buttonName,options,this.ne));
if(!hasButton) {
this.buttonList.push(buttonName);
}
}
},
findButton : function(itm) {
for(var i=0;i<this.panelButtons.length;i++) {
if(this.panelButtons[i].name == itm)
return this.panelButtons[i];
}
},
reorder : function() {
var bl = this.buttonList;
for(var i=0;i<bl.length;i++) {
var button = this.findButton(bl[i]);
if(button) {
this.panelElm.appendChild(button.margin);
}
}
},
remove : function() {
this.elm.remove();
}
});
var nicEditorButton = bkClass.extend({
construct : function(e,buttonName,options,nicEditor) {
this.options = options.buttons[buttonName];
this.name = buttonName;
this.ne = nicEditor;
this.elm = e;
this.margin = new bkElement('DIV').setStyle({'float' : 'left', marginTop : '2px'}).appendTo(e);
this.contain = new bkElement('DIV').setStyle({width : '20px', height : '20px'}).addClass('buttonContain').appendTo(this.margin);
this.border = new bkElement('DIV').setStyle({backgroundColor : '#efefef', border : '1px solid #efefef'}).appendTo(this.contain);
this.button = new bkElement('DIV').setStyle({width : '18px', height : '18px', overflow : 'hidden', zoom : 1, cursor : 'pointer'}).addClass('button').setStyle(this.ne.getIcon(buttonName,options)).appendTo(this.border);
this.button.addEvent('mouseover', this.hoverOn.closure(this)).addEvent('mouseout',this.hoverOff.closure(this)).addEvent('mousedown',this.mouseClick.closure(this)).noSelect();
if(!window.opera) {
this.button.onmousedown = this.button.onclick = bkLib.cancelEvent;
}
nicEditor.addEvent('selected', this.enable.closure(this)).addEvent('blur', this.disable.closure(this)).addEvent('key',this.key.closure(this));
this.disable();
this.init();
},
init : function() { },
hide : function() {
this.contain.setStyle({display : 'none'});
},
updateState : function() {
if(this.isDisabled) { this.setBg(); }
else if(this.isHover) { this.setBg('hover'); }
else if(this.isActive) { this.setBg('active'); }
else { this.setBg(); }
},
setBg : function(state) {
switch(state) {
case 'hover':
var stateStyle = {border : '1px solid #666', backgroundColor : '#ddd'};
break;
case 'active':
var stateStyle = {border : '1px solid #666', backgroundColor : '#ccc'};
break;
default:
var stateStyle = {border : '1px solid #efefef', backgroundColor : '#efefef'};
}
this.border.setStyle(stateStyle).addClass('button-'+state);
},
checkNodes : function(e) {
var elm = e;
do {
if(this.options.tags && bkLib.inArray(this.options.tags,elm.nodeName)) {
this.activate();
return true;
}
} while(elm = elm.parentNode && elm.className != "nicEdit");
elm = $BK(e);
while(elm.nodeType == 3) {
elm = $BK(elm.parentNode);
}
if(this.options.css) {
for(itm in this.options.css) {
if(elm.getStyle(itm,this.ne.selectedInstance.instanceDoc) == this.options.css[itm]) {
this.activate();
return true;
}
}
}
this.deactivate();
return false;
},
activate : function() {
if(!this.isDisabled) {
this.isActive = true;
this.updateState();
this.ne.fireEvent('buttonActivate',this);
}
},
deactivate : function() {
this.isActive = false;
this.updateState();
if(!this.isDisabled) {
this.ne.fireEvent('buttonDeactivate',this);
}
},
enable : function(ins,t) {
this.isDisabled = false;
this.contain.setStyle({'opacity' : 1}).addClass('buttonEnabled');
this.updateState();
this.checkNodes(t);
},
disable : function(ins,t) {
this.isDisabled = true;
this.contain.setStyle({'opacity' : 0.6}).removeClass('buttonEnabled');
this.updateState();
},
toggleActive : function() {
(this.isActive) ? this.deactivate() : this.activate();
},
hoverOn : function() {
if(!this.isDisabled) {
this.isHover = true;
this.updateState();
this.ne.fireEvent("buttonOver",this);
}
},
hoverOff : function() {
this.isHover = false;
this.updateState();
this.ne.fireEvent("buttonOut",this);
},
mouseClick : function() {
if(this.options.command) {
this.ne.nicCommand(this.options.command,this.options.commandArgs);
if(!this.options.noActive) {
this.toggleActive();
}
}
this.ne.fireEvent("buttonClick",this);
},
key : function(nicInstance,e) {
if(this.options.key && e.ctrlKey && String.fromCharCode(e.keyCode || e.charCode).toLowerCase() == this.options.key) {
this.mouseClick();
if(e.preventDefault) e.preventDefault();
}
}
});
var nicPlugin = bkClass.extend({
construct : function(nicEditor,options) {
this.options = options;
this.ne = nicEditor;
this.ne.addEvent('panel',this.loadPanel.closure(this));
this.init();
},
loadPanel : function(np) {
var buttons = this.options.buttons;
for(var button in buttons) {
np.addButton(button,this.options);
}
np.reorder();
},
init : function() { }
});
/* START CONFIG */
var nicPaneOptions = { };
/* END CONFIG */
var nicEditorPane = bkClass.extend({
construct : function(elm,nicEditor,options,openButton) {
this.ne = nicEditor;
this.elm = elm;
this.pos = elm.pos();
this.contain = new bkElement('div').setStyle({zIndex : '99999', overflow : 'hidden', position : 'absolute', left : this.pos[0]+'px', top : this.pos[1]+'px'})
this.pane = new bkElement('div').setStyle({fontSize : '12px', border : '1px solid #ccc', 'overflow': 'hidden', padding : '4px', textAlign: 'left', backgroundColor : '#ffffc9'}).addClass('pane').setStyle(options).appendTo(this.contain);
if(openButton && !openButton.options.noClose) {
this.close = new bkElement('div').setStyle({'float' : 'right', height: '16px', width : '16px', cursor : 'pointer'}).setStyle(this.ne.getIcon('close',nicPaneOptions)).addEvent('mousedown',openButton.removePane.closure(this)).appendTo(this.pane);
}
this.contain.noSelect().appendTo(document.body);
this.position();
this.init();
},
init : function() { },
position : function() {
if(this.ne.nicPanel) {
var panelElm = this.ne.nicPanel.elm;
var panelPos = panelElm.pos();
var newLeft = panelPos[0]+parseInt(panelElm.getStyle('width'))-(parseInt(this.pane.getStyle('width'))+8);
if(newLeft < this.pos[0]) {
this.contain.setStyle({left : newLeft+'px'});
}
}
},
toggle : function() {
this.isVisible = !this.isVisible;
this.contain.setStyle({display : ((this.isVisible) ? 'block' : 'none')});
},
remove : function() {
if(this.contain) {
this.contain.remove();
this.contain = null;
}
},
append : function(c) {
c.appendTo(this.pane);
},
setContent : function(c) {
this.pane.setContent(c);
}
});
var nicEditorAdvancedButton = nicEditorButton.extend({
init : function() {
this.ne.addEvent('selected',this.removePane.closure(this)).addEvent('blur',this.removePane.closure(this));
},
mouseClick : function() {
if(!this.isDisabled) {
if(this.pane && this.pane.pane) {
this.removePane();
} else {
this.pane = new nicEditorPane(this.contain,this.ne,{width : (this.width || '270px'), backgroundColor : '#fff'},this);
this.addPane();
this.ne.selectedInstance.saveRng();
}
}
},
addForm : function(f,elm) {
this.form = new bkElement('form').addEvent('submit',this.submit.closureListener(this));
this.pane.append(this.form);
this.inputs = {};
for(itm in f) {
var field = f[itm];
var val = '';
if(elm) {
val = elm.getAttribute(itm);
}
if(!val) {
val = field['value'] || '';
}
var type = f[itm].type;
if(type == 'title') {
new bkElement('div').setContent(field.txt).setStyle({fontSize : '14px', fontWeight: 'bold', padding : '0px', margin : '2px 0'}).appendTo(this.form);
} else {
var contain = new bkElement('div').setStyle({overflow : 'hidden', clear : 'both'}).appendTo(this.form);
if(field.txt) {
new bkElement('label').setAttributes({'for' : itm}).setContent(field.txt).setStyle({margin : '2px 4px', fontSize : '13px', width: '50px', lineHeight : '20px', textAlign : 'right', 'float' : 'left'}).appendTo(contain);
}
switch(type) {
case 'text':
this.inputs[itm] = new bkElement('input').setAttributes({id : itm, 'value' : val, 'type' : 'text'}).setStyle({margin : '2px 0', fontSize : '13px', 'float' : 'left', height : '20px', border : '1px solid #ccc', overflow : 'hidden'}).setStyle(field.style).appendTo(contain);
break;
case 'select':
this.inputs[itm] = new bkElement('select').setAttributes({id : itm}).setStyle({border : '1px solid #ccc', 'float' : 'left', margin : '2px 0'}).appendTo(contain);
for(opt in field.options) {
var o = new bkElement('option').setAttributes({value : opt, selected : (opt == val) ? 'selected' : ''}).setContent(field.options[opt]).appendTo(this.inputs[itm]);
}
break;
case 'content':
this.inputs[itm] = new bkElement('textarea').setAttributes({id : itm}).setStyle({border : '1px solid #ccc', 'float' : 'left'}).setStyle(field.style).appendTo(contain);
this.inputs[itm].value = val;
}
}
}
new bkElement('input').setAttributes({'type' : 'submit'}).setStyle({backgroundColor : '#efefef',border : '1px solid #ccc', margin : '3px 0', 'float' : 'left', 'clear' : 'both'}).appendTo(this.form);
this.form.onsubmit = bkLib.cancelEvent;
},
submit : function() { },
findElm : function(tag,attr,val) {
var list = this.ne.selectedInstance.getElm().getElementsByTagName(tag);
for(var i=0;i<list.length;i++) {
if(list[i].getAttribute(attr) == val) {
return $BK(list[i]);
}
}
},
removePane : function() {
if(this.pane) {
this.pane.remove();
this.pane = null;
this.ne.selectedInstance.restoreRng();
}
}
});
var nicButtonTips = bkClass.extend({
construct : function(nicEditor) {
this.ne = nicEditor;
nicEditor.addEvent('buttonOver',this.show.closure(this)).addEvent('buttonOut',this.hide.closure(this));
},
show : function(button) {
this.timer = setTimeout(this.create.closure(this,button),400);
},
create : function(button) {
this.timer = null;
if(!this.pane) {
this.pane = new nicEditorPane(button.button,this.ne,{fontSize : '12px', marginTop : '5px'});
this.pane.setContent(button.options.name);
}
},
hide : function(button) {
if(this.timer) {
clearTimeout(this.timer);
}
if(this.pane) {
this.pane = this.pane.remove();
}
}
});
nicEditors.registerPlugin(nicButtonTips);
/* START CONFIG */
var nicSelectOptions = {
buttons : {
'fontSize' : {name : __('Select Font Size'), type : 'nicEditorFontSizeSelect', command : 'fontsize'},
'fontFamily' : {name : __('Select Font Family'), type : 'nicEditorFontFamilySelect', command : 'fontname'},
'fontFormat' : {name : __('Select Font Format'), type : 'nicEditorFontFormatSelect', command : 'formatBlock'}
}
};
/* END CONFIG */
var nicEditorSelect = bkClass.extend({
construct : function(e,buttonName,options,nicEditor) {
this.options = options.buttons[buttonName];
this.elm = e;
this.ne = nicEditor;
this.name = buttonName;
this.selOptions = new Array();
this.margin = new bkElement('div').setStyle({'float' : 'left', margin : '2px 1px 0 1px'}).appendTo(this.elm);
this.contain = new bkElement('div').setStyle({width: '90px', height : '20px', cursor : 'pointer', overflow: 'hidden'}).addClass('selectContain').addEvent('click',this.toggle.closure(this)).appendTo(this.margin);
this.items = new bkElement('div').setStyle({overflow : 'hidden', zoom : 1, border: '1px solid #ccc', paddingLeft : '3px', backgroundColor : '#fff'}).appendTo(this.contain);
this.control = new bkElement('div').setStyle({overflow : 'hidden', 'float' : 'right', height: '18px', width : '16px'}).addClass('selectControl').setStyle(this.ne.getIcon('arrow',options)).appendTo(this.items);
this.txt = new bkElement('div').setStyle({overflow : 'hidden', 'float' : 'left', width : '66px', height : '14px', marginTop : '1px', fontFamily : 'sans-serif', textAlign : 'center', fontSize : '12px'}).addClass('selectTxt').appendTo(this.items);
if(!window.opera) {
this.contain.onmousedown = this.control.onmousedown = this.txt.onmousedown = bkLib.cancelEvent;
}
this.margin.noSelect();
this.ne.addEvent('selected', this.enable.closure(this)).addEvent('blur', this.disable.closure(this));
this.disable();
this.init();
},
disable : function() {
this.isDisabled = true;
this.close();
this.contain.setStyle({opacity : 0.6});
},
enable : function(t) {
this.isDisabled = false;
this.close();
this.contain.setStyle({opacity : 1});
},
setDisplay : function(txt) {
this.txt.setContent(txt);
},
toggle : function() {
if(!this.isDisabled) {
(this.pane) ? this.close() : this.open();
}
},
open : function() {
this.pane = new nicEditorPane(this.items,this.ne,{width : '88px', padding: '0px', borderTop : 0, borderLeft : '1px solid #ccc', borderRight : '1px solid #ccc', borderBottom : '0px', backgroundColor : '#fff'});
for(var i=0;i<this.selOptions.length;i++) {
var opt = this.selOptions[i];
var itmContain = new bkElement('div').setStyle({overflow : 'hidden', borderBottom : '1px solid #ccc', width: '88px', textAlign : 'left', overflow : 'hidden', cursor : 'pointer'});
var itm = new bkElement('div').setStyle({padding : '0px 4px'}).setContent(opt[1]).appendTo(itmContain).noSelect();
itm.addEvent('click',this.update.closure(this,opt[0])).addEvent('mouseover',this.over.closure(this,itm)).addEvent('mouseout',this.out.closure(this,itm)).setAttributes('id',opt[0]);
this.pane.append(itmContain);
if(!window.opera) {
itm.onmousedown = bkLib.cancelEvent;
}
}
},
close : function() {
if(this.pane) {
this.pane = this.pane.remove();
}
},
over : function(opt) {
opt.setStyle({backgroundColor : '#ccc'});
},
out : function(opt) {
opt.setStyle({backgroundColor : '#fff'});
},
add : function(k,v) {
this.selOptions.push(new Array(k,v));
},
update : function(elm) {
this.ne.nicCommand(this.options.command,elm);
this.close();
}
});
var nicEditorFontSizeSelect = nicEditorSelect.extend({
sel : {1 : '1 (8pt)', 2 : '2 (10pt)', 3 : '3 (12pt)', 4 : '4 (14pt)', 5 : '5 (18pt)', 6 : '6 (24pt)'},
init : function() {
this.setDisplay('Font Size...');
for(itm in this.sel) {
this.add(itm,'<font size="'+itm+'">'+this.sel[itm]+'</font>');
}
}
});
var nicEditorFontFamilySelect = nicEditorSelect.extend({
sel : {'arial' : 'Arial','comic sans ms' : 'Comic Sans','courier new' : 'Courier New','georgia' : 'Georgia', 'helvetica' : 'Helvetica', 'impact' : 'Impact', 'times new roman' : 'Times', 'trebuchet ms' : 'Trebuchet', 'verdana' : 'Verdana'},
init : function() {
this.setDisplay('Font Family...');
for(itm in this.sel) {
this.add(itm,'<font face="'+itm+'">'+this.sel[itm]+'</font>');
}
}
});
var nicEditorFontFormatSelect = nicEditorSelect.extend({
sel : {'p' : 'Paragraph', 'pre' : 'Pre', 'h6' : 'Heading 6', 'h5' : 'Heading 5', 'h4' : 'Heading 4', 'h3' : 'Heading 3', 'h2' : 'Heading 2', 'h1' : 'Heading 1'},
init : function() {
this.setDisplay('Font Format...');
for(itm in this.sel) {
var tag = itm.toUpperCase();
this.add('<'+tag+'>','<'+itm+' style="padding: 0px; margin: 0px;">'+this.sel[itm]+'</'+tag+'>');
}
}
});
nicEditors.registerPlugin(nicPlugin,nicSelectOptions);
/* START CONFIG */
var nicLinkOptions = {
buttons : {
'link' : {name : 'Add Link', type : 'nicLinkButton', tags : ['A']},
'unlink' : {name : 'Remove Link', command : 'unlink', noActive : true}
}
};
/* END CONFIG */
var nicLinkButton = nicEditorAdvancedButton.extend({
addPane : function() {
this.ln = this.ne.selectedInstance.selElm().parentTag('A');
this.addForm({
'' : {type : 'title', txt : 'Add/Edit Link'},
'href' : {type : 'text', txt : 'URL', value : 'http://', style : {width: '150px'}},
'title' : {type : 'text', txt : 'Title'},
'target' : {type : 'select', txt : 'Open In', options : {'' : 'Current Window', '_blank' : 'New Window'},style : {width : '100px'}}
},this.ln);
},
submit : function(e) {
var url = this.inputs['href'].value;
if(url == "http://" || url == "") {
alert("You must enter a URL to Create a Link");
return false;
}
this.removePane();
if(!this.ln) {
var tmp = 'javascript:nicTemp();';
this.ne.nicCommand("createlink",tmp);
this.ln = this.findElm('A','href',tmp);
}
if(this.ln) {
this.ln.setAttributes({
href : this.inputs['href'].value,
title : this.inputs['title'].value,
target : this.inputs['target'].options[this.inputs['target'].selectedIndex].value
});
}
}
});
nicEditors.registerPlugin(nicPlugin,nicLinkOptions);
/* START CONFIG */
var nicColorOptions = {
buttons : {
'forecolor' : {name : __('Change Text Color'), type : 'nicEditorColorButton', noClose : true},
'bgcolor' : {name : __('Change Background Color'), type : 'nicEditorBgColorButton', noClose : true}
}
};
/* END CONFIG */
var nicEditorColorButton = nicEditorAdvancedButton.extend({
addPane : function() {
var colorList = {0 : '00',1 : '33',2 : '66',3 :'99',4 : 'CC',5 : 'FF'};
var colorItems = new bkElement('DIV').setStyle({width: '270px'});
for(var r in colorList) {
for(var b in colorList) {
for(var g in colorList) {
var colorCode = '#'+colorList[r]+colorList[g]+colorList[b];
var colorSquare = new bkElement('DIV').setStyle({'cursor' : 'pointer', 'height' : '15px', 'float' : 'left'}).appendTo(colorItems);
var colorBorder = new bkElement('DIV').setStyle({border: '2px solid '+colorCode}).appendTo(colorSquare);
var colorInner = new bkElement('DIV').setStyle({backgroundColor : colorCode, overflow : 'hidden', width : '11px', height : '11px'}).addEvent('click',this.colorSelect.closure(this,colorCode)).addEvent('mouseover',this.on.closure(this,colorBorder)).addEvent('mouseout',this.off.closure(this,colorBorder,colorCode)).appendTo(colorBorder);
if(!window.opera) {
colorSquare.onmousedown = colorInner.onmousedown = bkLib.cancelEvent;
}
}
}
}
this.pane.append(colorItems.noSelect());
},
colorSelect : function(c) {
this.ne.nicCommand('foreColor',c);
this.removePane();
},
on : function(colorBorder) {
colorBorder.setStyle({border : '2px solid #000'});
},
off : function(colorBorder,colorCode) {
colorBorder.setStyle({border : '2px solid '+colorCode});
}
});
var nicEditorBgColorButton = nicEditorColorButton.extend({
colorSelect : function(c) {
this.ne.nicCommand('hiliteColor',c);
this.removePane();
}
});
nicEditors.registerPlugin(nicPlugin,nicColorOptions);
/* START CONFIG */
var nicImageOptions = {
buttons : {
'image' : {name : 'Add Image', type : 'nicImageButton', tags : ['IMG']}
}
};
/* END CONFIG */
var nicImageButton = nicEditorAdvancedButton.extend({
addPane : function() {
this.im = this.ne.selectedInstance.selElm().parentTag('IMG');
this.addForm({
'' : {type : 'title', txt : 'Add/Edit Image'},
'src' : {type : 'text', txt : 'URL', 'value' : 'http://', style : {width: '150px'}},
'alt' : {type : 'text', txt : 'Alt Text', style : {width: '100px'}},
'align' : {type : 'select', txt : 'Align', options : {none : 'Default','left' : 'Left', 'right' : 'Right'}}
},this.im);
},
submit : function(e) {
var src = this.inputs['src'].value;
if(src == "" || src == "http://") {
alert("You must enter a Image URL to insert");
return false;
}
this.removePane();
if(!this.im) {
var tmp = 'javascript:nicImTemp();';
this.ne.nicCommand("insertImage",tmp);
this.im = this.findElm('IMG','src',tmp);
}
if(this.im) {
this.im.setAttributes({
src : this.inputs['src'].value,
alt : this.inputs['alt'].value,
align : this.inputs['align'].value
});
}
}
});
nicEditors.registerPlugin(nicPlugin,nicImageOptions);
/* START CONFIG */
var nicSaveOptions = {
buttons : {
'save' : {name : __('Save this content'), type : 'nicEditorSaveButton'}
}
};
/* END CONFIG */
var nicEditorSaveButton = nicEditorButton.extend({
init : function() {
if(!this.ne.options.onSave) {
this.margin.setStyle({'display' : 'none'});
}
},
mouseClick : function() {
var onSave = this.ne.options.onSave;
var selectedInstance = this.ne.selectedInstance;
onSave(selectedInstance.getContent(), selectedInstance.elm.id, selectedInstance);
}
});
nicEditors.registerPlugin(nicPlugin,nicSaveOptions);
/* START CONFIG */
var nicUploadOptions = {
buttons : {
'upload' : {name : 'Upload Image', type : 'nicUploadButton'}
}
};
/* END CONFIG */
var nicUploadButton = nicEditorAdvancedButton.extend({
nicURI : 'http://api.imgur.com/2/upload.json',
errorText : 'Failed to upload image',
addPane : function() {
if(typeof window.FormData === "undefined") {
return this.onError("Image uploads are not supported in this browser, use Chrome, Firefox, or Safari instead.");
}
this.im = this.ne.selectedInstance.selElm().parentTag('IMG');
var container = new bkElement('div')
.setStyle({ padding: '10px' })
.appendTo(this.pane.pane);
new bkElement('div')
.setStyle({ fontSize: '14px', fontWeight : 'bold', paddingBottom: '5px' })
.setContent('Insert an Image')
.appendTo(container);
this.fileInput = new bkElement('input')
.setAttributes({ 'type' : 'file' })
.appendTo(container);
this.progress = new bkElement('progress')
.setStyle({ width : '100%', display: 'none' })
.setAttributes('max', 100)
.appendTo(container);
this.fileInput.onchange = this.uploadFile.closure(this);
},
onError : function(msg) {
this.removePane();
alert(msg || "Failed to upload image");
},
uploadFile : function() {
var file = this.fileInput.files[0];
if (!file || !file.type.match(/image.*/)) {
this.onError("Only image files can be uploaded");
return;
}
this.fileInput.setStyle({ display: 'none' });
this.setProgress(0);
var fd = new FormData(); // https://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
fd.append("image", file);
fd.append("key", "b7ea18a4ecbda8e92203fa4968d10660");
var xhr = new XMLHttpRequest();
xhr.open("POST", this.ne.options.uploadURI || this.nicURI);
xhr.onload = function() {
try {
var res = JSON.parse(xhr.responseText);
} catch(e) {
return this.onError();
}
this.onUploaded(res.upload);
}.closure(this);
xhr.onerror = this.onError.closure(this);
xhr.upload.onprogress = function(e) {
this.setProgress(e.loaded / e.total);
}.closure(this);
xhr.send(fd);
},
setProgress : function(percent) {
this.progress.setStyle({ display: 'block' });
if(percent < .98) {
this.progress.value = percent;
} else {
this.progress.removeAttribute('value');
}
},
onUploaded : function(options) {
this.removePane();
var src = options.links.original;
if(!this.im) {
this.ne.selectedInstance.restoreRng();
var tmp = 'javascript:nicImTemp();';
this.ne.nicCommand("insertImage", src);
this.im = this.findElm('IMG','src', src);
}
var w = parseInt(this.ne.selectedInstance.elm.getStyle('width'));
if(this.im) {
this.im.setAttributes({
src : src,
width : (w && options.image.width) ? Math.min(w, options.image.width) : ''
});
}
}
});
nicEditors.registerPlugin(nicPlugin,nicUploadOptions);
var nicXHTML = bkClass.extend({
stripAttributes : ['_moz_dirty','_moz_resizing','_extended'],
noShort : ['style','title','script','textarea','a'],
cssReplace : {'font-weight:bold;' : 'strong', 'font-style:italic;' : 'em'},
sizes : {1 : 'xx-small', 2 : 'x-small', 3 : 'small', 4 : 'medium', 5 : 'large', 6 : 'x-large'},
construct : function(nicEditor) {
this.ne = nicEditor;
if(this.ne.options.xhtml) {
nicEditor.addEvent('get',this.cleanup.closure(this));
}
},
cleanup : function(ni) {
var node = ni.getElm();
var xhtml = this.toXHTML(node);
ni.content = xhtml;
},
toXHTML : function(n,r,d) {
var txt = '';
var attrTxt = '';
var cssTxt = '';
var nType = n.nodeType;
var nName = n.nodeName.toLowerCase();
var nChild = n.hasChildNodes && n.hasChildNodes();
var extraNodes = new Array();
switch(nType) {
case 1:
var nAttributes = n.attributes;
switch(nName) {
case 'b':
nName = 'strong';
break;
case 'i':
nName = 'em';
break;
case 'font':
nName = 'span';
break;
}
if(r) {
for(var i=0;i<nAttributes.length;i++) {
var attr = nAttributes[i];
var attributeName = attr.nodeName.toLowerCase();
var attributeValue = attr.nodeValue;
if(!attr.specified || !attributeValue || bkLib.inArray(this.stripAttributes,attributeName) || typeof(attributeValue) == "function") {
continue;
}
switch(attributeName) {
case 'style':
var css = attributeValue.replace(/ /g,"");
for(itm in this.cssReplace) {
if(css.indexOf(itm) != -1) {
extraNodes.push(this.cssReplace[itm]);
css = css.replace(itm,'');
}
}
cssTxt += css;
attributeValue = "";
break;
case 'class':
attributeValue = attributeValue.replace("Apple-style-span","");
break;
case 'size':
cssTxt += "font-size:"+this.sizes[attributeValue]+';';
attributeValue = "";
break;
}
if(attributeValue) {
attrTxt += ' '+attributeName+'="'+attributeValue+'"';
}
}
if(cssTxt) {
attrTxt += ' style="'+cssTxt+'"';
}
for(var i=0;i<extraNodes.length;i++) {
txt += '<'+extraNodes[i]+'>';
}
if(attrTxt == "" && nName == "span") {
r = false;
}
if(r) {
txt += '<'+nName;
if(nName != 'br') {
txt += attrTxt;
}
}
}
if(!nChild && !bkLib.inArray(this.noShort,attributeName)) {
if(r) {
txt += ' />';
}
} else {
if(r) {
txt += '>';
}
for(var i=0;i<n.childNodes.length;i++) {
var results = this.toXHTML(n.childNodes[i],true,true);
if(results) {
txt += results;
}
}
}
if(r && nChild) {
txt += '</'+nName+'>';
}
for(var i=0;i<extraNodes.length;i++) {
txt += '</'+extraNodes[i]+'>';
}
break;
case 3:
//if(n.nodeValue != '\n') {
txt += n.nodeValue;
//}
break;
}
return txt;
}
});
nicEditors.registerPlugin(nicXHTML);
var nicBBCode = bkClass.extend({
construct : function(nicEditor) {
this.ne = nicEditor;
if(this.ne.options.bbCode) {
nicEditor.addEvent('get',this.bbGet.closure(this));
nicEditor.addEvent('set',this.bbSet.closure(this));
var loadedPlugins = this.ne.loadedPlugins;
for(itm in loadedPlugins) {
if(loadedPlugins[itm].toXHTML) {
this.xhtml = loadedPlugins[itm];
}
}
}
},
bbGet : function(ni) {
var xhtml = this.xhtml.toXHTML(ni.getElm());
ni.content = this.toBBCode(xhtml);
},
bbSet : function(ni) {
ni.content = this.fromBBCode(ni.content);
},
toBBCode : function(xhtml) {
function rp(r,m) {
xhtml = xhtml.replace(r,m);
}
rp(/\n/gi,"");
rp(/<strong>(.*?)<\/strong>/gi,"[b]$1[/b]");
rp(/<em>(.*?)<\/em>/gi,"[i]$1[/i]");
rp(/<span.*?style="text-decoration:underline;">(.*?)<\/span>/gi,"[u]$1[/u]");
rp(/<ul>(.*?)<\/ul>/gi,"[list]$1[/list]");
rp(/<li>(.*?)<\/li>/gi,"[*]$1[/*]");
rp(/<ol>(.*?)<\/ol>/gi,"[list=1]$1[/list]");
rp(/<img.*?src="(.*?)".*?>/gi,"[img]$1[/img]");
rp(/<a.*?href="(.*?)".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
rp(/<br.*?>/gi,"\n");
rp(/<.*?>.*?<\/.*?>/gi,"");
return xhtml;
},
fromBBCode : function(bbCode) {
function rp(r,m) {
bbCode = bbCode.replace(r,m);
}
rp(/\[b\](.*?)\[\/b\]/gi,"<strong>$1</strong>");
rp(/\[i\](.*?)\[\/i\]/gi,"<em>$1</em>");
rp(/\[u\](.*?)\[\/u\]/gi,"<span style=\"text-decoration:underline;\">$1</span>");
rp(/\[list\](.*?)\[\/list\]/gi,"<ul>$1</ul>");
rp(/\[list=1\](.*?)\[\/list\]/gi,"<ol>$1</ol>");
rp(/\[\*\](.*?)\[\/\*\]/gi,"<li>$1</li>");
rp(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rp(/\[url=(.*?)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
rp(/\n/gi,"<br />");
//rp(/\[.*?\](.*?)\[\/.*?\]/gi,"$1");
return bbCode;
}
});
nicEditors.registerPlugin(nicBBCode);
nicEditor = nicEditor.extend({
floatingPanel : function() {
this.floating = new bkElement('DIV').setStyle({position: 'absolute', top : '-1000px'}).appendTo(document.body);
this.addEvent('focus', this.reposition.closure(this)).addEvent('blur', this.hide.closure(this));
this.setPanel(this.floating);
},
reposition : function() {
var e = this.selectedInstance.e;
this.floating.setStyle({ width : (parseInt(e.getStyle('width')) || e.clientWidth)+'px' });
var top = e.offsetTop-this.floating.offsetHeight;
if(top < 0) {
top = e.offsetTop+e.offsetHeight;
}
this.floating.setStyle({ top : top+'px', left : e.offsetLeft+'px', display : 'block' });
},
hide : function() {
this.floating.setStyle({ top : '-1000px'});
}
});
/* START CONFIG */
var nicCodeOptions = {
buttons : {
'xhtml' : {name : 'Edit HTML', type : 'nicCodeButton'}
}
};
/* END CONFIG */
var nicCodeButton = nicEditorAdvancedButton.extend({
width : '350px',
addPane : function() {
this.addForm({
'' : {type : 'title', txt : 'Edit HTML'},
'code' : {type : 'content', 'value' : this.ne.selectedInstance.getContent(), style : {width: '340px', height : '200px'}}
});
},
submit : function(e) {
var code = this.inputs['code'].value;
this.ne.selectedInstance.setContent(code);
this.removePane();
}
});
nicEditors.registerPlugin(nicPlugin,nicCodeOptions);
| drupaals/demo.com | d7/sites/all/libraries/nicedit/nicEdit.js | JavaScript | gpl-2.0 | 50,796 |
/****************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
* (c) Copyright 2002, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attemp
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
****************************************************************************
Module Name:
rt_profile.c
Abstract:
Revision History:
Who When What
--------- ---------- ----------------------------------------------
*/
#include "rt_config.h"
NDIS_STATUS RTMPReadParametersHook(
IN PRTMP_ADAPTER pAd)
{
PSTRING src = NULL;
RTMP_OS_FD srcf;
RTMP_OS_FS_INFO osFSInfo;
INT retval = NDIS_STATUS_FAILURE;
PSTRING buffer;
buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG);
if(buffer == NULL)
return NDIS_STATUS_FAILURE;
memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
src = STA_PROFILE_PATH;
}
#endif // CONFIG_STA_SUPPORT //
#ifdef MULTIPLE_CARD_SUPPORT
src = (PSTRING)pAd->MC_FileName;
#endif // MULTIPLE_CARD_SUPPORT //
}
if (src && *src)
{
RtmpOSFSInfoChange(&osFSInfo, TRUE);
srcf = RtmpOSFileOpen(src, O_RDONLY, 0);
if (IS_FILE_OPEN_ERR(srcf))
{
DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src));
}
else
{
retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
if (retval > 0)
{
RTMPSetProfileParameters(pAd, buffer);
retval = NDIS_STATUS_SUCCESS;
}
else
DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval));
retval = RtmpOSFileClose(srcf);
if ( retval != 0)
{
retval = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval));
}
}
RtmpOSFSInfoChange(&osFSInfo, FALSE);
}
kfree(buffer);
return (retval);
}
| silver-alx/ac100_kernel | drivers/net/wireless/DPA_RT3070_WiFiBTCombo/NETIF/os/linux/rt_profile.c | C | gpl-2.0 | 2,320 |
/* main-rc6-test.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* rc6 test-suit
*
*/
#include "main-test-common.h"
#include "rc6.h"
#include "performance_test.h"
#include "bcal-performance.h"
#include "bcal-nessie.h"
#include "bcal_rc6.h"
#define RC6_ROUNDS 20
char *algo_name = "RC6-32/20/16";
const bcdesc_t *const algolist[] PROGMEM = {
(bcdesc_t*)&rc6_desc,
NULL
};
/*****************************************************************************
* additional validation-functions *
*****************************************************************************/
void rc6_genctx_dummy(uint8_t *key, uint16_t keysize_b, void *ctx){
rc6_initl(key, keysize_b, RC6_ROUNDS, ctx);
}
void testrun_nessie_rc6(void){
bcal_nessie_multiple(algolist);
}
void testrun_performance_rc6(void){
bcal_performance_multiple(algolist);
}
/*****************************************************************************
* main *
*****************************************************************************/
const char nessie_str[] PROGMEM = "nessie";
const char test_str[] PROGMEM = "test";
const char performance_str[] PROGMEM = "performance";
const char echo_str[] PROGMEM = "echo";
const cmdlist_entry_t cmdlist[] PROGMEM = {
{ nessie_str, NULL, testrun_nessie_rc6},
{ test_str, NULL, testrun_nessie_rc6},
{ performance_str, NULL, testrun_performance_rc6},
{ echo_str, (void*)1, (void_fpt)echo_ctrl},
{ NULL, NULL, NULL}
};
int main (void){
main_setup();
for(;;){
welcome_msg(algo_name);
cmd_interface(cmdlist);
}
}
| nerilex/avr-crypto-lib | test_src/main-rc6-test.c | C | gpl-2.0 | 2,347 |
/*
* Copyright (C) 2013-2015 Kay Sievers
* Copyright (C) 2013-2015 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Copyright (C) 2013-2015 Daniel Mack <daniel@zonque.org>
* Copyright (C) 2013-2015 David Herrmann <dh.herrmann@gmail.com>
* Copyright (C) 2013-2015 Linux Foundation
* Copyright (C) 2014-2015 Djalal Harouni
*
* kdbus is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*/
#include <linux/fs.h>
#include <linux/hashtable.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/sched.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/uio.h>
#include "bus.h"
#include "notify.h"
#include "connection.h"
#include "domain.h"
#include "endpoint.h"
#include "handle.h"
#include "item.h"
#include "match.h"
#include "message.h"
#include "metadata.h"
#include "names.h"
#include "policy.h"
#include "util.h"
static void kdbus_bus_free(struct kdbus_node *node)
{
struct kdbus_bus *bus = container_of(node, struct kdbus_bus, node);
WARN_ON(!list_empty(&bus->monitors_list));
WARN_ON(!hash_empty(bus->conn_hash));
kdbus_notify_free(bus);
kdbus_user_unref(bus->creator);
kdbus_name_registry_free(bus->name_registry);
kdbus_domain_unref(bus->domain);
kdbus_policy_db_clear(&bus->policy_db);
kdbus_meta_proc_unref(bus->creator_meta);
kfree(bus);
}
static void kdbus_bus_release(struct kdbus_node *node, bool was_active)
{
struct kdbus_bus *bus = container_of(node, struct kdbus_bus, node);
if (was_active)
atomic_dec(&bus->creator->buses);
}
static struct kdbus_bus *kdbus_bus_new(struct kdbus_domain *domain,
const char *name,
struct kdbus_bloom_parameter *bloom,
const u64 *pattach_owner,
const u64 *pattach_recv,
u64 flags, kuid_t uid, kgid_t gid)
{
struct kdbus_bus *b;
u64 attach_owner;
u64 attach_recv;
int ret;
if (bloom->size < 8 || bloom->size > KDBUS_BUS_BLOOM_MAX_SIZE ||
!KDBUS_IS_ALIGNED8(bloom->size) || bloom->n_hash < 1)
return ERR_PTR(-EINVAL);
ret = kdbus_sanitize_attach_flags(pattach_recv ? *pattach_recv : 0,
&attach_recv);
if (ret < 0)
return ERR_PTR(ret);
ret = kdbus_sanitize_attach_flags(pattach_owner ? *pattach_owner : 0,
&attach_owner);
if (ret < 0)
return ERR_PTR(ret);
ret = kdbus_verify_uid_prefix(name, domain->user_namespace, uid);
if (ret < 0)
return ERR_PTR(ret);
b = kzalloc(sizeof(*b), GFP_KERNEL);
if (!b)
return ERR_PTR(-ENOMEM);
kdbus_node_init(&b->node, KDBUS_NODE_BUS);
b->node.free_cb = kdbus_bus_free;
b->node.release_cb = kdbus_bus_release;
b->node.uid = uid;
b->node.gid = gid;
b->node.mode = S_IRUSR | S_IXUSR;
if (flags & (KDBUS_MAKE_ACCESS_GROUP | KDBUS_MAKE_ACCESS_WORLD))
b->node.mode |= S_IRGRP | S_IXGRP;
if (flags & KDBUS_MAKE_ACCESS_WORLD)
b->node.mode |= S_IROTH | S_IXOTH;
b->id = atomic64_inc_return(&domain->last_id);
b->bus_flags = flags;
b->attach_flags_req = attach_recv;
b->attach_flags_owner = attach_owner;
generate_random_uuid(b->id128);
b->bloom = *bloom;
b->domain = kdbus_domain_ref(domain);
kdbus_policy_db_init(&b->policy_db);
init_rwsem(&b->conn_rwlock);
hash_init(b->conn_hash);
INIT_LIST_HEAD(&b->monitors_list);
INIT_LIST_HEAD(&b->notify_list);
spin_lock_init(&b->notify_lock);
mutex_init(&b->notify_flush_lock);
ret = kdbus_node_link(&b->node, &domain->node, name);
if (ret < 0)
goto exit_unref;
/* cache the metadata/credentials of the creator */
b->creator_meta = kdbus_meta_proc_new();
if (IS_ERR(b->creator_meta)) {
ret = PTR_ERR(b->creator_meta);
b->creator_meta = NULL;
goto exit_unref;
}
ret = kdbus_meta_proc_collect(b->creator_meta,
KDBUS_ATTACH_CREDS |
KDBUS_ATTACH_PIDS |
KDBUS_ATTACH_AUXGROUPS |
KDBUS_ATTACH_TID_COMM |
KDBUS_ATTACH_PID_COMM |
KDBUS_ATTACH_EXE |
KDBUS_ATTACH_CMDLINE |
KDBUS_ATTACH_CGROUP |
KDBUS_ATTACH_CAPS |
KDBUS_ATTACH_SECLABEL |
KDBUS_ATTACH_AUDIT);
if (ret < 0)
goto exit_unref;
b->name_registry = kdbus_name_registry_new();
if (IS_ERR(b->name_registry)) {
ret = PTR_ERR(b->name_registry);
b->name_registry = NULL;
goto exit_unref;
}
/*
* Bus-limits of the creator are accounted on its real UID, just like
* all other per-user limits.
*/
b->creator = kdbus_user_lookup(domain, current_uid());
if (IS_ERR(b->creator)) {
ret = PTR_ERR(b->creator);
b->creator = NULL;
goto exit_unref;
}
return b;
exit_unref:
kdbus_node_deactivate(&b->node);
kdbus_node_unref(&b->node);
return ERR_PTR(ret);
}
/**
* kdbus_bus_ref() - increase the reference counter of a kdbus_bus
* @bus: The bus to reference
*
* Every user of a bus, except for its creator, must add a reference to the
* kdbus_bus using this function.
*
* Return: the bus itself
*/
struct kdbus_bus *kdbus_bus_ref(struct kdbus_bus *bus)
{
if (bus)
kdbus_node_ref(&bus->node);
return bus;
}
/**
* kdbus_bus_unref() - decrease the reference counter of a kdbus_bus
* @bus: The bus to unref
*
* Release a reference. If the reference count drops to 0, the bus will be
* freed.
*
* Return: NULL
*/
struct kdbus_bus *kdbus_bus_unref(struct kdbus_bus *bus)
{
if (bus)
kdbus_node_unref(&bus->node);
return NULL;
}
/**
* kdbus_bus_find_conn_by_id() - find a connection with a given id
* @bus: The bus to look for the connection
* @id: The 64-bit connection id
*
* Looks up a connection with a given id. The returned connection
* is ref'ed, and needs to be unref'ed by the user. Returns NULL if
* the connection can't be found.
*/
struct kdbus_conn *kdbus_bus_find_conn_by_id(struct kdbus_bus *bus, u64 id)
{
struct kdbus_conn *conn, *found = NULL;
down_read(&bus->conn_rwlock);
hash_for_each_possible(bus->conn_hash, conn, hentry, id)
if (conn->id == id) {
found = kdbus_conn_ref(conn);
break;
}
up_read(&bus->conn_rwlock);
return found;
}
/**
* kdbus_bus_broadcast() - send a message to all subscribed connections
* @bus: The bus the connections are connected to
* @conn_src: The source connection, may be %NULL for kernel notifications
* @kmsg: The message to send.
*
* Send @kmsg to all connections that are currently active on the bus.
* Connections must still have matches installed in order to let the message
* pass.
*
* The caller must hold the name-registry lock of @bus.
*/
void kdbus_bus_broadcast(struct kdbus_bus *bus,
struct kdbus_conn *conn_src,
struct kdbus_kmsg *kmsg)
{
struct kdbus_conn *conn_dst;
unsigned int i;
int ret;
lockdep_assert_held(&bus->name_registry->rwlock);
/*
* Make sure broadcast are queued on monitors before we send it out to
* anyone else. Otherwise, connections might react to broadcasts before
* the monitor gets the broadcast queued. In the worst case, the
* monitor sees a reaction to the broadcast before the broadcast itself.
* We don't give ordering guarantees across connections (and monitors
* can re-construct order via sequence numbers), but we should at least
* try to avoid re-ordering for monitors.
*/
kdbus_bus_eavesdrop(bus, conn_src, kmsg);
down_read(&bus->conn_rwlock);
hash_for_each(bus->conn_hash, i, conn_dst, hentry) {
if (conn_dst->id == kmsg->msg.src_id)
continue;
if (!kdbus_conn_is_ordinary(conn_dst))
continue;
/*
* Check if there is a match for the kmsg object in
* the destination connection match db
*/
if (!kdbus_match_db_match_kmsg(conn_dst->match_db, conn_src,
kmsg))
continue;
if (conn_src) {
/*
* Anyone can send broadcasts, as they have no
* destination. But a receiver needs TALK access to
* the sender in order to receive broadcasts.
*/
if (!kdbus_conn_policy_talk(conn_dst, NULL, conn_src))
continue;
ret = kdbus_kmsg_collect_metadata(kmsg, conn_src,
conn_dst);
if (ret < 0) {
kdbus_conn_lost_message(conn_dst);
continue;
}
} else {
/*
* Check if there is a policy db that prevents the
* destination connection from receiving this kernel
* notification
*/
if (!kdbus_conn_policy_see_notification(conn_dst, NULL,
kmsg))
continue;
}
ret = kdbus_conn_entry_insert(conn_src, conn_dst, kmsg, NULL);
if (ret < 0)
kdbus_conn_lost_message(conn_dst);
}
up_read(&bus->conn_rwlock);
}
/**
* kdbus_bus_eavesdrop() - send a message to all subscribed monitors
* @bus: The bus the monitors are connected to
* @conn_src: The source connection, may be %NULL for kernel notifications
* @kmsg: The message to send.
*
* Send @kmsg to all monitors that are currently active on the bus. Monitors
* must still have matches installed in order to let the message pass.
*
* The caller must hold the name-registry lock of @bus.
*/
void kdbus_bus_eavesdrop(struct kdbus_bus *bus,
struct kdbus_conn *conn_src,
struct kdbus_kmsg *kmsg)
{
struct kdbus_conn *conn_dst;
int ret;
/*
* Monitor connections get all messages; ignore possible errors
* when sending messages to monitor connections.
*/
lockdep_assert_held(&bus->name_registry->rwlock);
down_read(&bus->conn_rwlock);
list_for_each_entry(conn_dst, &bus->monitors_list, monitor_entry) {
if (conn_src) {
ret = kdbus_kmsg_collect_metadata(kmsg, conn_src,
conn_dst);
if (ret < 0) {
kdbus_conn_lost_message(conn_dst);
continue;
}
}
ret = kdbus_conn_entry_insert(conn_src, conn_dst, kmsg, NULL);
if (ret < 0)
kdbus_conn_lost_message(conn_dst);
}
up_read(&bus->conn_rwlock);
}
/**
* kdbus_cmd_bus_make() - handle KDBUS_CMD_BUS_MAKE
* @domain: domain to operate on
* @argp: command payload
*
* Return: NULL or newly created bus on success, ERR_PTR on failure.
*/
struct kdbus_bus *kdbus_cmd_bus_make(struct kdbus_domain *domain,
void __user *argp)
{
struct kdbus_bus *bus = NULL;
struct kdbus_cmd *cmd;
struct kdbus_ep *ep = NULL;
int ret;
struct kdbus_arg argv[] = {
{ .type = KDBUS_ITEM_NEGOTIATE },
{ .type = KDBUS_ITEM_MAKE_NAME, .mandatory = true },
{ .type = KDBUS_ITEM_BLOOM_PARAMETER, .mandatory = true },
{ .type = KDBUS_ITEM_ATTACH_FLAGS_SEND },
{ .type = KDBUS_ITEM_ATTACH_FLAGS_RECV },
};
struct kdbus_args args = {
.allowed_flags = KDBUS_FLAG_NEGOTIATE |
KDBUS_MAKE_ACCESS_GROUP |
KDBUS_MAKE_ACCESS_WORLD,
.argv = argv,
.argc = ARRAY_SIZE(argv),
};
ret = kdbus_args_parse(&args, argp, &cmd);
if (ret < 0)
return ERR_PTR(ret);
if (ret > 0)
return NULL;
bus = kdbus_bus_new(domain,
argv[1].item->str, &argv[2].item->bloom_parameter,
argv[3].item ? argv[3].item->data64 : NULL,
argv[4].item ? argv[4].item->data64 : NULL,
cmd->flags, current_euid(), current_egid());
if (IS_ERR(bus)) {
ret = PTR_ERR(bus);
bus = NULL;
goto exit;
}
if (atomic_inc_return(&bus->creator->buses) > KDBUS_USER_MAX_BUSES) {
atomic_dec(&bus->creator->buses);
ret = -EMFILE;
goto exit;
}
if (!kdbus_node_activate(&bus->node)) {
atomic_dec(&bus->creator->buses);
ret = -ESHUTDOWN;
goto exit;
}
ep = kdbus_ep_new(bus, "bus", cmd->flags, bus->node.uid, bus->node.gid,
false);
if (IS_ERR(ep)) {
ret = PTR_ERR(ep);
ep = NULL;
goto exit;
}
if (!kdbus_node_activate(&ep->node)) {
ret = -ESHUTDOWN;
goto exit;
}
/*
* Drop our own reference, effectively causing the endpoint to be
* deactivated and released when the parent bus is.
*/
ep = kdbus_ep_unref(ep);
exit:
ret = kdbus_args_clear(&args, ret);
if (ret < 0) {
if (ep) {
kdbus_node_deactivate(&ep->node);
kdbus_ep_unref(ep);
}
if (bus) {
kdbus_node_deactivate(&bus->node);
kdbus_bus_unref(bus);
}
return ERR_PTR(ret);
}
return bus;
}
/**
* kdbus_cmd_bus_creator_info() - handle KDBUS_CMD_BUS_CREATOR_INFO
* @conn: connection to operate on
* @argp: command payload
*
* Return: >=0 on success, negative error code on failure.
*/
int kdbus_cmd_bus_creator_info(struct kdbus_conn *conn, void __user *argp)
{
struct kdbus_cmd_info *cmd;
struct kdbus_bus *bus = conn->ep->bus;
struct kdbus_pool_slice *slice = NULL;
struct kdbus_item_header item_hdr;
struct kdbus_info info = {};
size_t meta_size, name_len;
struct kvec kvec[5];
u64 hdr_size = 0;
u64 attach_flags;
size_t cnt = 0;
int ret;
struct kdbus_arg argv[] = {
{ .type = KDBUS_ITEM_NEGOTIATE },
};
struct kdbus_args args = {
.allowed_flags = KDBUS_FLAG_NEGOTIATE,
.argv = argv,
.argc = ARRAY_SIZE(argv),
};
ret = kdbus_args_parse(&args, argp, &cmd);
if (ret != 0)
return ret;
ret = kdbus_sanitize_attach_flags(cmd->attach_flags, &attach_flags);
if (ret < 0)
goto exit;
attach_flags &= bus->attach_flags_owner;
ret = kdbus_meta_export_prepare(bus->creator_meta, NULL,
&attach_flags, &meta_size);
if (ret < 0)
goto exit;
name_len = strlen(bus->node.name) + 1;
info.id = bus->id;
info.flags = bus->bus_flags;
item_hdr.type = KDBUS_ITEM_MAKE_NAME;
item_hdr.size = KDBUS_ITEM_HEADER_SIZE + name_len;
kdbus_kvec_set(&kvec[cnt++], &info, sizeof(info), &hdr_size);
kdbus_kvec_set(&kvec[cnt++], &item_hdr, sizeof(item_hdr), &hdr_size);
kdbus_kvec_set(&kvec[cnt++], bus->node.name, name_len, &hdr_size);
cnt += !!kdbus_kvec_pad(&kvec[cnt], &hdr_size);
slice = kdbus_pool_slice_alloc(conn->pool, hdr_size + meta_size, false);
if (IS_ERR(slice)) {
ret = PTR_ERR(slice);
slice = NULL;
goto exit;
}
ret = kdbus_meta_export(bus->creator_meta, NULL, attach_flags,
slice, hdr_size, &meta_size);
if (ret < 0)
goto exit;
info.size = hdr_size + meta_size;
ret = kdbus_pool_slice_copy_kvec(slice, 0, kvec, cnt, hdr_size);
if (ret < 0)
goto exit;
kdbus_pool_slice_publish(slice, &cmd->offset, &cmd->info_size);
if (kdbus_member_set_user(&cmd->offset, argp, typeof(*cmd), offset) ||
kdbus_member_set_user(&cmd->info_size, argp,
typeof(*cmd), info_size))
ret = -EFAULT;
exit:
kdbus_pool_slice_release(slice);
return kdbus_args_clear(&args, ret);
}
| TeamFahQ/kernel_linux_next | ipc/kdbus/bus.c | C | gpl-2.0 | 14,169 |
/* ====================================================================
* 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.apache.jcc;
public class PythonVM {
static protected PythonVM vm;
static {
System.loadLibrary("jcc");
}
static public PythonVM start(String programName, String[] args)
{
if (vm == null)
{
vm = new PythonVM();
vm.init(programName, args);
}
return vm;
}
static public PythonVM start(String programName)
{
return start(programName, null);
}
static public PythonVM get()
{
return vm;
}
protected PythonVM()
{
}
protected native void init(String programName, String[] args);
public native Object instantiate(String moduleName, String className)
throws PythonException;
}
| adamdoupe/enemy-of-the-state | jcc/java/org/apache/jcc/PythonVM.java | Java | gpl-2.0 | 1,466 |
/*
* 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.
*/
package org.apache.commons.math.analysis.interpolation;
import org.apache.commons.math.MathException;
import org.apache.commons.math.exception.NonMonotonousSequenceException;
import org.apache.commons.math.exception.DimensionMismatchException;
import org.apache.commons.math.exception.NumberIsTooSmallException;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.junit.Assert;
import org.junit.Test;
/**
* Test the LinearInterpolator.
*/
public class LinearInterpolatorTest {
/** error tolerance for spline interpolator value at knot points */
protected double knotTolerance = 1E-12;
/** error tolerance for interpolating polynomial coefficients */
protected double coefficientTolerance = 1E-6;
/** error tolerance for interpolated values */
protected double interpolationTolerance = 1E-12;
@Test
public void testInterpolateLinearDegenerateTwoSegment()
throws Exception {
double x[] = { 0.0, 0.5, 1.0 };
double y[] = { 0.0, 0.5, 1.0 };
UnivariateRealInterpolator i = new LinearInterpolator();
UnivariateRealFunction f = i.interpolate(x, y);
verifyInterpolation(f, x, y);
// Verify coefficients using analytical values
PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
double target[] = {y[0], 1d};
TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);
target = new double[]{y[1], 1d};
TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
// Check interpolation
Assert.assertEquals(0.0,f.value(0.0), interpolationTolerance);
Assert.assertEquals(0.4,f.value(0.4), interpolationTolerance);
Assert.assertEquals(1.0,f.value(1.0), interpolationTolerance);
}
@Test
public void testInterpolateLinearDegenerateThreeSegment()
throws Exception {
double x[] = { 0.0, 0.5, 1.0, 1.5 };
double y[] = { 0.0, 0.5, 1.0, 1.5 };
UnivariateRealInterpolator i = new LinearInterpolator();
UnivariateRealFunction f = i.interpolate(x, y);
verifyInterpolation(f, x, y);
// Verify coefficients using analytical values
PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
double target[] = {y[0], 1d};
TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);
target = new double[]{y[1], 1d};
TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
target = new double[]{y[2], 1d};
TestUtils.assertEquals(polynomials[2].getCoefficients(), target, coefficientTolerance);
// Check interpolation
Assert.assertEquals(0,f.value(0), interpolationTolerance);
Assert.assertEquals(1.4,f.value(1.4), interpolationTolerance);
Assert.assertEquals(1.5,f.value(1.5), interpolationTolerance);
}
@Test
public void testInterpolateLinear() throws Exception {
double x[] = { 0.0, 0.5, 1.0 };
double y[] = { 0.0, 0.5, 0.0 };
UnivariateRealInterpolator i = new LinearInterpolator();
UnivariateRealFunction f = i.interpolate(x, y);
verifyInterpolation(f, x, y);
// Verify coefficients using analytical values
PolynomialFunction polynomials[] = ((PolynomialSplineFunction) f).getPolynomials();
double target[] = {y[0], 1d};
TestUtils.assertEquals(polynomials[0].getCoefficients(), target, coefficientTolerance);
target = new double[]{y[1], -1d};
TestUtils.assertEquals(polynomials[1].getCoefficients(), target, coefficientTolerance);
}
@Test
public void testIllegalArguments() throws MathException {
// Data set arrays of different size.
UnivariateRealInterpolator i = new LinearInterpolator();
try {
double xval[] = { 0.0, 1.0 };
double yval[] = { 0.0, 1.0, 2.0 };
i.interpolate(xval, yval);
Assert.fail("Failed to detect data set array with different sizes.");
} catch (DimensionMismatchException iae) {
// Expected.
}
// X values not sorted.
try {
double xval[] = { 0.0, 1.0, 0.5 };
double yval[] = { 0.0, 1.0, 2.0 };
i.interpolate(xval, yval);
Assert.fail("Failed to detect unsorted arguments.");
} catch (NonMonotonousSequenceException iae) {
// Expected.
}
// Not enough data to interpolate.
try {
double xval[] = { 0.0 };
double yval[] = { 0.0 };
i.interpolate(xval, yval);
Assert.fail("Failed to detect unsorted arguments.");
} catch (NumberIsTooSmallException iae) {
// Expected.
}
}
/**
* verifies that f(x[i]) = y[i] for i = 0..n-1 where n is common length.
*/
protected void verifyInterpolation(UnivariateRealFunction f, double x[], double y[])
throws Exception{
for (int i = 0; i < x.length; i++) {
Assert.assertEquals(f.value(x[i]), y[i], knotTolerance);
}
}
}
| SpoonLabs/astor | examples/math_63/src/test/java/org/apache/commons/math/analysis/interpolation/LinearInterpolatorTest.java | Java | gpl-2.0 | 6,231 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Wirecloud 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 Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with Wirecloud. If not, see <http://www.gnu.org/licenses/>.
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext as _
class Application(models.Model):
client_id = models.CharField(_('Client ID'), max_length=40, blank=False, primary_key=True)
client_secret = models.CharField(_('Client secret'), max_length=40, blank=False)
name = models.CharField(_('Application Name'), max_length=40, blank=False)
home_url = models.CharField(_('URL'), max_length=255, blank=False)
redirect_uri = models.CharField(_('Redirect URI'), max_length=255, blank=True)
def __unicode__(self):
return unicode(self.client_id)
class Code(models.Model):
client = models.ForeignKey(Application)
user = models.ForeignKey(User)
scope = models.CharField(_('Scope'), max_length=255, blank=True)
code = models.CharField(_('Code'), max_length=255, blank=False)
creation_timestamp = models.CharField(_('Creation timestamp'), max_length=40, blank=False)
expires_in = models.CharField(_('Expires in'), max_length=40, blank=True)
class Meta:
unique_together = ('client', 'code')
def __unicode__(self):
return unicode(self.code)
class Token(models.Model):
token = models.CharField(_('Token'), max_length=40, blank=False, primary_key=True)
client = models.ForeignKey(Application)
user = models.ForeignKey(User)
scope = models.CharField(_('Scope'), max_length=255, blank=True)
token_type = models.CharField(_('Token type'), max_length=10, blank=False)
refresh_token = models.CharField(_('Refresh token'), max_length=40, blank=True)
creation_timestamp = models.CharField(_('Creation timestamp'), max_length=40, blank=False)
expires_in = models.CharField(_('Expires in'), max_length=40, blank=True)
def __unicode__(self):
return unicode(self.token)
@receiver(post_save, sender=Application)
def invalidate_tokens_on_change(sender, instance, created, raw, **kwargs):
if created is False:
instance.token_set.all().update(creation_timestamp='0')
| sixuanwang/SAMSaaS | wirecloud-develop/src/wirecloud/oauth2provider/models.py | Python | gpl-2.0 | 2,919 |
///////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/popupwin.h
// Purpose: wxPopupWindow class for wxMac
// Author: Stefan Csomor
// Modified by:
// Created:
// RCS-ID: $Id: popupwin.h 65680 2010-09-30 11:44:45Z VZ $
// Copyright: (c) 2006 Stefan Csomor
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MAC_POPUPWIN_H_
#define _WX_MAC_POPUPWIN_H_
// ----------------------------------------------------------------------------
// wxPopupWindow
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase
{
public:
wxPopupWindow() { }
~wxPopupWindow();
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
{ (void)Create(parent, flags); }
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
virtual bool Show(bool show);
protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow)
};
#endif // _WX_MAC_POPUPWIN_H_
| NullNoname/dolphin | Externals/wxWidgets3/include/wx/osx/popupwin.h | C | gpl-2.0 | 1,090 |
/*
* CPUFreq sakuractive governor
*
* Copyright (C) 2011 sakuramilk <c.sakuramilk@gmail.com>
*
* Based on hotplug governor
* Copyright (C) 2010 Texas Instruments, Inc.
* Mike Turquette <mturquette@ti.com>
* Santosh Shilimkar <santosh.shilimkar@ti.com>
*
* Based on ondemand governor
* Copyright (C) 2001 Russell King
* (C) 2003 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
* Jun Nakajima <jun.nakajima@intel.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/cpu.h>
#include <linux/jiffies.h>
#include <linux/kernel_stat.h>
#include <linux/mutex.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/ktime.h>
#include <linux/sched.h>
#include <linux/err.h>
#include <linux/slab.h>
/* greater than 80% avg load across online CPUs increases frequency */
#define DEFAULT_UP_FREQ_MIN_LOAD (85)
/* Keep 10% of idle under the up threshold when decreasing the frequency */
#define DEFAULT_FREQ_DOWN_DIFFERENTIAL (10)
/* less than 20% avg load across online CPUs decreases frequency */
#define DEFAULT_DOWN_FREQ_MAX_LOAD (17)
/* default sampling period (uSec) is bogus; 10x ondemand's default for x86 */
#define DEFAULT_SAMPLING_PERIOD (100000)
/* default number of sampling periods to average before hotplug-in decision */
#define DEFAULT_HOTPLUG_IN_SAMPLING_PERIODS (5)
/* default number of sampling periods to average before hotplug-out decision */
#define DEFAULT_HOTPLUG_OUT_SAMPLING_PERIODS (10)
static void do_dbs_timer(struct work_struct *work);
static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event);
//static int hotplug_boost(struct cpufreq_policy *policy);
#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_SAKURACTIVE
static
#endif
struct cpufreq_governor cpufreq_gov_sakuractive = {
.name = "sakuractive",
.governor = cpufreq_governor_dbs,
.owner = THIS_MODULE,
};
struct cpu_dbs_info_s {
cputime64_t prev_cpu_idle;
cputime64_t prev_cpu_wall;
cputime64_t prev_cpu_nice;
struct cpufreq_policy *cur_policy;
struct delayed_work work;
struct work_struct cpu_up_work;
struct work_struct cpu_down_work;
struct cpufreq_frequency_table *freq_table;
int cpu;
unsigned int boost_applied;
/*
* percpu mutex that serializes governor limit change with
* do_dbs_timer invocation. We do not want do_dbs_timer to run
* when user is changing the governor or limits.
*/
struct mutex timer_mutex;
};
static DEFINE_PER_CPU(struct cpu_dbs_info_s, hp_cpu_dbs_info);
static unsigned int dbs_enable; /* number of CPUs using this policy */
/*
* dbs_mutex protects data in dbs_tuners_ins from concurrent changes on
* different CPUs. It protects dbs_enable in governor start/stop.
*/
static DEFINE_MUTEX(dbs_mutex);
static struct workqueue_struct *khotplug_wq;
static struct dbs_tuners {
unsigned int sampling_rate;
unsigned int up_threshold;
unsigned int down_differential;
unsigned int down_threshold;
unsigned int hotplug_in_sampling_periods;
unsigned int hotplug_out_sampling_periods;
unsigned int hotplug_load_index;
unsigned int *hotplug_load_history;
unsigned int ignore_nice;
unsigned int io_is_busy;
unsigned int boost_timeout;
} dbs_tuners_ins = {
.sampling_rate = DEFAULT_SAMPLING_PERIOD,
.up_threshold = DEFAULT_UP_FREQ_MIN_LOAD,
.down_differential = DEFAULT_FREQ_DOWN_DIFFERENTIAL,
.down_threshold = DEFAULT_DOWN_FREQ_MAX_LOAD,
.hotplug_in_sampling_periods = DEFAULT_HOTPLUG_IN_SAMPLING_PERIODS,
.hotplug_out_sampling_periods = DEFAULT_HOTPLUG_OUT_SAMPLING_PERIODS,
.hotplug_load_index = 0,
.ignore_nice = 0,
.io_is_busy = 0,
.boost_timeout = 0,
};
/*
* A corner case exists when switching io_is_busy at run-time: comparing idle
* times from a non-io_is_busy period to an io_is_busy period (or vice-versa)
* will misrepresent the actual change in system idleness. We ignore this
* corner case: enabling io_is_busy might cause freq increase and disabling
* might cause freq decrease, which probably matches the original intent.
*/
static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
{
u64 idle_time;
u64 iowait_time;
/* cpufreq-sakuractive always assumes CONFIG_NO_HZ */
idle_time = get_cpu_idle_time_us(cpu, wall);
/* add time spent doing I/O to idle time */
if (dbs_tuners_ins.io_is_busy) {
iowait_time = get_cpu_iowait_time_us(cpu, wall);
/* cpufreq-sakuractive always assumes CONFIG_NO_HZ */
if (iowait_time != -1ULL && idle_time >= iowait_time)
idle_time -= iowait_time;
}
return idle_time;
}
/************************** sysfs interface ************************/
/* XXX look at global sysfs macros in cpufreq.h, can those be used here? */
/* cpufreq_sakuractive Governor Tunables */
#define show_one(file_name, object) \
static ssize_t show_##file_name \
(struct kobject *kobj, struct attribute *attr, char *buf) \
{ \
return sprintf(buf, "%u\n", dbs_tuners_ins.object); \
}
show_one(sampling_rate, sampling_rate);
show_one(up_threshold, up_threshold);
show_one(down_differential, down_differential);
show_one(down_threshold, down_threshold);
show_one(hotplug_in_sampling_periods, hotplug_in_sampling_periods);
show_one(hotplug_out_sampling_periods, hotplug_out_sampling_periods);
show_one(ignore_nice_load, ignore_nice);
show_one(io_is_busy, io_is_busy);
show_one(boost_timeout, boost_timeout);
static ssize_t store_boost_timeout(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
mutex_lock(&dbs_mutex);
dbs_tuners_ins.boost_timeout = input;
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
mutex_lock(&dbs_mutex);
dbs_tuners_ins.sampling_rate = input;
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1 || input <= dbs_tuners_ins.down_threshold) {
return -EINVAL;
}
mutex_lock(&dbs_mutex);
dbs_tuners_ins.up_threshold = input;
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_down_differential(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1 || input >= dbs_tuners_ins.up_threshold)
return -EINVAL;
mutex_lock(&dbs_mutex);
dbs_tuners_ins.down_differential = input;
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_down_threshold(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1 || input >= dbs_tuners_ins.up_threshold) {
return -EINVAL;
}
mutex_lock(&dbs_mutex);
dbs_tuners_ins.down_threshold = input;
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_hotplug_in_sampling_periods(struct kobject *a,
struct attribute *b, const char *buf, size_t count)
{
unsigned int input;
unsigned int *temp;
unsigned int max_windows;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
/* already using this value, bail out */
if (input == dbs_tuners_ins.hotplug_in_sampling_periods)
return count;
mutex_lock(&dbs_mutex);
ret = count;
max_windows = max(dbs_tuners_ins.hotplug_in_sampling_periods,
dbs_tuners_ins.hotplug_out_sampling_periods);
/* no need to resize array */
if (input <= max_windows) {
dbs_tuners_ins.hotplug_in_sampling_periods = input;
goto out;
}
/* resize array */
temp = kmalloc((sizeof(unsigned int) * input), GFP_KERNEL);
if (!temp || IS_ERR(temp)) {
ret = -ENOMEM;
goto out;
}
memcpy(temp, dbs_tuners_ins.hotplug_load_history,
(max_windows * sizeof(unsigned int)));
kfree(dbs_tuners_ins.hotplug_load_history);
/* replace old buffer, old number of sampling periods & old index */
dbs_tuners_ins.hotplug_load_history = temp;
dbs_tuners_ins.hotplug_in_sampling_periods = input;
dbs_tuners_ins.hotplug_load_index = max_windows;
out:
mutex_unlock(&dbs_mutex);
return ret;
}
static ssize_t store_hotplug_out_sampling_periods(struct kobject *a,
struct attribute *b, const char *buf, size_t count)
{
unsigned int input;
unsigned int *temp;
unsigned int max_windows;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
/* already using this value, bail out */
if (input == dbs_tuners_ins.hotplug_out_sampling_periods)
return count;
mutex_lock(&dbs_mutex);
ret = count;
max_windows = max(dbs_tuners_ins.hotplug_in_sampling_periods,
dbs_tuners_ins.hotplug_out_sampling_periods);
/* no need to resize array */
if (input <= max_windows) {
dbs_tuners_ins.hotplug_out_sampling_periods = input;
goto out;
}
/* resize array */
temp = kmalloc((sizeof(unsigned int) * input), GFP_KERNEL);
if (!temp || IS_ERR(temp)) {
ret = -ENOMEM;
goto out;
}
memcpy(temp, dbs_tuners_ins.hotplug_load_history,
(max_windows * sizeof(unsigned int)));
kfree(dbs_tuners_ins.hotplug_load_history);
/* replace old buffer, old number of sampling periods & old index */
dbs_tuners_ins.hotplug_load_history = temp;
dbs_tuners_ins.hotplug_out_sampling_periods = input;
dbs_tuners_ins.hotplug_load_index = max_windows;
out:
mutex_unlock(&dbs_mutex);
return ret;
}
static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
unsigned int j;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
if (input > 1)
input = 1;
mutex_lock(&dbs_mutex);
if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
mutex_unlock(&dbs_mutex);
return count;
}
dbs_tuners_ins.ignore_nice = input;
/* we need to re-evaluate prev_cpu_idle */
for_each_online_cpu(j) {
struct cpu_dbs_info_s *dbs_info;
dbs_info = &per_cpu(hp_cpu_dbs_info, j);
dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
&dbs_info->prev_cpu_wall);
if (dbs_tuners_ins.ignore_nice)
dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
}
mutex_unlock(&dbs_mutex);
return count;
}
static ssize_t store_io_is_busy(struct kobject *a, struct attribute *b,
const char *buf, size_t count)
{
unsigned int input;
int ret;
ret = sscanf(buf, "%u", &input);
if (ret != 1)
return -EINVAL;
mutex_lock(&dbs_mutex);
dbs_tuners_ins.io_is_busy = !!input;
mutex_unlock(&dbs_mutex);
return count;
}
define_one_global_rw(sampling_rate);
define_one_global_rw(up_threshold);
define_one_global_rw(down_differential);
define_one_global_rw(down_threshold);
define_one_global_rw(hotplug_in_sampling_periods);
define_one_global_rw(hotplug_out_sampling_periods);
define_one_global_rw(ignore_nice_load);
define_one_global_rw(io_is_busy);
define_one_global_rw(boost_timeout);
static struct attribute *dbs_attributes[] = {
&sampling_rate.attr,
&up_threshold.attr,
&down_differential.attr,
&down_threshold.attr,
&hotplug_in_sampling_periods.attr,
&hotplug_out_sampling_periods.attr,
&ignore_nice_load.attr,
&io_is_busy.attr,
&boost_timeout.attr,
NULL
};
static struct attribute_group dbs_attr_group = {
.attrs = dbs_attributes,
.name = "sakuractive",
};
/************************** sysfs end ************************/
static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
{
/* combined load of all enabled CPUs */
unsigned int total_load = 0;
/* single largest CPU load percentage*/
unsigned int max_load = 0;
/* largest CPU load in terms of frequency */
unsigned int max_load_freq = 0;
/* average load across all enabled CPUs */
unsigned int avg_load = 0;
/* average load across multiple sampling periods for hotplug events */
unsigned int hotplug_in_avg_load = 0;
unsigned int hotplug_out_avg_load = 0;
/* number of sampling periods averaged for hotplug decisions */
unsigned int periods;
struct cpufreq_policy *policy;
unsigned int i, j;
policy = this_dbs_info->cur_policy;
/*
* cpu load accounting
* get highest load, total load and average load across all CPUs
*/
for_each_cpu(j, policy->cpus) {
unsigned int load;
unsigned int idle_time, wall_time;
cputime64_t cur_wall_time, cur_idle_time;
struct cpu_dbs_info_s *j_dbs_info;
j_dbs_info = &per_cpu(hp_cpu_dbs_info, j);
/* update both cur_idle_time and cur_wall_time */
cur_idle_time = get_cpu_idle_time(j, &cur_wall_time);
/* how much wall time has passed since last iteration? */
wall_time = (unsigned int) cputime64_sub(cur_wall_time,
j_dbs_info->prev_cpu_wall);
j_dbs_info->prev_cpu_wall = cur_wall_time;
/* how much idle time has passed since last iteration? */
idle_time = (unsigned int) cputime64_sub(cur_idle_time,
j_dbs_info->prev_cpu_idle);
j_dbs_info->prev_cpu_idle = cur_idle_time;
if (unlikely(!wall_time || wall_time < idle_time))
continue;
/* load is the percentage of time not spent in idle */
load = 100 * (wall_time - idle_time) / wall_time;
/* keep track of combined load across all CPUs */
total_load += load;
/* keep track of highest single load across all CPUs */
if (load > max_load)
max_load = load;
}
/* use the max load in the OPP freq change policy */
max_load_freq = max_load * policy->cur;
/* calculate the average load across all related CPUs */
avg_load = total_load / num_online_cpus();
mutex_lock(&dbs_mutex);
/*
* hotplug load accounting
* average load over multiple sampling periods
*/
/* how many sampling periods do we use for hotplug decisions? */
periods = max(dbs_tuners_ins.hotplug_in_sampling_periods,
dbs_tuners_ins.hotplug_out_sampling_periods);
/* store avg_load in the circular buffer */
dbs_tuners_ins.hotplug_load_history[dbs_tuners_ins.hotplug_load_index]
= avg_load;
/* compute average load across in & out sampling periods */
for (i = 0, j = dbs_tuners_ins.hotplug_load_index;
i < periods; i++, j--) {
if (i < dbs_tuners_ins.hotplug_in_sampling_periods)
hotplug_in_avg_load +=
dbs_tuners_ins.hotplug_load_history[j];
if (i < dbs_tuners_ins.hotplug_out_sampling_periods)
hotplug_out_avg_load +=
dbs_tuners_ins.hotplug_load_history[j];
if (j == 0)
j = periods;
}
hotplug_in_avg_load = hotplug_in_avg_load /
dbs_tuners_ins.hotplug_in_sampling_periods;
hotplug_out_avg_load = hotplug_out_avg_load /
dbs_tuners_ins.hotplug_out_sampling_periods;
/* return to first element if we're at the circular buffer's end */
if (++dbs_tuners_ins.hotplug_load_index == periods)
dbs_tuners_ins.hotplug_load_index = 0;
/* check if auxiliary CPU is needed based on avg_load */
if (avg_load > dbs_tuners_ins.up_threshold) {
/* should we enable auxillary CPUs? */
if (num_online_cpus() < 2 && hotplug_in_avg_load >
dbs_tuners_ins.up_threshold) {
queue_work_on(this_dbs_info->cpu, khotplug_wq,
&this_dbs_info->cpu_up_work);
goto out;
}
}
/* check for frequency increase based on max_load */
if (max_load > dbs_tuners_ins.up_threshold) {
/* increase to highest frequency supported */
if (policy->cur < policy->max)
__cpufreq_driver_target(policy, policy->max,
CPUFREQ_RELATION_H);
goto out;
}
/* check for frequency decrease */
if (avg_load < dbs_tuners_ins.down_threshold) {
/* are we at the minimum frequency already? */
if (policy->cur <= policy->min) {
/* should we disable auxillary CPUs? */
if (num_online_cpus() > 1 && hotplug_out_avg_load <
dbs_tuners_ins.down_threshold) {
queue_work_on(this_dbs_info->cpu, khotplug_wq,
&this_dbs_info->cpu_down_work);
}
goto out;
}
}
/*
* go down to the lowest frequency which can sustain the load by
* keeping 30% of idle in order to not cross the up_threshold
*/
if ((max_load_freq <
(dbs_tuners_ins.up_threshold - dbs_tuners_ins.down_differential) *
policy->cur) && (policy->cur > policy->min)) {
unsigned int freq_next;
freq_next = max_load_freq /
(dbs_tuners_ins.up_threshold -
dbs_tuners_ins.down_differential);
if (freq_next < policy->min)
freq_next = policy->min;
__cpufreq_driver_target(policy, freq_next,
CPUFREQ_RELATION_L);
}
out:
mutex_unlock(&dbs_mutex);
return;
}
static void do_cpu_up(struct work_struct *work)
{
cpu_up(1);
}
static void do_cpu_down(struct work_struct *work)
{
cpu_down(1);
}
static void do_dbs_timer(struct work_struct *work)
{
struct cpu_dbs_info_s *dbs_info =
container_of(work, struct cpu_dbs_info_s, work.work);
unsigned int cpu = dbs_info->cpu;
int delay = 0;
mutex_lock(&dbs_info->timer_mutex);
if (!dbs_info->boost_applied) {
dbs_check_cpu(dbs_info);
/* We want all related CPUs to do sampling nearly on same jiffy */
delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
} else {
delay = usecs_to_jiffies(dbs_tuners_ins.boost_timeout);
dbs_info->boost_applied = 0;
if (num_online_cpus() < 2)
queue_work_on(cpu, khotplug_wq,
&dbs_info->cpu_up_work);
}
queue_delayed_work_on(cpu, khotplug_wq, &dbs_info->work, delay);
mutex_unlock(&dbs_info->timer_mutex);
}
static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
{
/* We want all related CPUs to do sampling nearly on same jiffy */
int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
delay -= jiffies % delay;
INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
INIT_WORK(&dbs_info->cpu_up_work, do_cpu_up);
INIT_WORK(&dbs_info->cpu_down_work, do_cpu_down);
if (!dbs_info->boost_applied)
delay = usecs_to_jiffies(dbs_tuners_ins.boost_timeout);
queue_delayed_work_on(dbs_info->cpu, khotplug_wq, &dbs_info->work,
delay);
}
static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
{
cancel_delayed_work_sync(&dbs_info->work);
}
static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
unsigned int event)
{
unsigned int cpu = policy->cpu;
struct cpu_dbs_info_s *this_dbs_info;
unsigned int i, j, max_periods;
int rc;
this_dbs_info = &per_cpu(hp_cpu_dbs_info, cpu);
switch (event) {
case CPUFREQ_GOV_START:
if ((!cpu_online(cpu)) || (!policy->cur))
return -EINVAL;
mutex_lock(&dbs_mutex);
dbs_enable++;
for_each_cpu(j, policy->cpus) {
struct cpu_dbs_info_s *j_dbs_info;
j_dbs_info = &per_cpu(hp_cpu_dbs_info, j);
j_dbs_info->cur_policy = policy;
j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
&j_dbs_info->prev_cpu_wall);
if (dbs_tuners_ins.ignore_nice) {
j_dbs_info->prev_cpu_nice =
kstat_cpu(j).cpustat.nice;
}
max_periods = max(DEFAULT_HOTPLUG_IN_SAMPLING_PERIODS,
DEFAULT_HOTPLUG_OUT_SAMPLING_PERIODS);
dbs_tuners_ins.hotplug_load_history = kmalloc(
(sizeof(unsigned int) * max_periods),
GFP_KERNEL);
if (!dbs_tuners_ins.hotplug_load_history) {
WARN_ON(1);
return -ENOMEM;
}
for (i = 0; i < max_periods; i++)
dbs_tuners_ins.hotplug_load_history[i] = 50;
}
this_dbs_info->cpu = cpu;
this_dbs_info->freq_table = cpufreq_frequency_get_table(cpu);
/*
* Start the timerschedule work, when this governor
* is used for first time
*/
if (dbs_enable == 1) {
rc = sysfs_create_group(cpufreq_global_kobject,
&dbs_attr_group);
if (rc) {
mutex_unlock(&dbs_mutex);
return rc;
}
}
if (!dbs_tuners_ins.boost_timeout)
dbs_tuners_ins.boost_timeout = dbs_tuners_ins.sampling_rate * 30;
mutex_unlock(&dbs_mutex);
mutex_init(&this_dbs_info->timer_mutex);
dbs_timer_init(this_dbs_info);
break;
case CPUFREQ_GOV_STOP:
dbs_timer_exit(this_dbs_info);
mutex_lock(&dbs_mutex);
mutex_destroy(&this_dbs_info->timer_mutex);
dbs_enable--;
mutex_unlock(&dbs_mutex);
if (!dbs_enable)
sysfs_remove_group(cpufreq_global_kobject,
&dbs_attr_group);
kfree(dbs_tuners_ins.hotplug_load_history);
/*
* XXX BIG CAVEAT: Stopping the governor with CPU1 offline
* will result in it remaining offline until the user onlines
* it again. It is up to the user to do this (for now).
*/
break;
case CPUFREQ_GOV_LIMITS:
mutex_lock(&this_dbs_info->timer_mutex);
if (policy->max < this_dbs_info->cur_policy->cur)
__cpufreq_driver_target(this_dbs_info->cur_policy,
policy->max, CPUFREQ_RELATION_H);
else if (policy->min > this_dbs_info->cur_policy->cur)
__cpufreq_driver_target(this_dbs_info->cur_policy,
policy->min, CPUFREQ_RELATION_L);
mutex_unlock(&this_dbs_info->timer_mutex);
break;
}
return 0;
}
#if 0
static int hotplug_boost(struct cpufreq_policy *policy)
{
unsigned int cpu = policy->cpu;
struct cpu_dbs_info_s *this_dbs_info;
this_dbs_info = &per_cpu(hp_cpu_dbs_info, cpu);
#if 0
/* Already at max? */
if (policy->cur == policy->max)
return;
#endif
mutex_lock(&this_dbs_info->timer_mutex);
this_dbs_info->boost_applied = 1;
__cpufreq_driver_target(policy, policy->max,
CPUFREQ_RELATION_H);
mutex_unlock(&this_dbs_info->timer_mutex);
return 0;
}
#endif
static int __init cpufreq_gov_dbs_init(void)
{
int err;
cputime64_t wall;
u64 idle_time;
int cpu = get_cpu();
idle_time = get_cpu_idle_time_us(cpu, &wall);
put_cpu();
if (idle_time != -1ULL) {
dbs_tuners_ins.up_threshold = DEFAULT_UP_FREQ_MIN_LOAD;
} else {
pr_err("cpufreq-sakuractive: %s: assumes CONFIG_NO_HZ\n",
__func__);
return -EINVAL;
}
khotplug_wq = create_workqueue("khotplug");
if (!khotplug_wq) {
pr_err("Creation of khotplug failed\n");
return -EFAULT;
}
err = cpufreq_register_governor(&cpufreq_gov_sakuractive);
if (err)
destroy_workqueue(khotplug_wq);
return err;
}
static void __exit cpufreq_gov_dbs_exit(void)
{
cpufreq_unregister_governor(&cpufreq_gov_sakuractive);
destroy_workqueue(khotplug_wq);
}
MODULE_AUTHOR("sakuramilk <c.sakuramilk@gmail.com>");
MODULE_DESCRIPTION("'cpufreq_sakuractive' - cpufreq governor for dynamic frequency scaling and CPU hotplug");
MODULE_LICENSE("GPL");
#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_SAKURACTIVE
fs_initcall(cpufreq_gov_dbs_init);
#else
module_init(cpufreq_gov_dbs_init);
#endif
module_exit(cpufreq_gov_dbs_exit);
| k2wl/kernel-gt-i9082-stock-based | drivers/cpufreq/cpufreq_sakuractive.c | C | gpl-2.0 | 22,646 |
/* SCTP kernel implementation
* (C) Copyright IBM Corp. 2001, 2004
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
* These functions manipulate an sctp event. The struct ulpevent is used
* to carry notifications and data to the ULP (sockets).
*
* This SCTP implementation 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.
*
* This SCTP implementation 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 CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to the
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
*
* Written or modified by:
* Jon Grimm <jgrimm@us.ibm.com>
* La Monte H.P. Yarroll <piggy@acm.org>
* Ardelle Fan <ardelle.fan@intel.com>
* Sridhar Samudrala <sri@us.ibm.com>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/skbuff.h>
#include <net/sctp/structs.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
struct sctp_association *asoc);
static void sctp_ulpevent_release_data(struct sctp_ulpevent *event);
static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event);
/* Initialize an ULP event from an given skb. */
SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event,
int msg_flags,
unsigned int len)
{
memset(event, 0, sizeof(struct sctp_ulpevent));
event->msg_flags = msg_flags;
event->rmem_len = len;
}
/* Create a new sctp_ulpevent. */
SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags,
gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sk_buff *skb;
skb = alloc_skb(size, gfp);
if (!skb)
goto fail;
event = sctp_skb2event(skb);
sctp_ulpevent_init(event, msg_flags, skb->truesize);
return event;
fail:
return NULL;
}
/* Is this a MSG_NOTIFICATION? */
int sctp_ulpevent_is_notification(const struct sctp_ulpevent *event)
{
return MSG_NOTIFICATION == (event->msg_flags & MSG_NOTIFICATION);
}
/* Hold the association in case the msg_name needs read out of
* the association.
*/
static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event,
const struct sctp_association *asoc)
{
struct sk_buff *skb;
/* Cast away the const, as we are just wanting to
* bump the reference count.
*/
sctp_association_hold((struct sctp_association *)asoc);
skb = sctp_event2skb(event);
event->asoc = (struct sctp_association *)asoc;
atomic_add(event->rmem_len, &event->asoc->rmem_alloc);
sctp_skb_set_owner_r(skb, asoc->base.sk);
}
/* A simple destructor to give up the reference to the association. */
static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
{
struct sctp_association *asoc = event->asoc;
atomic_sub(event->rmem_len, &asoc->rmem_alloc);
sctp_association_put(asoc);
}
/* Create and initialize an SCTP_ASSOC_CHANGE event.
*
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* Communication notifications inform the ULP that an SCTP association
* has either begun or ended. The identifier for a new association is
* provided by this notification.
*
* Note: There is no field checking here. If a field is unused it will be
* zero'd out.
*/
struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
const struct sctp_association *asoc,
__u16 flags, __u16 state, __u16 error, __u16 outbound,
__u16 inbound, struct sctp_chunk *chunk, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_assoc_change *sac;
struct sk_buff *skb;
/* If the lower layer passed in the chunk, it will be
* an ABORT, so we need to include it in the sac_info.
*/
if (chunk) {
/* Copy the chunk data to a new skb and reserve enough
* head room to use as notification.
*/
skb = skb_copy_expand(chunk->skb,
sizeof(struct sctp_assoc_change), 0, gfp);
if (!skb)
goto fail;
/* Embed the event fields inside the cloned skb. */
event = sctp_skb2event(skb);
sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
/* Include the notification structure */
sac = (struct sctp_assoc_change *)
skb_push(skb, sizeof(struct sctp_assoc_change));
/* Trim the buffer to the right length. */
skb_trim(skb, sizeof(struct sctp_assoc_change) +
ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t));
} else {
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
sac = (struct sctp_assoc_change *) skb_put(skb,
sizeof(struct sctp_assoc_change));
}
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_type:
* It should be SCTP_ASSOC_CHANGE.
*/
sac->sac_type = SCTP_ASSOC_CHANGE;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_state: 32 bits (signed integer)
* This field holds one of a number of values that communicate the
* event that happened to the association.
*/
sac->sac_state = state;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_flags: 16 bits (unsigned integer)
* Currently unused.
*/
sac->sac_flags = 0;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_length: sizeof (__u32)
* This field is the total length of the notification data, including
* the notification header.
*/
sac->sac_length = skb->len;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_error: 32 bits (signed integer)
*
* If the state was reached due to a error condition (e.g.
* COMMUNICATION_LOST) any relevant error information is available in
* this field. This corresponds to the protocol error codes defined in
* [SCTP].
*/
sac->sac_error = error;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_outbound_streams: 16 bits (unsigned integer)
* sac_inbound_streams: 16 bits (unsigned integer)
*
* The maximum number of streams allowed in each direction are
* available in sac_outbound_streams and sac_inbound streams.
*/
sac->sac_outbound_streams = outbound;
sac->sac_inbound_streams = inbound;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* sac_assoc_id: sizeof (sctp_assoc_t)
*
* The association id field, holds the identifier for the association.
* All notifications for a given association have the same association
* identifier. For TCP style socket, this field is ignored.
*/
sctp_ulpevent_set_owner(event, asoc);
sac->sac_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/* Create and initialize an SCTP_PEER_ADDR_CHANGE event.
*
* Socket Extensions for SCTP - draft-01
* 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* When a destination address on a multi-homed peer encounters a change
* an interface details event is sent.
*/
struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
const struct sctp_association *asoc,
const struct sockaddr_storage *aaddr,
int flags, int state, int error, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_paddr_change *spc;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_paddr_change),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
spc = (struct sctp_paddr_change *)
skb_put(skb, sizeof(struct sctp_paddr_change));
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_type:
*
* It should be SCTP_PEER_ADDR_CHANGE.
*/
spc->spc_type = SCTP_PEER_ADDR_CHANGE;
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_length: sizeof (__u32)
*
* This field is the total length of the notification data, including
* the notification header.
*/
spc->spc_length = sizeof(struct sctp_paddr_change);
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_flags: 16 bits (unsigned integer)
* Currently unused.
*/
spc->spc_flags = 0;
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_state: 32 bits (signed integer)
*
* This field holds one of a number of values that communicate the
* event that happened to the address.
*/
spc->spc_state = state;
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_error: 32 bits (signed integer)
*
* If the state was reached due to any error condition (e.g.
* ADDRESS_UNREACHABLE) any relevant error information is available in
* this field.
*/
spc->spc_error = error;
/* Socket Extensions for SCTP
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
* spc_assoc_id: sizeof (sctp_assoc_t)
*
* The association id field, holds the identifier for the association.
* All notifications for a given association have the same association
* identifier. For TCP style socket, this field is ignored.
*/
sctp_ulpevent_set_owner(event, asoc);
spc->spc_assoc_id = sctp_assoc2id(asoc);
/* Sockets API Extensions for SCTP
* Section 5.3.1.2 SCTP_PEER_ADDR_CHANGE
*
* spc_aaddr: sizeof (struct sockaddr_storage)
*
* The affected address field, holds the remote peer's address that is
* encountering the change of state.
*/
memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage));
/* Map ipv4 address into v4-mapped-on-v6 address. */
sctp_get_pf_specific(asoc->base.sk->sk_family)->addr_v4map(
sctp_sk(asoc->base.sk),
(union sctp_addr *)&spc->spc_aaddr);
return event;
fail:
return NULL;
}
/* Create and initialize an SCTP_REMOTE_ERROR notification.
*
* Note: This assumes that the chunk->skb->data already points to the
* operation error payload.
*
* Socket Extensions for SCTP - draft-01
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* A remote peer may send an Operational Error message to its peer.
* This message indicates a variety of error conditions on an
* association. The entire error TLV as it appears on the wire is
* included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
* specification [SCTP] and any extensions for a list of possible
* error formats.
*/
struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
const struct sctp_association *asoc, struct sctp_chunk *chunk,
__u16 flags, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_remote_error *sre;
struct sk_buff *skb;
sctp_errhdr_t *ch;
__be16 cause;
int elen;
ch = (sctp_errhdr_t *)(chunk->skb->data);
cause = ch->cause;
elen = WORD_ROUND(ntohs(ch->length)) - sizeof(sctp_errhdr_t);
/* Pull off the ERROR header. */
skb_pull(chunk->skb, sizeof(sctp_errhdr_t));
/* Copy the skb to a new skb with room for us to prepend
* notification with.
*/
skb = skb_copy_expand(chunk->skb, sizeof(struct sctp_remote_error),
0, gfp);
/* Pull off the rest of the cause TLV from the chunk. */
skb_pull(chunk->skb, elen);
if (!skb)
goto fail;
/* Embed the event fields inside the cloned skb. */
event = sctp_skb2event(skb);
sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
sre = (struct sctp_remote_error *)
skb_push(skb, sizeof(struct sctp_remote_error));
/* Trim the buffer to the right length. */
skb_trim(skb, sizeof(struct sctp_remote_error) + elen);
/* Socket Extensions for SCTP
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* sre_type:
* It should be SCTP_REMOTE_ERROR.
*/
sre->sre_type = SCTP_REMOTE_ERROR;
/*
* Socket Extensions for SCTP
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* sre_flags: 16 bits (unsigned integer)
* Currently unused.
*/
sre->sre_flags = 0;
/* Socket Extensions for SCTP
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* sre_length: sizeof (__u32)
*
* This field is the total length of the notification data,
* including the notification header.
*/
sre->sre_length = skb->len;
/* Socket Extensions for SCTP
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* sre_error: 16 bits (unsigned integer)
* This value represents one of the Operational Error causes defined in
* the SCTP specification, in network byte order.
*/
sre->sre_error = cause;
/* Socket Extensions for SCTP
* 5.3.1.3 SCTP_REMOTE_ERROR
*
* sre_assoc_id: sizeof (sctp_assoc_t)
*
* The association id field, holds the identifier for the association.
* All notifications for a given association have the same association
* identifier. For TCP style socket, this field is ignored.
*/
sctp_ulpevent_set_owner(event, asoc);
sre->sre_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/* Create and initialize a SCTP_SEND_FAILED notification.
*
* Socket Extensions for SCTP - draft-01
* 5.3.1.4 SCTP_SEND_FAILED
*/
struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
const struct sctp_association *asoc, struct sctp_chunk *chunk,
__u16 flags, __u32 error, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_send_failed *ssf;
struct sk_buff *skb;
/* Pull off any padding. */
int len = ntohs(chunk->chunk_hdr->length);
/* Make skb with more room so we can prepend notification. */
skb = skb_copy_expand(chunk->skb,
sizeof(struct sctp_send_failed), /* headroom */
0, /* tailroom */
gfp);
if (!skb)
goto fail;
/* Pull off the common chunk header and DATA header. */
skb_pull(skb, sizeof(struct sctp_data_chunk));
len -= sizeof(struct sctp_data_chunk);
/* Embed the event fields inside the cloned skb. */
event = sctp_skb2event(skb);
sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
ssf = (struct sctp_send_failed *)
skb_push(skb, sizeof(struct sctp_send_failed));
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_type:
* It should be SCTP_SEND_FAILED.
*/
ssf->ssf_type = SCTP_SEND_FAILED;
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_flags: 16 bits (unsigned integer)
* The flag value will take one of the following values
*
* SCTP_DATA_UNSENT - Indicates that the data was never put on
* the wire.
*
* SCTP_DATA_SENT - Indicates that the data was put on the wire.
* Note that this does not necessarily mean that the
* data was (or was not) successfully delivered.
*/
ssf->ssf_flags = flags;
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_length: sizeof (__u32)
* This field is the total length of the notification data, including
* the notification header.
*/
ssf->ssf_length = sizeof(struct sctp_send_failed) + len;
skb_trim(skb, ssf->ssf_length);
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_error: 16 bits (unsigned integer)
* This value represents the reason why the send failed, and if set,
* will be a SCTP protocol error code as defined in [SCTP] section
* 3.3.10.
*/
ssf->ssf_error = error;
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_info: sizeof (struct sctp_sndrcvinfo)
* The original send information associated with the undelivered
* message.
*/
memcpy(&ssf->ssf_info, &chunk->sinfo, sizeof(struct sctp_sndrcvinfo));
/* Per TSVWG discussion with Randy. Allow the application to
* reassemble a fragmented message.
*/
ssf->ssf_info.sinfo_flags = chunk->chunk_hdr->flags;
/* Socket Extensions for SCTP
* 5.3.1.4 SCTP_SEND_FAILED
*
* ssf_assoc_id: sizeof (sctp_assoc_t)
* The association id field, sf_assoc_id, holds the identifier for the
* association. All notifications for a given association have the
* same association identifier. For TCP style socket, this field is
* ignored.
*/
sctp_ulpevent_set_owner(event, asoc);
ssf->ssf_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/* Create and initialize a SCTP_SHUTDOWN_EVENT notification.
*
* Socket Extensions for SCTP - draft-01
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*/
struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
const struct sctp_association *asoc,
__u16 flags, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_shutdown_event *sse;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_shutdown_event),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
sse = (struct sctp_shutdown_event *)
skb_put(skb, sizeof(struct sctp_shutdown_event));
/* Socket Extensions for SCTP
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*
* sse_type
* It should be SCTP_SHUTDOWN_EVENT
*/
sse->sse_type = SCTP_SHUTDOWN_EVENT;
/* Socket Extensions for SCTP
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*
* sse_flags: 16 bits (unsigned integer)
* Currently unused.
*/
sse->sse_flags = 0;
/* Socket Extensions for SCTP
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*
* sse_length: sizeof (__u32)
* This field is the total length of the notification data, including
* the notification header.
*/
sse->sse_length = sizeof(struct sctp_shutdown_event);
/* Socket Extensions for SCTP
* 5.3.1.5 SCTP_SHUTDOWN_EVENT
*
* sse_assoc_id: sizeof (sctp_assoc_t)
* The association id field, holds the identifier for the association.
* All notifications for a given association have the same association
* identifier. For TCP style socket, this field is ignored.
*/
sctp_ulpevent_set_owner(event, asoc);
sse->sse_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/* Create and initialize a SCTP_ADAPTATION_INDICATION notification.
*
* Socket Extensions for SCTP
* 5.3.1.6 SCTP_ADAPTATION_INDICATION
*/
struct sctp_ulpevent *sctp_ulpevent_make_adaptation_indication(
const struct sctp_association *asoc, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_adaptation_event *sai;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_adaptation_event),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
sai = (struct sctp_adaptation_event *)
skb_put(skb, sizeof(struct sctp_adaptation_event));
sai->sai_type = SCTP_ADAPTATION_INDICATION;
sai->sai_flags = 0;
sai->sai_length = sizeof(struct sctp_adaptation_event);
sai->sai_adaptation_ind = asoc->peer.adaptation_ind;
sctp_ulpevent_set_owner(event, asoc);
sai->sai_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/* A message has been received. Package this message as a notification
* to pass it to the upper layers. Go ahead and calculate the sndrcvinfo
* even if filtered out later.
*
* Socket Extensions for SCTP
* 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
*/
struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
struct sctp_chunk *chunk,
gfp_t gfp)
{
struct sctp_ulpevent *event = NULL;
struct sk_buff *skb;
size_t padding, len;
int rx_count;
/*
* check to see if we need to make space for this
* new skb, expand the rcvbuffer if needed, or drop
* the frame
*/
if (asoc->ep->rcvbuf_policy)
rx_count = atomic_read(&asoc->rmem_alloc);
else
rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);
if (rx_count >= asoc->base.sk->sk_rcvbuf) {
if ((asoc->base.sk->sk_userlocks & SOCK_RCVBUF_LOCK) ||
(!sk_rmem_schedule(asoc->base.sk, chunk->skb->truesize)))
goto fail;
}
/* Clone the original skb, sharing the data. */
skb = skb_clone(chunk->skb, gfp);
if (!skb)
goto fail;
/* Now that all memory allocations for this chunk succeeded, we
* can mark it as received so the tsn_map is updated correctly.
*/
if (sctp_tsnmap_mark(&asoc->peer.tsn_map,
ntohl(chunk->subh.data_hdr->tsn)))
goto fail_mark;
/* First calculate the padding, so we don't inadvertently
* pass up the wrong length to the user.
*
* RFC 2960 - Section 3.2 Chunk Field Descriptions
*
* The total length of a chunk(including Type, Length and Value fields)
* MUST be a multiple of 4 bytes. If the length of the chunk is not a
* multiple of 4 bytes, the sender MUST pad the chunk with all zero
* bytes and this padding is not included in the chunk length field.
* The sender should never pad with more than 3 bytes. The receiver
* MUST ignore the padding bytes.
*/
len = ntohs(chunk->chunk_hdr->length);
padding = WORD_ROUND(len) - len;
/* Fixup cloned skb with just this chunks data. */
skb_trim(skb, chunk->chunk_end - padding - skb->data);
/* Embed the event fields inside the cloned skb. */
event = sctp_skb2event(skb);
/* Initialize event with flags 0 and correct length
* Since this is a clone of the original skb, only account for
* the data of this chunk as other chunks will be accounted separately.
*/
sctp_ulpevent_init(event, 0, skb->len + sizeof(struct sk_buff));
sctp_ulpevent_receive_data(event, asoc);
event->stream = ntohs(chunk->subh.data_hdr->stream);
event->ssn = ntohs(chunk->subh.data_hdr->ssn);
event->ppid = chunk->subh.data_hdr->ppid;
if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) {
event->flags |= SCTP_UNORDERED;
event->cumtsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
}
event->tsn = ntohl(chunk->subh.data_hdr->tsn);
event->msg_flags |= chunk->chunk_hdr->flags;
event->iif = sctp_chunk_iif(chunk);
return event;
fail_mark:
kfree_skb(skb);
fail:
return NULL;
}
/* Create a partial delivery related event.
*
* 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
*
* When a receiver is engaged in a partial delivery of a
* message this notification will be used to indicate
* various events.
*/
struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
const struct sctp_association *asoc, __u32 indication,
gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_pdapi_event *pd;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_pdapi_event),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
pd = (struct sctp_pdapi_event *)
skb_put(skb, sizeof(struct sctp_pdapi_event));
/* pdapi_type
* It should be SCTP_PARTIAL_DELIVERY_EVENT
*
* pdapi_flags: 16 bits (unsigned integer)
* Currently unused.
*/
pd->pdapi_type = SCTP_PARTIAL_DELIVERY_EVENT;
pd->pdapi_flags = 0;
/* pdapi_length: 32 bits (unsigned integer)
*
* This field is the total length of the notification data, including
* the notification header. It will generally be sizeof (struct
* sctp_pdapi_event).
*/
pd->pdapi_length = sizeof(struct sctp_pdapi_event);
/* pdapi_indication: 32 bits (unsigned integer)
*
* This field holds the indication being sent to the application.
*/
pd->pdapi_indication = indication;
/* pdapi_assoc_id: sizeof (sctp_assoc_t)
*
* The association id field, holds the identifier for the association.
*/
sctp_ulpevent_set_owner(event, asoc);
pd->pdapi_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
struct sctp_ulpevent *sctp_ulpevent_make_authkey(
const struct sctp_association *asoc, __u16 key_id,
__u32 indication, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_authkey_event *ak;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_authkey_event),
MSG_NOTIFICATION, gfp);
if (!event)
goto fail;
skb = sctp_event2skb(event);
ak = (struct sctp_authkey_event *)
skb_put(skb, sizeof(struct sctp_authkey_event));
ak->auth_type = SCTP_AUTHENTICATION_EVENT;
ak->auth_flags = 0;
ak->auth_length = sizeof(struct sctp_authkey_event);
ak->auth_keynumber = key_id;
ak->auth_altkeynumber = 0;
ak->auth_indication = indication;
/*
* The association id field, holds the identifier for the association.
*/
sctp_ulpevent_set_owner(event, asoc);
ak->auth_assoc_id = sctp_assoc2id(asoc);
return event;
fail:
return NULL;
}
/*
* Socket Extensions for SCTP
* 6.3.10. SCTP_SENDER_DRY_EVENT
*/
struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
const struct sctp_association *asoc, gfp_t gfp)
{
struct sctp_ulpevent *event;
struct sctp_sender_dry_event *sdry;
struct sk_buff *skb;
event = sctp_ulpevent_new(sizeof(struct sctp_sender_dry_event),
MSG_NOTIFICATION, gfp);
if (!event)
return NULL;
skb = sctp_event2skb(event);
sdry = (struct sctp_sender_dry_event *)
skb_put(skb, sizeof(struct sctp_sender_dry_event));
sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT;
sdry->sender_dry_flags = 0;
sdry->sender_dry_length = sizeof(struct sctp_sender_dry_event);
sctp_ulpevent_set_owner(event, asoc);
sdry->sender_dry_assoc_id = sctp_assoc2id(asoc);
return event;
}
/* Return the notification type, assuming this is a notification
* event.
*/
__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
{
union sctp_notification *notification;
struct sk_buff *skb;
skb = sctp_event2skb(event);
notification = (union sctp_notification *) skb->data;
return notification->sn_header.sn_type;
}
/* Copy out the sndrcvinfo into a msghdr. */
void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
struct msghdr *msghdr)
{
struct sctp_sndrcvinfo sinfo;
if (sctp_ulpevent_is_notification(event))
return;
/* Sockets API Extensions for SCTP
* Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
*
* sinfo_stream: 16 bits (unsigned integer)
*
* For recvmsg() the SCTP stack places the message's stream number in
* this value.
*/
sinfo.sinfo_stream = event->stream;
/* sinfo_ssn: 16 bits (unsigned integer)
*
* For recvmsg() this value contains the stream sequence number that
* the remote endpoint placed in the DATA chunk. For fragmented
* messages this is the same number for all deliveries of the message
* (if more than one recvmsg() is needed to read the message).
*/
sinfo.sinfo_ssn = event->ssn;
/* sinfo_ppid: 32 bits (unsigned integer)
*
* In recvmsg() this value is
* the same information that was passed by the upper layer in the peer
* application. Please note that byte order issues are NOT accounted
* for and this information is passed opaquely by the SCTP stack from
* one end to the other.
*/
sinfo.sinfo_ppid = event->ppid;
/* sinfo_flags: 16 bits (unsigned integer)
*
* This field may contain any of the following flags and is composed of
* a bitwise OR of these values.
*
* recvmsg() flags:
*
* SCTP_UNORDERED - This flag is present when the message was sent
* non-ordered.
*/
sinfo.sinfo_flags = event->flags;
/* sinfo_tsn: 32 bit (unsigned integer)
*
* For the receiving side, this field holds a TSN that was
* assigned to one of the SCTP Data Chunks.
*/
sinfo.sinfo_tsn = event->tsn;
/* sinfo_cumtsn: 32 bit (unsigned integer)
*
* This field will hold the current cumulative TSN as
* known by the underlying SCTP layer. Note this field is
* ignored when sending and only valid for a receive
* operation when sinfo_flags are set to SCTP_UNORDERED.
*/
sinfo.sinfo_cumtsn = event->cumtsn;
/* sinfo_assoc_id: sizeof (sctp_assoc_t)
*
* The association handle field, sinfo_assoc_id, holds the identifier
* for the association announced in the COMMUNICATION_UP notification.
* All notifications for a given association have the same identifier.
* Ignored for one-to-one style sockets.
*/
sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc);
/* context value that is set via SCTP_CONTEXT socket option. */
sinfo.sinfo_context = event->asoc->default_rcv_context;
/* These fields are not used while receiving. */
sinfo.sinfo_timetolive = 0;
put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV,
sizeof(struct sctp_sndrcvinfo), (void *)&sinfo);
}
/* Do accounting for bytes received and hold a reference to the association
* for each skb.
*/
static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
struct sctp_association *asoc)
{
struct sk_buff *skb, *frag;
skb = sctp_event2skb(event);
/* Set the owner and charge rwnd for bytes received. */
sctp_ulpevent_set_owner(event, asoc);
sctp_assoc_rwnd_decrease(asoc, skb_headlen(skb));
if (!skb->data_len)
return;
/* Note: Not clearing the entire event struct as this is just a
* fragment of the real event. However, we still need to do rwnd
* accounting.
* In general, the skb passed from IP can have only 1 level of
* fragments. But we allow multiple levels of fragments.
*/
skb_walk_frags(skb, frag)
sctp_ulpevent_receive_data(sctp_skb2event(frag), asoc);
}
/* Do accounting for bytes just read by user and release the references to
* the association.
*/
static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
{
struct sk_buff *skb, *frag;
unsigned int len;
/* Current stack structures assume that the rcv buffer is
* per socket. For UDP style sockets this is not true as
* multiple associations may be on a single UDP-style socket.
* Use the local private area of the skb to track the owning
* association.
*/
skb = sctp_event2skb(event);
len = skb->len;
if (!skb->data_len)
goto done;
/* Don't forget the fragments. */
skb_walk_frags(skb, frag) {
/* NOTE: skb_shinfos are recursive. Although IP returns
* skb's with only 1 level of fragments, SCTP reassembly can
* increase the levels.
*/
sctp_ulpevent_release_frag_data(sctp_skb2event(frag));
}
done:
sctp_assoc_rwnd_increase(event->asoc, len);
sctp_ulpevent_release_owner(event);
}
static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
{
struct sk_buff *skb, *frag;
skb = sctp_event2skb(event);
if (!skb->data_len)
goto done;
/* Don't forget the fragments. */
skb_walk_frags(skb, frag) {
/* NOTE: skb_shinfos are recursive. Although IP returns
* skb's with only 1 level of fragments, SCTP reassembly can
* increase the levels.
*/
sctp_ulpevent_release_frag_data(sctp_skb2event(frag));
}
done:
sctp_ulpevent_release_owner(event);
}
/* Free a ulpevent that has an owner. It includes releasing the reference
* to the owner, updating the rwnd in case of a DATA event and freeing the
* skb.
*/
void sctp_ulpevent_free(struct sctp_ulpevent *event)
{
if (sctp_ulpevent_is_notification(event))
sctp_ulpevent_release_owner(event);
else
sctp_ulpevent_release_data(event);
kfree_skb(sctp_event2skb(event));
}
/* Purge the skb lists holding ulpevents. */
unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list)
{
struct sk_buff *skb;
unsigned int data_unread = 0;
while ((skb = skb_dequeue(list)) != NULL) {
struct sctp_ulpevent *event = sctp_skb2event(skb);
if (!sctp_ulpevent_is_notification(event))
data_unread += skb->len;
sctp_ulpevent_free(event);
}
return data_unread;
}
| jeffegg/beaglebone | net/sctp/ulpevent.c | C | gpl-2.0 | 32,388 |
/* Miscellaneous utilities for GIMPLE streaming. Things that are used
in both input and output are here.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Contributed by Doug Kwan <dougkwan@google.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "toplev.h"
#include "flags.h"
#include "hash-set.h"
#include "machmode.h"
#include "vec.h"
#include "double-int.h"
#include "input.h"
#include "alias.h"
#include "symtab.h"
#include "wide-int.h"
#include "inchash.h"
#include "tree.h"
#include "fold-const.h"
#include "predict.h"
#include "hard-reg-set.h"
#include "input.h"
#include "function.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"
#include "is-a.h"
#include "gimple.h"
#include "bitmap.h"
#include "diagnostic-core.h"
#include "hash-map.h"
#include "plugin-api.h"
#include "ipa-ref.h"
#include "cgraph.h"
#include "tree-streamer.h"
#include "lto-streamer.h"
#include "lto-section-names.h"
#include "streamer-hooks.h"
/* Statistics gathered during LTO, WPA and LTRANS. */
struct lto_stats_d lto_stats;
/* LTO uses bitmaps with different life-times. So use a separate
obstack for all LTO bitmaps. */
static bitmap_obstack lto_obstack;
static bool lto_obstack_initialized;
const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
/* Set when streaming LTO for offloading compiler. */
bool lto_stream_offload_p;
/* Return a string representing LTO tag TAG. */
const char *
lto_tag_name (enum LTO_tags tag)
{
if (lto_tag_is_tree_code_p (tag))
{
/* For tags representing tree nodes, return the name of the
associated tree code. */
return get_tree_code_name (lto_tag_to_tree_code (tag));
}
if (lto_tag_is_gimple_code_p (tag))
{
/* For tags representing gimple statements, return the name of
the associated gimple code. */
return gimple_code_name[lto_tag_to_gimple_code (tag)];
}
switch (tag)
{
case LTO_null:
return "LTO_null";
case LTO_bb0:
return "LTO_bb0";
case LTO_bb1:
return "LTO_bb1";
case LTO_eh_region:
return "LTO_eh_region";
case LTO_function:
return "LTO_function";
case LTO_eh_table:
return "LTO_eh_table";
case LTO_ert_cleanup:
return "LTO_ert_cleanup";
case LTO_ert_try:
return "LTO_ert_try";
case LTO_ert_allowed_exceptions:
return "LTO_ert_allowed_exceptions";
case LTO_ert_must_not_throw:
return "LTO_ert_must_not_throw";
case LTO_tree_pickle_reference:
return "LTO_tree_pickle_reference";
case LTO_field_decl_ref:
return "LTO_field_decl_ref";
case LTO_function_decl_ref:
return "LTO_function_decl_ref";
case LTO_label_decl_ref:
return "LTO_label_decl_ref";
case LTO_namespace_decl_ref:
return "LTO_namespace_decl_ref";
case LTO_result_decl_ref:
return "LTO_result_decl_ref";
case LTO_ssa_name_ref:
return "LTO_ssa_name_ref";
case LTO_type_decl_ref:
return "LTO_type_decl_ref";
case LTO_type_ref:
return "LTO_type_ref";
case LTO_global_decl_ref:
return "LTO_global_decl_ref";
default:
return "LTO_UNKNOWN";
}
}
/* Allocate a bitmap from heap. Initializes the LTO obstack if necessary. */
bitmap
lto_bitmap_alloc (void)
{
if (!lto_obstack_initialized)
{
bitmap_obstack_initialize (<o_obstack);
lto_obstack_initialized = true;
}
return BITMAP_ALLOC (<o_obstack);
}
/* Free bitmap B. */
void
lto_bitmap_free (bitmap b)
{
BITMAP_FREE (b);
}
/* Get a section name for a particular type or name. The NAME field
is only used if SECTION_TYPE is LTO_section_function_body. For all
others it is ignored. The callee of this function is responsible
to free the returned name. */
char *
lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f)
{
const char *add;
char post[32];
const char *sep;
if (section_type == LTO_section_function_body)
{
gcc_assert (name != NULL);
if (name[0] == '*')
name++;
add = name;
sep = "";
}
else if (section_type < LTO_N_SECTION_TYPES)
{
add = lto_section_name[section_type];
sep = ".";
}
else
internal_error ("bytecode stream: unexpected LTO section %s", name);
/* Make the section name unique so that ld -r combining sections
doesn't confuse the reader with merged sections.
For options don't add a ID, the option reader cannot deal with them
and merging should be ok here. */
if (section_type == LTO_section_opts)
strcpy (post, "");
else if (f != NULL)
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id);
else
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false));
return concat (section_name_prefix, sep, add, post, NULL);
}
/* Show various memory usage statistics related to LTO. */
void
print_lto_report (const char *s)
{
unsigned i;
fprintf (stderr, "[%s] # of input files: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files);
fprintf (stderr, "[%s] # of input cgraph nodes: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_input_cgraph_nodes);
fprintf (stderr, "[%s] # of function bodies: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_function_bodies);
for (i = 0; i < NUM_TREE_CODES; i++)
if (lto_stats.num_trees[i])
fprintf (stderr, "[%s] # of '%s' objects read: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
get_tree_code_name ((enum tree_code) i), lto_stats.num_trees[i]);
if (flag_lto)
{
fprintf (stderr, "[%s] Compression: "
HOST_WIDE_INT_PRINT_UNSIGNED " output bytes, "
HOST_WIDE_INT_PRINT_UNSIGNED " compressed bytes", s,
lto_stats.num_output_il_bytes,
lto_stats.num_compressed_il_bytes);
if (lto_stats.num_output_il_bytes > 0)
{
const float dividend = (float) lto_stats.num_compressed_il_bytes;
const float divisor = (float) lto_stats.num_output_il_bytes;
fprintf (stderr, " (ratio: %f)", dividend / divisor);
}
fprintf (stderr, "\n");
}
if (flag_wpa)
{
fprintf (stderr, "[%s] # of output files: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_output_files);
fprintf (stderr, "[%s] # of output symtab nodes: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_output_symtab_nodes);
fprintf (stderr, "[%s] # of output tree pickle references: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_pickle_refs_output);
fprintf (stderr, "[%s] # of output tree bodies: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_tree_bodies_output);
fprintf (stderr, "[%s] # callgraph partitions: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_cgraph_partitions);
fprintf (stderr, "[%s] Compression: "
HOST_WIDE_INT_PRINT_UNSIGNED " input bytes, "
HOST_WIDE_INT_PRINT_UNSIGNED " uncompressed bytes", s,
lto_stats.num_input_il_bytes,
lto_stats.num_uncompressed_il_bytes);
if (lto_stats.num_input_il_bytes > 0)
{
const float dividend = (float) lto_stats.num_uncompressed_il_bytes;
const float divisor = (float) lto_stats.num_input_il_bytes;
fprintf (stderr, " (ratio: %f)", dividend / divisor);
}
fprintf (stderr, "\n");
}
for (i = 0; i < LTO_N_SECTION_TYPES; i++)
fprintf (stderr, "[%s] Size of mmap'd section %s: "
HOST_WIDE_INT_PRINT_UNSIGNED " bytes\n", s,
lto_section_name[i], lto_stats.section_size[i]);
}
#ifdef LTO_STREAMER_DEBUG
struct tree_hash_entry
{
tree key;
intptr_t value;
};
struct tree_entry_hasher : typed_noop_remove <tree_hash_entry>
{
typedef tree_hash_entry value_type;
typedef tree_hash_entry compare_type;
static inline hashval_t hash (const value_type *);
static inline bool equal (const value_type *, const compare_type *);
};
inline hashval_t
tree_entry_hasher::hash (const value_type *e)
{
return htab_hash_pointer (e->key);
}
inline bool
tree_entry_hasher::equal (const value_type *e1, const compare_type *e2)
{
return (e1->key == e2->key);
}
static hash_table<tree_hash_entry> *tree_htab;
#endif
/* Initialization common to the LTO reader and writer. */
void
lto_streamer_init (void)
{
/* Check that all the TS_* handled by the reader and writer routines
match exactly the structures defined in treestruct.def. When a
new TS_* astructure is added, the streamer should be updated to
handle it. */
streamer_check_handled_ts_structures ();
#ifdef LTO_STREAMER_DEBUG
tree_htab = new hash_table<tree_hash_entry> (31);
#endif
}
/* Gate function for all LTO streaming passes. */
bool
gate_lto_out (void)
{
return ((flag_generate_lto || flag_generate_offload || in_lto_p)
/* Don't bother doing anything if the program has errors. */
&& !seen_error ());
}
#ifdef LTO_STREAMER_DEBUG
/* Add a mapping between T and ORIG_T, which is the numeric value of
the original address of T as it was seen by the LTO writer. This
mapping is useful when debugging streaming problems. A debugging
session can be started on both reader and writer using ORIG_T
as a breakpoint value in both sessions.
Note that this mapping is transient and only valid while T is
being reconstructed. Once T is fully built, the mapping is
removed. */
void
lto_orig_address_map (tree t, intptr_t orig_t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
ent.value = orig_t;
slot = tree_htab->find_slot (&ent, INSERT);
gcc_assert (!*slot);
*slot = XNEW (struct tree_hash_entry);
**slot = ent;
}
/* Get the original address of T as it was seen by the writer. This
is only valid while T is being reconstructed. */
intptr_t
lto_orig_address_get (tree t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
slot = tree_htab->find_slot (&ent, NO_INSERT);
return (slot ? (*slot)->value : 0);
}
/* Clear the mapping of T to its original address. */
void
lto_orig_address_remove (tree t)
{
struct tree_hash_entry ent;
struct tree_hash_entry **slot;
ent.key = t;
slot = tree_htab->find_slot (&ent, NO_INSERT);
gcc_assert (slot);
free (*slot);
tree_htab->clear_slot (slot);
}
#endif
/* Check that the version MAJOR.MINOR is the correct version number. */
void
lto_check_version (int major, int minor)
{
if (major != LTO_major_version || minor != LTO_minor_version)
fatal_error ("bytecode stream generated with LTO version %d.%d instead "
"of the expected %d.%d",
major, minor,
LTO_major_version, LTO_minor_version);
}
/* Initialize all the streamer hooks used for streaming GIMPLE. */
void
lto_streamer_hooks_init (void)
{
streamer_hooks_init ();
streamer_hooks.write_tree = lto_output_tree;
streamer_hooks.read_tree = lto_input_tree;
streamer_hooks.input_location = lto_input_location;
streamer_hooks.output_location = lto_output_location;
}
| kito-cheng/gcc | gcc/lto-streamer.c | C | gpl-2.0 | 11,719 |
/* LinphoneUIControler.h
*
* Copyright (C) 2011 Belledonne Comunications, Grenoble, France
*
* 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.
*/
#import <UIKit/UIKit.h>
#include "linphonecore.h"
@protocol LinphoneUICallDelegate
// UI changes
-(void) displayDialerFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName;
-(void) displayCall: (LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName;
-(void) displayIncomingCall: (LinphoneCall*) call NotificationFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName;
-(void) displayInCall: (LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName;
-(void) displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName;
//status reporting
-(void) displayStatus:(NSString*) message;
@end
@protocol LinphoneUIRegistrationDelegate
// UI changes for registration
-(void) displayRegisteredFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName onDomain:(NSString*)domain ;
-(void) displayRegisteringFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName onDomain:(NSString*)domain ;
-(void) displayRegistrationFailedFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName onDomain:(NSString*)domain forReason:(NSString*) reason;
-(void) displayNotRegisteredFromUI:(UIViewController*) viewCtrl;
@end
| GargoyleSoftware/voip-client-ios | Classes/LinphoneUI/LinphoneUIDelegates.h | C | gpl-2.0 | 2,635 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace TtNum1.team_buying
{
public partial class goods : System.Web.UI.Page
{
TtNum1.BLL.GoodsInfo bllgoodsinfo = new TtNum1.BLL.GoodsInfo();
TtNum1.Model.GoodsInfo modgoodsinfo = new TtNum1.Model.GoodsInfo();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["Goods_ID"] == null)
{
Response.Write("<script>window.alert('您没有选择公告,无法传值');window.location=index.aspx;</script>");
}
else
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
string a = Request.QueryString["Goods_ID"].ToString();
modgoodsinfo = bllgoodsinfo.GetModel(Convert.ToInt16(a));
Goods_ID.Text = modgoodsinfo.Goods_ID.ToString();
DataTable dt = bllgoodsinfo.GetList1(a).Tables[0];
if (dt.Rows.Count > 0)
{
Goods_ID.Text = dt.Rows[0]["Goods_ID"].ToString();
Goods_name.Text = dt.Rows[0]["Goods_name"].ToString();
Market_price.Text = dt.Rows[0]["Market_price"].ToString();
In_store_price.Text = dt.Rows[0]["In_store_price"].ToString();
Stock.Text = dt.Rows[0]["Stock"].ToString();
Image1.ImageUrl = dt.Rows[0]["Goods_pic"].ToString();
Image2.ImageUrl = dt.Rows[0]["Goods_pic"].ToString();
Goods_info.Text = dt.Rows[0]["Goods_info"].ToString();
Good_Brand.Text = dt.Rows[0]["Good_Brand"].ToString();
Qqp.Text = dt.Rows[0]["Qqp"].ToString();
TextBox12.Text = dt.Rows[0]["Qqp"].ToString();
if (dt.Rows[0]["IN_group_buying"].ToString() == "1")
{
IN_group_buying.Text = "是";
}
else
{
IN_group_buying.Text = "否";
}
Sales_volume.Text = dt.Rows[0]["Sales_volume"].ToString();
TextBox9.Text = dt.Rows[0]["Sales_volume"].ToString();
if (dt.Rows[0]["Group_Buying_Price"].ToString() == "" || dt.Rows[0]["Group_Buying_Price"].ToString() == null)
{
Group_Buying_Price.Text = "该商品未设置团购信息";
}
else
{
Group_Buying_Price.Text = dt.Rows[0]["Group_Buying_Price"].ToString();
}
TextBox10.Text = dt.Rows[0]["Group_Buying_Price"].ToString();
GS1.Text = dt.Rows[0]["Sort_name"].ToString();
GS2.Text = dt.Rows[0]["GS_name1"].ToString();
Image3.ImageUrl = dt.Rows[0]["Img_1"].ToString();
Image4.ImageUrl = dt.Rows[0]["Img_1"].ToString();
Image5.ImageUrl = dt.Rows[0]["Img_2"].ToString();
Image6.ImageUrl = dt.Rows[0]["Img_2"].ToString();
uptime.Text = dt.Rows[0]["uptime"].ToString();
}
}
}
}
protected void RadButton2_Click1(object sender, EventArgs e)
{
// Response.Write("<script>history.back(-1)</script>");
Response.Redirect(ViewState["BackUrl"].ToString());
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TtNum"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand("select * from GoodSort2 where GoodSort2.GS_ID='" + DropDownList1.SelectedValue + "'", conn);
DataSet ds = new DataSet();
try
{
conn.Open();
da.Fill(ds, "GoodSort2");
conn.Close();
}
catch (SqlException e2)
{
Response.Write(e2.ToString());
}
PagedDataSource obj = new PagedDataSource();
obj.DataSource = ds.Tables["GoodSort2"].DefaultView;
DropDownList2.DataSource = obj;
this.DropDownList2.DataTextField = "Sort_name";
this.DropDownList2.DataValueField = "Sort_ID";
DropDownList2.DataBind();
}
}
} | JJDJJ/TtNum | TtNum/TtNum/team_buying/goods.aspx.cs | C# | gpl-2.0 | 5,347 |
/*
* This file is part of NWFramework.
* Copyright (c) InCrew Software and Others.
* (See the AUTHORS file in the root of this distribution.)
*
* NWFramework 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.
*
* NWFramework 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 NWFramework; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "PchNWStream.h"
#include "NWStreamBlockVideo.h"
#include <memory.h>
//********************************************************************
//
//********************************************************************
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
NWStreamBlockVideo::NWStreamBlockVideo() : Inherited(),
mFrameBuffer(0),
mWidth(0),
mHeight(0),
mStride(0)
{
}
//********************************************************************
//
//********************************************************************
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
bool NWStreamBlockVideo::init()
{
bool bOK = true;
if (!isOk())
{
mFrameBuffer = 0;
mWidth = 0;
mHeight = 0;
mStride = 0;
bOK = Inherited::init(NWSTREAM_SUBTYPE_MEDIA_VIDEO);
}
return bOK;
}
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
void NWStreamBlockVideo::done()
{
if (isOk())
{
DISPOSE_ARRAY(mFrameBuffer);
Inherited::done();
}
}
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
void NWStreamBlockVideo::setFrameBufferData(int _width, int _height, int _stride, unsigned char* _frameBuffer, bool _copy)
{
if ( _frameBuffer && _copy )
{
int frameBufferSize = _height*_stride;
ASSERT(_stride >= (_height*3));
mFrameBuffer = NEW unsigned char[frameBufferSize];
memcpy(mFrameBuffer,_frameBuffer,frameBufferSize);
}
else
{
mFrameBuffer = _frameBuffer;
}
mWidth = _width;
mHeight = _height;
mStride = _stride;
}
| cryptonome/nwframework | Framework/NWStream/NWStreamBlockVideo.cpp | C++ | gpl-2.0 | 3,001 |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :organization
t.string :department
t.string :name
t.string :role
t.string :email
t.string :password
t.binary :picture
t.integer :given_chips
t.integer :received_chips
t.integer :avail_chips
t.timestamps
end
end
end
| kostaskoufou/Innovation_credits | vendor/db/migrate/20130618120305_create_users.rb | Ruby | gpl-2.0 | 385 |
package com.avrgaming.civcraft.structure;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.locks.ReentrantLock;
import org.bukkit.Location;
import com.avrgaming.civcraft.config.CivSettings;
import com.avrgaming.civcraft.exception.CivException;
import com.avrgaming.civcraft.exception.InvalidConfiguration;
import com.avrgaming.civcraft.object.Buff;
import com.avrgaming.civcraft.object.Town;
public class MobGrinder extends Structure {
private static final double T1_CHANCE = CivSettings.getDoubleStructure("mobGrinder.t1_chance"); //1%
private static final double T2_CHANCE = CivSettings.getDoubleStructure("mobGrinder.t2_chance"); //2%
private static final double T3_CHANCE = CivSettings.getDoubleStructure("mobGrinder.t3_chance"); //1%
private static final double T4_CHANCE = CivSettings.getDoubleStructure("mobGrinder.t4_chance"); //0.25%
private static final double PACK_CHANCE = CivSettings.getDoubleStructure("mobGrinder.pack_chance"); //0.10%
private static final double BIGPACK_CHANCE = CivSettings.getDoubleStructure("mobGrinder.bigpack_chance");
private static final double HUGEPACK_CHANCE = CivSettings.getDoubleStructure("mobGrinder.hugepack_chance");
public int skippedCounter = 0;
public ReentrantLock lock = new ReentrantLock();
public enum Crystal {
T1,
T2,
T3,
T4,
PACK,
BIGPACK,
HUGEPACK
}
protected MobGrinder(Location center, String id, Town town) throws CivException {
super(center, id, town);
}
public MobGrinder(ResultSet rs) throws SQLException, CivException {
super(rs);
}
@Override
public String getDynmapDescription() {
return null;
}
@Override
public String getMarkerIconName() {
return "minecart";
}
public double getMineralChance(Crystal crystal) {
double chance = 0;
switch (crystal) {
case T1:
chance = T1_CHANCE;
break;
case T2:
chance = T2_CHANCE;
break;
case T3:
chance = T3_CHANCE;
break;
case T4:
chance = T4_CHANCE;
break;
case PACK:
chance = PACK_CHANCE;
break;
case BIGPACK:
chance = BIGPACK_CHANCE;
break;
case HUGEPACK:
chance = HUGEPACK_CHANCE;
}
double increase = chance*this.getTown().getBuffManager().getEffectiveDouble(Buff.EXTRACTION);
chance += increase;
try {
if (this.getTown().getGovernment().id.equals("gov_tribalism")) {
chance *= CivSettings.getDouble(CivSettings.structureConfig, "mobGrinder.tribalism_rate");
} else {
chance *= CivSettings.getDouble(CivSettings.structureConfig, "mobGrinder.penalty_rate");
}
} catch (InvalidConfiguration e) {
e.printStackTrace();
}
return chance;
}
}
| ataranlen/civcraft | civcraft/src/com/avrgaming/civcraft/structure/MobGrinder.java | Java | gpl-2.0 | 2,644 |
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018.10.30 SummerGift first version
* 2019.03.05 whj4674672 add stm32h7
*/
#ifndef __DRV_USART_H__
#define __DRV_USART_H__
#include <rtthread.h>
#include "rtdevice.h"
#include <rthw.h>
#include <drv_common.h>
#include "drv_dma.h"
int rt_hw_usart_init(void);
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) \
|| defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4)
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
#elif defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32H7)
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) */
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F2) \
|| defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32G4)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#endif
/* stm32 config class */
struct stm32_uart_config
{
const char *name;
USART_TypeDef *Instance;
IRQn_Type irq_type;
struct dma_config *dma_rx;
struct dma_config *dma_tx;
};
/* stm32 uart dirver class */
struct stm32_uart
{
UART_HandleTypeDef handle;
struct stm32_uart_config *config;
#ifdef RT_SERIAL_USING_DMA
struct
{
DMA_HandleTypeDef handle;
rt_size_t last_index;
} dma_rx;
struct
{
DMA_HandleTypeDef handle;
} dma_tx;
#endif
rt_uint16_t uart_dma_flag;
struct rt_serial_device serial;
};
#endif /* __DRV_USART_H__ */
| onelife/rt-thread | bsp/stm32/libraries/HAL_Drivers/drv_usart.h | C | gpl-2.0 | 2,010 |
<?php
/**
* WordPress Roles and Capabilities.
*
* @package WordPress
* @subpackage User
*/
/**
* WordPress User Roles.
*
* The role option is simple, the structure is organized by role name that store
* the name in value of the 'name' key. The capabilities are stored as an array
* in the value of the 'capability' key.
*
* <code>
* array (
* 'rolename' => array (
* 'name' => 'rolename',
* 'capabilities' => array()
* )
* )
* </code>
*
* @since 2.0.0
* @package WordPress
* @subpackage User
*/
class WP_Roles {
/**
* List of roles and capabilities.
*
* @since 2.0.0
* @access public
* @var array
*/
var $roles;
/**
* List of the role objects.
*
* @since 2.0.0
* @access public
* @var array
*/
var $role_objects = array();
/**
* List of role names.
*
* @since 2.0.0
* @access public
* @var array
*/
var $role_names = array();
/**
* Option name for storing role list.
*
* @since 2.0.0
* @access public
* @var string
*/
var $role_key;
/**
* Whether to use the database for retrieval and storage.
*
* @since 2.1.0
* @access public
* @var bool
*/
var $use_db = true;
/**
* PHP4 Constructor - Call {@link WP_Roles::_init()} method.
*
* @since 2.0.0
* @access public
*
* @return WP_Roles
*/
function WP_Roles() {
$this->_init();
}
/**
* Setup the object properties.
*
* The role key is set to the current prefix for the $wpdb object with
* 'user_roles' appended. If the $wp_user_roles global is set, then it will
* be used and the role option will not be updated or used.
*
* @since 2.1.0
* @access protected
* @uses $wpdb Used to get the database prefix.
* @global array $wp_user_roles Used to set the 'roles' property value.
*/
function _init () {
global $wpdb;
global $wp_user_roles;
$this->role_key = $wpdb->prefix . 'user_roles';
if ( ! empty( $wp_user_roles ) ) {
$this->roles = $wp_user_roles;
$this->use_db = false;
} else {
$this->roles = get_option( $this->role_key );
}
if ( empty( $this->roles ) )
return;
$this->role_objects = array();
$this->role_names = array();
foreach ( (array) $this->roles as $role => $data ) {
$this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] );
$this->role_names[$role] = $this->roles[$role]['name'];
}
}
/**
* Add role name with capabilities to list.
*
* Updates the list of roles, if the role doesn't already exist.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
* @param string $display_name Role display name.
* @param array $capabilities List of role capabilities.
* @return null|WP_Role WP_Role object if role is added, null if already exists.
*/
function add_role( $role, $display_name, $capabilities = array() ) {
if ( isset( $this->roles[$role] ) )
return;
$this->roles[$role] = array(
'name' => $display_name,
'capabilities' => $capabilities
);
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
$this->role_objects[$role] = new WP_Role( $role, $capabilities );
$this->role_names[$role] = $display_name;
return $this->role_objects[$role];
}
/**
* Remove role by name.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
*/
function remove_role( $role ) {
if ( ! isset( $this->role_objects[$role] ) )
return;
unset( $this->role_objects[$role] );
unset( $this->role_names[$role] );
unset( $this->roles[$role] );
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
}
/**
* Add capability to role.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
* @param string $cap Capability name.
* @param bool $grant Optional, default is true. Whether role is capable of preforming capability.
*/
function add_cap( $role, $cap, $grant = true ) {
$this->roles[$role]['capabilities'][$cap] = $grant;
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
}
/**
* Remove capability from role.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
* @param string $cap Capability name.
*/
function remove_cap( $role, $cap ) {
unset( $this->roles[$role]['capabilities'][$cap] );
if ( $this->use_db )
update_option( $this->role_key, $this->roles );
}
/**
* Retrieve role object by name.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
* @return object|null Null, if role does not exist. WP_Role object, if found.
*/
function &get_role( $role ) {
if ( isset( $this->role_objects[$role] ) )
return $this->role_objects[$role];
else
return null;
}
/**
* Retrieve list of role names.
*
* @since 2.0.0
* @access public
*
* @return array List of role names.
*/
function get_names() {
return $this->role_names;
}
/**
* Whether role name is currently in the list of available roles.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name to look up.
* @return bool
*/
function is_role( $role )
{
return isset( $this->role_names[$role] );
}
}
/**
* WordPress Role class.
*
* @since 2.0.0
* @package WordPress
* @subpackage User
*/
class WP_Role {
/**
* Role name.
*
* @since 2.0.0
* @access public
* @var string
*/
var $name;
/**
* List of capabilities the role contains.
*
* @since 2.0.0
* @access public
* @var array
*/
var $capabilities;
/**
* PHP4 Constructor - Setup object properties.
*
* The list of capabilities, must have the key as the name of the capability
* and the value a boolean of whether it is granted to the role or not.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
* @param array $capabilities List of capabilities.
* @return WP_Role
*/
function WP_Role( $role, $capabilities ) {
$this->name = $role;
$this->capabilities = $capabilities;
}
/**
* Assign role a capability.
*
* @see WP_Roles::add_cap() Method uses implementation for role.
* @since 2.0.0
* @access public
*
* @param string $cap Capability name.
* @param bool $grant Whether role has capability privilege.
*/
function add_cap( $cap, $grant = true ) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$this->capabilities[$cap] = $grant;
$wp_roles->add_cap( $this->name, $cap, $grant );
}
/**
* Remove capability from role.
*
* This is a container for {@link WP_Roles::remove_cap()} to remove the
* capability from the role. That is to say, that {@link
* WP_Roles::remove_cap()} implements the functionality, but it also makes
* sense to use this class, because you don't need to enter the role name.
*
* @since 2.0.0
* @access public
*
* @param string $cap Capability name.
*/
function remove_cap( $cap ) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
unset( $this->capabilities[$cap] );
$wp_roles->remove_cap( $this->name, $cap );
}
/**
* Whether role has capability.
*
* The capabilities is passed through the 'role_has_cap' filter. The first
* parameter for the hook is the list of capabilities the class has
* assigned. The second parameter is the capability name to look for. The
* third and final parameter for the hook is the role name.
*
* @since 2.0.0
* @access public
*
* @param string $cap Capability name.
* @return bool True, if user has capability. False, if doesn't have capability.
*/
function has_cap( $cap ) {
$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
if ( !empty( $capabilities[$cap] ) )
return $capabilities[$cap];
else
return false;
}
}
/**
* WordPress User class.
*
* @since 2.0.0
* @package WordPress
* @subpackage User
*/
class WP_User {
/**
* User data container.
*
* This will be set as properties of the object.
*
* @since 2.0.0
* @access private
* @var array
*/
var $data;
/**
* The user's ID.
*
* @since 2.1.0
* @access public
* @var int
*/
var $ID = 0;
/**
* The deprecated user's ID.
*
* @since 2.0.0
* @access public
* @deprecated Use WP_User::$ID
* @see WP_User::$ID
* @var int
*/
var $id = 0;
/**
* The individual capabilities the user has been given.
*
* @since 2.0.0
* @access public
* @var array
*/
var $caps = array();
/**
* User metadata option name.
*
* @since 2.0.0
* @access public
* @var string
*/
var $cap_key;
/**
* The roles the user is part of.
*
* @since 2.0.0
* @access public
* @var array
*/
var $roles = array();
/**
* All capabilities the user has, including individual and role based.
*
* @since 2.0.0
* @access public
* @var array
*/
var $allcaps = array();
/**
* First name of the user.
*
* Created to prevent notices.
*
* @since 2.7.0
* @access public
* @var string
*/
var $first_name = '';
/**
* Last name of the user.
*
* Created to prevent notices.
*
* @since 2.7.0
* @access public
* @var string
*/
var $last_name = '';
/**
* PHP4 Constructor - Sets up the object properties.
*
* Retrieves the userdata and then assigns all of the data keys to direct
* properties of the object. Calls {@link WP_User::_init_caps()} after
* setting up the object's user data properties.
*
* @since 2.0.0
* @access public
*
* @param int|string $id User's ID or username
* @param int $name Optional. User's username
* @return WP_User
*/
function WP_User( $id, $name = '' ) {
if ( empty( $id ) && empty( $name ) )
return;
if ( ! is_numeric( $id ) ) {
$name = $id;
$id = 0;
}
if ( ! empty( $id ) )
$this->data = get_userdata( $id );
else
$this->data = get_userdatabylogin( $name );
if ( empty( $this->data->ID ) )
return;
foreach ( get_object_vars( $this->data ) as $key => $value ) {
$this->{$key} = $value;
}
$this->id = $this->ID;
$this->_init_caps();
}
/**
* Setup capability object properties.
*
* Will set the value for the 'cap_key' property to current database table
* prefix, followed by 'capabilities'. Will then check to see if the
* property matching the 'cap_key' exists and is an array. If so, it will be
* used.
*
* @since 2.1.0
* @access protected
*/
function _init_caps() {
global $wpdb;
$this->cap_key = $wpdb->prefix . 'capabilities';
$this->caps = &$this->{$this->cap_key};
if ( ! is_array( $this->caps ) )
$this->caps = array();
$this->get_role_caps();
}
/**
* Retrieve all of the role capabilities and merge with individual capabilities.
*
* All of the capabilities of the roles the user belongs to are merged with
* the users individual roles. This also means that the user can be denied
* specific roles that their role might have, but the specific user isn't
* granted permission to.
*
* @since 2.0.0
* @uses $wp_roles
* @access public
*/
function get_role_caps() {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
//Filter out caps that are not role names and assign to $this->roles
if ( is_array( $this->caps ) )
$this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) );
//Build $allcaps from role caps, overlay user's $caps
$this->allcaps = array();
foreach ( (array) $this->roles as $role ) {
$role = $wp_roles->get_role( $role );
$this->allcaps = array_merge( $this->allcaps, $role->capabilities );
}
$this->allcaps = array_merge( $this->allcaps, $this->caps );
}
/**
* Add role to user.
*
* Updates the user's meta data option with capabilities and roles.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
*/
function add_role( $role ) {
$this->caps[$role] = true;
update_usermeta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
$this->update_user_level_from_caps();
}
/**
* Remove role from user.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
*/
function remove_role( $role ) {
if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) )
return;
unset( $this->caps[$role] );
update_usermeta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
}
/**
* Set the role of the user.
*
* This will remove the previous roles of the user and assign the user the
* new one. You can set the role to an empty string and it will remove all
* of the roles from the user.
*
* @since 2.0.0
* @access public
*
* @param string $role Role name.
*/
function set_role( $role ) {
foreach ( (array) $this->roles as $oldrole )
unset( $this->caps[$oldrole] );
if ( !empty( $role ) ) {
$this->caps[$role] = true;
$this->roles = array( $role => true );
} else {
$this->roles = false;
}
update_usermeta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
$this->update_user_level_from_caps();
}
/**
* Choose the maximum level the user has.
*
* Will compare the level from the $item parameter against the $max
* parameter. If the item is incorrect, then just the $max parameter value
* will be returned.
*
* Used to get the max level based on the capabilities the user has. This
* is also based on roles, so if the user is assigned the Administrator role
* then the capability 'level_10' will exist and the user will get that
* value.
*
* @since 2.0.0
* @access public
*
* @param int $max Max level of user.
* @param string $item Level capability name.
* @return int Max Level.
*/
function level_reduction( $max, $item ) {
if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) {
$level = intval( $matches[1] );
return max( $max, $level );
} else {
return $max;
}
}
/**
* Update the maximum user level for the user.
*
* Updates the 'user_level' user metadata (includes prefix that is the
* database table prefix) with the maximum user level. Gets the value from
* the all of the capabilities that the user has.
*
* @since 2.0.0
* @access public
*/
function update_user_level_from_caps() {
global $wpdb;
$this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 );
update_usermeta( $this->ID, $wpdb->prefix.'user_level', $this->user_level );
}
/**
* Add capability and grant or deny access to capability.
*
* @since 2.0.0
* @access public
*
* @param string $cap Capability name.
* @param bool $grant Whether to grant capability to user.
*/
function add_cap( $cap, $grant = true ) {
$this->caps[$cap] = $grant;
update_usermeta( $this->ID, $this->cap_key, $this->caps );
}
/**
* Remove capability from user.
*
* @since 2.0.0
* @access public
*
* @param string $cap Capability name.
*/
function remove_cap( $cap ) {
if ( empty( $this->caps[$cap] ) ) return;
unset( $this->caps[$cap] );
update_usermeta( $this->ID, $this->cap_key, $this->caps );
}
/**
* Remove all of the capabilities of the user.
*
* @since 2.1.0
* @access public
*/
function remove_all_caps() {
global $wpdb;
$this->caps = array();
update_usermeta( $this->ID, $this->cap_key, '' );
update_usermeta( $this->ID, $wpdb->prefix.'user_level', '' );
$this->get_role_caps();
}
/**
* Whether user has capability or role name.
*
* This is useful for looking up whether the user has a specific role
* assigned to the user. The second optional parameter can also be used to
* check for capabilities against a specfic post.
*
* @since 2.0.0
* @access public
*
* @param string|int $cap Capability or role name to search.
* @param int $post_id Optional. Post ID to check capability against specific post.
* @return bool True, if user has capability; false, if user does not have capability.
*/
function has_cap( $cap ) {
if ( is_numeric( $cap ) )
$cap = $this->translate_level_to_cap( $cap );
$args = array_slice( func_get_args(), 1 );
$args = array_merge( array( $cap, $this->ID ), $args );
$caps = call_user_func_array( 'map_meta_cap', $args );
// Must have ALL requested caps
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
foreach ( (array) $caps as $cap ) {
//echo "Checking cap $cap<br />";
if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] )
return false;
}
return true;
}
/**
* Convert numeric level to level capability name.
*
* Prepends 'level_' to level number.
*
* @since 2.0.0
* @access public
*
* @param int $level Level number, 1 to 10.
* @return string
*/
function translate_level_to_cap( $level ) {
return 'level_' . $level;
}
}
/**
* Map meta capabilities to primitive capabilities.
*
* This does not actually compare whether the user ID has the actual capability,
* just what the capability or capabilities are. Meta capability list value can
* be 'delete_user', 'edit_user', 'delete_post', 'delete_page', 'edit_post',
* 'edit_page', 'read_post', or 'read_page'.
*
* @since 2.0.0
*
* @param string $cap Capability name.
* @param int $user_id User ID.
* @return array Actual capabilities for meta capability.
*/
function map_meta_cap( $cap, $user_id ) {
$args = array_slice( func_get_args(), 2 );
$caps = array();
switch ( $cap ) {
case 'delete_user':
$caps[] = 'delete_users';
break;
case 'edit_user':
if ( !isset( $args[0] ) || $user_id != $args[0] ) {
$caps[] = 'edit_users';
}
break;
case 'delete_post':
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'delete_page', $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}
$post_author_data = get_userdata( $post->post_author );
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
// If the user is the author...
if ( $user_id == $post_author_data->ID ) {
// If the post is published...
if ( 'publish' == $post->post_status )
$caps[] = 'delete_published_posts';
else
// If the post is draft...
$caps[] = 'delete_posts';
} else {
// The user is trying to edit someone else's post.
$caps[] = 'delete_others_posts';
// The post is published, extra cap required.
if ( 'publish' == $post->post_status )
$caps[] = 'delete_published_posts';
elseif ( 'private' == $post->post_status )
$caps[] = 'delete_private_posts';
}
break;
case 'delete_page':
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$page = get_page( $args[0] );
$page_author_data = get_userdata( $page->post_author );
//echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
// If the user is the author...
if ( $user_id == $page_author_data->ID ) {
// If the page is published...
if ( $page->post_status == 'publish' )
$caps[] = 'delete_published_pages';
else
// If the page is draft...
$caps[] = 'delete_pages';
} else {
// The user is trying to edit someone else's page.
$caps[] = 'delete_others_pages';
// The page is published, extra cap required.
if ( $page->post_status == 'publish' )
$caps[] = 'delete_published_pages';
elseif ( $page->post_status == 'private' )
$caps[] = 'delete_private_pages';
}
break;
// edit_post breaks down to edit_posts, edit_published_posts, or
// edit_others_posts
case 'edit_post':
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'edit_page', $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}
$post_author_data = get_userdata( $post->post_author );
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
// If the user is the author...
if ( $user_id == $post_author_data->ID ) {
// If the post is published...
if ( 'publish' == $post->post_status )
$caps[] = 'edit_published_posts';
else
// If the post is draft...
$caps[] = 'edit_posts';
} else {
// The user is trying to edit someone else's post.
$caps[] = 'edit_others_posts';
// The post is published, extra cap required.
if ( 'publish' == $post->post_status )
$caps[] = 'edit_published_posts';
elseif ( 'private' == $post->post_status )
$caps[] = 'edit_private_posts';
}
break;
case 'edit_page':
$author_data = get_userdata( $user_id );
//echo "post ID: {$args[0]}<br />";
$page = get_page( $args[0] );
$page_author_data = get_userdata( $page->post_author );
//echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
// If the user is the author...
if ( $user_id == $page_author_data->ID ) {
// If the page is published...
if ( 'publish' == $page->post_status )
$caps[] = 'edit_published_pages';
else
// If the page is draft...
$caps[] = 'edit_pages';
} else {
// The user is trying to edit someone else's page.
$caps[] = 'edit_others_pages';
// The page is published, extra cap required.
if ( 'publish' == $page->post_status )
$caps[] = 'edit_published_pages';
elseif ( 'private' == $page->post_status )
$caps[] = 'edit_private_pages';
}
break;
case 'read_post':
$post = get_post( $args[0] );
if ( 'page' == $post->post_type ) {
$args = array_merge( array( 'read_page', $user_id ), $args );
return call_user_func_array( 'map_meta_cap', $args );
}
if ( 'private' != $post->post_status ) {
$caps[] = 'read';
break;
}
$author_data = get_userdata( $user_id );
$post_author_data = get_userdata( $post->post_author );
if ( $user_id == $post_author_data->ID )
$caps[] = 'read';
else
$caps[] = 'read_private_posts';
break;
case 'read_page':
$page = get_page( $args[0] );
if ( 'private' != $page->post_status ) {
$caps[] = 'read';
break;
}
$author_data = get_userdata( $user_id );
$page_author_data = get_userdata( $page->post_author );
if ( $user_id == $page_author_data->ID )
$caps[] = 'read';
else
$caps[] = 'read_private_pages';
break;
default:
// If no meta caps match, return the original cap.
$caps[] = $cap;
}
return $caps;
}
/**
* Whether current user has capability or role.
*
* @since 2.0.0
*
* @param string $capability Capability or role name.
* @return bool
*/
function current_user_can( $capability ) {
$current_user = wp_get_current_user();
if ( empty( $current_user ) )
return false;
$args = array_slice( func_get_args(), 1 );
$args = array_merge( array( $capability ), $args );
return call_user_func_array( array( &$current_user, 'has_cap' ), $args );
}
/**
* Retrieve role object.
*
* @see WP_Roles::get_role() Uses method to retrieve role object.
* @since 2.0.0
*
* @param string $role Role name.
* @return object
*/
function get_role( $role ) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
return $wp_roles->get_role( $role );
}
/**
* Add role, if it does not exist.
*
* @see WP_Roles::add_role() Uses method to add role.
* @since 2.0.0
*
* @param string $role Role name.
* @param string $display_name Display name for role.
* @param array $capabilities List of capabilities.
* @return null|WP_Role WP_Role object if role is added, null if already exists.
*/
function add_role( $role, $display_name, $capabilities = array() ) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
return $wp_roles->add_role( $role, $display_name, $capabilities );
}
/**
* Remove role, if it exists.
*
* @see WP_Roles::remove_role() Uses method to remove role.
* @since 2.0.0
*
* @param string $role Role name.
* @return null
*/
function remove_role( $role ) {
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
return $wp_roles->remove_role( $role );
}
?>
| stulentsev/mafiaoffline | wp-includes/capabilities.php | PHP | gpl-2.0 | 24,111 |
# Copyright (C) 2011-2018 Project SkyFire <http://www.projectskyfire.org/
# Copyright (C) 2008-2018 TrinityCore <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# This file defines the following macros for developers to use in ensuring
# that installed software is of the right version:
#
# ENSURE_VERSION - test that a version number is greater than
# or equal to some minimum
# ENSURE_VERSION_RANGE - test that a version number is greater than
# or equal to some minimum and less than some
# maximum
# ENSURE_VERSION2 - deprecated, do not use in new code
#
# ENSURE_VERSION
# This macro compares version numbers of the form "x.y.z" or "x.y"
# ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
# Leading and trailing text is ok, e.g.
# ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
# Copyright (c) 2006, David Faure, <faure@kde.org>
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# ENSURE_VERSION_RANGE
# This macro ensures that a version number of the form
# "x.y.z" or "x.y" falls within a range defined by
# min_version <= found_version < max_version.
# If this expression holds, FOO_VERSION_OK will be set TRUE
#
# Example: ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
#
# This macro will break silently if any of x,y,z are greater than 100.
#
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# NORMALIZE_VERSION
# Helper macro to convert version numbers of the form "x.y.z"
# to an integer equal to 10^4 * x + 10^2 * y + z
#
# This macro will break silently if any of x,y,z are greater than 100.
#
# Copyright (c) 2006, David Faure, <faure@kde.org>
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# CHECK_RANGE_INCLUSIVE_LOWER
# Helper macro to check whether x <= y < z
#
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
if (_threePartMatch)
# parse the parts of the version string
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
else (_threePartMatch)
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
set(_patch_vers "0")
endif (_threePartMatch)
# compute an overall version number which can be compared at once
MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
ENDMACRO(NORMALIZE_VERSION)
MACRO(CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
if (${_value} LESS ${_lower_limit})
set( ${_ok} FALSE )
elseif (${_value} EQUAL ${_lower_limit})
set( ${_ok} TRUE )
elseif (${_value} EQUAL ${_upper_limit})
set( ${_ok} FALSE )
elseif (${_value} GREATER ${_upper_limit})
set( ${_ok} FALSE )
else (${_value} LESS ${_lower_limit})
set( ${_ok} TRUE )
endif (${_value} LESS ${_lower_limit})
ENDMACRO(CHECK_RANGE_INCLUSIVE_LOWER)
MACRO(ENSURE_VERSION requested_version found_version var_too_old)
NORMALIZE_VERSION( ${requested_version} req_vers_num )
NORMALIZE_VERSION( ${found_version} found_vers_num )
if (found_vers_num LESS req_vers_num)
set( ${var_too_old} FALSE )
else (found_vers_num LESS req_vers_num)
set( ${var_too_old} TRUE )
endif (found_vers_num LESS req_vers_num)
ENDMACRO(ENSURE_VERSION)
MACRO(ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
ENDMACRO(ENSURE_VERSION2)
MACRO(ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
NORMALIZE_VERSION( ${min_version} req_vers_num )
NORMALIZE_VERSION( ${found_version} found_vers_num )
NORMALIZE_VERSION( ${max_version} max_vers_num )
CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
ENDMACRO(ENSURE_VERSION_RANGE)
| NightCotRe0110/SkyFire.548 | cmake/macros/EnsureVersion.cmake | CMake | gpl-2.0 | 5,533 |
<!DOCTYPE html>
<html>
<h1>coca_cola_cherry10</h1>
<p> BOLD: 2/2 correct and 0/2false</p>
<p> SIFT: 2/2 correct and 0/2false</p><br>
<img src = "../../../BVD_M01/coca_cola_cherry/coca_cola_cherry10.jpg" alt = "coca_cola_cherry10.html" style= " width:320px;height:240px;"> <h1> Falsely compared to: </h1><br>
</html> | MarcGroef/ros-vision | catkin_ws/Reports/BOLD vs SIFT=0?BOLD-SIFT-5fold-all-10%/coca_cola_cherry/coca_cola_cherry10.html | HTML | gpl-2.0 | 316 |
class BitStruct
# Class for floats (single and double precision) in network order.
# Declared with BitStruct.float.
class FloatField < Field
# Used in describe.
def self.class_name
@class_name ||= "float"
end
def add_accessors_to(cl, attr = name) # :nodoc:
unless offset % 8 == 0
raise ArgumentError,
"Bad offset, #{offset}, for #{self.class} #{name}." +
" Must be multiple of 8."
end
unless length == 32 or length == 64
raise ArgumentError,
"Bad length, #{length}, for #{self.class} #{name}." +
" Must be 32 or 64."
end
offset_byte = offset / 8
length_byte = length / 8
last_byte = offset_byte + length_byte - 1
byte_range = offset_byte..last_byte
endian = (options[:endian] || options["endian"]).to_s
case endian
when "native"
ctl = case length
when 32; "f"
when 64; "d"
end
when "little"
ctl = case length
when 32; "e"
when 64; "E"
end
when "network", "big", ""
ctl = case length
when 32; "g"
when 64; "G"
end
else
raise ArgumentError,
"Unrecognized endian option: #{endian.inspect}"
end
cl.class_eval do
define_method attr do ||
self[byte_range].unpack(ctl).first
end
define_method "#{attr}=" do |val|
self[byte_range] = [val].pack(ctl)
end
end
end
end
end
| ausarbluhd/EternalLLC | scripts/pentbox/lib/bit-struct/bit-struct/float-field.rb | Ruby | gpl-2.0 | 1,559 |
<?php
/**
* Core Class to enable hooks and actions for Fonts
* @version 1.0
*/
if(!class_exists('IOAFont'))
{
class IOAFont
{
private $fonts;
function __construct()
{
$fonts = array( );
}
/**
* Retrives all registered fonts.
*/
public function getFonts()
{
return $this->fonts;
}
public function setFont($font,$key)
{
global $super_options;
$this->fonts[$key] = $font;
if(!isset($super_options[SN.$key])) $super_options[SN.$key] = $font['default_font'];
}
}
}
$fonts = new IOAFont();
function register_font_class($default='',$defined='',$default_font,$label,$addWeight,$subset)
{
global $fonts;
$fonts->setFont(array(
'default_class' => $default ,
'defined_class' => $defined ,
'default_font' => $default_font,
'label' => $label,
'fontWeight' => $addWeight,
'subset' => $subset
),trim(str_replace(' ','',$default)));
}
?> | HSrcWrld/DKWP | wp-content/themes/limitless/backend/classes/class_font_support.php | PHP | gpl-2.0 | 936 |
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
//============================================================
// include files
//============================================================
#include "mp_precomp.h"
#include "phydm_precomp.h"
u1Byte
ODM_GetAutoChannelSelectResult(
IN PVOID pDM_VOID,
IN u1Byte Band
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
PACS pACS = &pDM_Odm->DM_ACS;
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
if(Band == ODM_BAND_2_4G)
{
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[ACS] ODM_GetAutoChannelSelectResult(): CleanChannel_2G(%d)\n", pACS->CleanChannel_2G));
return (u1Byte)pACS->CleanChannel_2G;
}
else
{
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[ACS] ODM_GetAutoChannelSelectResult(): CleanChannel_5G(%d)\n", pACS->CleanChannel_5G));
return (u1Byte)pACS->CleanChannel_5G;
}
#else
return (u1Byte)pACS->CleanChannel_2G;
#endif
}
VOID
odm_AutoChannelSelectSetting(
IN PVOID pDM_VOID,
IN BOOLEAN IsEnable
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
u2Byte period = 0x2710;// 40ms in default
u2Byte NHMType = 0x7;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectSetting()=========> \n"));
if(IsEnable)
{//20 ms
period = 0x1388;
NHMType = 0x1;
}
if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
{
//PHY parameters initialize for ac series
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC+2, period); //0x990[31:16]=0x2710 Time duration for NHM unit: 4us, 0x2710=40ms
//ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, BIT8|BIT9|BIT10, NHMType); //0x994[9:8]=3 enable CCX
}
else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
//PHY parameters initialize for n series
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N+2, period); //0x894[31:16]=0x2710 Time duration for NHM unit: 4us, 0x2710=40ms
//ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, BIT10|BIT9|BIT8, NHMType); //0x890[9:8]=3 enable CCX
}
#endif
}
VOID
odm_AutoChannelSelectInit(
IN PVOID pDM_VOID
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
PACS pACS = &pDM_Odm->DM_ACS;
u1Byte i;
if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT))
return;
if(pACS->bForceACSResult)
return;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectInit()=========> \n"));
pACS->CleanChannel_2G = 1;
pACS->CleanChannel_5G = 36;
for (i = 0; i < ODM_MAX_CHANNEL_2G; ++i)
{
pACS->Channel_Info_2G[0][i] = 0;
pACS->Channel_Info_2G[1][i] = 0;
}
if(pDM_Odm->SupportICType & (ODM_IC_11AC_SERIES|ODM_RTL8192D))
{
for (i = 0; i < ODM_MAX_CHANNEL_5G; ++i)
{
pACS->Channel_Info_5G[0][i] = 0;
pACS->Channel_Info_5G[1][i] = 0;
}
}
#endif
}
VOID
odm_AutoChannelSelectReset(
IN PVOID pDM_VOID
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
PACS pACS = &pDM_Odm->DM_ACS;
if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT))
return;
if(pACS->bForceACSResult)
return;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectReset()=========> \n"));
odm_AutoChannelSelectSetting(pDM_Odm,TRUE);// for 20ms measurement
Phydm_NHMCounterStatisticsReset(pDM_Odm);
#endif
}
VOID
odm_AutoChannelSelect(
IN PVOID pDM_VOID,
IN u1Byte Channel
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
PACS pACS = &pDM_Odm->DM_ACS;
u1Byte ChannelIDX = 0, SearchIDX = 0;
u2Byte MaxScore=0;
if(!(pDM_Odm->SupportAbility & ODM_BB_NHM_CNT))
{
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Return: SupportAbility ODM_BB_NHM_CNT is disabled\n"));
return;
}
if(pACS->bForceACSResult)
{
ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Force 2G clean channel = %d, 5G clean channel = %d\n",
pACS->CleanChannel_2G, pACS->CleanChannel_5G));
return;
}
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Channel = %d=========> \n", Channel));
Phydm_GetNHMCounterStatistics(pDM_Odm);
odm_AutoChannelSelectSetting(pDM_Odm,FALSE);
if(Channel >=1 && Channel <=14)
{
ChannelIDX = Channel - 1;
pACS->Channel_Info_2G[1][ChannelIDX]++;
if(pACS->Channel_Info_2G[1][ChannelIDX] >= 2)
pACS->Channel_Info_2G[0][ChannelIDX] = (pACS->Channel_Info_2G[0][ChannelIDX] >> 1) +
(pACS->Channel_Info_2G[0][ChannelIDX] >> 2) + (pDM_Odm->NHM_cnt_0>>2);
else
pACS->Channel_Info_2G[0][ChannelIDX] = pDM_Odm->NHM_cnt_0;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): NHM_cnt_0 = %d \n", pDM_Odm->NHM_cnt_0));
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelect(): Channel_Info[0][%d] = %d, Channel_Info[1][%d] = %d\n", ChannelIDX, pACS->Channel_Info_2G[0][ChannelIDX], ChannelIDX, pACS->Channel_Info_2G[1][ChannelIDX]));
for(SearchIDX = 0; SearchIDX < ODM_MAX_CHANNEL_2G; SearchIDX++)
{
if(pACS->Channel_Info_2G[1][SearchIDX] != 0)
{
if(pACS->Channel_Info_2G[0][SearchIDX] >= MaxScore)
{
MaxScore = pACS->Channel_Info_2G[0][SearchIDX];
pACS->CleanChannel_2G = SearchIDX+1;
}
}
}
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("(1)odm_AutoChannelSelect(): 2G: CleanChannel_2G = %d, MaxScore = %d \n",
pACS->CleanChannel_2G, MaxScore));
}
else if(Channel >= 36)
{
// Need to do
pACS->CleanChannel_5G = Channel;
}
#endif
}
#if ( DM_ODM_SUPPORT_TYPE & ODM_AP )
VOID
phydm_AutoChannelSelectSettingAP(
IN PVOID pDM_VOID,
IN u4Byte setting, // 0: STORE_DEFAULT_NHM_SETTING; 1: RESTORE_DEFAULT_NHM_SETTING, 2: ACS_NHM_SETTING
IN u4Byte acs_step
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
prtl8192cd_priv priv = pDM_Odm->priv;
PACS pACS = &pDM_Odm->DM_ACS;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("odm_AutoChannelSelectSettingAP()=========> \n"));
//3 Store Default Setting
if(setting == STORE_DEFAULT_NHM_SETTING)
{
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("STORE_DEFAULT_NHM_SETTING\n"));
if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) // store Reg0x990, Reg0x994, Reg0x998, Reg0x99C, Reg0x9a0
{
pACS->Reg0x990 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC); // Reg0x990
pACS->Reg0x994 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC); // Reg0x994
pACS->Reg0x998 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC); // Reg0x998
pACS->Reg0x99C = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC); // Reg0x99c
pACS->Reg0x9A0 = ODM_Read1Byte(pDM_Odm, ODM_REG_NHM_TH8_11AC); // Reg0x9a0, u1Byte
}
else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
pACS->Reg0x890 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N); // Reg0x890
pACS->Reg0x894 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N); // Reg0x894
pACS->Reg0x898 = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N); // Reg0x898
pACS->Reg0x89C = ODM_Read4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N); // Reg0x89c
pACS->Reg0xE28 = ODM_Read1Byte(pDM_Odm, ODM_REG_NHM_TH8_11N); // Reg0xe28, u1Byte
}
}
//3 Restore Default Setting
else if(setting == RESTORE_DEFAULT_NHM_SETTING)
{
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("RESTORE_DEFAULT_NHM_SETTING\n"));
if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) // store Reg0x990, Reg0x994, Reg0x998, Reg0x99C, Reg0x9a0
{
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC, pACS->Reg0x990);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC, pACS->Reg0x994);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, pACS->Reg0x998);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC, pACS->Reg0x99C);
ODM_Write1Byte(pDM_Odm, ODM_REG_NHM_TH8_11AC, pACS->Reg0x9A0);
}
else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N, pACS->Reg0x890);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N, pACS->Reg0x894);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, pACS->Reg0x898);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N, pACS->Reg0x89C);
ODM_Write1Byte(pDM_Odm, ODM_REG_NHM_TH8_11N, pACS->Reg0xE28);
}
}
//3 ACS Setting
else if(setting == ACS_NHM_SETTING)
{
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("ACS_NHM_SETTING\n"));
u2Byte period;
period = 0x61a8;
pACS->ACS_Step = acs_step;
if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
{
//4 Set NHM period, 0x990[31:16]=0x61a8, Time duration for NHM unit: 4us, 0x61a8=100ms
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11AC+2, period);
//4 Set NHM ignore_cca=1, ignore_txon=1, ccx_en=0
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC,BIT8|BIT9|BIT10, 3);
if(pACS->ACS_Step == 0)
{
//4 Set IGI
ODM_SetBBReg(pDM_Odm,0xc50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x3E);
if (get_rf_mimo_mode(priv) != MIMO_1T1R)
ODM_SetBBReg(pDM_Odm,0xe50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x3E);
//4 Set ACS NHM threshold
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, 0x82786e64);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC, 0xffffff8c);
ODM_Write1Byte(pDM_Odm, ODM_REG_NHM_TH8_11AC, 0xff);
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11AC+2, 0xffff);
}
else if(pACS->ACS_Step == 1)
{
//4 Set IGI
ODM_SetBBReg(pDM_Odm,0xc50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x2A);
if (get_rf_mimo_mode(priv) != MIMO_1T1R)
ODM_SetBBReg(pDM_Odm,0xe50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x2A);
//4 Set ACS NHM threshold
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11AC, 0x5a50463c);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11AC, 0xffffff64);
}
}
else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
//4 Set NHM period, 0x894[31:16]=0x61a8, Time duration for NHM unit: 4us, 0x61a8=100ms
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TIMER_11N+2, period);
//4 Set NHM ignore_cca=1, ignore_txon=1, ccx_en=0
ODM_SetBBReg(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N,BIT8|BIT9|BIT10, 3);
if(pACS->ACS_Step == 0)
{
//4 Set IGI
ODM_SetBBReg(pDM_Odm,0xc50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x3E);
if (get_rf_mimo_mode(priv) != MIMO_1T1R)
ODM_SetBBReg(pDM_Odm,0xc58,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x3E);
//4 Set ACS NHM threshold
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, 0x82786e64);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N, 0xffffff8c);
ODM_Write1Byte(pDM_Odm, ODM_REG_NHM_TH8_11N, 0xff);
ODM_Write2Byte(pDM_Odm, ODM_REG_NHM_TH9_TH10_11N+2, 0xffff);
}
else if(pACS->ACS_Step == 1)
{
//4 Set IGI
ODM_SetBBReg(pDM_Odm,0xc50,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x2A);
if (get_rf_mimo_mode(priv) != MIMO_1T1R)
ODM_SetBBReg(pDM_Odm,0xc58,BIT0|BIT1|BIT2|BIT3|BIT4|BIT5|BIT6,0x2A);
//4 Set ACS NHM threshold
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH3_TO_TH0_11N, 0x5a50463c);
ODM_Write4Byte(pDM_Odm, ODM_REG_NHM_TH7_TO_TH4_11N, 0xffffff64);
}
}
}
}
VOID
phydm_GetNHMStatisticsAP(
IN PVOID pDM_VOID,
IN u4Byte idx, // @ 2G, Real channel number = idx+1
IN u4Byte acs_step
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
prtl8192cd_priv priv = pDM_Odm->priv;
PACS pACS = &pDM_Odm->DM_ACS;
u4Byte value32 = 0;
u1Byte i;
pACS->ACS_Step = acs_step;
if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
//4 Check if NHM result is ready
for (i=0; i<20; i++) {
ODM_delay_ms(1);
if ( ODM_GetBBReg(pDM_Odm,rFPGA0_PSDReport,BIT17) )
break;
}
//4 Get NHM Statistics
if ( pACS->ACS_Step==1 ) {
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT7_TO_CNT4_11N);
pACS->NHM_Cnt[idx][9] = (value32 & bMaskByte1) >> 8;
pACS->NHM_Cnt[idx][8] = (value32 & bMaskByte0);
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT_11N); // ODM_REG_NHM_CNT3_TO_CNT0_11N
pACS->NHM_Cnt[idx][7] = (value32 & bMaskByte3) >> 24;
pACS->NHM_Cnt[idx][6] = (value32 & bMaskByte2) >> 16;
pACS->NHM_Cnt[idx][5] = (value32 & bMaskByte1) >> 8;
} else if (pACS->ACS_Step==2) {
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT_11N); // ODM_REG_NHM_CNT3_TO_CNT0_11N
pACS->NHM_Cnt[idx][4] = ODM_Read1Byte(pDM_Odm, ODM_REG_NHM_CNT7_TO_CNT4_11N);
pACS->NHM_Cnt[idx][3] = (value32 & bMaskByte3) >> 24;
pACS->NHM_Cnt[idx][2] = (value32 & bMaskByte2) >> 16;
pACS->NHM_Cnt[idx][1] = (value32 & bMaskByte1) >> 8;
pACS->NHM_Cnt[idx][0] = (value32 & bMaskByte0);
}
}
else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
{
//4 Check if NHM result is ready
for (i=0; i<20; i++) {
ODM_delay_ms(1);
if (ODM_GetBBReg(pDM_Odm,ODM_REG_NHM_DUR_READY_11AC,BIT17))
break;
}
if ( pACS->ACS_Step==1 ) {
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT7_TO_CNT4_11AC);
pACS->NHM_Cnt[idx][9] = (value32 & bMaskByte1) >> 8;
pACS->NHM_Cnt[idx][8] = (value32 & bMaskByte0);
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT_11AC); // ODM_REG_NHM_CNT3_TO_CNT0_11AC
pACS->NHM_Cnt[idx][7] = (value32 & bMaskByte3) >> 24;
pACS->NHM_Cnt[idx][6] = (value32 & bMaskByte2) >> 16;
pACS->NHM_Cnt[idx][5] = (value32 & bMaskByte1) >> 8;
} else if (pACS->ACS_Step==2) {
value32 = ODM_Read4Byte(pDM_Odm,ODM_REG_NHM_CNT_11AC); // ODM_REG_NHM_CNT3_TO_CNT0_11AC
pACS->NHM_Cnt[idx][4] = ODM_Read1Byte(pDM_Odm, ODM_REG_NHM_CNT7_TO_CNT4_11AC);
pACS->NHM_Cnt[idx][3] = (value32 & bMaskByte3) >> 24;
pACS->NHM_Cnt[idx][2] = (value32 & bMaskByte2) >> 16;
pACS->NHM_Cnt[idx][1] = (value32 & bMaskByte1) >> 8;
pACS->NHM_Cnt[idx][0] = (value32 & bMaskByte0);
}
}
}
//#define ACS_DEBUG_INFO //acs debug default off
/*
int phydm_AutoChannelSelectAP(
IN PVOID pDM_VOID,
IN u4Byte ACS_Type, // 0: RXCount_Type, 1:NHM_Type
IN u4Byte available_chnl_num // amount of all channels
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
PACS pACS = &pDM_Odm->DM_ACS;
prtl8192cd_priv priv = pDM_Odm->priv;
static u4Byte score2G[MAX_2G_CHANNEL_NUM], score5G[MAX_5G_CHANNEL_NUM];
u4Byte score[MAX_BSS_NUM], use_nhm = 0;
u4Byte minScore=0xffffffff;
u4Byte tmpScore, tmpIdx=0;
u4Byte traffic_check = 0;
u4Byte fa_count_weighting = 1;
int i, j, idx=0, idx_2G_end=-1, idx_5G_begin=-1, minChan=0;
struct bss_desc *pBss=NULL;
#ifdef _DEBUG_RTL8192CD_
char tmpbuf[400];
int len=0;
#endif
memset(score2G, '\0', sizeof(score2G));
memset(score5G, '\0', sizeof(score5G));
for (i=0; i<priv->available_chnl_num; i++) {
if (priv->available_chnl[i] <= 14)
idx_2G_end = i;
else
break;
}
for (i=0; i<priv->available_chnl_num; i++) {
if (priv->available_chnl[i] > 14) {
idx_5G_begin = i;
break;
}
}
// DELETE
#ifndef CONFIG_RTL_NEW_AUTOCH
for (i=0; i<priv->site_survey->count; i++) {
pBss = &priv->site_survey->bss[i];
for (idx=0; idx<priv->available_chnl_num; idx++) {
if (pBss->channel == priv->available_chnl[idx]) {
if (pBss->channel <= 14)
setChannelScore(idx, score2G, 0, MAX_2G_CHANNEL_NUM-1);
else
score5G[idx - idx_5G_begin] += 5;
break;
}
}
}
#endif
if (idx_2G_end >= 0)
for (i=0; i<=idx_2G_end; i++)
score[i] = score2G[i];
if (idx_5G_begin >= 0)
for (i=idx_5G_begin; i<priv->available_chnl_num; i++)
score[i] = score5G[i - idx_5G_begin];
#ifdef CONFIG_RTL_NEW_AUTOCH
{
u4Byte y, ch_begin=0, ch_end= priv->available_chnl_num;
u4Byte do_ap_check = 1, ap_ratio = 0;
if (idx_2G_end >= 0)
ch_end = idx_2G_end+1;
if (idx_5G_begin >= 0)
ch_begin = idx_5G_begin;
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
for (y=ch_begin; y<ch_end; y++)
printk("1. init: chnl[%d] 20M_rx[%d] 40M_rx[%d] fa_cnt[%d] score[%d]\n",
priv->available_chnl[y],
priv->chnl_ss_mac_rx_count[y],
priv->chnl_ss_mac_rx_count_40M[y],
priv->chnl_ss_fa_count[y],
score[y]);
printk("\n");
#endif
#if defined(CONFIG_RTL_88E_SUPPORT) || defined(CONFIG_WLAN_HAL_8192EE)
if( pDM_Odm->SupportICType&(ODM_RTL8188E|ODM_RTL8192E)&& priv->pmib->dot11RFEntry.acs_type )
{
u4Byte tmp_score[MAX_BSS_NUM];
memcpy(tmp_score, score, sizeof(score));
if (find_clean_channel(priv, ch_begin, ch_end, tmp_score)) {
//memcpy(score, tmp_score, sizeof(score));
#ifdef _DEBUG_RTL8192CD_
printk("!! Found clean channel, select minimum FA channel\n");
#endif
goto USE_CLN_CH;
}
#ifdef _DEBUG_RTL8192CD_
printk("!! Not found clean channel, use NHM algorithm\n");
#endif
use_nhm = 1;
USE_CLN_CH:
for (y=ch_begin; y<ch_end; y++) {
for (i=0; i<=9; i++) {
u4Byte val32 = priv->nhm_cnt[y][i];
for (j=0; j<i; j++)
val32 *= 3;
score[y] += val32;
}
#ifdef _DEBUG_RTL8192CD_
printk("nhm_cnt_%d: H<-[ %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d]->L, score: %d\n",
y+1, priv->nhm_cnt[y][9], priv->nhm_cnt[y][8], priv->nhm_cnt[y][7],
priv->nhm_cnt[y][6], priv->nhm_cnt[y][5], priv->nhm_cnt[y][4],
priv->nhm_cnt[y][3], priv->nhm_cnt[y][2], priv->nhm_cnt[y][1],
priv->nhm_cnt[y][0], score[y]);
#endif
}
if (!use_nhm)
memcpy(score, tmp_score, sizeof(score));
goto choose_ch;
}
#endif
// For each channel, weighting behind channels with MAC RX counter
//For each channel, weighting the channel with FA counter
for (y=ch_begin; y<ch_end; y++) {
score[y] += 8 * priv->chnl_ss_mac_rx_count[y];
if (priv->chnl_ss_mac_rx_count[y] > 30)
do_ap_check = 0;
if( priv->chnl_ss_mac_rx_count[y] > MAC_RX_COUNT_THRESHOLD )
traffic_check = 1;
#ifdef RTK_5G_SUPPORT
if (priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_2G)
#endif
{
if ((int)(y-4) >= (int)ch_begin)
score[y-4] += 2 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y-3) >= (int)ch_begin)
score[y-3] += 8 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y-2) >= (int)ch_begin)
score[y-2] += 8 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 10 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y+1) < (int)ch_end)
score[y+1] += 10 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y+2) < (int)ch_end)
score[y+2] += 8 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y+3) < (int)ch_end)
score[y+3] += 8 * priv->chnl_ss_mac_rx_count[y];
if ((int)(y+4) < (int)ch_end)
score[y+4] += 2 * priv->chnl_ss_mac_rx_count[y];
}
//this is for CH_LOAD caculation
if( priv->chnl_ss_cca_count[y] > priv->chnl_ss_fa_count[y])
priv->chnl_ss_cca_count[y]-= priv->chnl_ss_fa_count[y];
else
priv->chnl_ss_cca_count[y] = 0;
}
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
for (y=ch_begin; y<ch_end; y++)
printk("2. after 20M check: chnl[%d] score[%d]\n",priv->available_chnl[y], score[y]);
printk("\n");
#endif
for (y=ch_begin; y<ch_end; y++) {
if (priv->chnl_ss_mac_rx_count_40M[y]) {
score[y] += 5 * priv->chnl_ss_mac_rx_count_40M[y];
if (priv->chnl_ss_mac_rx_count_40M[y] > 30)
do_ap_check = 0;
if( priv->chnl_ss_mac_rx_count_40M[y] > MAC_RX_COUNT_THRESHOLD )
traffic_check = 1;
#ifdef RTK_5G_SUPPORT
if (priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_2G)
#endif
{
if ((int)(y-6) >= (int)ch_begin)
score[y-6] += 1 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y-5) >= (int)ch_begin)
score[y-5] += 4 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y-4) >= (int)ch_begin)
score[y-4] += 4 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y-3) >= (int)ch_begin)
score[y-3] += 5 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y-2) >= (int)ch_begin)
score[y-2] += (5 * priv->chnl_ss_mac_rx_count_40M[y])/2;
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 5 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y+1) < (int)ch_end)
score[y+1] += 5 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y+2) < (int)ch_end)
score[y+2] += (5 * priv->chnl_ss_mac_rx_count_40M[y])/2;
if ((int)(y+3) < (int)ch_end)
score[y+3] += 5 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y+4) < (int)ch_end)
score[y+4] += 4 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y+5) < (int)ch_end)
score[y+5] += 4 * priv->chnl_ss_mac_rx_count_40M[y];
if ((int)(y+6) < (int)ch_end)
score[y+6] += 1 * priv->chnl_ss_mac_rx_count_40M[y];
}
}
}
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
for (y=ch_begin; y<ch_end; y++)
printk("3. after 40M check: chnl[%d] score[%d]\n",priv->available_chnl[y], score[y]);
printk("\n");
printk("4. do_ap_check=%d traffic_check=%d\n", do_ap_check, traffic_check);
printk("\n");
#endif
if( traffic_check == 0)
fa_count_weighting = 5;
else
fa_count_weighting = 1;
for (y=ch_begin; y<ch_end; y++) {
score[y] += fa_count_weighting * priv->chnl_ss_fa_count[y];
}
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
for (y=ch_begin; y<ch_end; y++)
printk("5. after fa check: chnl[%d] score[%d]\n",priv->available_chnl[y], score[y]);
printk("\n");
#endif
if (do_ap_check) {
for (i=0; i<priv->site_survey->count; i++) {
pBss = &priv->site_survey->bss[i];
for (y=ch_begin; y<ch_end; y++) {
if (pBss->channel == priv->available_chnl[y]) {
if (pBss->channel <= 14) {
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
printk("chnl[%d] has ap rssi=%d bw[0x%02x]\n",
pBss->channel, pBss->rssi, pBss->t_stamp[1]);
printk("\n");
#endif
if (pBss->rssi > 60)
ap_ratio = 4;
else if (pBss->rssi > 35)
ap_ratio = 2;
else
ap_ratio = 1;
if ((pBss->t_stamp[1] & 0x6) == 0) {
score[y] += 50 * ap_ratio;
if ((int)(y-4) >= (int)ch_begin)
score[y-4] += 10 * ap_ratio;
if ((int)(y-3) >= (int)ch_begin)
score[y-3] += 20 * ap_ratio;
if ((int)(y-2) >= (int)ch_begin)
score[y-2] += 30 * ap_ratio;
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 40 * ap_ratio;
if ((int)(y+1) < (int)ch_end)
score[y+1] += 40 * ap_ratio;
if ((int)(y+2) < (int)ch_end)
score[y+2] += 30 * ap_ratio;
if ((int)(y+3) < (int)ch_end)
score[y+3] += 20 * ap_ratio;
if ((int)(y+4) < (int)ch_end)
score[y+4] += 10 * ap_ratio;
}
else if ((pBss->t_stamp[1] & 0x4) == 0) {
score[y] += 50 * ap_ratio;
if ((int)(y-3) >= (int)ch_begin)
score[y-3] += 20 * ap_ratio;
if ((int)(y-2) >= (int)ch_begin)
score[y-2] += 30 * ap_ratio;
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 40 * ap_ratio;
if ((int)(y+1) < (int)ch_end)
score[y+1] += 50 * ap_ratio;
if ((int)(y+2) < (int)ch_end)
score[y+2] += 50 * ap_ratio;
if ((int)(y+3) < (int)ch_end)
score[y+3] += 50 * ap_ratio;
if ((int)(y+4) < (int)ch_end)
score[y+4] += 50 * ap_ratio;
if ((int)(y+5) < (int)ch_end)
score[y+5] += 40 * ap_ratio;
if ((int)(y+6) < (int)ch_end)
score[y+6] += 30 * ap_ratio;
if ((int)(y+7) < (int)ch_end)
score[y+7] += 20 * ap_ratio;
}
else {
score[y] += 50 * ap_ratio;
if ((int)(y-7) >= (int)ch_begin)
score[y-7] += 20 * ap_ratio;
if ((int)(y-6) >= (int)ch_begin)
score[y-6] += 30 * ap_ratio;
if ((int)(y-5) >= (int)ch_begin)
score[y-5] += 40 * ap_ratio;
if ((int)(y-4) >= (int)ch_begin)
score[y-4] += 50 * ap_ratio;
if ((int)(y-3) >= (int)ch_begin)
score[y-3] += 50 * ap_ratio;
if ((int)(y-2) >= (int)ch_begin)
score[y-2] += 50 * ap_ratio;
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 50 * ap_ratio;
if ((int)(y+1) < (int)ch_end)
score[y+1] += 40 * ap_ratio;
if ((int)(y+2) < (int)ch_end)
score[y+2] += 30 * ap_ratio;
if ((int)(y+3) < (int)ch_end)
score[y+3] += 20 * ap_ratio;
}
}
else {
if ((pBss->t_stamp[1] & 0x6) == 0) {
score[y] += 500;
}
else if ((pBss->t_stamp[1] & 0x4) == 0) {
score[y] += 500;
if ((int)(y+1) < (int)ch_end)
score[y+1] += 500;
}
else {
score[y] += 500;
if ((int)(y-1) >= (int)ch_begin)
score[y-1] += 500;
}
}
break;
}
}
}
}
#ifdef ACS_DEBUG_INFO//for debug
printk("\n");
for (y=ch_begin; y<ch_end; y++)
printk("6. after ap check: chnl[%d]:%d\n", priv->available_chnl[y],score[y]);
printk("\n");
#endif
#ifdef SS_CH_LOAD_PROC
// caculate noise level -- suggested by wilson
for (y=ch_begin; y<ch_end; y++) {
int fa_lv=0, cca_lv=0;
if (priv->chnl_ss_fa_count[y]>1000) {
fa_lv = 100;
} else if (priv->chnl_ss_fa_count[y]>500) {
fa_lv = 34 * (priv->chnl_ss_fa_count[y]-500) / 500 + 66;
} else if (priv->chnl_ss_fa_count[y]>200) {
fa_lv = 33 * (priv->chnl_ss_fa_count[y] - 200) / 300 + 33;
} else if (priv->chnl_ss_fa_count[y]>100) {
fa_lv = 18 * (priv->chnl_ss_fa_count[y] - 100) / 100 + 15;
} else {
fa_lv = 15 * priv->chnl_ss_fa_count[y] / 100;
}
if (priv->chnl_ss_cca_count[y]>400) {
cca_lv = 100;
} else if (priv->chnl_ss_cca_count[y]>200) {
cca_lv = 34 * (priv->chnl_ss_cca_count[y] - 200) / 200 + 66;
} else if (priv->chnl_ss_cca_count[y]>80) {
cca_lv = 33 * (priv->chnl_ss_cca_count[y] - 80) / 120 + 33;
} else if (priv->chnl_ss_cca_count[y]>40) {
cca_lv = 18 * (priv->chnl_ss_cca_count[y] - 40) / 40 + 15;
} else {
cca_lv = 15 * priv->chnl_ss_cca_count[y] / 40;
}
priv->chnl_ss_load[y] = (((fa_lv > cca_lv)? fa_lv : cca_lv)*75+((score[y]>100)?100:score[y])*25)/100;
DEBUG_INFO("ch:%d f=%d (%d), c=%d (%d), fl=%d, cl=%d, sc=%d, cu=%d\n",
priv->available_chnl[y],
priv->chnl_ss_fa_count[y], fa_thd,
priv->chnl_ss_cca_count[y], cca_thd,
fa_lv,
cca_lv,
score[y],
priv->chnl_ss_load[y]);
}
#endif
}
#endif
choose_ch:
#ifdef DFS
// heavy weighted DFS channel
if (idx_5G_begin >= 0){
for (i=idx_5G_begin; i<priv->available_chnl_num; i++) {
if (!priv->pmib->dot11DFSEntry.disable_DFS && is_DFS_channel(priv->available_chnl[i])
&& (score[i]!= 0xffffffff)){
score[i] += 1600;
}
}
}
#endif
//prevent Auto Channel selecting wrong channel in 40M mode-----------------
if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N)
&& priv->pshare->is_40m_bw) {
#if 0
if (GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset == 1) {
//Upper Primary Channel, cannot select the two lowest channels
if (priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) {
score[0] = 0xffffffff;
score[1] = 0xffffffff;
score[2] = 0xffffffff;
score[3] = 0xffffffff;
score[4] = 0xffffffff;
score[13] = 0xffffffff;
score[12] = 0xffffffff;
score[11] = 0xffffffff;
}
// if (priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) {
// score[idx_5G_begin] = 0xffffffff;
// score[idx_5G_begin + 1] = 0xffffffff;
// }
}
else if (GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset == 2) {
//Lower Primary Channel, cannot select the two highest channels
if (priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) {
score[0] = 0xffffffff;
score[1] = 0xffffffff;
score[2] = 0xffffffff;
score[13] = 0xffffffff;
score[12] = 0xffffffff;
score[11] = 0xffffffff;
score[10] = 0xffffffff;
score[9] = 0xffffffff;
}
// if (priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) {
// score[priv->available_chnl_num - 2] = 0xffffffff;
// score[priv->available_chnl_num - 1] = 0xffffffff;
// }
}
#endif
for (i=0; i<=idx_2G_end; ++i)
if (priv->available_chnl[i] == 14)
score[i] = 0xffffffff; // mask chan14
#ifdef RTK_5G_SUPPORT
if (idx_5G_begin >= 0) {
for (i=idx_5G_begin; i<priv->available_chnl_num; i++) {
int ch = priv->available_chnl[i];
if(priv->available_chnl[i] > 144)
--ch;
if((ch%4) || ch==140 || ch == 164 ) //mask ch 140, ch 165, ch 184...
score[i] = 0xffffffff;
}
}
#endif
}
if (priv->pmib->dot11RFEntry.disable_ch1213) {
for (i=0; i<=idx_2G_end; ++i) {
int ch = priv->available_chnl[i];
if ((ch == 12) || (ch == 13))
score[i] = 0xffffffff;
}
}
if (((priv->pmib->dot11StationConfigEntry.dot11RegDomain == DOMAIN_GLOBAL) ||
(priv->pmib->dot11StationConfigEntry.dot11RegDomain == DOMAIN_WORLD_WIDE)) &&
(idx_2G_end >= 11) && (idx_2G_end < 14)) {
score[13] = 0xffffffff; // mask chan14
score[12] = 0xffffffff; // mask chan13
score[11] = 0xffffffff; // mask chan12
}
//------------------------------------------------------------------
#ifdef _DEBUG_RTL8192CD_
for (i=0; i<priv->available_chnl_num; i++) {
len += sprintf(tmpbuf+len, "ch%d:%u ", priv->available_chnl[i], score[i]);
}
strcat(tmpbuf, "\n");
panic_printk("%s", tmpbuf);
#endif
if ( (priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_5G)
&& (priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_80))
{
for (i=0; i<priv->available_chnl_num; i++) {
if (is80MChannel(priv->available_chnl, priv->available_chnl_num, priv->available_chnl[i])) {
tmpScore = 0;
for (j=0; j<4; j++) {
if ((tmpScore != 0xffffffff) && (score[i+j] != 0xffffffff))
tmpScore += score[i+j];
else
tmpScore = 0xffffffff;
}
tmpScore = tmpScore / 4;
if (minScore > tmpScore) {
minScore = tmpScore;
tmpScore = 0xffffffff;
for (j=0; j<4; j++) {
if (score[i+j] < tmpScore) {
tmpScore = score[i+j];
tmpIdx = i+j;
}
}
idx = tmpIdx;
}
i += 3;
}
}
if (minScore == 0xffffffff) {
// there is no 80M channels
priv->pshare->is_40m_bw = HT_CHANNEL_WIDTH_20;
for (i=0; i<priv->available_chnl_num; i++) {
if (score[i] < minScore) {
minScore = score[i];
idx = i;
}
}
}
}
else if( (priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_5G)
&& (priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_20_40))
{
for (i=0; i<priv->available_chnl_num; i++) {
if(is40MChannel(priv->available_chnl,priv->available_chnl_num,priv->available_chnl[i])) {
tmpScore = 0;
for(j=0;j<2;j++) {
if ((tmpScore != 0xffffffff) && (score[i+j] != 0xffffffff))
tmpScore += score[i+j];
else
tmpScore = 0xffffffff;
}
tmpScore = tmpScore / 2;
if(minScore > tmpScore) {
minScore = tmpScore;
tmpScore = 0xffffffff;
for (j=0; j<2; j++) {
if (score[i+j] < tmpScore) {
tmpScore = score[i+j];
tmpIdx = i+j;
}
}
idx = tmpIdx;
}
i += 1;
}
}
if (minScore == 0xffffffff) {
// there is no 40M channels
priv->pshare->is_40m_bw = HT_CHANNEL_WIDTH_20;
for (i=0; i<priv->available_chnl_num; i++) {
if (score[i] < minScore) {
minScore = score[i];
idx = i;
}
}
}
}
else if( (priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_2G)
&& (priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_20_40)
&& (priv->available_chnl_num >= 8) )
{
u4Byte groupScore[14];
memset(groupScore, 0xff , sizeof(groupScore));
for (i=0; i<priv->available_chnl_num-4; i++) {
if (score[i] != 0xffffffff && score[i+4] != 0xffffffff) {
groupScore[i] = score[i] + score[i+4];
DEBUG_INFO("groupScore, ch %d,%d: %d\n", i+1, i+5, groupScore[i]);
if (groupScore[i] < minScore) {
#ifdef AUTOCH_SS_SPEEDUP
if(priv->pmib->miscEntry.autoch_1611_enable)
{
if(priv->available_chnl[i]==1 || priv->available_chnl[i]==6 || priv->available_chnl[i]==11)
{
minScore = groupScore[i];
idx = i;
}
}
else
#endif
{
minScore = groupScore[i];
idx = i;
}
}
}
}
if (score[idx] < score[idx+4]) {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_ABOVE;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_ABOVE;
} else {
idx = idx + 4;
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_BELOW;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_BELOW;
}
}
else
{
for (i=0; i<priv->available_chnl_num; i++) {
if (score[i] < minScore) {
#ifdef AUTOCH_SS_SPEEDUP
if(priv->pmib->miscEntry.autoch_1611_enable)
{
if(priv->available_chnl[i]==1 || priv->available_chnl[i]==6 || priv->available_chnl[i]==11)
{
minScore = score[i];
idx = i;
}
}
else
#endif
{
minScore = score[i];
idx = i;
}
}
}
}
if (IS_A_CUT_8881A(priv) &&
(priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_80)) {
if ((priv->available_chnl[idx] == 36) ||
(priv->available_chnl[idx] == 52) ||
(priv->available_chnl[idx] == 100) ||
(priv->available_chnl[idx] == 116) ||
(priv->available_chnl[idx] == 132) ||
(priv->available_chnl[idx] == 149) ||
(priv->available_chnl[idx] == 165))
idx++;
else if ((priv->available_chnl[idx] == 48) ||
(priv->available_chnl[idx] == 64) ||
(priv->available_chnl[idx] == 112) ||
(priv->available_chnl[idx] == 128) ||
(priv->available_chnl[idx] == 144) ||
(priv->available_chnl[idx] == 161) ||
(priv->available_chnl[idx] == 177))
idx--;
}
minChan = priv->available_chnl[idx];
// skip channel 14 if don't support ofdm
if ((priv->pmib->dot11RFEntry.disable_ch14_ofdm) &&
(minChan == 14)) {
score[idx] = 0xffffffff;
minScore = 0xffffffff;
for (i=0; i<priv->available_chnl_num; i++) {
if (score[i] < minScore) {
minScore = score[i];
idx = i;
}
}
minChan = priv->available_chnl[idx];
}
#if 0
//Check if selected channel available for 80M/40M BW or NOT ?
if(priv->pmib->dot11RFEntry.phyBandSelect == PHY_BAND_5G)
{
if(priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_80)
{
if(!is80MChannel(priv->available_chnl,priv->available_chnl_num,minChan))
{
//printk("BW=80M, selected channel = %d is unavaliable! reduce to 40M\n", minChan);
//priv->pmib->dot11nConfigEntry.dot11nUse40M = HT_CHANNEL_WIDTH_20_40;
priv->pshare->is_40m_bw = HT_CHANNEL_WIDTH_20_40;
}
}
if(priv->pmib->dot11nConfigEntry.dot11nUse40M == HT_CHANNEL_WIDTH_20_40)
{
if(!is40MChannel(priv->available_chnl,priv->available_chnl_num,minChan))
{
//printk("BW=40M, selected channel = %d is unavaliable! reduce to 20M\n", minChan);
//priv->pmib->dot11nConfigEntry.dot11nUse40M = HT_CHANNEL_WIDTH_20;
priv->pshare->is_40m_bw = HT_CHANNEL_WIDTH_20;
}
}
}
#endif
#ifdef CONFIG_RTL_NEW_AUTOCH
RTL_W32(RXERR_RPT, RXERR_RPT_RST);
#endif
// auto adjust contro-sideband
if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11N)
&& (priv->pshare->is_40m_bw ==1 || priv->pshare->is_40m_bw ==2)) {
#ifdef RTK_5G_SUPPORT
if (priv->pmib->dot11RFEntry.phyBandSelect & PHY_BAND_5G) {
if( (minChan>144) ? ((minChan-1)%8) : (minChan%8)) {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_ABOVE;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_ABOVE;
} else {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_BELOW;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_BELOW;
}
} else
#endif
{
#if 0
#ifdef CONFIG_RTL_NEW_AUTOCH
unsigned int ch_max;
if (priv->available_chnl[idx_2G_end] >= 13)
ch_max = 13;
else
ch_max = priv->available_chnl[idx_2G_end];
if ((minChan >= 5) && (minChan <= (ch_max-5))) {
if (score[minChan+4] > score[minChan-4]) { // what if some channels were cancelled?
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_BELOW;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_BELOW;
} else {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_ABOVE;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_ABOVE;
}
} else
#endif
{
if (minChan < 5) {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_ABOVE;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_ABOVE;
}
else if (minChan > 7) {
GET_MIB(priv)->dot11nConfigEntry.dot11n2ndChOffset = HT_2NDCH_OFFSET_BELOW;
priv->pshare->offset_2nd_chan = HT_2NDCH_OFFSET_BELOW;
}
}
#endif
}
}
//-----------------------
#if defined(__ECOS) && defined(CONFIG_SDIO_HCI)
panic_printk("Auto channel choose ch:%d\n", minChan);
#else
#ifdef _DEBUG_RTL8192CD_
panic_printk("Auto channel choose ch:%d\n", minChan);
#endif
#endif
#ifdef ACS_DEBUG_INFO//for debug
printk("7. minChan:%d 2nd_offset:%d\n", minChan, priv->pshare->offset_2nd_chan);
#endif
return minChan;
}
*/
#endif
VOID
phydm_CLMInit(
IN PVOID pDM_VOID,
IN u2Byte sampleNum /*unit : 4us*/
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_TIME_PERIOD_11AC, bMaskLWord, sampleNum); /*4us sample 1 time*/
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11AC, BIT8, 0x1); /*Enable CCX for CLM*/
} else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) {
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_TIME_PERIOD_11N, bMaskLWord, sampleNum); /*4us sample 1 time*/
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11N, BIT8, 0x1); /*Enable CCX for CLM*/
}
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[%s] : CLM sampleNum = %d\n", __func__, sampleNum));
}
VOID
phydm_CLMtrigger(
IN PVOID pDM_VOID
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) {
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11AC, BIT0, 0x0); /*Trigger CLM*/
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11AC, BIT0, 0x1);
} else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) {
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11N, BIT0, 0x0); /*Trigger CLM*/
ODM_SetBBReg(pDM_Odm, ODM_REG_CLM_11N, BIT0, 0x1);
}
}
BOOLEAN
phydm_checkCLMready(
IN PVOID pDM_VOID
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
u4Byte value32 = 0;
BOOLEAN ret = FALSE;
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_CLM_RESULT_11AC, bMaskDWord); /*make sure CLM calc is ready*/
else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_CLM_READY_11N, bMaskDWord); /*make sure CLM calc is ready*/
if (value32 & BIT16)
ret = TRUE;
else
ret = FALSE;
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[%s] : CLM ready = %d\n", __func__, ret));
return ret;
}
u2Byte
phydm_getCLMresult(
IN PVOID pDM_VOID
)
{
PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID;
u4Byte value32 = 0;
u2Byte results = 0;
if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES)
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_CLM_RESULT_11AC, bMaskDWord); /*read CLM calc result*/
else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
value32 = ODM_GetBBReg(pDM_Odm, ODM_REG_CLM_RESULT_11N, bMaskDWord); /*read CLM calc result*/
results = (u2Byte)(value32 & bMaskLWord);
ODM_RT_TRACE(pDM_Odm, ODM_COMP_ACS, ODM_DBG_LOUD, ("[%s] : CLM result = %d\n", __func__, results));
return results;
/*results are number of CCA times in sampleNum*/
}
| JideTechnology/remixos-kernel | drivers/staging/rtl8812au/hal/phydm/phydm_acs.c | C | gpl-2.0 | 41,700 |
<?php
namespace Pantheon\Terminus\UnitTests\Commands\Tag;
use Pantheon\Terminus\Collections\OrganizationSiteMemberships;
use Pantheon\Terminus\Collections\UserOrganizationMemberships;
use Pantheon\Terminus\Models\Organization;
use Pantheon\Terminus\Models\OrganizationSiteMembership;
use Pantheon\Terminus\Models\User;
use Pantheon\Terminus\Models\UserOrganizationMembership;
use Pantheon\Terminus\Session\Session;
use Pantheon\Terminus\UnitTests\Commands\CommandTestCase;
use Pantheon\Terminus\Collections\Tags;
/**
* Class TagCommandTest
* Abstract testing class for Pantheon\Terminus\Commands\Tag\*Command
* @package Pantheon\Terminus\UnitTests\Commands\Tag
*/
abstract class TagCommandTest extends CommandTestCase
{
/**
* @inheritdoc
*/
protected function setUp()
{
parent::setUp();
$this->site->id = 'site_id';
$this->session = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()
->getMock();
$user = $this->getMockBuilder(User::class)
->disableOriginalConstructor()
->getMock();
$this->org_site_membership = $this->getMockBuilder(OrganizationSiteMembership::class)
->disableOriginalConstructor()
->getMock();
$this->tags = $this->getMockBuilder(Tags::class)
->disableOriginalConstructor()
->getMock();
$user_org_memberships = $this->getMockBuilder(UserOrganizationMemberships::class)
->disableOriginalConstructor()
->getMock();
$user_org_membership = $this->getMockBuilder(UserOrganizationMembership::class)
->disableOriginalConstructor()
->getMock();
$this->organization = $this->getMockBuilder(Organization::class)
->disableOriginalConstructor()
->getMock();
$this->organization->id = 'org_id';
$this->org_site_memberships = $this->getMockBuilder(OrganizationSiteMemberships::class)
->disableOriginalConstructor()
->getMock();
$this->org_site_membership = $this->getMockBuilder(OrganizationSiteMembership::class)
->disableOriginalConstructor()
->getMock();
$this->tags = $this->getMockBuilder(Tags::class)
->disableOriginalConstructor()
->getMock();
$this->site->tags = $this->tags;
$this->org_site_membership->method('getSite')->willReturn($this->site);
$this->session->expects($this->once())
->method('getUser')
->with()
->willReturn($user);
$user->expects($this->once())
->method('getOrgMemberships')
->with()
->willReturn($user_org_memberships);
$user_org_memberships->expects($this->once())
->method('get')
->with($this->organization->id)
->willReturn($user_org_membership);
$user_org_membership->expects($this->once())
->method('getOrganization')
->with()
->willReturn($this->organization);
$this->organization->expects($this->once())
->method('getSiteMemberships')
->with()
->willReturn($this->org_site_memberships);
$this->org_site_memberships->expects($this->once())
->method('get')
->with($this->site->id)
->willReturn($this->org_site_membership);
}
}
| rloos289/PDXwing | vendor/pantheon-systems/terminus/tests/unit_tests/Commands/Tag/TagCommandTest.php | PHP | gpl-2.0 | 3,447 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_60) on Thu Jul 17 09:47:20 BST 2014 -->
<title>tools</title>
<meta name="date" content="2014-07-17">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="tools";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-files/index-1.html">Index</a></li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../ontology/sprites/producer/package-summary.html">Prev Package</a></li>
<li>Next Package</li>
</ul>
<ul class="navList">
<li><a href="../index.html?tools/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package tools</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../tools/ElapsedCpuTimer.html" title="class in tools">ElapsedCpuTimer</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../tools/IO.html" title="class in tools">IO</a></td>
<td class="colLast">
<div class="block">Created with IntelliJ IDEA.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../tools/JEasyFrame.html" title="class in tools">JEasyFrame</a></td>
<td class="colLast">
<div class="block">Frame for the graphics.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../tools/KeyInput.html" title="class in tools">KeyInput</a></td>
<td class="colLast">
<div class="block">This class is used to manage the key input.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../tools/Pair.html" title="class in tools">Pair</a></td>
<td class="colLast">
<div class="block">Created with IntelliJ IDEA.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../tools/StatSummary.html" title="class in tools">StatSummary</a></td>
<td class="colLast">
<div class="block">This class is used to model the statistics
of a fix of numbers.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../tools/Utils.html" title="class in tools">Utils</a></td>
<td class="colLast">
<div class="block">Created with IntelliJ IDEA.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../tools/Vector2d.html" title="class in tools">Vector2d</a></td>
<td class="colLast">
<div class="block">This class represents a vector, or a position, in the map.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation">
<caption><span>Enum Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Enum</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../tools/ElapsedCpuTimer.TimerType.html" title="enum in tools">ElapsedCpuTimer.TimerType</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-files/index-1.html">Index</a></li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../ontology/sprites/producer/package-summary.html">Prev Package</a></li>
<li>Next Package</li>
</ul>
<ul class="navList">
<li><a href="../index.html?tools/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| benelot/GVG-AI-2015 | doc/javadoc/tools/package-summary.html | HTML | gpl-2.0 | 6,179 |
; void p_forward_list_clear_fastcall(p_forward_list_t *list)
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC _p_forward_list_clear_fastcall
EXTERN asm_p_forward_list_clear
defc _p_forward_list_clear_fastcall = asm_p_forward_list_clear
| bitfixer/bitfixer | dg/z88dk/libsrc/_DEVELOPMENT/adt/p_forward_list/c/sdcc_iy/p_forward_list_clear_fastcall.asm | Assembly | gpl-2.0 | 249 |
/**
* Client UI Javascript for the Calendar plugin
*
* @version @package_version@
* @author Lazlo Westerhof <hello@lazlo.me>
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
* Copyright (C) 2010, Lazlo Westerhof <hello@lazlo.me>
* Copyright (C) 2012, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Roundcube calendar UI client class
function rcube_calendar_ui(settings)
{
// extend base class
rcube_calendar.call(this, settings);
/*** member vars ***/
this.is_loading = false;
this.selected_event = null;
this.selected_calendar = null;
this.search_request = null;
this.saving_lock;
/*** private vars ***/
var DAY_MS = 86400000;
var HOUR_MS = 3600000;
var me = this;
var gmt_offset = (new Date().getTimezoneOffset() / -60) - (settings.timezone || 0) - (settings.dst || 0);
var client_timezone = new Date().getTimezoneOffset();
var day_clicked = day_clicked_ts = 0;
var ignore_click = false;
var event_defaults = { free_busy:'busy', alarms:'' };
var event_attendees = [];
var attendees_list;
var freebusy_ui = { workinhoursonly:false, needsupdate:false };
var freebusy_data = {};
var current_view = null;
var exec_deferred = bw.ie6 ? 5 : 1;
var sensitivitylabels = { 'public':rcmail.gettext('public','calendar'), 'private':rcmail.gettext('private','calendar'), 'confidential':rcmail.gettext('confidential','calendar') };
var ui_loading = rcmail.set_busy(true, 'loading');
// general datepicker settings
var datepicker_settings = {
// translate from fullcalendar format to datepicker format
dateFormat: settings['date_format'].replace(/M/g, 'm').replace(/mmmmm/, 'MM').replace(/mmm/, 'M').replace(/dddd/, 'DD').replace(/ddd/, 'D').replace(/yy/g, 'y'),
firstDay : settings['first_day'],
dayNamesMin: settings['days_short'],
monthNames: settings['months'],
monthNamesShort: settings['months'],
changeMonth: false,
showOtherMonths: true,
selectOtherMonths: true
};
/*** imports ***/
var Q = this.quote_html;
var text2html = this.text2html;
var event_date_text = this.event_date_text;
var parse_datetime = this.parse_datetime;
var date2unixtime = this.date2unixtime;
var fromunixtime = this.fromunixtime;
var parseISO8601 = this.parseISO8601;
var init_alarms_edit = this.init_alarms_edit;
/*** private methods ***/
// same as str.split(delimiter) but it ignores delimiters within quoted strings
var explode_quoted_string = function(str, delimiter)
{
var result = [],
strlen = str.length,
q, p, i, char, last;
for (q = p = i = 0; i < strlen; i++) {
char = str.charAt(i);
if (char == '"' && last != '\\') {
q = !q;
}
else if (!q && char == delimiter) {
result.push(str.substring(p, i));
p = i + 1;
}
last = char;
}
result.push(str.substr(p));
return result;
};
// clone the given date object and optionally adjust time
var clone_date = function(date, adjust)
{
var d = new Date(date.getTime());
// set time to 00:00
if (adjust == 1) {
d.setHours(0);
d.setMinutes(0);
}
// set time to 23:59
else if (adjust == 2) {
d.setHours(23);
d.setMinutes(59);
}
return d;
};
// fix date if jumped over a DST change
var fix_date = function(date)
{
if (date.getHours() == 23)
date.setTime(date.getTime() + HOUR_MS);
else if (date.getHours() > 0)
date.setHours(0);
};
// turn the given date into an ISO 8601 date string understandable by PHPs strtotime()
var date2servertime = function(date)
{
return date.getFullYear()+'-'+zeropad(date.getMonth()+1)+'-'+zeropad(date.getDate())
+ 'T'+zeropad(date.getHours())+':'+zeropad(date.getMinutes())+':'+zeropad(date.getSeconds());
}
var date2timestring = function(date, dateonly)
{
return date2servertime(date).replace(/[^0-9]/g, '').substr(0, (dateonly ? 8 : 14));
}
var zeropad = function(num)
{
return (num < 10 ? '0' : '') + num;
}
var render_link = function(url)
{
var islink = false, href = url;
if (url.match(/^[fhtpsmailo]+?:\/\//i)) {
islink = true;
}
else if (url.match(/^[a-z0-9.-:]+(\/|$)/i)) {
islink = true;
href = 'http://' + url;
}
return islink ? '<a href="' + Q(href) + '" target="_blank">' + Q(url) + '</a>' : Q(url);
}
// determine whether the given date is on a weekend
var is_weekend = function(date)
{
return date.getDay() == 0 || date.getDay() == 6;
};
var is_workinghour = function(date)
{
if (settings['work_start'] > settings['work_end'])
return date.getHours() >= settings['work_start'] || date.getHours() < settings['work_end'];
else
return date.getHours() >= settings['work_start'] && date.getHours() < settings['work_end'];
};
// check if the event has 'real' attendees, excluding the current user
var has_attendees = function(event)
{
return (event.attendees && event.attendees.length && (event.attendees.length > 1 || String(event.attendees[0].email).toLowerCase() != settings.identity.email));
};
// check if the current user is an attendee of this event
var is_attendee = function(event, role, email)
{
var emails = email ? ';'+email.toLowerCase() : settings.identity.emails;
for (var i=0; event.attendees && i < event.attendees.length; i++) {
if ((!role || event.attendees[i].role == role) && event.attendees[i].email && emails.indexOf(';'+event.attendees[i].email.toLowerCase()) >= 0)
return event.attendees[i];
}
return false;
};
// check if the current user is the organizer
var is_organizer = function(event, email)
{
return is_attendee(event, 'ORGANIZER', email) || !event.id;
};
var load_attachment = function(event, att)
{
var qstring = '_id='+urlencode(att.id)+'&_event='+urlencode(event.recurrence_id||event.id)+'&_cal='+urlencode(event.calendar);
// open attachment in frame if it's of a supported mimetype
if (id && att.mimetype && $.inArray(att.mimetype, settings.mimetypes)>=0) {
if (rcmail.open_window(rcmail.env.comm_path+'&_action=get-attachment&'+qstring+'&_frame=1', true, true)) {
return;
}
}
rcmail.goto_url('get-attachment', qstring+'&_download=1', false);
};
// build event attachments list
var event_show_attachments = function(list, container, event, edit)
{
var i, id, len, img, content, li, elem,
ul = document.createElement('UL');
ul.className = 'attachmentslist';
for (i=0, len=list.length; i<len; i++) {
elem = list[i];
li = document.createElement('LI');
li.className = elem.classname;
if (edit) {
rcmail.env.attachments[elem.id] = elem;
// delete icon
content = document.createElement('A');
content.href = '#delete';
content.title = rcmail.gettext('delete');
content.className = 'delete';
$(content).click({id: elem.id}, function(e) { remove_attachment(this, e.data.id); return false; });
if (!rcmail.env.deleteicon)
content.innerHTML = rcmail.gettext('delete');
else {
img = document.createElement('IMG');
img.src = rcmail.env.deleteicon;
img.alt = rcmail.gettext('delete');
content.appendChild(img);
}
li.appendChild(content);
}
// name/link
content = document.createElement('A');
content.innerHTML = elem.name;
content.className = 'file';
content.href = '#load';
$(content).click({event: event, att: elem}, function(e) {
load_attachment(e.data.event, e.data.att); return false; });
li.appendChild(content);
ul.appendChild(li);
}
if (edit && rcmail.gui_objects.attachmentlist) {
ul.id = rcmail.gui_objects.attachmentlist.id;
rcmail.gui_objects.attachmentlist = ul;
}
container.empty().append(ul);
};
var remove_attachment = function(elem, id)
{
$(elem.parentNode).hide();
rcmail.env.deleted_attachments.push(id);
delete rcmail.env.attachments[id];
};
// event details dialog (show only)
var event_show_dialog = function(event)
{
var $dialog = $("#eventshow").removeClass().addClass('uidialog');
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:false };
me.selected_event = event;
// allow other plugins to do actions when event form is opened
rcmail.triggerEvent('calendar-event-init', {o: event});
$dialog.find('div.event-section, div.event-line').hide();
$('#event-title').html(Q(event.title)).show();
if (event.location)
$('#event-location').html('@ ' + text2html(event.location)).show();
if (event.description)
$('#event-description').show().children('.event-text').html(text2html(event.description, 300, 6));
if (event.vurl)
$('#event-url').show().children('.event-text').html(render_link(event.vurl));
// render from-to in a nice human-readable way
// -> now shown in dialog title
// $('#event-date').html(Q(me.event_date_text(event))).show();
if (event.recurrence && event.recurrence_text)
$('#event-repeat').show().children('.event-text').html(Q(event.recurrence_text));
if (event.alarms && event.alarms_text)
$('#event-alarm').show().children('.event-text').html(Q(event.alarms_text));
if (calendar.name)
$('#event-calendar').show().children('.event-text').html(Q(calendar.name)).removeClass().addClass('event-text').addClass('cal-'+calendar.id);
if (event.categories)
$('#event-category').show().children('.event-text').html(Q(event.categories)).removeClass().addClass('event-text cat-'+String(event.categories).replace(rcmail.identifier_expr, ''));
if (event.free_busy)
$('#event-free-busy').show().children('.event-text').html(Q(rcmail.gettext(event.free_busy, 'calendar')));
if (event.priority > 0) {
var priolabels = [ '', rcmail.gettext('highest'), rcmail.gettext('high'), '', '', rcmail.gettext('normal'), '', '', rcmail.gettext('low'), rcmail.gettext('lowest') ];
$('#event-priority').show().children('.event-text').html(Q(event.priority+' '+priolabels[event.priority]));
}
if (event.sensitivity && event.sensitivity != 'public') {
$('#event-sensitivity').show().children('.event-text').html(Q(sensitivitylabels[event.sensitivity]));
$dialog.addClass('sensitivity-'+event.sensitivity);
}
// create attachments list
if ($.isArray(event.attachments)) {
event_show_attachments(event.attachments, $('#event-attachments').children('.event-text'), event);
if (event.attachments.length > 0) {
$('#event-attachments').show();
}
}
else if (calendar.attachments) {
// fetch attachments, some drivers doesn't set 'attachments' prop of the event?
}
// list event attendees
if (calendar.attendees && event.attendees) {
var data, dispname, organizer = false, rsvp = false, line, morelink, html = '',overflow = '';
for (var j=0; j < event.attendees.length; j++) {
data = event.attendees[j];
dispname = Q(data.name || data.email);
if (data.email) {
dispname = '<a href="mailto:' + data.email + '" title="' + Q(data.email) + '" class="mailtolink">' + dispname + '</a>';
if (data.role == 'ORGANIZER')
organizer = true;
else if ((data.status == 'NEEDS-ACTION' || data.status == 'TENTATIVE') && settings.identity.emails.indexOf(';'+data.email) >= 0)
rsvp = data.status.toLowerCase();
}
line = '<span class="attendee ' + String(data.role == 'ORGANIZER' ? 'organizer' : data.status).toLowerCase() + '">' + dispname + '</span> ';
if (morelink)
overflow += line;
else
html += line;
// stop listing attendees
if (j == 7 && event.attendees.length >= 7) {
morelink = $('<a href="#more" class="morelink"></a>').html(rcmail.gettext('andnmore', 'calendar').replace('$nr', event.attendees.length - j - 1));
}
}
if (html && (event.attendees.length > 1 || !organizer)) {
$('#event-attendees').show()
.children('.event-text')
.html(html)
.find('a.mailtolink').click(function(e) { rcmail.redirect(rcmail.url('mail/compose', { _to:this.href.substr(7) })); return false; });
// display all attendees in a popup when clicking the "more" link
if (morelink) {
$('#event-attendees .event-text').append(morelink);
morelink.click(function(e){
rcmail.show_popup_dialog(
'<div id="all-event-attendees" class="event-attendees">' + html + overflow + '</div>',
rcmail.gettext('tabattendees','calendar'),
null,
{ width:450, modal:false });
$('#all-event-attendees a.mailtolink').click(function(e) { rcmail.redirect(rcmail.url('mail/compose', { _to:this.href.substr(7) })); return false; });
return false;
})
}
}
$('#event-rsvp')[(rsvp&&!organizer?'show':'hide')]();
$('#event-rsvp .rsvp-buttons input').prop('disabled', false).filter('input[rel='+rsvp+']').prop('disabled', true);
}
var buttons = {};
if (calendar.editable && event.editable !== false) {
buttons[rcmail.gettext('edit', 'calendar')] = function() {
event_edit_dialog('edit', event);
};
buttons[rcmail.gettext('remove', 'calendar')] = function() {
me.delete_event(event);
$dialog.dialog('close');
};
}
else {
buttons[rcmail.gettext('close', 'calendar')] = function(){
$dialog.dialog('close');
};
}
// open jquery UI dialog
$dialog.dialog({
modal: false,
resizable: !bw.ie6,
closeOnEscape: (!bw.ie6 && !bw.ie7), // disable for performance reasons
title: Q(me.event_date_text(event)),
open: function() {
$dialog.parent().find('.ui-button').first().focus();
},
close: function() {
$dialog.dialog('destroy').hide();
},
buttons: buttons,
minWidth: 320,
width: 420
}).show();
// set dialog size according to content
me.dialog_resize($dialog.get(0), $dialog.height(), 420);
/*
// add link for "more options" drop-down
$('<a>')
.attr('href', '#')
.html('More Options')
.addClass('dropdown-link')
.click(function(){ return false; })
.insertBefore($dialog.parent().find('.ui-dialog-buttonset').children().first());
*/
};
// bring up the event dialog (jquery-ui popup)
var event_edit_dialog = function(action, event)
{
// close show dialog first
$("#eventshow:ui-dialog").dialog('close');
var $dialog = $('<div>');
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:action=='new' };
me.selected_event = $.extend($.extend({}, event_defaults), event); // clone event object (with defaults)
event = me.selected_event; // change reference to clone
freebusy_ui.needsupdate = false;
// reset dialog first
$('#eventtabs').get(0).reset();
// allow other plugins to do actions when event form is opened
rcmail.triggerEvent('calendar-event-init', {o: event});
// event details
var title = $('#edit-title').val(event.title || '');
var location = $('#edit-location').val(event.location || '');
var description = $('#edit-description').html(event.description || '');
var vurl = $('#edit-url').val(event.vurl || '');
var categories = $('#edit-categories').val(event.categories);
var calendars = $('#edit-calendar').val(event.calendar);
var freebusy = $('#edit-free-busy').val(event.free_busy);
var priority = $('#edit-priority').val(event.priority);
var sensitivity = $('#edit-sensitivity').val(event.sensitivity);
var duration = Math.round((event.end.getTime() - event.start.getTime()) / 1000);
var startdate = $('#edit-startdate').val($.fullCalendar.formatDate(event.start, settings['date_format'])).data('duration', duration);
var starttime = $('#edit-starttime').val($.fullCalendar.formatDate(event.start, settings['time_format'])).show();
var enddate = $('#edit-enddate').val($.fullCalendar.formatDate(event.end, settings['date_format']));
var endtime = $('#edit-endtime').val($.fullCalendar.formatDate(event.end, settings['time_format'])).show();
var allday = $('#edit-allday').get(0);
var notify = $('#edit-attendees-donotify').get(0);
var invite = $('#edit-attendees-invite').get(0);
notify.checked = has_attendees(event), invite.checked = true;
if (event.allDay) {
starttime.val("12:00").hide();
endtime.val("13:00").hide();
allday.checked = true;
}
else {
allday.checked = false;
}
// set alarm(s)
// TODO: support multiple alarm entries
if (event.alarms || action != 'new') {
if (typeof event.alarms == 'string')
event.alarms = event.alarms.split(';');
var valarms = event.alarms || [''];
for (var alarm, i=0; i < valarms.length; i++) {
alarm = String(valarms[i]).split(':');
if (!alarm[1] && alarm[0]) alarm[1] = 'DISPLAY';
$('#eventedit select.edit-alarm-type').val(alarm[1]);
if (alarm[0].match(/@(\d+)/)) {
var ondate = fromunixtime(parseInt(RegExp.$1));
$('#eventedit select.edit-alarm-offset').val('@');
$('#eventedit input.edit-alarm-date').val($.fullCalendar.formatDate(ondate, settings['date_format']));
$('#eventedit input.edit-alarm-time').val($.fullCalendar.formatDate(ondate, settings['time_format']));
}
else if (alarm[0].match(/([-+])(\d+)([MHD])/)) {
$('#eventedit input.edit-alarm-value').val(RegExp.$2);
$('#eventedit select.edit-alarm-offset').val(''+RegExp.$1+RegExp.$3);
}
}
}
// set correct visibility by triggering onchange handlers
$('#eventedit select.edit-alarm-type, #eventedit select.edit-alarm-offset').change();
// enable/disable alarm property according to backend support
$('#edit-alarms')[(calendar.alarms ? 'show' : 'hide')]();
// check categories drop-down: add value if not exists
if (event.categories && !categories.find("option[value='"+event.categories+"']").length) {
$('<option>').attr('value', event.categories).text(event.categories).appendTo(categories).prop('selected', true);
}
// set recurrence form
var recurrence, interval, rrtimes, rrenddate;
var load_recurrence_tab = function()
{
recurrence = $('#edit-recurrence-frequency').val(event.recurrence ? event.recurrence.FREQ : '').change();
interval = $('#eventedit select.edit-recurrence-interval').val(event.recurrence ? event.recurrence.INTERVAL : 1);
rrtimes = $('#edit-recurrence-repeat-times').val(event.recurrence ? event.recurrence.COUNT : 1);
rrenddate = $('#edit-recurrence-enddate').val(event.recurrence && event.recurrence.UNTIL ? $.fullCalendar.formatDate(parseISO8601(event.recurrence.UNTIL), settings['date_format']) : '');
$('#eventedit input.edit-recurrence-until:checked').prop('checked', false);
var weekdays = ['SU','MO','TU','WE','TH','FR','SA'];
var rrepeat_id = '#edit-recurrence-repeat-forever';
if (event.recurrence && event.recurrence.COUNT) rrepeat_id = '#edit-recurrence-repeat-count';
else if (event.recurrence && event.recurrence.UNTIL) rrepeat_id = '#edit-recurrence-repeat-until';
$(rrepeat_id).prop('checked', true);
if (event.recurrence && event.recurrence.BYDAY && event.recurrence.FREQ == 'WEEKLY') {
var wdays = event.recurrence.BYDAY.split(',');
$('input.edit-recurrence-weekly-byday').val(wdays);
}
if (event.recurrence && event.recurrence.BYMONTHDAY) {
$('input.edit-recurrence-monthly-bymonthday').val(String(event.recurrence.BYMONTHDAY).split(','));
$('input.edit-recurrence-monthly-mode').val(['BYMONTHDAY']);
}
if (event.recurrence && event.recurrence.BYDAY && (event.recurrence.FREQ == 'MONTHLY' || event.recurrence.FREQ == 'YEARLY')) {
var byday, section = event.recurrence.FREQ.toLowerCase();
if ((byday = String(event.recurrence.BYDAY).match(/(-?[1-4])([A-Z]+)/))) {
$('#edit-recurrence-'+section+'-prefix').val(byday[1]);
$('#edit-recurrence-'+section+'-byday').val(byday[2]);
}
$('input.edit-recurrence-'+section+'-mode').val(['BYDAY']);
}
else if (event.start) {
$('#edit-recurrence-monthly-byday').val(weekdays[event.start.getDay()]);
}
if (event.recurrence && event.recurrence.BYMONTH) {
$('input.edit-recurrence-yearly-bymonth').val(String(event.recurrence.BYMONTH).split(','));
}
else if (event.start) {
$('input.edit-recurrence-yearly-bymonth').val([String(event.start.getMonth()+1)]);
}
};
// show warning if editing a recurring event
if (event.id && event.recurrence) {
var sel = event.thisandfuture ? 'future' : (event.isexception ? 'current' : 'all');
$('#edit-recurring-warning').show();
$('input.edit-recurring-savemode[value="'+sel+'"]').prop('checked', true);
}
else
$('#edit-recurring-warning').hide();
// init attendees tab
var organizer = !event.attendees || is_organizer(event),
allow_invitations = organizer || (calendar.owner && calendar.owner == 'anonymous') || settings.invite_shared;
event_attendees = [];
attendees_list = $('#edit-attendees-table > tbody').html('');
$('#edit-attendees-notify')[(notify.checked && allow_invitations ? 'show' : 'hide')]();
$('#edit-localchanges-warning')[(has_attendees(event) && !(allow_invitations || (calendar.owner && is_organizer(event, calendar.owner))) ? 'show' : 'hide')]();
var load_attendees_tab = function()
{
if (event.attendees) {
for (var j=0; j < event.attendees.length; j++)
add_attendee(event.attendees[j], !allow_invitations);
}
// select the correct organizer identity
var identity_id = 0;
$.each(settings.identities, function(i,v){
if (organizer && v == organizer.email) {
identity_id = i;
return false;
}
});
$('#edit-identities-list').val(identity_id);
$('#edit-attendees-form')[(allow_invitations?'show':'hide')]();
$('#edit-attendee-schedule')[(calendar.freebusy?'show':'hide')]();
};
// attachments
var load_attachments_tab = function()
{
rcmail.enable_command('remove-attachment', !calendar.readonly);
rcmail.env.deleted_attachments = [];
// we're sharing some code for uploads handling with app.js
rcmail.env.attachments = [];
rcmail.env.compose_id = event.id; // for rcmail.async_upload_form()
if ($.isArray(event.attachments)) {
event_show_attachments(event.attachments, $('#edit-attachments'), event, true);
}
else {
$('#edit-attachments > ul').empty();
// fetch attachments, some drivers doesn't set 'attachments' array for event?
}
};
// init dialog buttons
var buttons = {};
// save action
buttons[rcmail.gettext('save', 'calendar')] = function() {
var start = parse_datetime(allday.checked ? '12:00' : starttime.val(), startdate.val());
var end = parse_datetime(allday.checked ? '13:00' : endtime.val(), enddate.val());
// basic input validatetion
if (start.getTime() > end.getTime()) {
alert(rcmail.gettext('invalideventdates', 'calendar'));
return false;
}
// post data to server
var data = {
calendar: event.calendar,
start: date2servertime(start),
end: date2servertime(end),
allday: allday.checked?1:0,
title: title.val(),
description: description.val(),
location: location.val(),
categories: categories.val(),
vurl: vurl.val(),
free_busy: freebusy.val(),
priority: priority.val(),
sensitivity: sensitivity.val(),
recurrence: '',
alarms: '',
attendees: event_attendees,
deleted_attachments: rcmail.env.deleted_attachments,
attachments: []
};
// serialize alarm settings
// TODO: support multiple alarm entries
var alarm = $('#eventedit select.edit-alarm-type').val();
if (alarm) {
var val, offset = $('#eventedit select.edit-alarm-offset').val();
if (offset == '@')
data.alarms = '@' + date2unixtime(parse_datetime($('#eventedit input.edit-alarm-time').val(), $('#eventedit input.edit-alarm-date').val())) + ':' + alarm;
else if ((val = parseInt($('#eventedit input.edit-alarm-value').val())) && !isNaN(val) && val >= 0)
data.alarms = offset[0] + val + offset[1] + ':' + alarm;
}
// uploaded attachments list
for (var i in rcmail.env.attachments)
if (i.match(/^rcmfile(.+)/))
data.attachments.push(RegExp.$1);
// read attendee roles
$('select.edit-attendee-role').each(function(i, elem){
if (data.attendees[i])
data.attendees[i].role = $(elem).val();
});
if (organizer)
data._identity = $('#edit-identities-list option:selected').val();
// don't submit attendees if only myself is added as organizer
if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && String(data.attendees[0].email).toLowerCase() == settings.identity.email)
data.attendees = [];
// tell server to send notifications
if ((data.attendees.length || (event.id && event.attendees.length)) && allow_invitations && (notify.checked || invite.checked)) {
data._notify = 1;
}
// gather recurrence settings
var freq;
if ((freq = recurrence.val()) != '') {
data.recurrence = {
FREQ: freq,
INTERVAL: $('#edit-recurrence-interval-'+freq.toLowerCase()).val()
};
var until = $('input.edit-recurrence-until:checked').val();
if (until == 'count')
data.recurrence.COUNT = rrtimes.val();
else if (until == 'until')
data.recurrence.UNTIL = date2servertime(parse_datetime(endtime.val(), rrenddate.val()));
if (freq == 'WEEKLY') {
var byday = [];
$('input.edit-recurrence-weekly-byday:checked').each(function(){ byday.push(this.value); });
if (byday.length)
data.recurrence.BYDAY = byday.join(',');
}
else if (freq == 'MONTHLY') {
var mode = $('input.edit-recurrence-monthly-mode:checked').val(), bymonday = [];
if (mode == 'BYMONTHDAY') {
$('input.edit-recurrence-monthly-bymonthday:checked').each(function(){ bymonday.push(this.value); });
if (bymonday.length)
data.recurrence.BYMONTHDAY = bymonday.join(',');
}
else
data.recurrence.BYDAY = $('#edit-recurrence-monthly-prefix').val() + $('#edit-recurrence-monthly-byday').val();
}
else if (freq == 'YEARLY') {
var byday, bymonth = [];
$('input.edit-recurrence-yearly-bymonth:checked').each(function(){ bymonth.push(this.value); });
if (bymonth.length)
data.recurrence.BYMONTH = bymonth.join(',');
if ((byday = $('#edit-recurrence-yearly-byday').val()))
data.recurrence.BYDAY = $('#edit-recurrence-yearly-prefix').val() + byday;
}
}
data.calendar = calendars.val();
if (event.id) {
data.id = event.id;
if (event.recurrence)
data._savemode = $('input.edit-recurring-savemode:checked').val();
if (data.calendar && data.calendar != event.calendar)
data._fromcalendar = event.calendar;
}
update_event(action, data);
$dialog.dialog("close");
};
if (event.id) {
buttons[rcmail.gettext('remove', 'calendar')] = function() {
me.delete_event(event);
$dialog.dialog('close');
};
}
buttons[rcmail.gettext('cancel', 'calendar')] = function() {
$dialog.dialog("close");
};
// show/hide tabs according to calendar's feature support
$('#edit-tab-attendees')[(calendar.attendees?'show':'hide')]();
$('#edit-tab-attachments')[(calendar.attachments?'show':'hide')]();
// activate the first tab
$('#eventtabs').tabs('select', 0);
// hack: set task to 'calendar' to make all dialog actions work correctly
var comm_path_before = rcmail.env.comm_path;
rcmail.env.comm_path = comm_path_before.replace(/_task=[a-z]+/, '_task=calendar');
var editform = $("#eventedit");
// open jquery UI dialog
$dialog.dialog({
modal: true,
resizable: (!bw.ie6 && !bw.ie7), // disable for performance reasons
closeOnEscape: false,
title: rcmail.gettext((action == 'edit' ? 'edit_event' : 'new_event'), 'calendar'),
close: function() {
editform.hide().appendTo(document.body);
$dialog.dialog("destroy").remove();
rcmail.ksearch_blur();
rcmail.ksearch_destroy();
freebusy_data = {};
rcmail.env.comm_path = comm_path_before; // restore comm_path
},
buttons: buttons,
minWidth: 500,
width: 580
}).append(editform.show()); // adding form content AFTERWARDS massively speeds up opening on IE6
// set dialog size according to form content
me.dialog_resize($dialog.get(0), editform.height() + (bw.ie ? 20 : 0), 530);
title.select();
// init other tabs asynchronously
window.setTimeout(load_recurrence_tab, exec_deferred);
if (calendar.attendees)
window.setTimeout(load_attendees_tab, exec_deferred);
if (calendar.attachments)
window.setTimeout(load_attachments_tab, exec_deferred);
};
// open a dialog to display detailed free-busy information and to find free slots
var event_freebusy_dialog = function()
{
var $dialog = $('#eventfreebusy'),
event = me.selected_event;
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!event_attendees.length)
return false;
// set form elements
var allday = $('#edit-allday').get(0);
var duration = Math.round((event.end.getTime() - event.start.getTime()) / 1000);
freebusy_ui.startdate = $('#schedule-startdate').val($.fullCalendar.formatDate(event.start, settings['date_format'])).data('duration', duration);
freebusy_ui.starttime = $('#schedule-starttime').val($.fullCalendar.formatDate(event.start, settings['time_format'])).show();
freebusy_ui.enddate = $('#schedule-enddate').val($.fullCalendar.formatDate(event.end, settings['date_format']));
freebusy_ui.endtime = $('#schedule-endtime').val($.fullCalendar.formatDate(event.end, settings['time_format'])).show();
if (allday.checked) {
freebusy_ui.starttime.val("12:00").hide();
freebusy_ui.endtime.val("13:00").hide();
event.allDay = true;
}
// read attendee roles from drop-downs
$('select.edit-attendee-role').each(function(i, elem){
if (event_attendees[i])
event_attendees[i].role = $(elem).val();
});
// render time slots
var now = new Date(), fb_start = new Date(), fb_end = new Date();
fb_start.setTime(event.start);
fb_start.setHours(0); fb_start.setMinutes(0); fb_start.setSeconds(0); fb_start.setMilliseconds(0);
fb_end.setTime(fb_start.getTime() + DAY_MS);
freebusy_data = { required:{}, all:{} };
freebusy_ui.loading = 1; // prevent render_freebusy_grid() to load data yet
freebusy_ui.numdays = Math.max(allday.checked ? 14 : 1, Math.ceil(duration * 2 / 86400));
freebusy_ui.interval = allday.checked ? 1440 : 60;
freebusy_ui.start = fb_start;
freebusy_ui.end = new Date(freebusy_ui.start.getTime() + DAY_MS * freebusy_ui.numdays);
render_freebusy_grid(0);
// render list of attendees
freebusy_ui.attendees = {};
var domid, dispname, data, role_html, list_html = '';
for (var i=0; i < event_attendees.length; i++) {
data = event_attendees[i];
dispname = Q(data.name || data.email);
domid = String(data.email).replace(rcmail.identifier_expr, '');
role_html = '<a class="attendee-role-toggle" id="rcmlia' + domid + '" title="' + Q(rcmail.gettext('togglerole', 'calendar')) + '"> </a>';
list_html += '<div class="attendee ' + String(data.role).toLowerCase() + '" id="rcmli' + domid + '">' + role_html + dispname + '</div>';
// clone attendees data for local modifications
freebusy_ui.attendees[i] = freebusy_ui.attendees[domid] = $.extend({}, data);
}
// add total row
list_html += '<div class="attendee spacer"> </div>';
list_html += '<div class="attendee total">' + rcmail.gettext('reqallattendees','calendar') + '</div>';
$('#schedule-attendees-list').html(list_html)
.unbind('click.roleicons')
.bind('click.roleicons', function(e){
// toggle attendee status upon click on icon
if (e.target.id && e.target.id.match(/rcmlia(.+)/)) {
var attendee, domid = RegExp.$1, roles = [ 'REQ-PARTICIPANT', 'OPT-PARTICIPANT', 'CHAIR' ];
if ((attendee = freebusy_ui.attendees[domid]) && attendee.role != 'ORGANIZER') {
var req = attendee.role != 'OPT-PARTICIPANT';
var j = $.inArray(attendee.role, roles);
j = (j+1) % roles.length;
attendee.role = roles[j];
$(e.target).parent().removeClass().addClass('attendee '+String(attendee.role).toLowerCase());
// update total display if required-status changed
if (req != (roles[j] != 'OPT-PARTICIPANT')) {
compute_freebusy_totals();
update_freebusy_display(attendee.email);
}
}
}
return false;
});
// enable/disable buttons
$('#shedule-find-prev').button('option', 'disabled', (fb_start.getTime() < now.getTime()));
// dialog buttons
var buttons = {};
buttons[rcmail.gettext('select', 'calendar')] = function() {
$('#edit-startdate').val(freebusy_ui.startdate.val());
$('#edit-starttime').val(freebusy_ui.starttime.val());
$('#edit-enddate').val(freebusy_ui.enddate.val());
$('#edit-endtime').val(freebusy_ui.endtime.val());
// write role changes back to main dialog
$('select.edit-attendee-role').each(function(i, elem){
if (event_attendees[i] && freebusy_ui.attendees[i]) {
event_attendees[i].role = freebusy_ui.attendees[i].role;
$(elem).val(event_attendees[i].role);
}
});
if (freebusy_ui.needsupdate)
update_freebusy_status(me.selected_event);
freebusy_ui.needsupdate = false;
$dialog.dialog("close");
};
buttons[rcmail.gettext('cancel', 'calendar')] = function() {
$dialog.dialog("close");
};
$dialog.dialog({
modal: true,
resizable: true,
closeOnEscape: (!bw.ie6 && !bw.ie7),
title: rcmail.gettext('scheduletime', 'calendar'),
open: function() {
$dialog.parent().find('.ui-dialog-buttonset .ui-button').first().focus();
},
close: function() {
if (bw.ie6)
$("#edit-attendees-table").css('visibility','visible');
$dialog.dialog("destroy").hide();
},
resizeStop: function() {
render_freebusy_overlay();
},
buttons: buttons,
minWidth: 640,
width: 850
}).show();
// hide edit dialog on IE6 because of drop-down elements
if (bw.ie6)
$("#edit-attendees-table").css('visibility','hidden');
// adjust dialog size to fit grid without scrolling
var gridw = $('#schedule-freebusy-times').width();
var overflow = gridw - $('#attendees-freebusy-table td.times').width() + 1;
me.dialog_resize($dialog.get(0), $dialog.height() + (bw.ie ? 20 : 0), 800 + Math.max(0, overflow));
// fetch data from server
freebusy_ui.loading = 0;
load_freebusy_data(freebusy_ui.start, freebusy_ui.interval);
};
// render an HTML table showing free-busy status for all the event attendees
var render_freebusy_grid = function(delta)
{
if (delta) {
freebusy_ui.start.setTime(freebusy_ui.start.getTime() + DAY_MS * delta);
fix_date(freebusy_ui.start);
// skip weekends if in workinhoursonly-mode
if (Math.abs(delta) == 1 && freebusy_ui.workinhoursonly) {
while (is_weekend(freebusy_ui.start))
freebusy_ui.start.setTime(freebusy_ui.start.getTime() + DAY_MS * delta);
fix_date(freebusy_ui.start);
}
freebusy_ui.end = new Date(freebusy_ui.start.getTime() + DAY_MS * freebusy_ui.numdays);
}
var dayslots = Math.floor(1440 / freebusy_ui.interval);
var date_format = 'ddd '+ (dayslots <= 2 ? settings.date_short : settings.date_format);
var lastdate, datestr, css,
curdate = new Date(),
allday = (freebusy_ui.interval == 1440),
times_css = (allday ? 'allday ' : ''),
dates_row = '<tr class="dates">',
times_row = '<tr class="times">',
slots_row = '';
for (var s = 0, t = freebusy_ui.start.getTime(); t < freebusy_ui.end.getTime(); s++) {
curdate.setTime(t);
datestr = fc.fullCalendar('formatDate', curdate, date_format);
if (datestr != lastdate) {
if (lastdate && !allday) break;
dates_row += '<th colspan="' + dayslots + '" class="boxtitle date' + $.fullCalendar.formatDate(curdate, 'ddMMyyyy') + '">' + Q(datestr) + '</th>';
lastdate = datestr;
}
// set css class according to working hours
css = is_weekend(curdate) || (freebusy_ui.interval <= 60 && !is_workinghour(curdate)) ? 'offhours' : 'workinghours';
times_row += '<td class="' + times_css + css + '" id="t-' + Math.floor(t/1000) + '">' + Q(allday ? rcmail.gettext('all-day','calendar') : $.fullCalendar.formatDate(curdate, settings['time_format'])) + '</td>';
slots_row += '<td class="' + css + ' unknown"> </td>';
t += freebusy_ui.interval * 60000;
}
dates_row += '</tr>';
times_row += '</tr>';
// render list of attendees
var domid, data, list_html = '', times_html = '';
for (var i=0; i < event_attendees.length; i++) {
data = event_attendees[i];
domid = String(data.email).replace(rcmail.identifier_expr, '');
times_html += '<tr id="fbrow' + domid + '">' + slots_row + '</tr>';
}
// add line for all/required attendees
times_html += '<tr class="spacer"><td colspan="' + (dayslots * freebusy_ui.numdays) + '"> </td>';
times_html += '<tr id="fbrowall">' + slots_row + '</tr>';
var table = $('#schedule-freebusy-times');
table.children('thead').html(dates_row + times_row);
table.children('tbody').html(times_html);
// initialize event handlers on grid
if (!freebusy_ui.grid_events) {
freebusy_ui.grid_events = true;
table.children('thead').click(function(e){
// move event to the clicked date/time
if (e.target.id && e.target.id.match(/t-(\d+)/)) {
var newstart = new Date(RegExp.$1 * 1000);
// set time to 00:00
if (me.selected_event.allDay) {
newstart.setMinutes(0);
newstart.setHours(0);
}
update_freebusy_dates(newstart, new Date(newstart.getTime() + freebusy_ui.startdate.data('duration') * 1000));
render_freebusy_overlay();
}
})
}
// if we have loaded free-busy data, show it
if (!freebusy_ui.loading) {
if (freebusy_ui.start < freebusy_data.start || freebusy_ui.end > freebusy_data.end || freebusy_ui.interval != freebusy_data.interval) {
load_freebusy_data(freebusy_ui.start, freebusy_ui.interval);
}
else {
for (var email, i=0; i < event_attendees.length; i++) {
if ((email = event_attendees[i].email))
update_freebusy_display(email);
}
}
}
// render current event date/time selection over grid table
// use timeout to let the dom attributes (width/height/offset) be set first
window.setTimeout(function(){ render_freebusy_overlay(); }, 10);
};
// render overlay element over the grid to visiualize the current event date/time
var render_freebusy_overlay = function()
{
var overlay = $('#schedule-event-time');
if (me.selected_event.end.getTime() <= freebusy_ui.start.getTime() || me.selected_event.start.getTime() >= freebusy_ui.end.getTime()) {
overlay.hide();
if (overlay.data('isdraggable'))
overlay.draggable('disable');
}
else {
var table = $('#schedule-freebusy-times'),
width = 0,
pos = { top:table.children('thead').height(), left:0 },
eventstart = date2unixtime(clone_date(me.selected_event.start, me.selected_event.allDay?1:0)),
eventend = date2unixtime(clone_date(me.selected_event.end, me.selected_event.allDay?2:0)) - 60,
slotstart = date2unixtime(freebusy_ui.start),
slotsize = freebusy_ui.interval * 60,
slotend, fraction, $cell;
// iterate through slots to determine position and size of the overlay
table.children('thead').find('td').each(function(i, cell){
slotend = slotstart + slotsize - 1;
// event starts in this slot: compute left
if (eventstart >= slotstart && eventstart <= slotend) {
fraction = 1 - (slotend - eventstart) / slotsize;
pos.left = Math.round(cell.offsetLeft + cell.offsetWidth * fraction);
}
// event ends in this slot: compute width
if (eventend >= slotstart && eventend <= slotend) {
fraction = 1 - (slotend - eventend) / slotsize;
width = Math.round(cell.offsetLeft + cell.offsetWidth * fraction) - pos.left;
}
slotstart = slotstart + slotsize;
});
if (!width)
width = table.width() - pos.left;
// overlay is visible
if (width > 0) {
overlay.css({ width: (width-5)+'px', height:(table.children('tbody').height() - 4)+'px', left:pos.left+'px', top:pos.top+'px' }).show();
// configure draggable
if (!overlay.data('isdraggable')) {
overlay.draggable({
axis: 'x',
scroll: true,
stop: function(e, ui){
// convert pixels to time
var px = ui.position.left;
var range_p = $('#schedule-freebusy-times').width();
var range_t = freebusy_ui.end.getTime() - freebusy_ui.start.getTime();
var newstart = new Date(freebusy_ui.start.getTime() + px * (range_t / range_p));
newstart.setSeconds(0); newstart.setMilliseconds(0);
// snap to day boundaries
if (me.selected_event.allDay) {
if (newstart.getHours() >= 12) // snap to next day
newstart.setTime(newstart.getTime() + DAY_MS);
newstart.setMinutes(0);
newstart.setHours(0);
}
else {
// round to 5 minutes
var round = newstart.getMinutes() % 5;
if (round > 2.5) newstart.setTime(newstart.getTime() + (5 - round) * 60000);
else if (round > 0) newstart.setTime(newstart.getTime() - round * 60000);
}
// update event times and display
update_freebusy_dates(newstart, new Date(newstart.getTime() + freebusy_ui.startdate.data('duration') * 1000));
if (me.selected_event.allDay)
render_freebusy_overlay();
}
}).data('isdraggable', true);
}
else
overlay.draggable('enable');
}
else
overlay.draggable('disable').hide();
}
};
// fetch free-busy information for each attendee from server
var load_freebusy_data = function(from, interval)
{
var start = new Date(from.getTime() - DAY_MS * 2); // start 2 days before event
fix_date(start);
var end = new Date(start.getTime() + DAY_MS * Math.max(14, freebusy_ui.numdays + 7)); // load min. 14 days
freebusy_ui.numrequired = 0;
freebusy_data.all = [];
freebusy_data.required = [];
// load free-busy information for every attendee
var domid, email;
for (var i=0; i < event_attendees.length; i++) {
if ((email = event_attendees[i].email)) {
domid = String(email).replace(rcmail.identifier_expr, '');
$('#rcmli' + domid).addClass('loading');
freebusy_ui.loading++;
$.ajax({
type: 'GET',
dataType: 'json',
url: rcmail.url('freebusy-times'),
data: { email:email, start:date2servertime(clone_date(start, 1)), end:date2servertime(clone_date(end, 2)), interval:interval, _remote:1 },
success: function(data) {
freebusy_ui.loading--;
// find attendee
var attendee = null;
for (var i=0; i < event_attendees.length; i++) {
if (freebusy_ui.attendees[i].email == data.email) {
attendee = freebusy_ui.attendees[i];
break;
}
}
// copy data to member var
var ts, req = attendee.role != 'OPT-PARTICIPANT';
freebusy_data.start = parseISO8601(data.start);
freebusy_data[data.email] = {};
for (var i=0; i < data.slots.length; i++) {
ts = data.times[i] + '';
freebusy_data[data.email][ts] = data.slots[i];
// set totals
if (!freebusy_data.required[ts])
freebusy_data.required[ts] = [0,0,0,0];
if (req)
freebusy_data.required[ts][data.slots[i]]++;
if (!freebusy_data.all[ts])
freebusy_data.all[ts] = [0,0,0,0];
freebusy_data.all[ts][data.slots[i]]++;
}
freebusy_data.end = parseISO8601(data.end);
freebusy_data.interval = data.interval;
// hide loading indicator
var domid = String(data.email).replace(rcmail.identifier_expr, '');
$('#rcmli' + domid).removeClass('loading');
// update display
update_freebusy_display(data.email);
}
});
// count required attendees
if (freebusy_ui.attendees[i].role != 'OPT-PARTICIPANT')
freebusy_ui.numrequired++;
}
}
};
// re-calculate total status after role change
var compute_freebusy_totals = function()
{
freebusy_ui.numrequired = 0;
freebusy_data.all = [];
freebusy_data.required = [];
var email, req, status;
for (var i=0; i < event_attendees.length; i++) {
if (!(email = event_attendees[i].email))
continue;
req = freebusy_ui.attendees[i].role != 'OPT-PARTICIPANT';
if (req)
freebusy_ui.numrequired++;
for (var ts in freebusy_data[email]) {
if (!freebusy_data.required[ts])
freebusy_data.required[ts] = [0,0,0,0];
if (!freebusy_data.all[ts])
freebusy_data.all[ts] = [0,0,0,0];
status = freebusy_data[email][ts];
freebusy_data.all[ts][status]++;
if (req)
freebusy_data.required[ts][status]++;
}
}
};
// update free-busy grid with status loaded from server
var update_freebusy_display = function(email)
{
var status_classes = ['unknown','free','busy','tentative','out-of-office'];
var domid = String(email).replace(rcmail.identifier_expr, '');
var row = $('#fbrow' + domid);
var rowall = $('#fbrowall').children();
var dateonly = freebusy_ui.interval > 60,
t, ts = date2timestring(freebusy_ui.start, dateonly),
curdate = new Date(),
fbdata = freebusy_data[email];
if (fbdata && fbdata[ts] !== undefined && row.length) {
t = freebusy_ui.start.getTime();
row.children().each(function(i, cell){
curdate.setTime(t);
ts = date2timestring(curdate, dateonly);
cell.className = cell.className.replace('unknown', fbdata[ts] ? status_classes[fbdata[ts]] : 'unknown');
// also update total row if all data was loaded
if (freebusy_ui.loading == 0 && freebusy_data.all[ts] && (cell = rowall.get(i))) {
var workinghours = cell.className.indexOf('workinghours') >= 0;
var all_status = freebusy_data.all[ts][2] ? 'busy' : 'unknown';
req_status = freebusy_data.required[ts][2] ? 'busy' : 'free';
for (var j=1; j < status_classes.length; j++) {
if (freebusy_ui.numrequired && freebusy_data.required[ts][j] >= freebusy_ui.numrequired)
req_status = status_classes[j];
if (freebusy_data.all[ts][j] == event_attendees.length)
all_status = status_classes[j];
}
cell.className = (workinghours ? 'workinghours ' : 'offhours ') + req_status + ' all-' + all_status;
}
t += freebusy_ui.interval * 60000;
});
}
};
// write changed event date/times back to form fields
var update_freebusy_dates = function(start, end)
{
// fix all-day evebt times
if (me.selected_event.allDay) {
var numdays = Math.floor((me.selected_event.end.getTime() - me.selected_event.start.getTime()) / DAY_MS);
start.setHours(12);
start.setMinutes(0);
end.setTime(start.getTime() + numdays * DAY_MS);
end.setHours(13);
end.setMinutes(0);
}
me.selected_event.start = start;
me.selected_event.end = end;
freebusy_ui.startdate.val($.fullCalendar.formatDate(start, settings['date_format']));
freebusy_ui.starttime.val($.fullCalendar.formatDate(start, settings['time_format']));
freebusy_ui.enddate.val($.fullCalendar.formatDate(end, settings['date_format']));
freebusy_ui.endtime.val($.fullCalendar.formatDate(end, settings['time_format']));
freebusy_ui.needsupdate = true;
};
// attempt to find a time slot where all attemdees are available
var freebusy_find_slot = function(dir)
{
// exit if free-busy data isn't available yet
if (!freebusy_data || !freebusy_data.start)
return false;
var event = me.selected_event,
eventstart = clone_date(event.start, event.allDay ? 1 : 0).getTime(), // calculate with integers
eventend = clone_date(event.end, event.allDay ? 2 : 0).getTime(),
duration = eventend - eventstart - (event.allDay ? HOUR_MS : 0), // make sure we don't cross day borders on DST change
sinterval = freebusy_data.interval * 60000,
intvlslots = 1,
numslots = Math.ceil(duration / sinterval),
checkdate, slotend, email, ts, slot, slotdate = new Date();
// shift event times to next possible slot
eventstart += sinterval * intvlslots * dir;
eventend += sinterval * intvlslots * dir;
// iterate through free-busy slots and find candidates
var candidatecount = 0, candidatestart = candidateend = success = false;
for (slot = dir > 0 ? freebusy_data.start.getTime() : freebusy_data.end.getTime() - sinterval;
(dir > 0 && slot < freebusy_data.end.getTime()) || (dir < 0 && slot >= freebusy_data.start.getTime());
slot += sinterval * dir) {
slotdate.setTime(slot);
// fix slot if just crossed a DST change
if (event.allDay) {
fix_date(slotdate);
slot = slotdate.getTime();
}
slotend = slot + sinterval;
if ((dir > 0 && slotend <= eventstart) || (dir < 0 && slot >= eventend)) // skip
continue;
// respect workingours setting
if (freebusy_ui.workinhoursonly) {
if (is_weekend(slotdate) || (freebusy_data.interval <= 60 && !is_workinghour(slotdate))) { // skip off-hours
candidatestart = candidateend = false;
candidatecount = 0;
continue;
}
}
if (!candidatestart)
candidatestart = slot;
// check freebusy data for all attendees
ts = date2timestring(slotdate, freebusy_data.interval > 60);
for (var i=0; i < event_attendees.length; i++) {
if (freebusy_ui.attendees[i].role != 'OPT-PARTICIPANT' && (email = freebusy_ui.attendees[i].email) && freebusy_data[email] && freebusy_data[email][ts] > 1) {
candidatestart = candidateend = false;
break;
}
}
// occupied slot
if (!candidatestart) {
slot += Math.max(0, intvlslots - candidatecount - 1) * sinterval * dir;
candidatecount = 0;
continue;
}
// set candidate end to slot end time
candidatecount++;
if (dir < 0 && !candidateend)
candidateend = slotend;
// if candidate is big enough, this is it!
if (candidatecount == numslots) {
if (dir > 0) {
event.start.setTime(candidatestart);
event.end.setTime(candidatestart + duration);
}
else {
event.end.setTime(candidateend);
event.start.setTime(candidateend - duration);
}
success = true;
break;
}
}
// update event date/time display
if (success) {
update_freebusy_dates(event.start, event.end);
// move freebusy grid if necessary
var offset = Math.ceil((event.start.getTime() - freebusy_ui.end.getTime()) / DAY_MS);
if (event.start.getTime() >= freebusy_ui.end.getTime())
render_freebusy_grid(Math.max(1, offset));
else if (event.end.getTime() <= freebusy_ui.start.getTime())
render_freebusy_grid(Math.min(-1, offset));
else
render_freebusy_overlay();
var now = new Date();
$('#shedule-find-prev').button('option', 'disabled', (event.start.getTime() < now.getTime()));
}
else {
alert(rcmail.gettext('noslotfound','calendar'));
}
};
// update event properties and attendees availability if event times have changed
var event_times_changed = function()
{
if (me.selected_event) {
var allday = $('#edit-allday').get(0);
me.selected_event.allDay = allday.checked;
me.selected_event.start = parse_datetime(allday.checked ? '12:00' : $('#edit-starttime').val(), $('#edit-startdate').val());
me.selected_event.end = parse_datetime(allday.checked ? '13:00' : $('#edit-endtime').val(), $('#edit-enddate').val());
if (event_attendees)
freebusy_ui.needsupdate = true;
$('#edit-startdate').data('duration', Math.round((me.selected_event.end.getTime() - me.selected_event.start.getTime()) / 1000));
}
};
// add the given list of participants
var add_attendees = function(names)
{
names = explode_quoted_string(names.replace(/,\s*$/, ''), ',');
// parse name/email pairs
var item, email, name, success = false;
for (var i=0; i < names.length; i++) {
email = name = '';
item = $.trim(names[i]);
if (!item.length) {
continue;
} // address in brackets without name (do nothing)
else if (item.match(/^<[^@]+@[^>]+>$/)) {
email = item.replace(/[<>]/g, '');
} // address without brackets and without name (add brackets)
else if (rcube_check_email(item)) {
email = item;
} // address with name
else if (item.match(/([^\s<@]+@[^>]+)>*$/)) {
email = RegExp.$1;
name = item.replace(email, '').replace(/^["\s<>]+/, '').replace(/["\s<>]+$/, '');
}
if (email) {
add_attendee({ email:email, name:name, role:'REQ-PARTICIPANT', status:'NEEDS-ACTION' });
success = true;
}
else {
alert(rcmail.gettext('noemailwarning'));
}
}
return success;
};
// add the given attendee to the list
var add_attendee = function(data, readonly)
{
// check for dupes...
var exists = false;
$.each(event_attendees, function(i, v){ exists |= (v.email == data.email); });
if (exists)
return false;
var dispname = Q(data.name || data.email);
if (data.email)
dispname = '<a href="mailto:' + data.email + '" title="' + Q(data.email) + '" class="mailtolink">' + dispname + '</a>';
// role selection
var organizer = data.role == 'ORGANIZER';
var opts = {};
if (organizer)
opts.ORGANIZER = rcmail.gettext('calendar.roleorganizer');
opts['REQ-PARTICIPANT'] = rcmail.gettext('calendar.rolerequired');
opts['OPT-PARTICIPANT'] = rcmail.gettext('calendar.roleoptional');
opts['CHAIR'] = rcmail.gettext('calendar.rolechair');
if (organizer && !readonly)
dispname = rcmail.env['identities-selector'];
var select = '<select class="edit-attendee-role"' + (organizer || readonly ? ' disabled="true"' : '') + '>';
for (var r in opts)
select += '<option value="'+ r +'" class="' + r.toLowerCase() + '"' + (data.role == r ? ' selected="selected"' : '') +'>' + Q(opts[r]) + '</option>';
select += '</select>';
// availability
var avail = data.email ? 'loading' : 'unknown';
// delete icon
var icon = rcmail.env.deleteicon ? '<img src="' + rcmail.env.deleteicon + '" alt="" />' : rcmail.gettext('delete');
var dellink = '<a href="#delete" class="iconlink delete deletelink" title="' + Q(rcmail.gettext('delete')) + '">' + icon + '</a>';
var html = '<td class="role">' + select + '</td>' +
'<td class="name">' + dispname + '</td>' +
'<td class="availability"><img src="./program/resources/blank.gif" class="availabilityicon ' + avail + '" /></td>' +
'<td class="confirmstate"><span class="' + String(data.status).toLowerCase() + '">' + Q(data.status) + '</span></td>' +
'<td class="options">' + (organizer || readonly ? '' : dellink) + '</td>';
var tr = $('<tr>')
.addClass(String(data.role).toLowerCase())
.html(html)
.appendTo(attendees_list);
tr.find('a.deletelink').click({ id:(data.email || data.name) }, function(e) { remove_attendee(this, e.data.id); return false; });
tr.find('a.mailtolink').click(function(e) { rcmail.redirect(rcmail.url('mail/compose', { _to:this.href.substr(7) })); return false; });
// select organizer identity
if (data.identity_id)
$('#edit-identities-list').val(data.identity_id);
// check free-busy status
if (avail == 'loading') {
check_freebusy_status(tr.find('img.availabilityicon'), data.email, me.selected_event);
}
event_attendees.push(data);
};
// iterate over all attendees and update their free-busy status display
var update_freebusy_status = function(event)
{
var icons = attendees_list.find('img.availabilityicon');
for (var i=0; i < event_attendees.length; i++) {
if (icons.get(i) && event_attendees[i].email)
check_freebusy_status(icons.get(i), event_attendees[i].email, event);
}
freebusy_ui.needsupdate = false;
};
// load free-busy status from server and update icon accordingly
var check_freebusy_status = function(icon, email, event)
{
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { freebusy:false };
if (!calendar.freebusy) {
$(icon).removeClass().addClass('availabilityicon unknown');
return;
}
icon = $(icon).removeClass().addClass('availabilityicon loading');
$.ajax({
type: 'GET',
dataType: 'html',
url: rcmail.url('freebusy-status'),
data: { email:email, start:date2servertime(clone_date(event.start, event.allDay?1:0)), end:date2servertime(clone_date(event.end, event.allDay?2:0)), _remote: 1 },
success: function(status){
icon.removeClass('loading').addClass(String(status).toLowerCase());
},
error: function(){
icon.removeClass('loading').addClass('unknown');
}
});
};
// remove an attendee from the list
var remove_attendee = function(elem, id)
{
$(elem).closest('tr').remove();
event_attendees = $.grep(event_attendees, function(data){ return (data.name != id && data.email != id) });
};
// when the user accepts or declines an event invitation
var event_rsvp = function(response)
{
if (me.selected_event && me.selected_event.attendees && response) {
// update attendee status
for (var data, i=0; i < me.selected_event.attendees.length; i++) {
data = me.selected_event.attendees[i];
if (settings.identity.emails.indexOf(';'+String(data.email).toLowerCase()) >= 0)
data.status = response.toUpperCase();
}
event_show_dialog(me.selected_event);
// submit status change to server
me.saving_lock = rcmail.set_busy(true, 'calendar.savingdata');
rcmail.http_post('event', { action:'rsvp', e:me.selected_event, status:response });
}
}
// post the given event data to server
var update_event = function(action, data)
{
me.saving_lock = rcmail.set_busy(true, 'calendar.savingdata');
rcmail.http_post('calendar/event', { action:action, e:data });
// render event temporarily into the calendar
if ((data.start && data.end) || data.id) {
var event = data.id ? $.extend(fc.fullCalendar('clientEvents', function(e){ return e.id == data.id; })[0], data) : data;
if (data.start)
event.start = data.start;
if (data.end)
event.end = data.end;
if (data.allday !== undefined)
event.allDay = data.allday;
event.editable = false;
event.temp = true;
event.className = 'fc-event-cal-'+data.calendar+' fc-event-temp';
fc.fullCalendar(data.id ? 'updateEvent' : 'renderEvent', event);
}
};
// mouse-click handler to check if the show dialog is still open and prevent default action
var dialog_check = function(e)
{
var showd = $("#eventshow");
if (showd.is(':visible') && !$(e.target).closest('.ui-dialog').length) {
showd.dialog('close');
e.stopImmediatePropagation();
ignore_click = true;
return false;
}
else if (ignore_click) {
window.setTimeout(function(){ ignore_click = false; }, 20);
return false;
}
return true;
};
// display confirm dialog when modifying/deleting an event
var update_event_confirm = function(action, event, data)
{
if (!data) data = event;
var decline = false, notify = false, html = '', cal = me.calendars[event.calendar];
// event has attendees, ask whether to notify them
if (has_attendees(event)) {
if (is_organizer(event)) {
notify = true;
html += '<div class="message">' +
'<label><input class="confirm-attendees-donotify" type="checkbox" checked="checked" value="1" name="notify" /> ' +
rcmail.gettext((action == 'remove' ? 'sendcancellation' : 'sendnotifications'), 'calendar') +
'</label></div>';
}
else if (action == 'remove' && is_attendee(event)) {
decline = true;
html += '<div class="message">' +
'<label><input class="confirm-attendees-decline" type="checkbox" checked="checked" value="1" name="decline" /> ' +
rcmail.gettext('itipdeclineevent', 'calendar') +
'</label></div>';
}
else {
html += '<div class="message">' + rcmail.gettext('localchangeswarning', 'calendar') + '</div>';
}
}
// recurring event: user needs to select the savemode
if (event.recurrence) {
html += '<div class="message"><span class="ui-icon ui-icon-alert"></span>' +
rcmail.gettext((action == 'remove' ? 'removerecurringeventwarning' : 'changerecurringeventwarning'), 'calendar') + '</div>' +
'<div class="savemode">' +
'<a href="#current" class="button">' + rcmail.gettext('currentevent', 'calendar') + '</a>' +
'<a href="#future" class="button">' + rcmail.gettext('futurevents', 'calendar') + '</a>' +
'<a href="#all" class="button">' + rcmail.gettext('allevents', 'calendar') + '</a>' +
(action != 'remove' ? '<a href="#new" class="button">' + rcmail.gettext('saveasnew', 'calendar') + '</a>' : '') +
'</div>';
}
// show dialog
if (html) {
var $dialog = $('<div>').html(html);
$dialog.find('a.button').button().click(function(e){
data._savemode = String(this.href).replace(/.+#/, '');
if ($dialog.find('input.confirm-attendees-donotify').get(0))
data._notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
if (decline && $dialog.find('input.confirm-attendees-decline:checked'))
data.decline = 1;
update_event(action, data);
$dialog.dialog("destroy").hide();
return false;
});
var buttons = [{
text: rcmail.gettext('cancel', 'calendar'),
click: function() {
$(this).dialog("close");
}
}];
if (!event.recurrence) {
buttons.push({
text: rcmail.gettext((action == 'remove' ? 'remove' : 'save'), 'calendar'),
click: function() {
data._notify = notify && $dialog.find('input.confirm-attendees-donotify').get(0).checked ? 1 : 0;
data.decline = decline && $dialog.find('input.confirm-attendees-decline:checked').length ? 1 : 0;
update_event(action, data);
$(this).dialog("close");
}
});
}
$dialog.dialog({
modal: true,
width: 460,
dialogClass: 'warning',
title: rcmail.gettext((action == 'remove' ? 'removeeventconfirm' : 'changeeventconfirm'), 'calendar'),
buttons: buttons,
close: function(){
$dialog.dialog("destroy").hide();
if (!rcmail.busy)
fc.fullCalendar('refetchEvents');
}
}).addClass('event-update-confirm').show();
return false;
}
// show regular confirm box when deleting
else if (action == 'remove' && !cal.undelete) {
if (!confirm(rcmail.gettext('deleteventconfirm', 'calendar')))
return false;
}
// do update
update_event(action, data);
return true;
};
var update_agenda_toolbar = function()
{
$('#agenda-listrange').val(fc.fullCalendar('option', 'listRange'));
$('#agenda-listsections').val(fc.fullCalendar('option', 'listSections'));
}
/*** fullcalendar event handlers ***/
var fc_event_render = function(event, element, view) {
if (view.name != 'list' && view.name != 'table') {
var prefix = event.sensitivity && event.sensitivity != 'public' ? String(sensitivitylabels[event.sensitivity]).toUpperCase()+': ' : '';
element.attr('title', prefix + event.title);
}
if (view.name != 'month') {
if (event.location) {
element.find('div.fc-event-title').after('<div class="fc-event-location">@ ' + Q(event.location) + '</div>');
}
if (event.sensitivity && event.sensitivity != 'public')
element.find('div.fc-event-time').append('<i class="fc-icon-sensitive"></i>');
if (event.recurrence)
element.find('div.fc-event-time').append('<i class="fc-icon-recurring"></i>');
if (event.alarms)
element.find('div.fc-event-time').append('<i class="fc-icon-alarms"></i>');
}
};
/*** public methods ***/
/**
* Remove saving lock and free the UI for new input
*/
this.unlock_saving = function()
{
if (me.saving_lock)
rcmail.set_busy(false, null, me.saving_lock);
};
// opens calendar day-view in a popup
this.fisheye_view = function(date)
{
$('#fish-eye-view:ui-dialog').dialog('close');
// create list of active event sources
var src, cals = {}, sources = [];
for (var id in this.calendars) {
src = $.extend({}, this.calendars[id]);
src.editable = false;
src.url = null;
src.events = [];
if (src.active) {
cals[id] = src;
sources.push(src);
}
}
// copy events already loaded
var events = fc.fullCalendar('clientEvents');
for (var event, i=0; i< events.length; i++) {
event = events[i];
if (event.source && (src = cals[event.source.id])) {
src.events.push(event);
}
}
var h = $(window).height() - 50;
var dialog = $('<div>')
.attr('id', 'fish-eye-view')
.dialog({
modal: true,
width: 680,
height: h,
title: $.fullCalendar.formatDate(date, 'dddd ' + settings['date_long']),
close: function(){
dialog.dialog("destroy");
me.fisheye_date = null;
}
})
.fullCalendar({
header: { left: '', center: '', right: '' },
height: h - 50,
defaultView: 'agendaDay',
date: date.getDate(),
month: date.getMonth(),
year: date.getFullYear(),
ignoreTimezone: true, // will treat the given date strings as in local (browser's) timezone
eventSources: sources,
monthNames : settings['months'],
monthNamesShort : settings['months_short'],
dayNames : settings['days'],
dayNamesShort : settings['days_short'],
firstDay : settings['first_day'],
firstHour : settings['first_hour'],
slotMinutes : 60/settings['timeslots'],
timeFormat: { '': settings['time_format'] },
axisFormat : settings['time_format'],
columnFormat: { day: 'dddd ' + settings['date_short'] },
titleFormat: { day: 'dddd ' + settings['date_long'] },
allDayText: rcmail.gettext('all-day', 'calendar'),
currentTimeIndicator: settings.time_indicator,
eventRender: fc_event_render,
eventClick: function(event) {
event_show_dialog(event);
}
});
this.fisheye_date = date;
};
//public method to show the print dialog.
this.print_calendars = function(view)
{
if (!view) view = fc.fullCalendar('getView').name;
var date = fc.fullCalendar('getDate') || new Date();
var range = fc.fullCalendar('option', 'listRange');
var sections = fc.fullCalendar('option', 'listSections');
rcmail.open_window(rcmail.url('print', { view: view, date: date2unixtime(date), range: range, sections: sections, search: this.search_query }), true, true);
};
// public method to bring up the new event dialog
this.add_event = function(templ) {
if (this.selected_calendar) {
var now = new Date();
var date = fc.fullCalendar('getDate');
if (typeof date != 'Date')
date = now;
date.setHours(now.getHours()+1);
date.setMinutes(0);
var end = new Date(date.getTime());
end.setHours(date.getHours()+1);
event_edit_dialog('new', $.extend({ start:date, end:end, allDay:false, calendar:this.selected_calendar }, templ || {}));
}
};
// delete the given event after showing a confirmation dialog
this.delete_event = function(event) {
// show confirm dialog for recurring events, use jquery UI dialog
return update_event_confirm('remove', event, { id:event.id, calendar:event.calendar, attendees:event.attendees });
};
// opens a jquery UI dialog with event properties (or empty for creating a new calendar)
this.calendar_edit_dialog = function(calendar)
{
// close show dialog first
var $dialog = $("#calendarform");
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!calendar)
calendar = { name:'', color:'cc0000', editable:true, showalarms:true };
var form, name, color, alarms;
$dialog.html(rcmail.get_label('loading'));
$.ajax({
type: 'GET',
dataType: 'html',
url: rcmail.url('calendar'),
data: { action:(calendar.id ? 'form-edit' : 'form-new'), c:{ id:calendar.id } },
success: function(data) {
$dialog.html(data);
// resize and reposition dialog window
form = $('#calendarpropform');
me.dialog_resize('#calendarform', form.height(), form.width());
name = $('#calendar-name').prop('disabled', !calendar.editable).val(calendar.editname || calendar.name);
color = $('#calendar-color').val(calendar.color).miniColors({ value: calendar.color, colorValues:rcmail.env.mscolors });
alarms = $('#calendar-showalarms').prop('checked', calendar.showalarms).get(0);
name.select();
}
});
// dialog buttons
var buttons = {};
buttons[rcmail.gettext('save', 'calendar')] = function() {
// form is not loaded
if (!form || !form.length)
return;
// TODO: do some input validation
if (!name.val() || name.val().length < 2) {
alert(rcmail.gettext('invalidcalendarproperties', 'calendar'));
name.select();
return;
}
// post data to server
var data = form.serializeJSON();
if (data.color)
data.color = data.color.replace(/^#/, '');
if (calendar.id)
data.id = calendar.id;
if (alarms)
data.showalarms = alarms.checked ? 1 : 0;
me.saving_lock = rcmail.set_busy(true, 'calendar.savingdata');
rcmail.http_post('calendar', { action:(calendar.id ? 'edit' : 'new'), c:data });
$dialog.dialog("close");
};
buttons[rcmail.gettext('cancel', 'calendar')] = function() {
$dialog.dialog("close");
};
// open jquery UI dialog
$dialog.dialog({
modal: true,
resizable: true,
closeOnEscape: false,
title: rcmail.gettext((calendar.id ? 'editcalendar' : 'createcalendar'), 'calendar'),
close: function() {
$dialog.html('').dialog("destroy").hide();
},
buttons: buttons,
minWidth: 400,
width: 420
}).show();
};
this.calendar_remove = function(calendar)
{
if (confirm(rcmail.gettext(calendar.children ? 'deletecalendarconfirmrecursive' : 'deletecalendarconfirm', 'calendar'))) {
rcmail.http_post('calendar', { action:'remove', c:{ id:calendar.id } });
return true;
}
return false;
};
this.calendar_destroy_source = function(id)
{
var delete_ids = [];
if (this.calendars[id]) {
// find sub-calendars
if (this.calendars[id].children) {
for (var child_id in this.calendars) {
if (String(child_id).indexOf(id) == 0)
delete_ids.push(child_id);
}
}
else {
delete_ids.push(id);
}
}
// delete all calendars in the list
for (var i=0; i < delete_ids.length; i++) {
id = delete_ids[i];
fc.fullCalendar('removeEventSource', this.calendars[id]);
$(rcmail.get_folder_li(id, 'rcmlical')).remove();
$('#edit-calendar option[value="'+id+'"]').remove();
delete this.calendars[id];
}
};
// open a dialog to upload an .ics file with events to be imported
this.import_events = function(calendar)
{
// close show dialog first
var $dialog = $("#eventsimport"),
form = rcmail.gui_objects.importform;
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (calendar)
$('#event-import-calendar').val(calendar.id);
var buttons = {};
buttons[rcmail.gettext('import', 'calendar')] = function() {
if (form && form.elements._data.value) {
rcmail.async_upload_form(form, 'import_events', function(e) {
rcmail.set_busy(false, null, me.saving_lock);
$('.ui-dialog-buttonpane button', $dialog.parent()).button('enable');
// display error message if no sophisticated response from server arrived (e.g. iframe load error)
if (me.import_succeeded === null)
rcmail.display_message(rcmail.get_label('importerror', 'calendar'), 'error');
});
// display upload indicator (with extended timeout)
var timeout = rcmail.env.request_timeout;
rcmail.env.request_timeout = 600;
me.import_succeeded = null;
me.saving_lock = rcmail.set_busy(true, 'uploading');
$('.ui-dialog-buttonpane button', $dialog.parent()).button('disable');
// restore settings
rcmail.env.request_timeout = timeout;
}
};
buttons[rcmail.gettext('cancel', 'calendar')] = function() {
$dialog.dialog("close");
};
// open jquery UI dialog
$dialog.dialog({
modal: true,
resizable: false,
closeOnEscape: false,
title: rcmail.gettext('importevents', 'calendar'),
close: function() {
$('.ui-dialog-buttonpane button', $dialog.parent()).button('enable');
$dialog.dialog("destroy").hide();
},
buttons: buttons,
width: 520
}).show();
};
// callback from server if import succeeded
this.import_success = function(p)
{
this.import_succeeded = true;
$("#eventsimport:ui-dialog").dialog('close');
rcmail.set_busy(false, null, me.saving_lock);
rcmail.gui_objects.importform.reset();
if (p.refetch)
this.refresh(p);
};
// callback from server to report errors on import
this.import_error = function(p)
{
this.import_succeeded = false;
rcmail.display_message(p.message || rcmail.get_label('importerror', 'calendar'), 'error');
}
// show URL of the given calendar in a dialog box
this.showurl = function(calendar)
{
var $dialog = $('#calendarurlbox');
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (calendar.feedurl) {
if (calendar.caldavurl) {
$('#caldavurl').val(calendar.caldavurl);
$('#calendarcaldavurl').show();
}
else {
$('#calendarcaldavurl').hide();
}
$dialog.dialog({
resizable: true,
closeOnEscape: true,
title: rcmail.gettext('showurl', 'calendar'),
close: function() {
$dialog.dialog("destroy").hide();
},
width: 520
}).show();
$('#calfeedurl').val(calendar.feedurl).select();
}
};
// refresh the calendar view after saving event data
this.refresh = function(p)
{
var source = me.calendars[p.source];
if (source && (p.refetch || (p.update && !source.active))) {
// activate event source if new event was added to an invisible calendar
if (!source.active) {
source.active = true;
fc.fullCalendar('addEventSource', source);
$('#' + rcmail.get_folder_li(source.id, 'rcmlical').id + ' input').prop('checked', true);
}
else
fc.fullCalendar('refetchEvents', source);
}
// add/update single event object
else if (source && p.update) {
var event = p.update;
event.temp = false;
event.editable = source.editable;
var existing = fc.fullCalendar('clientEvents', event._id);
if (existing.length) {
$.extend(existing[0], event);
fc.fullCalendar('updateEvent', existing[0]);
}
else {
event.source = source; // link with source
fc.fullCalendar('renderEvent', event);
}
// refresh fish-eye view
if (me.fisheye_date)
me.fisheye_view(me.fisheye_date);
}
// remove temp events
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
};
// modify query parameters for refresh requests
this.before_refresh = function(query)
{
var view = fc.fullCalendar('getView');
query.start = date2unixtime(view.visStart);
query.end = date2unixtime(view.visEnd);
if (this.search_query)
query.q = this.search_query;
return query;
};
/*** event searching ***/
// execute search
this.quicksearch = function()
{
if (rcmail.gui_objects.qsearchbox) {
var q = rcmail.gui_objects.qsearchbox.value;
if (q != '') {
var id = 'search-'+q;
var sources = [];
if (this._search_message)
rcmail.hide_message(this._search_message);
for (var sid in this.calendars) {
if (this.calendars[sid]) {
this.calendars[sid].url = this.calendars[sid].url.replace(/&q=.+/, '') + '&q='+escape(q);
sources.push(sid);
}
}
id += '@'+sources.join(',');
// ignore if query didn't change
if (this.search_request == id) {
return;
}
// remember current view
else if (!this.search_request) {
this.default_view = fc.fullCalendar('getView').name;
}
this.search_request = id;
this.search_query = q;
// change to list view
fc.fullCalendar('option', 'listSections', 'month')
.fullCalendar('option', 'listRange', Math.max(60, settings['agenda_range']))
.fullCalendar('changeView', 'table');
update_agenda_toolbar();
// refetch events with new url (if not already triggered by changeView)
if (!this.is_loading)
fc.fullCalendar('refetchEvents');
}
else // empty search input equals reset
this.reset_quicksearch();
}
};
// reset search and get back to normal event listing
this.reset_quicksearch = function()
{
$(rcmail.gui_objects.qsearchbox).val('');
if (this._search_message)
rcmail.hide_message(this._search_message);
if (this.search_request) {
// hide bottom links of agenda view
fc.find('.fc-list-content > .fc-listappend').hide();
// restore original event sources and view mode from fullcalendar
fc.fullCalendar('option', 'listSections', settings['agenda_sections'])
.fullCalendar('option', 'listRange', settings['agenda_range']);
update_agenda_toolbar();
for (var sid in this.calendars) {
if (this.calendars[sid])
this.calendars[sid].url = this.calendars[sid].url.replace(/&q=.+/, '');
}
if (this.default_view)
fc.fullCalendar('changeView', this.default_view);
if (!this.is_loading)
fc.fullCalendar('refetchEvents');
this.search_request = this.search_query = null;
}
};
// callback if all sources have been fetched from server
this.events_loaded = function(count)
{
var addlinks, append = '';
// enhance list view when searching
if (this.search_request) {
if (!count) {
this._search_message = rcmail.display_message(rcmail.gettext('searchnoresults', 'calendar'), 'notice');
append = '<div class="message">' + rcmail.gettext('searchnoresults', 'calendar') + '</div>';
}
append += '<div class="fc-bottomlinks formlinks"></div>';
addlinks = true;
}
if (fc.fullCalendar('getView').name == 'table') {
var container = fc.find('.fc-list-content > .fc-listappend');
if (append) {
if (!container.length)
container = $('<div class="fc-listappend"></div>').appendTo(fc.find('.fc-list-content'));
container.html(append).show();
}
else if (container.length)
container.hide();
// add links to adjust search date range
if (addlinks) {
var lc = container.find('.fc-bottomlinks');
$('<a>').attr('href', '#').html(rcmail.gettext('searchearlierdates', 'calendar')).appendTo(lc).click(function(){
fc.fullCalendar('incrementDate', 0, -1, 0);
});
lc.append(" ");
$('<a>').attr('href', '#').html(rcmail.gettext('searchlaterdates', 'calendar')).appendTo(lc).click(function(){
var range = fc.fullCalendar('option', 'listRange');
if (range < 90) {
fc.fullCalendar('option', 'listRange', fc.fullCalendar('option', 'listRange') + 30).fullCalendar('render');
update_agenda_toolbar();
}
else
fc.fullCalendar('incrementDate', 0, 1, 0);
});
}
}
if (this.fisheye_date)
this.fisheye_view(this.fisheye_date);
};
// resize and reposition (center) the dialog window
this.dialog_resize = function(id, height, width)
{
var win = $(window), w = win.width(), h = win.height();
$(id).dialog('option', { height: Math.min(h-20, height+130), width: Math.min(w-20, width+50) })
.dialog('option', 'position', ['center', 'center']); // only works in a separate call (!?)
};
// adjust calendar view size
this.view_resize = function()
{
var footer = fc.fullCalendar('getView').name == 'table' ? $('#agendaoptions').outerHeight() : 0;
fc.fullCalendar('option', 'height', $('#calendar').height() - footer);
};
/*** startup code ***/
// create list of event sources AKA calendars
this.calendars = {};
var li, cal, active, event_sources = [];
for (var id in rcmail.env.calendars) {
cal = rcmail.env.calendars[id];
this.calendars[id] = $.extend({
url: "./?_task=calendar&_action=load_events&source="+escape(id),
editable: !cal.readonly,
className: 'fc-event-cal-'+id,
id: id
}, cal);
this.calendars[id].color = settings.event_coloring % 2 ? '' : '#' + cal.color;
if ((active = cal.active || false)) {
event_sources.push(this.calendars[id]);
}
// init event handler on calendar list checkbox
if ((li = rcmail.get_folder_li(id, 'rcmlical'))) {
$('#'+li.id+' input').click(function(e){
var id = $(this).data('id');
if (me.calendars[id]) { // add or remove event source on click
var action;
if (this.checked) {
action = 'addEventSource';
me.calendars[id].active = true;
}
else {
action = 'removeEventSource';
me.calendars[id].active = false;
}
// add/remove event source
fc.fullCalendar(action, me.calendars[id]);
rcmail.http_post('calendar', { action:'subscribe', c:{ id:id, active:me.calendars[id].active?1:0 } });
}
}).data('id', id).get(0).checked = active;
$(li).click(function(e){
var id = $(this).data('id');
rcmail.select_folder(id, 'rcmlical');
rcmail.enable_command('calendar-edit', true);
rcmail.enable_command('calendar-remove', 'calendar-showurl', true);
me.selected_calendar = id;
})
.dblclick(function(){ me.calendar_edit_dialog(me.calendars[me.selected_calendar]); })
.data('id', id);
}
if (!cal.readonly && !this.selected_calendar) {
this.selected_calendar = id;
rcmail.enable_command('addevent', true);
}
}
// select default calendar
if (settings.default_calendar && this.calendars[settings.default_calendar] && !this.calendars[settings.default_calendar].readonly)
this.selected_calendar = settings.default_calendar;
var viewdate = new Date();
if (rcmail.env.date)
viewdate.setTime(fromunixtime(rcmail.env.date));
// initalize the fullCalendar plugin
var fc = $('#calendar').fullCalendar({
header: {
right: 'prev,next today',
center: 'title',
left: 'agendaDay,agendaWeek,month,table'
},
aspectRatio: 1,
date: viewdate.getDate(),
month: viewdate.getMonth(),
year: viewdate.getFullYear(),
ignoreTimezone: true, // will treat the given date strings as in local (browser's) timezone
height: $('#calendar').height(),
eventSources: event_sources,
monthNames : settings['months'],
monthNamesShort : settings['months_short'],
dayNames : settings['days'],
dayNamesShort : settings['days_short'],
firstDay : settings['first_day'],
firstHour : settings['first_hour'],
slotMinutes : 60/settings['timeslots'],
timeFormat: {
'': settings['time_format'],
agenda: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
list: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
table: settings['time_format'] + '{ - ' + settings['time_format'] + '}'
},
axisFormat : settings['time_format'],
columnFormat: {
month: 'ddd', // Mon
week: 'ddd ' + settings['date_short'], // Mon 9/7
day: 'dddd ' + settings['date_short'], // Monday 9/7
table: settings['date_agenda']
},
titleFormat: {
month: 'MMMM yyyy',
week: settings['dates_long'],
day: 'dddd ' + settings['date_long'],
table: settings['dates_long']
},
listPage: 1, // advance one day in agenda view
listRange: settings['agenda_range'],
listSections: settings['agenda_sections'],
tableCols: ['handle', 'date', 'time', 'title', 'location'],
defaultView: rcmail.env.view || settings['default_view'],
allDayText: rcmail.gettext('all-day', 'calendar'),
buttonText: {
prev: (bw.ie6 ? ' << ' : ' ◄ '),
next: (bw.ie6 ? ' >> ' : ' ► '),
today: settings['today'],
day: rcmail.gettext('day', 'calendar'),
week: rcmail.gettext('week', 'calendar'),
month: rcmail.gettext('month', 'calendar'),
table: rcmail.gettext('agenda', 'calendar')
},
listTexts: {
until: rcmail.gettext('until', 'calendar'),
past: rcmail.gettext('pastevents', 'calendar'),
today: rcmail.gettext('today', 'calendar'),
tomorrow: rcmail.gettext('tomorrow', 'calendar'),
thisWeek: rcmail.gettext('thisweek', 'calendar'),
nextWeek: rcmail.gettext('nextweek', 'calendar'),
thisMonth: rcmail.gettext('thismonth', 'calendar'),
nextMonth: rcmail.gettext('nextmonth', 'calendar'),
future: rcmail.gettext('futureevents', 'calendar'),
week: rcmail.gettext('weekofyear', 'calendar')
},
selectable: true,
selectHelper: false,
currentTimeIndicator: settings.time_indicator,
loading: function(isLoading) {
me.is_loading = isLoading;
this._rc_loading = rcmail.set_busy(isLoading, 'loading', this._rc_loading);
// trigger callback
if (!isLoading)
me.events_loaded($(this).fullCalendar('clientEvents').length);
},
// event rendering
eventRender: fc_event_render,
// render element indicating more (invisible) events
overflowRender: function(data, element) {
element.html(rcmail.gettext('andnmore', 'calendar').replace('$nr', data.count))
.click(function(e){ me.fisheye_view(data.date); });
},
// callback for date range selection
select: function(start, end, allDay, e, view) {
var range_select = (!allDay || start.getDate() != end.getDate())
if (dialog_check(e) && range_select)
event_edit_dialog('new', { start:start, end:end, allDay:allDay, calendar:me.selected_calendar });
if (range_select || ignore_click)
view.calendar.unselect();
},
// callback for clicks in all-day box
dayClick: function(date, allDay, e, view) {
var now = new Date().getTime();
if (now - day_clicked_ts < 400 && day_clicked == date.getTime()) { // emulate double-click on day
var enddate = new Date(); enddate.setTime(date.getTime() + DAY_MS - 60000);
return event_edit_dialog('new', { start:date, end:enddate, allDay:allDay, calendar:me.selected_calendar });
}
if (!ignore_click) {
view.calendar.gotoDate(date);
if (day_clicked && new Date(day_clicked).getMonth() != date.getMonth())
view.calendar.select(date, date, allDay);
}
day_clicked = date.getTime();
day_clicked_ts = now;
},
// callback when a specific event is clicked
eventClick: function(event) {
if (!event.temp)
event_show_dialog(event);
},
// callback when an event was dragged and finally dropped
eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc) {
if (event.end == null || event.end.getTime() < event.start.getTime()) {
event.end = new Date(event.start.getTime() + (allDay ? DAY_MS : HOUR_MS));
}
// moved to all-day section: set times to 12:00 - 13:00
if (allDay && !event.allDay) {
event.start.setHours(12);
event.start.setMinutes(0);
event.start.setSeconds(0);
event.end.setHours(13);
event.end.setMinutes(0);
event.end.setSeconds(0);
}
// moved from all-day section: set times to working hours
else if (event.allDay && !allDay) {
var newstart = event.start.getTime();
revertFunc(); // revert to get original duration
var numdays = Math.max(1, Math.round((event.end.getTime() - event.start.getTime()) / DAY_MS)) - 1;
event.start = new Date(newstart);
event.end = new Date(newstart + numdays * DAY_MS);
event.end.setHours(settings['work_end'] || 18);
event.end.setMinutes(0);
if (event.end.getTime() < event.start.getTime())
event.end = new Date(newstart + HOUR_MS);
}
// send move request to server
var data = {
id: event.id,
calendar: event.calendar,
start: date2servertime(event.start),
end: date2servertime(event.end),
allday: allDay?1:0
};
update_event_confirm('move', event, data);
},
// callback for event resizing
eventResize: function(event, delta) {
// sanitize event dates
if (event.allDay)
event.start.setHours(12);
if (!event.end || event.end.getTime() < event.start.getTime())
event.end = new Date(event.start.getTime() + HOUR_MS);
// send resize request to server
var data = {
id: event.id,
calendar: event.calendar,
start: date2servertime(event.start),
end: date2servertime(event.end)
};
update_event_confirm('resize', event, data);
},
viewDisplay: function(view) {
$('#agendaoptions')[view.name == 'table' ? 'show' : 'hide']();
if (minical) {
window.setTimeout(function(){ minical.datepicker('setDate', fc.fullCalendar('getDate')); }, exec_deferred);
if (view.name != current_view)
me.view_resize();
current_view = view.name;
}
},
viewRender: function(view) {
if (fc && view.name == 'month')
fc.fullCalendar('option', 'maxHeight', Math.floor((view.element.parent().height()-18) / 6) - 35);
}
});
// format time string
var formattime = function(hour, minutes, start) {
var time, diff, unit, duration = '', d = new Date();
d.setHours(hour);
d.setMinutes(minutes);
time = $.fullCalendar.formatDate(d, settings['time_format']);
if (start) {
diff = Math.floor((d.getTime() - start.getTime()) / 60000);
if (diff > 0) {
unit = 'm';
if (diff >= 60) {
unit = 'h';
diff = Math.round(diff / 3) / 20;
}
duration = ' (' + diff + unit + ')';
}
}
return [time, duration];
};
var autocomplete_times = function(p, callback) {
/* Time completions */
var result = [];
var now = new Date();
var st, start = (String(this.element.attr('id')).indexOf('endtime') > 0
&& (st = $('#edit-starttime').val())
&& $('#edit-startdate').val() == $('#edit-enddate').val())
? parse_datetime(st, '') : null;
var full = p.term - 1 > 0 || p.term.length > 1;
var hours = start ? start.getHours() :
(full ? parse_datetime(p.term, '') : now).getHours();
var step = 15;
var minutes = hours * 60 + (full ? 0 : now.getMinutes());
var min = Math.ceil(minutes / step) * step % 60;
var hour = Math.floor(Math.ceil(minutes / step) * step / 60);
// list hours from 0:00 till now
for (var h = start ? start.getHours() : 0; h < hours; h++)
result.push(formattime(h, 0, start));
// list 15min steps for the next two hours
for (; h < hour + 2 && h < 24; h++) {
while (min < 60) {
result.push(formattime(h, min, start));
min += step;
}
min = 0;
}
// list the remaining hours till 23:00
while (h < 24)
result.push(formattime((h++), 0, start));
return callback(result);
};
var autocomplete_open = function(event, ui) {
// scroll to current time
var $this = $(this);
var widget = $this.autocomplete('widget');
var menu = $this.data('autocomplete').menu;
var amregex = /^(.+)(a[.m]*)/i;
var pmregex = /^(.+)(a[.m]*)/i;
var val = $(this).val().replace(amregex, '0:$1').replace(pmregex, '1:$1');
var li, html;
widget.css('width', '10em');
widget.children().each(function(){
li = $(this);
html = li.children().first().html().replace(/\s+\(.+\)$/, '').replace(amregex, '0:$1').replace(pmregex, '1:$1');
if (html.indexOf(val) == 0)
menu._scrollIntoView(li);
});
};
// if start date is changed, shift end date according to initial duration
var shift_enddate = function(dateText) {
var newstart = parse_datetime('0', dateText);
var newend = new Date(newstart.getTime() + $('#edit-startdate').data('duration') * 1000);
$('#edit-enddate').val($.fullCalendar.formatDate(newend, me.settings['date_format']));
event_times_changed();
};
// Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
// Uses the default $.datepicker.iso8601Week() function but takes firstDay setting into account.
// This is a temporary fix until http://bugs.jqueryui.com/ticket/8420 is resolved.
var iso8601Week = datepicker_settings.calculateWeek = function(date) {
var mondayOffset = Math.abs(1 - datepicker_settings.firstDay);
return $.datepicker.iso8601Week(new Date(date.getTime() + mondayOffset * 86400000));
};
var minical;
var init_calendar_ui = function()
{
// initialize small calendar widget using jQuery UI datepicker
minical = $('#datepicker').datepicker($.extend(datepicker_settings, {
inline: true,
showWeek: true,
changeMonth: false, // maybe enable?
changeYear: false, // maybe enable?
onSelect: function(dateText, inst) {
ignore_click = true;
var d = minical.datepicker('getDate'); //parse_datetime('0:0', dateText);
fc.fullCalendar('gotoDate', d).fullCalendar('select', d, d, true);
},
onChangeMonthYear: function(year, month, inst) {
minical.data('year', year).data('month', month);
},
beforeShowDay: function(date) {
var view = fc.fullCalendar('getView');
var active = view.visStart && date.getTime() >= view.visStart.getTime() && date.getTime() < view.visEnd.getTime();
return [ true, (active ? 'ui-datepicker-activerange ui-datepicker-active-' + view.name : ''), ''];
}
})) // set event handler for clicks on calendar week cell of the datepicker widget
.click(function(e) {
var cell = $(e.target);
if (e.target.tagName == 'TD' && cell.hasClass('ui-datepicker-week-col')) {
var base_date = minical.datepicker('getDate');
if (minical.data('month'))
base_date.setMonth(minical.data('month')-1);
if (minical.data('year'))
base_date.setYear(minical.data('year'));
base_date.setHours(12);
base_date.setDate(base_date.getDate() - ((base_date.getDay() + 6) % 7) + datepicker_settings.firstDay);
var day_off = base_date.getDay() - datepicker_settings.firstDay;
var base_kw = iso8601Week(base_date);
var target_kw = parseInt(cell.html());
var diff = (target_kw - base_kw) * 7 * DAY_MS;
// select monday of the chosen calendar week
var date = new Date(base_date.getTime() - day_off * DAY_MS + diff);
fc.fullCalendar('gotoDate', date).fullCalendar('setDate', date).fullCalendar('changeView', 'agendaWeek');
minical.datepicker('setDate', date);
}
});
// init event dialog
$('#eventtabs').tabs({
show: function(event, ui) {
if (ui.panel.id == 'event-tab-3') {
$('#edit-attendee-name').select();
// update free-busy status if needed
if (freebusy_ui.needsupdate && me.selected_event)
update_freebusy_status(me.selected_event);
// add current user as organizer if non added yet
if (!event_attendees.length) {
add_attendee($.extend({ role:'ORGANIZER' }, settings.identity));
$('#edit-attendees-form .attendees-invitebox').show();
}
}
}
});
$('#edit-enddate').datepicker(datepicker_settings);
$('#edit-startdate').datepicker(datepicker_settings).datepicker('option', 'onSelect', shift_enddate).change(function(){ shift_enddate(this.value); });
$('#edit-enddate').datepicker('option', 'onSelect', event_times_changed).change(event_times_changed);
$('#edit-allday').click(function(){ $('#edit-starttime, #edit-endtime')[(this.checked?'hide':'show')](); event_times_changed(); });
// configure drop-down menu on time input fields based on jquery UI autocomplete
$('#edit-starttime, #edit-endtime, #eventedit input.edit-alarm-time')
.attr('autocomplete', "off")
.autocomplete({
delay: 100,
minLength: 1,
source: autocomplete_times,
open: autocomplete_open,
change: event_times_changed,
select: function(event, ui) {
$(this).val(ui.item[0]);
return false;
}
})
.click(function() { // show drop-down upon clicks
$(this).autocomplete('search', $(this).val() ? $(this).val().replace(/\D.*/, "") : " ");
}).each(function(){
$(this).data('autocomplete')._renderItem = function(ul, item) {
return $('<li>')
.data('item.autocomplete', item)
.append('<a>' + item[0] + item[1] + '</a>')
.appendTo(ul);
};
});
// register events on alarm fields
init_alarms_edit('#eventedit');
// toggle recurrence frequency forms
$('#edit-recurrence-frequency').change(function(e){
var freq = $(this).val().toLowerCase();
$('.recurrence-form').hide();
if (freq)
$('#recurrence-form-'+freq+', #recurrence-form-until').show();
});
$('#edit-recurrence-enddate').datepicker(datepicker_settings).click(function(){ $("#edit-recurrence-repeat-until").prop('checked', true) });
$('#edit-recurrence-repeat-times').change(function(e){ $('#edit-recurrence-repeat-count').prop('checked', true); });
// init attendees autocompletion
var ac_props;
// parallel autocompletion
if (rcmail.env.autocomplete_threads > 0) {
ac_props = {
threads: rcmail.env.autocomplete_threads,
sources: rcmail.env.autocomplete_sources
};
}
rcmail.init_address_input_events($('#edit-attendee-name'), ac_props);
rcmail.addEventListener('autocomplete_insert', function(e){ $('#edit-attendee-add').click(); });
$('#edit-attendee-add').click(function(){
var input = $('#edit-attendee-name');
rcmail.ksearch_blur();
if (add_attendees(input.val())) {
input.val('');
}
});
// keep these two checkboxes in sync
$('#edit-attendees-donotify, #edit-attendees-invite').click(function(){
$('#edit-attendees-donotify, #edit-attendees-invite').prop('checked', this.checked);
});
$('#edit-attendee-schedule').click(function(){
event_freebusy_dialog();
});
$('#shedule-freebusy-prev').html(bw.ie6 ? '<<' : '◄').button().click(function(){ render_freebusy_grid(-1); });
$('#shedule-freebusy-next').html(bw.ie6 ? '>>' : '►').button().click(function(){ render_freebusy_grid(1); }).parent().buttonset();
$('#shedule-find-prev').button().click(function(){ freebusy_find_slot(-1); });
$('#shedule-find-next').button().click(function(){ freebusy_find_slot(1); });
$('#schedule-freebusy-workinghours').click(function(){
freebusy_ui.workinhoursonly = this.checked;
$('#workinghourscss').remove();
if (this.checked)
$('<style type="text/css" id="workinghourscss"> td.offhours { opacity:0.3; filter:alpha(opacity=30) } </style>').appendTo('head');
});
$('#event-rsvp input.button').click(function(){
event_rsvp($(this).attr('rel'))
});
$('#agenda-listrange').change(function(e){
settings['agenda_range'] = parseInt($(this).val());
fc.fullCalendar('option', 'listRange', settings['agenda_range']).fullCalendar('render');
// TODO: save new settings in prefs
}).val(settings['agenda_range']);
$('#agenda-listsections').change(function(e){
settings['agenda_sections'] = $(this).val();
fc.fullCalendar('option', 'listSections', settings['agenda_sections']).fullCalendar('render');
// TODO: save new settings in prefs
}).val(fc.fullCalendar('option', 'listSections'));
// hide event dialog when clicking somewhere into document
$(document).bind('mousedown', dialog_check);
rcmail.set_busy(false, 'loading', ui_loading);
}
// initialize more UI elements (deferred)
window.setTimeout(init_calendar_ui, exec_deferred);
// add proprietary css styles if not IE
if (!bw.ie)
$('div.fc-content').addClass('rcube-fc-content');
// IE supresses 2nd click event when double-clicking
if (bw.ie && bw.vendver < 9) {
$('div.fc-content').bind('dblclick', function(e){
if (!$(this).hasClass('fc-widget-header') && fc.fullCalendar('getView').name != 'table') {
var date = fc.fullCalendar('getDate');
var enddate = new Date(); enddate.setTime(date.getTime() + DAY_MS - 60000);
event_edit_dialog('new', { start:date, end:enddate, allDay:true, calendar:me.selected_calendar });
}
});
}
} // end rcube_calendar class
/* calendar plugin initialization */
window.rcmail && rcmail.addEventListener('init', function(evt) {
// configure toolbar buttons
rcmail.register_command('addevent', function(){ cal.add_event(); }, true);
rcmail.register_command('print', function(){ cal.print_calendars(); }, true);
// configure list operations
rcmail.register_command('calendar-create', function(){ cal.calendar_edit_dialog(null); }, true);
rcmail.register_command('calendar-edit', function(){ cal.calendar_edit_dialog(cal.calendars[cal.selected_calendar]); }, false);
rcmail.register_command('calendar-remove', function(){ cal.calendar_remove(cal.calendars[cal.selected_calendar]); }, false);
rcmail.register_command('events-import', function(){ cal.import_events(cal.calendars[cal.selected_calendar]); }, true);
rcmail.register_command('calendar-showurl', function(){ cal.showurl(cal.calendars[cal.selected_calendar]); }, false);
// search and export events
rcmail.register_command('export', function(){ rcmail.goto_url('export_events', { source:cal.selected_calendar }); }, true);
rcmail.register_command('search', function(){ cal.quicksearch(); }, true);
rcmail.register_command('reset-search', function(){ cal.reset_quicksearch(); }, true);
// register callback commands
rcmail.addEventListener('plugin.destroy_source', function(p){ cal.calendar_destroy_source(p.id); });
rcmail.addEventListener('plugin.unlock_saving', function(p){ cal.unlock_saving(); });
rcmail.addEventListener('plugin.refresh_calendar', function(p){ cal.refresh(p); });
rcmail.addEventListener('plugin.import_success', function(p){ cal.import_success(p); });
rcmail.addEventListener('plugin.import_error', function(p){ cal.import_error(p); });
rcmail.addEventListener('requestrefresh', function(q){ return cal.before_refresh(q); });
// let's go
var cal = new rcube_calendar_ui($.extend(rcmail.env.calendar_settings, rcmail.env.libcal_settings));
$(window).resize(function(e) {
// check target due to bugs in jquery
// http://bugs.jqueryui.com/ticket/7514
// http://bugs.jquery.com/ticket/9841
if (e.target == window) {
cal.view_resize();
}
}).resize();
// show calendars list when ready
$('#calendars').css('visibility', 'inherit');
// show toolbar
$('#toolbar').show();
});
| stephdl/roundcubemail_plugins | root/usr/share/roundcubemail/plugins/calendar/calendar_ui.js | JavaScript | gpl-2.0 | 114,423 |
<?php
/**
* @package sauto
* @subpackage Views
* @author Dacian Strain {@link http://shop.elbase.eu}
* @author Created on 17-Nov-2013
* @license GNU/GPL
*/
//-- No direct access
defined('_JEXEC') || die('=;)');
$time = time();
$app =& JFactory::getApplication();
$db = JFactory::getDbo();
$request_v =& JRequest::getVar( 'request', '', 'post', 'string' );
$app->setUserState('request', $request_v);
$titlu_anunt =& JRequest::getVar( 'titlu_anunt', '', 'post', 'string' );
$app->setUserState('titlu_anunt', $titlu_anunt);
$marca =& JRequest::getVar( 'marca', '', 'post', 'string' );
$model_auto =& JRequest::getVar( 'model_auto', '', 'post', 'string' );
$app->setUserState('model_auto', $model_auto);
$an_fabricatie =& JRequest::getVar( 'an_fabricatie', '', 'post', 'string' );
$app->setUserState('an_fabricatie', $an_fabricatie);
$cilindree =& JRequest::getVar( 'cilindree', '', 'post', 'string' );
$app->setUserState('cilindree', $cilindree);
$carburant =& JRequest::getVar( 'carburant', '', 'post', 'string' );
$app->setUserState('carburant', $carburant);
$caroserie =& JRequest::getVar( 'caroserie', '', 'post', 'string' );
$app->setUserState('caroserie', $caroserie);
$serie_caroserie =& JRequest::getVar( 'serie_caroserie', '', 'post', 'string' );
$app->setUserState('serie_caroserie', $serie_caroserie);
$anunt =& JRequest::getVar( 'anunt8', '', 'post', 'string', JREQUEST_ALLOWHTML );
$app->setUserState('anunt', $anunt);
$judet =& JRequest::getVar( 'judet', '', 'post', 'string' );
$city =& JRequest::getVar( 'localitate', '', 'post', 'string' );
$query = "SELECT `id` FROM #__sa_judete WHERE `judet` = '".$judet."'";
$db->setQuery($query);
$id_judet = $db->loadResult();
$transmisie =& JRequest::getVar( 'transmisie', '', 'post', 'string' );
$app->setUserState('transmisie', $transmisie);
$user =& JFactory::getUser();
$uid = $user->id;
$register_anunt = 0;
//echo '>>>>> marca '.$marca.' >>>> '.$new_marca.' >>>>> '.$model_auto.' >>>>> '.$new_model.'<br />';
$link_redirect = JRoute::_('index.php?option=com_sauto&view=add_request');
if ($marca == '') {
//nu am selectat marca
$app->redirect($link_redirect, JText::_('SAUTO_NO_MARCA_ADDED'));
} else {
//marca existenta, obtinem id-ul
$query = "SELECT `id` FROM #__sa_marca_auto WHERE `marca_auto` = '".$marca."'";
$db->setQuery($query);
$mid = $db->loadResult();
$marca_auto_id = $mid;
$app->setUserState('marca', $mid);
//echo '<br />>>>>>'.$marca_auto_id.'<br />';
$model_auto_id = $model_auto;
$app->setUserState('model_auto', $model_auto);
}
//echo '<br />>>>>>'.$model_auto_id.'<br />';
//verificam campurile introduse
if ($titlu_anunt == '') {
//nu avem introdus titlul
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_TITLE_ADDED'));
} else {
if ($an_fabricatie == '') {
//nu avem introdus anul fabricatiei
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_PRODUCTION_YEAR_ADDED'));
} else {
if ($cilindree == '') {
//cilindreea nu este introdusa
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_CAPACITY_ADDED'));
} else {
if ($carburant == '') {
//carburantul nu este ales
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_CARBURANT_ADDED'));
} else {
if ($caroserie == '') {
//nu este aleasa caroseria
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_CARSERIE_ADDED'));
} else {
if ($serie_caroserie == '') {
//seria caroseriei nu este introdusa
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_SERIE_CARSERIE_ADDED'));
} else {
if ($anunt == '') {
//nu este adaugat anuntul
//SautoViewAdding::deleteModels($marca_noua_id, $model_nou_id);
$app->redirect($link_redirect, JText::_('SAUTO_NO_ANUNT_ADDED'));
} else {
//e ok
$register_anunt = 1;
}
}
}
}
}
}
}
//sfarsit verificare
if ($register_anunt == 1) {
//obtin data curenta
$curentDate = date('Y-m-d H:i:s', $time);
$expiryDate = date('Y-m-d H:i:s', ($time+2592000));
//echo '<br />caroserie>>>>'.$caroserie.'<br />';
//adaug in baza de date
$query = "INSERT INTO #__sa_anunturi
(`titlu_anunt`, `anunt`, `tip_anunt`, `marca_auto`, `model_auto`, `an_fabricatie`,
`cilindree`, `carburant`, `caroserie`, `serie_caroserie`, `proprietar`, `data_adaugarii`,
`status_anunt`, `raportat`, `data_expirarii`, `judet`, `city`, `transmisie`)
VALUES
('".$titlu_anunt."', '".$anunt."', '8', '".$marca_auto_id."', '".$model_auto_id."', '".$an_fabricatie."',
'".$cilindree."', '".$carburant."','".$caroserie."', '".$serie_caroserie."', '".$uid."', '".$curentDate."',
'1', '0', '".$expiryDate."', '".$id_judet."', '".$city."', '".$transmisie."')";
$db->setQuery($query);
$db->query();
$anunt_id = $db->insertid();
###########################prelucrare imagine#############
SautoViewAdding::uploadImg($time, $uid, $anunt_id);
SautoViewAdding::sendMail($anunt_id);
###########################end prelucrare imagine################## $app->setUserState('titlu_anunt', '');
//parcam masina daca este cazul....
$parcheaza =& JRequest::getVar( 'parcheaza', '', 'post', 'string' );
if ($parcheaza == 1) {
$query = "INSERT INTO #__sa_garaj
(`owner`, `marca`, `model`, `an_fabricatie`, `cilindree`, `carburant`,
`caroserie`, `serie_caroserie`, `transmisie`)
VALUES
('".$uid."', '".$marca_auto_id."', '".$model_auto_id."', '".$an_fabricatie."', '".$cilindree."',
'".$carburant."', '".$caroserie."', '".$serie_caroserie."', '".$transmisie."')";
$db->setQuery($query);
$db->query();
}
//end parcare masina
$app->setUserState('an_fabricatie', '');
$app->setUserState('cilindree', '');
$app->setUserState('carburant', '');
$app->setUserState('marca', '');
$app->setUserState('caroserie', '');
$app->setUserState('serie_caroserie', '');
$app->setUserState('model_auto', '');
$app->setUserState('request', '');$app->setUserState('transmisie', '');
$app->setUserState('titlu_anunt', '');
$app->setUserState('transmisie', '');
$app->setUserState('anunt', '');
$link_redirect_fr = JRoute::_('index.php?option=com_sauto');
$app->redirect($link_redirect_fr, JText::_('SAUTO_SUCCESS_ADDED'));
}
?>
| grchis/android | components/com_sauto/views/adding/tmpl/default_8.php | PHP | gpl-2.0 | 6,604 |
#!/usr/bin/env python3
# This file is part of ipxact2systemverilog
# Copyright (C) 2013 Andreas Lindh
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# andreas.lindh (a) hiced.com
import math
import os
import sys
import xml.etree.ElementTree as ETree
import tabulate
from mdutils.mdutils import MdUtils
DEFAULT_INI = {'global': {'unusedholes': 'yes',
'onebitenum': 'no'}}
def sortRegisterAndFillHoles(regName,
fieldNameList,
bitOffsetList,
bitWidthList,
fieldDescList,
enumTypeList,
unusedHoles=True):
# sort the lists, highest offset first
fieldNameList = fieldNameList
bitOffsetList = [int(x) for x in bitOffsetList]
bitWidthList = [int(x) for x in bitWidthList]
fieldDescList = fieldDescList
enumTypeList = enumTypeList
matrix = list(zip(bitOffsetList, fieldNameList, bitWidthList, fieldDescList, enumTypeList))
matrix.sort(key=lambda x: x[0]) # , reverse=True)
bitOffsetList, fieldNameList, bitWidthList, fieldDescList, enumTypeList = list(zip(*matrix))
# zip return tuples not lists
fieldNameList = list(fieldNameList)
bitOffsetList = list([int(x) for x in bitOffsetList])
bitWidthList = list([int(x) for x in bitWidthList])
fieldDescList = list(fieldDescList)
enumTypeList = list(enumTypeList)
if unusedHoles:
unUsedCnt = 0
nextFieldStartingPos = 0
# fill up the holes
index = 0
register_width = bitOffsetList[-1] + bitWidthList[-1]
while register_width > nextFieldStartingPos:
if nextFieldStartingPos != bitOffsetList[index]:
newBitWidth = bitOffsetList[index] - nextFieldStartingPos
bitOffsetList.insert(index, nextFieldStartingPos)
fieldNameList.insert(index, 'unused' + str(unUsedCnt))
bitWidthList.insert(index, newBitWidth)
fieldDescList.insert(index, 'unused')
enumTypeList.insert(index, '')
unUsedCnt += 1
nextFieldStartingPos = int(bitOffsetList[index]) + int(bitWidthList[index])
index += 1
return regName, fieldNameList, bitOffsetList, bitWidthList, fieldDescList, enumTypeList
class documentClass():
def __init__(self, name):
self.name = name
self.memoryMapList = []
def addMemoryMap(self, memoryMap):
self.memoryMapList.append(memoryMap)
class memoryMapClass():
def __init__(self, name):
self.name = name
self.addressBlockList = []
def addAddressBlock(self, addressBlock):
self.addressBlockList.append(addressBlock)
class addressBlockClass():
def __init__(self, name, addrWidth, dataWidth):
self.name = name
self.addrWidth = addrWidth
self.dataWidth = dataWidth
self.registerList = []
self.suffix = ""
def addRegister(self, reg):
assert isinstance(reg, registerClass)
self.registerList.append(reg)
def setRegisterList(self, registerList):
self.registerList = registerList
def returnAsString(self):
raise NotImplementedError("method returnAsString() is virutal and must be overridden.")
class registerClass():
def __init__(self, name, address, resetValue, size, access, desc, fieldNameList,
bitOffsetList, bitWidthList, fieldDescList, enumTypeList):
assert isinstance(enumTypeList, list), 'enumTypeList is not a list'
self.name = name
self.address = address
self.resetValue = resetValue
self.size = size
self.access = access
self.desc = desc
self.fieldNameList = fieldNameList
self.bitOffsetList = bitOffsetList
self.bitWidthList = bitWidthList
self.fieldDescList = fieldDescList
self.enumTypeList = enumTypeList
class enumTypeClassRegistry():
""" should perhaps be a singleton instead """
def __init__(self):
self.listOfEnums = []
def enumAllReadyExist(self, enum):
for e in self.listOfEnums:
if e.compare(enum):
enum.allReadyExist = True
enum.enumName = e.name
break
self.listOfEnums.append(enum)
return enum
class enumTypeClass():
def __init__(self, name, bitWidth, keyList, valueList, descrList):
self.name = name
self.bitWidth = bitWidth
matrix = list(zip(valueList, keyList, descrList))
matrix.sort(key=lambda x: x[0])
valueList, keyList, descrList = list(zip(*matrix))
self.keyList = list(keyList)
self.valueList = list(valueList)
self.allReadyExist = False
self.enumName = None
self.descrList = descrList
def compare(self, other):
result = True
result = self.bitWidth == other.bitWidth and result
result = self.compareLists(self.keyList, other.keyList) and result
return result
def compareLists(self, list1, list2):
for val in list1:
if val in list2:
return True
return False
class rstAddressBlock(addressBlockClass):
"""Generates a ReStructuredText file from a IP-XACT register description"""
def __init__(self, name, addrWidth, dataWidth):
self.name = name
self.addrWidth = addrWidth
self.dataWidth = dataWidth
self.registerList = []
self.suffix = ".rst"
def returnEnumValueString(self, enumTypeObj):
if isinstance(enumTypeObj, enumTypeClass):
l = []
for i in range(len(enumTypeObj.keyList)):
l.append(enumTypeObj.keyList[i] + '=' + enumTypeObj.valueList[i])
s = ", ".join(l)
else:
s = ''
return s
def returnAsString(self):
r = ""
regNameList = [reg.name for reg in self.registerList]
regAddressList = [reg.address for reg in self.registerList]
regDescrList = [reg.desc for reg in self.registerList]
r += self.returnRstTitle()
r += self.returnRstSubTitle()
summary_table = []
for i in range(len(regNameList)):
summary_table.append(["%#04x" % regAddressList[i], str(regNameList[i]) + "_", str(regDescrList[i])])
r += tabulate.tabulate(summary_table,
headers=['Address', 'Register Name', 'Description'],
tablefmt="grid")
r += "\n"
r += "\n"
for reg in self.registerList:
r += self.returnRstRegDesc(reg.name, reg.address, reg.size, reg.resetValue, reg.desc, reg.access)
reg_table = []
for fieldIndex in reversed(list(range(len(reg.fieldNameList)))):
bits = "[" + str(reg.bitOffsetList[fieldIndex] + reg.bitWidthList[fieldIndex] - 1) + \
":" + str(reg.bitOffsetList[fieldIndex]) + "]"
_line = [bits,
reg.fieldNameList[fieldIndex]]
if reg.resetValue:
temp = (int(reg.resetValue, 0) >> reg.bitOffsetList[fieldIndex])
mask = (2 ** reg.bitWidthList[fieldIndex]) - 1
temp &= mask
temp = "{value:#0{width}x}".format(value=temp,
width=math.ceil(reg.bitWidthList[fieldIndex] / 4) + 2)
_line.append(temp)
_line.append(reg.fieldDescList[fieldIndex])
reg_table.append(_line)
_headers = ['Bits', 'Field name']
if reg.resetValue:
_headers.append('Reset')
_headers.append('Description')
r += tabulate.tabulate(reg_table,
headers=_headers,
tablefmt="grid")
r += "\n"
r += "\n"
# enumerations
for enum in reg.enumTypeList:
if enum:
# header
r += enum.name + "\n"
r += ',' * len(enum.name) + "\n"
r += "\n"
# table
enum_table = []
for i in range(len(enum.keyList)):
_value = "{value:#0{width}x}".format(value=int(enum.valueList[i], 0),
width=math.ceil(int(enum.bitWidth, 0) / 4) + 2)
_line = [enum.keyList[i],
_value,
enum.descrList[i]]
enum_table.append(_line)
r += tabulate.tabulate(enum_table,
headers=['Name', 'Value', 'Description'],
tablefmt="grid")
r += "\n\n"
return r
def returnRstTitle(self):
r = ''
r += "====================\n"
r += "Register description\n"
r += "====================\n\n"
return r
def returnRstSubTitle(self):
r = ''
r += "Registers\n"
r += "---------\n\n"
return r
def returnRstRegDesc(self, name, address, size, resetValue, desc, access):
r = ""
r += name + "\n"
r += len(name) * '-' + "\n"
r += "\n"
r += ":Name: " + str(name) + "\n"
r += ":Address: " + hex(address) + "\n"
if resetValue:
# display the resetvalue in hex notation in the full length of the register
r += ":Reset Value: {value:#0{size:d}x}\n".format(value=int(resetValue, 0), size=size // 4 + 2)
r += ":Access: " + access + "\n"
r += ":Description: " + desc + "\n"
r += "\n"
return r
class mdAddressBlock(addressBlockClass):
"""Generates a Markdown file from a IP-XACT register description"""
def __init__(self, name, addrWidth, dataWidth):
self.name = name
self.addrWidth = addrWidth
self.dataWidth = dataWidth
self.registerList = []
self.suffix = ".md"
self.mdFile = MdUtils(file_name="none",
title="")
def returnEnumValueString(self, enumTypeObj):
if isinstance(enumTypeObj, enumTypeClass):
l = []
for i in range(len(enumTypeObj.keyList)):
l.append(enumTypeObj.keyList[i] + '=' + enumTypeObj.valueList[i])
s = ", ".join(l)
else:
s = ''
return s
def returnAsString(self):
regNameList = [reg.name for reg in self.registerList]
regAddressList = [reg.address for reg in self.registerList]
regDescrList = [reg.desc for reg in self.registerList]
self.mdFile.new_header(level=1, title="Register description")
self.mdFile.new_header(level=2, title="Registers")
# summary
header = ['Address', 'Register Name', 'Description']
rows = []
for i in range(len(regNameList)):
rows.extend(["{:#04x}".format(regAddressList[i]),
f"[{regNameList[i]}](#{regNameList[i]})",
str(regDescrList[i])])
self.mdFile.new_table(columns=len(header),
rows=len(regNameList) + 1, # header + data
text=header + rows,
text_align='left')
# all registers
for reg in self.registerList:
headers = ['Bits', 'Field name']
if reg.resetValue:
headers.append('Reset')
headers.append('Description')
self.returnMdRegDesc(reg.name, reg.address, reg.size, reg.resetValue, reg.desc, reg.access)
reg_table = []
for fieldIndex in reversed(list(range(len(reg.fieldNameList)))):
bits = "[" + str(reg.bitOffsetList[fieldIndex] + reg.bitWidthList[fieldIndex] - 1) + \
":" + str(reg.bitOffsetList[fieldIndex]) + "]"
reg_table.append(bits)
reg_table.append(reg.fieldNameList[fieldIndex])
if reg.resetValue:
temp = (int(reg.resetValue, 0) >> reg.bitOffsetList[fieldIndex])
mask = (2 ** reg.bitWidthList[fieldIndex]) - 1
temp &= mask
temp = "{value:#0{width}x}".format(value=temp,
width=math.ceil(reg.bitWidthList[fieldIndex] / 4) + 2)
reg_table.append(temp)
reg_table.append(reg.fieldDescList[fieldIndex])
self.mdFile.new_table(columns=len(headers),
rows=len(reg.fieldNameList) + 1,
text=headers + reg_table,
text_align='left')
# enumerations
for enum in reg.enumTypeList:
if enum:
self.mdFile.new_header(level=4,
title=enum.name)
enum_table = []
for i in range(len(enum.keyList)):
_value = "{value:#0{width}x}".format(value=int(enum.valueList[i], 0),
width=math.ceil(int(enum.bitWidth, 0) / 4) + 2)
enum_table.append(enum.keyList[i])
enum_table.append(_value)
enum_table.append(enum.descrList[i])
headers = ['Name', 'Value', 'Description']
self.mdFile.new_table(columns=len(headers),
rows=len(enum.keyList) + 1,
text=headers + enum_table,
text_align='left')
return self.mdFile.file_data_text
def returnMdRegDesc(self, name, address, size, resetValue, desc, access):
self.mdFile.new_header(level=3, title=name)
self.mdFile.new_line("**Name** " + str(name))
self.mdFile.new_line("**Address** " + hex(address))
if resetValue:
# display the resetvalue in hex notation in the full length of the register
self.mdFile.new_line(
"**Reset Value** {value:#0{size:d}x}".format(value=int(resetValue, 0), size=size // 4 + 2))
self.mdFile.new_line("**Access** " + access)
self.mdFile.new_line("**Description** " + desc)
class vhdlAddressBlock(addressBlockClass):
"""Generates a vhdl file from a IP-XACT register description"""
def __init__(self, name, addrWidth, dataWidth):
self.name = name
self.addrWidth = addrWidth
self.dataWidth = dataWidth
self.registerList = []
self.suffix = "_vhd_pkg.vhd"
def returnAsString(self):
r = ''
r += self.returnPkgHeaderString()
r += "\n\n"
r += self.returnPkgBodyString()
return r
def returnPkgHeaderString(self):
r = ''
r += "--\n"
r += "-- Automatically generated\n"
r += "-- with the command '%s'\n" % (' '.join(sys.argv))
r += "--\n"
r += "-- Do not manually edit!\n"
r += "--\n"
r += "-- VHDL 93\n"
r += "--\n"
r += "\n"
r += "library ieee;\n"
r += "use ieee.std_logic_1164.all;\n"
r += "use ieee.numeric_std.all;\n"
r += "\n"
r += "package " + self.name + "_vhd_pkg is\n"
r += "\n"
r += " constant addr_width : natural := " + str(self.addrWidth) + ";\n"
r += " constant data_width : natural := " + str(self.dataWidth) + ";\n"
r += "\n\n"
r += self.returnRegFieldEnumTypeStrings(True)
for reg in self.registerList:
r += " constant {name}_addr : natural := {address} ; -- {address:#0{width}x}\n".format(name=reg.name,
address=reg.address,
width=math.ceil(
self.addrWidth / 4) + 2) # +2 for the '0x'
r += "\n"
for reg in self.registerList:
if reg.resetValue:
r += " constant {name}_reset_value : std_ulogic_vector(data_width-1 downto 0) := std_ulogic_vector(to_unsigned({value:d}, data_width)); -- {value:#0{width}x}\n".format(
name=reg.name,
value=int(reg.resetValue, 0),
width=math.ceil((self.dataWidth / 4)) + 2)
r += "\n\n"
for reg in self.registerList:
r += self.returnRegRecordTypeString(reg)
r += self.returnRegistersInRecordTypeString()
r += self.returnRegistersOutRecordTypeString()
r += self.returnRegistersReadFunction()
r += self.returnRegistersWriteFunction()
r += self.returnRegistersResetFunction()
r += "end;\n"
return r
def returnRegFieldEnumTypeStrings(self, prototype):
r = ''
for reg in self.registerList:
for enum in reg.enumTypeList:
if isinstance(enum, enumTypeClass) and not enum.allReadyExist:
r += " -- {}\n".format(enum.name) # group the enums in the package
if prototype:
t = " type " + enum.name + "_enum is ("
indent = t.find('(') + 1
r += t
for ki in range(len(enum.keyList)):
if ki != 0: # no indentation for the first element
r += " " * indent
r += enum.keyList[ki]
if ki != len(enum.keyList) - 1: # no ',' for the last element
r += ","
else: # last element
r += ");"
if enum.descrList[ki]:
r += " -- " + enum.descrList[ki]
if ki != len(enum.keyList) - 1: # no new line for the last element
r += "\n"
r += "\n"
r += " function " + enum.name + \
"_enum_to_sulv(v: " + enum.name + "_enum ) return std_ulogic_vector"
if prototype:
r += ";\n"
else:
r += " is\n"
r += " variable r : std_ulogic_vector(" + str(enum.bitWidth) + "-1 downto 0);\n"
r += " begin\n"
r += " case v is\n"
for i in range(len(enum.keyList)):
r += ' when {key} => r:="{value_int:0{bitwidth}b}"; -- {value}\n'.format(
key=enum.keyList[i],
value=enum.valueList[i],
value_int=int(enum.valueList[i]),
bitwidth=int(enum.bitWidth))
r += " end case;\n"
r += " return r;\n"
r += " end function;\n\n"
r += " function sulv_to_" + enum.name + \
"_enum(v: std_ulogic_vector(" + str(enum.bitWidth) + "-1 downto 0)) return " + \
enum.name + "_enum"
if prototype:
r += ";\n"
else:
r += " is\n"
r += " variable r : " + enum.name + "_enum;\n"
r += " begin\n"
r += " case v is\n"
for i in range(len(enum.keyList)):
r += ' when "{value_int:0{bitwidth}b}" => r:={key};\n'.format(key=enum.keyList[i],
value_int=int(
enum.valueList[
i]),
bitwidth=int(
enum.bitWidth))
r += ' when others => r:=' + enum.keyList[0] + '; -- error\n'
r += " end case;\n"
r += " return r;\n"
r += " end function;\n\n"
if prototype:
r += "\n"
if prototype:
r += "\n"
return r
def returnRegRecordTypeString(self, reg):
r = ''
r += " type " + reg.name + "_record_type is record\n"
for i in reversed(list(range(len(reg.fieldNameList)))):
bits = "[" + str(reg.bitOffsetList[i] + reg.bitWidthList[i] - 1) + ":" + str(reg.bitOffsetList[i]) + "]"
bit = "[" + str(reg.bitOffsetList[i]) + "]"
if isinstance(reg.enumTypeList[i], enumTypeClass):
if not reg.enumTypeList[i].allReadyExist:
r += " " + reg.fieldNameList[i] + " : " + \
reg.enumTypeList[i].name + "_enum; -- " + bits + "\n"
else:
r += " " + reg.fieldNameList[i] + " : " + \
reg.enumTypeList[i].enumName + "_enum; -- " + bits + "\n"
else:
if reg.bitWidthList[i] == 1: # single bit
r += " " + reg.fieldNameList[i] + " : std_ulogic; -- " + bit + "\n"
else: # vector
r += " " + reg.fieldNameList[i] + " : std_ulogic_vector(" + str(reg.bitWidthList[i] - 1) + \
" downto 0); -- " + bits + "\n"
r += " end record;\n\n"
return r
def returnRegistersInRecordTypeString(self):
r = ""
r += " type " + self.name + "_in_record_type is record\n"
for reg in self.registerList:
if reg.access == "read-only":
r += " {name} : {name}_record_type; -- addr {addr:#0{width}x}\n".format(name=reg.name,
addr=reg.address,
width=math.ceil(
self.addrWidth / 4) + 2) # +2 for the '0x'
r += " end record;\n\n"
return r
def returnRegistersOutRecordTypeString(self):
r = ""
r += " type " + self.name + "_out_record_type is record\n"
for reg in self.registerList:
if reg.access != "read-only":
r += " {name} : {name}_record_type; -- addr {addr:#0{width}x}\n".format(name=reg.name,
addr=reg.address,
width=math.ceil(
self.addrWidth / 4) + 2) # +2 for the '0x'
r += " end record;\n\n"
return r
def returnRegistersReadFunction(self):
r = " function read_" + self.name + "(registers_i : " + self.name + "_in_record_type;\n"
indent = r.find('(') + 1
r += " " * indent + "registers_o : " + self.name + "_out_record_type;\n"
r += " " * indent + "address : std_ulogic_vector(addr_width-1 downto 0)\n"
r += " " * indent + ") return std_ulogic_vector;\n\n"
return r
def returnRegistersWriteFunction(self):
r = " function write_" + self.name + "(value : std_ulogic_vector(data_width-1 downto 0);\n"
indent = r.find('(') + 1
r += " " * indent + "address : std_ulogic_vector(addr_width-1 downto 0);\n"
r += " " * indent + "registers_o : " + self.name + "_out_record_type\n"
r += " " * indent + ") return " + self.name + "_out_record_type;\n\n"
return r
def returnRegistersResetFunction(self):
r = " function reset_" + self.name + " return " + self.name + "_out_record_type;\n"
r += " function reset_" + self.name + "(address: std_ulogic_vector(addr_width-1 downto 0);\n"
indent = r.splitlines()[-1].find('(') + 1
r += " " * indent + "registers_o : " + self.name + "_out_record_type\n"
r += " " * indent + ") return " + self.name + "_out_record_type;\n\n"
return r
def returnRecToSulvFunctionString(self, reg):
r = ""
r += " function " + reg.name + \
"_record_type_to_sulv(v : " + reg.name + "_record_type) return std_ulogic_vector is\n"
r += " variable r : std_ulogic_vector(data_width-1 downto 0);\n"
r += " begin\n"
r += " r := (others => '0');\n"
for i in reversed(list(range(len(reg.fieldNameList)))):
bits = str(reg.bitOffsetList[i] + reg.bitWidthList[i] - 1) + " downto " + str(reg.bitOffsetList[i])
bit = str(reg.bitOffsetList[i])
if isinstance(reg.enumTypeList[i], enumTypeClass):
if not reg.enumTypeList[i].allReadyExist:
r += " r(" + bits + ") := " + \
reg.enumTypeList[i].name + "_enum_to_sulv(v." + reg.fieldNameList[i] + ");\n"
else:
r += " r(" + bits + ") := " + \
reg.enumTypeList[i].enumName + "_enum_to_sulv(v." + reg.fieldNameList[i] + ");\n"
else:
if reg.bitWidthList[i] == 1: # single bit
r += " r(" + bit + ") := v." + reg.fieldNameList[i] + ";\n"
else: # vector
r += " r(" + bits + ") := v." + reg.fieldNameList[i] + ";\n"
r += " return r;\n"
r += " end function;\n\n"
return r
def returnSulvToRecFunctionString(self, reg):
r = ""
r += " function sulv_to_" + reg.name + \
"_record_type(v : std_ulogic_vector) return " + reg.name + "_record_type is\n"
r += " variable r : " + reg.name + "_record_type;\n"
r += " begin\n"
for i in reversed(list(range(len(reg.fieldNameList)))):
bits = str(reg.bitOffsetList[i] + reg.bitWidthList[i] - 1) + " downto " + str(reg.bitOffsetList[i])
bit = str(reg.bitOffsetList[i])
if isinstance(reg.enumTypeList[i], enumTypeClass):
if not reg.enumTypeList[i].allReadyExist:
r += " r." + reg.fieldNameList[i] + " := sulv_to_" + \
reg.enumTypeList[i].name + "_enum(v(" + bits + "));\n"
else:
r += " r." + reg.fieldNameList[i] + " := sulv_to_" + \
reg.enumTypeList[i].enumName + "_enum(v(" + bits + "));\n"
else:
if reg.bitWidthList[i] == 1: # single bit
r += " r." + reg.fieldNameList[i] + " := v(" + bit + ");\n"
else:
r += " r." + reg.fieldNameList[i] + " := v(" + bits + ");\n"
r += " return r;\n"
r += " end function;\n\n"
return r
def returnReadFunctionString(self):
r = ""
t = " function read_" + self.name + "(registers_i : " + self.name + "_in_record_type;\n"
indent = t.find('(') + 1
r += t
r += " " * indent + "registers_o : " + self.name + "_out_record_type;\n"
r += " " * indent + "address : std_ulogic_vector(addr_width-1 downto 0)\n"
r += " " * indent + ") return std_ulogic_vector is\n"
r += " variable r : std_ulogic_vector(data_width-1 downto 0);\n"
r += " begin\n"
r += " case to_integer(unsigned(address)) is\n"
for reg in self.registerList:
if reg.access == "read-only":
r += " when " + reg.name + "_addr => r:= " + reg.name + \
"_record_type_to_sulv(registers_i." + reg.name + ");\n"
else:
r += " when " + reg.name + "_addr => r:= " + reg.name + \
"_record_type_to_sulv(registers_o." + reg.name + ");\n"
r += " when others => r := (others => '0');\n"
r += " end case;\n"
r += " return r;\n"
r += " end function;\n\n"
return r
def returnWriteFunctionString(self):
r = ""
t = " function write_" + self.name + "(value : std_ulogic_vector(data_width-1 downto 0);\n"
r += t
indent = t.find('(') + 1
r += " " * indent + "address : std_ulogic_vector(addr_width-1 downto 0);\n"
r += " " * indent + "registers_o : " + self.name + "_out_record_type\n"
r += " " * indent + ") return " + self.name + "_out_record_type is\n"
r += " variable r : " + self.name + "_out_record_type;\n"
r += " begin\n"
r += " r := registers_o;\n"
r += " case to_integer(unsigned(address)) is\n"
for reg in self.registerList:
if reg.access != "read-only":
r += " when " + reg.name + "_addr => r." + reg.name + \
" := sulv_to_" + reg.name + "_record_type(value);\n"
r += " when others => null;\n"
r += " end case;\n"
r += " return r;\n"
r += " end function;\n\n"
return r
def returnResetFunctionString(self):
r = ""
r += " function reset_" + self.name + " return " + self.name + "_out_record_type is\n"
r += " variable r : " + self.name + "_out_record_type;\n"
r += " begin\n"
for reg in self.registerList:
if reg.resetValue:
if reg.access != "read-only":
r += " r." + reg.name + " := sulv_to_" + \
reg.name + "_record_type(" + reg.name + "_reset_value);\n"
r += " return r;\n"
r += " end function;\n"
r += "\n"
r += " function reset_" + self.name + "(address: std_ulogic_vector(addr_width-1 downto 0);\n"
indent = r.splitlines()[-1].find('(') + 1
r += " " * indent + "registers_o : " + self.name + "_out_record_type\n"
r += " " * indent + ") return " + self.name + "_out_record_type is\n"
r += " variable r : " + self.name + "_out_record_type;\n"
r += " begin\n"
r += " r := registers_o;\n"
r += " case to_integer(unsigned(address)) is\n"
for reg in self.registerList:
if reg.resetValue:
if reg.access != "read-only":
r += " when " + reg.name + "_addr => r." + reg.name + \
" := sulv_to_" + reg.name + "_record_type(" + reg.name + "_reset_value);\n"
r += " when others => null;\n"
r += " end case;\n"
r += " return r;\n"
r += " end function;\n\n"
return r
def returnPkgBodyString(self):
r = ""
r += "package body " + self.name + "_vhd_pkg is\n\n"
r += self.returnRegFieldEnumTypeStrings(False)
for reg in self.registerList:
r += self.returnRecToSulvFunctionString(reg)
r += self.returnSulvToRecFunctionString(reg)
r += self.returnReadFunctionString()
r += self.returnWriteFunctionString()
r += self.returnResetFunctionString()
r += "end package body;\n"
return r
class systemVerilogAddressBlock(addressBlockClass):
def __init__(self, name, addrWidth, dataWidth):
self.name = name
self.addrWidth = addrWidth
self.dataWidth = dataWidth
self.registerList = []
self.suffix = "_sv_pkg.sv"
def returnIncludeString(self):
r = "\n"
r += "`define " + self.name + "_addr_width " + str(self.addrWidth) + "\n"
r += "`define " + self.name + "_data_width " + str(self.dataWidth) + "\n"
return r
def returnSizeString(self):
r = "\n"
r += "const int addr_width = " + str(self.addrWidth) + ";\n"
r += "const int data_width = " + str(self.dataWidth) + ";\n"
return r
def returnAddressesString(self):
r = "\n"
for reg in self.registerList:
r += "const int " + reg.name + "_addr = " + str(reg.address) + ";\n"
r += "\n"
return r
def returnAddressListString(self):
r = "\n"
r = "//synopsys translate_off\n"
r += "const int " + self.name + "_regAddresses [" + str(len(self.registerList)) + "] = '{"
l = []
for reg in self.registerList:
l.append("\n " + reg.name + "_addr")
r += ",".join(l)
r += "};\n"
r += "\n"
r += "const string " + self.name + "_regNames [" + str(len(self.registerList)) + "] = '{"
l = []
for reg in self.registerList:
l.append('\n "' + reg.name + '"')
r += ",".join(l)
r += "};\n"
r += "const reg " + self.name + "_regUnResetedAddresses [" + str(len(self.registerList)) + "] = '{"
l = []
for reg in self.registerList:
if reg.resetValue:
l.append("\n 1'b0")
else:
l.append("\n 1'b1")
r += ",".join(l)
r += "};\n"
r += "\n"
r += "//synopsys translate_on\n\n"
return r
def enumeratedType(self, prepend, fieldName, valueNames, values):
r = "\n"
members = []
# dont want to create to simple names in the global names space.
# should preppend with name from ipxact file
for index in range(len(valueNames)):
name = valueNames[index]
value = values[index]
members.append(name + "=" + value)
r += "typedef enum { " + ",".join(members) + "} enum_" + fieldName + ";\n"
return r
def returnResetValuesString(self):
r = ""
for reg in self.registerList:
if reg.resetValue:
r += "const " + reg.name + "_struct_type " + reg.name + \
"_reset_value = " + str(int(reg.resetValue, 0)) + ";\n"
r += "\n"
return r
def returnStructString(self):
r = "\n"
for reg in self.registerList:
r += "\ntypedef struct packed {\n"
for i in reversed(list(range(len(reg.fieldNameList)))):
bits = "bits [" + str(reg.bitOffsetList[i] + reg.bitWidthList[i] - 1) + \
":" + str(reg.bitOffsetList[i]) + "]"
r += " bit [" + str(reg.bitWidthList[i] - 1) + ":0] " + \
str(reg.fieldNameList[i]) + ";//" + bits + "\n"
r += "} " + reg.name + "_struct_type;\n\n"
return r
def returnRegistersStructString(self):
r = "typedef struct packed {\n"
for reg in self.registerList:
r += " " + reg.name + "_struct_type " + reg.name + ";\n"
r += "} " + self.name + "_struct_type;\n\n"
return r
def returnReadFunctionString(self):
r = "function bit [31:0] read_" + self.name + "(" + self.name + "_struct_type registers,int address);\n"
r += " bit [31:0] r;\n"
r += " case(address)\n"
for reg in self.registerList:
r += " " + reg.name + "_addr: r[$bits(registers." + reg.name + ")-1:0] = registers." + reg.name + ";\n"
r += " default: r =0;\n"
r += " endcase\n"
r += " return r;\n"
r += "endfunction\n\n"
return r
def returnWriteFunctionString(self):
t = "function " + self.name + "_struct_type write_" + self.name + "(bit [31:0] data, int address,\n"
r = t
indent = r.find('(') + 1
r += " " * indent + self.name + "_struct_type registers);\n"
r += " " + self.name + "_struct_type r;\n"
r += " r = registers;\n"
r += " case(address)\n"
for reg in self.registerList:
r += " " + reg.name + "_addr: r." + reg.name + " = data[$bits(registers." + reg.name + ")-1:0];\n"
r += " endcase // case address\n"
r += " return r;\n"
r += "endfunction\n\n"
return r
def returnResetFunctionString(self):
r = "function " + self.name + "_struct_type reset_" + self.name + "();\n"
r += " " + self.name + "_struct_type r;\n"
for reg in self.registerList:
if reg.resetValue:
r += " r." + reg.name + "=" + reg.name + "_reset_value;\n"
r += " return r;\n"
r += "endfunction\n"
r += "\n"
return r
def returnAsString(self):
r = ''
r += "// Automatically generated\n"
r += "// with the command '%s'\n" % (' '.join(sys.argv))
r += "//\n"
r += "// Do not manually edit!\n"
r += "//\n"
r += "package " + self.name + "_sv_pkg;\n\n"
r += self.returnSizeString()
r += self.returnAddressesString()
r += self.returnAddressListString()
r += self.returnStructString()
r += self.returnResetValuesString()
r += self.returnRegistersStructString()
r += self.returnReadFunctionString()
r += self.returnWriteFunctionString()
r += self.returnResetFunctionString()
r += "endpackage //" + self.name + "_sv_pkg\n"
return r
class ipxactParser():
def __init__(self, srcFile, config):
self.srcFile = srcFile
self.config = config
self.enumTypeClassRegistry = enumTypeClassRegistry()
def returnDocument(self):
spirit_ns = 'http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5'
tree = ETree.parse(self.srcFile)
ETree.register_namespace('spirit', spirit_ns)
namespace = tree.getroot().tag[1:].split("}")[0]
spiritString = '{' + spirit_ns + '}'
docName = tree.find(spiritString + "name").text
d = documentClass(docName)
memoryMaps = tree.find(spiritString + "memoryMaps")
memoryMapList = memoryMaps.findall(spiritString + "memoryMap") if memoryMaps is not None else []
for memoryMap in memoryMapList:
memoryMapName = memoryMap.find(spiritString + "name").text
addressBlockList = memoryMap.findall(spiritString + "addressBlock")
m = memoryMapClass(memoryMapName)
for addressBlock in addressBlockList:
addressBlockName = addressBlock.find(spiritString + "name").text
registerList = addressBlock.findall(spiritString + "register")
baseAddress = int(addressBlock.find(spiritString + "baseAddress").text, 0)
nbrOfAddresses = int(addressBlock.find(spiritString + "range").text, 0) # TODO, this is wrong
addrWidth = int(math.ceil((math.log(baseAddress + nbrOfAddresses, 2))))
dataWidth = int(addressBlock.find(spiritString + "width").text, 0)
a = addressBlockClass(addressBlockName, addrWidth, dataWidth)
for registerElem in registerList:
regName = registerElem.find(spiritString + "name").text
reset = registerElem.find(spiritString + "reset")
if reset is not None:
resetValue = reset.find(spiritString + "value").text
else:
resetValue = None
size = int(registerElem.find(spiritString + "size").text, 0)
access = registerElem.find(spiritString + "access").text
if registerElem.find(spiritString + "description") != None:
desc = registerElem.find(spiritString + "description").text
else:
desc = ""
regAddress = baseAddress + int(registerElem.find(spiritString + "addressOffset").text, 0)
r = self.returnRegister(spiritString, registerElem, regAddress,
resetValue, size, access, desc, dataWidth)
a.addRegister(r)
m.addAddressBlock(a)
d.addMemoryMap(m)
return d
def returnRegister(self, spiritString, registerElem, regAddress, resetValue, size, access, regDesc, dataWidth):
regName = registerElem.find(spiritString + "name").text
fieldList = registerElem.findall(spiritString + "field")
fieldNameList = [item.find(spiritString + "name").text for item in fieldList]
bitOffsetList = [item.find(spiritString + "bitOffset").text for item in fieldList]
bitWidthList = [item.find(spiritString + "bitWidth").text for item in fieldList]
fieldDescList = [item.find(spiritString + "description").text for item in fieldList]
enumTypeList = []
for index in range(len(fieldList)):
fieldElem = fieldList[index]
bitWidth = bitWidthList[index]
fieldName = fieldNameList[index]
enumeratedValuesElem = fieldElem.find(spiritString + "enumeratedValues")
if enumeratedValuesElem is not None:
enumeratedValueList = enumeratedValuesElem.findall(spiritString + "enumeratedValue")
valuesNameList = [item.find(spiritString + "name").text for item in enumeratedValueList]
descrList = [item.find(spiritString + "description").text if item.find(
spiritString + "description") is not None else "" for item in enumeratedValueList]
valuesList = [item.find(spiritString + "value").text for item in enumeratedValueList]
if len(valuesNameList) > 0:
if int(bitWidth) > 1: # if the field of a enum is longer than 1 bit, always use enums
enum = enumTypeClass(fieldName, bitWidth, valuesNameList, valuesList, descrList)
enum = self.enumTypeClassRegistry.enumAllReadyExist(enum)
enumTypeList.append(enum)
else: # bit field of 1 bit
if self.config['global'].getboolean('onebitenum'): # do create one bit enums
enum = enumTypeClass(fieldName, bitWidth, valuesNameList, valuesList, descrList)
enum = self.enumTypeClassRegistry.enumAllReadyExist(enum)
enumTypeList.append(enum)
else: # dont create enums of booleans because this only decreases readability
enumTypeList.append(None)
else:
enumTypeList.append(None)
else:
enumTypeList.append(None)
if len(fieldNameList) == 0:
fieldNameList.append(regName)
bitOffsetList.append(0)
bitWidthList.append(dataWidth)
fieldDescList.append('')
enumTypeList.append(None)
(regName, fieldNameList, bitOffsetList, bitWidthList, fieldDescList, enumTypeList) = sortRegisterAndFillHoles(
regName, fieldNameList, bitOffsetList, bitWidthList, fieldDescList, enumTypeList,
self.config['global'].getboolean('unusedholes'))
reg = registerClass(regName, regAddress, resetValue, size, access, regDesc, fieldNameList,
bitOffsetList, bitWidthList, fieldDescList, enumTypeList)
return reg
class ipxact2otherGenerator():
def __init__(self, destDir, namingScheme="addressBlockName"):
self.destDir = destDir
self.namingScheme = namingScheme
def write(self, fileName, string):
_dest = os.path.join(self.destDir, fileName)
print("writing file " + _dest)
if not os.path.exists(os.path.dirname(_dest)):
os.makedirs(os.path.dirname(_dest))
with open(_dest, "w") as f:
f.write(string)
def generate(self, generatorClass, document):
self.document = document
docName = document.name
for memoryMap in document.memoryMapList:
mapName = memoryMap.name
for addressBlock in memoryMap.addressBlockList:
blockName = addressBlock.name
block = generatorClass(addressBlock.name,
addressBlock.addrWidth,
addressBlock.dataWidth)
block.setRegisterList(addressBlock.registerList)
s = block.returnAsString()
if self.namingScheme == "addressBlockName":
fileName = blockName + block.suffix
else:
fileName = docName + '_' + mapName + '_' + blockName + block.suffix
self.write(fileName, s)
if generatorClass == systemVerilogAddressBlock:
includeFileName = fileName + "h"
includeString = block.returnIncludeString()
self.write(includeFileName, includeString)
| vermaete/ipxact2systemverilog | ipxact2systemverilog/ipxact2hdlCommon.py | Python | gpl-2.0 | 46,497 |
<?php
/*
+---------------------------------------------------------------------------+
| OpenX v2.8 |
| ========== |
| |
| Copyright (c) 2003-2009 OpenX Limited |
| For contact details, see: http://www.openx.org/ |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: PasswordRecovery.php 82775 2013-08-06 23:40:26Z chris.nutting $
*/
/**
* Password recovery DAL for Openads
*
* @package OpenXDal
*/
require_once MAX_PATH.'/lib/OA/Dal.php';
require_once MAX_PATH.'/lib/max/Plugin.php';
class OA_Dal_PasswordRecovery extends OA_Dal
{
/**
* Search users with a matching email address
*
* @param string e-mail
* @return array matching users
*/
function searchMatchingUsers($email)
{
$doUsers = OA_Dal::factoryDO('users');
$doUsers->email_address = $email;
$doUsers->find();
$users = array();
while ($doUsers->fetch()) {
$users[] = $doUsers->toArray();
}
return $users;
}
/**
* Generate and save a recovery ID for a user
*
* @param int user ID
* @return array generated recovery ID
*/
function generateRecoveryId($userId)
{
$doPwdRecovery = OA_Dal::factoryDO('password_recovery');
// Make sure that recoveryId is unique in password_recovery table
do {
$recoveryId = strtoupper(md5(uniqid('', true)));
$recoveryId = substr(chunk_split($recoveryId, 8, '-'), -23, 22);
$doPwdRecovery->recovery_id = $recoveryId;
} while ($doPwdRecovery->find()>0);
$doPwdRecovery = OA_Dal::factoryDO('password_recovery');
$doPwdRecovery->whereAdd('user_id = '.DBC::makeLiteral($userId));
$doPwdRecovery->delete(true);
$doPwdRecovery = OA_Dal::factoryDO('password_recovery');
$doPwdRecovery->user_type = 'user';
$doPwdRecovery->user_id = $userId;
$doPwdRecovery->recovery_id = $recoveryId;
$doPwdRecovery->updated = OA::getNowUTC();
$doPwdRecovery->insert();
return $recoveryId;
}
/**
* Check if recovery ID is valid
*
* @param string recovery ID
* @return bool true if recovery ID is valid
*/
function checkRecoveryId($recoveryId)
{
$doPwdRecovery = OA_Dal::factoryDO('password_recovery');
$doPwdRecovery->recovery_id = $recoveryId;
return (bool)$doPwdRecovery->count();
}
/**
* Save the new password in the user properties
*
* @param string recovery ID
* @param string new password
* @return bool Ttrue the new password was correctly saved
*/
function saveNewPasswordAndLogin($recoveryId, $password)
{
$doPwdRecovery = OA_Dal::factoryDO('password_recovery');
$doPwdRecovery->recovery_id = $recoveryId;
$doPwdRecoveryClone = clone($doPwdRecovery);
$doPwdRecovery->find();
if ($doPwdRecovery->fetch()) {
$userId = $doPwdRecovery->user_id;
$doPlugin = &OA_Auth::staticGetAuthPlugin();
$doPlugin->setNewPassword($userId, $password);
$doPwdRecoveryClone->delete();
phpAds_SessionStart();
$doUser = OA_Dal::staticGetDO('users', $userId);
phpAds_SessionDataRegister(OA_Auth::getSessionData($doUser));
phpAds_SessionDataStore();
return true;
}
return false;
}
}
?>
| maestrano/openx | lib/OA/Dal/PasswordRecovery.php | PHP | gpl-2.0 | 4,846 |
/*
* Copyright (C) 2008 Peter Grasch <peter.grasch@bedahr.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SIMON_SIMONDNETWORKCONFIGURATION_H_932B7362E7CC428398A5F279795080B6
#define SIMON_SIMONDNETWORKCONFIGURATION_H_932B7362E7CC428398A5F279795080B6
#include <KCModule>
#include <QVariantList>
#include "ui_simondnetworkconfiguration.h"
class SimondNetworkConfiguration : public KCModule
{
Q_OBJECT
private:
Ui::NetworkConfiguration ui;
private slots:
void slotChanged();
public:
explicit SimondNetworkConfiguration(QWidget* parent, const QVariantList& args=QVariantList());
void save();
void load();
~SimondNetworkConfiguration();
};
#endif
| photom/simon | simond/src/config/simondnetworkconfiguration.h | C | gpl-2.0 | 1,377 |
/*
* $Id$
*
* Copyright 2006 University of Dundee. All rights reserved.
* Use is subject to license terms supplied in LICENSE.txt
*/
package ome.server.itests.hibernate;
import java.util.Arrays;
import java.util.Set;
import ome.model.IAnnotated;
import ome.model.ILink;
import ome.model.IObject;
import ome.model.annotations.Annotation;
import ome.model.annotations.BasicAnnotation;
import ome.model.annotations.LongAnnotation;
import ome.model.containers.Dataset;
import ome.model.containers.DatasetImageLink;
import ome.model.containers.Project;
import ome.model.containers.ProjectDatasetLink;
import ome.model.core.Image;
import ome.model.core.Pixels;
import ome.model.display.RenderingDef;
import ome.model.meta.Experimenter;
import ome.server.itests.AbstractManagedContextTest;
import ome.testing.ObjectFactory;
import ome.tools.hibernate.ExtendedMetadata;
import org.hibernate.SessionFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class ExtendedMetadataTest extends AbstractManagedContextTest {
ExtendedMetadata.Impl metadata;
@BeforeClass
public void init() throws Exception {
setUp();
metadata = new ExtendedMetadata.Impl();
metadata.setSessionFactory((SessionFactory)applicationContext.getBean("sessionFactory"));
tearDown();
}
@Test
public void testAnnotatedAreFound() throws Exception {
Set<Class<IAnnotated>> anns = metadata.getAnnotatableTypes();
assertTrue(anns.contains(Image.class));
assertTrue(anns.contains(Project.class));
// And several others
}
@Test
public void testAnnotationsAreFound() throws Exception {
Set<Class<Annotation>> anns = metadata.getAnnotationTypes();
assertTrue(anns.toString(), anns.contains(Annotation.class));
assertTrue(anns.toString(), anns.contains(BasicAnnotation.class));
assertTrue(anns.toString(), anns.contains(LongAnnotation.class));
// And several others
}
/**
* Where a superclass has a relationship to a class (Annotation to some link type),
* it is also necessary to be able to find the same relationship from a subclass
* (e.g. FileAnnotation).
*/
@Test
public void testLinkFromSubclassToSuperClassRel() {
assertNotNull(
metadata.getRelationship("ImageAnnotationLink", "FileAnnotation"));
}
/**
* For simplicity, the relationship map currently holds only the short
* class names. Here we are adding a test which checks for the full ones
* under "broken" to remember to re-evaluate.
*/
@Test(groups = {"broken","fixme"})
public void testAnnotatedAreFoundByFQN() throws Exception {
Set<Class<IAnnotated>> anns = metadata.getAnnotatableTypes();
assertTrue(anns.contains(Image.class));
assertTrue(anns.contains(Project.class));
// And several others
}
// ~ Locking
// =========================================================================
@Test
public void testProjectLocksDataset() throws Exception {
Project p = new Project();
Dataset d = new Dataset();
p.linkDataset(d);
ILink l = (ILink) p.collectDatasetLinks(null).iterator().next();
assertDoesntContain(metadata.getLockCandidates(p), d);
assertContains(metadata.getLockCandidates(l), d);
}
@Test
// Because Pixels does not have a reference to RenderingDef
public void testRenderingDefLocksPixels() throws Exception {
Pixels p = ObjectFactory.createPixelGraph(null);
RenderingDef r = ObjectFactory.createRenderingDef();
r.setPixels(p);
assertContains(metadata.getLockCandidates(r), p);
}
@Test(groups = "ticket:357")
// quirky because of defaultTag
// see https://trac.openmicroscopy.org/ome/ticket/357
public void testPixelsLocksImage() throws Exception {
Pixels p = ObjectFactory.createPixelGraph(null);
Image i = new Image();
i.setName("locking");
i.addPixels(p);
assertContains(metadata.getLockCandidates(p), i);
}
@Test
// omit locks for system types (TODO they shouldn't have permissions anyway)
public void testExperimenterDoesntGetLocked() throws Exception {
Experimenter e = new Experimenter();
Project p = new Project();
p.getDetails().setOwner(e);
assertDoesntContain(metadata.getLockCandidates(p), e);
}
@Test
public void testNoNulls() throws Exception {
Project p = new Project();
ProjectDatasetLink pdl = new ProjectDatasetLink();
pdl.link(p, null);
assertDoesntContain(metadata.getLockCandidates(pdl), null);
}
// ~ Unlocking
// =========================================================================
@Test
public void testProjectCanBeUnlockedFromDataset() throws Exception {
assertContains(metadata.getLockChecks(Project.class),
ProjectDatasetLink.class.getName(), "parent");
}
@Test
// Because Pixels does not have a reference to RenderingDef
public void testPixelsCanBeUnlockedFromRenderingDef() throws Exception {
assertContains(metadata.getLockChecks(Pixels.class), RenderingDef.class
.getName(), "pixels");
}
@Test(groups = "ticket:357")
// quirky because of defaultTag
// see https://trac.openmicroscopy.org/ome/ticket/357
public void testImageCanBeUnlockedFromPixels() throws Exception {
assertContains(metadata.getLockChecks(Image.class), Pixels.class
.getName(), "image");
}
// ~ Updating
// =========================================================================
@Test(groups = { "ticket:346", "broken" })
public void testCreateEventImmutable() throws Exception {
assertContains(metadata.getImmutableFields(Image.class),
"details.creationEvent");
}
// ~ Counting
// =========================================================================
@Test(groups = { "ticket:657" })
public void testCountQueriesAreCorrect() throws Exception {
assertEquals(metadata.getCountQuery(DatasetImageLink.CHILD), metadata
.getCountQuery(DatasetImageLink.CHILD),
"select target.child.id, count(target) "
+ "from ome.model.containers.DatasetImageLink target "
+ "group by target.child.id");
assertEquals(metadata.getCountQuery(Pixels.IMAGE), metadata
.getCountQuery(Pixels.IMAGE),
"select target.image.id, count(target) "
+ "from ome.model.core.Pixels target "
+ "group by target.image.id");
}
@Test(groups = { "ticket:657" })
public void testTargetTypes() throws Exception {
assertEquals(metadata.getTargetType(Pixels.IMAGE), Image.class);
assertEquals(metadata.getTargetType(DatasetImageLink.CHILD),
Image.class);
}
// ~ Relationships
// =========================================================================
@Test(groups = "ticket:2665")
public void testRelationships() {
String rel;
rel = metadata.getRelationship(Pixels.class.getSimpleName(), Image.class.getSimpleName());
assertEquals("image", rel);
rel = metadata.getRelationship(Image.class.getSimpleName(), Pixels.class.getSimpleName());
assertEquals("pixels", rel);
}
// ~ Helpers
// =========================================================================
private void assertContains(Object[] array, Object i) {
if (!contained(array, i)) {
fail(i + " not contained in " + Arrays.toString(array));
}
}
private void assertDoesntContain(IObject[] array, IObject i) {
if (contained(array, i)) {
fail(i + " contained in " + Arrays.toString(array));
}
}
private void assertContains(String[][] array, String t1, String t2) {
boolean contained = false;
for (int i = 0; i < array.length; i++) {
String[] test = array[i];
if (test[0].equals(t1) && test[1].equals(t2)) {
contained |= true;
}
}
assertTrue(contained);
}
private boolean contained(Object[] array, Object i) {
boolean contained = false;
for (Object object : array) {
if (i == null) {
if (object == null) {
contained = true;
}
} else {
if (i.equals(object)) {
contained = true;
}
}
}
return contained;
}
}
| knabar/openmicroscopy | components/server/test/ome/server/itests/hibernate/ExtendedMetadataTest.java | Java | gpl-2.0 | 8,808 |
class CreateTeachers < ActiveRecord::Migration
def change
create_table :teachers do |t|
t.string :name, null: false
t.integer :grade
t.integer :college_id
t.integer :user_id
t.string :address
t.string :phone
t.string :email
t.timestamps null: false
end
end
end
| vjudge1/score | db/migrate/20150908120446_create_teachers.rb | Ruby | gpl-2.0 | 322 |
<html>
<head>
<title>RunUO Documentation - Class Overview - OnItemConsumed</title>
</head>
<body bgcolor="white" style="font-family: Courier New" text="#000000" link="#000000" vlink="#000000" alink="#808080">
<h4><a href="../namespaces/Server.Items.html">Back to Server.Items</a></h4>
<h2>OnItemConsumed : MulticastDelegate, <!-- DBG-2.1 --><font color="blue">ICloneable</font>, <!-- DBG-2.1 --><font color="blue">ISerializable</font></h2>
(<font color="blue">ctor</font>) OnItemConsumed( <font color="blue">object</font> object, IntPtr method )<br>
<font color="blue">virtual</font> IAsyncResult BeginInvoke( <!-- DBG-0 --><a href="Item.html">Item</a> item, <font color="blue">int</font> amount, AsyncCallback callback, <font color="blue">object</font> object )<br>
<font color="blue">virtual</font> <font color="blue">void</font> EndInvoke( IAsyncResult result )<br>
<font color="blue">virtual</font> <font color="blue">void</font> Invoke( <!-- DBG-0 --><a href="Item.html">Item</a> item, <font color="blue">int</font> amount )<br>
</body>
</html>
| alucardxlx/caoticamente-shards | docs/types/OnItemConsumed.html | HTML | gpl-2.0 | 1,117 |
describe('PastDateValidatorWidgetFactory', function() {
var Mock = {};
var factory;
var whoAmI;
beforeEach(function() {
angular.mock.module('studio');
mockElement();
inject(function(_$injector_) {
mockWidgetScope(_$injector_);
factory = _$injector_.get('PastDateValidatorWidgetFactory');
});
widget = factory.create(Mock.scope, Mock.element);
});
describe('Start a PastDate Factory Object', function() {
it('should return a PastDate Validator Object', function() {
pending();
});
it('should start the data field as date', function() {
expect(widget.data).toBeDefined();
expect(widget.data).toEqual(false);
});
});
describe('updates on data', function() {
xit('should model data value be equal to self value', function() {
// expect(Mock.question.fillingRules.options['pastDate'].data.reference).toEqual(widget.data);
});
it('should call updateFillingRules from parente widget', function() {
spyOn(Mock.parentWidget, 'updateFillingRules');
widget.updateData();
expect(Mock.parentWidget.updateFillingRules).toHaveBeenCalled();
});
});
function mockElement() {
Mock.element = {};
}
function mockWidgetScope($injector) {
Mock.scope = {
class: '',
$parent: {
widget: mockParentWidget($injector)
}
};
return Mock.scope;
}
function mockParentWidget($injector) {
mockQuestion($injector);
Mock.parentWidget = {
getItem: function() {
return Mock.question;
},
updateFillingRules: function() {}
};
return Mock.parentWidget;
}
function mockQuestion($injector) {
Mock.question = $injector.get('SurveyItemFactory').create('IntegerQuestion', 'Q1');
Mock.question.fillingRules.options.pastDate = $injector.get('RulesFactory').create('pastDate');
return Mock.question;
}
function mockAdd($injector) {
Mock.add = $injector.get('FillingRulesEditorWidgetFactory').create();
}
});
| ccem-dev/studio | tests/unit/editor/ui/validation/require/past-date/past-date-validator-widget-factory-spec.js | JavaScript | gpl-2.0 | 2,268 |
/*
* linux/drivers/video/omapfb/boot_progressbar.c
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/platform_device.h>
#include <plat/vrfb.h>
#include "omapfb.h"
#define TRUE 1
#define FALSE 0
static int progress_flag = FALSE;
static int progress_pos;
static struct timer_list progress_timer;
#define PROGRESS_BAR_LEFT_POS 54
#define PROGRESS_BAR_RIGHT_POS 425
#define PROGRESS_BAR_START_Y 576
#define PROGRESS_BAR_WIDTH 4
#define PROGRESS_BAR_HEIGHT 8
static unsigned char anycall_progress_bar_left[] = {
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00
};
static unsigned char anycall_progress_bar_right[] = {
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00
};
static unsigned char anycall_progress_bar_center[] = {
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00,
0xf3, 0xc5, 0x00, 0x00, 0xf3, 0xc5, 0x00, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00
};
static unsigned char anycall_progress_bar[] = {
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00,
0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00
};
static void progress_timer_handler(unsigned long data);
static int show_progress = 1;
module_param_named(progress, show_progress, bool, 0);
static void omapfb_update_framebuffer( \
struct fb_info *fb, int x, int y, void *buffer, \
int src_width, int src_height)
{
struct omapfb_info *ofbi = FB2OFB(fb);
struct omapfb2_device *fbdev = ofbi->fbdev;
struct fb_fix_screeninfo *fix = &fb->fix;
struct fb_var_screeninfo *var = &fb->var;
int row;
int bytes_per_pixel = (var->bits_per_pixel / 8);
unsigned char *pSrc = buffer;
unsigned char *pDst = fb->screen_base;
if (x+src_width > var->xres || y+src_height > var->yres) {
dev_err(fbdev->dev, "invalid destination coordinate or" \
" source size (%d, %d) (%d %d)\n", \
x, y, src_width, src_height);
return;
}
pDst += y * fix->line_length + x * bytes_per_pixel;
for (row = 0; row < src_height ; row++) {
memcpy(pDst, pSrc, src_width * bytes_per_pixel);
pSrc += src_width * bytes_per_pixel;
pDst += fix->line_length;
}
}
void omapfb_start_progress(struct fb_info *fb)
{
int x_pos;
if (!show_progress)
return;
init_timer(&progress_timer);
progress_timer.expires = (get_jiffies_64() + (HZ/20));
progress_timer.data = (long)fb;
progress_timer.function = progress_timer_handler;
progress_pos = PROGRESS_BAR_LEFT_POS;
/* draw progress background. */
for (x_pos = PROGRESS_BAR_LEFT_POS; x_pos <= PROGRESS_BAR_RIGHT_POS; \
x_pos += PROGRESS_BAR_WIDTH){
omapfb_update_framebuffer(fb,
x_pos,
PROGRESS_BAR_START_Y,
(void *)anycall_progress_bar,
PROGRESS_BAR_WIDTH,
PROGRESS_BAR_HEIGHT);
}
omapfb_update_framebuffer(fb,
PROGRESS_BAR_LEFT_POS,
PROGRESS_BAR_START_Y,
(void *)anycall_progress_bar_left,
PROGRESS_BAR_WIDTH,
PROGRESS_BAR_HEIGHT);
progress_pos += PROGRESS_BAR_WIDTH;
omapfb_update_framebuffer(fb,
progress_pos,
PROGRESS_BAR_START_Y,
(void *)anycall_progress_bar_right,
PROGRESS_BAR_WIDTH,
PROGRESS_BAR_HEIGHT);
add_timer(&progress_timer);
progress_flag = TRUE;
}
static void omapfb_stop_progress(void)
{
if (progress_flag == FALSE)
return;
del_timer(&progress_timer);
progress_flag = 0;
}
static void progress_timer_handler(unsigned long data)
{
int i;
for (i = 0; i < PROGRESS_BAR_WIDTH; i++) {
omapfb_update_framebuffer((struct fb_info *)data,
progress_pos++,
PROGRESS_BAR_START_Y,
(void *)anycall_progress_bar_center,
1,
PROGRESS_BAR_HEIGHT);
}
omapfb_update_framebuffer((struct fb_info *)data,
progress_pos,
PROGRESS_BAR_START_Y,
(void *)anycall_progress_bar_right,
PROGRESS_BAR_WIDTH,
PROGRESS_BAR_HEIGHT);
if (progress_pos + PROGRESS_BAR_WIDTH >= PROGRESS_BAR_RIGHT_POS ) {
omapfb_stop_progress();
} else {
progress_timer.expires = (get_jiffies_64() + (HZ/20));
progress_timer.function = progress_timer_handler;
add_timer(&progress_timer);
}
}
| dhiru1602/android_kernel_samsung_latona | drivers/video/omap2/omapfb/omapfb-progressbar.c | C | gpl-2.0 | 6,333 |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package bc;
import be.ReporteFumigacion;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author argos
*/
@Stateless
public class ReporteFumigacionFacade extends AbstractFacade<ReporteFumigacion> implements ReporteFumigacionFacadeLocal {
@PersistenceContext(unitName = "sistema-ejbPU")
private EntityManager em;
protected EntityManager getEntityManager() {
return em;
}
public ReporteFumigacionFacade() {
super(ReporteFumigacion.class);
}
}
| jchalco/Ate | sistema/sistema-ejb/src/java/bc/ReporteFumigacionFacade.java | Java | gpl-2.0 | 663 |
/*
Copyright (C) 2010 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/memento_command.h"
#include "evoral/Parameter.hpp"
#include "ardour/session.h"
namespace ARDOUR {
class MidiSource;
class AutomationList;
/** A class for late-binding a MidiSource and a Parameter to an AutomationList */
class MidiAutomationListBinder : public MementoCommandBinder<ARDOUR::AutomationList>
{
public:
MidiAutomationListBinder (boost::shared_ptr<ARDOUR::MidiSource>, Evoral::Parameter);
MidiAutomationListBinder (XMLNode *, ARDOUR::Session::SourceMap const &);
ARDOUR::AutomationList* get () const;
void add_state (XMLNode *);
private:
boost::shared_ptr<ARDOUR::MidiSource> _source;
Evoral::Parameter _parameter;
};
}
| cth103/ardour-cth103 | libs/ardour/ardour/midi_automation_list_binder.h | C | gpl-2.0 | 1,405 |
/*
* empathy-streamed-media-factory.c - Source for EmpathyStreamedMediaFactory
* Copyright (C) 2008-2011 Collabora Ltd.
* @author Sjoerd Simons <sjoerd.simons@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <telepathy-glib/account-channel-request.h>
#include <telepathy-glib/simple-handler.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/util.h>
#include <libempathy/empathy-request-util.h>
#include <libempathy/empathy-utils.h>
#include "empathy-streamed-media-factory.h"
#include "empathy-streamed-media-handler.h"
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
#include <libempathy/empathy-debug.h>
G_DEFINE_TYPE(EmpathyStreamedMediaFactory, empathy_streamed_media_factory, G_TYPE_OBJECT)
static void handle_channels_cb (TpSimpleHandler *handler,
TpAccount *account,
TpConnection *connection,
GList *channels,
GList *requests_satisfied,
gint64 user_action_time,
TpHandleChannelsContext *context,
gpointer user_data);
/* signal enum */
enum
{
NEW_STREAMED_MEDIA_HANDLER,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
/* private structure */
typedef struct {
TpBaseClient *handler;
gboolean dispose_has_run;
} EmpathyStreamedMediaFactoryPriv;
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStreamedMediaFactory)
static GObject *call_factory = NULL;
static void
empathy_streamed_media_factory_init (EmpathyStreamedMediaFactory *obj)
{
EmpathyStreamedMediaFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj,
EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, EmpathyStreamedMediaFactoryPriv);
TpAccountManager *am;
obj->priv = priv;
am = tp_account_manager_dup ();
priv->handler = tp_simple_handler_new_with_am (am, FALSE, FALSE,
EMPATHY_AV_BUS_NAME_SUFFIX, FALSE, handle_channels_cb, obj, NULL);
tp_base_client_take_handler_filter (priv->handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
NULL));
tp_base_client_take_handler_filter (priv->handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN, TRUE,
NULL));
tp_base_client_take_handler_filter (priv->handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN, TRUE,
NULL));
tp_base_client_add_handler_capabilities_varargs (priv->handler,
"org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/ice-udp",
"org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/gtalk-p2p",
"org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/video/h264",
NULL);
g_object_unref (am);
}
static GObject *
empathy_streamed_media_factory_constructor (GType type, guint n_construct_params,
GObjectConstructParam *construct_params)
{
g_return_val_if_fail (call_factory == NULL, NULL);
call_factory = G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->constructor
(type, n_construct_params, construct_params);
g_object_add_weak_pointer (call_factory, (gpointer)&call_factory);
return call_factory;
}
static void
empathy_streamed_media_factory_finalize (GObject *object)
{
/* free any data held directly by the object here */
if (G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->finalize)
G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->finalize (object);
}
static void
empathy_streamed_media_factory_dispose (GObject *object)
{
EmpathyStreamedMediaFactoryPriv *priv = GET_PRIV (object);
if (priv->dispose_has_run)
return;
priv->dispose_has_run = TRUE;
tp_clear_object (&priv->handler);
if (G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->dispose)
G_OBJECT_CLASS (empathy_streamed_media_factory_parent_class)->dispose (object);
}
static void
empathy_streamed_media_factory_class_init (
EmpathyStreamedMediaFactoryClass *empathy_streamed_media_factory_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (empathy_streamed_media_factory_class);
g_type_class_add_private (empathy_streamed_media_factory_class,
sizeof (EmpathyStreamedMediaFactoryPriv));
object_class->constructor = empathy_streamed_media_factory_constructor;
object_class->dispose = empathy_streamed_media_factory_dispose;
object_class->finalize = empathy_streamed_media_factory_finalize;
signals[NEW_STREAMED_MEDIA_HANDLER] =
g_signal_new ("new-streamed-media-handler",
G_TYPE_FROM_CLASS (empathy_streamed_media_factory_class),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
2, EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, G_TYPE_BOOLEAN);
}
EmpathyStreamedMediaFactory *
empathy_streamed_media_factory_initialise (void)
{
g_return_val_if_fail (call_factory == NULL, NULL);
return EMPATHY_STREAMED_MEDIA_FACTORY (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, NULL));
}
EmpathyStreamedMediaFactory *
empathy_streamed_media_factory_get (void)
{
g_return_val_if_fail (call_factory != NULL, NULL);
return EMPATHY_STREAMED_MEDIA_FACTORY (call_factory);
}
static void
create_streamed_media_handler (EmpathyStreamedMediaFactory *factory,
EmpathyTpStreamedMedia *call)
{
EmpathyStreamedMediaHandler *handler;
g_return_if_fail (factory != NULL);
handler = empathy_streamed_media_handler_new_for_channel (call);
g_signal_emit (factory, signals[NEW_STREAMED_MEDIA_HANDLER], 0,
handler, FALSE);
g_object_unref (handler);
}
static void
call_status_changed_cb (EmpathyTpStreamedMedia *call,
GParamSpec *spec,
EmpathyStreamedMediaFactory *self)
{
if (empathy_tp_streamed_media_get_status (call) <= EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING)
return;
create_streamed_media_handler (self, call);
g_signal_handlers_disconnect_by_func (call, call_status_changed_cb, self);
g_object_unref (call);
}
static void
handle_channels_cb (TpSimpleHandler *handler,
TpAccount *account,
TpConnection *connection,
GList *channels,
GList *requests_satisfied,
gint64 user_action_time,
TpHandleChannelsContext *context,
gpointer user_data)
{
EmpathyStreamedMediaFactory *self = user_data;
GList *l;
for (l = channels; l != NULL; l = g_list_next (l))
{
TpChannel *channel = l->data;
EmpathyTpStreamedMedia *call;
if (tp_proxy_get_invalidated (channel) != NULL)
continue;
if (tp_channel_get_channel_type_id (channel) !=
TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
continue;
call = empathy_tp_streamed_media_new (account, channel);
if (empathy_tp_streamed_media_get_status (call) <= EMPATHY_TP_STREAMED_MEDIA_STATUS_READYING)
{
/* We have to wait that the TpStreamedMedia is ready as the
* call-handler rely on it. */
tp_g_signal_connect_object (call, "notify::status",
G_CALLBACK (call_status_changed_cb), self, 0);
continue;
}
create_streamed_media_handler (self, call);
g_object_unref (call);
}
tp_handle_channels_context_accept (context);
}
gboolean
empathy_streamed_media_factory_register (EmpathyStreamedMediaFactory *self,
GError **error)
{
EmpathyStreamedMediaFactoryPriv *priv = GET_PRIV (self);
return tp_base_client_register (priv->handler, error);
}
| dinoboy197/Empathy | src/empathy-streamed-media-factory.c | C | gpl-2.0 | 8,514 |
require File.dirname(__FILE__) + '/../spec_helper'
describe PagesController do
describe 'handling GET for a single post' do
before(:each) do
@page = mock_model(Page)
Page.stub(:find_by_slug).and_return(@page)
end
def do_get
get :show, :id => 'a-page'
end
it "should be successful" do
do_get
response.should be_success
end
it "should render show template" do
do_get
response.should render_template('show')
end
it 'should find the page requested' do
Page.should_receive(:find_by_slug).with('a-page').and_return(@page)
do_get
end
it 'should assign the page found for the view' do
do_get
assigns[:page].should equal(@page)
end
end
describe 'handling GET with invalid page' do
it 'raises a RecordNotFound error' do
Page.stub(:find_by_slug).and_return(nil)
lambda {
get :show, :id => 'a-page'
}.should raise_error(ActiveRecord::RecordNotFound)
end
end
end
| scottwainstock/pbm-blog | spec/controllers/pages_controller_spec.rb | Ruby | gpl-2.0 | 1,013 |
/*
Copyright_License {
XCSoar Glide Computer - http://www.xcsoar.org/
Copyright (C) 2000-2013 The XCSoar Project
A detailed list of copyright holders can be found in the file "AUTHORS".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
*/
#ifndef XCSOAR_CYLINDER_ZONE_EDIT_WIDGET_HPP
#define XCSOAR_CYLINDER_ZONE_EDIT_WIDGET_HPP
#include "ObservationZoneEditWidget.hpp"
#include <assert.h>
class CylinderZone;
class CylinderZoneEditWidget : public ObservationZoneEditWidget {
const bool radius_editable;
public:
CylinderZoneEditWidget(CylinderZone &oz, bool _length_editable);
protected:
const CylinderZone &GetObject() const {
return (const CylinderZone &)ObservationZoneEditWidget::GetObject();
}
CylinderZone &GetObject() {
return (CylinderZone &)ObservationZoneEditWidget::GetObject();
}
public:
/* virtual methods from class Widget */
virtual void Prepare(ContainerWindow &parent,
const PixelRect &rc) override;
virtual bool Save(bool &changed) override;
};
#endif
| onkelhotte/test | src/Dialogs/Task/Widgets/CylinderZoneEditWidget.hpp | C++ | gpl-2.0 | 1,691 |
<?php defined('_JEXEC') or die('Restricted access');
// SEF problem
$isThereQMR = false;
$isThereQMR = preg_match("/\?/i", $this->tmpl['action']);
if ($isThereQMR) {
$amp = '&';
} else {
$amp = '?';
}
if ((int)$this->tmpl['displayratingimg'] == 1) {
// Leave message for already voted images
$vote = JRequest::getVar('vote', 0, '', 'int');
if ($vote == 1) {
$voteMsg = JText::_('PHOCA GALLERY IMAGE RATED');
} else {
$voteMsg = JText::_('You have already rated this image');
}
?><table style="text-align:left" border="0"><tr><td><?php
echo '<strong>' . JText::_('Rating'). '</strong>: ' . $this->tmpl['votesaverageimg'] .' / '.$this->tmpl['votescountimg'] . ' ' . JText::_($this->tmpl['votestextimg']). ' ';
if ($this->tmpl['alreadyratedimg']) {
echo '<td style="text-align:left"><ul class="star-rating">'
.'<li class="current-rating" style="width:'.$this->tmpl['voteswidthimg'].'px"></li>'
.'<li><span class="star1"></span></li>';
for ($i = 2;$i < 6;$i++) {
echo '<li><span class="stars'.$i.'"></span></li>';
}
echo '</ul></td>'
.'<td style="text-align:left" colspan="4"> '.$voteMsg.'</td></tr>';
} else if ($this->tmpl['notregisteredimg']) {
echo '<td style="text-align:left"><ul class="star-rating">'
.'<li class="current-rating" style="width:'.$this->tmpl['voteswidthimg'].'px"></li>'
.'<li><span class="star1"></span></li>';
for ($i = 2;$i < 6;$i++) {
echo '<li><span class="stars'.$i.'"></span></li>';
}
echo '</ul></td>'
.'<td style="text-align:left" colspan="4"> '.JText::_('Only registered and logged in user can rate this image').'</td>';
} else {
echo '<td style="text-align:left"><ul class="star-rating">'
.'<li class="current-rating" style="width:'.$this->tmpl['voteswidthimg'].'px"></li>'
.'<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating=1" title="1 '. JText::_('star out of').' 5" class="star1">1</a></li>';
for ($i = 2;$i < 6;$i++) {
echo '<li><a href="'.$this->tmpl['action'].$amp.'controller=detail&task=rate&rating='.$i.'" title="'.$i.' '. JText::_('star out of').' 5" class="stars'.$i.'">'.$i.'</a></li>';
}
echo '</td>';
}
?></tr></table><?php
}
?>
| prabhu9484/testFork | components/com_phocagallery/views/detail/tmpl/default_rating.php | PHP | gpl-2.0 | 2,301 |
#!/usr/bin/python
# encoding: utf-8
# filename: outroTipoDeProducaoBibliografica.py
#
# scriptLattes V8
# Copyright 2005-2013: Jesús P. Mena-Chalco e Roberto M. Cesar-Jr.
# http://scriptlattes.sourceforge.net/
#
#
# Este programa é um software livre; você pode redistribui-lo e/ou
# modifica-lo dentro dos termos da Licença Pública Geral GNU como
# publicada pela Fundação do Software Livre (FSF); na versão 2 da
# Licença, ou (na sua opinião) qualquer versão.
#
# Este programa é distribuído na esperança que possa ser util,
# mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer
# MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a
# Licença Pública Geral GNU para maiores detalhes.
#
# Você deve ter recebido uma cópia da Licença Pública Geral GNU
# junto com este programa, se não, escreva para a Fundação do Software
# Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
from scriptLattes import *
from geradorDePaginasWeb import *
import re
class OutroTipoDeProducaoBibliografica:
item = None # dado bruto
idMembro = None
relevante = None
autores = None
titulo = None
ano = None
natureza = None # tipo de producao
chave = None
def __init__(self, idMembro, partesDoItem='', relevante=''):
self.idMembro = set([])
self.idMembro.add(idMembro)
if not partesDoItem=='':
# partesDoItem[0]: Numero (NAO USADO)
# partesDoItem[1]: Descricao do livro (DADO BRUTO)
self.relevante = relevante
self.item = partesDoItem[1]
# Dividir o item na suas partes constituintes
partes = self.item.partition(" . ")
self.autores = partes[0].strip()
partes = partes[2]
aux = re.findall(u' \((.*?)\)\.$', partes)
if len(aux)>0:
self.natureza = aux[-1]
partes = partes.rpartition(" (")
partes = partes[0]
else:
self.natureza = ''
aux = re.findall(u' ((?:19|20)\d\d)\\b', partes)
if len(aux)>0:
self.ano = aux[-1] #.strip().rstrip(".").rstrip(",")
partes = partes.rpartition(" ")
partes = partes[0]
else:
self.ano = ''
self.titulo = partes.strip().rstrip(".").rstrip(",")
self.chave = self.autores # chave de comparação entre os objetos
else:
self.relevante = ''
self.autores = ''
self.titulo = ''
self.ano = ''
self.natureza = ''
def compararCom(self, objeto):
if self.idMembro.isdisjoint(objeto.idMembro) and compararCadeias(self.titulo, objeto.titulo):
# Os IDs dos membros são agrupados.
# Essa parte é importante para a criação do GRAFO de colaborações
self.idMembro.update(objeto.idMembro)
if len(self.autores)<len(objeto.autores):
self.autores = objeto.autores
if len(self.titulo)<len(objeto.titulo):
self.titulo = objeto.titulo
if len(self.natureza)<len(objeto.natureza):
self.natureza = objeto.natureza
return self
else: # nao similares
return None
def html(self, listaDeMembros):
s = self.autores + '. <b>' + self.titulo + '</b>. '
s+= str(self.ano) + '. ' if str(self.ano).isdigit() else '. '
s+= self.natureza if not self.natureza=='' else ''
s+= menuHTMLdeBuscaPB(self.titulo)
return s
# ------------------------------------------------------------------------ #
def __str__(self):
s = "\n[OUTRO TIPO DE PRODUCAO BIBLIOGRAFICA] \n"
s += "+ID-MEMBRO : " + str(self.idMembro) + "\n"
s += "+RELEVANTE : " + str(self.relevante) + "\n"
s += "+AUTORES : " + self.autores.encode('utf8','replace') + "\n"
s += "+TITULO : " + self.titulo.encode('utf8','replace') + "\n"
s += "+ANO : " + str(self.ano) + "\n"
s += "+NATUREZA : " + self.natureza.encode('utf8','replace') + "\n"
s += "+item : " + self.item.encode('utf8','replace') + "\n"
return s
| DiegoQueiroz/scriptLattes | scriptLattes/producoesBibliograficas/outroTipoDeProducaoBibliografica.py | Python | gpl-2.0 | 3,771 |
<?php
/*
* Child theme creation results page
*/
?>
<div id="child_created" class="main-panel">
<h3><?php _e( 'Your child theme was successfully created!', 'divi-children' ); ?></h3>
<div id="created_theme">
<div class="theme_screenshot">
<img src="<?php echo $divichild['new_theme_dir'] . '/screenshot.jpg'; ?>" alt="screenshot">
</div>
<div class="theme_info">
<h3><?php echo $divichild['new_theme_name']; ?></h3>
<h4><?php _e( 'By', 'divi-children' ); ?><?php echo ' ' . $divichild['new_theme_authorname']; ?></h4>
<p><em><?php _e( 'Version', 'divi-children' ); ?></em><b><?php echo ': ' . $divichild['new_theme_version']; ?></b></p>
<p><b><?php echo $divichild['new_theme_description']; ?></b></p>
<p><em><?php _e( 'Parent Theme', 'divi-children' ); ?></em><b><?php echo ': ' . $divichild['new_theme_parent']; ?></b></p>
<p><em><?php _e( 'Theme URI', 'divi-children' ); ?></em><b><?php echo ': ' . $divichild['new_theme_uri']; ?></b></p>
<p><em><?php _e( 'Author URI', 'divi-children' ); ?></em><b><?php echo ': ' . $divichild['new_theme_authoruri']; ?></b></p>
<a href="<?php echo admin_url( 'themes.php' ); ?>" class="button-primary"><?php _e( 'You can activate it now in the Themes Manager', 'divi-children' ); ?></a>
</div>
</div>
</div>
<div id="footer_display">
<h3><?php _e( 'Your footer credits will look like this:', 'divi-children' ); ?></h3>
<div class="footer-display">
<?php
$firstyear = get_option( 'footer_credits_firstyear' );
$owner = get_option( 'footer_credits_owner' );
$ownerlink = get_option( 'footer_credits_ownerlink' );
$developed_text = get_option( 'footer_credits_developed' );
$developer = get_option( 'footer_credits_developer' );
$developerlink = get_option( 'footer_credits_developerlink' );
$powered_text = get_option( 'footer_credits_powered' );
$powered_code = get_option( 'footer_credits_poweredcode' );
$powered_codelink = get_option( 'footer_credits_poweredcodelink' );
$footer_credits = 'Copyright © ';
$current_year = date( 'Y' );
if ( $firstyear AND ($firstyear != 0 )) {
if( $firstyear != $current_year ) {
$footer_credits .= $firstyear . ' - ' . $current_year;
}
} else {
$footer_credits .= $current_year;
}
$footer_credits .= ' <a href="' . esc_url( $ownerlink ) . '">' . $owner . '</a>';
if ( $developed_text ) {
$footer_credits .= ' | ' . $developed_text . ' ' . '<a href="' . esc_url( $developerlink ) . '">' . $developer . '</a>';
}
if ( $powered_text ) {
$footer_credits .= ' | ' . $powered_text . ' ' . '<a href="' . esc_url( $powered_codelink ) . '">' . $powered_code . '</a>';
}
echo $footer_credits;
?>
</div>
</div> | todd3773/netpartnering | wp-content/plugins/Divi_Children_2.0.8/includes/results-page.php | PHP | gpl-2.0 | 2,728 |
using System.IO;
using System.Text;
namespace CodeMask.WPF.Controls.Gif.Decoding
{
internal class GifCommentExtension : GifExtension
{
internal const int ExtensionLabel = 0xFE;
private GifCommentExtension()
{
}
public string Text { get; private set; }
internal override GifBlockKind Kind
{
get { return GifBlockKind.SpecialPurpose; }
}
internal static GifCommentExtension ReadComment(Stream stream)
{
var comment = new GifCommentExtension();
comment.Read(stream);
return comment;
}
private void Read(Stream stream)
{
// Note: at this point, the label (0xFE) has already been read
var bytes = GifHelpers.ReadDataBlocks(stream, false);
if (bytes != null)
Text = Encoding.ASCII.GetString(bytes);
}
}
} | cooglex/CodeMask | CodeMask/CodeMask.WPF.Controls/Gif/Decoding/GifCommentExtension.cs | C# | gpl-2.0 | 929 |
/**
* @file SleepTimer.cpp
* @author Pere Tuset-Peiro (peretuset@openmote.com)
* @version v0.1
* @date May, 2015
* @brief
*
* @copyright Copyright 2015, OpenMote Technologies, S.L.
* This file is licensed under the GNU General Public License v2.
*/
/*================================ include ==================================*/
#include "SleepTimer.h"
#include "InterruptHandler.h"
#include "cc2538_include.h"
/*================================ define ===================================*/
/*================================ typedef ==================================*/
/*=============================== variables =================================*/
/*=============================== prototypes ================================*/
/*================================= public ==================================*/
SleepTimer::SleepTimer(uint32_t interrupt):
interrupt_(interrupt)
{
}
void SleepTimer::start(uint32_t counts)
{
uint32_t current;
// Get current counter
current = SleepModeTimerCountGet();
// Set future timeout
SleepModeTimerCompareSet(current + counts);
}
void SleepTimer::stop(void)
{
// Nothing to do here, SleepTimer cannot be stopped
}
uint32_t SleepTimer::sleep(void)
{
return 0;
}
void SleepTimer::wakeup(uint32_t ticks)
{
}
uint32_t SleepTimer::getCounter(void)
{
// Get current counter
return SleepModeTimerCountGet();
}
bool SleepTimer::isExpired(uint32_t future)
{
uint32_t current;
int32_t delta;
// Get current counter
current = SleepModeTimerCountGet();
// Calculate delta
delta = (int32_t) (current - future);
// Return true if expired
return (delta < 0);
}
void SleepTimer::setCallback(Callback* callback)
{
callback_ = callback;
}
void SleepTimer::clearCallback(void)
{
callback_ = nullptr;
}
void SleepTimer::enableInterrupts(void)
{
InterruptHandler::getInstance().setInterruptHandler(this);
IntEnable(interrupt_);
}
void SleepTimer::disableInterrupts(void)
{
IntDisable(interrupt_);
InterruptHandler::getInstance().clearInterruptHandler(this);
}
/*=============================== protected =================================*/
/*================================ private ==================================*/
void SleepTimer::interruptHandler(void)
{
if (callback_ != nullptr)
{
callback_->execute();
}
}
| tdautc19841202/firmware | platform/cc2538/SleepTimer.cpp | C++ | gpl-2.0 | 2,420 |
<?php
/*
*
* Copyright 2001-2004 Thomas Belliard, Laurent Delineau, Edouard Hue, Eric Lebrun
*
* This file is part of GEPI.
*
* GEPI 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.
*
* GEPI 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 GEPI; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Initialisations files
require_once("../lib/initialisations.inc.php");
// Resume session
$resultat_session = $session_gepi->security_check();
if ($resultat_session == '0') {
header("Location: ../logout.php?auto=1");
die();
};
//**************** EN-TETE *****************
require_once("../lib/header.inc.php");
//**************** FIN EN-TETE *************
?>
<h1 class='gepi'>GEPI - Informations générales</h1>
<?php
echo "Vous êtes actuellement connecté sur l'application <b>GEPI (".getSettingValue("gepiSchoolName").")</b>.
<br />Par sécurité, si vous n'envoyez aucune information au serveur (activation d'un lien ou soumission d'un formulaire) pendant plus de <b>".getSettingValue("sessionMaxLength")." minutes</b>, vous serez automatiquement déconnecté de l'application.";
echo "<h2>Administration de l'application GEPI</h2>\n";
echo "<table cellpadding='5' summary='Infos'>\n";
echo "<tr><td>Nom et prénom de l'administrateur : </td><td><b>".getSettingValue("gepiAdminNom")." ".getSettingValue("gepiAdminPrenom")."</b></td></tr>\n";
echo "<tr><td>Fonction de l'administrateur : </td><td><b>".getSettingValue("gepiAdminFonction")."</b></td></tr>\n";
echo "<tr><td>Email de l'administrateur : </td><td><b><a href=\"mailto:" . getSettingValue("gepiAdminAdress") . "\">".getSettingValue("gepiAdminAdress")."</a></b></td></tr>\n";
echo "<tr><td>Nom de l'établissement : </td><td><b>".getSettingValue("gepiSchoolName")."</b></td></tr>\n";
echo "<tr><td Valign='top'>Adresse : </td><td><b>".getSettingValue("gepiSchoolAdress1")."<br />".getSettingValue("gepiSchoolAdress2")."<br />".getSettingValue("gepiSchoolZipCode")." ".getSettingValue("gepiSchoolCity")."</b></td></tr>\n";
echo "</table>\n";
echo "<h2>Objectifs de l'application GEPI</h2>\n";
echo "L'objectif de GEPI est la <b>gestion pédagogique des élèves et de leur scolarité</b>.
Dans ce but, des données sont collectées et stockées dans une base unique de type MySql.";
echo "<h2>Obligations de l'utilisateur</h2>\n";
echo "Les membres de l'équipe pédagogique sont tenus de remplir les rubriques qui leur ont été affectées par l'administrateur
lors du paramétrage de l'application.";
echo "<br />Il est possible de modifier le contenu d'une rubrique tant que la période concernée n'a pas été close par l'administrateur.";
echo "<h2>Destinataires des données relatives au bulletin scolaire</h2>\n";
echo "Concernant le bulletin scolaire, les données suivantes sont récoltées auprès des membres de l'équipe pédagogique :
<ul><li>absences (pour chaque période : nombre de demi-journées d'absence, nombre d'absences non justifiées, nombre de retards, observations)</li>
<li>moyennes et appréciations par matière,</li>
<li>moyennes et appréciations par projet inter-disciplinaire,</li>
<li>avis du conseil de classe.</li>
</ul>
Toutes ces informations sont intégralement reproduites sur un bulletin à la fin de chaque période (voir ci-dessous).
<br /><br />
Ces données servent à :
<ul>
<li>l'élaboration d'un bulletin à la fin de chaque période, édité par le service scolarité et communiqué à l'élève
et à ses responsables légaux : notes obtenues, absences, moyennes, appréciations des enseignants, avis du conseil de classe.</li>
<li>l'élaboration d'un document de travail reprenant les informations du bulletin officiel et disponible pour les membres de l'équipe pédagogique de la classe concernée</li>
</ul>\n";
//On vérifie si le module cahiers de texte est activé
if (getSettingValue("active_cahiers_texte")=='y') {
echo "<h2>Destinataires des données relatives au cahier de texte</h2>\n";
echo "Conformément aux directives de l'Education Nationale, chaque professeur dispose dans GEPI d'un cahier de texte pour chacune de ses classes qu'il peut tenir à jour
en étant connecté.
<br />
Le cahier de texte relate le travail réalisé en classe :
<ul>
<li>projet de l'équipe pédagogique,</li>
<li>contenu pédagogique de chaque séance, chronologie, objectif visé, travail à faire ...</li>
<li>documents divers,</li>
<li>évaluations, ...</li>
</ul>
Il constitue un outil de communication pour l'élève, les équipes disciplinaires
et pluridisciplinaires, l'administration, le chef d'établissement, les corps d'inspection et les familles.
<br /> Les cahiers de texte sont accessibles en ligne.";
if ((getSettingValue("cahiers_texte_login_pub") != '') and (getSettingValue("cahiers_texte_passwd_pub") != '')) {
echo " <b>En raison du caractére personnel du contenu, l'accès à l'interface de consultation publique est restreint</b>. Pour accéder aux cahiers de texte, il est nécessaire de demander auprès de l'administrateur,
le nom d'utilisateur et le mot de passe valides.";
} else {
echo " <b>L'accès à l'interface de consultation publique est entièrement libre et n'est soumise à aucune restriction.</b>\n";
}
}
//On vérifie si le module carnet de notes est activé
if (getSettingValue("active_carnets_notes")=='y') {
echo "<h2>Destinataires des données relatives au carnet de notes</h2>\n";
echo "Chaque professeur dispose dans GEPI d'un carnet de notes pour chacune de ses classes, qu'il peut tenir à jour
en étant connecté.
<br />
Le carnet de note permet la saisie des notes et/ou des commentaires de tout type d'évaluation (formatives, sommatives, oral, TP, TD, ...).
<br /><b>Le professeur s'engage à ne faire figurer dans le carnet de notes que des notes et commentaires portés à la connaissance de l'élève (note et commentaire portés sur la copie, ...).</b>
Ces données stockées dans GEPI n'ont pas d'autre destinataire que le professeur lui-même et le ou les professeurs principaux de la classe.
<br />Les notes peuvent servir à l'élaboration d'une moyenne qui figurera dans le bulletin officiel à la fin de chaque période.";
}
//On vérifie si le plugin suivi_eleves est activé
$test_plugin = sql_query1("select ouvert from plugins where nom='suivi_eleves'");
if ($test_plugin=='y') {
echo "<h2>Destinataires des données relatives au module de suivi des élèves</h2>\n";
echo "Chaque professeur dispose dans GEPI d'un outil de suivi des élèves (\"observatoire\") pour chacune de ses classes, qu'il peut tenir à jour
en étant connecté.
<br />
Dans l'observatoire, le professeur a la possibilité d'attribuer à chacun de ses élèves un code pour chaque période.
Ces codes et leur signification sont paramétrables par les administrateurs de l'observatoire désignés par l'administrateur général de GEPI.
<br />.
Le professeur dispose également de la possibilité de saisir un commentaire pour chacun de ses élèves
dans le respect de la loi et dans le cadre strict de l'Education Nationale.
<br /><br />L'observatoire et les données qui y figurent sont accessibles à l'ensemble de l'équipe pédagogique de l'établissement.
<br /><br />Dans le respect de la loi informatique et liberté 78-17 du 6 janvier 1978, chaque élève a également accès dans son espace GEPI aux données qui le concernent";
}
require("../lib/footer.inc.php");
?>
| Regis85/gepi | gestion/info_gepi.php | PHP | gpl-2.0 | 8,127 |
/*
* 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.
*/
package org.apache.commons.math3.stat.clustering;
import java.io.Serializable;
import java.util.Collection;
import java.util.Arrays;
import org.apache.commons.math3.util.MathArrays;
/**
* A simple implementation of {@link Clusterable} for points with double coordinates.
* @version $Id$
* @since 3.1
*/
public class EuclideanDoublePoint implements Clusterable<EuclideanDoublePoint>, Serializable {
/** Serializable version identifier. */
private static final long serialVersionUID = 8026472786091227632L;
/** Point coordinates. */
private final double[] point;
/**
* Build an instance wrapping an integer array.
* <p>
* The wrapped array is referenced, it is <em>not</em> copied.
*
* @param point the n-dimensional point in integer space
*/
public EuclideanDoublePoint(final double[] point) {
this.point = point;
}
/** {@inheritDoc} */
public EuclideanDoublePoint centroidOf(final Collection<EuclideanDoublePoint> points) {
final double[] centroid = new double[getPoint().length];
for (final EuclideanDoublePoint p : points) {
for (int i = 0; i < centroid.length; i++) {
centroid[i] += p.getPoint()[i];
}
}
for (int i = 0; i < centroid.length; i++) {
centroid[i] /= points.size();
}
return new EuclideanDoublePoint(centroid);
}
/** {@inheritDoc} */
public double distanceFrom(final EuclideanDoublePoint p) {
return MathArrays.distance(point, p.getPoint());
}
/** {@inheritDoc} */
@Override
public boolean equals(final Object other) {
if (!(other instanceof EuclideanDoublePoint)) {
return false;
}
return Arrays.equals(point, ((EuclideanDoublePoint) other).point);
}
/**
* Get the n-dimensional point in integer space.
*
* @return a reference (not a copy!) to the wrapped array
*/
public double[] getPoint() {
return point;
}
/** {@inheritDoc} */
@Override
public int hashCode() {
return Arrays.hashCode(point);
}
/** {@inheritDoc} */
@Override
public String toString() {
return Arrays.toString(point);
}
}
| SpoonLabs/astor | examples/math_5/src/main/java/org/apache/commons/math3/stat/clustering/EuclideanDoublePoint.java | Java | gpl-2.0 | 3,065 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.