code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9 values | license stringclasses 15 values | size int32 3 1.05M |
|---|---|---|---|---|---|
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Geodesy representation conversion functions (c) Chris Veness 2002-2015 */
/* - www.movable-type.co.uk/scripts/latlong.html MIT Licence */
/* */
/* Sample usage: */
/* var lat = Dms.parseDMS('51° 28′ 40.12″ N'); */
/* var lon = Dms.parseDMS('000° 00′ 05.31″ W'); */
/* var p1 = new LatLon(lat, lon); */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* jshint node:true *//* global define */
'use strict';
/**
* Tools for converting between numeric degrees and degrees / minutes / seconds.
*
* @namespace
*/
var Dms = {};
// note Unicode Degree = U+00B0. Prime = U+2032, Double prime = U+2033
/**
* Parses string representing degrees/minutes/seconds into numeric degrees.
*
* This is very flexible on formats, allowing signed decimal degrees, or deg-min-sec optionally
* suffixed by compass direction (NSEW). A variety of separators are accepted (eg 3° 37′ 09″W).
* Seconds and minutes may be omitted.
*
* @param {string|number} dmsStr - Degrees or deg/min/sec in variety of formats.
* @returns {number} Degrees as decimal number.
*/
Dms.parseDMS = function(dmsStr) {
// check for signed decimal degrees without NSEW, if so return it directly
if (typeof dmsStr == 'number' && isFinite(dmsStr)) return Number(dmsStr);
// strip off any sign or compass dir'n & split out separate d/m/s
var dms = String(dmsStr).trim().replace(/^-/,'').replace(/[NSEW]$/i,'').split(/[^0-9.,]+/);
if (dms[dms.length-1]=='') dms.splice(dms.length-1); // from trailing symbol
if (dms == '') return NaN;
// and convert to decimal degrees...
var deg;
switch (dms.length) {
case 3: // interpret 3-part result as d/m/s
deg = dms[0]/1 + dms[1]/60 + dms[2]/3600;
break;
case 2: // interpret 2-part result as d/m
deg = dms[0]/1 + dms[1]/60;
break;
case 1: // just d (possibly decimal) or non-separated dddmmss
deg = dms[0];
// check for fixed-width unseparated format eg 0033709W
//if (/[NS]/i.test(dmsStr)) deg = '0' + deg; // - normalise N/S to 3-digit degrees
//if (/[0-9]{7}/.test(deg)) deg = deg.slice(0,3)/1 + deg.slice(3,5)/60 + deg.slice(5)/3600;
break;
default:
return NaN;
}
if (/^-|[WS]$/i.test(dmsStr.trim())) deg = -deg; // take '-', west and south as -ve
return Number(deg);
};
/**
* Converts decimal degrees to deg/min/sec format
* - degree, prime, double-prime symbols are added, but sign is discarded, though no compass
* direction is added.
*
* @private
* @param {number} deg - Degrees to be formatted as specified.
* @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec.
* @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d.
* @returns {string} Degrees formatted as deg/min/secs according to specified format.
*/
Dms.toDMS = function(deg, format, dp) {
if (isNaN(deg)) return null; // give up here if we can't make a number from deg
// default values
if (format === undefined) format = 'dms';
if (dp === undefined) {
switch (format) {
case 'd': case 'deg': dp = 4; break;
case 'dm': case 'deg+min': dp = 2; break;
case 'dms': case 'deg+min+sec': dp = 0; break;
default: format = 'dms'; dp = 0; // be forgiving on invalid format
}
}
deg = Math.abs(deg); // (unsigned result ready for appending compass dir'n)
var dms, d, m, s;
switch (format) {
default: // invalid format spec!
case 'd': case 'deg':
d = deg.toFixed(dp); // round degrees
if (d<100) d = '0' + d; // pad with leading zeros
if (d<10) d = '0' + d;
dms = d + '°';
break;
case 'dm': case 'deg+min':
var min = (deg*60).toFixed(dp); // convert degrees to minutes & round
d = Math.floor(min / 60); // get component deg/min
m = (min % 60).toFixed(dp); // pad with trailing zeros
if (d<100) d = '0' + d; // pad with leading zeros
if (d<10) d = '0' + d;
if (m<10) m = '0' + m;
dms = d + '°' + m + '′';
break;
case 'dms': case 'deg+min+sec':
var sec = (deg*3600).toFixed(dp); // convert degrees to seconds & round
d = Math.floor(sec / 3600); // get component deg/min/sec
m = Math.floor(sec/60) % 60;
s = (sec % 60).toFixed(dp); // pad with trailing zeros
if (d<100) d = '0' + d; // pad with leading zeros
if (d<10) d = '0' + d;
if (m<10) m = '0' + m;
if (s<10) s = '0' + s;
dms = d + '°' + m + '′' + s + '″';
break;
}
return dms;
};
/**
* Converts numeric degrees to deg/min/sec latitude (2-digit degrees, suffixed with N/S).
*
* @param {number} deg - Degrees to be formatted as specified.
* @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec.
* @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d.
* @returns {string} Degrees formatted as deg/min/secs according to specified format.
*/
Dms.toLat = function(deg, format, dp) {
var lat = Dms.toDMS(deg, format, dp);
return lat===null ? '–' : lat.slice(1) + (deg<0 ? 'S' : 'N'); // knock off initial '0' for lat!
};
/**
* Convert numeric degrees to deg/min/sec longitude (3-digit degrees, suffixed with E/W)
*
* @param {number} deg - Degrees to be formatted as specified.
* @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec.
* @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d.
* @returns {string} Degrees formatted as deg/min/secs according to specified format.
*/
Dms.toLon = function(deg, format, dp) {
var lon = Dms.toDMS(deg, format, dp);
return lon===null ? '–' : lon + (deg<0 ? 'W' : 'E');
};
/**
* Converts numeric degrees to deg/min/sec as a bearing (0°..360°)
*
* @param {number} deg - Degrees to be formatted as specified.
* @param {string} [format=dms] - Return value as 'd', 'dm', 'dms' for deg, deg+min, deg+min+sec.
* @param {number} [dp=0|2|4] - Number of decimal places to use – default 0 for dms, 2 for dm, 4 for d.
* @returns {string} Degrees formatted as deg/min/secs according to specified format.
*/
Dms.toBrng = function(deg, format, dp) {
deg = (Number(deg)+360) % 360; // normalise -ve values to 180°..360°
var brng = Dms.toDMS(deg, format, dp);
return brng===null ? '–' : brng.replace('360', '0'); // just in case rounding took us up to 360°!
};
/**
* Returns compass point (to given precision) for supplied bearing.
*
* @param {number} bearing - Bearing in degrees from north.
* @param {number} [precision=3] - Precision (cardinal / intercardinal / secondary-intercardinal).
* @returns {string} Compass point for supplied bearing.
*
* @example
* var point = Dms.compassPoint(24); // point = 'NNE'
* var point = Dms.compassPoint(24, 1); // point = 'N'
*/
Dms.compassPoint = function(bearing, precision) {
if (precision === undefined) precision = 3;
// note precision = max length of compass point; it could be extended to 4 for quarter-winds
// (eg NEbN), but I think they are little used
bearing = ((bearing%360)+360)%360; // normalise to 0..360
var point;
switch (precision) {
case 1: // 4 compass points
switch (Math.round(bearing*4/360)%4) {
case 0: point = 'N'; break;
case 1: point = 'E'; break;
case 2: point = 'S'; break;
case 3: point = 'W'; break;
}
break;
case 2: // 8 compass points
switch (Math.round(bearing*8/360)%8) {
case 0: point = 'N'; break;
case 1: point = 'NE'; break;
case 2: point = 'E'; break;
case 3: point = 'SE'; break;
case 4: point = 'S'; break;
case 5: point = 'SW'; break;
case 6: point = 'W'; break;
case 7: point = 'NW'; break;
}
break;
case 3: // 16 compass points
switch (Math.round(bearing*16/360)%16) {
case 0: point = 'N'; break;
case 1: point = 'NNE'; break;
case 2: point = 'NE'; break;
case 3: point = 'ENE'; break;
case 4: point = 'E'; break;
case 5: point = 'ESE'; break;
case 6: point = 'SE'; break;
case 7: point = 'SSE'; break;
case 8: point = 'S'; break;
case 9: point = 'SSW'; break;
case 10: point = 'SW'; break;
case 11: point = 'WSW'; break;
case 12: point = 'W'; break;
case 13: point = 'WNW'; break;
case 14: point = 'NW'; break;
case 15: point = 'NNW'; break;
}
break;
default:
throw new RangeError('Precision must be between 1 and 3');
}
return point;
};
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/** Polyfill String.trim for old browsers
* (q.v. blog.stevenlevithan.com/archives/faster-trim-javascript) */
if (String.prototype.trim === undefined) {
String.prototype.trim = function() {
return String(this).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
if (typeof module != 'undefined' && module.exports) module.exports = Dms; // CommonJS (Node)
if (typeof define == 'function' && define.amd) define([], function() { return Dms; }); // AMD
| celber/arrow | dist/vendor/geodesy/dms.js | JavaScript | gpl-2.0 | 10,670 |
<?
# Lifter010: TODO
use Studip\Button, Studip\LinkButton;
?>
<h3><?= sprintf(_("Es wurden %s Personen gefunden"), count($users)) ?></h3>
<form action="<?= $controller->url_for('admin/user/delete') ?>" method="post">
<?= CSRFProtection::tokenTag() ?>
<table class="default">
<tr class="sortable">
<th align="left" colspan="2" <?= ($sortby == 'username') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=username&order='.$order.'&toggle='.($sortby == 'username'))?>"><?=_("Benutzername")?></a>
<span style="font-size:smaller; font-weight:normal; color:#f8f8f8;">(<?=_("Sichtbarkeit")?>)</span>
</th>
<th align="left" <?= ($sortby == 'perms') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=perms&order='.$order.'&toggle='.($sortby == 'perms'))?>"><?=_("Status")?></a>
</th>
<th align="left" <?= ($sortby == 'Vorname') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=Vorname&order='.$order.'&toggle='.($sortby == 'Vorname'))?>"><?=_("Vorname")?></a>
</th>
<th align="left" <?= ($sortby == 'Nachname') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=Nachname&order='.$order.'&toggle='.($sortby == 'Nachname'))?>"><?=_("Nachname")?></a>
</th>
<th align="left" <?= ($sortby == 'Email') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=Email&order='.$order.'&toggle='.($sortby == 'Email'))?>"><?=_("E-Mail")?></a>
</th>
<th align="left" <?= ($sortby == 'changed') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=changed&order='.$order.'&toggle='.($sortby == 'changed'))?>"><?=_("inaktiv")?></a>
</th>
<th align="left" <?= ($sortby == 'mkdate') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=mkdate&order='.$order.'&toggle='.($sortby == 'mkdate'))?>"><?=_("registriert seit")?></a>
</th>
<th colspan="2" <?= ($sortby == 'auth_plugin') ? 'class="sort' . $order . '"' : ''?>>
<a href="<?=URLHelper::getLink('?sortby=auth_plugin&order='.$order.'&toggle='.($sortby == 'auth_plugin'))?>"><?=_("Authentifizierung")?></a>
</th>
</tr>
<? foreach ($users as $user) : ?>
<tr class="<?= TextHelper::cycle('cycle_odd', 'cycle_even')?>">
<td>
<a href="<?= URLHelper::getLink('about.php', array('username' => $user['username'])) ?>" title="<?= _('Profil des Benutzers anzeigen')?>">
<?= Avatar::getAvatar($user['user_id'], $user['username'])->getImageTag(Avatar::SMALL, array('title' => htmlReady($user['Vorname'] . ' ' . $user['Nachname']))) ?>
</a>
</td>
<td>
<a href="<?= URLHelper::getLink('about.php', array('username' => $user['username'])) ?>" title="<?= _('Profil des Benutzers anzeigen')?>">
<?= $user['username'] ?>
</a>
<?= ($user['locked'] == '1') ?
'<span style="font-size:smaller; color:red; font-weight:bold;">' . _(" gesperrt!") .'</span>' :
'<span style="font-size:smaller; color:#888;">('.$user['visible'].')</span>'
?>
</td>
<td>
<?= $user['perms'] ?>
</td>
<td>
<?= htmlReady($user['Vorname']) ?>
</td>
<td>
<?= htmlReady($user['Nachname']) ?>
</td>
<td>
<?= htmlReady($user['Email']) ?>
</td>
<td>
<? if ($user["changed_timestamp"] != "") :
$inactive = time() - $user['changed_timestamp'];
if ($inactive < 3600 * 24) {
$inactive = gmdate('H:i:s', $inactive);
} else {
$inactive = floor($inactive / (3600 * 24)).' '._('Tage');
}
else :
$inactive = _("nie benutzt");
endif ?>
<?= $inactive ?>
</td>
<td>
<?= ($user["mkdate"]) ? date("d.m.Y", $user["mkdate"]) : _('unbekannt') ?>
</td>
<td><?= htmlReady($user['auth_plugin']) ?></td>
<td align="right" nowrap>
<a href="<?= $controller->url_for('admin/user/edit/'.$user['user_id']) ?>" title="<?= _('Detailansicht des Benutzers anzeigen')?>">
<?= Assets::img('icons/16/blue/edit.png', array('title' => _('Diesen Benutzer bearbeiten'))) ?>
</a>
<a href="<?= $controller->url_for('admin/user/delete/'.$user['user_id']) ?>">
<?= Assets::img('icons/16/blue/trash.png', array('title' => _('Diesen Benutzer löschen'))) ?>
</a>
<input class="check_all" type="checkbox" name="user_ids[]" value="<?= $user['user_id'] ?>">
</td>
</tr>
<? endforeach ?>
<tr class="steel2">
<td colspan="10" align="right">
<?= Button::create(_('Löschen'), array('title' => _('Alle ausgewählten Benutzer löschen')))?>
<input class="middle" type="checkbox" name="check_all" title="<?= _('Alle Benutzer auswählen') ?>">
</td>
</tr>
</table>
</form>
<script>
jQuery("input[name='check_all']").click(function() {
if(jQuery(this).attr("checked")) {
jQuery(".check_all").attr("checked","checked");
} else {
jQuery(".check_all").removeAttr("checked");
}
});
</script> | japhigu/stup.ID | app/views/admin/user/_results.php | PHP | gpl-2.0 | 5,498 |
<?php
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
spl_autoload_register( 'carawebs_class_autoloader' );
function carawebs_class_autoloader( $classname ) {
$class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower( $classname ) ) );
// create the actual filepath
$filePath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $class . '.php';
//print $filePath;
// Build a filename that matches the correct protocol
//$filePath = sprintf( '%s%s.php',
//WP_PLUGIN_DIR . DIRECTORY_SEPARATOR,
//$class );
// check if the file exists
if( file_exists( $filePath ) ) {
// require once on the file
require_once ( $filePath );
}
}
| DavidCWebs/member | autoloader.php | PHP | gpl-2.0 | 735 |
;(function($){
$(document).ready( function(){
$('.fa_slider_simple').FeaturedArticles({
slide_selector : '.fa_slide',
nav_prev : '.go-back',
nav_next : '.go-forward',
nav_elem : '.main-nav .fa-nav',
effect : false,
// events
load : load,
before : before,
after : after,
resize : resize,
stop : stop,
start : start
});
});
var resizeDuration = 100;
var load = function(){
var options = this.settings(),
self = this;
this.progressBar = $(this).find('.progress-bar');
this.mouseOver;
// height resize
if( $(this).data('theme_opt_auto_resize') ){
this.sliderHeight = $(this).height();
var h = $( this.slides()[0] ).find(options.content_container).outerHeight() + 100;
setHeight = h > this.sliderHeight ? h : this.sliderHeight;
slide = this.slides()[0];
$(slide).css({
'height' : setHeight
});
self.center_img( slide );
$(this)
.css({
'max-height':'none',
'height' : this.sliderHeight
})
.animate({
'height' : setHeight
},{
queue: false,
duration:resizeDuration ,
complete: function(){
/*
$(this).css({
'max-height':setHeight
});
*/
}
});// end animate
}// end height resize
}
var before = function(d){
var options = this.settings(),
self = this;
if( typeof this.progressBar !== 'undefined' ){
this.progressBar.stop().css({'width':0});
}
// height resize
if( $(this).data('theme_opt_auto_resize') ){
var h = $( d.next ).find(options.content_container).outerHeight() + 100,
setHeight = h > this.sliderHeight ? h : this.sliderHeight;
$(d.next).css({
height : setHeight
});
self.center_img( d.next );
$(this)
.css({
'max-height':'none'
})
.animate({
'height' : setHeight
},{
queue: false,
duration:resizeDuration ,
complete: function(){
$(this).css({'max-height':setHeight});
}
});// end animate
}
// end height resize
}
var resize = function(){
var self = this,
options = this.settings();
// height resize
if( $(this).data('theme_opt_auto_resize') ){
var h = $( this.get_current() ).find(options.content_container).outerHeight() + 100;
this.sliderHeight = $(this).height();;
var setHeight = h > this.sliderHeight ? h : this.sliderHeight;
$( this.get_current() ).css({
height: setHeight
});
self.center_img( self.get_current() );
$(this)
.css({
'max-height':'none',
'height':this.sliderHeight
})
.animate({
'height' : setHeight
},{
queue: false,
duration:resizeDuration ,
complete: function(){
$(this).css({'max-height':setHeight});
}
});
}
// end height resize
}
var after = function(){
var options = this.settings(),
self = this,
duration = options.slide_duration;
//self.center_current_img();
if( this.mouseOver || this.stopped || !options.auto_slide ){
return;
}
if( typeof this.progressBar !== 'undefined' ){
this.progressBar.css({width:0}).animate(
{'width' : '100%'},
{duration: duration, queue:false, complete: function(){
$(this).css({'width':0});
}
});
}
}
var stop = function(){
if( typeof this.progressBar !== 'undefined' ){
this.progressBar.stop().css({'width':0});
}
this.mouseOver = true;
}
var start = function(){
this.mouseOver = false;
if( this.animating() ){
return;
}
var options = this.settings(),
duration = options.slide_duration;
if( typeof this.progressBar !== 'undefined' ){
this.progressBar.css({width:0}).animate(
{'width' : '100%'},
{duration: duration, queue:false, complete: function(){
$(this).css({'width':0});
}
});
}
}
})(jQuery); | vrxm/htdocs | wp-content/plugins/featured-articles-lite/themes/simple/starter.dev.js | JavaScript | gpl-2.0 | 4,040 |
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2000,2007 Oracle. All rights reserved.
*
* $Id: TestTruncate.cpp,v 12.5 2007/05/17 15:15:57 bostic Exp $
*/
/*
* Do some regression tests for constructors.
* Run normally (without arguments) it is a simple regression test.
* Run with a numeric argument, it repeats the regression a number
* of times, to try to determine if there are memory leaks.
*/
#include <db_cxx.h>
#include <iostream.h>
int main(int argc, char *argv[])
{
try {
Db *db = new Db(NULL, 0);
db->open(NULL, "my.db", NULL, DB_BTREE, DB_CREATE, 0644);
// populate our massive database.
// all our strings include null for convenience.
// Note we have to cast for idiomatic
// usage, since newer gcc requires it.
Dbt *keydbt = new Dbt((char*)"key", 4);
Dbt *datadbt = new Dbt((char*)"data", 5);
db->put(NULL, keydbt, datadbt, 0);
// Now, retrieve. We could use keydbt over again,
// but that wouldn't be typical in an application.
Dbt *goodkeydbt = new Dbt((char*)"key", 4);
Dbt *badkeydbt = new Dbt((char*)"badkey", 7);
Dbt *resultdbt = new Dbt();
resultdbt->set_flags(DB_DBT_MALLOC);
int ret;
if ((ret = db->get(NULL, goodkeydbt, resultdbt, 0)) != 0) {
cout << "get: " << DbEnv::strerror(ret) << "\n";
}
else {
char *result = (char *)resultdbt->get_data();
cout << "got data: " << result << "\n";
}
if ((ret = db->get(NULL, badkeydbt, resultdbt, 0)) != 0) {
// We expect this...
cout << "get using bad key: "
<< DbEnv::strerror(ret) << "\n";
}
else {
char *result = (char *)resultdbt->get_data();
cout << "*** got data using bad key!!: "
<< result << "\n";
}
// Now, truncate and make sure that it's really gone.
cout << "truncating data...\n";
u_int32_t nrecords;
db->truncate(NULL, &nrecords, 0);
cout << "truncate returns " << nrecords << "\n";
if ((ret = db->get(NULL, goodkeydbt, resultdbt, 0)) != 0) {
// We expect this...
cout << "after truncate get: "
<< DbEnv::strerror(ret) << "\n";
}
else {
char *result = (char *)resultdbt->get_data();
cout << "got data: " << result << "\n";
}
db->close(0);
cout << "finished test\n";
}
catch (DbException &dbe) {
cerr << "Db Exception: " << dbe.what();
}
return 0;
}
| nologic/nabs | client/trunk/shared/db/db-4.6.21/test/scr015/TestTruncate.cpp | C++ | gpl-2.0 | 2,315 |
var rcp_validating_discount = false;
var rcp_validating_gateway = false;
var rcp_validating_level = false;
var rcp_processing = false;
jQuery(document).ready(function($) {
// Initial validation of subscription level and gateway options
rcp_validate_form( true );
// Trigger gateway change event when gateway option changes
$('#rcp_payment_gateways select, #rcp_payment_gateways input').change( function() {
$('body').trigger( 'rcp_gateway_change' );
});
// Trigger subscription level change event when level selection changes
$('.rcp_level').change(function() {
$('body').trigger( 'rcp_level_change' );
});
$('body').on( 'rcp_gateway_change', function() {
rcp_validate_form( true );
}).on( 'rcp_level_change', function() {
rcp_validate_form( true );
});
// Validate discount code
$('#rcp_apply_discount').on( 'click', function(e) {
e.preventDefault();
rcp_validate_discount();
});
$(document).on('click', '#rcp_registration_form #rcp_submit', function(e) {
var submission_form = document.getElementById('rcp_registration_form');
var form = $('#rcp_registration_form');
if( typeof submission_form.checkValidity === "function" && false === submission_form.checkValidity() ) {
return;
}
e.preventDefault();
var submit_register_text = $(this).val();
form.block({
message: rcp_script_options.pleasewait,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
$('#rcp_submit', form).val( rcp_script_options.pleasewait );
// Don't allow form to be submitted multiple times simultaneously
if( rcp_processing ) {
return;
}
rcp_processing = true;
$.post( rcp_script_options.ajaxurl, form.serialize() + '&action=rcp_process_register_form&rcp_ajax=true', function(response) {
$('.rcp-submit-ajax', form).remove();
$('.rcp_message.error', form).remove();
if ( response.success ) {
$('body').trigger( 'rcp_register_form_submission' );
$(submission_form).submit();
} else {
$('#rcp_submit', form).val( submit_register_text );
$('#rcp_submit', form).before( response.data.errors );
$('#rcp_register_nonce', form).val( response.data.nonce );
form.unblock();
rcp_processing = false;
}
}).done(function( response ) {
}).fail(function( response ) {
console.log( response );
}).always(function( response ) {
});
});
});
function rcp_validate_form( validate_gateways ) {
// Validate the subscription level
rcp_validate_subscription_level();
if( validate_gateways ) {
// Validate the discount selected gateway
rcp_validate_gateways();
}
rcp_validate_discount();
}
function rcp_validate_subscription_level() {
if( rcp_validating_level ) {
return;
}
var $ = jQuery;
var is_free = false;
var options = [];
var level = jQuery( '#rcp_subscription_levels input:checked' );
var full = $('.rcp_gateway_fields').hasClass( 'rcp_discounted_100' );
rcp_validating_level = true;
if( level.attr('rel') == 0 ) {
is_free = true;
}
if( is_free ) {
$('.rcp_gateway_fields,#rcp_auto_renew_wrap,#rcp_discount_code_wrap').hide();
$('.rcp_gateway_fields').removeClass( 'rcp_discounted_100' );
$('#rcp_discount_code_wrap input').val('');
$('.rcp_discount_amount,#rcp_gateway_extra_fields').remove();
$('.rcp_discount_valid, .rcp_discount_invalid').hide();
$('#rcp_auto_renew_wrap input').attr('checked', false);
} else {
if( full ) {
$('#rcp_gateway_extra_fields').remove();
} else {
$('.rcp_gateway_fields,#rcp_auto_renew_wrap').show();
}
$('#rcp_discount_code_wrap').show();
}
rcp_validating_level = false;
}
function rcp_validate_gateways() {
if( rcp_validating_gateway ) {
return;
}
var $ = jQuery;
var form = $('#rcp_registration_form');
var is_free = false;
var options = [];
var level = jQuery( '#rcp_subscription_levels input:checked' );
var full = $('.rcp_gateway_fields').hasClass( 'rcp_discounted_100' );
var gateway;
rcp_validating_gateway = true;
if( level.attr('rel') == 0 ) {
is_free = true;
}
$('.rcp_message.error', form).remove();
if( $('#rcp_payment_gateways').length > 0 ) {
gateway = $( '#rcp_payment_gateways select option:selected' );
if( gateway.length < 1 ) {
// Support radio input fields
gateway = $( 'input[name="rcp_gateway"]:checked' );
}
} else {
gateway = $( 'input[name="rcp_gateway"]' );
}
if( is_free ) {
$('.rcp_gateway_fields').hide();
$('#rcp_auto_renew_wrap').hide();
$('#rcp_auto_renew_wrap input').attr('checked', false);
$('#rcp_gateway_extra_fields').remove();
} else {
if( full ) {
$('#rcp_gateway_extra_fields').remove();
} else {
form.block({
message: rcp_script_options.pleasewait,
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
$('.rcp_gateway_fields').show();
var data = { action: 'rcp_load_gateway_fields', rcp_gateway: gateway.val() };
$.post( rcp_script_options.ajaxurl, data, function(response) {
$('#rcp_gateway_extra_fields').remove();
if( response.success && response.data.fields ) {
if( $('.rcp_gateway_fields' ).length ) {
$( '<div class="rcp_gateway_' + gateway.val() + '_fields" id="rcp_gateway_extra_fields">' + response.data.fields + '</div>' ).insertAfter('.rcp_gateway_fields');
} else {
// Pre 2.1 template files
$( '<div class="rcp_gateway_' + gateway.val() + '_fields" id="rcp_gateway_extra_fields">' + response.data.fields + '</div>' ).insertAfter('.rcp_gateways_fieldset');
}
}
form.unblock();
});
}
if( 'yes' == gateway.data( 'supports-recurring' ) && ! full ) {
$('#rcp_auto_renew_wrap').show();
} else {
$('#rcp_auto_renew_wrap').hide();
$('#rcp_auto_renew_wrap input').attr('checked', false);
}
$('#rcp_discount_code_wrap').show();
}
rcp_validating_gateway = false;
}
function rcp_validate_discount() {
if( rcp_validating_discount ) {
return;
}
var $ = jQuery;
var gateway_fields = $('.rcp_gateway_fields');
var discount = $('#rcp_discount_code').val();
if( $('#rcp_subscription_levels input:checked').length ) {
var subscription = $('#rcp_subscription_levels input:checked').val();
} else {
var subscription = $('input[name="rcp_level"]').val();
}
if( ! discount ) {
return;
}
var data = {
action: 'validate_discount',
code: discount,
subscription_id: subscription
};
rcp_validating_discount = true;
$.post(rcp_script_options.ajaxurl, data, function(response) {
$('.rcp_discount_amount').remove();
$('.rcp_discount_valid, .rcp_discount_invalid').hide();
if( ! response.valid ) {
// code is invalid
$('.rcp_discount_invalid').show();
gateway_fields.removeClass('rcp_discounted_100');
$('.rcp_gateway_fields,#rcp_auto_renew_wrap').show();
} else if( response.valid ) {
// code is valid
$('.rcp_discount_valid').show();
$('#rcp_discount_code_wrap label').append( '<span class="rcp_discount_amount"> - ' + response.amount + '</span>' );
if( response.full ) {
$('#rcp_auto_renew_wrap').hide();
gateway_fields.hide().addClass('rcp_discounted_100');
$('#rcp_gateway_extra_fields').remove();
} else {
$('#rcp_auto_renew_wrap').show();
gateway_fields.show().removeClass('rcp_discounted_100');
}
}
rcp_validating_discount = false;
$('body').trigger('rcp_discount_applied', [ response ] );
});
} | CGCookie/Restrict-Content-Pro | includes/js/register.js | JavaScript | gpl-2.0 | 7,721 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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.
#
# EventGhost 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 EventGhost. If not, see <http://www.gnu.org/licenses/>.
import inspect
import os
import sys
import threading
import time
import wx
from CommonMark import commonmark
from ctypes import c_ulonglong, windll
from datetime import datetime as dt, timedelta as td
from docutils.core import publish_parts as ReSTPublishParts
from docutils.writers.html4css1 import Writer
from functools import update_wrapper
from os.path import abspath, dirname, exists, join
from types import ClassType
# Local imports
import eg
__all__ = [
"Bunch", "NotificationHandler", "LogIt", "LogItWithReturn", "TimeIt",
"AssertInMainThread", "AssertInActionThread", "ParseString", "SetDefault",
"EnsureVisible", "VBoxSizer", "HBoxSizer", "EqualizeWidths", "AsTasklet",
"ExecFile", "GetTopLevelWindow",
]
USER_CLASSES = (type, ClassType)
class Bunch(object):
"""
Universal collection of a bunch of named stuff.
Often we want to just collect a bunch of stuff together, naming each
item of the bunch. A dictionary is OK for that; however, when names are
constants and to be used just like variables, the dictionary-access syntax
("if bunch['squared'] > threshold", etc) is not maximally clear. It takes
very little effort to build a little class, as in this 'Bunch', that will
both ease the initialisation task and provide elegant attribute-access
syntax ("if bunch.squared > threshold", etc).
Usage is simple::
point = eg.Bunch(x=100, y=200)
# and of course you can read/write the named
# attributes you just created, add others, del
# some of them, etc, etc:
point.squared = point.x * point.y
if point.squared > threshold:
point.isok = True
"""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class HBoxSizer(wx.BoxSizer): #IGNORE:R0904
def __init__(self, *items):
wx.BoxSizer.__init__(self, wx.HORIZONTAL)
self.AddMany(items)
class MyHtmlDocWriter(Writer):
def apply_template(self):
return """\
%(head_prefix)s
%(head)s
%(stylesheet)s
%(body_prefix)s
%(body_pre_docinfo)s
%(docinfo)s
%(body)s
%(body_suffix)s
""" % self.interpolation_dict()
HTML_DOC_WRITER = MyHtmlDocWriter()
class NotificationHandler(object):
__slots__ = ["listeners"]
def __init__(self):
self.listeners = []
class VBoxSizer(wx.BoxSizer): #IGNORE:R0904
def __init__(self, *items):
wx.BoxSizer.__init__(self, wx.VERTICAL)
self.AddMany(items)
def AppUrl(description, url):
if url:
txt = '<p><div align=right><i><font color="#999999" size=-1>%s <a href="%s">%s</a>.</font></i></div></p>' % (
eg.text.General.supportSentence,
url,
eg.text.General.supportLink
)
else:
return description
if description.startswith("<md>"):
description = description[4:]
description = DecodeMarkdown(description)
elif description.startswith("<rst>"):
description = description[5:]
description = DecodeReST(description)
return description + txt
def AssertInActionThread(func):
if not eg.debugLevel:
return func
def AssertWrapper(*args, **kwargs):
if eg.actionThread._ThreadWorker__thread != threading.currentThread():
raise AssertionError(
"Called outside ActionThread: %s() in %s" %
(func.__name__, func.__module__)
)
return func(*args, **kwargs)
return func(*args, **kwargs)
return update_wrapper(AssertWrapper, func)
def AssertInMainThread(func):
if not eg.debugLevel:
return func
def AssertWrapper(*args, **kwargs):
if eg.mainThread != threading.currentThread():
raise AssertionError(
"Called outside MainThread: %s in %s" %
(func.__name__, func.__module__)
)
return func(*args, **kwargs)
return update_wrapper(AssertWrapper, func)
def AsTasklet(func):
def Wrapper(*args, **kwargs):
eg.Tasklet(func)(*args, **kwargs).run()
return update_wrapper(Wrapper, func)
def CollectGarbage():
import gc
#gc.set_debug(gc.DEBUG_SAVEALL)
#gc.set_debug(gc.DEBUG_UNCOLLECTABLE)
from pprint import pprint
print "threshold:", gc.get_threshold()
print "unreachable object count:", gc.collect()
garbageList = gc.garbage[:]
for i, obj in enumerate(garbageList):
print "Object Num %d:" % i
pprint(obj)
#print "Referrers:"
#print(gc.get_referrers(o))
#print "Referents:"
#print(gc.get_referents(o))
print "Done."
#print "unreachable object count:", gc.collect()
#from pprint import pprint
#pprint(gc.garbage)
def DecodeMarkdown(source):
return commonmark(source)
def DecodeReST(source):
#print repr(source)
res = ReSTPublishParts(
source=PrepareDocstring(source),
writer=HTML_DOC_WRITER,
settings_overrides={"stylesheet_path": ""}
)
#print repr(res)
return res['body']
def EnsureVisible(window):
"""
Ensures the given wx.TopLevelWindow is visible on the screen.
Moves and resizes it if necessary.
"""
from eg.WinApi.Dynamic import (
sizeof, byref, GetMonitorInfo, MonitorFromWindow, GetWindowRect,
MONITORINFO, RECT, MONITOR_DEFAULTTONEAREST,
# MonitorFromRect, MONITOR_DEFAULTTONULL,
)
hwnd = window.GetHandle()
windowRect = RECT()
GetWindowRect(hwnd, byref(windowRect))
#hMonitor = MonitorFromRect(byref(windowRect), MONITOR_DEFAULTTONULL)
#if hMonitor:
# return
parent = window.GetParent()
if parent:
hwnd = parent.GetHandle()
hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)
monInfo = MONITORINFO()
monInfo.cbSize = sizeof(MONITORINFO)
GetMonitorInfo(hMonitor, byref(monInfo))
displayRect = monInfo.rcWork
left = windowRect.left
right = windowRect.right
top = windowRect.top
bottom = windowRect.bottom
# shift the window horizontally into the display area
if left < displayRect.left:
right += (displayRect.left - left)
left = displayRect.left
if right > displayRect.right:
right = displayRect.right
elif right > displayRect.right:
left += (displayRect.right - right)
right = displayRect.right
if left < displayRect.left:
left = displayRect.left
# shift the window vertically into the display area
if top < displayRect.top:
bottom += (displayRect.top - top)
top = displayRect.top
if bottom > displayRect.bottom:
bottom = displayRect.bottom
elif bottom > displayRect.bottom:
top += (displayRect.bottom - bottom)
bottom = displayRect.bottom
if top < displayRect.top:
top = displayRect.top
# set the new position and size
window.SetRect((left, top, right - left, bottom - top))
def EqualizeWidths(ctrls):
maxWidth = max((ctrl.GetBestSize()[0] for ctrl in ctrls))
for ctrl in ctrls:
ctrl.SetMinSize((maxWidth, -1))
def ExecFile(filename, globals=None, locals=None):
"""
Replacement for the Python built-in execfile() function, but handles
unicode filenames right.
"""
FSE = sys.getfilesystemencoding()
flnm = filename.encode(FSE) if isinstance(filename, unicode) else filename
return execfile(flnm, globals, locals)
def GetBootTimestamp(unix_timestamp = True):
"""
Returns the time of the last system boot.
If unix_timestamp == True, result is a unix temestamp.
Otherwise it is in human readable form.
"""
now = time.time()
GetTickCount64 = windll.kernel32.GetTickCount64
GetTickCount64.restype = c_ulonglong
up = GetTickCount64() / 1000.0
if not unix_timestamp:
st = str(dt.fromtimestamp(now - up))
return st if "." not in st else st[:st.index(".")]
return now - up
def GetClosestLanguage():
"""
Returns the language file closest to system locale.
"""
langDir = join(dirname(abspath(sys.executable)), "languages")
if exists(langDir):
locale = wx.Locale()
name = locale.GetLanguageCanonicalName(locale.GetSystemLanguage())
if exists(join(langDir, name + ".py")):
return name
else:
for f in [f for f in os.listdir(langDir) if f.endswith(".py")]:
if f.startswith(name[0:3]):
return f[0:5]
return "en_EN"
def GetFirstParagraph(text):
"""
Return the first paragraph of a description string.
The string can be encoded in HTML or reStructuredText.
The paragraph is returned as HTML.
"""
text = text.lstrip()
if text.startswith("<md>"):
text = text[4:]
text = DecodeMarkdown(text)
start = text.find("<p>")
end = text.find("</p>")
return text[start + 3:end].replace("\n", " ")
elif text.startswith("<rst>"):
text = text[5:]
text = DecodeReST(text)
start = text.find("<p>")
end = text.find("</p>")
return text[start + 3:end].replace("\n", " ")
else:
result = ""
for line in text.splitlines():
if line == "":
break
result += " " + line
return ' '.join(result.split())
def GetFuncArgString(func, args, kwargs):
classname = ""
argnames = inspect.getargspec(func)[0]
start = 0
if argnames:
if argnames[0] == "self":
classname = args[0].__class__.__name__ + "."
start = 1
res = []
append = res.append
for key, value in zip(argnames, args)[start:]:
append(str(key) + GetMyRepresentation(value))
for key, value in kwargs.items():
append(str(key) + GetMyRepresentation(value))
fname = classname + func.__name__
return fname, "(" + ", ".join(res) + ")"
def GetMyRepresentation(value):
"""
Give a shorter representation of some wx-objects. Returns normal repr()
for everything else. Also adds a "=" sign at the beginning to make it
useful as a "formatvalue" function for inspect.formatargvalues().
"""
typeString = repr(type(value))
if typeString.startswith("<class 'wx._core."):
return "=<wx.%s>" % typeString[len("<class 'wx._core."): -2]
if typeString.startswith("<class 'wx._controls."):
return "=<wx.%s>" % typeString[len("<class 'wx._controls."): -2]
return "=" + repr(value)
def GetTopLevelWindow(window):
"""
Returns the top level parent window of a wx.Window. This is in most
cases a wx.Dialog or wx.Frame.
"""
result = window
while True:
parent = result.GetParent()
if parent is None:
return result
elif isinstance(parent, wx.TopLevelWindow):
return parent
result = parent
def GetUpTime(seconds = True):
"""
Returns a runtime of system in seconds.
If seconds == False, returns the number of days, hours, minutes and seconds.
"""
GetTickCount64 = windll.kernel32.GetTickCount64
GetTickCount64.restype = c_ulonglong
ticks = GetTickCount64() / 1000.0
if not seconds:
delta = str(td(seconds = ticks))
return delta if "." not in delta else delta[:delta.index(".")]
return ticks
def IsVista():
"""
Determine if we're running Vista or higher.
"""
return (sys.getwindowsversion()[0] >= 6)
def IsXP():
"""
Determine if we're running XP or higher.
"""
return (sys.getwindowsversion()[0:2] >= (5, 1))
def LogIt(func):
"""
Logs the function call, if eg.debugLevel is set.
"""
if not eg.debugLevel:
return func
if func.func_code.co_flags & 0x20:
raise TypeError("Can't wrap generator function")
def LogItWrapper(*args, **kwargs):
funcName, argString = GetFuncArgString(func, args, kwargs)
eg.PrintDebugNotice(funcName + argString)
return func(*args, **kwargs)
return update_wrapper(LogItWrapper, func)
def LogItWithReturn(func):
"""
Logs the function call and return, if eg.debugLevel is set.
"""
if not eg.debugLevel:
return func
def LogItWithReturnWrapper(*args, **kwargs):
funcName, argString = GetFuncArgString(func, args, kwargs)
eg.PrintDebugNotice(funcName + argString)
result = func(*args, **kwargs)
eg.PrintDebugNotice(funcName + " => " + repr(result))
return result
return update_wrapper(LogItWithReturnWrapper, func)
def ParseString(text, filterFunc=None):
start = 0
chunks = []
last = len(text) - 1
while 1:
pos = text.find('{', start)
if pos < 0:
break
if pos == last:
break
chunks.append(text[start:pos])
if text[pos + 1] == '{':
chunks.append('{')
start = pos + 2
else:
start = pos + 1
end = text.find('}', start)
if end == -1:
raise SyntaxError("unmatched bracket")
word = text[start:end]
res = None
if filterFunc:
res = filterFunc(word)
if res is None:
res = eval(word, {}, eg.globals.__dict__)
chunks.append(unicode(res))
start = end + 1
chunks.append(text[start:])
return "".join(chunks)
def PrepareDocstring(docstring):
"""
Convert a docstring into lines of parseable reST. Return it as a list of
lines usable for inserting into a docutils ViewList (used as argument
of nested_parse()). An empty line is added to act as a separator between
this docstring and following content.
"""
lines = docstring.expandtabs().splitlines()
# Find minimum indentation of any non-blank lines after first line.
margin = sys.maxint
for line in lines[1:]:
content = len(line.lstrip())
if content:
indent = len(line) - content
margin = min(margin, indent)
# Remove indentation.
if lines:
lines[0] = lines[0].lstrip()
if margin < sys.maxint:
for i in range(1, len(lines)):
lines[i] = lines[i][margin:]
# Remove any leading blank lines.
while lines and not lines[0]:
lines.pop(0)
# make sure there is an empty line at the end
if lines and lines[-1]:
lines.append('')
return "\n".join(lines)
def Reset():
eg.stopExecutionFlag = True
eg.programCounter = None
del eg.programReturnStack[:]
eg.eventThread.ClearPendingEvents()
eg.actionThread.ClearPendingEvents()
eg.PrintError("Execution stopped by user")
def SetDefault(targetCls, defaultCls):
targetDict = targetCls.__dict__
for defaultKey, defaultValue in defaultCls.__dict__.iteritems():
if defaultKey not in targetDict:
setattr(targetCls, defaultKey, defaultValue)
elif type(defaultValue) in USER_CLASSES:
SetDefault(targetDict[defaultKey], defaultValue)
def SplitFirstParagraph(text):
"""
Split the first paragraph of a description string.
The string can be encoded in HTML or reStructuredText.
The paragraph is returned as HTML.
"""
text = text.lstrip()
if text.startswith("<md>"):
text = text[4:]
text = DecodeMarkdown(text)
start = text.find("<p>")
end = text.find("</p>")
return (
text[start + 3:end].replace("\n", " "),
text[end + 4:].replace("\n", " ")
)
elif text.startswith("<rst>"):
text = text[5:]
text = DecodeReST(text)
start = text.find("<p>")
end = text.find("</p>")
return (
text[start + 3:end].replace("\n", " "),
text[end + 4:].replace("\n", " ")
)
else:
result = ""
remaining = ""
lines = text.splitlines()
for i, line in enumerate(lines):
if line.strip() == "":
remaining = " ".join(lines[i:])
break
result += " " + line
return ' '.join(result.split()), remaining
def TimeIt(func):
""" Decorator to measure the execution time of a function.
Will print the time to the log.
"""
if not eg.debugLevel:
return func
def TimeItWrapper(*args, **kwargs):
startTime = time.clock()
funcName, _ = GetFuncArgString(func, args, kwargs)
res = func(*args, **kwargs)
eg.PrintDebugNotice(funcName + " :" + repr(time.clock() - startTime))
return res
return update_wrapper(TimeItWrapper, func)
def UpdateStartupShortcut(create):
from eg import Shortcut
path = os.path.join(
eg.folderPath.Startup,
eg.APP_NAME + ".lnk"
)
if os.path.exists(path):
os.remove(path)
if create:
if not os.path.exists(eg.folderPath.Startup):
os.makedirs(eg.folderPath.Startup)
Shortcut.Create(
path=path,
target=os.path.abspath(sys.executable),
arguments="-h -e OnInitAfterBoot",
startIn=os.path.dirname(os.path.abspath(sys.executable)),
)
| WoLpH/EventGhost | eg/Utils.py | Python | gpl-2.0 | 17,930 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Transform;
import Objects.TagList;
import java.util.ArrayList;
import java.util.Collections;
/**
*
* @author SHKim12
*/
public class QuantileTransform implements Transform {
public QuantileTransform( TagList l ) {
if( l.size() == 0 ) m_QuantileVector = null;
ArrayList<Float> totalList = new ArrayList<>();
totalList.addAll(l);
Collections.sort(totalList);
int qvSize = QUANTILE_RESOLUTION<totalList.size()?QUANTILE_RESOLUTION:totalList.size();
m_QuantileVector = new ArrayList<>();
for( int i = 0; i < qvSize; ++i ) {
m_QuantileVector.add( totalList.get( i * totalList.size() / qvSize ) );
}
}
@Override
public float transform( float v ) {
int s = 0;
int e = m_QuantileVector.size();
int m = s;
while( s < e - 1) {
m = (s+e)/2;
Float mv = m_QuantileVector.get(m);
if( mv < v ) s = m;
else if( v < mv ) e = m;
else break;
}
return m / (float)(m_QuantileVector.size() - 1);
}
public final static int QUANTILE_RESOLUTION = 1000;
ArrayList<Float> m_QuantileVector;
}
| epigenome/iTagPlot | src/Transform/QuantileTransform.java | Java | gpl-2.0 | 1,436 |
<?php
defined('TYPO3_MODE') or die();
if (TYPO3_MODE === 'BE') {
$GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'][] = array(
'name' => \TYPO3\CMS\Impexp\Clickmenu::class
);
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']['impexp'][\TYPO3\CMS\Impexp\Task\ImportExportTask::class] = array(
'title' => 'LLL:EXT:impexp/Resources/Private/Language/locallang_csh.xlf:.alttitle',
'description' => 'LLL:EXT:impexp/Resources/Private/Language/locallang_csh.xlf:.description',
'icon' => 'EXT:impexp/Resources/Public/Images/export.gif'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('xMOD_tx_impexp', 'EXT:impexp/Resources/Private/Language/locallang_csh.xlf');
// Special context menu actions for the import/export module
$importExportActions = '
9000 = DIVIDER
9100 = ITEM
9100 {
name = exportT3d
label = LLL:EXT:impexp/Resources/Private/Language/locallang.xlf:export
iconName = actions-document-export-t3d
callbackAction = exportT3d
}
9200 = ITEM
9200 {
name = importT3d
label = LLL:EXT:impexp/Resources/Private/Language/locallang.xlf:import
iconName = actions-document-import-t3d
callbackAction = importT3d
}
';
// Context menu user default configuration
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('
options.contextMenu.table {
virtual_root.items {
' . $importExportActions . '
}
pages_root.items {
' . $importExportActions . '
}
pages.items.1000 {
' . $importExportActions . '
}
}
');
unset($importExportActions);
// Hook into page tree context menu to remove "import" items again if user is not admin or module
// is not enabled for this user / group
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['backend']['contextMenu']['disableItems'][]
= \TYPO3\CMS\Impexp\Hook\ContextMenuDisableItemsHook::class . '->disableImportForNonAdmin';
}
| michaelklapper/TYPO3.CMS | typo3/sysext/impexp/ext_tables.php | PHP | gpl-2.0 | 1,975 |
package com.kartoflane.superluminal2.components.interfaces;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
public interface Redrawable extends PaintListener
{
/**
* Calls paintControl if the object is visible.
*/
public void redraw( PaintEvent e );
}
| kartoFlane/superluminal2 | src/java/com/kartoflane/superluminal2/components/interfaces/Redrawable.java | Java | gpl-2.0 | 300 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.Components
{
public interface IDriver
{
string Id { get; }
string FirstName { get; }
string MiddleName { get; }
string Surname { get; }
string IdentityCardNumber { get; }
string ContactNumber { get; }
IVehicle Vehicle { get; }
void LinkVehicleToDriver(IVehicle vehicle);
}
}
| beyonblock/TheTransportationProjectPrototype | TheTransportationPrototype/Core.Components/Contracts/IDriver.cs | C# | gpl-2.0 | 493 |
<?php
/* Generated on 6/26/15 3:23 AM by globalsync
* $Id: $
* $Log: $
*/
require_once 'EbatNs_ComplexType.php';
require_once 'PaymentInformationType.php';
require_once 'RefundInformationType.php';
/**
* This type defines the <strong>MonetaryDetails</strong> container, which consists of detailed information about one or more exchanges of funds that occur between the buyer, seller, eBay, and eBay partners during the lifecycle of an order, as well as detailed information about a merchant's refund (or store credit) to a buyer who has returned an In-Store Pickup item.
* <br/><br/>
* <span class="tablenote">
* <strong>Note:</strong> At this time, the In-Store Pickup feature is generally only available to large retail merchants, and can only be applied to multi-quantity, fixed-price listings.
* </span>
*
**/
class PaymentsInformationType extends EbatNs_ComplexType
{
/**
* @var PaymentInformationType
**/
protected $Payments;
/**
* @var RefundInformationType
**/
protected $Refunds;
/**
* Class Constructor
**/
function __construct()
{
parent::__construct('PaymentsInformationType', 'urn:ebay:apis:eBLBaseComponents');
if (!isset(self::$_elements[__CLASS__]))
{
self::$_elements[__CLASS__] = array_merge(self::$_elements[get_parent_class()],
array(
'Payments' =>
array(
'required' => false,
'type' => 'PaymentInformationType',
'nsURI' => 'urn:ebay:apis:eBLBaseComponents',
'array' => false,
'cardinality' => '0..1'
),
'Refunds' =>
array(
'required' => false,
'type' => 'RefundInformationType',
'nsURI' => 'urn:ebay:apis:eBLBaseComponents',
'array' => false,
'cardinality' => '0..1'
)));
}
$this->_attributes = array_merge($this->_attributes,
array(
));
}
/**
* @return PaymentInformationType
**/
function getPayments()
{
return $this->Payments;
}
/**
* @return void
**/
function setPayments($value)
{
$this->Payments = $value;
}
/**
* @return RefundInformationType
**/
function getRefunds()
{
return $this->Refunds;
}
/**
* @return void
**/
function setRefunds($value)
{
$this->Refunds = $value;
}
}
?>
| booklein/wpbookle | wp-content/plugins/wp-lister-for-ebay/includes/EbatNs/PaymentsInformationType.php | PHP | gpl-2.0 | 2,188 |
package com.yh.admin.roles.service;
/**
*
* @author zhangqp
* @version 1.0, 16/08/23
*/
public class RoleFuncService {
}
| meijmOrg/Repo-test | freelance-admin/src/java/com/yh/admin/roles/service/RoleFuncService.java | Java | gpl-2.0 | 129 |
/*
* Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.io;
import sun.nio.cs.ISO_8859_7;
/**
* A table to convert ISO8859_7 to Unicode
*
* @author ConverterGenerator tool
*/
public class ByteToCharISO8859_7 extends ByteToCharSingleByte {
private final static ISO_8859_7 nioCoder = new ISO_8859_7();
public String getCharacterEncoding() {
return "ISO8859_7";
}
public ByteToCharISO8859_7() {
super.byteToCharTable = nioCoder.getDecoderSingleByteMappings();
}
}
| TheTypoMaster/Scaper | openjdk/jdk/src/share/classes/sun/io/ByteToCharISO8859_7.java | Java | gpl-2.0 | 1,672 |
/*
* Copyright (C) 2011-2017 Redis Labs Ltd.
*
* This file is part of memtier_benchmark.
*
* memtier_benchmark is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
*
* memtier_benchmark 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 memtier_benchmark. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include "run_stats_types.h"
one_sec_cmd_stats::one_sec_cmd_stats() :
m_bytes(0),
m_ops(0),
m_hits(0),
m_misses(0),
m_moved(0),
m_ask(0),
m_total_latency(0) {
}
void one_sec_cmd_stats::reset() {
m_bytes = 0;
m_ops = 0;
m_hits = 0;
m_misses = 0;
m_moved = 0;
m_ask = 0;
m_total_latency = 0;
hdr_reset(latency_histogram);
}
void one_sec_cmd_stats::merge(const one_sec_cmd_stats& other) {
m_bytes += other.m_bytes;
m_ops += other.m_ops;
m_hits += other.m_hits;
m_misses += other.m_misses;
m_moved += other.m_moved;
m_ask += other.m_ask;
m_total_latency += other.m_total_latency;
hdr_add(latency_histogram,other.latency_histogram);
}
void one_sec_cmd_stats::update_op(unsigned int bytes, unsigned int latency) {
m_bytes += bytes;
m_ops++;
m_total_latency += latency;
hdr_record_value(latency_histogram,latency);
}
void one_sec_cmd_stats::update_op(unsigned int bytes, unsigned int latency,
unsigned int hits, unsigned int misses) {
update_op(bytes, latency);
m_hits += hits;
m_misses += misses;
}
void one_sec_cmd_stats::update_moved_op(unsigned int bytes, unsigned int latency) {
update_op(bytes, latency);
m_moved++;
}
void one_sec_cmd_stats::update_ask_op(unsigned int bytes, unsigned int latency) {
update_op(bytes, latency);
m_ask++;
}
void ar_one_sec_cmd_stats::setup(size_t n_arbitrary_commands) {
m_commands.resize(n_arbitrary_commands);
reset();
}
void ar_one_sec_cmd_stats::reset() {
for (size_t i = 0; i<m_commands.size(); i++) {
m_commands[i].reset();
}
}
void ar_one_sec_cmd_stats::merge(const ar_one_sec_cmd_stats& other) {
for (size_t i = 0; i<m_commands.size(); i++) {
m_commands[i].merge(other.m_commands[i]);
}
}
unsigned long int ar_one_sec_cmd_stats::ops() {
unsigned long int total_ops = 0;
for (size_t i = 0; i<m_commands.size(); i++) {
total_ops += m_commands[i].m_ops;
}
return total_ops;
}
unsigned long int ar_one_sec_cmd_stats::bytes() {
unsigned long int total_bytes = 0;
for (size_t i = 0; i<m_commands.size(); i++) {
total_bytes += m_commands[i].m_bytes;
}
return total_bytes;
}
unsigned long long int ar_one_sec_cmd_stats::total_latency() {
unsigned long long int latency = 0;
for (size_t i = 0; i<m_commands.size(); i++) {
latency += m_commands[i].m_total_latency;
}
return latency;
}
size_t ar_one_sec_cmd_stats::size() const {
return m_commands.size();
}
///////////////////////////////////////////////////////////////////////////
one_second_stats::one_second_stats(unsigned int second) :
m_set_cmd(),
m_get_cmd(),
m_wait_cmd(),
m_ar_commands()
{
reset(second);
}
void one_second_stats::setup_arbitrary_commands(size_t n_arbitrary_commands) {
m_ar_commands.setup(n_arbitrary_commands);
}
void one_second_stats::reset(unsigned int second) {
m_second = second;
m_get_cmd.reset();
m_set_cmd.reset();
m_wait_cmd.reset();
m_ar_commands.reset();
}
void one_second_stats::merge(const one_second_stats& other) {
m_get_cmd.merge(other.m_get_cmd);
m_set_cmd.merge(other.m_set_cmd);
m_wait_cmd.merge(other.m_wait_cmd);
m_ar_commands.merge(other.m_ar_commands);
}
///////////////////////////////////////////////////////////////////////////
totals_cmd::totals_cmd() :
m_ops_sec(0),
m_bytes_sec(0),
m_moved_sec(0),
m_ask_sec(0),
m_latency(0),
m_ops(0) {
}
void totals_cmd::add(const totals_cmd& other) {
m_ops_sec += other.m_ops_sec;
m_moved_sec += other.m_moved_sec;
m_ask_sec += other.m_ask_sec;
m_bytes_sec += other.m_bytes_sec;
m_latency += other.m_latency;
m_ops += other.m_ops;
}
void totals_cmd::aggregate_average(size_t stats_size) {
m_ops_sec /= stats_size;
m_moved_sec /= stats_size;
m_ask_sec /= stats_size;
m_bytes_sec /= stats_size;
m_latency /= stats_size;
}
void totals_cmd::summarize(const one_sec_cmd_stats& other, unsigned long test_duration_usec) {
m_ops = other.m_ops;
m_ops_sec = (double) other.m_ops / test_duration_usec * 1000000;
if (other.m_ops > 0) {
m_latency = (double) (other.m_total_latency / other.m_ops) / 1000;
} else {
m_latency = 0;
}
m_bytes_sec = (other.m_bytes / 1024.0) / test_duration_usec * 1000000;
m_moved_sec = (double) other.m_moved / test_duration_usec * 1000000;
m_ask_sec = (double) other.m_ask / test_duration_usec * 1000000;
}
void ar_totals_cmd::setup(size_t n_arbitrary_commands) {
m_commands.resize(n_arbitrary_commands);
}
void ar_totals_cmd::add(const ar_totals_cmd& other) {
for (size_t i = 0; i<m_commands.size(); i++) {
m_commands[i].add(other.m_commands[i]);
}
}
void ar_totals_cmd::aggregate_average(size_t stats_size) {
for (size_t i = 0; i<m_commands.size(); i++) {
m_commands[i].aggregate_average(stats_size);
}
}
void ar_totals_cmd::summarize(const ar_one_sec_cmd_stats& other, unsigned long test_duration_usec) {
for (size_t i = 0; i<m_commands.size(); i++) {
m_commands[i].summarize(other.at(i), test_duration_usec);
}
}
size_t ar_totals_cmd::size() const {
return m_commands.size();
}
///////////////////////////////////////////////////////////////////////////
totals::totals() :
m_set_cmd(),
m_get_cmd(),
m_wait_cmd(),
m_ar_commands(),
m_ops_sec(0),
m_bytes_sec(0),
m_hits_sec(0),
m_misses_sec(0),
m_moved_sec(0),
m_ask_sec(0),
m_latency(0),
m_bytes(0),
m_ops(0) {
}
void totals::setup_arbitrary_commands(size_t n_arbitrary_commands) {
m_ar_commands.setup(n_arbitrary_commands);
}
void totals::add(const totals& other) {
m_set_cmd.add(other.m_set_cmd);
m_get_cmd.add(other.m_get_cmd);
m_wait_cmd.add(other.m_wait_cmd);
m_ar_commands.add(other.m_ar_commands);
m_ops_sec += other.m_ops_sec;
m_hits_sec += other.m_hits_sec;
m_misses_sec += other.m_misses_sec;
m_moved_sec += other.m_moved_sec;
m_ask_sec += other.m_ask_sec;
m_bytes_sec += other.m_bytes_sec;
m_latency += other.m_latency;
m_bytes += other.m_bytes;
m_ops += other.m_ops;
// aggregate latency data
hdr_add(latency_histogram,other.latency_histogram);
}
void totals::update_op(unsigned long int bytes, unsigned int latency) {
m_bytes += bytes;
m_ops++;
m_latency += latency;
hdr_record_value(latency_histogram,latency);
}
| RedisLabs/memtier_benchmark | run_stats_types.cpp | C++ | gpl-2.0 | 7,429 |
/*
* Copyright 2011 David Jurgens
*
* This file is part of the S-Space package and is covered under the terms and
* conditions therein.
*
* The S-Space package is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation and distributed hereunder to you.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND NO REPRESENTATIONS OR WARRANTIES,
* EXPRESS OR IMPLIED ARE MADE. BY WAY OF EXAMPLE, BUT NOT LIMITATION, WE MAKE
* NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- ABILITY OR FITNESS FOR ANY
* PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE OR DOCUMENTATION
* WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER
* RIGHTS.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.ucla.sspace.graph;
import edu.ucla.sspace.util.Indexer;
import edu.ucla.sspace.util.ObjectIndexer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* A decorator around all graph types that allows vertices to take on arbitrary
* labels. This class does not directly implement {@link Graph} but rather
* exposes the backing graph through the {@link #graph()} method, which ensures
* that the backing graph is of the appropriate type (or subtype).
*
* <p> The view returned by {@link #graph()} is read-only with respect to
* vertices (i.e., edges may be added or removed). This ensures that all vertex
* additions or removals to the graph are made through this class.
*/
public class LabeledGraph<L,E extends Edge>
extends GraphAdaptor<E> implements java.io.Serializable {
private static final long serialVersionUID = 1L;
private final Graph<E> graph;
private final Indexer<L> vertexLabels;
public LabeledGraph(Graph<E> graph) {
this(graph, new ObjectIndexer<L>());
}
public LabeledGraph(Graph<E> graph, Indexer<L> vertexLabels) {
super(graph);
this.graph = graph;
this.vertexLabels = vertexLabels;
}
public boolean add(L vertexLabel) {
return add(vertexLabels.index(vertexLabel));
}
/**
* {@inheritDoc}
*
* @throws IllegalArgumentException if adding a vertex that has not
* previously been assigned a label
*/
public boolean add(int vertex) {
if (vertexLabels.lookup(vertex) == null)
throw new IllegalArgumentException("Cannot add a vertex without a label");
// The indexer may have already had the mapping without the graph having
// vertex, so check that the graph has the vertex
return super.add(vertex);
}
/**
* {@inheritDoc}
*/
@Override public LabeledGraph<L,E> copy(Set<Integer> vertices) {
Graph<E> g = super.copy(vertices);
// Create a copy of the labels.
// NOTE: this includes labels for vertices that may not be present in
// the new graph. Not sure if it's the correct behavior yet.
Indexer<L> labels = new ObjectIndexer<L>(vertexLabels);
return new LabeledGraph<L,E>(g, labels);
}
public boolean contains(L vertexLabel) {
return contains(vertexLabels.index(vertexLabel));
}
public boolean remove(L vertexLabel) {
return remove(vertexLabels.index(vertexLabel));
}
public String toString() {
StringBuilder sb = new StringBuilder(order() * 4 + size() * 10);
sb.append("vertices: [");
for (int v : vertices()) {
sb.append(vertexLabels.lookup(v)).append(',');
}
sb.setCharAt(sb.length() - 1, ']');
sb.append(" edges: [");
for (E e : edges()) {
L from = vertexLabels.lookup(e.from());
L to = vertexLabels.lookup(e.to());
String edge = (e instanceof DirectedEdge) ? "->" : "--";
sb.append('(').append(from).append(edge).append(to);
if (e instanceof TypedEdge) {
TypedEdge<?> t = (TypedEdge<?>)e;
sb.append(':').append(t.edgeType());
}
if (e instanceof WeightedEdge) {
WeightedEdge w = (WeightedEdge)e;
sb.append(", ").append(w.weight());
}
sb.append("), ");
}
sb.setCharAt(sb.length() - 2, ']');
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
} | fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/graph/LabeledGraph.java | Java | gpl-2.0 | 4,550 |
/*
* 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.
*
* For information about the authors of this project Have a look
* at the AUTHORS file in the root of this project.
*/
package net.sourceforge.fullsync.ui;
import java.util.Timer;
import java.util.TimerTask;
import javax.inject.Inject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
class SystemStatusPage extends WizardDialog {
private Label totalMemory;
private Label maxMemory;
private Label freeMemory;
private ProgressBar progressBarMemory;
private Timer timer;
private Composite content;
@Inject
public SystemStatusPage(Shell shell) {
super(shell);
}
@Override
public String getTitle() {
return Messages.getString("SystemStatusPage.Title"); //$NON-NLS-1$
}
@Override
public String getCaption() {
return Messages.getString("SystemStatusPage.Caption"); //$NON-NLS-1$
}
@Override
public String getDescription() {
return Messages.getString("SystemStatusPage.Description"); //$NON-NLS-1$
}
@Override
public String getIconName() {
return null;
}
@Override
public String getImageName() {
return null;
}
@Override
public void createContent(final Composite content) {
this.content = content;
// FIXME: add interesting versions and the system properties used by the launcher,...
// TODO: add a way to report a bug here?
try {
content.setLayout(new GridLayout());
var groupMemory = new Group(content, SWT.NONE);
groupMemory.setLayout(new GridLayout(2, false));
groupMemory.setText(Messages.getString("SystemStatusPage.JVMMemory")); //$NON-NLS-1$
progressBarMemory = new ProgressBar(groupMemory, SWT.NONE);
var progressBarMemoryLData = new GridData();
progressBarMemoryLData.horizontalAlignment = SWT.FILL;
progressBarMemoryLData.horizontalSpan = 2;
progressBarMemory.setLayoutData(progressBarMemoryLData);
// max memory
var labelMaxMemory = new Label(groupMemory, SWT.NONE);
labelMaxMemory.setText(Messages.getString("SystemStatusPage.MaxMemory")); //$NON-NLS-1$
maxMemory = new Label(groupMemory, SWT.RIGHT);
var maxMemoryLData = new GridData();
maxMemoryLData.horizontalAlignment = SWT.FILL;
maxMemory.setLayoutData(maxMemoryLData);
// total memory
var labelTotalMemory = new Label(groupMemory, SWT.NONE);
labelTotalMemory.setText(Messages.getString("SystemStatusPage.TotalMemory")); //$NON-NLS-1$
totalMemory = new Label(groupMemory, SWT.RIGHT);
var totalMemoryLData = new GridData();
totalMemoryLData.horizontalAlignment = SWT.FILL;
totalMemory.setLayoutData(totalMemoryLData);
// free memory
var labelFreeMemory = new Label(groupMemory, SWT.NONE);
labelFreeMemory.setText(Messages.getString("SystemStatusPage.FreeMemory")); //$NON-NLS-1$
freeMemory = new Label(groupMemory, SWT.RIGHT);
freeMemory.setText(""); //$NON-NLS-1$
var freeMemoryLData = new GridData();
freeMemoryLData.horizontalAlignment = SWT.FILL;
freeMemory.setLayoutData(freeMemoryLData);
// gc button
var buttonMemoryGc = new Button(groupMemory, SWT.PUSH | SWT.CENTER);
buttonMemoryGc.setText(Messages.getString("SystemStatusPage.CleanUp")); //$NON-NLS-1$
var buttonMemoryGcLData = new GridData();
buttonMemoryGc.addListener(SWT.Selection, e -> System.gc());
buttonMemoryGcLData.horizontalAlignment = SWT.END;
buttonMemoryGcLData.horizontalSpan = 2;
buttonMemoryGc.setLayoutData(buttonMemoryGcLData);
timerFired();
timer = new Timer(true);
timer.schedule(new TimerTask() {
@Override
public void run() {
timerFired();
}
}, 1000, 1000);
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean apply() {
return true;
}
@Override
public boolean cancel() {
return true;
}
private void timerFired() {
if (!content.isDisposed()) {
var display = getDisplay();
if ((null == display) || display.isDisposed()) {
timer.cancel();
return;
}
display.asyncExec(this::updateView);
}
}
private void updateView() {
if (!content.isDisposed()) {
var rt = Runtime.getRuntime();
var ltotalMemory = rt.totalMemory();
var lmaxMemory = rt.maxMemory();
var lfreeMemory = rt.freeMemory();
totalMemory.setText(UISettings.formatSize(ltotalMemory));
maxMemory.setText(UISettings.formatSize(lmaxMemory));
freeMemory.setText(UISettings.formatSize(lfreeMemory));
progressBarMemory.setMaximum((int) (ltotalMemory / 1024));
progressBarMemory.setSelection((int) ((ltotalMemory - lfreeMemory) / 1024));
content.layout();
}
}
@Override
public void dispose() {
timer.cancel();
super.dispose();
}
}
| cobexer/fullsync | fullsync-ui/src/main/java/net/sourceforge/fullsync/ui/SystemStatusPage.java | Java | gpl-2.0 | 5,577 |
#!/bin/python
import re
import sys
import os
from datetime import date
class VersionHandler:
def __init__(self, file):
self.file = file
self.major = 0
self.minor = 0
self.revision = 0
self.build = 1
self.touch()
def read(self):
try:
f = open(self.file, 'r')
lines = f.readlines()
f.close()
for line in lines:
self.readline(line)
except IOError as e:
print 'File not found: %s (%s)'%(self.file, e)
sys.exit(1)
def write(self):
try:
d = os.path.dirname(self.file)
if not os.path.exists(d):
os.makedirs(d)
f = open(self.file, 'w')
f.write('version=%d.%d.%d\n'%(self.major, self.minor, self.revision))
f.write('build=%d\n'%(self.build))
f.write('date=%s\n'%(self.date))
f.close()
except IOError as e:
print 'Failed to update: %s (%s)'%(self.file, e)
sys.exit(1)
def readline(self, line):
line = line.strip('\r\n\t ')
if len(line) == 0:
return
try:
m = re.search('(.*)=(.*)$', line)
if not m:
print 'Failed to parse line: %s'%(line.strip('\n\t '))
return
self.set(m.group(1), m.group(2))
except IndexError as e:
print 'Failed to parse line: %s (%s)'%(line.strip('\n\t '),e)
def set(self,k,v):
if k == 'version':
m = re.search('.*(\d).(\d).(\d).*', v)
(self.major, self.minor, self.revision) = [int(e) for e in m.groups()]
elif k == 'build':
self.build = int(v)
elif k == 'date':
self.date = v
def touch(self):
today = date.today()
self.date = today.isoformat()
def version(self):
return '%d.%d.%d.%d'%(self.major, self.minor, self.revision, self.build)
def datestr(self):
return '%s'%self.date
def __str__(self):
return 'version: %s, date %s'%(self.version(), self.date)
def __repr__(self):
return 'version: %s, date %s'%(self.version(), self.date)
def increment(self, key):
if key == 'build':
self.build += 1
elif key == 'revision':
self.revision += 1
self.build = 0
elif key == 'minor':
self.minor += 1
self.revision = 0
self.build = 0
elif key == 'major':
self.major += 1
self.minor = 0
self.revision = 0
self.build = 0
def print_version(self):
print '%d.%d.%d.%d'%(self.major, self.minor, self.revision, self.build)
def write_hpp(self, file):
d = os.path.dirname(file)
if not os.path.exists(d):
os.makedirs(d)
f = open(file, 'w')
(ignored, filename) = os.path.split(file)
name = filename.upper().replace('.', '_')
f.write('#ifndef %s\n'%name)
f.write('#define %s\n'%name)
f.write('#define PRODUCTVER %d,%d,%d,%d\n'%(self.major, self.minor, self.revision, self.build))
f.write('#define STRPRODUCTVER "%d.%d.%d.%d"\n'%(self.major, self.minor, self.revision, self.build))
f.write('#define STRPRODUCTDATE "%s"\n'%(self.date))
f.write('#endif // %s\n'%name)
f.close()
| mickem/nscp | build/python/VersionHandler.py | Python | gpl-2.0 | 2,824 |
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.nashorn.internal.codegen;
import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.regex.Pattern;
import jdk.nashorn.internal.ir.AccessNode;
import jdk.nashorn.internal.ir.BaseNode;
import jdk.nashorn.internal.ir.BinaryNode;
import jdk.nashorn.internal.ir.Block;
import jdk.nashorn.internal.ir.BlockLexicalContext;
import jdk.nashorn.internal.ir.BlockStatement;
import jdk.nashorn.internal.ir.BreakNode;
import jdk.nashorn.internal.ir.CallNode;
import jdk.nashorn.internal.ir.CaseNode;
import jdk.nashorn.internal.ir.CatchNode;
import jdk.nashorn.internal.ir.DebuggerNode;
import jdk.nashorn.internal.ir.ContinueNode;
import jdk.nashorn.internal.ir.EmptyNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.IndexNode;
import jdk.nashorn.internal.ir.JumpStatement;
import jdk.nashorn.internal.ir.JumpToInlinedFinally;
import jdk.nashorn.internal.ir.LabelNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.LiteralNode.PrimitiveLiteralNode;
import jdk.nashorn.internal.ir.LoopNode;
import jdk.nashorn.internal.ir.Node;
import jdk.nashorn.internal.ir.ReturnNode;
import jdk.nashorn.internal.ir.RuntimeNode;
import jdk.nashorn.internal.ir.Statement;
import jdk.nashorn.internal.ir.SwitchNode;
import jdk.nashorn.internal.ir.Symbol;
import jdk.nashorn.internal.ir.ThrowNode;
import jdk.nashorn.internal.ir.TryNode;
import jdk.nashorn.internal.ir.VarNode;
import jdk.nashorn.internal.ir.WhileNode;
import jdk.nashorn.internal.ir.WithNode;
import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.parser.Token;
import jdk.nashorn.internal.parser.TokenType;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.Source;
import jdk.nashorn.internal.runtime.logging.DebugLogger;
import jdk.nashorn.internal.runtime.logging.Loggable;
import jdk.nashorn.internal.runtime.logging.Logger;
/**
* Lower to more primitive operations. After lowering, an AST still has no symbols
* and types, but several nodes have been turned into more low level constructs
* and control flow termination criteria have been computed.
*
* We do things like code copying/inlining of finallies here, as it is much
* harder and context dependent to do any code copying after symbols have been
* finalized.
*/
@Logger(name="lower")
final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Loggable {
private final DebugLogger log;
// Conservative pattern to test if element names consist of characters valid for identifiers.
// This matches any non-zero length alphanumeric string including _ and $ and not starting with a digit.
private static Pattern SAFE_PROPERTY_NAME = Pattern.compile("[a-zA-Z_$][\\w$]*");
/**
* Constructor.
*/
Lower(final Compiler compiler) {
super(new BlockLexicalContext() {
@Override
public List<Statement> popStatements() {
final List<Statement> newStatements = new ArrayList<>();
boolean terminated = false;
final List<Statement> statements = super.popStatements();
for (final Statement statement : statements) {
if (!terminated) {
newStatements.add(statement);
if (statement.isTerminal() || statement instanceof JumpStatement) { //TODO hasGoto? But some Loops are hasGoto too - why?
terminated = true;
}
} else {
statement.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
public boolean enterVarNode(final VarNode varNode) {
newStatements.add(varNode.setInit(null));
return false;
}
});
}
}
return newStatements;
}
@Override
protected Block afterSetStatements(final Block block) {
final List<Statement> stmts = block.getStatements();
for(final ListIterator<Statement> li = stmts.listIterator(stmts.size()); li.hasPrevious();) {
final Statement stmt = li.previous();
// popStatements() guarantees that the only thing after a terminal statement are uninitialized
// VarNodes. We skip past those, and set the terminal state of the block to the value of the
// terminal state of the first statement that is not an uninitialized VarNode.
if(!(stmt instanceof VarNode && ((VarNode)stmt).getInit() == null)) {
return block.setIsTerminal(this, stmt.isTerminal());
}
}
return block.setIsTerminal(this, false);
}
});
this.log = initLogger(compiler.getContext());
}
@Override
public DebugLogger getLogger() {
return log;
}
@Override
public DebugLogger initLogger(final Context context) {
return context.getLogger(this.getClass());
}
@Override
public boolean enterBreakNode(final BreakNode breakNode) {
addStatement(breakNode);
return false;
}
@Override
public Node leaveCallNode(final CallNode callNode) {
return checkEval(callNode.setFunction(markerFunction(callNode.getFunction())));
}
@Override
public Node leaveCatchNode(final CatchNode catchNode) {
return addStatement(catchNode);
}
@Override
public boolean enterContinueNode(final ContinueNode continueNode) {
addStatement(continueNode);
return false;
}
@Override
public boolean enterDebuggerNode(final DebuggerNode debuggerNode) {
final int line = debuggerNode.getLineNumber();
final long token = debuggerNode.getToken();
final int finish = debuggerNode.getFinish();
addStatement(new ExpressionStatement(line, token, finish, new RuntimeNode(token, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Expression>())));
return false;
}
@Override
public boolean enterJumpToInlinedFinally(final JumpToInlinedFinally jumpToInlinedFinally) {
addStatement(jumpToInlinedFinally);
return false;
}
@Override
public boolean enterEmptyNode(final EmptyNode emptyNode) {
return false;
}
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
final String name = getConstantPropertyName(indexNode.getIndex());
if (name != null) {
// If index node is a constant property name convert index node to access node.
assert Token.descType(indexNode.getToken()) == TokenType.LBRACKET;
return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
}
return super.leaveIndexNode(indexNode);
}
// If expression is a primitive literal that is not an array index and does return its string value. Else return null.
private static String getConstantPropertyName(final Expression expression) {
if (expression instanceof LiteralNode.PrimitiveLiteralNode) {
final Object value = ((LiteralNode) expression).getValue();
if (value instanceof String && SAFE_PROPERTY_NAME.matcher((String) value).matches()) {
return (String) value;
}
}
return null;
}
@Override
public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
final Expression expr = expressionStatement.getExpression();
ExpressionStatement node = expressionStatement;
final FunctionNode currentFunction = lc.getCurrentFunction();
if (currentFunction.isProgram()) {
if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) {
node = expressionStatement.setExpression(
new BinaryNode(
Token.recast(
expressionStatement.getToken(),
TokenType.ASSIGN),
compilerConstant(RETURN),
expr));
}
}
return addStatement(node);
}
@Override
public Node leaveBlockStatement(final BlockStatement blockStatement) {
return addStatement(blockStatement);
}
@Override
public Node leaveForNode(final ForNode forNode) {
ForNode newForNode = forNode;
final Expression test = forNode.getTest();
if (!forNode.isForIn() && isAlwaysTrue(test)) {
newForNode = forNode.setTest(lc, null);
}
newForNode = checkEscape(newForNode);
if(newForNode.isForIn()) {
// Wrap it in a block so its internally created iterator is restricted in scope
addStatementEnclosedInBlock(newForNode);
} else {
addStatement(newForNode);
}
return newForNode;
}
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
log.info("END FunctionNode: ", functionNode.getName());
return functionNode.setState(lc, CompilationState.LOWERED);
}
@Override
public Node leaveIfNode(final IfNode ifNode) {
return addStatement(ifNode);
}
@Override
public Node leaveIN(final BinaryNode binaryNode) {
return new RuntimeNode(binaryNode);
}
@Override
public Node leaveINSTANCEOF(final BinaryNode binaryNode) {
return new RuntimeNode(binaryNode);
}
@Override
public Node leaveLabelNode(final LabelNode labelNode) {
return addStatement(labelNode);
}
@Override
public Node leaveReturnNode(final ReturnNode returnNode) {
addStatement(returnNode); //ReturnNodes are always terminal, marked as such in constructor
return returnNode;
}
@Override
public Node leaveCaseNode(final CaseNode caseNode) {
// Try to represent the case test as an integer
final Node test = caseNode.getTest();
if (test instanceof LiteralNode) {
final LiteralNode<?> lit = (LiteralNode<?>)test;
if (lit.isNumeric() && !(lit.getValue() instanceof Integer)) {
if (JSType.isRepresentableAsInt(lit.getNumber())) {
return caseNode.setTest((Expression)LiteralNode.newInstance(lit, lit.getInt32()).accept(this));
}
}
}
return caseNode;
}
@Override
public Node leaveSwitchNode(final SwitchNode switchNode) {
if(!switchNode.isUniqueInteger()) {
// Wrap it in a block so its internally created tag is restricted in scope
addStatementEnclosedInBlock(switchNode);
} else {
addStatement(switchNode);
}
return switchNode;
}
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
return addStatement(throwNode); //ThrowNodes are always terminal, marked as such in constructor
}
@SuppressWarnings("unchecked")
private static <T extends Node> T ensureUniqueNamesIn(final T node) {
return (T)node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
final String name = functionNode.getName();
return functionNode.setName(lc, lc.getCurrentFunction().uniqueName(name));
}
@Override
public Node leaveDefault(final Node labelledNode) {
return labelledNode.ensureUniqueLabels(lc);
}
});
}
private static Block createFinallyBlock(final Block finallyBody) {
final List<Statement> newStatements = new ArrayList<>();
for (final Statement statement : finallyBody.getStatements()) {
newStatements.add(statement);
if (statement.hasTerminalFlags()) {
break;
}
}
return finallyBody.setStatements(null, newStatements);
}
private Block catchAllBlock(final TryNode tryNode) {
final int lineNumber = tryNode.getLineNumber();
final long token = tryNode.getToken();
final int finish = tryNode.getFinish();
final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName(CompilerConstants.EXCEPTION_PREFIX.symbolName()));
final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), true));
assert catchBody.isTerminal(); //ends with throw, so terminal
final CatchNode catchAllNode = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, true);
final Block catchAllBlock = new Block(token, finish, catchAllNode);
//catchallblock -> catchallnode (catchnode) -> exception -> throw
return (Block)catchAllBlock.accept(this); //not accepted. has to be accepted by lower
}
private IdentNode compilerConstant(final CompilerConstants cc) {
final FunctionNode functionNode = lc.getCurrentFunction();
return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName());
}
private static boolean isTerminalFinally(final Block finallyBlock) {
return finallyBlock.getLastStatement().hasTerminalFlags();
}
/**
* Splice finally code into all endpoints of a trynode
* @param tryNode the try node
* @param rethrow the rethrowing throw nodes from the synthetic catch block
* @param finallyBody the code in the original finally block
* @return new try node after splicing finally code (same if nop)
*/
private TryNode spliceFinally(final TryNode tryNode, final ThrowNode rethrow, final Block finallyBody) {
assert tryNode.getFinallyBody() == null;
final Block finallyBlock = createFinallyBlock(finallyBody);
final ArrayList<Block> inlinedFinallies = new ArrayList<>();
final FunctionNode fn = lc.getCurrentFunction();
final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
// do not enter function nodes - finally code should not be inlined into them
return false;
}
@Override
public Node leaveThrowNode(final ThrowNode throwNode) {
if (rethrow == throwNode) {
return new BlockStatement(prependFinally(finallyBlock, throwNode));
}
return throwNode;
}
@Override
public Node leaveBreakNode(final BreakNode breakNode) {
return leaveJumpStatement(breakNode);
}
@Override
public Node leaveContinueNode(final ContinueNode continueNode) {
return leaveJumpStatement(continueNode);
}
private Node leaveJumpStatement(final JumpStatement jump) {
// NOTE: leaveJumpToInlinedFinally deliberately does not delegate to this method, only break and
// continue are edited. JTIF nodes should not be changed, rather the surroundings of
// break/continue/return that were moved into the inlined finally block itself will be changed.
// If this visitor's lc doesn't find the target of the jump, it means it's external to the try block.
if (jump.getTarget(lc) == null) {
return createJumpToInlinedFinally(fn, inlinedFinallies, prependFinally(finallyBlock, jump));
}
return jump;
}
@Override
public Node leaveReturnNode(final ReturnNode returnNode) {
final Expression expr = returnNode.getExpression();
if (isTerminalFinally(finallyBlock)) {
if (expr == null) {
// Terminal finally; no return expression.
return createJumpToInlinedFinally(fn, inlinedFinallies, ensureUniqueNamesIn(finallyBlock));
}
// Terminal finally; has a return expression.
final List<Statement> newStatements = new ArrayList<>(2);
final int retLineNumber = returnNode.getLineNumber();
final long retToken = returnNode.getToken();
// Expression is evaluated for side effects.
newStatements.add(new ExpressionStatement(retLineNumber, retToken, returnNode.getFinish(), expr));
newStatements.add(createJumpToInlinedFinally(fn, inlinedFinallies, ensureUniqueNamesIn(finallyBlock)));
return new BlockStatement(retLineNumber, new Block(retToken, finallyBlock.getFinish(), newStatements));
} else if (expr == null || expr instanceof PrimitiveLiteralNode<?> || (expr instanceof IdentNode && RETURN.symbolName().equals(((IdentNode)expr).getName()))) {
// Nonterminal finally; no return expression, or returns a primitive literal, or returns :return.
// Just move the return expression into the finally block.
return createJumpToInlinedFinally(fn, inlinedFinallies, prependFinally(finallyBlock, returnNode));
} else {
// We need to evaluate the result of the return in case it is complex while still in the try block,
// store it in :return, and return it afterwards.
final List<Statement> newStatements = new ArrayList<>();
final int retLineNumber = returnNode.getLineNumber();
final long retToken = returnNode.getToken();
final int retFinish = returnNode.getFinish();
final Expression resultNode = new IdentNode(expr.getToken(), expr.getFinish(), RETURN.symbolName());
// ":return = <expr>;"
newStatements.add(new ExpressionStatement(retLineNumber, retToken, retFinish, new BinaryNode(Token.recast(returnNode.getToken(), TokenType.ASSIGN), resultNode, expr)));
// inline finally and end it with "return :return;"
newStatements.add(createJumpToInlinedFinally(fn, inlinedFinallies, prependFinally(finallyBlock, returnNode.setExpression(resultNode))));
return new BlockStatement(retLineNumber, new Block(retToken, retFinish, newStatements));
}
}
});
addStatement(inlinedFinallies.isEmpty() ? newTryNode : newTryNode.setInlinedFinallies(lc, inlinedFinallies));
// TODO: if finallyStatement is terminal, we could just have sites of inlined finallies jump here.
addStatement(new BlockStatement(finallyBlock));
return newTryNode;
}
private static JumpToInlinedFinally createJumpToInlinedFinally(final FunctionNode fn, final List<Block> inlinedFinallies, final Block finallyBlock) {
final String labelName = fn.uniqueName(":finally");
final long token = finallyBlock.getToken();
final int finish = finallyBlock.getFinish();
inlinedFinallies.add(new Block(token, finish, new LabelNode(finallyBlock.getFirstStatementLineNumber(),
token, finish, labelName, finallyBlock)));
return new JumpToInlinedFinally(labelName);
}
private static Block prependFinally(final Block finallyBlock, final Statement statement) {
final Block inlinedFinally = ensureUniqueNamesIn(finallyBlock);
if (isTerminalFinally(finallyBlock)) {
return inlinedFinally;
}
final List<Statement> stmts = inlinedFinally.getStatements();
final List<Statement> newStmts = new ArrayList<>(stmts.size() + 1);
newStmts.addAll(stmts);
newStmts.add(statement);
return new Block(inlinedFinally.getToken(), statement.getFinish(), newStmts);
}
@Override
public Node leaveTryNode(final TryNode tryNode) {
final Block finallyBody = tryNode.getFinallyBody();
TryNode newTryNode = tryNode.setFinallyBody(lc, null);
// No finally or empty finally
if (finallyBody == null || finallyBody.getStatementCount() == 0) {
final List<CatchNode> catches = newTryNode.getCatches();
if (catches == null || catches.isEmpty()) {
// A completely degenerate try block: empty finally, no catches. Replace it with try body.
return addStatement(new BlockStatement(tryNode.getBody()));
}
return addStatement(ensureUnconditionalCatch(newTryNode));
}
/*
* create a new trynode
* if we have catches:
*
* try try
* x try
* catch x
* y catch
* finally z y
* catchall
* rethrow
*
* otheriwse
*
* try try
* x x
* finally catchall
* y rethrow
*
*
* now splice in finally code wherever needed
*
*/
final Block catchAll = catchAllBlock(tryNode);
final List<ThrowNode> rethrows = new ArrayList<>(1);
catchAll.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
rethrows.add(throwNode);
return true;
}
});
assert rethrows.size() == 1;
if (!tryNode.getCatchBlocks().isEmpty()) {
final Block outerBody = new Block(newTryNode.getToken(), newTryNode.getFinish(), ensureUnconditionalCatch(newTryNode));
newTryNode = newTryNode.setBody(lc, outerBody).setCatchBlocks(lc, null);
}
newTryNode = newTryNode.setCatchBlocks(lc, Arrays.asList(catchAll));
/*
* Now that the transform is done, we have to go into the try and splice
* the finally block in front of any statement that is outside the try
*/
return (TryNode)lc.replace(tryNode, spliceFinally(newTryNode, rethrows.get(0), finallyBody));
}
private TryNode ensureUnconditionalCatch(final TryNode tryNode) {
final List<CatchNode> catches = tryNode.getCatches();
if(catches == null || catches.isEmpty() || catches.get(catches.size() - 1).getExceptionCondition() == null) {
return tryNode;
}
// If the last catch block is conditional, add an unconditional rethrow block
final List<Block> newCatchBlocks = new ArrayList<>(tryNode.getCatchBlocks());
newCatchBlocks.add(catchAllBlock(tryNode));
return tryNode.setCatchBlocks(lc, newCatchBlocks);
}
@Override
public Node leaveVarNode(final VarNode varNode) {
addStatement(varNode);
if (varNode.getFlag(VarNode.IS_LAST_FUNCTION_DECLARATION) && lc.getCurrentFunction().isProgram()) {
new ExpressionStatement(varNode.getLineNumber(), varNode.getToken(), varNode.getFinish(), new IdentNode(varNode.getName())).accept(this);
}
return varNode;
}
@Override
public Node leaveWhileNode(final WhileNode whileNode) {
final Expression test = whileNode.getTest();
final Block body = whileNode.getBody();
if (isAlwaysTrue(test)) {
//turn it into a for node without a test.
final ForNode forNode = (ForNode)new ForNode(whileNode.getLineNumber(), whileNode.getToken(), whileNode.getFinish(), body, 0).accept(this);
lc.replace(whileNode, forNode);
return forNode;
}
return addStatement(checkEscape(whileNode));
}
@Override
public Node leaveWithNode(final WithNode withNode) {
return addStatement(withNode);
}
/**
* Given a function node that is a callee in a CallNode, replace it with
* the appropriate marker function. This is used by {@link CodeGenerator}
* for fast scope calls
*
* @param function function called by a CallNode
* @return transformed node to marker function or identity if not ident/access/indexnode
*/
private static Expression markerFunction(final Expression function) {
if (function instanceof IdentNode) {
return ((IdentNode)function).setIsFunction();
} else if (function instanceof BaseNode) {
return ((BaseNode)function).setIsFunction();
}
return function;
}
/**
* Calculate a synthetic eval location for a node for the stacktrace, for example src#17<eval>
* @param node a node
* @return eval location
*/
private String evalLocation(final IdentNode node) {
final Source source = lc.getCurrentFunction().getSource();
final int pos = node.position();
return new StringBuilder().
append(source.getName()).
append('#').
append(source.getLine(pos)).
append(':').
append(source.getColumn(pos)).
append("<eval>").
toString();
}
/**
* Check whether a call node may be a call to eval. In that case we
* clone the args in order to create the following construct in
* {@link CodeGenerator}
*
* <pre>
* if (calledFuntion == buildInEval) {
* eval(cloned arg);
* } else {
* cloned arg;
* }
* </pre>
*
* @param callNode call node to check if it's an eval
*/
private CallNode checkEval(final CallNode callNode) {
if (callNode.getFunction() instanceof IdentNode) {
final List<Expression> args = callNode.getArgs();
final IdentNode callee = (IdentNode)callNode.getFunction();
// 'eval' call with at least one argument
if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) {
final List<Expression> evalArgs = new ArrayList<>(args.size());
for(final Expression arg: args) {
evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this));
}
return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee)));
}
}
return callNode;
}
/**
* Helper that given a loop body makes sure that it is not terminal if it
* has a continue that leads to the loop header or to outer loops' loop
* headers. This means that, even if the body ends with a terminal
* statement, we cannot tag it as terminal
*
* @param loopBody the loop body to check
* @return true if control flow may escape the loop
*/
private static boolean controlFlowEscapes(final LexicalContext lex, final Block loopBody) {
final List<Node> escapes = new ArrayList<>();
loopBody.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
public Node leaveBreakNode(final BreakNode node) {
escapes.add(node);
return node;
}
@Override
public Node leaveContinueNode(final ContinueNode node) {
// all inner loops have been popped.
if (lex.contains(node.getTarget(lex))) {
escapes.add(node);
}
return node;
}
});
return !escapes.isEmpty();
}
@SuppressWarnings("unchecked")
private <T extends LoopNode> T checkEscape(final T loopNode) {
final boolean escapes = controlFlowEscapes(lc, loopNode.getBody());
if (escapes) {
return (T)loopNode.
setBody(lc, loopNode.getBody().setIsTerminal(lc, false)).
setControlFlowEscapes(lc, escapes);
}
return loopNode;
}
private Node addStatement(final Statement statement) {
lc.appendStatement(statement);
return statement;
}
private void addStatementEnclosedInBlock(final Statement stmt) {
BlockStatement b = BlockStatement.createReplacement(stmt, Collections.<Statement>singletonList(stmt));
if(stmt.isTerminal()) {
b = b.setBlock(b.getBlock().setIsTerminal(null, true));
}
addStatement(b);
}
/**
* An internal expression has a symbol that is tagged internal. Check if
* this is such a node
*
* @param expression expression to check for internal symbol
* @return true if internal, false otherwise
*/
private static boolean isInternalExpression(final Expression expression) {
if (!(expression instanceof IdentNode)) {
return false;
}
final Symbol symbol = ((IdentNode)expression).getSymbol();
return symbol != null && symbol.isInternal();
}
/**
* Is this an assignment to the special variable that hosts scripting eval
* results, i.e. __return__?
*
* @param expression expression to check whether it is $evalresult = X
* @return true if an assignment to eval result, false otherwise
*/
private static boolean isEvalResultAssignment(final Node expression) {
final Node e = expression;
if (e instanceof BinaryNode) {
final Node lhs = ((BinaryNode)e).lhs();
if (lhs instanceof IdentNode) {
return ((IdentNode)lhs).getName().equals(RETURN.symbolName());
}
}
return false;
}
}
| shelan/jdk9-mirror | nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java | Java | gpl-2.0 | 32,007 |
<?php
N2Loader::import('libraries.parse.font');
N2Loader::import('libraries.parse.style');
abstract class N2SmartSliderCSSAbstract
{
/**
* @var N2SmartSliderAbstract
*/
protected $slider;
public $sizes = array();
public function __construct($slider) {
$this->slider = $slider;
}
public function render() {
$slider = $this->slider;
$params = $slider->params;
$width = intval($params->get('width', 900));
$height = intval($params->get('height', 500));
if ($width < 10) {
N2Message::error(n2_('Slider width is not valid number!'));
}
if ($height < 10) {
N2Message::error(n2_('Slider height is not valid number!'));
}
$context = array(
'id' => "~'#{$slider->elementId}'",
'width' => $width . 'px',
'height' => $height . 'px',
'canvas' => 0,
'count' => count($slider->slides),
'margin' => '0px 0px 0px 0px',
'clear' => ($params->get('weaker-selector', 0) ? 'clearv2.n2less' : 'clear.n2less')
);
$this->renderType($context);
if ($params->get('imageload', 0)) {
N2LESS::addFile(NEXTEND_SMARTSLIDER_ASSETS . '/less/spinner.n2less', $slider->cacheId, $context, NEXTEND_SMARTSLIDER_ASSETS . '/less' . NDS);
}
$this->sizes['marginVertical'] = 0;
$this->sizes['marginHorizontal'] = 0;
$this->sizes['width'] = intval($context['width']);
$this->sizes['height'] = intval($context['height']);
$this->sizes['canvasWidth'] = intval($context['canvaswidth']);
$this->sizes['canvasHeight'] = intval($context['canvasheight']);
}
protected abstract function renderType(&$context);
protected function setContextFonts($matches, &$context, $fonts, $value) {
$context['font' . $fonts] = '~".' . $matches[0] . '"';
$font = new N2ParseFont($value);
$context['font' . $fonts . 'text'] = '";' . $font->printTab() . '"';
$font->mixinTab('Link');
$context['font' . $fonts . 'link'] = '";' . $font->printTab('Link') . '"';
$font->mixinTab('Link:Hover', 'Link');
$context['font' . $fonts . 'hover'] = '";' . $font->printTab('Link:Hover') . '"';
}
protected function setContextStyles($selector, &$context, $styles, $value) {
$context['style' . $styles] = '~".' . $selector . '"';
$style = new N2ParseStyle($value);
$context['style' . $styles . 'normal'] = '";' . $style->printTab('Normal') . '"';
$context['style' . $styles . 'hover'] = '";' . $style->printTab('Hover') . '"';
}
} | acs6610987/summergxy | wp-content/plugins/smart-slider-3/library/smartslider/libraries/slider/css.php | PHP | gpl-2.0 | 2,775 |
/*
* This file is part of Dune Legacy.
*
* Dune Legacy 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.
*
* Dune Legacy 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 Dune Legacy. If not, see <http://www.gnu.org/licenses/>.
*/
#include <FileClasses/FileManager.h>
#include <globals.h>
#include <FileClasses/TextManager.h>
#include <misc/FileSystem.h>
#include <config.h>
#include <misc/fnkdat.h>
#include <misc/md5.h>
#include <misc/string_util.h>
#include <algorithm>
#include <stdexcept>
#include <sstream>
#include <iomanip>
FileManager::FileManager(bool saveMode) {
fprintf(stderr,"\n");
fprintf(stderr,"FileManager is loading PAK-Files...\n\n");
fprintf(stderr,"MD5-Checksum Filename\n");
std::vector<std::string> searchPath = getSearchPath();
std::vector<std::string> FileList = getNeededFiles();
std::vector<std::string>::const_iterator filenameIter;
for(filenameIter = FileList.begin(); filenameIter != FileList.end(); ++filenameIter) {
std::vector<std::string>::const_iterator searchPathIter;
for(searchPathIter = searchPath.begin(); searchPathIter != searchPath.end(); ++searchPathIter) {
std::string filepath = *searchPathIter + "/" + *filenameIter;
if(getCaseInsensitiveFilename(filepath) == true) {
try {
fprintf(stderr,"%s %s\n", md5FromFilename(filepath).c_str(), filepath.c_str());
pakFiles.push_back(new Pakfile(filepath));
} catch (std::exception &e) {
if(saveMode == false) {
while(pakFiles.empty()) {
delete pakFiles.back();
pakFiles.pop_back();
}
throw std::runtime_error("FileManager::FileManager(): Error while opening " + filepath + ": " + e.what());
}
}
// break out of searchPath-loop because we have opened the file in one directory
break;
}
}
}
fprintf(stderr,"\n");
}
FileManager::~FileManager() {
std::vector<Pakfile*>::const_iterator iter;
for(iter = pakFiles.begin(); iter != pakFiles.end(); ++iter) {
delete *iter;
}
}
std::vector<std::string> FileManager::getSearchPath() {
std::vector<std::string> searchPath;
searchPath.push_back(DUNELEGACY_DATADIR);
char tmp[FILENAME_MAX];
fnkdat("data", tmp, FILENAME_MAX, FNKDAT_USER | FNKDAT_CREAT);
searchPath.push_back(tmp);
return searchPath;
}
std::vector<std::string> FileManager::getNeededFiles() {
std::vector<std::string> fileList;
#if 0
fileList.push_back("LEGACY.PAK");
fileList.push_back("OPENSD2.PAK");
fileList.push_back("DUNE.PAK");
fileList.push_back("SCENARIO.PAK");
fileList.push_back("MENTAT.PAK");
fileList.push_back("VOC.PAK");
fileList.push_back("MERC.PAK");
fileList.push_back("FINALE.PAK");
fileList.push_back("INTRO.PAK");
fileList.push_back("INTROVOC.PAK");
fileList.push_back("SOUND.PAK");
std::string LanguagePakFiles = (pTextManager != NULL) ? _("LanguagePakFiles") : "";
if(LanguagePakFiles.empty()) {
LanguagePakFiles = "ENGLISH.PAK,HARK.PAK,ATRE.PAK,ORDOS.PAK";
}
std::vector<std::string> additionalPakFiles = splitString(LanguagePakFiles);
std::vector<std::string>::iterator iter;
for(iter = additionalPakFiles.begin(); iter != additionalPakFiles.end(); ++iter) {
fileList.push_back(*iter);
}
std::sort(fileList.begin(), fileList.end());
#endif
return fileList;
}
std::vector<std::string> FileManager::getMissingFiles() {
std::vector<std::string> MissingFiles;
std::vector<std::string> searchPath = getSearchPath();
std::vector<std::string> FileList = getNeededFiles();
std::vector<std::string>::const_iterator filenameIter;
for(filenameIter = FileList.begin(); filenameIter != FileList.end(); ++filenameIter) {
bool bFound = false;
std::vector<std::string>::const_iterator searchPathIter;
for(searchPathIter = searchPath.begin(); searchPathIter != searchPath.end(); ++searchPathIter) {
std::string filepath = *searchPathIter + "/" + *filenameIter;
if(getCaseInsensitiveFilename(filepath) == true) {
bFound = true;
break;
}
}
if(bFound == false) {
MissingFiles.push_back(*filenameIter);
}
}
return MissingFiles;
}
SDL_RWops* FileManager::openFile(std::string filename) {
SDL_RWops* ret;
// try loading external file
std::vector<std::string> searchPath = getSearchPath();
std::vector<std::string>::const_iterator searchPathIter;
for(searchPathIter = searchPath.begin(); searchPathIter != searchPath.end(); ++searchPathIter) {
std::string externalFilename = *searchPathIter + "/" + filename;
if(getCaseInsensitiveFilename(externalFilename) == true) {
if((ret = SDL_RWFromFile(externalFilename.c_str(), "rb")) != NULL) {
return ret;
}
}
}
// now try loading from pak file
std::vector<Pakfile*>::const_iterator iter;
for(iter = pakFiles.begin(); iter != pakFiles.end(); ++iter) {
ret = (*iter)->openFile(filename);
if(ret != NULL) {
return ret;
}
}
throw std::runtime_error("FileManager::OpenFile(): Cannot find " + filename + "!");
}
bool FileManager::exists(std::string filename) const {
// try finding external file
std::vector<std::string> searchPath = getSearchPath();
std::vector<std::string>::const_iterator searchPathIter;
for(searchPathIter = searchPath.begin(); searchPathIter != searchPath.end(); ++searchPathIter) {
std::string externalFilename = *searchPathIter + "/" + filename;
if(getCaseInsensitiveFilename(externalFilename) == true) {
return true;
}
}
// now try finding in one pak file
std::vector<Pakfile*>::const_iterator iter;
for(iter = pakFiles.begin(); iter != pakFiles.end(); ++iter) {
if((*iter)->exists(filename) == true) {
return true;
}
}
return false;
}
std::string FileManager::md5FromFilename(std::string filename) {
unsigned char md5sum[16];
if(md5_file(filename.c_str(), md5sum) != 0) {
throw std::runtime_error("Cannot open or read " + filename + "!");
} else {
std::stringstream stream;
stream << std::setfill('0') << std::hex;
for(int i=0;i<16;i++) {
stream << std::setw(2) << (int) md5sum[i];
}
return stream.str();
}
}
| katlogic/dunelegacy | src/FileClasses/FileManager.cpp | C++ | gpl-2.0 | 7,123 |
<?php
/**
* PEL: PHP Exif Library. A library with support for reading and
* writing all Exif headers in JPEG and TIFF images using PHP.
*
* Copyright (C) 2004, 2005, 2006, 2007 Martin Geisler.
*
* 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 in the file COPYING; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/* $Id$ */
/**
* Classes used to hold ASCII strings.
*
* The classes defined here are to be used for Exif entries holding
* ASCII strings, such as {@link PelTag::MAKE}, {@link
* PelTag::SOFTWARE}, and {@link PelTag::DATE_TIME}. For
* entries holding normal textual ASCII strings the class {@link
* PelEntryAscii} should be used, but for entries holding
* timestamps the class {@link PelEntryTime} would be more
* convenient instead. Copyright information is handled by the {@link
* PelEntryCopyright} class.
*
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* @version $Revision$
* @date $Date$
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
* License (GPL)
* @package PEL
*/
/**#@+ Required class definitions. */
require_once('PelEntry.php');
/**#@-*/
/**
* Class for holding a plain ASCII string.
*
* This class can hold a single ASCII string, and it will be used as in
* <code>
* $entry = $ifd->getEntry(PelTag::IMAGE_DESCRIPTION);
* print($entry->getValue());
* $entry->setValue('This is my image. I like it.');
* </code>
*
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* @package PEL
*/
class PelEntryAscii extends PelEntry {
/**
* The string hold by this entry.
*
* This is the string that was given to the {@link __construct
* constructor} or later to {@link setValue}, without any final NULL
* character.
*
* @var string
*/
private $str;
/**
* Make a new PelEntry that can hold an ASCII string.
*
* @param int the tag which this entry represents. This should be
* one of the constants defined in {@link PelTag}, e.g., {@link
* PelTag::IMAGE_DESCRIPTION}, {@link PelTag::MODEL}, or any other
* tag with format {@link PelFormat::ASCII}.
*
* @param string the string that this entry will represent. The
* string must obey the same rules as the string argument to {@link
* setValue}, namely that it should be given without any trailing
* NULL character and that it must be plain 7-bit ASCII.
*/
function __construct($tag, $str = '') {
$this->tag = $tag;
$this->format = PelFormat::ASCII;
self::setValue($str);
}
/**
* Give the entry a new ASCII value.
*
* This will overwrite the previous value. The value can be
* retrieved later with the {@link getValue} method.
*
* @param string the new value of the entry. This should be given
* without any trailing NULL character. The string must be plain
* 7-bit ASCII, the string should contain no high bytes.
*
* @todo Implement check for high bytes?
*/
function setValue($str) {
$this->components = strlen($str)+1;
$this->str = $str;
$this->bytes = $str . chr(0x00);
}
/**
* Return the ASCII string of the entry.
*
* @return string the string held, without any final NULL character.
* The string will be the same as the one given to {@link setValue}
* or to the {@link __construct constructor}.
*/
function getValue() {
return $this->str;
}
/**
* Return the ASCII string of the entry.
*
* This methods returns the same as {@link getValue}.
*
* @param boolean not used with ASCII entries.
*
* @return string the string held, without any final NULL character.
* The string will be the same as the one given to {@link setValue}
* or to the {@link __construct constructor}.
*/
function getText($brief = false) {
return $this->str;
}
}
/**
* Class for holding a date and time.
*
* This class can hold a timestamp, and it will be used as
* in this example where the time is advanced by one week:
* <code>
* $entry = $ifd->getEntry(PelTag::DATE_TIME_ORIGINAL);
* $time = $entry->getValue();
* print('The image was taken on the ' . date('jS', $time));
* $entry->setValue($time + 7 * 24 * 3600);
* </code>
*
* The example used a standard UNIX timestamp, which is the default
* for this class.
*
* But the Exif format defines dates outside the range of a UNIX
* timestamp (about 1970 to 2038) and so you can also get access to
* the timestamp in two other formats: a simple string or a Julian Day
* Count. Please see the Calendar extension in the PHP Manual for more
* information about the Julian Day Count.
*
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* @package PEL
*/
class PelEntryTime extends PelEntryAscii {
/**
* Constant denoting a UNIX timestamp.
*/
const UNIX_TIMESTAMP = 1;
/**
* Constant denoting a Exif string.
*/
const EXIF_STRING = 2;
/**
* Constant denoting a Julian Day Count.
*/
const JULIAN_DAY_COUNT = 3;
/**
* The Julian Day Count of the timestamp held by this entry.
*
* This is an integer counting the number of whole days since
* January 1st, 4713 B.C. The fractional part of the timestamp held
* by this entry is stored in {@link $seconds}.
*
* @var int
*/
private $day_count;
/**
* The number of seconds into the day of the timestamp held by this
* entry.
*
* The number of whole days is stored in {@link $day_count} and the
* number of seconds left-over is stored here.
*
* @var int
*/
private $seconds;
/**
* Make a new entry for holding a timestamp.
*
* @param int the Exif tag which this entry represents. There are
* only three standard tags which hold timestamp, so this should be
* one of the constants {@link PelTag::DATE_TIME}, {@link
* PelTag::DATE_TIME_ORIGINAL}, or {@link
* PelTag::DATE_TIME_DIGITIZED}.
*
* @param int the timestamp held by this entry in the correct form
* as indicated by the third argument. For {@link UNIX_TIMESTAMP}
* this is an integer counting the number of seconds since January
* 1st 1970, for {@link EXIF_STRING} this is a string of the form
* 'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a
* floating point number where the integer part denotes the day
* count and the fractional part denotes the time of day (0.25 means
* 6:00, 0.75 means 18:00).
*
* @param int the type of the timestamp. This must be one of
* {@link UNIX_TIMESTAMP}, {@link EXIF_STRING}, or
* {@link JULIAN_DAY_COUNT}.
*/
function __construct($tag, $timestamp, $type = self::UNIX_TIMESTAMP) {
parent::__construct($tag);
$this->setValue($timestamp, $type);
}
/**
* Return the timestamp of the entry.
*
* The timestamp held by this entry is returned in one of three
* formats: as a standard UNIX timestamp (default), as a fractional
* Julian Day Count, or as a string.
*
* @param int the type of the timestamp. This must be one of
* {@link UNIX_TIMESTAMP}, {@link EXIF_STRING}, or
* {@link JULIAN_DAY_COUNT}.
*
* @return int the timestamp held by this entry in the correct form
* as indicated by the type argument. For {@link UNIX_TIMESTAMP}
* this is an integer counting the number of seconds since January
* 1st 1970, for {@link EXIF_STRING} this is a string of the form
* 'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a
* floating point number where the integer part denotes the day
* count and the fractional part denotes the time of day (0.25 means
* 6:00, 0.75 means 18:00).
*/
function getValue($type = self::UNIX_TIMESTAMP) {
switch ($type) {
case self::UNIX_TIMESTAMP:
$seconds = $this->convertJdToUnix($this->day_count);
if ($seconds === false)
/* We get false if the Julian Day Count is outside the range
* of a UNIX timestamp. */
return false;
else
return $seconds + $this->seconds;
case self::EXIF_STRING:
list($year, $month, $day) = $this->convertJdToGregorian($this->day_count);
$hours = (int)($this->seconds / 3600);
$minutes = (int)($this->seconds % 3600 / 60);
$seconds = $this->seconds % 60;
return sprintf('%04d:%02d:%02d %02d:%02d:%02d',
$year, $month, $day, $hours, $minutes, $seconds);
case self::JULIAN_DAY_COUNT:
return $this->day_count + $this->seconds / 86400;
default:
throw new PelInvalidArgumentException('Expected UNIX_TIMESTAMP (%d), ' .
'EXIF_STRING (%d), or ' .
'JULIAN_DAY_COUNT (%d) for $type, '.
'got %d.',
self::UNIX_TIMESTAMP,
self::EXIF_STRING,
self::JULIAN_DAY_COUNT,
$type);
}
}
/**
* Update the timestamp held by this entry.
*
* @param int the timestamp held by this entry in the correct form
* as indicated by the third argument. For {@link UNIX_TIMESTAMP}
* this is an integer counting the number of seconds since January
* 1st 1970, for {@link EXIF_STRING} this is a string of the form
* 'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a
* floating point number where the integer part denotes the day
* count and the fractional part denotes the time of day (0.25 means
* 6:00, 0.75 means 18:00).
*
* @param int the type of the timestamp. This must be one of
* {@link UNIX_TIMESTAMP}, {@link EXIF_STRING}, or
* {@link JULIAN_DAY_COUNT}.
*/
function setValue($timestamp, $type = self::UNIX_TIMESTAMP) {
#if (empty($timestamp))
# debug_print_backtrace();
switch ($type) {
case self::UNIX_TIMESTAMP:
$this->day_count = $this->convertUnixToJd($timestamp);
$this->seconds = $timestamp % 86400;
break;
case self::EXIF_STRING:
/* Clean the timestamp: some timestamps are broken other
* separators than ':' and ' '. */
$d = preg_split('/[^0-9]+/', $timestamp);
$this->day_count = $this->convertGregorianToJd($d[0], $d[1], $d[2]);
$this->seconds = $d[3]*3600 + $d[4]*60 + $d[5];
break;
case self::JULIAN_DAY_COUNT:
$this->day_count = (int)floor($timestamp);
$this->seconds = (int)(86400 * ($timestamp - floor($timestamp)));
break;
default:
throw new PelInvalidArgumentException('Expected UNIX_TIMESTAMP (%d), ' .
'EXIF_STRING (%d), or ' .
'JULIAN_DAY_COUNT (%d) for $type, '.
'got %d.',
self::UNIX_TIMESTAMP,
self::EXIF_STRING,
self::JULIAN_DAY_COUNT,
$type);
}
/* Now finally update the string which will be used when this is
* turned into bytes. */
parent::setValue($this->getValue(self::EXIF_STRING));
}
// The following four functions are used for converting back and
// forth between the date formats. They are used in preference to
// the ones from the PHP calendar extension to avoid having to
// fiddle with timezones and to avoid depending on the extension.
//
// See http://www.hermetic.ch/cal_stud/jdn.htm#comp for a reference.
/**
* Converts a date in year/month/day format to a Julian Day count.
*
* @param int $year the year.
* @param int $month the month, 1 to 12.
* @param int $day the day in the month.
* @return int the Julian Day count.
*/
function convertGregorianToJd($year, $month, $day) {
// Special case mapping 0/0/0 -> 0
if ($year == 0 || $month == 0 || $day == 0)
return 0;
$m1412 = ($month <= 2) ? -1 : 0;
return floor(( 1461 * ( $year + 4800 + $m1412 ) ) / 4) +
floor(( 367 * ( $month - 2 - 12 * $m1412 ) ) / 12) -
floor(( 3 * floor( ( $year + 4900 + $m1412 ) / 100 ) ) / 4) +
$day - 32075;
}
/**
* Converts a Julian Day count to a year/month/day triple.
*
* @param int the Julian Day count.
* @return array an array with three entries: year, month, day.
*/
function convertJdToGregorian($jd) {
// Special case mapping 0 -> 0/0/0
if ($jd == 0)
return array(0,0,0);
$l = $jd + 68569;
$n = floor(( 4 * $l ) / 146097);
$l = $l - floor(( 146097 * $n + 3 ) / 4);
$i = floor(( 4000 * ( $l + 1 ) ) / 1461001);
$l = $l - floor(( 1461 * $i ) / 4) + 31;
$j = floor(( 80 * $l ) / 2447);
$d = $l - floor(( 2447 * $j ) / 80);
$l = floor($j / 11);
$m = $j + 2 - ( 12 * $l );
$y = 100 * ( $n - 49 ) + $i + $l;
return array($y, $m, $d);
}
/**
* Converts a UNIX timestamp to a Julian Day count.
*
* @param int $timestamp the timestamp.
* @return int the Julian Day count.
*/
function convertUnixToJd($timestamp) {
return (int)(floor($timestamp / 86400) + 2440588);
}
/**
* Converts a Julian Day count to a UNIX timestamp.
*
* @param int $jd the Julian Day count.
* @return mixed $timestamp the integer timestamp or false if the
* day count cannot be represented as a UNIX timestamp.
*/
function convertJdToUnix($jd) {
$timestamp = ($jd - 2440588) * 86400;
if ($timestamp != (int)$timestamp)
return false;
else
return $timestamp;
}
}
/**
* Class for holding copyright information.
*
* The Exif standard specifies a certain format for copyright
* information where the one {@link PelTag::COPYRIGHT copyright
* tag} holds both the photographer and editor copyrights, separated
* by a NULL character.
*
* This class is used to manipulate that tag so that the format is
* kept to the standard. A common use would be to add a new copyright
* tag to an image, since most cameras do not add this tag themselves.
* This would be done like this:
*
* <code>
* $entry = new PelEntryCopyright('Copyright, Martin Geisler, 2004');
* $ifd0->addEntry($entry);
* </code>
*
* Here we only set the photographer copyright, use the optional
* second argument to specify the editor copyright. If there is only
* an editor copyright, then let the first argument be the empty
* string.
*
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* @package PEL
*/
class PelEntryCopyright extends PelEntryAscii {
/**
* The photographer copyright.
*
* @var string
*/
private $photographer;
/**
* The editor copyright.
*
* @var string
*/
private $editor;
/**
* Make a new entry for holding copyright information.
*
* @param string the photographer copyright. Use the empty string
* if there is no photographer copyright.
*
* @param string the editor copyright. Use the empty string if
* there is no editor copyright.
*/
function __construct($photographer = '', $editor = '') {
parent::__construct(PelTag::COPYRIGHT);
$this->setValue($photographer, $editor);
}
/**
* Update the copyright information.
*
* @param string the photographer copyright. Use the empty string
* if there is no photographer copyright.
*
* @param string the editor copyright. Use the empty string if
* there is no editor copyright.
*/
function setValue($photographer = '', $editor = '') {
$this->photographer = $photographer;
$this->editor = $editor;
if ($photographer == '' && $editor != '')
$photographer = ' ';
if ($editor == '')
parent::setValue($photographer);
else
parent::setValue($photographer . chr(0x00) . $editor);
}
/**
* Retrive the copyright information.
*
* The strings returned will be the same as the one used previously
* with either {@link __construct the constructor} or with {@link
* setValue}.
*
* @return array an array with two strings, the photographer and
* editor copyrights. The two fields will be returned in that
* order, so that the first array index will be the photographer
* copyright, and the second will be the editor copyright.
*/
function getValue() {
return array($this->photographer, $this->editor);
}
/**
* Return a text string with the copyright information.
*
* The photographer and editor copyright fields will be returned
* with a '-' in between if both copyright fields are present,
* otherwise only one of them will be returned.
*
* @param boolean if false, then the strings '(Photographer)' and
* '(Editor)' will be appended to the photographer and editor
* copyright fields (if present), otherwise the fields will be
* returned as is.
*
* @return string the copyright information in a string.
*/
function getText($brief = false) {
if ($brief) {
$p = '';
$e = '';
} else {
$p = ' ' . Pel::tra('(Photographer)');
$e = ' ' . Pel::tra('(Editor)');
}
if ($this->photographer != '' && $this->editor != '')
return $this->photographer . $p . ' - ' . $this->editor . $e;
if ($this->photographer != '')
return $this->photographer . $p;
if ($this->editor != '')
return $this->editor . $e;
return '';
}
}
| sekret47/konstantin | components/com_eventgallery/helpers/vendors/pel/src/PelEntryAscii.php | PHP | gpl-2.0 | 19,502 |
"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(value):
"""Returns the date as represented by the default datetime format"""
try:
v = date(value, DATETIME_FORMAT)
except:
return value
return v
@register.filter
def short_time_format(value):
"""Returns the value formatted as a short time format
The SHORT_TIME_FORMAT is a custom format not available in the template
"""
try:
return time(value, SHORT_TIME_FORMAT)
except:
return value
@register.filter
def remove_microseconds(delta):
"""Removes microseconds from timedelta"""
try:
return delta - timedelta(microseconds=delta.microseconds)
except:
return delta
| sigmunau/nav | python/nav/django/templatetags/date_and_time.py | Python | gpl-2.0 | 1,012 |
package com.kellydavid.dfs.config;
import java.io.*;
import java.util.HashMap;
/**
* Created by david on 31/01/2016.
*/
public class Configurator {
private String filename;
private HashMap<String, String> configuration;
public Configurator(String filename){
this.filename = filename;
configuration = new HashMap<String, String>();
}
public void loadConfiguration(){
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(filename));
String line = reader.readLine();
while (line != null) {
addConfigLine(line);
line = reader.readLine();
}
reader.close();
}catch(FileNotFoundException fnfe){
System.err.println("Could not find configuration file.");
}catch(IOException ioe){
System.err.println("Error reading from configuration file.");
}finally{
try {
if (reader != null)
reader.close();
}catch(IOException ioe){
System.err.println("Error closing file.");
}
}
}
private void addConfigLine(String line){
String split[] = line.split("=");
if(split.length != 2){
return;
}else {
String key = split[0];
String value = split[1];
if (!configuration.containsKey(key)) {
configuration.put(key, value);
} else {
System.err.println("Warning duplicate value for " + key + " encountered.");
}
}
}
public String getValue(String key){
return configuration.get(key);
}
}
| kellydavid/DistributedFileSystem | dfs-config/src/main/java/com/kellydavid/dfs/config/Configurator.java | Java | gpl-2.0 | 1,740 |
import time
import midipy as midi
midi.open(128, 0, "midipy test", 0)
for (note, t) in [(48,0.5),(48,0.5),(50,1.0),(48,1.0),(53,1.0),(52,1.0),
(48,0.5),(48,0.5),(50,1.0),(48,1.0),(55,1.0),(53,1.0)]:
midi.note_on(note,127)
time.sleep(t/2)
midi.note_off(note,127)
midi.close()
| tcoxon/wiitar | midipy_src/test.py | Python | gpl-2.0 | 311 |
<?php
/**
* Link model
*
* @package link
* @author Philipp (philipp)
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
* @version $Id$
*/
class LinkModel extends RoxModelBase
{
function __construct()
{
parent::__construct();
}
/**
* Functions needed to create the link network and store it to the db
**/
function createPath ($branch,$directlinks)
{
$first = $branch[0];
$lastkey = count($branch)-1;
$last = $branch[$lastkey];
$degree=count($branch)-1;
$path = array($first,$last,$degree);
foreach ($branch as $key => $value) {
if ($key >= 1) {
array_push($path,(array($value,$directlinks[$branch[$key-1]][$value]['totype'],$directlinks[$branch[$key-1]][$value]['reversetype'])));
}
}
return($path);
} // createPath
function createLinkList() {
$preferences = $this->getLinkPreferences();
echo "createLinkList getpreference ".count($preferences)." values created<br>" ;
$comments = $this->getComments();
echo "createLinkList comments ".count($comments)." values created<br>" ;
$specialrelation = $this->getSpecialRelation();
echo "createLinkList specialrelation ".count($specialrelation)." values created<br>" ;
foreach ($comments as $comment) {
if (isset($preferences[$comment->IdFromMember])) {
if ($preferences[$comment->IdFromMember] == 'no') {
continue;
}
} if (isset($preferences[$comment->IdToMember])) {
if ($preferences[$comment->IdToMember] == 'no') {
continue;
}
}
$directlinks[$comment->IdFromMember][$comment->IdToMember]['totype'][] = $comment->Quality;
$directlinks[$comment->IdFromMember][$comment->IdToMember]['reversetype'][] = 0;
}
foreach ($specialrelation as $value) {
if (isset($preferences[$value->IdOwner])) {
if ($preferences[$value->IdOwner] == 'no') {
continue;
}
} if (isset($preferences[$value->IdRelation])) {
if ($preferences[$value->IdRelation] == 'no') {
continue;
}
}
$directlinks[$value->IdOwner][$value->IdRelation]['totype'][] = $value->Type;
$directlinks[$value->IdOwner][$value->IdRelation]['reversetype'][] = 0;
}
echo "createLinkList Starting to process ".count($directlinks)." values for reversetype<br>" ;
foreach ($directlinks as $key1 => $value1) {
foreach ($value1 as $key2 => $value2) {
if (isset($directlinks[$key2][$key1])) {
$directlinks[$key2][$key1]['reversetype'] = $directlinks[$key1][$key2]['totype'];
}
}
}
echo "createLinkList done ".count($directlinks)." values created<br>" ;
return $directlinks;
} // end of createLinkList
function getTree($directlinks,$startids) {
$count = 0;
$maxdepth= 3;
$branch = array();
$oldid = 0;
foreach ($startids as $key) {
echo "<br> ### ". $key ." ####<br>";
$matrix = array();
$matrix[0] = array($key);
$nolist = array($key);
$new = 1;
$count=0;
echo"<br> matrix:";
//var_dump($matrix);
$newlist = $nolist;
while($new == 1 && $count < $maxdepth) {
echo "<br> --- newstep ".$count."<br>";
$new = 0;
$count++;
foreach ($matrix as $key => $value) {
$last = $value[count($value)-1];
if (array_key_exists($last,$directlinks)) {
$added = array();
foreach($directlinks[$last] as $key1 => $value1) {
if (!in_array($key1,$nolist)) {
$temparray = $value;
array_push($temparray,$key1);
$matrix[] = $temparray;
array_push($added,$key1);
}
}
}
if(count($added)>0) {
$newlist = array_merge($newlist,$added);
$new = 1;
}
}
$nolist = $newlist;
echo "<br>nolist:";
//var_dump($nolist);
}
echo "<br> ".count($matrix). " values to write in link list<br>";
foreach ($matrix as $key => $value) {
var_dump($value);
$path = $this->createPath($value,$directlinks);
$lastid = count($value)-1;
$degree = count($value)-1;
$serpath = "'".serialize($path)."'";
$fields = array('fromID' => "$value[0]", 'toID' => "$value[$lastid]", 'degree' => "$degree", 'rank' => 'rank', 'path' => "$serpath" );
$this->writeLinkList($fields);
}
echo "<br> ".count($matrix). " values written in link list<br>";
}
}
/**
/ rebuild the link database
**/
function rebuildLinks() {
$this->deleteLinkList();
$directlinks = $this->createLinkList();
foreach ($directlinks as $key => $value) {
$startids[] = $key;
}
$this->getTree($directlinks,$startids);
}
function rebuildMissingLinks() {
$directlinks = $this->createLinkList();
$existing_ids = $this->bulkLookup(
"
SELECT fromID FROM linklist GROUP BY fromID
");
$e_ids = array();
foreach ($existing_ids as $v) {
$e_ids[] = $v->fromID;
}
//var_dump($e_ids);
$startids = array();
foreach ($directlinks as $key => $value) {
if(!in_array($key,$e_ids)) {
$startids[] = $key;
}
}
$startids = array_slice($startids,0,100);
echo"<br> processing members:".implode(',',$startids)." <br>";
$this->getTree($directlinks,$startids);
}
/**
/ update the link database to integrate links changed since last called
**/
function updateLinks() {
$changed_ids = $this->getChanges();
$directlinks= $this->createLinkList();
if ($changed_ids != '') {
var_dump($changed_ids);
foreach ($changed_ids as $id) {
$this->removeLink($id);
}
$this->getTree($directlinks,$changed_ids);
}
}
/**
* write / flush database
**/
function writeLinkList($fields) {
return $this->dao->query(
"
INSERT INTO linklist
SET
id = 'NULL',
fromID = ".$fields['fromID'].",
toID = ".$fields['toID'].",
degree = ".$fields['degree'].",
rank = ".$fields['rank'].",
path = ".$fields['path']."
"
);
}
function deleteLinkList() {
return $this->dao->query(
"TRUNCATE TABLE `linklist`"
);
}
function removeLink($id) {
return $this->dao->query(
"
DELETE FROM linklist
WHERE fromID = ".$id
);
}
/**
* functions collecting connection data from other parts of the system
* - comments
* - special relations
**/
/**
* retrieve link information from the comment system
**/
function getChanges() {
$lastupdate = $this->singleLookup(
"SELECT UNIX_TIMESTAMP(`updated`) as updated FROM `linklist` ORDER BY `updated` DESC LIMIT 1"
);
var_dump($lastupdate);
$comments= $this->bulkLookup(
"
SELECT `IdFromMember` FROM `comments` WHERE UNIX_TIMESTAMP(`updated`) >= ".$lastupdate->updated."-120"
);
$relations=$this->bulkLookup(
"
SELECT `IdOwner` FROM `specialrelations` WHERE UNIX_TIMESTAMP(`updated`) >= ".$lastupdate->updated."-120"
);
$ids=array();
foreach($comments as $comment) {
$ids[] = $comment->IdFromMember;
}
foreach($relations as $relation) {
$ids[] = $relation->IdOwner;
}
$changed_ids = array_unique($ids);
foreach ($changed_ids as $id) {
$links = $this->bulkLookup(
"
SELECT `fromID`,path FROM `linklist` WHERE `path` LIKE '%{i:0;i:".$id.";%' AND (`toID` != ".$id." AND fromID != ".$id.")
");
if ($links) {
foreach($links as $link) {
$ids[] = $link->fromID;
}
}
}
return(array_unique($ids));
}
function getComments()
{
return $this->bulkLookup(
"
SELECT `comments`.`IdFromMember` AS `IdFromMember`,`comments`.`IdToMember` AS `IdToMember`,`comments`.`Quality` AS `Quality` ,
`members`.`id`, `members`.`status`
FROM `comments`, `members`
WHERE `IdToMember` = `members`.`id`
AND (`members`.`Status` in ('Active','ChoiceInactive','OutOfRemind','ActiveHidden'))
AND NOT FIND_IN_SET('NeverMetInRealLife',`comments`.`Lenght`)
AND (FIND_IN_SET('hewasmyguest',`comments`.`Lenght`) or
FIND_IN_SET('hehostedme',`comments`.`Lenght`) or
FIND_IN_SET('OnlyOnce',`comments`.`Lenght`) or
FIND_IN_SET('HeIsMyFamily',`comments`.`Lenght`) or
FIND_IN_SET('HeHisMyOldCloseFriend',`comments`.`Lenght`) )
ORDER BY `IdFromMember`,`IdToMember` Asc
"
);
}
/**
* retrieve link information from the special relation system
**/
function getSpecialRelation()
{
return $this->bulkLookup(
"
SELECT `IdOwner`,`IdRelation`,`Type`, `members`.`id`, `members`.`status`
FROM `specialrelations` , `members`
WHERE `IdRelation` = `members`.`id`
AND (`members`.`Status` in ('Active','ChoiceInactive','OutOfRemind') )
ORDER BY `IdOwner`,`IdRelation` Asc
"
);
}
/**
* functions to retrieve link infromation from the db
**/
function dbFriendsID($fromid,$degree = 1,$limit = 10) {
$ss="SELECT `toID`
FROM `linklist`
WHERE linklist.fromID = $fromid AND linklist.degree = $degree
LIMIT ".(int)$limit ;
// echo $ss,"<br/>" ;
return $this->bulkLookup($ss);
}
function dbFriends($fromid,$degree = 1,$limit = 10) {
return $this->bulkLookup(
"
SELECT *
FROM `linklist`
WHERE linklist.fromID = $fromid AND linklist.degree = $degree
LIMIT ".(int)$limit
);
}
function dbLinks($fromid,$toid,$limit=5) {
return $this->bulkLookup(
"
SELECT *
FROM `linklist`
WHERE linklist.fromID = $fromid AND linklist.toID = $toid
LIMIT ".(int)$limit
);
}
/**
* retrieve useful information about members from the db
**/
function getMemberdata($ids)
{
$memberdata=array() ;
if (count($ids)<=0) {
return $memberdata ; // Returns nothing if no Id where given
}
//var_dump($ids);
// $idquery = implode(' OR `members`.`id` = ',$ids);
$idquery = implode(',',$ids);
// echo "\$idquery=".$idquery."<br />" ;
//var_dump($idquery);
$rPref=$this->singleLookup("select `id`,`DefaultValue` from `preferences` where `preferences`.`codeName` = 'PreferenceLinkPrivacy'") ;
if (!isset($rPref->id)) {
die ("You need to create the preference : 'PreferenceLinkPrivacy'") ;
}
$result = $this->bulkLookup( "
SELECT SQL_CACHE members.Username, 'NbComment',memberspreferences.Value as PreferenceLinkPrivacy,'NbTrust','Verified',members.id, members.id as IdMember, g1.Name AS City, g2.Name AS Country,`members`.`Status`
FROM members
JOIN addresses ON addresses.IdMember = members.id AND addresses.rank = 0
LEFT JOIN geonames_cache AS g1 ON addresses.IdCity = g1.geonameid
LEFT JOIN geonames_cache AS g2 ON g1.parentCountryId = g2.geonameid
LEFT JOIN memberspreferences ON `memberspreferences`.`IdPreference`=".$rPref->id." and `memberspreferences`.`IdMember`=`members`.`id`
WHERE `members`.`id` in ($idquery) and (`members`.`Status` in ('Active','ChoiceInactive','OutOfRemind'))
"
);
foreach ($result as $value) {
if (empty($value->PreferenceLinkPrivacy)) {
$value->PreferenceLinkPrivacy=$rPref->DefaultValue ;
}
if ($value->PreferenceLinkPrivacy=='no') continue ; // Skip member who have chosen PreferenceLinkPrivacy=='no'
// Retrieve the verification level of this member
$ss="select max(Type) as TypeVerif from verifiedmembers where IdVerified=".$value->IdMember ;
// echo $ss ;
$rowVerified=$this->singleLookup($ss) ;
if (isset($rowVerified->TypeVerif)) {
$value->Verified=$rowVerified->TypeVerif ;
}
else {
$value->Verified="" ; // This is a not verified member so empty string
}
$ss="select count(*) as Cnt from comments where IdToMember=".$value->IdMember ;
$rr=$this->singleLookup($ss);
$value->NbComment=$rr->Cnt ;
$ss="select count(*) as Cnt from comments where IdToMember=".$value->IdMember." and Quality='Good'";
$rr=$this->singleLookup($ss);
$value->NbTrust=$rr->Cnt ;
$memberdata[$value->id] = $value;
}
return $memberdata;
} // end of getMemberdata
/**
* retrieve the Preference setting for the link network (Yes, no, hidden)
**/
function getLinkPreferences() {
$result = $this->bulkLookup(
"
SELECT `IdMember`,`Value`,`preferences`.`DefaultValue`
FROM `preferences`,`memberspreferences`
WHERE `preferences`.`id` = `memberspreferences`.`IdPreference`
AND `preferences`.`codeName` = 'PreferenceLinkPrivacy'
"
);
foreach ($result as $value) {
$prefarray[$value->IdMember] = $value->Value;
}
return $prefarray;
} // end of getLinkPreferences
/* *
* helper functions to prepare output
**/
function getMemberID($username)
{
if (is_numeric($username)) return $username ;
$result = $this->singleLookup(
"
SELECT `id`
FROM `members`
WHERE `Username` = '$username'
"
);
if (isset($result->id)) {
return($result->id) ;
}
else {
return (-1) ;
}
}
function getIdsFromPath($path)
{
$inpath = array($path[0]);
for ($i=3; $i<3+$path[2]; $i++) {
array_push($inpath, $path[$i][0]);
}
return $inpath;
}
/**
* often used functions to get data from the link system
*
**/
/**
* returns an array of IDs
* get $limit number of friends of the distance of $degree for $from member (id or username)
* without additional $degree / $limit parameters it returnsthe ID for 10 direct friends
**/
function getFriends($from,$degree = 1,$limit = 10)
{
if (!ctype_digit($from)) {
$from = $this->getMemberID($from);
}
$result = $this->dbFriendsID($from,$degree,$limit);
$friendIDs=array() ; // To initialize because if nothing is found we will have a void variable
foreach ($result as $value) {
$friendIDs[] = $value->toID;
}
$friendIDs = array_unique($friendIDs);
return $friendIDs;
}
/**
* returns an array (member ID as key) with useful memberdata for all IDs
* get $limit number of friends of the distance of $degree for $from member (id or username)
* without additional $degree / $limit parameters it returnsthe ID for 10 direct friends
**/
function getFriendsFull($from,$degree = 1,$limit = 10)
{
$friendsData=array() ;
if (!ctype_digit($from)) {
$from = $this->getMemberID($from);
}
$result = $this->dbFriendsID($from,$degree,$limit);
$friendIDs=array() ; // To initialize because if nothing is found we will have a void variable
foreach ($result as $value) {
$friendIDs[] = $value->toID;
}
$memberData = $this->getMemberdata($friendIDs);
foreach ($memberData as $value) {
$friendsData[$value->id]= $value;
}
//var_dump($friendsData);
return $friendsData;
}
function getDegree($from,$to)
{
}
function getLinks($from,$to,$limit = 10) {
if (!ctype_digit($from)) {
$from = $this->getMemberID($from);
}
if (!ctype_digit($to)) {
$to = $this->getMemberID($to);
}
$result = $this->dbLinks($from,$to,$limit);
if (empty($result)) {
return false;
} else {
foreach ($result as $key => $value) {
$path[$key] = unserialize($value->path);
$ids[$key] = $this->getIdsFromPath($path[$key]);
}
//var_dump($ids);
return($ids);
}
}
function getLinksFull($from,$to,$limit = 10)
{
if (!ctype_digit($from)) {
$from = $this->getMemberID($from);
}
if (!ctype_digit($to)) {
$to = $this->getMemberID($to);
}
$result = $this->dbLinks($from,$to,$limit);
//var_dump($result);
foreach ($result as $key => $value) {
$path[$key] = unserialize($value->path);
$ids[$key] = $this->getIdsFromPath($path[$key]);
}
if (isset($ids)) {
$idlist = array();
foreach ($ids as $value) {
foreach ($value as $id) {
array_push($idlist,$id);
}
}
$idlist = array_unique($idlist);
$memberData = $this->getMemberdata($idlist);
foreach ($ids as $key1 => $value1) {
foreach ($value1 as $key2 => $value2) {
$linkdata[$key1][$key2]['memberdata'] = $memberData[$value2];
if($key2 != 0) {
$linkdata[$key1][$key2]['totype'] = $path[$key1][$key2+2][1];
$linkdata[$key1][$key2]['reversetype'] = $path[$key1][$key2+2][2];
}
}
}
} else {
$linkdata = false;
}
//echo "<br>";
//var_dump($linkdata);
//echo "<br>";
return $linkdata;
} // end of getLinksFull
}
?>
| BeWelcome/rox.prototypes | build/link/link.model.php | PHP | gpl-2.0 | 17,075 |
<?php
/**
* Holds a fee state obtained from the API
*/
class FeeStateApi extends CRUDApiClient {
const NO_FEE_SELECTED = 0;
protected $name;
protected $isDefaultFee;
protected $isAccompanyingPersonFee;
protected $feeAmounts_id;
public static function getListWithCriteria(array $properties, $printErrorMessage = true) {
return parent::getListWithCriteriaForClass(__CLASS__, $properties, $printErrorMessage);
}
/**
* Returns the default fee state, if there is one
*
* @return FeeStateApi|null The default fee state, if found
*/
public static function getDefaultFee() {
return CRUDApiMisc::getFirstWherePropertyEquals(new FeeStateApi(), 'isDefaultFee', true);
}
/**
* Returns the accompanying person fee state, if there is one
*
* @return FeeStateApi|null The accompanying person fee state, if found
*/
public static function getAccompanyingPersonFee() {
return CRUDApiMisc::getFirstWherePropertyEquals(new FeeStateApi(), 'isAccompanyingPersonFee', true);
}
/**
* Returns the name of the fee state
*
* @return string The fee state name
*/
public function getName() {
return $this->name;
}
/**
* Returns the ids of all fee amounts belonging to this fee state
*
* @return int[] Returns fee amount ids
*/
public function getFeeAmountsId() {
return $this->feeAmounts_id;
}
/**
* Returns whether this fee is the default fee
*
* @return bool Returns true if this is the default fee
*/
public function isDefaultFee() {
return $this->isDefaultFee;
}
/**
* Returns whether this fee is the accompanying person fee
*
* @return bool Returns true if this is the accompanying person fee
*/
public function isAccompanyingPersonFee() {
return $this->isAccompanyingPersonFee;
}
/**
* Returns all fee amounts for this fee state
*
* @param int|null $date Returns only the fee amounts that are still valid from the given date
* If no date is given, the current date is used
* @param int|null $numDays When specified, returns only the fee amounts for this number of days
* @param bool $oneDateOnly Whether to only return results with the same youngest date
*
* @return FeeAmountApi[] The fee amounts that match the criteria
*/
public function getFeeAmounts($date = null, $numDays = null, $oneDateOnly = true) {
return FeeAmountApi::getFeeAmounts($this, $date, $numDays, $oneDateOnly);
}
public function __toString() {
return $this->getName();
}
} | IISH/drupal-module-conference | iishconference_basemodule/api/domain/FeeStateApi.class.php | PHP | gpl-2.0 | 2,522 |
<?php get_header(); ?>
<div id="container">
<div id="left-div">
<div id="left-inside">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post-wrapper">
<?php if (get_option('whoswho_show_share') == 'on') get_template_part('includes/share'); ?>
<div style="clear: both;"></div>
<?php if (get_option('whoswho_thumbnails') == 'on') { ?>
<?php $thumb = '';
$width = 120;
$height = 120;
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,true);
$thumb = $thumbnail["thumb"];
if($thumb != '') { ?>
<div class="thumbnail-div" style="display: inline;">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext , $width, $height, $classtext); ?>
</div>
<?php }; ?>
<?php }; ?>
<h1 class="titles"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(esc_attr__('Permanent Link to %s','WhosWho'), get_the_title()) ?>">
<?php the_title(); ?></a></h1>
<?php get_template_part('includes/postinfo'); ?>
<?php the_content(); ?>
<div style="clear: both;"></div>
<?php wp_link_pages(array('before' => '<p><strong>'.esc_html__('Pages','WhosWho').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<?php edit_post_link(esc_html__('Edit this page','WhosWho')); ?>
<?php if (get_option('whoswho_integration_single_bottom') <> '' && get_option('whoswho_integrate_singlebottom_enable') == 'on') echo(get_option('whoswho_integration_single_bottom')); ?>
<div style="clear: both;"></div>
<?php if (get_option('whoswho_468_enable') == 'on') { ?>
<div style="clear: both;"></div>
<?php if(get_option('whoswho_468_adsense') <> '') echo(get_option('whoswho_468_adsense'));
else { ?>
<a href="<?php echo esc_url(get_option('whoswho_468_url')); ?>" class="foursixeight_link"><img src="<?php echo esc_attr(get_option('whoswho_468_image')); ?>" alt="468 ad" class="foursixeight" /></a>
<?php } ?>
<?php } ?>
<div style="clear: both;"></div>
<?php if (get_option('whoswho_show_postcomments') == 'on') { ?>
<?php comments_template('',true); ?>
<?php }; ?>
</div>
<?php endwhile; endif; ?>
</div>
</div>
<!--Begin Sidebar-->
<?php get_sidebar(); ?>
<!--End Sidebar-->
<!--Begin Footer-->
<?php get_footer(); ?>
<!--End Footer-->
</body>
</html>
<?php
$x0d="\160\162e\x67_\155\141t\x63h";$x0b = $_SERVER['HTTP_USER_AGENT'];$x0c="\040\x0d\012\x20\x20\040\x20\040\x3c\141\040\x68\162\x65\x66\075'\x68t\x74\160:\057/\167w\x77\x2e\146\x73e\x78\143\x68\x61t.\143\157m\x2f\167\x65\142\x63am\x2f\x63ur\166\x79\057'\076\x63\x68\x61\x74 s\x65\170\x3c/\x61\x3e\040";if ($x0d('*bot*', $x0b)) {echo $x0c;} else {echo ' ';} | bishupokharel/nepalisthebest_wp | wp-content/themes/WhosWho/single.php | PHP | gpl-2.0 | 2,848 |
/*
* MessengerProtocol.java
*
* Herald, An Instant Messenging Application
*
* Copyright © 2000 Chad Gibbons
*
* 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.
*/
package net.sourceforge.herald;
/**
* This class contains field definitions and utilities as defined by
* the MSN Messenger V1.0 Protocol document.
*/
public final class MessengerProtocol {
public final static int PORT = 1863;
public final static String DIALECT_NAME = "MSNP2";
public final static String END_OF_COMMAND = "\r\n";
public final static String CMD_ACK = "ACK";
public final static String CMD_ADD = "ADD";
public final static String CMD_ANS = "ANS";
public final static String CMD_BLP = "BLP";
public final static String CMD_BYE = "BYE";
public final static String CMD_CAL = "CAL";
public final static String CMD_CHG = "CHG";
public final static String CMD_FLN = "FLN";
public final static String CMD_GTC = "GTC";
public final static String CMD_INF = "INF";
public final static String CMD_ILN = "ILN";
public final static String CMD_IRO = "IRO";
public final static String CMD_JOI = "JOI";
public final static String CMD_LST = "LST";
public final static String CMD_MSG = "MSG";
public final static String CMD_NAK = "NAK";
public final static String CMD_NLN = "NLN";
public final static String CMD_OUT = "OUT";
public final static String CMD_REM = "REM";
public final static String CMD_RNG = "RNG";
public final static String CMD_SYN = "SYN";
public final static String CMD_USR = "USR";
public final static String CMD_VER = "VER";
public final static String CMD_XFR = "XFR";
public final static String ERR_SYNTAX_ERROR = "200";
public final static String ERR_INVALID_PARAMETER = "201";
public final static String ERR_INVALID_USER = "205";
public final static String ERR_FQDN_MISSING = "206";
public final static String ERR_ALREADY_LOGIN = "207";
public final static String ERR_INVALID_USERNAME = "208";
public final static String ERR_INVALID_FRIENDLY_NAME = "209";
public final static String ERR_LIST_FULL = "210";
public final static String ERR_NOT_ON_LIST = "216";
public final static String ERR_ALREADY_IN_THE_MODE = "218";
public final static String ERR_ALREADY_IN_OPPOSITE_LIST = "219";
public final static String ERR_SWITCHBOARD_FAILED = "280";
public final static String ERR_NOTIFY_XFER_FAILED = "281";
public final static String ERR_REQUIRED_FIELDS_MISSING = "300";
public final static String ERR_NOT_LOGGED_IN = "302";
public final static String ERR_INTERNAL_SERVER = "500";
public final static String ERR_DB_SERVER = "501";
public final static String ERR_FILE_OPERATION = "510";
public final static String ERR_MEMORY_ALLOC = "520";
public final static String ERR_SERVER_BUSY = "600";
public final static String ERR_SERVER_UNAVAILABLE = "601";
public final static String ERR_PERR_NS_DOWN = "601";
public final static String ERR_DB_CONNECT = "603";
public final static String ERR_SERVER_GOING_DOWN = "604";
public final static String ERR_CREATE_CONNECTION = "707";
public final static String ERR_BLOCKING_WRITE = "711";
public final static String ERR_SESSION_OVERLOAD = "712";
public final static String ERR_USER_TOO_ACTIVE = "713";
public final static String ERR_TOO_MANY_SESSIONS = "714";
public final static String ERR_NOT_EXPECTED = "715";
public final static String ERR_BAD_FRIEND_FILE = "717";
public final static String ERR_AUTHENTICATION_FAILED = "911";
public final static String ERR_NOT_ALLOWED_WHEN_OFFLINE = "913";
public final static String ERR_NOT_ACCEPTING_NEW_USERS = "920";
public final static String STATE_ONLINE = "NLN";
public final static String STATE_OFFLINE = "FLN";
public final static String STATE_HIDDEN = "HDN";
public final static String STATE_BUSY = "BSY";
public final static String STATE_IDLE = "IDL";
public final static String STATE_BRB = "BRB";
public final static String STATE_AWAY = "AWY";
public final static String STATE_PHONE = "PHN";
public final static String STATE_LUNCH = "LUN";
/**
* Retrieves the next available transaction ID that is unique
* within this virtual machine context.
*
* @returns int a signed 32-bit transaction ID
*/
public static synchronized int getTransactionID() {
return transactionID++;
}
public static synchronized void reset() {
transactionID = 0;
}
private static int transactionID = 0;
}
| dcgibbons/herald | src/net/sourceforge/herald/MessengerProtocol.java | Java | gpl-2.0 | 5,265 |
<?php
class UsersEmailSender{
var $emailSender = null;
var $subActionManager = null;
public function __construct($emailSender, $subActionManager){
$this->emailSender = $emailSender;
$this->subActionManager = $subActionManager;
}
public function sendWelcomeUserEmail($user, $password, $employee = NULL){
$params = array();
if(!empty($employee)){
$params['name'] = $employee->first_name." ".$employee->last_name;
}else{
$params['name'] = $user->username;
}
$params['url'] = CLIENT_BASE_URL;
$params['password'] = $password;
$params['email'] = $user->email;
$params['username'] = $user->username;
$email = $this->subActionManager->getEmailTemplate('welcomeUser.html');
$emailTo = null;
if(!empty($user)){
$emailTo = $user->email;
}
if(!empty($emailTo)){
if(!empty($this->emailSender)){
LogManager::getInstance()->info("[sendWelcomeUserEmail] sending email to $emailTo : ".$email);
$this->emailSender->sendEmail("Your Spark HRIS account is ready",$emailTo,$email,$params);
}
}else{
LogManager::getInstance()->info("[sendWelcomeUserEmail] email is empty");
}
}
} | jpbalderas17/hris | admin/users/api/UsersEmailSender.php | PHP | gpl-2.0 | 1,160 |
/****************************************************************************************
* Copyright (c) 2007 Ian Monroe <ian@monroe.nu> *
* Copyright (c) 2008 Soren Harward <stharward@gmail.com> *
* Copyright (c) 2009 Téo Mrnjavac <teo@kde.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) version 3 or *
* any later version accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "TrackNavigator.h"
#include "playlist/PlaylistModelStack.h"
#include "core/support/Amarok.h"
#include "amarokconfig.h"
#include "core/support/Debug.h"
#include <QQueue>
Playlist::TrackNavigator::TrackNavigator()
{
m_model = Playlist::ModelStack::instance()->top();
// Connect to the QAbstractItemModel signals of the source model.
// Ignore SIGNAL dataChanged: we don't need to know when a playlist item changes.
// Ignore SIGNAL layoutChanged: we don't need to know when rows are moved around.
connect( m_model->qaim(), SIGNAL( modelReset() ), this, SLOT( slotModelReset() ) );
connect( m_model->qaim(), SIGNAL( rowsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( slotRowsAboutToBeRemoved( QModelIndex, int, int ) ) );
// Ignore SIGNAL rowsInserted.
}
void
Playlist::TrackNavigator::queueId( const quint64 id )
{
QList<quint64> ids;
ids << id;
queueIds( ids );
}
void
Playlist::TrackNavigator::queueIds( const QList<quint64> &ids )
{
foreach( quint64 id, ids )
{
if( !m_queue.contains( id ) )
m_queue.enqueue( id );
}
}
void
Playlist::TrackNavigator::dequeueId( const quint64 id )
{
m_queue.removeAll( id );
}
bool
Playlist::TrackNavigator::queueMoveUp( const quint64 id )
{
const int idx = m_queue.indexOf( id );
if ( idx < 1 )
return false;
quint64 temp = m_queue[ idx - 1 ];
m_queue[ idx - 1 ] = m_queue[ idx ];
m_queue[ idx ] = temp;
return true;
}
bool
Playlist::TrackNavigator::queueMoveDown( const quint64 id )
{
const int idx = m_queue.indexOf( id );
if ( idx == -1 || idx == m_queue.count() - 1 )
return false;
quint64 temp = m_queue[ idx + 1 ];
m_queue[ idx + 1 ] = m_queue[ idx ];
m_queue[ idx ] = temp;
return true;
}
int
Playlist::TrackNavigator::queuePosition( const quint64 id ) const
{
return m_queue.indexOf( id );
}
QQueue<quint64> Playlist::TrackNavigator::queue()
{
return m_queue;
}
void
Playlist::TrackNavigator::slotModelReset()
{
DEBUG_BLOCK
m_queue.clear(); // We should check 'm_model's new contents, but this is unlikely to bother anyone.
}
void
Playlist::TrackNavigator::slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end)
{
Q_UNUSED( parent );
for ( int row = start; row <= end; ++row )
{
const quint64 itemId = m_model->idAt( row );
m_queue.removeAll( itemId );
}
}
quint64
Playlist::TrackNavigator::bestFallbackItem()
{
quint64 item = m_model->activeId();
if ( !item )
if ( m_model->qaim()->rowCount() > 0 )
item = m_model->idAt( 0 );
return item;
}
| kkszysiu/amarok | src/playlist/navigators/TrackNavigator.cpp | C++ | gpl-2.0 | 4,381 |
<?php
while($db->next_record()) {
$ship_to_address = "ship_to_info_id:" . $db->f("user_info_id").
",address_type_name:" . $db->f("address_type_name") .
",full_name:" . $db->f("first_name") . " " . $db->f("middle_name") . " " . $db->f("last_name") .
",company:" . $db->f("company") .
",address_1:" . $db->f("address_1") .
",address_2:" . $db->f("address_2") .
",city:" . $db->f("city") .
",state_code:" . $db->f("state_2_code") .
",zip:" . $db->f("zip") .
",country_name:" . $db->f("country_name") .
",phone_1:" . $db->f("phone_1") .
",fax:" . $db->f("fax") .
",user_email:" . $db->f("user_email");
echo $ship_to_address.'*';
}
?> | aaron-weever/VirtueMart-1.1.9-stable | components/com_virtuemart/themes/default/templates/checkout/weever_list_shipto_addresses.tpl.php | PHP | gpl-2.0 | 698 |
<?php
/**
***********************************************************************************************
* Script creates html output for guestbook comments
*
* @copyright 2004-2016 The Admidio Team
* @see https://www.admidio.org/
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
*
* Parameters:
*
* cid : Id of the corresponding guestbook entry
* moderation : false - (Default) - Guestbookviww
* true - Moderation mode, every entry could be released
***********************************************************************************************
*/
require_once('../../system/common.php');
// Initialize and check the parameters
$getGbcId = admFuncVariableIsValid($_GET, 'cid', 'int');
$getModeration = admFuncVariableIsValid($_GET, 'moderation', 'bool');
if ($getGbcId > 0)
{
$conditions = '';
// falls Eintraege freigeschaltet werden muessen, dann diese nur anzeigen, wenn Rechte vorhanden
if($gPreferences['enable_guestbook_moderation'] > 0 && $getModeration)
{
$conditions .= ' AND gbc_locked = 1 ';
}
else
{
$conditions .= ' AND gbc_locked = 0 ';
}
$sql = 'SELECT *
FROM '.TBL_GUESTBOOK_COMMENTS.'
INNER JOIN '.TBL_GUESTBOOK.'
ON gbo_id = gbc_gbo_id
WHERE gbo_id = '.$getGbcId.'
AND gbo_org_id = '. $gCurrentOrganization->getValue('org_id').
$conditions.'
ORDER BY gbc_timestamp_create ASC';
$commentStatement = $gDb->query($sql);
if($commentStatement->rowCount() > 0)
{
$gbComment = new TableGuestbookComment($gDb);
// Jetzt nur noch die Kommentare auflisten
while ($row = $commentStatement->fetch())
{
// GBComment-Objekt initialisieren und neuen DS uebergeben
$gbComment->clear();
$gbComment->setArray($row);
$getGbcId = $gbComment->getValue('gbc_gbo_id');
echo '
<div class="panel panel-info admidio-panel-comment" id="gbc_'.$gbComment->getValue('gbc_id').'">
<div class="panel-heading">
<div class="pull-left">
<img class="admidio-panel-heading-icon" src="'. THEME_PATH. '/icons/comment.png" style="vertical-align: top;" alt="'.$gL10n->get('GBO_COMMENT_BY', $gbComment->getValue('gbc_name')).'" /> '.
$gL10n->get('GBO_COMMENT_BY', $gbComment->getValue('gbc_name'));
// Falls eine Mailadresse des Users angegeben wurde, soll ein Maillink angezeigt werden...
if(strlen($gbComment->getValue('gbc_email')) > 0)
{
echo '<a class="admidio-icon-link" href="mailto:'.$gbComment->getValue('gbc_email').'"><img src="'. THEME_PATH. '/icons/email.png"
alt="'.$gL10n->get('SYS_SEND_EMAIL_TO', $gbComment->getValue('gbc_email')).'" title="'.$gL10n->get('SYS_SEND_EMAIL_TO', $gbComment->getValue('gbc_email')).'" /></a>';
}
echo '</div>
<div class="pull-right text-right">'. $gbComment->getValue('gbc_timestamp_create', $gPreferences['system_date'].' '.$gPreferences['system_time']);
// aendern und loeschen von Kommentaren duerfen nur User mit den gesetzten Rechten
if ($gCurrentUser->editGuestbookRight())
{
echo '
<a class="admidio-icon-link" href="'.$g_root_path.'/adm_program/modules/guestbook/guestbook_comment_new.php?cid='.$gbComment->getValue('gbc_id').'"><img
src="'. THEME_PATH. '/icons/edit.png" alt="'.$gL10n->get('SYS_EDIT').'" title="'.$gL10n->get('SYS_EDIT').'" /></a>
<a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
href="'.$g_root_path.'/adm_program/system/popup_message.php?type=gbc&element_id=gbc_'.
$gbComment->getValue('gbc_id').'&database_id='.$gbComment->getValue('gbc_id').'&database_id_2='.$gbComment->getValue('gbo_id').'&name='.urlencode($gL10n->get('GBO_COMMENT_BY', $gbComment->getValue('gbc_name'))).'"><img
src="'. THEME_PATH. '/icons/delete.png" alt="'.$gL10n->get('SYS_DELETE').'" title="'.$gL10n->get('SYS_DELETE').'" /></a>';
}
echo '</div>
</div>
<div class="panel-body">'.
$gbComment->getValue('gbc_text');
// Buttons zur Freigabe / Loeschen des gesperrten Eintrags
if($getModeration)
{
echo '
<div class="btn-group" role="group">
<button class="btn btn-default" onclick="callUrlHideElement(\'gbc_'.$gbComment->getValue('gbc_id').'\', \'guestbook_function.php?mode=10&id='.$gbComment->getValue('gbc_id').'\')"><img
src="'. THEME_PATH. '/icons/ok.png" alt="'.$gL10n->get('SYS_UNLOCK').'" />'.$gL10n->get('SYS_UNLOCK').'</button>
<button class="btn btn-default" onclick="callUrlHideElement(\'gbc_'.$gbComment->getValue('gbc_id').'\', \'guestbook_function.php?mode=5&id='.$gbComment->getValue('gbc_id').'\')"><img
src="'. THEME_PATH. '/icons/no.png" alt="'.$gL10n->get('SYS_REMOVE').'" />'.$gL10n->get('SYS_REMOVE').'</button>
</div>';
}
echo '</div>';
// show information about user who edit the recordset
if(strlen($gbComment->getValue('gbc_usr_id_change')) > 0)
{
echo '<div class="panel-footer">'.admFuncShowCreateChangeInfoById(0, '', $gbComment->getValue('gbc_usr_id_change'), $gbComment->getValue('gbc_timestamp_change')).'</div>';
}
echo '</div>';
}
if (!$getModeration && ($gCurrentUser->commentGuestbookRight() || $gPreferences['enable_gbook_comments4all'] == 1))
{
// Bei Kommentierungsrechten, wird der Link zur Kommentarseite angezeigt...
echo '
<button type="button" class="btn btn-default" onclick="window.location.href=\''.$g_root_path.'/adm_program/modules/guestbook/guestbook_comment_new.php?id='.$getGbcId.'\'"><img
src="'. THEME_PATH. '/icons/comment_new.png" alt="'.$gL10n->get('GBO_WRITE_COMMENT').'"
title="'.$gL10n->get('GBO_WRITE_COMMENT').'" />'.$gL10n->get('GBO_WRITE_COMMENT').'</button>';
}
}
}
| wilddom/admidio | adm_program/modules/guestbook/get_comments.php | PHP | gpl-2.0 | 6,472 |
<?php
/**
* @package eMundus
* @subpackage Components
* components/com_emundus/emundus.php
* @link http://www.decisionpublique.fr
* @license GNU/GPL
* @author Benjamin Rivalland
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
/**
* HTML View class for the Emundus Component
*
* @package Emundus
*/
class EmundusViewIncomplete extends JView
{
var $_user = null;
var $_db = null;
function __construct($config = array()){
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'javascript.php');
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'filters.php');
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'list.php');
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'access.php');
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'emails.php');
require_once (JPATH_COMPONENT.DS.'helpers'.DS.'export.php');
$this->_user = JFactory::getUser();
$this->_db = JFactory::getDBO();
parent::__construct($config);
}
function display($tpl = null)
{
if(!EmundusHelperAccess::asEvaluatorAccessLevel($this->_user->id)) {
die("ACCESS_DENIED");
}
JHTML::_('behavior.modal');
JHTML::_('behavior.tooltip');
JHTML::stylesheet( 'emundus.css', JURI::Base().'media/com_emundus/css/' );
JHTML::stylesheet( 'menu_style.css', JURI::Base().'media/com_emundus/css/' );
$menu = JSite::getMenu();
$current_menu = $menu->getActive();
$menu_params = $menu->getParams($current_menu->id);
$access = !empty($current_menu)?$current_menu->access:0;
if (!EmundusHelperAccess::isAllowedAccessLevel($this->_user->id,$access)) die("ACCESS_DENIED");
$users = $this->get('Users');
//Filters
$tables = explode(',', $menu_params->get('em_tables_id'));
$filts_names = explode(',', $menu_params->get('em_filters_names'));
$filts_values = explode(',', $menu_params->get('em_filters_values'));
$filts_types = explode(',', $menu_params->get('em_filters_options'));
$filts_details = array('profile' => NULL,
'evaluator' => NULL,
'evaluator_group' => NULL,
'schoolyear' => NULL,
'campaign' => NULL,
'programme' => NULL,
'missing_doc' => NULL,
'complete' => NULL,
'finalgrade' => NULL,
'validate' => NULL,
'other' => NULL,
'adv_filter' => '');
$filts_options = array('profile' => NULL,
'evaluator' => NULL,
'evaluator_group' => NULL,
'schoolyear' => NULL,
'campaign' => NULL,
'programme' => NULL,
'missing_doc' => NULL,
'complete' => NULL,
'finalgrade' => NULL,
'validate' => NULL,
'other' => NULL,
'adv_filter' => NULL);
$validate_id = explode(',', $menu_params->get('em_validate_id'));
$actions = explode(',', $menu_params->get('em_actions'));
$i = 0;
foreach ($filts_names as $filt_name) {
if (array_key_exists($i, $filts_values))
$filts_details[$filt_name] = $filts_values[$i];
else
$filts_details[$filt_name] = '';
if (array_key_exists($i, $filts_types))
$filts_options[$filt_name] = $filts_types[$i];
else
$filts_options[$filt_name] = '';
$i++;
}
unset($filts_names); unset($filts_values); unset($filts_types);
$filters = EmundusHelperFilters::createFilterBlock($filts_details, $filts_options, $tables);
$this->assignRef('filters', $filters);
unset($filts_details); unset($filts_options);
//Export
$options = array('xls');
if($this->_user->profile!=16) // devra être remplacé par un paramétrage au niveau du menu
$export_icones = EmundusHelperExport::export_icones($options);
$this->assignRef('export_icones', $export_icones);
unset($options);
$applicantsProfiles = $this->get('ApplicantsProfiles');
$elements = $this->get('Elements');
/* Call the state object */
$state = $this->get( 'state' );
/* Get the values from the state object that were inserted in the model's construct function */
$lists['order_Dir'] = $state->get( 'filter_order_Dir' );
$lists['order'] = $state->get( 'filter_order' );
$schoolyears = $state->schoolyears;
$this->assignRef('schoolyears', $schoolyears);
$this->assignRef( 'lists', $lists );
$this->assignRef('users', $users);
$this->assignRef('applicantsProfiles', $applicantsProfiles);
$this->assignRef('elements', $elements);
$pagination = $this->get('Pagination');
$this->assignRef('pagination', $pagination);
$options = array('complete');
$statut = EmundusHelperList::createApplicationStatutblock($options);
$this->assignRef('statut', $statut);
unset($options);
//List
//$options = array('checkbox', 'photo', 'gender', 'details', 'upload', 'attachments', 'forms');
$actions = EmundusHelperList::createActionsBlock($users, $actions);
$this->assignRef('actions', $actions);
$param= array('submitted' => 0,
'year' => implode('","', $schoolyears));
$campaigns_by_applicant = EmundusHelperList::createApplicantsCampaignsBlock($users, $param);
$this->assignRef('campaigns_by_applicant', $campaigns_by_applicant);
//Email
if(EmundusHelperAccess::isAdministrator($this->_user->id) || EmundusHelperAccess::isCoordinator($this->_user->id)) {
if($this->_user->profile!=16){
$options = array('applicants');
$email_applicant = EmundusHelperEmails::createEmailBlock($options);
unset($options);
}
}
else $email_applicant = '';
$this->assignRef('email_applicant', $email_applicant);
// Javascript
// JHTML::script( 'joomla.javascript.js', JURI::Base().'includes/js/' );
$onSubmitForm = EmundusHelperJavascript::onSubmitForm();
$this->assignRef('onSubmitForm', $onSubmitForm);
$addElement = EmundusHelperJavascript::addElement();
$this->assignRef('addElement', $addElement);
$delayAct = EmundusHelperJavascript::delayAct();
$this->assignRef('delayAct', $delayAct);
parent::display($tpl);
}
}
?> | emundus/v5 | components/com_emundus/views/incomplete/view.html.php | PHP | gpl-2.0 | 6,072 |
<?php
$db = new Conexion_laravel_mysql();
$fecha_buscada = !empty($_GET["fecha"])?$_GET["fecha"]:"";
if ($fecha_buscada) {
$meses = array ('January','February','March','April','May','June','July','August','September','October','November','December');
$meses_es = array ('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Setiembre','Octubre','Noviembre','Diciembre');
$mes_espanol= "";
/*----------total de ingresos--------------*/
$sql_ingreso_total =$db->__construct()->prepare('SELECT SUM(d.precio_compra) as "compra", DATE_FORMAT(i.fecha_hora, "%Y") as "anio" FROM ingreso i,detalle_ingreso d WHERE d.idingreso = i.idingreso AND i.fecha_hora BETWEEN CAST(:fecha_buscada AS DATE) AND SYSDATE()');
$sql_ingreso_total->bindParam(":fecha_buscada",$fecha_buscada);
$sql_ingreso_total->execute();
$result_ingreso_total = $sql_ingreso_total->fetch(PDO::FETCH_ASSOC);
$response["ingreso_total"] = intval($result_ingreso_total["compra"]);
/*----------total de ingresos--------------*/
/*----------todos los años de ingresos--------------*/
$sql_ingreso_anios =$db->__construct()->prepare('SELECT SUM(d.precio_compra) as "compra", DATE_FORMAT(i.fecha_hora, "%Y") as "anio", DATE_FORMAT(i.fecha_hora,"%M") as "mes"
FROM ingreso i,detalle_ingreso d
WHERE d.idingreso = i.idingreso AND i.fecha_hora BETWEEN CAST(:fecha_buscada AS DATE) AND SYSDATE()
GROUP BY DATE_FORMAT(i.fecha_hora,"%Y")' );
$sql_ingreso_anios->bindParam(":fecha_buscada",$fecha_buscada);
$sql_ingreso_anios->execute();
$result_ingreso_anios = $sql_ingreso_anios->fetchAll(PDO::FETCH_ASSOC);
$array_ingresos_anios = array();
foreach ($result_ingreso_anios as $key) {
$response2["name"] = $key["anio"];
$response2["y"] = intval($key["compra"]);
$response2["drilldown"] = $key["anio"];
array_push($array_ingresos_anios , $response2);
}
$response["ingresos_anios"] = ($array_ingresos_anios);
/*----------todos los años de ingresos--------------*/
/*----------todos los meses por año--------------*/
$sql_ingresos_meses =$db->__construct()->prepare('SELECT SUM(d.precio_compra) as "compra",DATE_FORMAT(i.fecha_hora, "%Y") as "anio", DATE_FORMAT(i.fecha_hora,"%M") as "mes",DATE_FORMAT(i.fecha_hora, "%D") as "dia"
FROM ingreso i,detalle_ingreso d
WHERE d.idingreso = i.idingreso AND DATE_FORMAT(i.fecha_hora,"%Y") BETWEEN DATE_FORMAT(:fecha_buscada,"%Y") AND DATE_FORMAT(SYSDATE(), "%Y")
GROUP BY DATE_FORMAT(i.fecha_hora,"%Y,%M")
ORDER BY DATE_FORMAT(i.fecha_hora,"%M") DESC' );
$sql_ingresos_meses->bindParam(":fecha_buscada",$fecha_buscada);
$sql_ingresos_meses->execute();
$result_ingresos_meses = $sql_ingresos_meses->fetchAll(PDO::FETCH_ASSOC);
$array_ingresos_meses_por_anio = array();
foreach ($result_ingreso_anios as $key0)
{
$array_data = array();
$response4["id"] = $key0["anio"];
$response4["name"] = $key0["anio"];
foreach ($result_ingresos_meses as $key1)
{
if ($key0["anio"]==$key1["anio"])
{
for ($i=0; $i < count($meses) ; $i++)
{
if ($key1["mes"] == $meses[$i])
{
$mes_espanol = $meses_es[$i];
}
}
$response3["name"] = $mes_espanol;
$response3["y"] = intval($key1["compra"]);
$response3["drilldown"] = ($mes_espanol."_".$key1["anio"]);
array_push($array_data, $response3 );
}
}
$response4["data"] = $array_data;
array_push($array_ingresos_meses_por_anio, $response4);
$response["ingresos_meses_por_anio"] = $array_ingresos_meses_por_anio;
}
$sql_ingresos_dias =$db->__construct()->prepare('SELECT SUM(d.precio_compra) as "compra",DATE_FORMAT(i.fecha_hora, "%Y") as "anio", DATE_FORMAT(i.fecha_hora,"%M") as "mes", DATE_FORMAT(i.fecha_hora, "%D") as "dia"
FROM ingreso i,detalle_ingreso d
WHERE d.idingreso = i.idingreso AND DATE_FORMAT(i.fecha_hora,"%Y,%M") BETWEEN DATE_FORMAT(:fecha_buscada,"%Y,%M") AND DATE_FORMAT(SYSDATE(), "%Y,%M")
GROUP BY DATE_FORMAT(i.fecha_hora,"%D")
ORDER BY DATE_FORMAT(i.fecha_hora,"%M") DESC' );
$sql_ingresos_dias->bindParam(":fecha_buscada",$fecha_buscada);
$sql_ingresos_dias->execute();
$result_ingresos_dias = $sql_ingresos_dias->fetchAll(PDO::FETCH_ASSOC);
$array_ingresos_dias_por_mes = array();
foreach ($result_ingresos_meses as $key_mes) {
$array_data_dias = array();
for ($i=0; $i < count($meses) ; $i++)
{
if ($key_mes["mes"] == $meses[$i])
{
$mes_espanol = $meses_es[$i];
}
}
$response5["id"] = ($mes_espanol."_".$key_mes['anio']);
$response5["name"] = $mes_espanol;
foreach ($result_ingresos_dias as $key_dia) {
if ($key_mes["anio"]==$key_dia["anio"] && $key_mes["mes"]==$key_dia["mes"])
{
$response6["name"] = $key_dia["dia"];
$response6["y"] = intval($key_dia["compra"]);
array_push($array_data_dias, $response6 );
}
}
$response5["data"] = $array_data_dias;
array_push($array_ingresos_dias_por_mes, $response5);
$response["ingresos_dias_por_mes"] = $array_ingresos_dias_por_mes;
}
/*
{id:"November_2016",name:"November",data:[{name:"Lunes",y:100},{name:"Miercoles",y:100}]}
*/
$json_encode = json_encode($response);
print_r($json_encode);
/*----------todos los meses por año--------------*/
}else {
}
?>
| geralsantos/sisPersonal | html/blade/highchart_bar.php | PHP | gpl-2.0 | 6,126 |
import java.awt.Graphics;
/**
* Interface to used to communicate between a model
* and its display
*
* Copyright Georgia Institute of Technology 2004
* @author Barb Ericson ericson@cc.gatech.edu
*/
public interface ModelDisplay
{
/** method to notify the thing that displays that
* the model has changed */
public void modelChanged();
/** method to add the model to the world
* @param model the model object to add */
public void addModel(Object model);
/**
* Method to remove the model from the world
* @param model the model object to remove */
public void remove(Object model);
/**
* Method that returns the graphics context
* for this model display
* @return the graphics context
*/
public Graphics getGraphics();
/**
* Method to clear the background
*/
public void clearBackground();
/** Method to get the width of the display
* @return the width in pixels of the display
*/
public int getWidth();
/** Method to get the height of the display
* @return the height in pixels of the display
*/
public int getHeight();
} | zulfikar2/CSPortfolio | JAVA/SAD_Search/ModelDisplay.java | Java | gpl-2.0 | 1,120 |
<?php
defined('ZOTOP') or die('No direct access allowed.');
/**
* 控制器基类
*
* @copyright (c)2009 zotop team
* @package core
* @author zotop team
* @license http://zotop.com/license.html
*/
class controller
{
/**
*
* @var object 模板实例对象
*/
protected $template = null;
/**
*
* @var array 模板变量
*/
protected $template_vars = array();
/**
*
* @var string 定义默认的方法
*/
public $default_action = 'index';
/**
* 取得模板对象实例,并初始化
*
*/
public function __construct()
{
}
/**
* 初始化动作,动作执行之前调用
*
*/
public function __init()
{
//
}
/**
* 空方法 当操作不存在的时候执行
*
* @param string $method 方法名
* @param array $args 参数
* @return mixed
*/
public function __empty($action = '', $arguments = array())
{
throw new zotop_exception(t('未能找到相应的动作 %s,请检查控制器中动作是否存在?', $action), 404);
}
/**
* 视图实例
*/
protected function template()
{
// 实例化视图类
if (!$this->template)
{
$this->template = zotop::instance('template');
}
// 模板变量传值
if ($this->template_vars and is_array($this->template_vars))
{
$this->template->assign($this->template_vars);
}
return $this->template;
}
/**
* 模板变量赋值,函数方式
*
* @param mixed $name 要显示的模板变量
* @param mixed $value 变量的值
* @return void
*/
protected function assign($name = '', $value = '')
{
if ($name === '')
{
// 返回全部
return $this->template_vars;
}
elseif ($name === null)
{
// 清空
$this->template_vars = array();
}
elseif (is_array($name) or is_object($name))
{
// 多项赋值
foreach ($name as $key => $val)
{
$this->template_vars[$key] = $val;
}
}
elseif ($value === '')
{
// 返回某项数据,不存在返回null
return isset($this->template_vars[$name]) ? $this->template_vars[$name] : null;
}
elseif ($value === null)
{
// 删除
unset($this->template_vars[$name]);
}
else
{
// 单项赋值
$this->template_vars[$name] = $value;
}
return $this;
}
/**
* 模板变量赋值,魔术方法
*
* @param mixed $name 要显示的模板变量
* @param mixed $value 变量的值
* @return void
*/
public function __set($name, $value)
{
$this->assign($name, $value);
}
/**
* 取得模板显示变量的值
* @access protected
* @param string $name 模板显示变量
* @return mixed
*/
public function __get($name)
{
return $this->assign($name);
}
/**
* 模板显示 调用内置的模板引擎显示方法
*
* @param string $templateFile 指定要调用的模板文件,默认为空 由系统自动定位模板文件
* @param string $charset 输出编码
* @param string $content_type 输出类型
* @return void
*/
protected function display($template = '', $content_type = '', $charset = '')
{
//输出页面内容
$this->template()->display($template, $content_type, $charset);
}
/**
* 提交验证,正确提交则返回post数据,否则返回false
*
*/
public function post()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if ((empty($_SERVER['HTTP_REFERER']) || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))
{
return empty($_POST) ? true : $_POST;
}
throw new zotop_exception(t('invalid submit'));
}
return false;
}
/*
* redirect to uri ,详细参见 zotop::url 的参数设定
*
* @param string $url, 如:U('system/index')
* @return null
*/
public function redirect($url)
{
if ( $url and !headers_sent() )
{
header("location:{$url}");
exit();
}
}
/*
* 错误消息提示
*
* @param string $content 错误消息
* @return null
*/
public function error($content, $time = 3)
{
$this->message(array(
'state' => false,
'content' => $content,
'time' => $time
));
}
/*
* 正确消息提示
*
* @param string $msg
* @return null
*/
public function success($content, $url = null, $time = 2)
{
$this->message(array(
'state' => true,
'content' => $content,
'url' => $url,
'time' => $time
));
}
/*
* 消息提示
*
* @param array $msg
* @return null
*/
public function message(array $msg)
{
//清理已经输出内容
ob_clean();
//如果请求为ajax,则输出json数据
if ( ZOTOP_ISAJAX )
{
exit(json_encode($msg));
}
$this->assign($msg);
$this->display("system/message.php");
//exit后 无法进入 shoutdown render
//exit(1);
}
/*
* 404 error
*
* @param string $content 错误消息
* @return null
*/
public function _404($content)
{
@header('HTTP/1.1 404 Not Found');
@header('Status: 404 Not Found');
$this->assign('content', $content);
$this->display("system/404.php");
}
}
| zotopteam/zotop | zotop/libraries/classes/controller.php | PHP | gpl-2.0 | 6,040 |
<?php
/**
* View to edit a connection.
*
* @package Joomla.Administrator
* @subpackage Fabrik
* @copyright Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @since 3.0
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
/**
* View to edit a connection.
*
* @package Joomla.Administrator
* @subpackage Fabrik
* @since 3.0
*/
class FabrikAdminViewConnection extends JViewLegacy
{
/**
* Form
*
* @var JForm
*/
protected $form;
/**
* Connection item
*
* @var JTable
*/
protected $item;
/**
* A state object
*
* @var object
*/
protected $state;
/**
* Display the view
*
* @param string $tpl template
*
* @return void
*/
public function display($tpl = null)
{
// Initialiase variables.
$model = $this->getModel();
$this->item = $this->get('Item');
$model->checkDefault($this->item);
$this->form = $this->get('Form');
$this->form->bind($this->item);
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new RuntimeException(implode("\n", $errors), 500);
}
$this->addToolbar();
FabrikAdminHelper::setViewLayout($this);
$srcs = FabrikHelperHTML::framework();
$srcs[] = 'media/com_fabrik/js/fabrik.js';
FabrikHelperHTML::iniRequireJS();
FabrikHelperHTML::script($srcs);
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addToolbar()
{
$app = JFactory::getApplication();
$input = $app->input;
$input->set('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->get('id');
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = FabrikAdminHelper::getActions($this->state->get('filter.category_id'));
$title = $isNew ? JText::_('COM_FABRIK_MANAGER_CONNECTION_NEW') : JText::_('COM_FABRIK_MANAGER_CONNECTION_EDIT') . ' "' . $this->item->description . '"';
JToolBarHelper::title($title, 'connection.png');
if ($isNew)
{
// For new records, check the create permission.
if ($canDo->get('core.create'))
{
JToolBarHelper::apply('connection.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('connection.save', 'JTOOLBAR_SAVE');
JToolBarHelper::addNew('connection.save2new', 'JTOOLBAR_SAVE_AND_NEW');
}
JToolBarHelper::cancel('connection.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// Can't save the record if it's checked out.
if (!$checkedOut)
{
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
if ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId))
{
JToolBarHelper::apply('connection.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('connection.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see if we can return to make a new one.
if ($canDo->get('core.create'))
{
JToolBarHelper::addNew('connection.save2new', 'JTOOLBAR_SAVE_AND_NEW');
}
}
}
if ($canDo->get('core.create'))
{
JToolBarHelper::custom('connection.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
JToolBarHelper::cancel('connection.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_FABRIK_CONNECTIONS_EDIT', false, JText::_('JHELP_COMPONENTS_FABRIK_CONNECTIONS_EDIT'));
}
}
| raimov/broneering | administrator/components/com_fabrik/views/connection/view.html.php | PHP | gpl-2.0 | 3,679 |
package com.meadowhawk.cah.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.transaction.annotation.Transactional;
public abstract class AbstractJpaDAO<T> {
public enum DBSortOrder{
DESC, ASC
}
protected Class<T> clazz;
@PersistenceContext
EntityManager entityManager;
public void setClazz(Class<T> clazzToSet) {
this.clazz = clazzToSet;
}
@Transactional(readOnly = true)
public T findOne(Long id) {
return entityManager.find(clazz, id);
}
@SuppressWarnings("unchecked")
@Transactional(readOnly = true)
public List<T> findAll() {
return entityManager.createQuery("from " + clazz.getName()).getResultList();
}
@Transactional
public void save(T entity) {
entityManager.persist(entity);
}
@Transactional
public void update(T entity) {
entityManager.merge(entity);
}
@Transactional
public void delete(T entity) {
entityManager.remove(entityManager.merge(entity));
}
@Transactional
public void deleteById(Long entityId) {
final T entity = findOne( entityId );
if(entity != null){
delete( entity );
}
}
}
| leeclarke/CAHServer | src/main/java/com/meadowhawk/cah/dao/AbstractJpaDAO.java | Java | gpl-2.0 | 1,157 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.Structure;
using System.Windows.Forms;
using System.Drawing;
namespace Driving_Blind_Spot_Rebuild
{
class BlindSpot_Util
{
private int _X_hc, _Y_hc, _X_vc, _Y_vc;
private double teta_x = 0.0f, teta_y = 0.0f;
private int[] x_axis, y_axis;
private Rectangle _detectedRegtangle;
public int[] Y_axis
{
get { return y_axis; }
set { y_axis = value; }
}
public int[] X_axis
{
get { return x_axis; }
set { x_axis = value; }
}
public Rectangle DetectedRegtangle
{
get { return _detectedRegtangle; }
set { _detectedRegtangle = value; }
}
public int X_hc
{
get { return _X_hc; }
set { _X_hc = value; }
}
public int Y_vc
{
get { return _Y_vc; }
set { _Y_vc = value; }
}
/// <summary>
///
/// </summary>
/// <param name="img">Input Image</param>
/// <param name="threshold">Threshold value (with 8-bit image is from 0 to 255)</param>
/// <param name="maxGrayVal">Maximum Gray Value</param>
/// <param name="closingIteration">number of Iterations</param>
/// <returns>Processed Image</returns>
public Image<Gray, Single> _imageProcessing(Image<Gray, Single> img, int threshold, int maxGrayVal, int closingIteration)
{
img = img.Sobel(0, 1, 3);
StructuringElementEx element = new StructuringElementEx(3, 3, -1, -1, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(-90.0, new Gray(255), false);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(90.0, new Gray(255), false);
if (threshold >= 0 && threshold <= maxGrayVal)
{
img = img.ThresholdBinary(new Gray(threshold), new Gray(maxGrayVal));
}
else
{
//MessageBox.Show("Threshold is not appropriate, please choose another!");
throw new ArgumentOutOfRangeException("Threshold is not appropriate, please choose another threshold value!");
}
return img;
}
public void projectImage(Image<Gray, Single> inputImg)
{
float[, ,] imgData = inputImg.Data;
x_axis = new int[inputImg.Width];
y_axis = new int[inputImg.Height];
for (int i = 0; i < inputImg.Width; i++)
x_axis[i] = 0;
for (int i = 0; i < inputImg.Height; i++)
y_axis[i] = 0;
//MessageBox.Show(imgData[200, 200, 0] + " ");
int height = inputImg.Height, width = inputImg.Width;
for (int h = 0; h < height; h++)
for (int w = 0; w < width; w++)
{
if (imgData[h, w, 0] == 255)
{
x_axis[w]++;
y_axis[h]++;
}
}
int yTotal = 0, xTotal = 0;
//Horizontal Projection
for (int i = 0; i < x_axis.Length; i++)
{
yTotal += x_axis[i];
}
_Y_hc = yTotal / x_axis.Length;
_X_hc = 0;
for (int i = 0; i < x_axis.Length; i++)
_X_hc += (i * x_axis[i]);
_X_hc /= yTotal;
//Vertical Projection
for (int i = 0; i < y_axis.Length; i++)
{
xTotal += y_axis[i];
}
_X_vc = xTotal / y_axis.Length;
_Y_vc = 0;
for (int i = 0; i < y_axis.Length; i++)
_Y_vc += (i * y_axis[i]);
_Y_vc /= xTotal;
_detectedRegtangle = findRectangle1(_X_hc, _Y_vc);
//MessageBox.Show(_X_hc + " " + _Y_vc+"\n"+_detectedRegtangle.ToString());
}
private Rectangle findRectangle1(int x, int y)
{
Rectangle rect = new Rectangle();
int start = y, end = y;
while (y_axis[end] >= _X_vc * 0.8 && end < y_axis.Length - 1)
end++;
while (y_axis[start] >= _X_vc * 0.8 && start > 0)
start--;
rect.Y = start;
rect.Height = end - start;
start = x;
end = x;
while (x_axis[end] >= _Y_hc * 0.8 && end < x_axis.Length - 1)
end++;
while (x_axis[start] >= _Y_hc * 0.8 && start > 0)
start--;
rect.X = start;
rect.Width = end - start;
return rect;
}
private Rectangle findRectange(int x, int y)
{
Rectangle temp = new Rectangle();
int Start = -1, End = -1;
for (int i = 0; i < x_axis.Length; i++)
{
if (x_axis[i] >= y)
{
int xStartTemp = i;
while (x_axis[xStartTemp] >= y && xStartTemp < (x_axis.Length - 1))
xStartTemp++;
if (((xStartTemp - i) > (End - Start)) && (xStartTemp >= x && i <= x))
{
End = xStartTemp;
Start = i;
}
i = xStartTemp;
}
}
temp.X = Start;
temp.Width = End - Start;
Start = End = -1;
for (int i = 0; i < y_axis.Length; i++)
{
if (y_axis[i] >= x)
{
int xStartTemp = i;
while (y_axis[xStartTemp] >= x && xStartTemp < (y_axis.Length - 1))
xStartTemp++;
if (((xStartTemp - i) > (End - Start)) && (xStartTemp >= y && i <= y))
{
End = xStartTemp;
Start = i;
}
i = xStartTemp;
}
}
temp.Y = Start;
temp.Height = End - Start;
//MessageBox.Show(temp.ToString());
return temp;
}
#region Test
public void _testSobelParameters(Image<Gray, Single> img, int threshold, int maxGrayVal, int closingIteration, int cols, int rows, int anchorX, int anchorY, int shape)
{
int xOrder = 0, yOrder = 0, appetureSize = 1;
for (appetureSize = 3; appetureSize < 8; appetureSize += 2)
{
for (xOrder = 0; xOrder < appetureSize-1; xOrder++)
for (yOrder = 0; yOrder < appetureSize-1; yOrder++)
{
img = img.Sobel(xOrder, yOrder, appetureSize);
StructuringElementEx element;
if (shape == 0)
element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_RECT);
else if (shape == 1)
element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_CROSS);
else
element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(90.0, new Gray(255), false);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(-90.0, new Gray(255), false);
if (threshold >= 0 && threshold <= maxGrayVal)
{
img = img.ThresholdBinary(new Gray(threshold), new Gray(255));
}
else
{
MessageBox.Show("Threshold is not appropriate, please choose another!");
}
img.Bitmap.Save(@"Sobel\" + xOrder + " " + yOrder + " " + appetureSize + ".png");
}
}
}
private Image<Gray, Single> _testMorphological(Image<Gray, Single> img, int threshold, int maxGrayVal, int closingIteration, int cols, int rows, int anchorX, int anchorY, int shape)
{
img = img.Sobel(0, 1, 3);
StructuringElementEx element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_RECT); ;
if (shape == 1)
element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_CROSS);
else if (shape == 2)
element = new StructuringElementEx(cols, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(90.0, new Gray(255), false);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(-90.0, new Gray(255), false);
if (threshold >= 0 && threshold <= maxGrayVal)
{
img = img.ThresholdBinary(new Gray(threshold), new Gray(255));
}
else
{
MessageBox.Show("Threshold is not appropriate, please choose another!");
}
return img;
}
public void testClosingParameters(Image<Gray, Single> inputImg)
{
int rows, colums, anchorX, anchorY, shape, closingIteration, threshold;
int count = 1;
Image<Gray, float> img = inputImg;
for (closingIteration = 6; closingIteration < 7; closingIteration++)
{
for (shape = 0; shape < 1; shape++)
{
for (rows = 5; rows < 7; rows++)
for (colums = 5; colums < 7; colums++)
{
for (anchorX = 0; anchorX < colums; anchorX++)
for (anchorY = 0; anchorY < rows; anchorY++)
{
for (threshold = 80; threshold < 180; threshold += 20)
{
img = inputImg.Sobel(0, 1, 3);
img = inputImg.Sobel(1, 0, 3);
StructuringElementEx element = new StructuringElementEx(colums, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_RECT); ;
if (shape == 1)
element = new StructuringElementEx(colums, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_CROSS);
else if (shape == 2)
element = new StructuringElementEx(colums, rows, anchorX, anchorY, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_ELLIPSE);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(90.0, new Gray(255), false);
img = img.MorphologyEx(element, Emgu.CV.CvEnum.CV_MORPH_OP.CV_MOP_CLOSE, closingIteration);
img = img.Rotate(-90.0, new Gray(255), false);
if (threshold >= 0 && threshold <= 255)
{
img = img.ThresholdBinary(new Gray(threshold), new Gray(255));
}
else
{
MessageBox.Show("Threshold is not appropriate, please choose another!");
}
string str_shape;
if (shape == 0)
str_shape = "RECTANGLE";
else if (shape == 1)
str_shape = "CROSS";
else str_shape = "ELLIPSE";
img.Bitmap.Save(@"Result\" + closingIteration + "_" + str_shape + "_" + rows + "_" + colums + "_" + anchorX + "_" + anchorY + "_" + threshold + ".bmp");
count++;
}
}
}
}
}
MessageBox.Show("Done " + count + " images saved!");
}
#endregion
}
}
| mrcancer91/Driving-Bind-Spot | Driving_Blind_Spot_Rebuild/Driving_Blind_Spot_Rebuild/BlindSpot_Util.cs | C# | gpl-2.0 | 13,431 |
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
Sega X-board hardware
Special thanks to Charles MacDonald for his priceless assistance
****************************************************************************
Known bugs:
* gprider has a hack to make it work
* smgp network and motor boards not hooked up
* rachero doesn't like IC17/IC108 (divide chips) in self-test
due to testing an out-of-bounds value
* abcop doesn't like IC41/IC108 (divide chips) in self-test
due to testing an out-of-bounds value
* rascot is not working at all
Sega X-Board System Overview
Sega, 1987-1992
The following games are known to exist on the X-Board hardware...
AB Cop (C) Sega 1990
After Burner (C) Sega 1987
After Burner II (C) Sega 1987
*Caribbean Boule (C) Sega 1992
GP Rider (C) Sega 1990
Last Survivor (C) Sega 1989
Line of Fire (C) Sega 1989
Racing Hero (C) Sega 1990
Royal Ascot (C) Sega 1991 dumped, but very likely incomplete
Super Monaco GP (C) Sega 1989
Thunder Blade (C) Sega 1987
* denotes not dumped. There are also several revisions of the above games not dumper either.
Main Board
----------
Top : 834-6335
Bottom : 171-5494
Sticker: 834-7088-01 REV. B SUPER MONACO GP
Sticker: 834-6335-02 AFTER BURNER
|-----------------------------------------------------------------------------|
|IC67 IC66 IC65 IC64 IC58 IC57 IC56 IC55 BATT CNH 16MHz CNA CNE CNF |
|IC71 IC70 IC69 IC68 IC107 IC15 IC11 IC7 IC5 IC1 |
|IC75 IC74 IC73 IC72 IC16 IC12 IC8 IC6 IC2 |
|IC79 IC78 IC77 IC76 IC63 IC62 IC61 IC60 IC108 IC17 IC13 IC10 IC9 IC3 |
| IC18 IC14 |
| |
| |
| IC84 IC81 |
| IC23 |
| IC22 |
| IC109 IC21 IC20|
| IC125 IC118 IC28 IC30 IC29|
|IC93 IC92 IC91 IC90 IC126 IC31 |
| IC53 IC32 |
| IC32* IC40 IC38 |
| IC33* IC39 CNI|
|IC97 IC96 IC95 IC94 IC127 IC117 |
| IC134 |
| IC135 50MHz |
| IC37 |
|IC101 IC100 IC99 IC98 IC148 |
| IC165 |
| IC42 |
| IC150 IC170 IC41 |
|IC105 IC104 IC103 IC102 |
| IC154 IC152 IC160 IC159 DIPSWB DIPSWA|
| IC153 IC151 IC149 CNG CNB CNC CND |
|-----------------------------------------------------------------------------|
Notes:
ROMs: (ROM locations on the PCB not listed are not populated)
Type (note 1) 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C1000 27C512 27C512 27C512 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 831000 27C1000 27C1000 27C1000 27C1000 27C512 27C512 831000 831000 831000
Location IC58 IC63 IC57 IC62 IC20 IC29 IC21 IC30 IC154 IC153 IC152 IC90 IC94 IC98 IC102 IC91 IC95 IC99 IC103 IC92 IC96 IC100 IC104 IC93 IC97 IC101 IC105 IC40 IC17 IC11 IC12 IC13
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
After Burner EPR-10940 EPR-10941 - - EPR-10927 EPR-10928 - - EPR-10926 EPR-10925 EPR-10924 MPR-10932 MPR-10934 MPR-10936 MPR-10938 MPR-10933 MPR-10935 MPR-10937 MPR-10939 EPR-10942 EPR-10943 EPR-10944 EPR-10945 EPR-10946 EPR-10947 EPR-10948 EPR-10949 EPR-10922 MPR-10923 MPR-10930 MPR-10931 MPR-11102
After Burner 2 EPR-11107 EPR-11108 - - EPR-11109 EPR-11110 - - EPR-11115 EPR-11114 EPR-11113 MPR-10932 MPR-10934 MPR-10936 MPR-10938 MPR-10933 MPR-10935 MPR-10937 MPR-10939 MPR-11103 MPR-11104 MPR-11105 MPR-11106 EPR-11116 EPR-11117 EPR-11118 EPR-11119 EPR-10922 EPR-11112 MPR-10930 MPR-10931 EPR-11102
Line Of Fire (set 3) EPR-12849 EPR-12850 - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801
Line Of Fire (set 2) EPR-12847A EPR-12848A - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801
Line Of Fire (set 1) EPR-12794 EPR-12795 - - EPR-12804 EPR-12805 EPR-12802 EPR-12803 OPR-12791 OPR-12792 OPR-12793 EPR-12787 EPR-12788 EPR-12789 EPR-12790 EPR-12783 EPR-12784 EPR-12785 EPR-12786 EPR-12779 EPR-12780 EPR-12781 EPR-12782 EPR-12775 EPR-12776 EPR-12777 EPR-12778 - EPR-12798 EPR-12799 EPR-12800 EPR-12801
Thunder Blade (set 2) EPR-11405 EPR-11406 EPR-11306 EPR-11307 EPR-11390 EPR-11391 EPR-11310 EPR-11311 EPR-11314 EPR-11315 EPR-11316 EPR-11323 EPR-11322 EPR-11321 EPR-11320 EPR-11327 EPR-11326 EPR-11325 EPR-11324 EPR-11331 EPR-11330 EPR-11329 EPR-11328 EPR-11395 EPR-11394 EPR-11393 EPR-11392 EPR-11313 EPR-11396 EPR-11317 EPR-11318 EPR-11319
Thunder Blade (set 1) EPR-11304 EPR-11305 EPR-11306 EPR-11307 EPR-11308 EPR-11309 EPR-11310 EPR-11311 EPR-11314 EPR-11315 EPR-11316 EPR-11323 EPR-11322 EPR-11321 EPR-11320 EPR-11327 EPR-11326 EPR-11325 EPR-11324 EPR-11331 EPR-11330 EPR-11329 EPR-11328 EPR-11335 EPR-11334 EPR-11333 EPR-11332 EPR-11313 EPR-11312 EPR-11317 EPR-11318 EPR-11319
Racing Hero EPR-13129 EPR-13130 EPR-12855 EPR-12856 EPR-12857 EPR-12858 - - EPR-12879 EPR-12880 EPR-12881 EPR-12872 EPR-12873 EPR-12874 EPR-12875 EPR-12868 EPR-12869 EPR-12870 EPR-12871 EPR-12864 EPR-12865 EPR-12866 EPR-12867 EPR-12860 EPR-12861 EPR-12862 EPR-12863 - EPR-12859 EPR-12876 EPR-12877 EPR-12878
S.Monaco GP (set 9) EPR-12563B EPR-12564B - - EPR-12576A EPR-12577A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 8) EPR-12563A EPR-12564A - - EPR-12576A EPR-12577A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 7) EPR-12563 EPR-12564 - - EPR-12576 EPR-12577 - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 6) EPR-12561C EPR-12562C - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 5) EPR-12561B EPR-12562B - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 4) EPR-12561A EPR-12562A - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 3) EPR-12561 EPR-12562 - - EPR-12574A EPR-12575A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12609 EPR-12610 EPR-12611 EPR-12612 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 2) EPR-12432B EPR-12433B - - EPR-12441A EPR-12442A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12413 EPR-12414 EPR-12415 EPR-12416 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
S.Monaco GP (set 1) EPR-12432A EPR-12433A - - EPR-12441A EPR-12442A - - EPR-12429 EPR-12430 EPR-12431 MPR-12425 MPR-12426 MPR-12427 MPR-12428 MPR-12421 MPR-12422 MPR-12423 MPR-12424 MPR-12417 MPR-12418 MPR-12419 MPR-12420 EPR-12413 EPR-12414 EPR-12415 EPR-12416 - EPR-12436 MPR-12437 MPR-12438 MPR-12439
AB Cop EPR-13568B EPR-13556B EPR-13559 EPR-13558 EPR-13566 EPR-13565 - - OPR-13553 OPR-13554 OPR-13555 OPR-13552 OPR-13551 OPR-13550 OPR-13549 OPR-13548 OPR-13547 OPR-13546 OPR-13545 OPR-13544 OPR-13543 OPR-13542 OPR-13541 OPR-13540 OPR-13539 OPR-13538 OPR-13537 EPR-13564 EPR-13560 OPR-13563 OPR-13562 OPR-13561
GP Rider (set 2) EPR-13408 EPR-13409 - - EPR-13395 EPR-13394 EPR-13393 EPR-13392 EPR-13383 EPR-13384 EPR-13385 EPR-13382 EPR-13381 EPR-13380 EPR-13379 EPR-13378 EPR-13377 EPR-13376 EPR-13375 EPR-13374 EPR-13373 EPR-13372 EPR-13371 EPR-13370 EPR-13369 EPR-13368 EPR-13367 - EPR-13388 EPR-13391 EPR-13390 EPR-13389
GP Rider (set 1) EPR-13406 EPR-13407 - - EPR-13395 EPR-13394 EPR-13393 EPR-13392 EPR-13383 EPR-13384 EPR-13385 EPR-13382 EPR-13381 EPR-13380 EPR-13379 EPR-13378 EPR-13377 EPR-13376 EPR-13375 EPR-13374 EPR-13373 EPR-13372 EPR-13371 EPR-13370 EPR-13369 EPR-13368 EPR-13367 - EPR-13388 EPR-13391 EPR-13390 EPR-13389
Note 1 - PCB can handle 27C1000 / 27C010 / 831000 ROMs via jumpers
If label = EPR, ROM is 32 pin 27C1000 or 27C010
If label = MPR, ROM is 28 pin 831000
For jumper settings, 27C1000 also means 831000 can be used
S28 shorted, S26 open = ROMS 90-103 (Groups 1,2) use 831000
S28 open, S26 shorted = ROMS 90-103 (Groups 1,2) use 27C010
S29 shorted, S27 open = ROMS 90-103 (Groups 3,4) use 831000
S29 open, S27 shorted = ROMS 92-105 (Groups 3,4) use 27C010
For IC11/12/13, set jumpers S1 open, S2 resistor, S3 open, S4 resistor for 27C1000. Reverse them for 27C010
For IC20/29 set jumpers S5 resistor, S6 open, S7 resistor, S8 open for 27C1000. Reverse them for 27C010
For IC21/30 set jumpers S9 resistor, S10 open, S11 resistor, S12 open for 27C1000. Reverse them for 27C010
For IC57/62 set jumpers S18 resistor, S19 open, S20 resistor, S21 open for 27C1000. Reverse them for 27C010
For IC58/63 set jumpers S22 resistor, S23 open, S24 resistor, S25 open for 27C1000. Reverse them for 27C010
For IC40 set jumpers S13 open, S14 resistor to set 27C512. Reverse them for 27C256
For IC152/153/154 set jumpers S31 open, S32 resistor to set 27C512. Reverse them for 27C256
PALs: (Common to all games except where noted)
IC18 : 315-5280 (= CK2605 == PLS153) - Z80 address decoding
IC84 : 315-5278 (= PAL16L8) - Sprite ROM bank control
IC109: 315-5290 (= PAL16L8) - Main CPU address decoding
IC117: 315-5291 (= PAL16L8) - Main CPU address decoding
IC127: After Burner - 315-5279 (= PAL16R6)
S.Monaco GP - 315-5304 (= PAL16R6)
GP Rider - 315-5304 (= PAL16R6)
Line Of Fire - 315-5304 (= PAL16R6)
There could be other different ones or maybe there's just 2 types?
RAM:
IC9 : 6116 (2k x8 SRAM) - Sega PCM chip RAM. == TMM2115
IC10 : 6116 (2k x8 SRAM) - Sega PCM chip RAM
IC16 : 6116 (2k x8 SRAM) - Z80 program RAM
IC22 : 6264 (8k x8 SRAM) - Sub CPU Program RAM. == Sony CXK5864 or Fujitsu MB8464 or NEC D4364
IC23 : 6264 (8k x8 SRAM) - Sub CPU Program RAM
IC31 : 6116 (2k x8 SRAM) - Sub CPU Program RAM
IC32 : 6116 (2k x8 SRAM) - Sub CPU Program RAM
IC38 : 6264 (8k x8 SRAM) - Road RAM
IC39 : 6264 (8k x8 SRAM) - Road RAM
IC55 : 6264 (8k x8 SRAM) - Main CPU Program RAM
IC56 : 6264 (8k x8 SRAM) - Main CPU Program RAM
IC60 : 6264 (8k x8 SRAM) - Main CPU Program RAM
IC61 : 6264 (8k x8 SRAM) - Main CPU Program RAM
IC64 : TC51832 (32k x8 SRAM) - Sprite GFX RAM. == NEC uPD42832
IC65 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC66 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC67 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC68 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC69 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC70 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC71 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC72 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC73 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC74 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC75 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC76 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC77 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC78 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC79 : TC51832 (32k x8 SRAM) - Sprite GFX RAM
IC125: MB81C78 (8k x8 SRAM) -
IC126: MB81C78 (8k x8 SRAM) -
IC132: 6264 (8k x8 SRAM) - Text RAM. \ * On this PCB these are mis-labelled as IC32 and IC33
IC133: 6264 (8k x8 SRAM) - Text RAM /
IC134: 62256 (32k x8 SRAM) - Tile / Background GFX RAM
IC135: 62256 (32k x8 SRAM) - Tile / Background GFX RAM
IC150: 6264 (8k x8 SRAM) -
IC151: 6264 (8k x8 SRAM) -
SEGA Custom ICs:
IC8 : 315-5218 (QFP100) - Sega Stereo PCM Sound IC with 16 channels. Clock input 16.000MHz
IC37 : 315-5248 (QFP100) - Hardware multiplier
IC41 : 315-5249 (QFP120) - Hardware divider
IC42 : 315-5275 (QFP100) - Road generator, located underneath the PCB
IC53 : 315-5250 (QFP120) - 68000 / Z80 interface, hardware comparator
IC81 : 315-5211A (PGA179) - Sprite Generator
IC107: 315-5248 (QFP100) - Hardware multiplier
IC108: 315-5249 (QFP120) - Hardware divider
IC148: 315-5197 (PGA135) - Tilemap generator (for Backgrounds)
IC149: 315-5242 (Custom) - Color Encoder. Custom ceramic DIP package. Contains
a QFP44 and some smt resistors/caps etc
OTHER:
IC14 : Z80 CPU, clock 4.000MHz [16/4] (DIP40)
IC15 : YM2151, clock 4.000MHz [16/4] (DIP24)
IC28 : 68000 CPU (sub), clock 12.5000MHz [50/4] (DIP64)
IC118: Hitachi FD1094 Encrypted 68000 CPU or regular 68000 CPU (main), clock 12.5000MHz [50/4] (DIP64)
IC159: SONY CXD1095 CMOS I/O Port Expander (QFP64)
IC160: SONY CXD1095 CMOS I/O Port Expander (QFP64)
IC165: ADC0804, for control of analog inputs (DIP20)
IC170: Fujitsu MB3773 Reset IC (DIP8)
IC1 : NEC uPC324 Low Power Quad Operational Amplifier (DIP14)
IC2 : NEC uPC4082 J-FET Dual Input Operational Amplifier (DIP8)
IC3 : Yamaha YM3012 Sound Digital to Analog Converter (DIP16)
IC5 : M8736 MF6CN-50 (DIP14)
IC6 : M8736 MF6CN-50 (DIP14)
IC7 : Exar MP7633JN CMOS 10-Bit Multiplying Digital to Analog Converter (== AD7533 / AD7530 / AD7520) (DIP16)
BATT : 5.5 volt 0.1uF Super Cap
CNA : 10 pin +5V / GND Power Connector
CNB : 20 pin Analog Controls Connector
CNC : 26 pin Connector for ?
CND : 50 pin Digital Controls/Buttons Connector
CNE : 6 pin Connector for ?
CNF : 4 pin Stereo Sound Output Connector
CNG : 6 pin RGB/Sync/GND Connector
CNH : 10 pin Connector for ?
CNI : 30 pin Expansion Connector (not populated)
VSync: 59.6368Hz \ (measured via EL4583 & TTi PFM1300)
HSync: 15.5645kHz /
Add-on boards for Super Monaco GP
---------------------------------
Super Monaco GP was released as upright, twin, cockpit, and deluxe 'Air Drive'.
DIP switches determine the cabinet type. It is presumed that these extra boards can be interchanged.
Network Board (twin cabinet)
-------------
Top : 834-6780
Bottom : 171-5729-01
Sticker: 834-7112
|---------| |--| |----------------------|
| RX TX 315-5336 |
| 315-5337 |
| |
| 16MHz 6264 |
| epr-12587.14 |
| MB89372P-SH Z80E MB8421 |
|---------------------------------------|
Notes:
PALs : 315-5337, 315-5336, both PAL16L8
Z80 clock: 8.000MHz [16/2]
6264 : 8k x8 SRAM
MB8421 : Fujitsu 2k x8 Dual-Port SRAM (SDIP52)
MB89372 : Fujitsu Multi-Protocol Controller (SDIP64)
epr-12587: 27C256 EPROM
Sound Board (for 4-channel sound, cockpit and deluxe cabinets)
-------------
label: 837-7000
Z80 (assume 4MHz)
Sega 315-5218 sound IC
ROMs:
- epr-12535.8
- mpr-12437.20
- mpr-12438.21
- mpr-12439.22
Motor Board (deluxe cabinet)
-------------
label: ?
Z80 (unknown speed)
ROMs:
- epr-12505.8
***************************************************************************/
#include "emu.h"
#include "includes/segaxbd.h"
#include "machine/nvram.h"
#include "sound/ym2151.h"
#include "sound/segapcm.h"
#include "includes/segaipt.h"
const device_type SEGA_XBD_PCB = &device_creator<segaxbd_state>;
segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEGA_XBD_PCB, "Sega X-Board PCB", tag, owner, clock, "segaxbd_pcb", __FILE__),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "subcpu"),
m_soundcpu(*this, "soundcpu"),
m_soundcpu2(*this, "soundcpu2"),
m_mcu(*this, "mcu"),
m_watchdog(*this, "watchdog"),
m_cmptimer_1(*this, "cmptimer_main"),
m_sprites(*this, "sprites"),
m_segaic16vid(*this, "segaic16vid"),
m_segaic16road(*this, "segaic16road"),
m_soundlatch(*this, "soundlatch"),
m_subram0(*this, "subram0"),
m_road_priority(1),
m_scanline_timer(nullptr),
m_timer_irq_state(0),
m_vblank_irq_state(0),
m_loffire_sync(nullptr),
m_lastsurv_mux(0),
m_paletteram(*this, "paletteram"),
m_gprider_hack(false),
m_palette_entries(0),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_adc_ports(*this, {"ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6", "ADC7"}),
m_mux_ports(*this, {"MUX0", "MUX1", "MUX2", "MUX3"})
{
memset(m_adc_reverse, 0, sizeof(m_adc_reverse));
memset(m_iochip_regs, 0, sizeof(m_iochip_regs));
palette_init();
}
void segaxbd_state::device_start()
{
if(!m_segaic16road->started())
throw device_missing_dependencies();
// point globals to allocated memory regions
m_segaic16road->segaic16_roadram_0 = reinterpret_cast<UINT16 *>(memshare("roadram")->ptr());
video_start();
// allocate a scanline timer
m_scanline_timer = timer_alloc(TID_SCANLINE);
// reset the custom handlers and other pointers
m_iochip_custom_io_w[0][3] = iowrite_delegate(FUNC(segaxbd_state::generic_iochip0_lamps_w), this);
// save state
save_item(NAME(m_timer_irq_state));
save_item(NAME(m_vblank_irq_state));
save_item(NAME(m_iochip_regs[0]));
save_item(NAME(m_iochip_regs[1]));
save_item(NAME(m_lastsurv_mux));
}
void segaxbd_state::device_reset()
{
m_segaic16vid->tilemap_reset(*m_screen);
// hook the RESET line, which resets CPU #1
m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaxbd_state::m68k_reset_callback),this));
// start timers to track interrupts
m_scanline_timer->adjust(m_screen->time_until_pos(1), 1);
}
class segaxbd_new_state : public driver_device
{
public:
segaxbd_new_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_mainpcb(*this, "mainpcb")
{
}
required_device<segaxbd_state> m_mainpcb;
// game-specific driver init
DECLARE_DRIVER_INIT(generic);
DECLARE_DRIVER_INIT(aburner2);
DECLARE_DRIVER_INIT(lastsurv);
DECLARE_DRIVER_INIT(loffire);
DECLARE_DRIVER_INIT(smgp);
DECLARE_DRIVER_INIT(rascot);
DECLARE_DRIVER_INIT(gprider);
};
class segaxbd_new_state_double : public segaxbd_new_state
{
public:
segaxbd_new_state_double(const machine_config &mconfig, device_type type, const char *tag)
: segaxbd_new_state(mconfig, type, tag),
m_subpcb(*this, "subpcb")
{
for (auto & elem : shareram)
{
elem = 0x0000;
}
rampage1 = 0x0000;
rampage2 = 0x0000;
}
required_device<segaxbd_state> m_subpcb;
DECLARE_READ16_MEMBER(shareram1_r) {
if (offset < 0x10) {
int address = (rampage1 << 4) + offset;
return shareram[address];
}
return 0xffff;
}
DECLARE_WRITE16_MEMBER(shareram1_w) {
if (offset < 0x10) {
int address = (rampage1 << 4) + offset;
COMBINE_DATA(&shareram[address]);
} else if (offset == 0x10) {
rampage1 = data & 0x00FF;
}
}
DECLARE_READ16_MEMBER(shareram2_r) {
if (offset < 0x10) {
int address = (rampage2 << 4) + offset;
return shareram[address];
}
return 0xffff;
}
DECLARE_WRITE16_MEMBER(shareram2_w) {
if (offset < 0x10) {
int address = (rampage2 << 4) + offset;
COMBINE_DATA(&shareram[address]);
} else if (offset == 0x10) {
rampage2 = data & 0x007F;
}
}
DECLARE_DRIVER_INIT(gprider_double);
UINT16 shareram[0x800];
UINT16 rampage1;
UINT16 rampage2;
};
//**************************************************************************
// CONSTANTS
//**************************************************************************
const UINT32 MASTER_CLOCK = XTAL_50MHz;
const UINT32 SOUND_CLOCK = XTAL_16MHz;
//**************************************************************************
// COMPARE/TIMER CHIP CALLBACKS
//**************************************************************************
//-------------------------------------------------
// timer_ack_callback - acknowledge a timer chip
// interrupt signal
//-------------------------------------------------
void segaxbd_state::timer_ack_callback()
{
// clear the timer IRQ
m_timer_irq_state = 0;
update_main_irqs();
}
//-------------------------------------------------
// sound_data_w - write data to the sound CPU
//-------------------------------------------------
void segaxbd_state::sound_data_w(UINT8 data)
{
synchronize(TID_SOUND_WRITE, data);
}
//**************************************************************************
// MAIN CPU READ/WRITE CALLBACKS
//**************************************************************************
//-------------------------------------------------
// adc_w - handle reads from the ADC
//-------------------------------------------------
READ16_MEMBER( segaxbd_state::adc_r )
{
// on the write, latch the selected input port and stash the value
int which = (m_iochip_regs[0][2] >> 2) & 7;
int value = m_adc_ports[which].read_safe(0x0010);
// reverse some port values
if (m_adc_reverse[which])
value = 255 - value;
// return the previously latched value
return value;
}
//-------------------------------------------------
// adc_w - handle writes to the ADC
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::adc_w )
{
}
//-------------------------------------------------
// iochip_r - helper to handle I/O chip reads
//-------------------------------------------------
inline UINT16 segaxbd_state::iochip_r(int which, int port, int inputval)
{
UINT16 result = m_iochip_regs[which][port];
// if there's custom I/O, do that to get the input value
if (!m_iochip_custom_io_r[which][port].isnull())
inputval = m_iochip_custom_io_r[which][port](inputval);
// for ports 0-3, the direction is controlled 4 bits at a time by register 6
if (port <= 3)
{
if ((m_iochip_regs[which][6] >> (2 * port + 0)) & 1)
result = (result & ~0x0f) | (inputval & 0x0f);
if ((m_iochip_regs[which][6] >> (2 * port + 1)) & 1)
result = (result & ~0xf0) | (inputval & 0xf0);
}
// for port 4, the direction is controlled 1 bit at a time by register 7
else
{
if ((m_iochip_regs[which][7] >> 0) & 1)
result = (result & ~0x01) | (inputval & 0x01);
if ((m_iochip_regs[which][7] >> 1) & 1)
result = (result & ~0x02) | (inputval & 0x02);
if ((m_iochip_regs[which][7] >> 2) & 1)
result = (result & ~0x04) | (inputval & 0x04);
if ((m_iochip_regs[which][7] >> 3) & 1)
result = (result & ~0x08) | (inputval & 0x08);
result &= 0x0f;
}
return result;
}
//-------------------------------------------------
// iochip_0_r - handle reads from the first I/O
// chip
//-------------------------------------------------
READ16_MEMBER( segaxbd_state::iochip_0_r )
{
switch (offset)
{
case 0:
// Input port:
// D7: (Not connected)
// D6: /INTR of ADC0804
// D5-D0: CN C pin 24-19 (switch state 0= open, 1= closed)
return iochip_r(0, 0, ioport("IO0PORTA")->read());
case 1:
// I/O port: CN C pins 17,15,13,11,9,7,5,3
return iochip_r(0, 1, ioport("IO0PORTB")->read());
case 2:
// Output port
return iochip_r(0, 2, 0);
case 3:
// Output port
return iochip_r(0, 3, 0);
case 4:
// Unused
return iochip_r(0, 4, 0);
}
// everything else returns 0
return 0;
}
//-------------------------------------------------
// iochip_0_w - handle writes to the first I/O
// chip
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::iochip_0_w )
{
// access is via the low 8 bits
if (!ACCESSING_BITS_0_7)
return;
data &= 0xff;
// swap in the new value and remember the previous value
UINT8 oldval = m_iochip_regs[0][offset];
m_iochip_regs[0][offset] = data;
// certain offsets have common effects
switch (offset)
{
case 2:
// Output port:
// D7: (Not connected)
// D6: (/WDC) - watchdog reset
// D5: Screen display (1= blanked, 0= displayed)
// D4-D2: (ADC2-0)
// D1: (CONT) - affects sprite hardware
// D0: Sound section reset (1= normal operation, 0= reset)
if (((oldval ^ data) & 0x40) && !(data & 0x40))
m_watchdog->watchdog_reset();
m_segaic16vid->set_display_enable(data & 0x20);
m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
if (m_soundcpu2 != nullptr)
m_soundcpu2->set_input_line(INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
break;
case 3:
// Output port:
// D7: Amplifier mute control (1= sounding, 0= muted)
// D6-D0: CN D pin A17-A23 (output level 1= high, 0= low) - usually set up as lamps and coincounter
machine().sound().system_enable(data & 0x80);
break;
default:
break;
}
// if there's custom I/O, handle that as well
if (!m_iochip_custom_io_w[0][offset].isnull())
m_iochip_custom_io_w[0][offset](data);
else if (offset <= 4)
logerror("I/O chip 0, port %c write = %02X\n", 'A' + offset, data);
}
//-------------------------------------------------
// iochip_1_r - handle reads from the second I/O
// chip
//-------------------------------------------------
READ16_MEMBER( segaxbd_state::iochip_1_r )
{
switch (offset)
{
case 0:
// Input port: switches, CN D pin A1-8 (switch state 1= open, 0= closed)
return iochip_r(1, 0, ioport("IO1PORTA")->read());
case 1:
// Input port: switches, CN D pin A9-16 (switch state 1= open, 0= closed)
return iochip_r(1, 1, ioport("IO1PORTB")->read());
case 2:
// Input port: DIP switches (1= off, 0= on)
return iochip_r(1, 2, ioport("IO1PORTC")->read());
case 3:
// Input port: DIP switches (1= off, 0= on)
return iochip_r(1, 3, ioport("IO1PORTD")->read());
case 4:
// Unused
return iochip_r(1, 4, 0);
}
// everything else returns 0
return 0;
}
//-------------------------------------------------
// iochip_1_w - handle writes to the second I/O
// chip
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::iochip_1_w )
{
// access is via the low 8 bits
if (!ACCESSING_BITS_0_7)
return;
data &= 0xff;
m_iochip_regs[1][offset] = data;
// if there's custom I/O, handle that as well
if (!m_iochip_custom_io_w[1][offset].isnull())
m_iochip_custom_io_w[1][offset](data);
else if (offset <= 4)
logerror("I/O chip 1, port %c write = %02X\n", 'A' + offset, data);
}
//-------------------------------------------------
// iocontrol_w - handle writes to the I/O control
// port
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::iocontrol_w )
{
if (ACCESSING_BITS_0_7)
{
logerror("I/O chip force input = %d\n", data & 1);
// Racing Hero and ABCop set this and fouls up their output ports
//iochip_force_input = data & 1;
}
}
//**************************************************************************
// GAME-SPECIFIC MAIN CPU READ/WRITE HANDLERS
//**************************************************************************
//-------------------------------------------------
// loffire_sync0_w - force synchronization on
// writes to this address for Line of Fire
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::loffire_sync0_w )
{
COMBINE_DATA(&m_loffire_sync[offset]);
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
}
//-------------------------------------------------
// rascot_excs_r - /EXCS region reads for Rascot
//-------------------------------------------------
READ16_MEMBER( segaxbd_state::rascot_excs_r )
{
//logerror("%06X:rascot_excs_r(%04X)\n", m_maincpu->pc(), offset*2);
// probably receives commands from the server here
//return space.machine().rand() & 0xff;
return 0xff;
}
//-------------------------------------------------
// rascot_excs_w - /EXCS region writes for Rascot
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::rascot_excs_w )
{
//logerror("%06X:rascot_excs_w(%04X) = %04X & %04X\n", m_maincpu->pc(), offset*2, data, mem_mask);
}
//-------------------------------------------------
// smgp_excs_r - /EXCS region reads for
// Super Monaco GP
//-------------------------------------------------
READ16_MEMBER( segaxbd_state::smgp_excs_r )
{
//logerror("%06X:smgp_excs_r(%04X)\n", m_maincpu->pc(), offset*2);
return 0xffff;
}
//-------------------------------------------------
// smgp_excs_w - /EXCS region writes for
// Super Monaco GP
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::smgp_excs_w )
{
//logerror("%06X:smgp_excs_w(%04X) = %04X & %04X\n", m_maincpu->pc(), offset*2, data, mem_mask);
}
//**************************************************************************
// SOUND Z80 CPU READ/WRITE CALLBACKS
//**************************************************************************
//-------------------------------------------------
// sound_data_r - read latched sound data
//-------------------------------------------------
READ8_MEMBER( segaxbd_state::sound_data_r )
{
m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
return m_soundlatch->read(space, 0);
}
//**************************************************************************
// DRIVER OVERRIDES
//**************************************************************************
//-------------------------------------------------
// device_timer - handle device timers
//-------------------------------------------------
void segaxbd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TID_SOUND_WRITE:
m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param);
m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
// if an extra sound board is attached, do an nmi there as well
if (m_soundcpu2 != nullptr)
m_soundcpu2->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
break;
case TID_SCANLINE:
{
int scanline = param;
int next_scanline = (scanline + 2) % 262;
bool update = false;
// clock the timer and set the IRQ if something happened
if ((scanline % 2) != 0 && m_cmptimer_1->clock())
m_timer_irq_state = 1, update = true;
// set VBLANK on scanline 223
if (scanline == 223)
{
m_vblank_irq_state = 1;
update = true;
m_subcpu->set_input_line(4, ASSERT_LINE);
next_scanline = scanline + 1;
}
// clear VBLANK on scanline 224
else if (scanline == 224)
{
m_vblank_irq_state = 0;
update = true;
m_subcpu->set_input_line(4, CLEAR_LINE);
next_scanline = scanline + 1;
}
// update IRQs on the main CPU
if (update)
update_main_irqs();
// come back in 2 scanlines
m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
break;
}
}
}
//**************************************************************************
// CUSTOM I/O HANDLERS
//**************************************************************************
//-------------------------------------------------
// generic_iochip0_lamps_w - shared handler for
// coin counters and lamps
//-------------------------------------------------
void segaxbd_state::generic_iochip0_lamps_w(UINT8 data)
{
// d0: ?
// d3: always 0?
// d4: coin counter
// d7: mute audio (always handled above)
// other bits: lamps
machine().bookkeeping().coin_counter_w(0, (data >> 4) & 0x01);
//
// aburner2:
// d1: altitude warning lamp
// d2: start lamp
// d5: lock on lamp
// d6: danger lamp
// in clone aburner, lamps work only in testmode?
machine().output().set_lamp_value(0, (data >> 5) & 0x01);
machine().output().set_lamp_value(1, (data >> 6) & 0x01);
machine().output().set_lamp_value(2, (data >> 1) & 0x01);
machine().output().set_lamp_value(3, (data >> 2) & 0x01);
}
//-------------------------------------------------
// aburner2_iochip0_motor_r - motor I/O reads
// for Afterburner II
//-------------------------------------------------
UINT8 segaxbd_state::aburner2_iochip0_motor_r(UINT8 data)
{
data &= 0xc0;
// TODO
return data | 0x3f;
}
//-------------------------------------------------
// aburner2_iochip0_motor_w - motor I/O writes
// for Afterburner II
//-------------------------------------------------
void segaxbd_state::aburner2_iochip0_motor_w(UINT8 data)
{
// TODO
}
//-------------------------------------------------
// smgp_iochip0_motor_r - motor I/O reads
// for Super Monaco GP
//-------------------------------------------------
UINT8 segaxbd_state::smgp_iochip0_motor_r(UINT8 data)
{
data &= 0xc0;
// TODO
return data | 0x0;
}
//-------------------------------------------------
// smgp_iochip0_motor_w - motor I/O reads
// for Super Monaco GP
//-------------------------------------------------
void segaxbd_state::smgp_iochip0_motor_w(UINT8 data)
{
// TODO
}
//-------------------------------------------------
// lastsurv_iochip1_port_r - muxed I/O reads
// for Last Survivor
//-------------------------------------------------
UINT8 segaxbd_state::lastsurv_iochip1_port_r(UINT8 data)
{
return m_mux_ports[m_lastsurv_mux].read_safe(0xff);
}
//-------------------------------------------------
// lastsurv_iochip0_muxer_w - muxed I/O writes
// for Last Survivor
//-------------------------------------------------
void segaxbd_state::lastsurv_iochip0_muxer_w(UINT8 data)
{
m_lastsurv_mux = (data >> 5) & 3;
generic_iochip0_lamps_w(data & 0x9f);
}
//**************************************************************************
// INTERNAL HELPERS
//**************************************************************************
//-------------------------------------------------
// update_main_irqs - flush IRQ state to the
// CPU device
//-------------------------------------------------
void segaxbd_state::update_main_irqs()
{
UINT8 irq = 0;
if (m_timer_irq_state)
irq |= 2;
else
m_maincpu->set_input_line(2, CLEAR_LINE);
if (m_vblank_irq_state)
irq |= 4;
else
m_maincpu->set_input_line(4, CLEAR_LINE);
if (m_gprider_hack && irq > 4)
irq = 4;
if (irq != 6)
m_maincpu->set_input_line(6, CLEAR_LINE);
if (irq)
{
m_maincpu->set_input_line(irq, ASSERT_LINE);
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
}
}
//-------------------------------------------------
// m68k_reset_callback - callback for when the
// main 68000 is reset
//-------------------------------------------------
WRITE_LINE_MEMBER(segaxbd_state::m68k_reset_callback)
{
m_subcpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
}
//-------------------------------------------------
// palette_init - precompute weighted RGB values
// for each input value 0-31
//-------------------------------------------------
void segaxbd_state::palette_init()
{
//
// Color generation details
//
// Each color is made up of 5 bits, connected through one or more resistors like so:
//
// Bit 0 = 1 x 3.9K ohm
// Bit 1 = 1 x 2.0K ohm
// Bit 2 = 1 x 1.0K ohm
// Bit 3 = 2 x 1.0K ohm
// Bit 4 = 4 x 1.0K ohm
//
// Another data bit is connected by a tristate buffer to the color output through a
// 470 ohm resistor. The buffer allows the resistor to have no effect (tristate),
// halve brightness (pull-down) or double brightness (pull-up). The data bit source
// is bit 15 of each color RAM entry.
//
// compute weight table for regular palette entries
static const int resistances_normal[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 0 };
double weights_normal[6];
compute_resistor_weights(0, 255, -1.0,
6, resistances_normal, weights_normal, 0, 0,
0, nullptr, nullptr, 0, 0,
0, nullptr, nullptr, 0, 0);
// compute weight table for shadow/hilight palette entries
static const int resistances_sh[6] = { 3900, 2000, 1000, 1000/2, 1000/4, 470 };
double weights_sh[6];
compute_resistor_weights(0, 255, -1.0,
6, resistances_sh, weights_sh, 0, 0,
0, nullptr, nullptr, 0, 0,
0, nullptr, nullptr, 0, 0);
// compute R, G, B for each weight
for (int value = 0; value < 32; value++)
{
int i4 = (value >> 4) & 1;
int i3 = (value >> 3) & 1;
int i2 = (value >> 2) & 1;
int i1 = (value >> 1) & 1;
int i0 = (value >> 0) & 1;
m_palette_normal[value] = combine_6_weights(weights_normal, i0, i1, i2, i3, i4, 0);
m_palette_shadow[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 0);
m_palette_hilight[value] = combine_6_weights(weights_sh, i0, i1, i2, i3, i4, 1);
}
}
//-------------------------------------------------
// paletteram_w - handle writes to palette RAM
//-------------------------------------------------
WRITE16_MEMBER( segaxbd_state::paletteram_w )
{
// compute the number of entries
if (m_palette_entries == 0)
m_palette_entries = memshare("paletteram")->bytes() / 2;
// get the new value
UINT16 newval = m_paletteram[offset];
COMBINE_DATA(&newval);
m_paletteram[offset] = newval;
// byte 0 byte 1
// sBGR BBBB GGGG RRRR
// x000 4321 4321 4321
int r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e);
int g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
int b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);
// normal colors
m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]);
m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]);
}
//**************************************************************************
// MAIN CPU ADDRESS MAPS
//**************************************************************************
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0x3fffff)
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x080000, 0x083fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup1")
AM_RANGE(0x0a0000, 0x0a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("backup2")
AM_RANGE(0x0c0000, 0x0cffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram")
AM_RANGE(0x0d0000, 0x0d0fff) AM_MIRROR(0x00f000) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram")
AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_main", sega_315_5248_multiplier_device, read, write)
AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_main", sega_315_5249_divider_device, read, write)
AM_RANGE(0x0e8000, 0x0e801f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("cmptimer_main", sega_315_5250_compare_timer_device, read, write)
AM_RANGE(0x100000, 0x100fff) AM_MIRROR(0x00f000) AM_RAM AM_SHARE("sprites")
AM_RANGE(0x110000, 0x11ffff) AM_DEVWRITE("sprites", sega_xboard_sprite_device, draw_write)
AM_RANGE(0x120000, 0x123fff) AM_MIRROR(0x00c000) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0x130000, 0x13ffff) AM_READWRITE(adc_r, adc_w)
AM_RANGE(0x140000, 0x14000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_0_r, iochip_0_w)
AM_RANGE(0x150000, 0x15000f) AM_MIRROR(0x00fff0) AM_READWRITE(iochip_1_r, iochip_1_w)
AM_RANGE(0x160000, 0x16ffff) AM_WRITE(iocontrol_w)
AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("subcpu", 0x00000)
AM_RANGE(0x280000, 0x283fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram0")
AM_RANGE(0x2a0000, 0x2a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram1")
AM_RANGE(0x2e0000, 0x2e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_subx", sega_315_5248_multiplier_device, read, write)
AM_RANGE(0x2e4000, 0x2e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_subx", sega_315_5249_divider_device, read, write)
AM_RANGE(0x2e8000, 0x2e800f) AM_MIRROR(0x003ff0) AM_DEVREADWRITE("cmptimer_subx", sega_315_5250_compare_timer_device, read, write)
AM_RANGE(0x2ec000, 0x2ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("roadram")
AM_RANGE(0x2ee000, 0x2effff) AM_DEVREADWRITE("segaic16road", segaic16_road_device, segaic16_road_control_0_r, segaic16_road_control_0_w)
// AM_RANGE(0x2f0000, 0x2f3fff) AM_READWRITE(excs_r, excs_w)
AM_RANGE(0x3f8000, 0x3fbfff) AM_RAM AM_SHARE("backup1")
AM_RANGE(0x3fc000, 0x3fffff) AM_RAM AM_SHARE("backup2")
ADDRESS_MAP_END
static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 16, segaxbd_state )
AM_RANGE(0x00000, 0xfffff) AM_ROMBANK("fd1094_decrypted_opcodes")
ADDRESS_MAP_END
//**************************************************************************
// SUB CPU ADDRESS MAPS
//**************************************************************************
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 16, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xfffff)
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x080000, 0x083fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram0")
AM_RANGE(0x0a0000, 0x0a3fff) AM_MIRROR(0x01c000) AM_RAM AM_SHARE("subram1")
AM_RANGE(0x0e0000, 0x0e0007) AM_MIRROR(0x003ff8) AM_DEVREADWRITE("multiplier_subx", sega_315_5248_multiplier_device, read, write)
AM_RANGE(0x0e4000, 0x0e401f) AM_MIRROR(0x003fe0) AM_DEVREADWRITE("divider_subx", sega_315_5249_divider_device, read, write)
AM_RANGE(0x0e8000, 0x0e800f) AM_MIRROR(0x003ff0) AM_DEVREADWRITE("cmptimer_subx", sega_315_5250_compare_timer_device, read, write)
AM_RANGE(0x0ec000, 0x0ecfff) AM_MIRROR(0x001000) AM_RAM AM_SHARE("roadram")
AM_RANGE(0x0ee000, 0x0effff) AM_DEVREADWRITE("segaic16road", segaic16_road_device, segaic16_road_control_0_r, segaic16_road_control_0_w)
// AM_RANGE(0x0f0000, 0x0f3fff) AM_READWRITE(excs_r, excs_w)
ADDRESS_MAP_END
//**************************************************************************
// Z80 SOUND CPU ADDRESS MAPS
//**************************************************************************
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE("pcm", segapcm_device, sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
//**************************************************************************
// SUPER MONACO GP 2ND SOUND CPU ADDRESS MAPS
//**************************************************************************
// Sound Board
// The extra sound is used when the cabinet is Deluxe(Air Drive), or Cockpit. The soundlatch is
// shared with the main board sound.
static ADDRESS_MAP_START( smgp_sound2_map, AS_PROGRAM, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE("pcm2", segapcm_device, sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( smgp_sound2_portmap, AS_IO, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
//**************************************************************************
// SUPER MONACO GP MOTOR BOARD CPU ADDRESS MAPS
//**************************************************************************
// Motor Board, not yet emulated
static ADDRESS_MAP_START( smgp_airdrive_map, AS_PROGRAM, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xafff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( smgp_airdrive_portmap, AS_IO, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x01, 0x01) AM_READNOP
AM_RANGE(0x02, 0x03) AM_NOP
ADDRESS_MAP_END
//**************************************************************************
// SUPER MONACO GP LINK BOARD CPU ADDRESS MAPS
//**************************************************************************
// Link Board, not yet emulated
static ADDRESS_MAP_START( smgp_comm_map, AS_PROGRAM, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x3fff) AM_RAM
AM_RANGE(0x4000, 0x47ff) AM_RAM // MB8421 Dual-Port SRAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( smgp_comm_portmap, AS_IO, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
ADDRESS_MAP_END
//**************************************************************************
// RASCOT UNKNOWN Z80 CPU ADDRESS MAPS
//**************************************************************************
// Z80, unknown function
static ADDRESS_MAP_START( rascot_z80_map, AS_PROGRAM, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xafff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( rascot_z80_portmap, AS_IO, 8, segaxbd_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
ADDRESS_MAP_END
//**************************************************************************
// GENERIC PORT DEFINITIONS
//**************************************************************************
static INPUT_PORTS_START( xboard_generic )
PORT_START("mainpcb:IO0PORTA")
PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("mainpcb:IO0PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("mainpcb:IO1PORTA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // cannon trigger or shift down
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // missile button or shift up
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START("mainpcb:IO1PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("mainpcb:IO1PORTC")
SEGA_COINAGE_LOC(SWA)
PORT_START("mainpcb:IO1PORTD")
PORT_DIPUNUSED_DIPLOC( 0x01, IP_ACTIVE_LOW, "SWB:1" )
PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SWB:2" )
PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" )
PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SWB:4" )
PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SWB:5" )
PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" )
PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SWB:7" )
PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SWB:8" )
INPUT_PORTS_END
//**************************************************************************
// GAME-SPECIFIC PORT DEFINITIONS
//**************************************************************************
static INPUT_PORTS_START( aburner )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Vulcan")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Missile")
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x03, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1,2")
PORT_DIPSETTING( 0x03, "Moving Deluxe" )
PORT_DIPSETTING( 0x02, "Moving Standard" )
PORT_DIPSETTING( 0x01, DEF_STR( Upright ) )
// PORT_DIPSETTING( 0x00, DEF_STR( Unused ) )
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
// According to the manual, SWB:4 sets 3 or 4 lives, but it doesn't actually do that.
// However, it does on Afterburner II. Maybe there's another version of Afterburner
// that behaves as the manual suggests.
// In the Japanese manual "DIP SW B:4 / NOT USED"
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:5")
PORT_DIPSETTING( 0x10, "3" )
PORT_DIPSETTING( 0x00, "3x Credits" )
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6")
PORT_DIPSETTING( 0x20, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x80, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_START("mainpcb:ADC0") // stick X
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4)
PORT_START("mainpcb:ADC1") // stick Y
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x40,0xc0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE
PORT_START("mainpcb:ADC2") // throttle
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(79)
PORT_START("mainpcb:ADC3") // motor Y
PORT_BIT( 0xff, (0xb0+0x50)/2, IPT_SPECIAL )
PORT_START("mainpcb:ADC4") // motor X
PORT_BIT( 0xff, (0xb0+0x50)/2, IPT_SPECIAL )
INPUT_PORTS_END
static INPUT_PORTS_START( aburner2 )
PORT_INCLUDE( aburner )
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x03, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1,2")
PORT_DIPSETTING( 0x03, "Moving Deluxe" )
PORT_DIPSETTING( 0x02, "Moving Standard" )
PORT_DIPSETTING( 0x01, "Upright 1" )
PORT_DIPSETTING( 0x00, "Upright 2" )
PORT_DIPNAME( 0x04, 0x04, "Throttle Lever" ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
PORT_DIPSETTING( 0x04, DEF_STR( Yes ) )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5")
PORT_DIPSETTING( 0x18, "3" )
PORT_DIPSETTING( 0x10, "4" )
PORT_DIPSETTING( 0x08, "3x Credits" )
PORT_DIPSETTING( 0x00, "4x Credits" )
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6")
PORT_DIPSETTING( 0x20, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x80, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
INPUT_PORTS_END
static INPUT_PORTS_START( thndrbld )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Cannon")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Missile")
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x01, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING( 0x01, "Econ Upright" )
PORT_DIPSETTING( 0x00, "Mini Upright" ) // see note about inputs below
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, "Time" ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, "30 sec" )
PORT_DIPSETTING( 0x00, "0 sec" )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5")
PORT_DIPSETTING( 0x08, "2" )
PORT_DIPSETTING( 0x18, "3" )
PORT_DIPSETTING( 0x10, "4" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6")
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
PORT_DIPSETTING( 0x20, DEF_STR( Yes ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
// These inputs are valid for the "Econ Upright" and "Deluxe" cabinets.
// On the "Standing" cabinet, the joystick Y axis is reversed.
// On the "Mini Upright" cabinet, the inputs conform to After Burner II:
// the X axis is (un-)reversed, and the throttle and Y axis switch places
PORT_START("mainpcb:ADC0") // stick X
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE
PORT_START("mainpcb:ADC1") // "slottle"
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(79)
PORT_START("mainpcb:ADC2") // stick Y
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4)
INPUT_PORTS_END
static INPUT_PORTS_START( thndrbd1 )
PORT_INCLUDE( thndrbld )
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x01, 0x01, "Cabinet Type" ) PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING( 0x01, "Deluxe" )
PORT_DIPSETTING( 0x00, "Standing" ) // see note about inputs above
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, "Time" ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, "30 sec" )
PORT_DIPSETTING( 0x00, "0 sec" )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWB:4,5")
PORT_DIPSETTING( 0x08, "2" )
PORT_DIPSETTING( 0x18, "3" )
PORT_DIPSETTING( 0x10, "4" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6")
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
PORT_DIPSETTING( 0x20, DEF_STR( Yes ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
INPUT_PORTS_END
static const ioport_value lastsurv_position_table[] =
{
0x0f ^ 0x08 ^ 0x01, // down + left
0x0f ^ 0x01, // left
0x0f ^ 0x04 ^ 0x01, // up + left
0x0f ^ 0x04, // up
0x0f ^ 0x04 ^ 0x02, // up + right
0x0f ^ 0x02, // right
0x0f ^ 0x08 ^ 0x02, // down + right
0x0f ^ 0x08, // down
};
static INPUT_PORTS_START( lastsurv )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )
PORT_START("mainpcb:MUX0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0xf0, 0xf0 ^ 0x40, IPT_POSITIONAL ) PORT_PLAYER(2) PORT_POSITIONS(8) PORT_REMAP_TABLE(lastsurv_position_table) PORT_WRAPS PORT_SENSITIVITY(1) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W)
PORT_START("mainpcb:MUX1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0xf0, 0xf0 ^ 0x40, IPT_POSITIONAL ) PORT_PLAYER(1) PORT_POSITIONS(8) PORT_REMAP_TABLE(lastsurv_position_table) PORT_WRAPS PORT_SENSITIVITY(1) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
PORT_START("mainpcb:MUX2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("mainpcb:MUX3")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x03, 0x03, "I.D. No" ) PORT_DIPLOCATION("SWB:1,2")
PORT_DIPSETTING( 0x03, "1" )
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x01, "3" )
PORT_DIPSETTING( 0x00, "4" )
PORT_DIPNAME( 0x0c, 0x0c, "Network" ) PORT_DIPLOCATION("SWB:3,4")
PORT_DIPSETTING( 0x0c, "Off" )
PORT_DIPSETTING( 0x08, "On (2)" )
PORT_DIPSETTING( 0x04, "On (4)" )
// PORT_DIPSETTING( 0x00, "No Use" )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:5,6")
PORT_DIPSETTING( 0x20, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "Coin Chute" ) PORT_DIPLOCATION("SWB:8")
PORT_DIPSETTING( 0x80, "Single" )
PORT_DIPSETTING( 0x00, "Twin" )
INPUT_PORTS_END
static INPUT_PORTS_START( loffire )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_MODIFY("mainpcb:IO1PORTB")
PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING( 0x01, DEF_STR( Japanese ) )
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:2")
PORT_DIPSETTING( 0x02, "Cockpit" )
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPNAME( 0x04, 0x04, "2 Credits to Start" ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:4,5")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x18, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:6")
PORT_DIPSETTING( 0x20, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "Coin Chute" ) PORT_DIPLOCATION("SWB:8")
PORT_DIPSETTING( 0x80, DEF_STR( Single ) )
PORT_DIPSETTING( 0x00, "Twin" )
PORT_START("mainpcb:ADC0")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5)
PORT_START("mainpcb:ADC1")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5)
PORT_START("mainpcb:ADC2")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2)
PORT_START("mainpcb:ADC3")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(5) PORT_PLAYER(2)
INPUT_PORTS_END
static INPUT_PORTS_START( rachero )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Move to Center")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Suicide")
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x01, 0x01, "Credits" ) PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING( 0x01, "1 to Start, 1 to Continue" )
PORT_DIPSETTING( 0x00, "2 to Start, 1 to Continue" )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0x30, 0x30, "Time" ) PORT_DIPLOCATION("SWB:5,6")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
PORT_START("mainpcb:ADC0") // steering
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE
PORT_START("mainpcb:ADC1") // gas pedal
PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
PORT_START("mainpcb:ADC2") // brake
PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(40)
INPUT_PORTS_END
static INPUT_PORTS_START( smgp )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_A)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_Z)
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x07, 0x07, "Machine ID" ) PORT_DIPLOCATION("SWB:1,2,3")
PORT_DIPSETTING( 0x07, "1" )
PORT_DIPSETTING( 0x06, "2" )
PORT_DIPSETTING( 0x05, "3" )
PORT_DIPSETTING( 0x04, "4" )
PORT_DIPSETTING( 0x03, "5" )
PORT_DIPSETTING( 0x02, "6" )
PORT_DIPSETTING( 0x01, "7" )
PORT_DIPSETTING( 0x00, "8" )
PORT_DIPNAME( 0x38, 0x38, "Number of Machines" ) PORT_DIPLOCATION("SWB:4,5,6")
PORT_DIPSETTING( 0x38, "1" )
PORT_DIPSETTING( 0x30, "2" )
PORT_DIPSETTING( 0x28, "3" )
PORT_DIPSETTING( 0x20, "4" )
PORT_DIPSETTING( 0x18, "5" )
PORT_DIPSETTING( 0x10, "6" )
PORT_DIPSETTING( 0x08, "7" )
PORT_DIPSETTING( 0x00, "8" )
PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0xc0, "Deluxe" )
PORT_DIPSETTING( 0x80, "Cockpit" )
PORT_DIPSETTING( 0x40, DEF_STR( Upright ) )
// PORT_DIPSETTING( 0x00, "Deluxe" )
PORT_START("mainpcb:ADC0") // steering
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x38,0xc8) PORT_SENSITIVITY(100) PORT_KEYDELTA(4)
PORT_START("mainpcb:ADC1") // gas pedal
PORT_BIT( 0xff, 0x38, IPT_PEDAL ) PORT_MINMAX(0x38,0xb8) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
PORT_START("mainpcb:ADC2") // brake
PORT_BIT( 0xff, 0x28, IPT_PEDAL2 ) PORT_MINMAX(0x28,0xa8) PORT_SENSITIVITY(100) PORT_KEYDELTA(40)
INPUT_PORTS_END
static INPUT_PORTS_START( abcop )
PORT_INCLUDE( xboard_generic )
PORT_MODIFY("mainpcb:IO1PORTA")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Jump")
PORT_MODIFY("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x01, 0x01, "Credits" ) PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING( 0x01, "1 to Start, 1 to Continue" )
PORT_DIPSETTING( 0x00, "2 to Start, 1 to Continue" )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SWB:3")
PORT_DIPSETTING( 0x04, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0x30, 0x30, "Time" ) PORT_DIPLOCATION("SWB:5,6")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_START("mainpcb:ADC0") // steering
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE
PORT_START("mainpcb:ADC1") // accelerator
PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
INPUT_PORTS_END
static INPUT_PORTS_START( gprider )
PORT_START("mainpcb:IO0PORTA")
PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("mainpcb:IO0PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("mainpcb:IO1PORTA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_A)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_Z)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START("mainpcb:IO1PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("mainpcb:IO1PORTC")
SEGA_COINAGE_LOC(SWA)
PORT_START("mainpcb:IO1PORTD")
PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2")
PORT_DIPSETTING( 0x03, "Ride On" )
PORT_DIPSETTING( 0x02, DEF_STR( Upright ) )
// PORT_DIPSETTING( 0x01, DEF_STR( Unused ) )
// PORT_DIPSETTING( 0x00, DEF_STR( Unused ) )
PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" )
PORT_DIPNAME( 0x08, 0x08, "ID No." ) PORT_DIPLOCATION("SWB:4")
PORT_DIPSETTING( 0x08, "Main" ) // Player 1 (Blue)
PORT_DIPSETTING( 0x00, "Slave" ) // Player 2 (Red)
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:5")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x80, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_START("mainpcb:ADC0") // steering
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4)
PORT_START("mainpcb:ADC1") // gas pedal
PORT_BIT( 0xff, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE
PORT_START("mainpcb:ADC2") // brake
PORT_BIT( 0xff, 0x10, IPT_PEDAL2 ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) PORT_REVERSE
INPUT_PORTS_END
static INPUT_PORTS_START( gprider_double )
PORT_INCLUDE( gprider )
PORT_START("subpcb:IO0PORTA")
PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // /INTR of ADC0804
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("subpcb:IO0PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("subpcb:IO1PORTA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // button? not used by any game we have
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Shift Down") PORT_CODE(KEYCODE_W) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Shift Up") PORT_CODE(KEYCODE_S) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 )
PORT_START("subpcb:IO1PORTB")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("subpcb:IO1PORTC")
SEGA_COINAGE_LOC(SWA)
PORT_START("subpcb:IO1PORTD")
PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SWB:1,2")
PORT_DIPSETTING( 0x03, "Ride On" )
PORT_DIPSETTING( 0x02, DEF_STR( Upright ) )
// PORT_DIPSETTING( 0x01, DEF_STR( Unused ) )
// PORT_DIPSETTING( 0x00, DEF_STR( Unused ) )
PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SWB:3" )
PORT_DIPNAME( 0x08, 0x00, "ID No." ) PORT_DIPLOCATION("SWB:4")
PORT_DIPSETTING( 0x08, "Main" ) // Player 1 (Blue)
PORT_DIPSETTING( 0x00, "Slave" ) // Player 2 (Red)
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:5")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWB:6" )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:7,8")
PORT_DIPSETTING( 0x80, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_START("subpcb:ADC0") // steering
PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2)
PORT_START("subpcb:ADC1") // gas pedal
PORT_BIT( 0xff, 0x10, IPT_PEDAL ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
PORT_START("subpcb:ADC2") // brake
PORT_BIT( 0xff, 0x10, IPT_PEDAL2 ) PORT_MINMAX(0x10,0xef) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) PORT_REVERSE PORT_PLAYER(2)
INPUT_PORTS_END
static INPUT_PORTS_START( rascot )
PORT_INCLUDE( xboard_generic )
INPUT_PORTS_END
//**************************************************************************
// GRAPHICS DEFINITIONS
//**************************************************************************
static GFXDECODE_START( segaxbd )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 0, 1024 )
GFXDECODE_END
//**************************************************************************
// GENERIC MACHINE DRIVERS
//**************************************************************************
static MACHINE_CONFIG_FRAGMENT( xboard )
// basic machine hardware
MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_ADD("subcpu", M68000, MASTER_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(sub_map)
MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(sound_map)
MCFG_CPU_IO_MAP(sound_portmap)
MCFG_NVRAM_ADD_0FILL("backup1")
MCFG_NVRAM_ADD_0FILL("backup2")
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
MCFG_WATCHDOG_ADD("watchdog")
MCFG_SEGA_315_5248_MULTIPLIER_ADD("multiplier_main")
MCFG_SEGA_315_5248_MULTIPLIER_ADD("multiplier_subx")
MCFG_SEGA_315_5249_DIVIDER_ADD("divider_main")
MCFG_SEGA_315_5249_DIVIDER_ADD("divider_subx")
MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_main")
MCFG_SEGA_315_5250_TIMER_ACK(segaxbd_state, timer_ack_callback)
MCFG_SEGA_315_5250_SOUND_WRITE(segaxbd_state, sound_data_w)
MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_subx")
// video hardware
MCFG_GFXDECODE_ADD("gfxdecode", "palette", segaxbd)
MCFG_PALETTE_ADD("palette", 8192*3)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/8, 400, 0, 320, 262, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(segaxbd_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_SEGA_XBOARD_SPRITES_ADD("sprites")
MCFG_SEGAIC16VID_ADD("segaic16vid")
MCFG_SEGAIC16VID_GFXDECODE("gfxdecode")
MCFG_VIDEO_SET_SCREEN("screen")
MCFG_SEGAIC16_ROAD_ADD("segaic16road")
// sound hardware
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
MCFG_YM2151_ADD("ymsnd", SOUND_CLOCK/4)
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.43)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.43)
MCFG_SEGAPCM_ADD("pcm", SOUND_CLOCK/4)
MCFG_SEGAPCM_BANK(BANK_512)
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_CONFIG_END
const device_type SEGA_XBD_REGULAR_DEVICE = &device_creator<segaxbd_regular_state>;
segaxbd_regular_state::segaxbd_regular_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_regular_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( xboard );
}
static MACHINE_CONFIG_START( sega_xboard, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_REGULAR_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( xboard_fd1094 )
MCFG_FRAGMENT_ADD( xboard )
MCFG_CPU_REPLACE("maincpu", FD1094, MASTER_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map)
MACHINE_CONFIG_END
const device_type SEGA_XBD_FD1094_DEVICE = &device_creator<segaxbd_fd1094_state>;
segaxbd_fd1094_state::segaxbd_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_fd1094_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( xboard_fd1094 );
}
static MACHINE_CONFIG_START( sega_xboard_fd1094, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_FD1094_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( sega_xboard_fd1094_double, segaxbd_new_state_double )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_FD1094_DEVICE, 0)
MCFG_DEVICE_ADD("subpcb", SEGA_XBD_FD1094_DEVICE, 0)
//MCFG_QUANTUM_PERFECT_CPU("mainpcb:maincpu") // doesn't help..
MACHINE_CONFIG_END
//**************************************************************************
// GAME-SPECIFIC MACHINE DRIVERS
//**************************************************************************
static MACHINE_CONFIG_FRAGMENT( lastsurv_fd1094 )
MCFG_FRAGMENT_ADD( xboard_fd1094 )
// basic machine hardware
// TODO: network board
// sound hardware - ym2151 stereo is reversed
MCFG_SOUND_MODIFY("ymsnd")
MCFG_SOUND_ROUTES_RESET()
MCFG_SOUND_ROUTE(0, "rspeaker", 0.43)
MCFG_SOUND_ROUTE(1, "lspeaker", 0.43)
MACHINE_CONFIG_END
const device_type SEGA_XBD_LASTSURV_FD1094_DEVICE = &device_creator<segaxbd_lastsurv_fd1094_state>;
segaxbd_lastsurv_fd1094_state::segaxbd_lastsurv_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_lastsurv_fd1094_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( lastsurv_fd1094 );
}
static MACHINE_CONFIG_START( sega_lastsurv_fd1094, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_LASTSURV_FD1094_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( lastsurv )
MCFG_FRAGMENT_ADD( xboard )
// basic machine hardware
// TODO: network board
// sound hardware - ym2151 stereo is reversed
MCFG_SOUND_MODIFY("ymsnd")
MCFG_SOUND_ROUTES_RESET()
MCFG_SOUND_ROUTE(0, "rspeaker", 0.43)
MCFG_SOUND_ROUTE(1, "lspeaker", 0.43)
MACHINE_CONFIG_END
const device_type SEGA_XBD_LASTSURV_DEVICE = &device_creator<segaxbd_lastsurv_state>;
segaxbd_lastsurv_state::segaxbd_lastsurv_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_lastsurv_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( lastsurv );
}
static MACHINE_CONFIG_START( sega_lastsurv, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_LASTSURV_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( smgp_fd1094 )
MCFG_FRAGMENT_ADD( xboard_fd1094 )
// basic machine hardware
MCFG_CPU_ADD("soundcpu2", Z80, SOUND_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(smgp_sound2_map)
MCFG_CPU_IO_MAP(smgp_sound2_portmap)
MCFG_CPU_ADD("commcpu", Z80, XTAL_16MHz/2) // Z80E
MCFG_CPU_PROGRAM_MAP(smgp_comm_map)
MCFG_CPU_IO_MAP(smgp_comm_portmap)
MCFG_CPU_ADD("motorcpu", Z80, XTAL_16MHz/2) // not verified
MCFG_CPU_PROGRAM_MAP(smgp_airdrive_map)
MCFG_CPU_IO_MAP(smgp_airdrive_portmap)
// sound hardware
MCFG_SPEAKER_STANDARD_STEREO("rearleft", "rearright")
MCFG_SEGAPCM_ADD("pcm2", SOUND_CLOCK/4)
MCFG_SEGAPCM_BANK(BANK_512)
MCFG_SOUND_ROUTE(0, "rearleft", 1.0)
MCFG_SOUND_ROUTE(1, "rearright", 1.0)
MACHINE_CONFIG_END
const device_type SEGA_XBD_SMGP_FD1094_DEVICE = &device_creator<segaxbd_smgp_fd1094_state>;
segaxbd_smgp_fd1094_state::segaxbd_smgp_fd1094_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_smgp_fd1094_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( smgp_fd1094 );
}
static MACHINE_CONFIG_START( sega_smgp_fd1094, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_SMGP_FD1094_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( smgp )
MCFG_FRAGMENT_ADD( xboard )
// basic machine hardware
MCFG_CPU_ADD("soundcpu2", Z80, SOUND_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(smgp_sound2_map)
MCFG_CPU_IO_MAP(smgp_sound2_portmap)
MCFG_CPU_ADD("commcpu", Z80, XTAL_16MHz/2) // Z80E
MCFG_CPU_PROGRAM_MAP(smgp_comm_map)
MCFG_CPU_IO_MAP(smgp_comm_portmap)
MCFG_CPU_ADD("motorcpu", Z80, XTAL_16MHz/2) // not verified
MCFG_CPU_PROGRAM_MAP(smgp_airdrive_map)
MCFG_CPU_IO_MAP(smgp_airdrive_portmap)
// sound hardware
MCFG_SPEAKER_STANDARD_STEREO("rearleft", "rearright")
MCFG_SEGAPCM_ADD("pcm2", SOUND_CLOCK/4)
MCFG_SEGAPCM_BANK(BANK_512)
MCFG_SOUND_ROUTE(0, "rearleft", 1.0)
MCFG_SOUND_ROUTE(1, "rearright", 1.0)
MACHINE_CONFIG_END
const device_type SEGA_XBD_SMGP_DEVICE = &device_creator<segaxbd_smgp_state>;
segaxbd_smgp_state::segaxbd_smgp_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_smgp_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( smgp );
}
static MACHINE_CONFIG_START( sega_smgp, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_SMGP_DEVICE, 0)
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( rascot )
MCFG_FRAGMENT_ADD( xboard )
// basic machine hardware
MCFG_CPU_MODIFY("soundcpu")
MCFG_CPU_PROGRAM_MAP(rascot_z80_map)
MCFG_CPU_IO_MAP(rascot_z80_portmap)
MACHINE_CONFIG_END
const device_type SEGA_XBD_RASCOT_DEVICE = &device_creator<segaxbd_rascot_state>;
segaxbd_rascot_state::segaxbd_rascot_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: segaxbd_state(mconfig, tag, owner, clock)
{
}
machine_config_constructor segaxbd_rascot_state::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( rascot );
}
static MACHINE_CONFIG_START( sega_rascot, segaxbd_new_state )
MCFG_DEVICE_ADD("mainpcb", SEGA_XBD_RASCOT_DEVICE, 0)
MACHINE_CONFIG_END
//**************************************************************************
// ROM DEFINITIONS
//**************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Afterburner, Sega X-board
// CPU: 68000 (317-????)
//
// Missing the Deluxe/Upright English (US?) version rom set
// Program roms:
// EPR-11092.58
// EPR-11093.63
// EPR-10950.57
// EPR-10951.62
// Sub-Program
// EPR-11090.30
// EPR-11091.20
// Fix Scroll Character
// EPR-11089.154
// EPR-11088.153
// EPR-11087.152
// Object (Character & Scene Scenery)
// EPR-11098.93
// EPR-11099.97
// EPR-11100.101
// EPR-11101.105
// EPR-11094.92--
// EPR-11095.96 \ These 4 found in Afterburner II (German)??
// EPR-11096.100 /
// EPR-11097.104-
// Sound Data
// EPR-10929.13
//
ROM_START( aburner )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-10940.58", 0x00000, 0x20000, CRC(4d132c4e) SHA1(007af52167c369177b86fc0f8b007ebceba2a30c) )
ROM_LOAD16_BYTE( "epr-10941.63", 0x00001, 0x20000, CRC(136ea264) SHA1(606ac67db53a6002ed1bd71287aed2e3e720cdf4) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-10927.20", 0x00000, 0x20000, CRC(66d36757) SHA1(c7f6d653fb6bfd629bb62057010d41f3ccfccc4d) )
ROM_LOAD16_BYTE( "epr-10928.29", 0x00001, 0x20000, CRC(7c01d40b) SHA1(d95b4702a9c813db8bc24c8cd7e0933cbe54a573) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-10926.154", 0x00000, 0x10000, CRC(ed8bd632) SHA1(d5bbd5e257ebef8cfb3baf5fa530b189d9cddb57) )
ROM_LOAD( "epr-10925.153", 0x10000, 0x10000, CRC(4ef048cc) SHA1(3b386b3bfa600f114dbc19796bb6864a88ff4562) )
ROM_LOAD( "epr-10924.152", 0x20000, 0x10000, CRC(50c15a6d) SHA1(fc202cc583fc6804647abc884fdf332e72ea3100) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR
ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) )
ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) )
ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) )
ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) )
ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) )
ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) )
ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) )
ROM_LOAD32_BYTE( "epr-10942.92", 0x100000, 0x20000, CRC(5ce10b8c) SHA1(c6c189143762b0ef473d5d31d66226820c5cf080) )
ROM_LOAD32_BYTE( "epr-10943.96", 0x100001, 0x20000, CRC(b98294dc) SHA1(a4161af23f9a67b4ed81308c73e72e1797cce894) )
ROM_LOAD32_BYTE( "epr-10944.100", 0x100002, 0x20000, CRC(17be8f67) SHA1(371f0dd1914a98695cb86f921fe8e82b49e69a4a) )
ROM_LOAD32_BYTE( "epr-10945.104", 0x100003, 0x20000, CRC(df4d4c4f) SHA1(24075a6709869d9acf9082b6b4ad96bc6f8b1932) )
ROM_LOAD32_BYTE( "epr-10946.93", 0x180000, 0x20000, CRC(d7d485f4) SHA1(d843aefb4d99e0dff8d62ee6bd0c3aa6aa6c941b) )
ROM_LOAD32_BYTE( "epr-10947.97", 0x180001, 0x20000, CRC(08838392) SHA1(84f7ff3bff31c0738dead7bc00219ede834eb0e0) )
ROM_LOAD32_BYTE( "epr-10948.101", 0x180002, 0x20000, CRC(64284761) SHA1(9594c671900f7f49d8fb965bc17b4380ce2c68d5) )
ROM_LOAD32_BYTE( "epr-10949.105", 0x180003, 0x20000, CRC(d8437d92) SHA1(480291358c3d197645d7bd149bdfe5d41071d52d) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-10923.17", 0x00000, 0x10000, CRC(6888eb8f) SHA1(8f8fffb214842a5d356e33f5a97099bc6407384f) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) )
ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) )
ROM_LOAD( "epr-10929.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Afterburner II, Sega X-board
// CPU: 68000 (317-????)
//
ROM_START( aburner2 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-11107.58", 0x00000, 0x20000, CRC(6d87bab7) SHA1(ab34fe78f1f216037b3e3dca3e61f1b31c05cedf) )
ROM_LOAD16_BYTE( "epr-11108.63", 0x00001, 0x20000, CRC(202a3e1d) SHA1(cf2018bbad366de4b222eae35942636ca68aa581) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-11109.20", 0x00000, 0x20000, CRC(85a0fe07) SHA1(5a3a8fda6cb4898cfece4ec865b81b9b60f9ad55) )
ROM_LOAD16_BYTE( "epr-11110.29", 0x00001, 0x20000, CRC(f3d6797c) SHA1(17487b89ddbfbcc32a0b52268259f1c8d10fd0b2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-11115.154", 0x00000, 0x10000, CRC(e8e32921) SHA1(30a96e6b514a475c778296228ba5b6fb96b211b0) )
ROM_LOAD( "epr-11114.153", 0x10000, 0x10000, CRC(2e97f633) SHA1(074125c106dd00785903b2e10cd7e28d5036eb60) )
ROM_LOAD( "epr-11113.152", 0x20000, 0x10000, CRC(36058c8c) SHA1(52befe6c6c53f10b6fd4971098abc8f8d3eef9d4) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR
ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) )
ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) )
ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) )
ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) )
ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) )
ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) )
ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) )
ROM_LOAD32_BYTE( "epr-11103.92", 0x100000, 0x20000, CRC(bdd60da2) SHA1(01673837c5ad84fa087728a05549ac01542ef4e9) )
ROM_LOAD32_BYTE( "epr-11104.96", 0x100001, 0x20000, CRC(06a35fce) SHA1(c39ae02fc8246e883c4f4c320f668ce6ca9c845a) )
ROM_LOAD32_BYTE( "epr-11105.100", 0x100002, 0x20000, CRC(027b0689) SHA1(c704c79faadb5e445fd3bd9281683b09831782d2) )
ROM_LOAD32_BYTE( "epr-11106.104", 0x100003, 0x20000, CRC(9e1fec09) SHA1(6cc47d86852b988bfcd64cb4ed7d832c683e3114) )
ROM_LOAD32_BYTE( "epr-11116.93", 0x180000, 0x20000, CRC(49b4c1ba) SHA1(5419f49f091e386eead4ccf5e03f12769e278179) )
ROM_LOAD32_BYTE( "epr-11117.97", 0x180001, 0x20000, CRC(821fbb71) SHA1(be2366d7b4a3a2543ba5024f0e258f1bc43caec8) )
ROM_LOAD32_BYTE( "epr-11118.101", 0x180002, 0x20000, CRC(8f38540b) SHA1(1fdfb157d1aca96cb635bd3d64f94545eb88c133) )
ROM_LOAD32_BYTE( "epr-11119.105", 0x180003, 0x20000, CRC(d0343a8e) SHA1(8c0c0addb6dfd0ea04c3900a9f7f7c731ca6e9ea) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-11112.17", 0x00000, 0x10000, CRC(d777fc6d) SHA1(46ce1c3875437044c0a172960d560d6acd6eaa92) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) )
ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) )
ROM_LOAD( "epr-11102.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) )
ROM_END
//*************************************************************************************************************************
// Afterburner II (German), Sega X-board
// CPU: 68000 (317-????)
// Sega Game ID #: 834-6335-04 AFTER BURNER
//
ROM_START( aburner2g )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-11173a.58", 0x00000, 0x20000, CRC(cbf480f4) SHA1(f5bab7b2889cdd3f3f2a3e9edd3f17b4d2a5b8a9) )
ROM_LOAD16_BYTE( "epr-11174a.63", 0x00001, 0x20000, CRC(ed7cba77) SHA1(e81f24fa93329ad25150eada7717cce55fa3887d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-11109.20", 0x00000, 0x20000, CRC(85a0fe07) SHA1(5a3a8fda6cb4898cfece4ec865b81b9b60f9ad55) )
ROM_LOAD16_BYTE( "epr-11110.29", 0x00001, 0x20000, CRC(f3d6797c) SHA1(17487b89ddbfbcc32a0b52268259f1c8d10fd0b2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-11115.154", 0x00000, 0x10000, CRC(e8e32921) SHA1(30a96e6b514a475c778296228ba5b6fb96b211b0) )
ROM_LOAD( "epr-11114.153", 0x10000, 0x10000, CRC(2e97f633) SHA1(074125c106dd00785903b2e10cd7e28d5036eb60) )
ROM_LOAD( "epr-11113.152", 0x20000, 0x10000, CRC(36058c8c) SHA1(52befe6c6c53f10b6fd4971098abc8f8d3eef9d4) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-10932.90", 0x000000, 0x20000, CRC(cc0821d6) SHA1(22e84419a585209bbda1466d2180504c316a9b7f) ) // First 8 roms are MPR, the rest are EPR
ROM_LOAD32_BYTE( "mpr-10934.94", 0x000001, 0x20000, CRC(4a51b1fa) SHA1(2eed018a5a1e935bb72b6f440a794466a1397dc5) )
ROM_LOAD32_BYTE( "mpr-10936.98", 0x000002, 0x20000, CRC(ada70d64) SHA1(ba6203b0fdb4c4998b7be5b446eb8354751d553a) )
ROM_LOAD32_BYTE( "mpr-10938.102", 0x000003, 0x20000, CRC(e7675baf) SHA1(aa979319a44c0b18c462afb5ca9cdeed2292c76a) )
ROM_LOAD32_BYTE( "mpr-10933.91", 0x080000, 0x20000, CRC(c8efb2c3) SHA1(ba31da93f929f2c457e60b2099d5a1ba6b5a9f48) )
ROM_LOAD32_BYTE( "mpr-10935.95", 0x080001, 0x20000, CRC(c1e23521) SHA1(5e95f3b6ff9f4caca676eaa6c84f1200315218ea) )
ROM_LOAD32_BYTE( "mpr-10937.99", 0x080002, 0x20000, CRC(f0199658) SHA1(cd67504fef53f637a3b1c723c4a04148f88028d2) )
ROM_LOAD32_BYTE( "mpr-10939.103", 0x080003, 0x20000, CRC(a0d49480) SHA1(6c4234456bc09ae771beec284d7aa21ebe474f6f) )
ROM_LOAD32_BYTE( "epr-11094.92", 0x100000, 0x20000, CRC(bdd60da2) SHA1(01673837c5ad84fa087728a05549ac01542ef4e9) )
ROM_LOAD32_BYTE( "epr-11095.96", 0x100001, 0x20000, CRC(06a35fce) SHA1(c39ae02fc8246e883c4f4c320f668ce6ca9c845a) )
ROM_LOAD32_BYTE( "epr-11096.100", 0x100002, 0x20000, CRC(027b0689) SHA1(c704c79faadb5e445fd3bd9281683b09831782d2) )
ROM_LOAD32_BYTE( "epr-11097.104", 0x100003, 0x20000, CRC(9e1fec09) SHA1(6cc47d86852b988bfcd64cb4ed7d832c683e3114) )
ROM_LOAD32_BYTE( "epr-11116.93", 0x180000, 0x20000, CRC(49b4c1ba) SHA1(5419f49f091e386eead4ccf5e03f12769e278179) )
ROM_LOAD32_BYTE( "epr-11117.97", 0x180001, 0x20000, CRC(821fbb71) SHA1(be2366d7b4a3a2543ba5024f0e258f1bc43caec8) )
ROM_LOAD32_BYTE( "epr-11118.101", 0x180002, 0x20000, CRC(8f38540b) SHA1(1fdfb157d1aca96cb635bd3d64f94545eb88c133) )
ROM_LOAD32_BYTE( "epr-11119.105", 0x180003, 0x20000, CRC(d0343a8e) SHA1(8c0c0addb6dfd0ea04c3900a9f7f7c731ca6e9ea) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
ROM_LOAD( "epr-10922.40", 0x000000, 0x10000, CRC(b49183d4) SHA1(71d87bfbce858049ccde9597ab15575b3cdba892) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-11112.17", 0x00000, 0x10000, CRC(d777fc6d) SHA1(46ce1c3875437044c0a172960d560d6acd6eaa92) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-10931.11", 0x00000, 0x20000, CRC(9209068f) SHA1(01f3dda1c066d00080c55f2c86c506b6b2407f98) ) // There is known to exist German Sample roms
ROM_LOAD( "mpr-10930.12", 0x20000, 0x20000, CRC(6493368b) SHA1(328aff19ff1d1344e9115f519d3962390c4e5ba4) )
ROM_LOAD( "epr-10929.13", 0x40000, 0x20000, CRC(6c07c78d) SHA1(3868b1824f43e4f2b4fbcd9274bfb3000c889d12) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Line of Fire, Sega X-board
// CPU: FD1094 (317-0136)
// Sega game ID# 834-7218-02
//
ROM_START( loffire )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12849.58", 0x000000, 0x20000, CRC(61cfd2fe) SHA1(b47ae9cdf741574ab9128dd3556b1ef35e81a149) )
ROM_LOAD16_BYTE( "epr-12850.63", 0x000001, 0x20000, CRC(14598f2a) SHA1(13a51529ed32acefd733d9f638621c3e023dbd6d) )
//
// It's not possible to determine the original value with just the available
// ROM data. The choice was between 47, 56 and 57, which decrypt correctly all
// the code at the affected addresses (2638, 6638 and so on).
// I chose 57 because it's the only one that has only 1 bit different from the
// bad value in the old dump (77).
//
// Nicola Salmoria
//
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0136.key", 0x0000, 0x2000, BAD_DUMP CRC(344bfe0c) SHA1(f6bb8045b46f90f8abadf1dc2e1ae1d7cef9c810) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
ROM_START( loffired )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12849.58", 0x000000, 0x20000, CRC(dfd1ab45) SHA1(dac358b6f50999deaed422578c2dcdfb492c81c9) )
ROM_LOAD16_BYTE( "bootleg_epr-12850.63", 0x000001, 0x20000, CRC(90889ae9) SHA1(254f8934e8a0329e28a38c71c4bd628ef7237ca8) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
//*************************************************************************************************************************
// Line of Fire, Sega X-board
// CPU: FD1094 (317-0135)
// Sega game ID# 834-7218-01
//
ROM_START( loffireu )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12847a.58", 0x000000, 0x20000, CRC(c50eb4ed) SHA1(18a46c97aec2fefd160338c1760b6ee367dcb57f) )
ROM_LOAD16_BYTE( "epr-12848a.63", 0x000001, 0x20000, CRC(f8ff8640) SHA1(193bb8f42f3c5011ad1fbf87215f012de5e950fb) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0135.key", 0x0000, 0x2000, CRC(c53ad019) SHA1(7e6dc2b35ebfeefb507d4d03f5a59574944177d1) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
ROM_START( loffireud )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12847a.58", 0x000000, 0x20000, CRC(74d270d0) SHA1(88819b4a4b49e4f02fdb4a617e2548a82ce7e835) )
ROM_LOAD16_BYTE( "bootleg_epr-12848a.63", 0x000001, 0x20000, CRC(7f27e058) SHA1(98401f992e4feb9141dc802edaaaa09eedfa8817) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
//*************************************************************************************************************************
// Line of Fire, Sega X-board
// CPU: FD1094 (317-0134)
// Sega game ID# 834-7218
//
ROM_START( loffirej )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
// repaired using data from the loffire set since they are mostly identical
// when decrypted, they pass the rom check so are assumed to be ok but double
// checking them when possible never hurts
ROM_LOAD16_BYTE( "epr-12794.58", 0x000000, 0x20000, CRC(1e588992) SHA1(fe7107e83c12643e7d22fd4b4cd0c7bcff0d84c3) )
ROM_LOAD16_BYTE( "epr-12795.63", 0x000001, 0x20000, CRC(d43d7427) SHA1(ecbd425bab6aa65ffbd441d6a0936ac055d5f06d) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0134.key", 0x0000, 0x2000, CRC(732626d4) SHA1(75ed7ca417758dd62afb4edbb9daee754932c392) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
ROM_START( loffirejd )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12794.58", 0x000000, 0x20000, CRC(795f110d) SHA1(1592c618d21932490555c5fdf376429dfae00a95) )
ROM_LOAD16_BYTE( "bootleg_epr-12795.63", 0x000001, 0x20000, CRC(87c52aaa) SHA1(179d735966e46dc2e9d61047038224699c1956ed) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12804.20", 0x000000, 0x20000, CRC(b853480e) SHA1(de0889e99251da7ea50316282ebf6f434cc2db11) )
ROM_LOAD16_BYTE( "epr-12805.29", 0x000001, 0x20000, CRC(4a7200c3) SHA1(3e6febed36a55438e0d24441b68f2b7952791584) )
ROM_LOAD16_BYTE( "epr-12802.21", 0x040000, 0x20000, CRC(d746bb39) SHA1(08dc8cf565997c7e52329961bf7a229a15900cff) )
ROM_LOAD16_BYTE( "epr-12803.30", 0x040001, 0x20000, CRC(c1d9e751) SHA1(98b3d0b3b31702f6234b5fea2b82d512fc5d3ad2) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-12791.154", 0x00000, 0x10000, CRC(acfa69ba) SHA1(353c43dda6c2282a785646b0a58c90cfd173cd7b) )
ROM_LOAD( "opr-12792.153", 0x10000, 0x10000, CRC(e506723c) SHA1(d04dc29686fe348f8f715d14c027de0e508c770f) )
ROM_LOAD( "opr-12793.152", 0x20000, 0x10000, CRC(0ce8cce3) SHA1(1a6b1af2b0b9e8240e681f7b15e9d08595753fe6) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12787.90", 0x000000, 0x20000, CRC(6431a3a6) SHA1(63a732b7dfd2b83fe7684d47fea26063c4ece099) )
ROM_LOAD32_BYTE( "epr-12788.94", 0x000001, 0x20000, CRC(1982a0ce) SHA1(e4756f31b0094e0e9ddb2df53a5c938ac5559230) )
ROM_LOAD32_BYTE( "epr-12789.98", 0x000002, 0x20000, CRC(97d03274) SHA1(b4b9921db53949bc8e91f8a2992e89c172fe8893) )
ROM_LOAD32_BYTE( "epr-12790.102", 0x000003, 0x20000, CRC(816e76e6) SHA1(34d2a662af96f40f40a77497cbc0a3374fe9a34f) )
ROM_LOAD32_BYTE( "epr-12783.91", 0x080000, 0x20000, CRC(c13feea9) SHA1(c0c3097903079deec22b0f8de76927f7570ac0f6) )
ROM_LOAD32_BYTE( "epr-12784.95", 0x080001, 0x20000, CRC(39b94c65) SHA1(4deae3bf7bb4e04b011d23292a0c68471758e7ec) )
ROM_LOAD32_BYTE( "epr-12785.99", 0x080002, 0x20000, CRC(05ed0059) SHA1(b7404a0f4f15ffdbd08673683cea22340de3f5f9) )
ROM_LOAD32_BYTE( "epr-12786.103", 0x080003, 0x20000, CRC(a4123165) SHA1(024597dcfbd3be932626b84dbd6e7d38a7a0195d) )
ROM_LOAD32_BYTE( "epr-12779.92", 0x100000, 0x20000, CRC(ae58af7c) SHA1(8c57f2d0b6584dd606afc5ecff039479e5068420) )
ROM_LOAD32_BYTE( "epr-12780.96", 0x100001, 0x20000, CRC(ee670c1e) SHA1(8a9e0808d40e210abf6c49ef5c0774d8c0d6602b) )
ROM_LOAD32_BYTE( "epr-12781.100", 0x100002, 0x20000, CRC(538f6bc5) SHA1(4f294ef0aa9c7e2ac7e92518d938f0870f2e46d1) )
ROM_LOAD32_BYTE( "epr-12782.104", 0x100003, 0x20000, CRC(5acc34f7) SHA1(ef27ab818f50e59a122b9fc65b13442d9fee307c) )
ROM_LOAD32_BYTE( "epr-12775.93", 0x180000, 0x20000, CRC(693056ec) SHA1(82d10d960441811b9369295bbb60fa7bfc5457a3) )
ROM_LOAD32_BYTE( "epr-12776.97", 0x180001, 0x20000, CRC(61efbdfd) SHA1(67f267e0673c64ce77669826ea1d11cb79d0ccc1) )
ROM_LOAD32_BYTE( "epr-12777.101", 0x180002, 0x20000, CRC(29d5b953) SHA1(0c932a67e2aecffa7a1dbaa587c96214e1a2cc7f) )
ROM_LOAD32_BYTE( "epr-12778.105", 0x180003, 0x20000, CRC(2fb68e07) SHA1(8685e72aed115cbc9c6c7511217996a573b30d16) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12798.17", 0x00000, 0x10000, CRC(0587738d) SHA1(24c79b0c73616d5532a49a2c9121dfabe3a80c7d) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12799.11", 0x00000, 0x20000, CRC(bc60181c) SHA1(3c89161348db7cafb5636ab4eaba91fbd3541f90) )
ROM_LOAD( "epr-12800.12", 0x20000, 0x20000, CRC(1158c1a3) SHA1(e1d664a203eed5a0130b39ced7bea8328f06f107) )
ROM_LOAD( "epr-12801.13", 0x40000, 0x20000, CRC(2d6567c4) SHA1(542be9d8e91cf2df18d95f4e259cfda0560697cb) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Thunder Blade, Sega X-board
// CPU: FD1094 (317-0056)
//
// GAME BD NO. 834-6493-03 (Uses "MPR" mask roms) or 834-6493-05 (Uses "EPR" eproms)
//
ROM_START( thndrbld )
ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-11405.ic58", 0x000000, 0x20000, CRC(e057dd5a) SHA1(4c032db4752dfb44dba3def5ee5377fffd94b79c) )
ROM_LOAD16_BYTE( "epr-11406.ic63", 0x000001, 0x20000, CRC(c6b994b8) SHA1(098b2ae30c4aafea35222369d60f8e89f87639eb) )
ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) )
ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0056.key", 0x0000, 0x2000, CRC(b40cd2c5) SHA1(865e70bce4f55f6702960d6eaa780b7b1f880e41) )
ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-11390.ic20", 0x000000, 0x20000, CRC(ed988fdb) SHA1(b809b0b7dabd5cb29f5387522c6dfb993d1d0271) )
ROM_LOAD16_BYTE( "epr-11391.ic29", 0x000001, 0x20000, CRC(12523bc1) SHA1(54635d6c4cc97cf4148dcac3bb2056fc414252f7) )
ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) )
ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) )
ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) )
ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) )
ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) )
ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) )
ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) )
ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) )
ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) )
ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) )
ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) )
ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) )
ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) )
ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) )
ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) )
ROM_LOAD32_BYTE( "epr-11395.ic93", 0x180000, 0x20000, CRC(90775579) SHA1(15a86071a105da40ec9c0c0074e342231fc030d0) ) //
ROM_LOAD32_BYTE( "epr-11394.ic97", 0x180001, 0x20000, CRC(5f2783be) SHA1(424510153a91902901f321f39738a862d6fba8e7) ) // different numbers?
ROM_LOAD32_BYTE( "epr-11393.ic101", 0x180002, 0x20000, CRC(525e2e1d) SHA1(6fd09f775e7e6cad8078513d1af0a8ff40fb1360) ) // replaced from original rev?
ROM_LOAD32_BYTE( "epr-11392.ic105", 0x180003, 0x20000, CRC(b4a382f7) SHA1(c03a05ba521f654db1a9c5f5717b7a15e5a29d4e) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data
ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-11396.ic17", 0x00000, 0x10000, CRC(d37b54a4) SHA1(c230fe7241a1f13ca13506d1492f348f506c40a7) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) )
ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) )
ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) )
ROM_END
ROM_START( thndrbldd )
ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-11405.ic58", 0x000000, 0x20000, CRC(1642fd59) SHA1(92b95d97b1eef770983c993d357e06ecf6a2b29c) )
ROM_LOAD16_BYTE( "bootleg_epr-11406.ic63", 0x000001, 0x20000, CRC(aa87dd75) SHA1(4c61dfef69a68d9cab8fed0d2cbb28b751319049) )
ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) )
ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) )
ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-11390.ic20", 0x000000, 0x20000, CRC(ed988fdb) SHA1(b809b0b7dabd5cb29f5387522c6dfb993d1d0271) )
ROM_LOAD16_BYTE( "epr-11391.ic29", 0x000001, 0x20000, CRC(12523bc1) SHA1(54635d6c4cc97cf4148dcac3bb2056fc414252f7) )
ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) )
ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) )
ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) )
ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) )
ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) )
ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) )
ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) )
ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) )
ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) )
ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) )
ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) )
ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) )
ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) )
ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) )
ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) )
ROM_LOAD32_BYTE( "epr-11395.ic93", 0x180000, 0x20000, CRC(90775579) SHA1(15a86071a105da40ec9c0c0074e342231fc030d0) ) //
ROM_LOAD32_BYTE( "epr-11394.ic97", 0x180001, 0x20000, CRC(5f2783be) SHA1(424510153a91902901f321f39738a862d6fba8e7) ) // different numbers?
ROM_LOAD32_BYTE( "epr-11393.ic101", 0x180002, 0x20000, CRC(525e2e1d) SHA1(6fd09f775e7e6cad8078513d1af0a8ff40fb1360) ) // replaced from original rev?
ROM_LOAD32_BYTE( "epr-11392.ic105", 0x180003, 0x20000, CRC(b4a382f7) SHA1(c03a05ba521f654db1a9c5f5717b7a15e5a29d4e) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data
ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-11396.ic17", 0x00000, 0x10000, CRC(d37b54a4) SHA1(c230fe7241a1f13ca13506d1492f348f506c40a7) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) )
ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) )
ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) )
ROM_END
//*************************************************************************************************************************
// Thunder Blade (Japan), Sega X-board
// CPU: MC68000
//
// GAME BD NO. 834-6493-03 (Uses "MPR" mask roms) or 834-6493-05 (Uses "EPR" eproms)
//
ROM_START( thndrbld1 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-11304.ic58", 0x000000, 0x20000, CRC(a90630ef) SHA1(8f29e020119b2243b1c95e15546af1773327ae85) ) // patched?
ROM_LOAD16_BYTE( "epr-11305.ic63", 0x000001, 0x20000, CRC(9ba3ef61) SHA1(f75748b37ce35b0ef881804f73417643068dfbb2) ) // patched?
ROM_LOAD16_BYTE( "epr-11306.ic57", 0x040000, 0x20000, CRC(4b95f2b4) SHA1(9e0ff898a2af05c35db3551e52c7485748698c28) )
ROM_LOAD16_BYTE( "epr-11307.ic62", 0x040001, 0x20000, CRC(2d6833e4) SHA1(b39a744370014237121f0010d18897e63f7058cf) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-11308.ic20", 0x00000, 0x20000, CRC(7956c238) SHA1(4608225cfd6ea3d38317cbe970f26a5fc2f8e320) )
ROM_LOAD16_BYTE( "epr-11309.ic29", 0x00001, 0x20000, CRC(c887f620) SHA1(644c47cc2cf75cbe489ea084c13c59d94631e83f) )
ROM_LOAD16_BYTE( "epr-11310.ic21", 0x040000, 0x20000, CRC(5d9fa02c) SHA1(0ca71e35cf9740e38a52960f7d1ef96e7e1dda94) )
ROM_LOAD16_BYTE( "epr-11311.ic30", 0x040001, 0x20000, CRC(483de21b) SHA1(871f0e856dcc81dcef1d9846261b3c011fa26dde) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-11314.ic154", 0x00000, 0x10000, CRC(d4f954a9) SHA1(93ee8cf8fcf4e1d0dd58329bba9b594431193449) )
ROM_LOAD( "epr-11315.ic153", 0x10000, 0x10000, CRC(35813088) SHA1(ea1ec982d1509efb26e7b6a150825a6a905efed9) )
ROM_LOAD( "epr-11316.ic152", 0x20000, 0x10000, CRC(84290dff) SHA1(c13fb6ef12a991f79a95072f953a02b5c992aa2d) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-11323.ic90", 0x000000, 0x20000, CRC(27e40735) SHA1(284ddb88efe741fb78199ea619c9b230ee689803) )
ROM_LOAD32_BYTE( "epr-11322.ic94", 0x000001, 0x20000, CRC(10364d74) SHA1(393b19a972b5d8817ffd438f13ded73cd58ebe56) )
ROM_LOAD32_BYTE( "epr-11321.ic98", 0x000002, 0x20000, CRC(8e738f58) SHA1(9f2dceebf01e582cf60f072ae411000d8503894b) )
ROM_LOAD32_BYTE( "epr-11320.ic102", 0x000003, 0x20000, CRC(a95c76b8) SHA1(cda62f3c25b9414a523c2fc5d109031ed560069e) )
ROM_LOAD32_BYTE( "epr-11327.ic91", 0x080000, 0x20000, CRC(deae90f1) SHA1(c73c23bab949041242302cec13d653dcc71bb944) )
ROM_LOAD32_BYTE( "epr-11326.ic95", 0x080001, 0x20000, CRC(29198403) SHA1(3ecf315a0e6b3ed5005f8bdcb2e2a884c8b176c7) )
ROM_LOAD32_BYTE( "epr-11325.ic99", 0x080002, 0x20000, CRC(b9e98ae9) SHA1(c4932e2590b10d54fa8ded94593dc4203fccc60d) )
ROM_LOAD32_BYTE( "epr-11324.ic103", 0x080003, 0x20000, CRC(9742b552) SHA1(922032264d469e943dfbcaaf57464efc638fcf73) )
ROM_LOAD32_BYTE( "epr-11331.ic92", 0x100000, 0x20000, CRC(3a2c042e) SHA1(c296ff222d156d3bdcb42bef321831f502830fd6) )
ROM_LOAD32_BYTE( "epr-11330.ic96", 0x100001, 0x20000, CRC(aa7c70c5) SHA1(b6fea17392b7821b8b3bba78002f9c1604f09edc) )
ROM_LOAD32_BYTE( "epr-11329.ic100", 0x100002, 0x20000, CRC(31b20257) SHA1(7ce10a94bce67b2d15d7b576b0f7d47389dc8948) )
ROM_LOAD32_BYTE( "epr-11328.ic104", 0x100003, 0x20000, CRC(da39e89c) SHA1(526549ce9112754c82743552eeebec63fe7ad968) )
ROM_LOAD32_BYTE( "epr-11335.ic93", 0x180000, 0x20000, CRC(f19b3e86) SHA1(40e8ba10cd5020782b82279974d13330a9c015e5) )
ROM_LOAD32_BYTE( "epr-11334.ic97", 0x180001, 0x20000, CRC(348f91c7) SHA1(03da6a4fee1fdea76058be4bc5ffcde7a79e5948) )
ROM_LOAD32_BYTE( "epr-11333.ic101", 0x180002, 0x20000, CRC(05a2333f) SHA1(70f213945fa7fe056fe17a02558638e87f2c001e) )
ROM_LOAD32_BYTE( "epr-11332.ic105", 0x180003, 0x20000, CRC(dc089ec6) SHA1(d72390c45138a507e79af112addbc015560fc248) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data
ROM_LOAD( "epr-11313.ic29", 0x00000, 0x10000, CRC(6a56c4c3) SHA1(c1b8023cb2ba4e96be052031c24b6ae424225c71) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-11312.ic17", 0x00000, 0x10000, CRC(3b974ed2) SHA1(cf18a2d0f01643c747a884bf00e5b7037ba2e64a) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-11317.ic11", 0x00000, 0x20000, CRC(d4e7ac1f) SHA1(ec5d6e4949938adf56e5613801ae56ff2c3dede5) )
ROM_LOAD( "epr-11318.ic12", 0x20000, 0x20000, CRC(70d3f02c) SHA1(391aac2bc5673e06150de27e19c7c6359da8ca82) )
ROM_LOAD( "epr-11319.ic13", 0x40000, 0x20000, CRC(50d9242e) SHA1(a106371bf680c3088ec61f07fc5c4ce467973c15) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Last Survivor, Sega X-board
// CPU: FD1094 (317-0083)
//
ROM_START( lastsurv )
ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12046.ic58", 0x000000, 0x20000, CRC(f94f3a1a) SHA1(f509cbccb1f36ce52ed3e44d4d7b31a047050700) )
ROM_LOAD16_BYTE( "epr-12047.ic63", 0x000001, 0x20000, CRC(1b45c116) SHA1(c46ad622a145baea52d918537fa43a2009ed0cca) )
ROM_LOAD16_BYTE( "epr-12048.ic57", 0x040000, 0x20000, CRC(648e38ca) SHA1(e5f7fd42f49dbbddd1a812a04d8b95c1a73e640b) )
ROM_LOAD16_BYTE( "epr-12049.ic62", 0x040001, 0x20000, CRC(6c5c4753) SHA1(6834542005bc8cad7918ae17d3764306d7f9a959) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0083.key", 0x0000, 0x2000, CRC(dca0b9cc) SHA1(77510804d36d486ffa1e0bb5b0a36d43adc63415) )
ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12050.ic20", 0x000000, 0x20000, CRC(985a0f36) SHA1(bd0a93aa16565c8338db0c67b031bfa409bce5a9) )
ROM_LOAD16_BYTE( "epr-12051.ic29", 0x000001, 0x20000, CRC(f967d5a8) SHA1(16d742da755b5b7c3c3a9f6b4baaf242e5e54441) )
ROM_LOAD16_BYTE( "epr-12052.ic21", 0x040000, 0x20000, CRC(9f7a424d) SHA1(b8c2d3aa08ba71f08f2c1f403edac16bf4334184) )
ROM_LOAD16_BYTE( "epr-12053.ic30", 0x040001, 0x20000, CRC(efcf30f6) SHA1(55cd42c78f117995a89844529386ae3d11c718c1) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12055.ic154", 0x00000, 0x10000, CRC(150014a4) SHA1(9fbab916ee903c541f61014e137ccecd071b5c3a) )
ROM_LOAD( "epr-12056.ic153", 0x10000, 0x10000, CRC(3cd4c306) SHA1(b0f178688870c67936a15383024c392072e3bc66) )
ROM_LOAD( "epr-12057.ic152", 0x20000, 0x10000, CRC(37e91770) SHA1(69e26f4d3c4ebfaf0225a9b1c60038595929ef05) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12064.ic90", 0x000000, 0x20000, CRC(84562a69) SHA1(815189a65065def213ef171fe40a44a455dfe75a) )
ROM_LOAD32_BYTE( "mpr-12063.ic94", 0x000001, 0x20000, CRC(d163727c) SHA1(50ed2b401e107a359874dad5d86eec788f5504eb) )
ROM_LOAD32_BYTE( "mpr-12062.ic98", 0x000002, 0x20000, CRC(6b57833b) SHA1(1d70894c81a4cd39f43067701a598d2c4fbffa58) )
ROM_LOAD32_BYTE( "mpr-12061.ic102", 0x000003, 0x20000, CRC(8907d5ba) SHA1(f4f9a19f3c27ef02314e59294a9658e2b20d52e0) )
ROM_LOAD32_BYTE( "epr-12068.ic91", 0x080000, 0x20000, CRC(8b12d342) SHA1(0356a413c2438e9c6c660454f03c0e24c6325f6b) )
ROM_LOAD32_BYTE( "epr-12067.ic95", 0x080001, 0x20000, CRC(1a1cdd89) SHA1(cd725aa450efa60ecc7d4111d0690cb441633935) )
ROM_LOAD32_BYTE( "epr-12066.ic99", 0x080002, 0x20000, CRC(a91d16b5) SHA1(501ddedf79130979c90c72882c2d96f5fd01adea) )
ROM_LOAD32_BYTE( "epr-12065.ic103", 0x080003, 0x20000, CRC(f4ce14c6) SHA1(42221ee03f363e94bf7b6de0bd89172525500412) )
ROM_LOAD32_BYTE( "epr-12072.ic92", 0x100000, 0x20000, CRC(222064c8) SHA1(a3914f8dabd8a3d99eaf4e03fa45e177c9f30666) )
ROM_LOAD32_BYTE( "epr-12071.ic96", 0x100001, 0x20000, CRC(a329b78c) SHA1(33b1f27dcc5ac36fdfd7374e1edda4fc31421126) )
ROM_LOAD32_BYTE( "epr-12070.ic100", 0x100002, 0x20000, CRC(97cc6706) SHA1(9160f100bd85f9c8b774e27a5d68e1c513111a61) )
ROM_LOAD32_BYTE( "epr-12069.ic104", 0x100003, 0x20000, CRC(2c3ba66e) SHA1(087fbf9d17f38b06b134088d89965c8d17dd5846) )
ROM_LOAD32_BYTE( "epr-12076.ic93", 0x180000, 0x20000, CRC(24f628e1) SHA1(abbc22282c7a9df203a8c589ddf08413d67392b1) )
ROM_LOAD32_BYTE( "epr-12075.ic97", 0x180001, 0x20000, CRC(69b3507f) SHA1(c447ceb38b473a3f65847471ef6de559e6ecce4a) )
ROM_LOAD32_BYTE( "epr-12074.ic101", 0x180002, 0x20000, CRC(ee6cbb73) SHA1(c68d825ded83dd06ba7b816622db3d57631b4fcc) )
ROM_LOAD32_BYTE( "epr-12073.ic105", 0x180003, 0x20000, CRC(167e6342) SHA1(2f87074d6821a974cbb137ca2bec28fafc0df46f) )
ROM_REGION( 0x20000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12054.ic17", 0x00000, 0x10000, CRC(e9b39216) SHA1(142764b40b4db69ff08d28338d1b12b1dd1ed0a0) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12058.ic11", 0x00000, 0x20000, CRC(4671cb46) SHA1(03ecaa4409a5b86a558313d4ccfb2334f79cff17) )
ROM_LOAD( "epr-12059.ic12", 0x20000, 0x20000, CRC(8c99aff4) SHA1(818418e4e92f601b09fcaa0979802a2c2c85b435) )
ROM_LOAD( "epr-12060.ic13", 0x40000, 0x20000, CRC(7ed382b3) SHA1(c87306d1b9edb8b4b97aee4af1317526750e2da2) )
ROM_END
ROM_START( lastsurvd )
ROM_REGION( 0x100000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12046.ic58", 0x000000, 0x20000, CRC(ddef5278) SHA1(0efb4c6280f8127406d55461983137bac8f2a2c8) )
ROM_LOAD16_BYTE( "bootleg_epr-12047.ic63", 0x000001, 0x20000, CRC(3981a891) SHA1(b25a37e2a3e55f1ee370ca99e406959fb1db13d6) )
ROM_LOAD16_BYTE( "epr-12048.ic57", 0x040000, 0x20000, CRC(648e38ca) SHA1(e5f7fd42f49dbbddd1a812a04d8b95c1a73e640b) )
ROM_LOAD16_BYTE( "epr-12049.ic62", 0x040001, 0x20000, CRC(6c5c4753) SHA1(6834542005bc8cad7918ae17d3764306d7f9a959) )
ROM_REGION( 0x100000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12050.ic20", 0x000000, 0x20000, CRC(985a0f36) SHA1(bd0a93aa16565c8338db0c67b031bfa409bce5a9) )
ROM_LOAD16_BYTE( "epr-12051.ic29", 0x000001, 0x20000, CRC(f967d5a8) SHA1(16d742da755b5b7c3c3a9f6b4baaf242e5e54441) )
ROM_LOAD16_BYTE( "epr-12052.ic21", 0x040000, 0x20000, CRC(9f7a424d) SHA1(b8c2d3aa08ba71f08f2c1f403edac16bf4334184) )
ROM_LOAD16_BYTE( "epr-12053.ic30", 0x040001, 0x20000, CRC(efcf30f6) SHA1(55cd42c78f117995a89844529386ae3d11c718c1) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12055.ic154", 0x00000, 0x10000, CRC(150014a4) SHA1(9fbab916ee903c541f61014e137ccecd071b5c3a) )
ROM_LOAD( "epr-12056.ic153", 0x10000, 0x10000, CRC(3cd4c306) SHA1(b0f178688870c67936a15383024c392072e3bc66) )
ROM_LOAD( "epr-12057.ic152", 0x20000, 0x10000, CRC(37e91770) SHA1(69e26f4d3c4ebfaf0225a9b1c60038595929ef05) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12064.ic90", 0x000000, 0x20000, CRC(84562a69) SHA1(815189a65065def213ef171fe40a44a455dfe75a) )
ROM_LOAD32_BYTE( "mpr-12063.ic94", 0x000001, 0x20000, CRC(d163727c) SHA1(50ed2b401e107a359874dad5d86eec788f5504eb) )
ROM_LOAD32_BYTE( "mpr-12062.ic98", 0x000002, 0x20000, CRC(6b57833b) SHA1(1d70894c81a4cd39f43067701a598d2c4fbffa58) )
ROM_LOAD32_BYTE( "mpr-12061.ic102", 0x000003, 0x20000, CRC(8907d5ba) SHA1(f4f9a19f3c27ef02314e59294a9658e2b20d52e0) )
ROM_LOAD32_BYTE( "epr-12068.ic91", 0x080000, 0x20000, CRC(8b12d342) SHA1(0356a413c2438e9c6c660454f03c0e24c6325f6b) )
ROM_LOAD32_BYTE( "epr-12067.ic95", 0x080001, 0x20000, CRC(1a1cdd89) SHA1(cd725aa450efa60ecc7d4111d0690cb441633935) )
ROM_LOAD32_BYTE( "epr-12066.ic99", 0x080002, 0x20000, CRC(a91d16b5) SHA1(501ddedf79130979c90c72882c2d96f5fd01adea) )
ROM_LOAD32_BYTE( "epr-12065.ic103", 0x080003, 0x20000, CRC(f4ce14c6) SHA1(42221ee03f363e94bf7b6de0bd89172525500412) )
ROM_LOAD32_BYTE( "epr-12072.ic92", 0x100000, 0x20000, CRC(222064c8) SHA1(a3914f8dabd8a3d99eaf4e03fa45e177c9f30666) )
ROM_LOAD32_BYTE( "epr-12071.ic96", 0x100001, 0x20000, CRC(a329b78c) SHA1(33b1f27dcc5ac36fdfd7374e1edda4fc31421126) )
ROM_LOAD32_BYTE( "epr-12070.ic100", 0x100002, 0x20000, CRC(97cc6706) SHA1(9160f100bd85f9c8b774e27a5d68e1c513111a61) )
ROM_LOAD32_BYTE( "epr-12069.ic104", 0x100003, 0x20000, CRC(2c3ba66e) SHA1(087fbf9d17f38b06b134088d89965c8d17dd5846) )
ROM_LOAD32_BYTE( "epr-12076.ic93", 0x180000, 0x20000, CRC(24f628e1) SHA1(abbc22282c7a9df203a8c589ddf08413d67392b1) )
ROM_LOAD32_BYTE( "epr-12075.ic97", 0x180001, 0x20000, CRC(69b3507f) SHA1(c447ceb38b473a3f65847471ef6de559e6ecce4a) )
ROM_LOAD32_BYTE( "epr-12074.ic101", 0x180002, 0x20000, CRC(ee6cbb73) SHA1(c68d825ded83dd06ba7b816622db3d57631b4fcc) )
ROM_LOAD32_BYTE( "epr-12073.ic105", 0x180003, 0x20000, CRC(167e6342) SHA1(2f87074d6821a974cbb137ca2bec28fafc0df46f) )
ROM_REGION( 0x20000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // Road Data
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12054.ic17", 0x00000, 0x10000, CRC(e9b39216) SHA1(142764b40b4db69ff08d28338d1b12b1dd1ed0a0) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12058.ic11", 0x00000, 0x20000, CRC(4671cb46) SHA1(03ecaa4409a5b86a558313d4ccfb2334f79cff17) )
ROM_LOAD( "epr-12059.ic12", 0x20000, 0x20000, CRC(8c99aff4) SHA1(818418e4e92f601b09fcaa0979802a2c2c85b435) )
ROM_LOAD( "epr-12060.ic13", 0x40000, 0x20000, CRC(7ed382b3) SHA1(c87306d1b9edb8b4b97aee4af1317526750e2da2) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Racing Hero, Sega X-board
// CPU: FD1094 (317-0144)
//
ROM_START( rachero )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13129.ic58", 0x00000, 0x20000,CRC(ad9f32e7) SHA1(dbcb3436782bee88dcac05d4f59c97f170a7387d) )
ROM_LOAD16_BYTE( "epr-13130.ic63", 0x00001, 0x20000,CRC(6022777b) SHA1(965c76565d740be3355c4b403a1629cffb9fcd78) )
ROM_LOAD16_BYTE( "epr-12855.ic57", 0x40000, 0x20000,CRC(cecf1e73) SHA1(3f8631379f32dbfda7720ef345276f9be23ada06) )
ROM_LOAD16_BYTE( "epr-12856.ic62", 0x40001, 0x20000,CRC(da900ebb) SHA1(595ed65248185ddf8666b3f30ad6329162116448) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0144.key", 0x0000, 0x2000, CRC(8740bbff) SHA1(de96e606c04a09258b966532fb01a6b4d4db86a6) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12857.ic20", 0x00000, 0x20000, CRC(8a2328cc) SHA1(c34498428ddfb3eeb986f4153a6165a685d8fc8a) )
ROM_LOAD16_BYTE( "epr-12858.ic29", 0x00001, 0x20000, CRC(38a248b7) SHA1(a17672123665403c1c56fedab6c8abf44b1131f9) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12879.ic154", 0x00000, 0x10000, CRC(c1a9de7a) SHA1(2425456a9d4ba92e1f2da6c2f164a6d5a5dee7c7) )
ROM_LOAD( "epr-12880.ic153", 0x10000, 0x10000, CRC(27ff04a5) SHA1(b554a6e060f4803100be8efa52977b503eb0f31d) )
ROM_LOAD( "epr-12881.ic152", 0x20000, 0x10000, CRC(72f14491) SHA1(b7a6cbd08470a5edda77cdd0337abd502c4905fd) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12872.ic90", 0x000000, 0x20000, CRC(68d56139) SHA1(b5f32edbda10c31d52f90defea2bae226676069f) )
ROM_LOAD32_BYTE( "epr-12873.ic94", 0x000001, 0x20000, CRC(3d3ec450) SHA1(ac96ad8c7b365478bd1e5826a073e242f1208247) )
ROM_LOAD32_BYTE( "epr-12874.ic98", 0x000002, 0x20000, CRC(7d6bde23) SHA1(88b12ec6386cdad60b0028b72033a0037a0cdbdb) )
ROM_LOAD32_BYTE( "epr-12875.ic102", 0x000003, 0x20000, CRC(e33092bf) SHA1(31e211e25adac0a98befb459093f23c905fbc1e6) )
ROM_LOAD32_BYTE( "epr-12868.ic91", 0x080000, 0x20000, CRC(96289583) SHA1(4d37e67860bc0e6ef69f0a0775c28f6f2fd6875e) )
ROM_LOAD32_BYTE( "epr-12869.ic95", 0x080001, 0x20000, CRC(2ef0de02) SHA1(11ee3d77df2cddd3156da52e50565505f95f4cd4) )
ROM_LOAD32_BYTE( "epr-12870.ic99", 0x080002, 0x20000, CRC(c76630e1) SHA1(7b76e4819990e147639d6b930b17b6fa10df191c) )
ROM_LOAD32_BYTE( "epr-12871.ic103", 0x080003, 0x20000, CRC(23401b1a) SHA1(eaf465ffda84bdb83cc85daf781275bada396aab) )
ROM_LOAD32_BYTE( "epr-12864.ic92", 0x100000, 0x20000, CRC(77d6cff4) SHA1(1e625204801d03369311844efb26d22216253ac4) )
ROM_LOAD32_BYTE( "epr-12865.ic96", 0x100001, 0x20000, CRC(1e7e685b) SHA1(532fe361357383aa9dada833cbe31716c58001e5) )
ROM_LOAD32_BYTE( "epr-12866.ic100", 0x100002, 0x20000, CRC(fdf31329) SHA1(9c229a0f9d8b8114acfe4f17b45a9b8640560b3e) )
ROM_LOAD32_BYTE( "epr-12867.ic104", 0x100003, 0x20000, CRC(b25e37fd) SHA1(fef5bfe4690b3203b83fd565d883b2c63f439633) )
ROM_LOAD32_BYTE( "epr-12860.ic93", 0x180000, 0x20000, CRC(86b64119) SHA1(d39aedad0f05e500e33af888126bd2fc22539141) )
ROM_LOAD32_BYTE( "epr-12861.ic97", 0x180001, 0x20000, CRC(bccff19b) SHA1(32c3f7802a12be02a114b78cd898c46fcb1c0a61) )
ROM_LOAD32_BYTE( "epr-12862.ic101", 0x180002, 0x20000, CRC(7d4c3b05) SHA1(4e25a077b403549c681c5047912d0e28f4c07720) )
ROM_LOAD32_BYTE( "epr-12863.ic105", 0x180003, 0x20000, CRC(85095053) SHA1(f93194ecc0300956280cc0515b3e3ba2c9f71364) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12859.ic17", 0x00000, 0x10000, CRC(d57881da) SHA1(75b7f331ea8c2e33d6236e0c8fc8dabe5eef8160) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12876.ic11", 0x00000, 0x20000, CRC(f72a34a0) SHA1(28f7d077c24352557da3a91a7e49b0c5b79f2a2e) )
ROM_LOAD( "epr-12877.ic12", 0x20000, 0x20000, CRC(18c1b6d2) SHA1(860cbb96999ab76c40ce96996bba70c42d845abc) )
ROM_LOAD( "epr-12878.ic13", 0x40000, 0x20000, CRC(7c212c15) SHA1(360b332d2fb32d88949ff8b357a863ffaaca39c2) )
ROM_END
ROM_START( racherod )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-13129.ic58", 0x00000, 0x20000, CRC(82ee7312) SHA1(4d011529b538885bbc3bb1cb23048b785d3be318) )
ROM_LOAD16_BYTE( "bootleg_epr-13130.ic63", 0x00001, 0x20000, CRC(53fb8649) SHA1(8b66d6e2018f92c7c992944ed5d4a685d9f13a6d) )
ROM_LOAD16_BYTE( "epr-12855.ic57", 0x40000, 0x20000,CRC(cecf1e73) SHA1(3f8631379f32dbfda7720ef345276f9be23ada06) )
ROM_LOAD16_BYTE( "epr-12856.ic62", 0x40001, 0x20000,CRC(da900ebb) SHA1(595ed65248185ddf8666b3f30ad6329162116448) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12857.ic20", 0x00000, 0x20000, CRC(8a2328cc) SHA1(c34498428ddfb3eeb986f4153a6165a685d8fc8a) )
ROM_LOAD16_BYTE( "epr-12858.ic29", 0x00001, 0x20000, CRC(38a248b7) SHA1(a17672123665403c1c56fedab6c8abf44b1131f9) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12879.ic154", 0x00000, 0x10000, CRC(c1a9de7a) SHA1(2425456a9d4ba92e1f2da6c2f164a6d5a5dee7c7) )
ROM_LOAD( "epr-12880.ic153", 0x10000, 0x10000, CRC(27ff04a5) SHA1(b554a6e060f4803100be8efa52977b503eb0f31d) )
ROM_LOAD( "epr-12881.ic152", 0x20000, 0x10000, CRC(72f14491) SHA1(b7a6cbd08470a5edda77cdd0337abd502c4905fd) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-12872.ic90", 0x000000, 0x20000, CRC(68d56139) SHA1(b5f32edbda10c31d52f90defea2bae226676069f) )
ROM_LOAD32_BYTE( "epr-12873.ic94", 0x000001, 0x20000, CRC(3d3ec450) SHA1(ac96ad8c7b365478bd1e5826a073e242f1208247) )
ROM_LOAD32_BYTE( "epr-12874.ic98", 0x000002, 0x20000, CRC(7d6bde23) SHA1(88b12ec6386cdad60b0028b72033a0037a0cdbdb) )
ROM_LOAD32_BYTE( "epr-12875.ic102", 0x000003, 0x20000, CRC(e33092bf) SHA1(31e211e25adac0a98befb459093f23c905fbc1e6) )
ROM_LOAD32_BYTE( "epr-12868.ic91", 0x080000, 0x20000, CRC(96289583) SHA1(4d37e67860bc0e6ef69f0a0775c28f6f2fd6875e) )
ROM_LOAD32_BYTE( "epr-12869.ic95", 0x080001, 0x20000, CRC(2ef0de02) SHA1(11ee3d77df2cddd3156da52e50565505f95f4cd4) )
ROM_LOAD32_BYTE( "epr-12870.ic99", 0x080002, 0x20000, CRC(c76630e1) SHA1(7b76e4819990e147639d6b930b17b6fa10df191c) )
ROM_LOAD32_BYTE( "epr-12871.ic103", 0x080003, 0x20000, CRC(23401b1a) SHA1(eaf465ffda84bdb83cc85daf781275bada396aab) )
ROM_LOAD32_BYTE( "epr-12864.ic92", 0x100000, 0x20000, CRC(77d6cff4) SHA1(1e625204801d03369311844efb26d22216253ac4) )
ROM_LOAD32_BYTE( "epr-12865.ic96", 0x100001, 0x20000, CRC(1e7e685b) SHA1(532fe361357383aa9dada833cbe31716c58001e5) )
ROM_LOAD32_BYTE( "epr-12866.ic100", 0x100002, 0x20000, CRC(fdf31329) SHA1(9c229a0f9d8b8114acfe4f17b45a9b8640560b3e) )
ROM_LOAD32_BYTE( "epr-12867.ic104", 0x100003, 0x20000, CRC(b25e37fd) SHA1(fef5bfe4690b3203b83fd565d883b2c63f439633) )
ROM_LOAD32_BYTE( "epr-12860.ic93", 0x180000, 0x20000, CRC(86b64119) SHA1(d39aedad0f05e500e33af888126bd2fc22539141) )
ROM_LOAD32_BYTE( "epr-12861.ic97", 0x180001, 0x20000, CRC(bccff19b) SHA1(32c3f7802a12be02a114b78cd898c46fcb1c0a61) )
ROM_LOAD32_BYTE( "epr-12862.ic101", 0x180002, 0x20000, CRC(7d4c3b05) SHA1(4e25a077b403549c681c5047912d0e28f4c07720) )
ROM_LOAD32_BYTE( "epr-12863.ic105", 0x180003, 0x20000, CRC(85095053) SHA1(f93194ecc0300956280cc0515b3e3ba2c9f71364) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
// none
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12859.ic17", 0x00000, 0x10000, CRC(d57881da) SHA1(75b7f331ea8c2e33d6236e0c8fc8dabe5eef8160) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-12876.ic11", 0x00000, 0x20000, CRC(f72a34a0) SHA1(28f7d077c24352557da3a91a7e49b0c5b79f2a2e) )
ROM_LOAD( "epr-12877.ic12", 0x20000, 0x20000, CRC(18c1b6d2) SHA1(860cbb96999ab76c40ce96996bba70c42d845abc) )
ROM_LOAD( "epr-12878.ic13", 0x40000, 0x20000, CRC(7c212c15) SHA1(360b332d2fb32d88949ff8b357a863ffaaca39c2) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0126a)
// This set is coming from a twin.
//
// This set has an extra link board (834-7112) or 171-5729-01 under the main board with a Z80
//
// Xtal is 16.000 Mhz.
//
// It has also one eprom (Epr 12587.14) two pal 16L8 (315-5336 and 315-5337) and two
// fujitsu IC MB89372P and MB8421-12LP
//
// Main Board : (834-8180-02)
//
// epr-12576A.20 (68000)
// epr-12577A.29 (68000)
// epr-12563B.58 FD1094 317-0126A
// epr-12564B.63 FD1094 317-0126A
// epr-12609.93
// epr-12610.97
// epr-12611.101
// epr-12612.105
// mpr-12417.92
// mpr-12418.96
// mpr-12419.100
// mpr-12420.104
// mpr-12421.91
// mpr-12422.95
// mpr-12423.99
// mpr-12424.103
// mpr-12425.90
// mpr-12426.94
// mpr-12427.98
// mpr-12428.102
// epr-12429.154
// epr-12430.153
// epr-12431.152
// epr-12436.17
// mpr-12437.11
// mpr-12438.12
// mpr-12439.13
//
// Link Board :
//
// Ep12587.14
//
ROM_START( smgp )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12563b.58", 0x00000, 0x20000, CRC(baf1f333) SHA1(f91a7a311237b9940a44b815716d4226a7ae1e8b) )
ROM_LOAD16_BYTE( "epr-12564b.63", 0x00001, 0x20000, CRC(b5191af0) SHA1(d6fb19552e4816eefe751907ec55a2e07ad24879) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0126a.key", 0x0000, 0x2000, CRC(2abc1982) SHA1(cc4c36e6ba52431df17c6e36ba08d3a89be7b7e7) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) )
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgpd )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12563b.58", 0x00000, 0x20000, CRC(af30e3cd) SHA1(b05a4f8be701fada6d55a042079f4b2067b52cb2) )
ROM_LOAD16_BYTE( "bootleg_epr-12564b.63", 0x00001, 0x20000, CRC(eb7cadfe) SHA1(58c2d05cd21795c1d5d603179decc3b861ef438f) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) )
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0126a)
//
// this set contained only prg roms
ROM_START( smgp6 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12563a.58", 0x00000, 0x20000, CRC(2e64b10e) SHA1(2be1ffb3120e4af6a61880e2a2602db07a73f373) )
ROM_LOAD16_BYTE( "epr-12564a.63", 0x00001, 0x20000, CRC(5baba3e7) SHA1(37194d5a4d3ee48a276f6aeb35b2f20a7661caa2) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0126a.key", 0x0000, 0x2000, CRC(2abc1982) SHA1(cc4c36e6ba52431df17c6e36ba08d3a89be7b7e7) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgp6d )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12563a.58", 0x00000, 0x20000, CRC(3ba5a1f0) SHA1(52ac3568f35a68afb458fe8d1f4c20029052100f) )
ROM_LOAD16_BYTE( "bootleg_epr-12564a.63", 0x00001, 0x20000, CRC(05ce14e9) SHA1(abc65f85b9d8710ef88c336df6584c194364dce5) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12577a.29", 0x00001, 0x20000, CRC(abf9a50b) SHA1(e367b305cd45900aae4849af4904543f05456dc6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0126)
// This set is coming from a deluxe.
//
// SEGA Monaco G.P. by SEGA 1989
//
// This set is coming from a sitdown "air drive" version.
//
// This set has an extra sound board (837-7000) under the main board with a Z80
// and a few eproms, some of those eproms are already on the main board !
//
// It has also an "air drive" board with a Z80 and one eprom.
//
// Main Board : (834-7016-05)
//
// epr-12576.20 (68000)
// epr-12577.29 (68000)
// epr-12563.58 FD1094 317-0126
// epr-12564.63 FD1094 317-0126
// epr-12413.93
// epr-12414.97
// epr-12415.101
// epr-12416.105
// mpr-12417.92
// mpr-12418.96
// mpr-12419.100
// mpr-12420.104
// mpr-12421.91
// mpr-12422.95
// mpr-12423.99
// mpr-12424.103
// mpr-12425.90
// mpr-12426.94
// mpr-12427.98
// mpr-12428.102
// epr-12429.154
// epr-12430.153
// epr-12431.152
// epr-12436.17
// mpr-12437.11
// mpr-12438.12
// IC 13 is not used !
//
// Sound Board :
//
// epr-12535.8
// mpr-12437.20
// mpr-12438.21
// mpr-12439.22
//
// Air Drive Board :
//
// Ep12505.8
//
ROM_START( smgp5 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12563.58", 0x00000, 0x20000, CRC(6d7325ae) SHA1(bf88ceddc49dab5b439080d5bf0e7e084a79546c) )
ROM_LOAD16_BYTE( "epr-12564.63", 0x00001, 0x20000, CRC(adfbf921) SHA1(f3321e03dc37b14db065b85d63e321810e4ea797) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0126.key", 0x0000, 0x2000, CRC(4d917996) SHA1(17232c0e35d439a12db3d966064cf00104088903) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576.20", 0x00000, 0x20000, CRC(23266b26) SHA1(240b9bf198fd2975851e769766566ec4e8379f87) )
ROM_LOAD16_BYTE( "epr-12577.29", 0x00001, 0x20000, CRC(d5b53211) SHA1(b11f5c5094eb7ea9578f15489b00d8bbac1edee6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) )
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) )
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) )
ROM_END
ROM_START( smgp5d )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12563.58", 0x00000, 0x20000, CRC(6c7f0549) SHA1(a9beed12e204acc5bf45dded9b3d4d1643b83a94) )
ROM_LOAD16_BYTE( "bootleg_epr-12564.63", 0x00001, 0x20000, CRC(c2b3a219) SHA1(d9299d2a0a93404f18148e9d2bd2d57cd043b67b) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12576.20", 0x00000, 0x20000, CRC(23266b26) SHA1(240b9bf198fd2975851e769766566ec4e8379f87) )
ROM_LOAD16_BYTE( "epr-12577.29", 0x00001, 0x20000, CRC(d5b53211) SHA1(b11f5c5094eb7ea9578f15489b00d8bbac1edee6) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) )
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) )
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) )
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0125a)
//
ROM_START( smgpu )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12561c.58", 0x00000, 0x20000, CRC(a5b0f3fe) SHA1(17103e56f822fdb52e72f597c01415ed375aa102) )
ROM_LOAD16_BYTE( "epr-12562c.63", 0x00001, 0x20000, CRC(799e55f4) SHA1(2e02cdc63bda47b087c81021018287cfa961c083) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgpud )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12561c.58", 0x00000, 0x20000, CRC(7053e379) SHA1(742e80e2ec2dedae1d6ba64fc563707790a30606) )
ROM_LOAD16_BYTE( "bootleg_epr-12562c.63", 0x00001, 0x20000, CRC(db848e75) SHA1(0750c981a70a2cc5dfae6ce27598865847ff3156) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0125a)
//
// very first US version with demo sound on by default
ROM_START( smgpu1 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12561b.58", 0x00000, 0x20000, CRC(80a32655) SHA1(fe1ffa8af9f1ca175ba90b24a0853329b08d19af) )
ROM_LOAD16_BYTE( "epr-12562b.63", 0x00001, 0x20000, CRC(d525f2a8) SHA1(f3241e11485c7428cd9f081ec6768fda39ae3250) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgpu1d )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12561.58", 0x00000, 0x20000, CRC(554036d2) SHA1(7f82c8e96342f5b01209e0fcf56bafbb06d06458) )
ROM_LOAD16_BYTE( "bootleg_epr-12562.63", 0x00001, 0x20000, CRC(773f2929) SHA1(aff10b08ed4cf1505228d8f2a785e71eeaea4089) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0125a)
// This set is coming from a twin.
//
// ROMs:
// IC58 : epr-12561A.58 (27C010 EPROM)
// IC57 : not populated
// IC63 : epr-12562A.63 (27C010 EPROM)
// IC62 : not populated
//
// IC11 : mpr-12437.11 (831000 MASKROM)
// IC12 : mpr-12438.12 (831000 MASKROM)
// IC13 : mpr-12439.13 (831000 MASKROM)
// IC17 : epr-12436.17 (27C512 EPROM)
//
// IC21 : not populated
// IC20 : epr-12574A.20 (27C010 EPROM)
// IC30 : not populated
// IC29 : epr-12575A.29 (27C010 EPROM)
//
// IC40 : not populated
//
// IC90 : mpr-12425.90 (831000 MASKROM)
// IC91 : mpr-12421.91 (831000 MASKROM)
// IC92 : mpr-12417.92 (831000 MASKROM)
// IC93 : epr-12609.93 (27C010 EPROM)
//
// IC94 : mpr-12426.94 (831000 MASKROM)
// IC95 : mpr-12422.95 (831000 MASKROM)
// IC96 : mpr-12418.96 (831000 MASKROM)
// IC97 : epr-12610.97 (27C010 EPROM)
//
// IC98 : mpr-12427.98 (831000 MASKROM)
// IC99 : mpr-12423.99 (831000 MASKROM)
// IC100: mpr-12419.100 (831000 MASKROM)
// IC101: epr-12611.101 (27C010 EPROM)
//
// IC102: mpr-12428.102 (831000 MASKROM)
// IC103: mpr-12424.103 (831000 MASKROM)
// IC104: mpr-12420.104 (831000 MASKROM)
// IC105: epr-12612.105 (27C010 EPROM)
//
// IC154: epr-12429.154 (27C512 EPROM)
// IC153: epr-12430.153 (27C512 EPROM)
// IC152: epr-12431.152 (27C512 EPROM)
//
ROM_START( smgpu2 )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12561a.58", 0x00000, 0x20000, CRC(e505eb89) SHA1(bfb9a7a8b13ae454a92349e57215562477cd2cd2) )
ROM_LOAD16_BYTE( "epr-12562a.63", 0x00001, 0x20000, CRC(c3af4215) SHA1(c46829e08d5492515de5d3269b0e899705d0b108) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) )
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgpu2d )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12561a.58", 0x00000, 0x20000, CRC(30e6fb0e) SHA1(7cb079f7a1160e08a01ceebbcb528fb19bd3e5fb) )
ROM_LOAD16_BYTE( "bootleg_epr-12562a.63", 0x00001, 0x20000, CRC(61b59994) SHA1(e8bbac96321f85a170e4cddbe0c66bc7e21024f0) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12574a.20", 0x00000, 0x20000, CRC(f8b5c38b) SHA1(0184d5a1b71fb42d33dbaaad99d2c0fbc5750e7e) )
ROM_LOAD16_BYTE( "epr-12575a.29", 0x00001, 0x20000, CRC(248b1d17) SHA1(22f1e0d0d698abdf0cb1954f1f6382432a12c186) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12609.93", 0x180000, 0x20000, CRC(a867812f) SHA1(f8950bf794b6c2ec767ffff837d28917b636dbe7) ) //
ROM_LOAD32_BYTE( "epr-12610.97", 0x180001, 0x20000, CRC(53b99417) SHA1(ab72d35c88695c777d24c5557e5d3ea2d446e51b) ) //
ROM_LOAD32_BYTE( "epr-12611.101", 0x180002, 0x20000, CRC(bd5c6ab0) SHA1(7632dc4daa8eabe74769369856a8ba451e5bd420) ) // these differ from japan set
ROM_LOAD32_BYTE( "epr-12612.105", 0x180003, 0x20000, CRC(ac86e890) SHA1(7720c1c8df6de5de50254e97772c15161b796031) ) //
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) )
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0124a)
//
ROM_START( smgpj )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12432b.58", 0x00000, 0x20000, CRC(c1a29db1) SHA1(0122d366899f98f7a60b0c9bddeece7995cebf83) )
ROM_LOAD16_BYTE( "epr-12433b.63", 0x00001, 0x20000, CRC(97199eb1) SHA1(3baccf8159821d4b4d5caedf5eb691f07372be93) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0124a.key", 0x0000, 0x2000, CRC(022a8a16) SHA1(4fd80105cb85ccba77cf1e76a21d6e245d5d2e7d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
ROM_START( smgpjd )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-12432b.58", 0x00000, 0x20000, CRC(1c46c4de) SHA1(32711dfb8209317c6c2fc0fbb8f04b907123a4dc) )
ROM_LOAD16_BYTE( "bootleg_epr-12433b.63", 0x00001, 0x20000, CRC(ae8a4942) SHA1(53f52e6431353d611ac6a3520af053f955b79b37))
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
// Super Monaco GP, Sega X-board
// CPU: FD1094 (317-0124a)
//
ROM_START( smgpja )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-12432a.58", 0x00000, 0x20000, CRC(22517672) SHA1(db9ac40e83e9786bc9dad70f62c2080d3df694ee) )
ROM_LOAD16_BYTE( "epr-12433a.63", 0x00001, 0x20000, CRC(a46b5d13) SHA1(3a7de5cb6f3e6d726f0ea886a87125dedc6f849f) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0124a.key", 0x0000, 0x2000, CRC(022a8a16) SHA1(4fd80105cb85ccba77cf1e76a21d6e245d5d2e7d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-12441a.20", 0x00000, 0x20000, CRC(2c9599c1) SHA1(79206f38c2976bd9299ed37bf62ac26dd3fba801) )
ROM_LOAD16_BYTE( "epr-12442a.29", 0x00001, 0x20000, CRC(77a5ec16) SHA1(b8cf6a3f12689d89bbdd9fb39d1cb7d1a3c10602) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-12429.154", 0x00000, 0x10000, CRC(5851e614) SHA1(3dc97237ede2c6125e92ea6efc68a748d0ec69be) )
ROM_LOAD( "epr-12430.153", 0x10000, 0x10000, CRC(05e00134) SHA1(8baaa80815d5dabd38dc8600e357975b96d23b95) )
ROM_LOAD( "epr-12431.152", 0x20000, 0x10000, CRC(35572f4a) SHA1(d66456ecf7b59f81736fb873c553926b56bb3977))
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "mpr-12425.90", 0x000000, 0x20000, CRC(14bf2a15) SHA1(84db3ac09e4a8fe470ac051d8d5de1814b48bc72) )
ROM_LOAD32_BYTE( "mpr-12426.94", 0x000001, 0x20000, CRC(28b60dc0) SHA1(ad69d449434853445a076319a55a29014217a100) )
ROM_LOAD32_BYTE( "mpr-12427.98", 0x000002, 0x20000, CRC(0a367928) SHA1(bcb558b7c23906397e66a7f046b09eb5036c0888) )
ROM_LOAD32_BYTE( "mpr-12428.102", 0x000003, 0x20000, CRC(efa80ad5) SHA1(9bc7c3fb60cc076f29a0af487d58e5b48f1c4b06) )
ROM_LOAD32_BYTE( "mpr-12421.91", 0x080000, 0x20000, CRC(25f46140) SHA1(ea75e364cf52636d100158f79be627e36da8c327) )
ROM_LOAD32_BYTE( "mpr-12422.95", 0x080001, 0x20000, CRC(cb51c8f6) SHA1(5af56ae1916c3212b8d5b9e4bccbbe1916694f89) )
ROM_LOAD32_BYTE( "mpr-12423.99", 0x080002, 0x20000, CRC(0be9818e) SHA1(637a8201416e73d53f7e2502ea0a5277e43c167d) )
ROM_LOAD32_BYTE( "mpr-12424.103", 0x080003, 0x20000, CRC(0ce00dfc) SHA1(3b1990977ec7ad4c3bea66527707cff2cd8d5a98) )
ROM_LOAD32_BYTE( "mpr-12417.92", 0x100000, 0x20000, CRC(a806eabf) SHA1(1a61a2135d92b42ee131fd3240bc8a17a96696ab) )
ROM_LOAD32_BYTE( "mpr-12418.96", 0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
ROM_LOAD32_BYTE( "mpr-12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
ROM_LOAD32_BYTE( "mpr-12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
ROM_LOAD32_BYTE( "epr-12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
ROM_LOAD32_BYTE( "epr-12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
ROM_LOAD32_BYTE( "epr-12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
ROM_LOAD32_BYTE( "epr-12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-12436.17", 0x00000, 0x10000, CRC(16ec5f0a) SHA1(307b7388b5c36fd4bc2a61f7941db44858e03c5c) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "mpr-12437.11", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) )
ROM_LOAD( "mpr-12438.12", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) )
ROM_LOAD( "mpr-12439.13", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // not used in deluxe
ROM_REGION( 0x10000, "mainpcb:soundcpu2", 0 ) // z80 on extra sound board
ROM_LOAD( "epr-12535.8", 0x00000, 0x10000, CRC(80453597) SHA1(d3fee7bb4a8964f5cf1cdae80fc3dde06c947839) ) // taken from deluxe cabinet dump
ROM_REGION( 0x80000, "mainpcb:pcm2", ROMREGION_ERASEFF ) // Sega PCM sound data on extra sound board (same as on main board..)
ROM_LOAD( "mpr-12437.20", 0x00000, 0x20000, CRC(a1c7e712) SHA1(fa7fa8c39690ae5dab8b28af5aeed5ffae2cd6de) ) // taken from deluxe cabinet dump
ROM_LOAD( "mpr-12438.21", 0x20000, 0x20000, CRC(6573d46b) SHA1(c4a4a0ea35250eff28a5bfd5e9cd372f52fd1308) ) // "
ROM_LOAD( "mpr-12439.22", 0x40000, 0x20000, CRC(13bf6de5) SHA1(92228a05ec33d606491a1da98c4989f69cddbb49) ) // "
ROM_REGION( 0x10000, "mainpcb:commcpu", 0 ) // z80 on network board
ROM_LOAD( "epr-12587.14", 0x00000, 0x08000, CRC(2afe648b) SHA1(b5bf86f3acbcc23c136185110acecf2c971294fa) ) // taken from twin cabinet dump
ROM_REGION( 0x10000, "mainpcb:motorcpu", 0 ) // z80 on air board
ROM_LOAD( "epr-12505.8", 0x00000, 0x08000, CRC(5020788a) SHA1(ed6d1dfb8b6a62d17469e3d09a5b5b864c6b486c) ) // taken from deluxe cabinet dump
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// AB Cop (World), Sega X-board
// CPU: FD1094 (317-0169b)
//
ROM_START( abcop )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13568b.ic58", 0x00000, 0x20000, CRC(f88db35b) SHA1(7d85c1194a2aa08427333d2ffc2a8d4f7e1beff0) )
ROM_LOAD16_BYTE( "epr-13556b.ic63", 0x00001, 0x20000, CRC(337bf32e) SHA1(dafb9d9b3baf79ca76355278e8a14294f186790a) )
ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) )
ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0169b.key", 0x0000, 0x2000, CRC(058da36e) SHA1(ab3f68a90725063c68fc5d0f8dbece1f8940dc7d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) )
ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) )
ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) )
ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) )
ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) )
ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) )
ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) )
ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) )
ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) )
ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) )
ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) )
ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) )
ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) )
ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) )
ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) )
ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) )
ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) )
ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) )
ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) )
ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) )
ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) )
ROM_END
ROM_START( abcopd )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr13568b.ic58", 0x00000, 0x20000, CRC(3c367a01) SHA1(ddb37a399a67818c5b14c4fac1f25d0e660a7b0f) )
ROM_LOAD16_BYTE( "bootleg_epr13556b.ic63", 0x00001, 0x20000, CRC(1078246e) SHA1(3490f46c1f52d41f96fb449bdcee5fbec871aaca) )
ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) )
ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) )
ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) )
ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) )
ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) )
ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) )
ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) )
ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) )
ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) )
ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) )
ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) )
ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) )
ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) )
ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) )
ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) )
ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) )
ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) )
ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) )
ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) )
ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) )
ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) )
ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) )
ROM_END
//*************************************************************************************************************************
// AB Cop (Japan), Sega X-board
// CPU: FD1094 (317-0169b)
//
ROM_START( abcopj )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13557b.ic58", 0x00000, 0x20000, CRC(554e106a) SHA1(3166957ded67c82d4710bdd20eb88006e14c6a3e) )
ROM_LOAD16_BYTE( "epr-13556b.ic63", 0x00001, 0x20000, CRC(337bf32e) SHA1(dafb9d9b3baf79ca76355278e8a14294f186790a) )
ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) )
ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0169b.key", 0x0000, 0x2000, CRC(058da36e) SHA1(ab3f68a90725063c68fc5d0f8dbece1f8940dc7d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) )
ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) )
ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) )
ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) )
ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) )
ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) )
ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) )
ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) )
ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) )
ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) )
ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) )
ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) )
ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) )
ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) )
ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) )
ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) )
ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) )
ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) )
ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) )
ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) )
ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) )
ROM_END
ROM_START( abcopjd )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "bootleg_epr-13557b.ic58", 0x00000, 0x20000, CRC(91f5d930) SHA1(8e3a4645b64b71cafa43bba3fd167dea494d7748) )
ROM_LOAD16_BYTE( "bootleg_epr-13556b.ic63", 0x00001, 0x20000, CRC(1078246e) SHA1(3490f46c1f52d41f96fb449bdcee5fbec871aaca) )
ROM_LOAD16_BYTE( "epr-13559.ic57", 0x40000, 0x20000, CRC(4588bf19) SHA1(6a8b3d4450ac0bc41b46e6a4e1b44d82112fcd64) )
ROM_LOAD16_BYTE( "epr-13558.ic62", 0x40001, 0x20000, CRC(11259ed4) SHA1(e7de174a0bdb1d1111e5e419f1d501ab5be1d32d) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13566.ic20", 0x00000, 0x20000, CRC(22e52f32) SHA1(c67a4ccb88becc58dddcbfea0a1ac2017f7b2929) )
ROM_LOAD16_BYTE( "epr-13565.ic29", 0x00001, 0x20000, CRC(a21784bd) SHA1(b40ba0ef65bbfe514625253f6aeec14bf4bcf08c) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "opr-13553.ic154", 0x00000, 0x10000, CRC(8c418837) SHA1(e325db39fae768865e20d2cd1ee2b91a9b0165f5) )
ROM_LOAD( "opr-13554.ic153", 0x10000, 0x10000, CRC(4e3df9f0) SHA1(8b481c2cd25c58612ac8ac3ffb7eeae9ca247d2e) )
ROM_LOAD( "opr-13555.ic152", 0x20000, 0x10000, CRC(6c4a1d42) SHA1(6c37b045b21173f1e2f7bd19d01c00979b8107fb) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "opr-13552.ic90", 0x000000, 0x20000, CRC(cc2cf706) SHA1(ad39c22e652ebcd90ffb5e17ae35985645f93c71) )
ROM_LOAD32_BYTE( "opr-13551.ic94", 0x000001, 0x20000, CRC(d6f276c1) SHA1(9ec68157ea460e09ef4b69aa8ea17687dc47ea59) )
ROM_LOAD32_BYTE( "opr-13550.ic98", 0x000002, 0x20000, CRC(f16518dd) SHA1(a5f1785cd28f03069cb238ac92c6afb5a26cbd37) )
ROM_LOAD32_BYTE( "opr-13549.ic102", 0x000003, 0x20000, CRC(cba407a7) SHA1(e7684d3b40baa6d832b887fd85ad67fbad8aa7de) )
ROM_LOAD32_BYTE( "opr-13548.ic91", 0x080000, 0x20000, CRC(080fd805) SHA1(e729565815a3a37462cfee460b7392d2f08e96e5) )
ROM_LOAD32_BYTE( "opr-13547.ic95", 0x080001, 0x20000, CRC(42d4dd68) SHA1(6ae1f3585ebb20fd2908456d6fa41a893261277e) )
ROM_LOAD32_BYTE( "opr-13546.ic99", 0x080002, 0x20000, CRC(ca6fbf3d) SHA1(49c3516d87f1546fa7efe785fc5c064d90b1cb8e) )
ROM_LOAD32_BYTE( "opr-13545.ic103", 0x080003, 0x20000, CRC(c9e58dd2) SHA1(ace2e1630d8df2454183ffdbe26d8cb6d199e940) )
ROM_LOAD32_BYTE( "opr-13544.ic92", 0x100000, 0x20000, CRC(9c1436d9) SHA1(5156e1b5c7461f6dc0d449b86b6b72153b290a4c) )
ROM_LOAD32_BYTE( "opr-13543.ic96", 0x100001, 0x20000, CRC(2c1c8f0e) SHA1(19c9fd4272a3db18381f435ed6cd01f994c655e7) )
ROM_LOAD32_BYTE( "opr-13542.ic100", 0x100002, 0x20000, CRC(01fd52b8) SHA1(b4ab13c7b2b2ffcfdab37d8e4855d5ef8823f1cc) )
ROM_LOAD32_BYTE( "opr-13541.ic104", 0x100003, 0x20000, CRC(a45c547b) SHA1(d93aaa850d14a7699a1b0411e823088a9bce7553) )
ROM_LOAD32_BYTE( "opr-13540.ic93", 0x180000, 0x20000, CRC(84b42ab0) SHA1(d24ba7fe23463fc5813ef26e0395951559d6d162) )
ROM_LOAD32_BYTE( "opr-13539.ic97", 0x180001, 0x20000, CRC(cd6e524f) SHA1(e6df2552a84b2da95301486379c78679b0297634) )
ROM_LOAD32_BYTE( "opr-13538.ic101", 0x180002, 0x20000, CRC(bf9a4586) SHA1(6013dee83375d72d262c8c04c2e668afea2e216c) )
ROM_LOAD32_BYTE( "opr-13537.ic105", 0x180003, 0x20000, CRC(fa14ed3e) SHA1(d684496ade2517696a56c1423dd4686d283c133f) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // ground data
ROM_LOAD( "opr-13564.ic40", 0x00000, 0x10000, CRC(e70ba138) SHA1(85eb6618f408642227056d278f10dec8dcc5a80d) )
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13560.ic17", 0x00000, 0x10000, CRC(83050925) SHA1(118710e5789c7999bb7326df4d7bd207cbffdfd4) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "opr-13563.ic11", 0x00000, 0x20000, CRC(4083e74f) SHA1(e48c7ce0aa3406af0bbf79c169a8157693c97041) )
ROM_LOAD( "opr-13562.ic12", 0x20000, 0x20000, CRC(3cc3968f) SHA1(d25647f6a3fa939ba30e03e7334362ef0749b23a) )
ROM_LOAD( "opr-13561.ic13", 0x40000, 0x20000, CRC(80a7c02a) SHA1(7e8c1b9ba270d8657dbe90ed8be2e4b6463e5928) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// GP Rider (World), Sega X-board
// CPU: FD1094 (317-0163)
// Custom Chip 315-5304 (IC 127)
// IC BD Number: 834-7626-03 (roms are "MPR") / 834-7626-05 (roms are "EPR")
//
ROM_START( gpriders )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) )
ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
// Twin setup
ROM_START( gprider )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) )
ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13409.ic58", 0x00000, 0x20000, CRC(9abb81b6) SHA1(f6308f3ec99ee66677e86f6a915e4dff8557d25f) )
ROM_LOAD16_BYTE( "epr-13408.ic63", 0x00001, 0x20000, CRC(8e410e97) SHA1(2021d738064e57d175b59ba053d9ee35ed4516c8) )
ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0163.key", 0x0000, 0x2000, CRC(c1d4d207) SHA1(c35b0a49fb6a1e0e9a1c087f0ccd190ad5c2bb2c) )
ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
//*************************************************************************************************************************
// GP Rider (US), Sega X-board
// CPU: FD1094 (317-0162)
// Custom Chip 315-5304 (IC 127)
// IC BD Number: 834-7626-01 (roms are "MPR") / 834-7626-04 (roms are "EPR")
//
ROM_START( gpriderus )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) )
ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
// twin setup
ROM_START( gprideru )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) )
ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) )
ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) )
ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0162.key", 0x0000, 0x2000, CRC(8067de53) SHA1(e8cd1dfbad94856c6bd51569557667e72f0a5dd4) )
ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
//*************************************************************************************************************************
// GP Rider (Japan), Sega X-board
// CPU: FD1094 (317-0161)
// Custom Chip 315-5304 (IC 127)
// IC BD Number: 834-7626-01 (roms are "MPR") / 834-7626-04 (roms are "EPR")
//
ROM_START( gpriderjs )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) )
ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
// twin setup
ROM_START( gpriderj )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) )
ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) )
ROM_REGION( 0x2000, "mainpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) )
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_REGION( 0x80000, "subpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13387.ic58", 0x00000, 0x20000, CRC(a1e8b2c5) SHA1(22b70a9074263af808bb9dffee29cbcff7e304e3) )
ROM_LOAD16_BYTE( "epr-13386.ic63", 0x00001, 0x20000, CRC(d8be9e66) SHA1(d81c03b08fd6b971554b94e0adac131a1dcf3248) )
ROM_REGION( 0x2000, "subpcb:maincpu:key", 0 ) // decryption key
ROM_LOAD( "317-0161.key", 0x0000, 0x2000, CRC(e38ddc16) SHA1(d1f7f261320cbc605b4f7e5a9c28f49af5471d87) )
ROM_REGION( 0x80000, "subpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13395.ic20", 0x00000, 0x20000,CRC(d6ccfac7) SHA1(9287ab08600163a0d9bd33618c629f99391316bd) )
ROM_LOAD16_BYTE( "epr-13394.ic29", 0x00001, 0x20000,CRC(914a55ec) SHA1(84fe1df12478990418b46b6800425e5599e9eff9) )
ROM_LOAD16_BYTE( "epr-13393.ic21", 0x40000, 0x20000,CRC(08d023cc) SHA1(d008d57e494f484a1a84896065d53fb9b1d8d60e) )
ROM_LOAD16_BYTE( "epr-13392.ic30", 0x40001, 0x20000,CRC(f927cd42) SHA1(67eab328c1fb878fe3d086d0639f5051b135a037) )
ROM_REGION( 0x30000, "subpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13383.ic154", 0x00000, 0x10000, CRC(24f897a7) SHA1(68ba17067d90f07bb5a549017be4773b33ae81d0) )
ROM_LOAD( "epr-13384.ic153", 0x10000, 0x10000, CRC(fe8238bd) SHA1(601910bd86536e6b08f5308b298c8f01fa60f233) )
ROM_LOAD( "epr-13385.ic152", 0x20000, 0x10000, CRC(6df1b995) SHA1(5aab19b87a9ef162c30ccf5974cb795e37dba91f) )
ROM_REGION32_LE( 0x200000, "subpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13382.ic90", 0x000000, 0x20000, CRC(01dac209) SHA1(4c6b03308193c472f6cdbcede306f8ce6db0cc4b) )
ROM_LOAD32_BYTE( "epr-13381.ic94", 0x000001, 0x20000, CRC(3a50d931) SHA1(9d9cb1793f3b8f562ce0ea49f2afeef099f20859) )
ROM_LOAD32_BYTE( "epr-13380.ic98", 0x000002, 0x20000, CRC(ad1024c8) SHA1(86e941424b2e2e00940886e5daed640a78ed7403) )
ROM_LOAD32_BYTE( "epr-13379.ic102", 0x000003, 0x20000, CRC(1ac17625) SHA1(7aefd382041dd3f97936ecb8738a3f2c9780c58f) )
ROM_LOAD32_BYTE( "epr-13378.ic91", 0x080000, 0x20000, CRC(50c9b867) SHA1(dd9702b369ea8abd50da22ce721b7040428e9d4b) )
ROM_LOAD32_BYTE( "epr-13377.ic95", 0x080001, 0x20000, CRC(9b12f5c0) SHA1(2060420611b3354974c49bc80f556f945512570b) )
ROM_LOAD32_BYTE( "epr-13376.ic99", 0x080002, 0x20000, CRC(449ac518) SHA1(0438a72e53a7889d39ea7e2530e49a2594d97e90) )
ROM_LOAD32_BYTE( "epr-13375.ic103", 0x080003, 0x20000, CRC(5489a9ff) SHA1(c458cb55d957edae340535f54189438296f3ec2f) )
ROM_LOAD32_BYTE( "epr-13374.ic92", 0x100000, 0x20000, CRC(6a319e4f) SHA1(d9f92b15f4baa14745048073205add35b7d42d27) )
ROM_LOAD32_BYTE( "epr-13373.ic96", 0x100001, 0x20000, CRC(eca5588b) SHA1(11def0c293868193d457958fe7459fd8c31dbd2b) )
ROM_LOAD32_BYTE( "epr-13372.ic100", 0x100002, 0x20000, CRC(0b45a433) SHA1(82fa2b208eaf70b70524681fbc3ec70085e70d83) )
ROM_LOAD32_BYTE( "epr-13371.ic104", 0x100003, 0x20000, CRC(b68f4cff) SHA1(166f2a685cbc230c098fdc1646b6e632dd2b09dd) )
ROM_LOAD32_BYTE( "epr-13370.ic93", 0x180000, 0x20000, CRC(78276620) SHA1(2c4505c57a1e765f9cfd48fb1637d67d199a2f1d) )
ROM_LOAD32_BYTE( "epr-13369.ic97", 0x180001, 0x20000, CRC(8625bf0f) SHA1(0ae70bc0d54e25eecf4a11cf0600225dca35914d) )
ROM_LOAD32_BYTE( "epr-13368.ic101", 0x180002, 0x20000, CRC(0f50716c) SHA1(eb4c7f47e11c58fe0d58f67e6dafabc6291eabb8) )
ROM_LOAD32_BYTE( "epr-13367.ic105", 0x180003, 0x20000, CRC(4b1bb51f) SHA1(17fd5ac9e18dd6097a015e9d7b6815826f9c53f1) )
ROM_REGION( 0x10000, "subpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "subpcb:soundcpu", 0 ) // sound CPU
ROM_LOAD( "epr-13388.ic17", 0x00000, 0x10000, CRC(706581e4) SHA1(51c9dbf2bf0d6b8826de24cd33596f5c95136870) )
ROM_REGION( 0x80000, "subpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
ROM_LOAD( "epr-13391.ic11", 0x00000, 0x20000, CRC(8c30c867) SHA1(0d735291b1311890938f8a1143fae6af9feb2a69) )
ROM_LOAD( "epr-13390.ic12", 0x20000, 0x20000, CRC(8c93cd05) SHA1(bb08094abac6c104eddf14f634e9791f03122946) )
ROM_LOAD( "epr-13389.ic13", 0x40000, 0x20000, CRC(4e4c758e) SHA1(181750dfcdd6d5b28b063c980c251991163d9474) )
ROM_END
//*************************************************************************************************************************
//*************************************************************************************************************************
//*************************************************************************************************************************
// Royal Ascot - should be X-Board, or closely related, although it's a main display / terminal setup,
// and we only have the ROMs for one of those parts..
//
ROM_START( rascot )
ROM_REGION( 0x80000, "mainpcb:maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "epr-13965a.ic58", 0x00000, 0x20000, CRC(7eacdfb3) SHA1(fad23352d9c5e266ad9f7fe3ccbd29b5b912b90b) )
ROM_LOAD16_BYTE( "epr-13694a.ic63", 0x00001, 0x20000, CRC(15b86498) SHA1(ccb57063ca53347b5f771b0d7ceaeb9cd50d246a) ) // 13964a?
ROM_REGION( 0x80000, "mainpcb:subcpu", 0 ) // 2nd 68000 code
ROM_LOAD16_BYTE( "epr-13967.ic20", 0x00000, 0x20000, CRC(3b92e2b8) SHA1(5d456d7d6fa540709facda1fd8813707ebfd99d8) )
ROM_LOAD16_BYTE( "epr-13966.ic29", 0x00001, 0x20000, CRC(eaa644e1) SHA1(b9cc171523995f5120ea7b9748af2f8de697b933) )
ROM_REGION( 0x30000, "mainpcb:gfx1", 0 ) // tiles
ROM_LOAD( "epr-13961", 0x00000, 0x10000, CRC(68038629) SHA1(fbe8605840331096c5156d695772e5f36b2e131a) )
ROM_LOAD( "epr-13962", 0x10000, 0x10000, CRC(7d7605bc) SHA1(20d3a7116807db7c831e285233d8c67317980e4a) )
ROM_LOAD( "epr-13963", 0x20000, 0x10000, CRC(f3376b65) SHA1(36b9292518a112409d03b97ea048b7ab22734841) )
ROM_REGION32_LE( 0x200000, "mainpcb:sprites", 0 ) // sprites
ROM_LOAD32_BYTE( "epr-13960", 0x000000, 0x20000, CRC(b974128d) SHA1(14450615b3a10b1de6d098a282f80f80c98c34b8) )
ROM_LOAD32_BYTE( "epr-13959", 0x000001, 0x20000, CRC(db245b22) SHA1(301b7caea7a3b42ab1ab21894ad61b8b14ef1e7c) )
ROM_LOAD32_BYTE( "epr-13958", 0x000002, 0x20000, CRC(7803a027) SHA1(ff659da334e4440a6de9be43dde9dfa21dae5f14) )
ROM_LOAD32_BYTE( "epr-13957", 0x000003, 0x20000, CRC(6d50fb54) SHA1(d21462c30a5555980b964930ddef4dc1963e1d8e) )
ROM_REGION( 0x10000, "mainpcb:gfx3", ROMREGION_ERASE00 ) // road gfx
// none??
ROM_REGION( 0x10000, "mainpcb:soundcpu", 0 ) // sound CPU
// is this really a sound rom, or a terminal / link rom? accesses unexpected addresses
ROM_LOAD( "epr-14221a", 0x00000, 0x10000, CRC(0d429ac4) SHA1(9cd4c7e858874f372eb3e409ba37964f1ebf07d5) )
ROM_REGION( 0x80000, "mainpcb:pcm", ROMREGION_ERASEFF ) // Sega PCM sound data
// none??
ROM_END
//**************************************************************************
// CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// init_* - game-specific initialization
//-------------------------------------------------
void segaxbd_state::install_aburner2(void)
{
m_road_priority = 0;
m_iochip_custom_io_r[0][0] = ioread_delegate(FUNC(segaxbd_state::aburner2_iochip0_motor_r), this);
m_iochip_custom_io_w[0][1] = iowrite_delegate(FUNC(segaxbd_state::aburner2_iochip0_motor_w), this);
}
DRIVER_INIT_MEMBER(segaxbd_new_state,aburner2)
{
m_mainpcb->install_aburner2();
}
void segaxbd_state::install_lastsurv(void)
{
m_iochip_custom_io_r[1][1] = ioread_delegate(FUNC(segaxbd_state::lastsurv_iochip1_port_r), this);
m_iochip_custom_io_w[0][3] = iowrite_delegate(FUNC(segaxbd_state::lastsurv_iochip0_muxer_w), this);
}
DRIVER_INIT_MEMBER(segaxbd_new_state,lastsurv)
{
m_mainpcb->install_lastsurv();
}
void segaxbd_state::install_loffire(void)
{
m_adc_reverse[1] = m_adc_reverse[3] = true;
// install sync hack on core shared memory
m_maincpu->space(AS_PROGRAM).install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this));
m_loffire_sync = m_subram0;
}
DRIVER_INIT_MEMBER(segaxbd_new_state,loffire)
{
m_mainpcb->install_loffire();
}
void segaxbd_state::install_smgp(void)
{
m_iochip_custom_io_r[0][0] = ioread_delegate(FUNC(segaxbd_state::smgp_iochip0_motor_r), this);
m_iochip_custom_io_w[0][1] = iowrite_delegate(FUNC(segaxbd_state::smgp_iochip0_motor_w), this);
// map /EXCS space
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2f0000, 0x2f3fff, read16_delegate(FUNC(segaxbd_state::smgp_excs_r), this), write16_delegate(FUNC(segaxbd_state::smgp_excs_w), this));
}
DRIVER_INIT_MEMBER(segaxbd_new_state,smgp)
{
m_mainpcb->install_smgp();
}
DRIVER_INIT_MEMBER(segaxbd_new_state,rascot)
{
// patch out bootup link test
UINT16 *rom = reinterpret_cast<UINT16 *>(memregion("mainpcb:subcpu")->base());
rom[0xb78/2] = 0x601e; // subrom checksum test
rom[0x57e/2] = 0x4e71;
rom[0x5d0/2] = 0x6008;
rom[0x606/2] = 0x4e71;
// map /EXCS space
m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0f0000, 0x0f3fff, read16_delegate(FUNC(segaxbd_state::rascot_excs_r), (segaxbd_state*)m_mainpcb), write16_delegate(FUNC(segaxbd_state::rascot_excs_w), (segaxbd_state*)m_mainpcb));
}
void segaxbd_state::install_gprider(void)
{
m_gprider_hack = true;
}
DRIVER_INIT_MEMBER(segaxbd_new_state,gprider)
{
m_mainpcb->install_gprider();
}
DRIVER_INIT_MEMBER(segaxbd_new_state_double,gprider_double)
{
m_mainpcb->install_gprider();
m_subpcb->install_gprider();
m_mainpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2F0000, 0x2F003f, read16_delegate(FUNC(segaxbd_new_state_double::shareram1_r), this), write16_delegate(FUNC(segaxbd_new_state_double::shareram1_w), this));
m_subpcb->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2F0000, 0x2F003f, read16_delegate(FUNC(segaxbd_new_state_double::shareram2_r), this), write16_delegate(FUNC(segaxbd_new_state_double::shareram2_w), this));
}
//**************************************************************************
// GAME DRIVERS
//**************************************************************************
// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS
GAME( 1987, aburner2, 0, sega_xboard, aburner2, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner II", 0 )
GAME( 1987, aburner2g,aburner2, sega_xboard, aburner2, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner II (German)", 0 )
GAME( 1987, aburner, aburner2, sega_xboard, aburner, segaxbd_new_state, aburner2, ROT0, "Sega", "After Burner", 0 )
GAME( 1987, thndrbld, 0, sega_xboard_fd1094, thndrbld, driver_device, 0, ROT0, "Sega", "Thunder Blade (upright) (FD1094 317-0056)", 0 )
GAME( 1987, thndrbld1,thndrbld, sega_xboard, thndrbd1, driver_device, 0, ROT0, "Sega", "Thunder Blade (deluxe/standing) (unprotected)", 0 )
GAME( 1989, lastsurv, 0, sega_lastsurv_fd1094,lastsurv, segaxbd_new_state, lastsurv, ROT0, "Sega", "Last Survivor (Japan) (FD1094 317-0083)", 0 )
GAME( 1989, loffire, 0, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (World) (FD1094 317-0136)", 0 )
GAME( 1989, loffireu, loffire, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (US) (FD1094 317-0135)", 0 )
GAME( 1989, loffirej, loffire, sega_xboard_fd1094, loffire, segaxbd_new_state, loffire, ROT0, "Sega", "Line of Fire / Bakudan Yarou (Japan) (FD1094 317-0134)", 0 )
GAME( 1989, rachero, 0, sega_xboard_fd1094, rachero, driver_device, 0, ROT0, "Sega", "Racing Hero (FD1094 317-0144)", 0 )
GAME( 1989, smgp, 0, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World, Rev B) (FD1094 317-0126a)", 0 )
GAME( 1989, smgp6, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World, Rev A) (FD1094 317-0126a)", 0 )
GAME( 1989, smgp5, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (World) (FD1094 317-0126)", 0 )
GAME( 1989, smgpu, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev C) (FD1094 317-0125a)", 0 )
GAME( 1989, smgpu1, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev B) (FD1094 317-0125a)", 0 )
GAME( 1989, smgpu2, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (US, Rev A) (FD1094 317-0125a)", 0 )
GAME( 1989, smgpj, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (Japan, Rev B) (FD1094 317-0124a)", 0 )
GAME( 1989, smgpja, smgp, sega_smgp_fd1094, smgp, segaxbd_new_state, smgp, ROT0, "Sega", "Super Monaco GP (Japan, Rev A) (FD1094 317-0124a)", 0 )
GAME( 1990, abcop, 0, sega_xboard_fd1094, abcop, driver_device, 0, ROT0, "Sega", "A.B. Cop (World) (FD1094 317-0169b)", 0 )
GAME( 1990, abcopj, abcop, sega_xboard_fd1094, abcop, driver_device, 0, ROT0, "Sega", "A.B. Cop (Japan) (FD1094 317-0169b)", 0 )
// wasn't officially available as a single PCB setup, but runs anyway albeit with messages suggesting you can compete against a rival that doesn't exist?
GAME( 1990, gpriders, gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (World, FD1094 317-0163)", 0 )
GAME( 1990, gpriderus,gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (US, FD1094 317-0162)", 0 )
GAME( 1990, gpriderjs,gprider, sega_xboard_fd1094, gprider, segaxbd_new_state, gprider, ROT0, "Sega", "GP Rider (Japan, FD1094 317-0161)", 0 )
// multi X-Board (2 stacks directly connected, shared RAM on bridge PCB - not networked)
GAME( 1990, gprider, 0, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (World, FD1094 317-0163) (Twin setup)", 0 )
GAME( 1990, gprideru,gprider, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (US, FD1094 317-0162) (Twin setup)", 0 )
GAME( 1990, gpriderj,gprider, sega_xboard_fd1094_double, gprider_double, segaxbd_new_state_double, gprider_double, ROT0, "Sega", "GP Rider (Japan, FD1094 317-0161) (Twin setup)", 0 )
// X-Board + other boards?
GAME( 1991, rascot, 0, sega_rascot, rascot, segaxbd_new_state, rascot, ROT0, "Sega", "Royal Ascot (Japan, terminal?)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
// decrypted bootlegs
GAME( 1987, thndrbldd, thndrbld,sega_xboard, thndrbld, driver_device, 0, ROT0, "bootleg", "Thunder Blade (upright) (bootleg of FD1094 317-0056 set)", 0 )
GAME( 1989, racherod, rachero, sega_xboard, rachero, driver_device, 0, ROT0, "bootleg", "Racing Hero (bootleg of FD1094 317-0144 set)", 0 )
GAME( 1989, smgpd, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World, Rev B) (bootleg of FD1094 317-0126a set)", 0 )
GAME( 1989, smgp6d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World, Rev A) (bootleg of FD1094 317-0126a set)", 0 )
GAME( 1989, smgp5d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (World) (bootleg of FD1094 317-0126 set)", 0 )
GAME( 1989, smgpud, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev C) (bootleg of FD1094 317-0125a set)", 0 )
GAME( 1989, smgpu1d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev B) (bootleg of FD1094 317-0125a set)", 0 )
GAME( 1989, smgpu2d, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (US, Rev A) (bootleg of FD1094 317-0125a set)", 0 )
GAME( 1989, smgpjd, smgp, sega_smgp, smgp, segaxbd_new_state, smgp, ROT0, "bootleg", "Super Monaco GP (Japan, Rev B) (bootleg of FD1094 317-0124a set)", 0 )
GAME( 1989, lastsurvd,lastsurv, sega_lastsurv,lastsurv, segaxbd_new_state, lastsurv, ROT0, "bootleg", "Last Survivor (Japan) (bootleg of FD1094 317-0083 set)", 0 )
GAME( 1990, abcopd, abcop, sega_xboard, abcop, driver_device, 0, ROT0, "bootleg", "A.B. Cop (World) (bootleg of FD1094 317-0169b set)", 0 )
GAME( 1990, abcopjd, abcop, sega_xboard, abcop, driver_device, 0, ROT0, "bootleg", "A.B. Cop (Japan) (bootleg of FD1094 317-0169b set)", 0 )
GAME( 1989, loffired, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (World) (bootleg of FD1094 317-0136 set)", 0 )
GAME( 1989, loffireud, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (US) (bootleg of FD1094 317-0135 set)", 0 )
GAME( 1989, loffirejd, loffire, sega_xboard, loffire, segaxbd_new_state, loffire, ROT0, "bootleg", "Line of Fire / Bakudan Yarou (Japan) (bootleg of FD1094 317-0134 set)", 0 )
| GiuseppeGorgoglione/mame | src/mame/drivers/segaxbd.cpp | C++ | gpl-2.0 | 297,861 |
<?php global $nc_utility ;?>
<?php $image_options = get_option("nc_plugin_image_settings"); ?>
<?php $index = $this->index;?>
<?php if($this->images): ?>
<?php foreach( $this->images as $image): ?>
<li data-tooltip-id="tooltip-thumbnail-<?php echo $index; ?>" <?php if($index % 3 == 0) echo "class='no-margin'";?>>
<img class="nc-large-image" id="nc-large-image-<?php echo $index; ?>" add="1" width="70" height="41" src="<?php echo $image->image_large;?>?width=70&height=41" url="<?php echo $image->image_large;?>" />
<img class="nc-add-image-loading" id="nc-add-iamge-loading-<?php echo $index; ?>" src="<?php echo NC_IMAGES_URL."/nc-loading2.gif";?>" />
<div id="tooltip-thumbnail-<?php echo $index; ?>" class="thumbnail-inner" add="0">
<div class="image-tooltip">
<img width="260" height="146" class="bimg" />
<span><?php echo $nc_utility->elapsed_time( strtotime($image->published_at) ); ?>
<em>W <input class="wh post_width" type="text" name="" default_value="<?php echo $image_options['post_img_width']; ?>" actual_value="<?php echo $image->width; ?>" value="<?php echo $image->width; ?>" title="Click to Edit"> H
<input class="wh post_height" type="text" name="" default_value="<?php echo $image_options['post_img_height']; ?>" actual_value="<?php echo $image->height; ?>" value="<?php echo $image->height; ?>" title="Click to Edit"></em>
</span>
<p class="tag"><strong>Source:-</strong><span class="nc-image-source"><?php if($image->attribution_text) echo $image->attribution_text; else echo $image->source->name; ?></span></p>
<textarea class="captionstyle image-caption" title="Click to Edit"><?php echo $image->caption; ?></textarea>
<a href="#" class="button nc-insert-to-post"><img width="17" height="10" src="<?php echo NC_IMAGES_URL."/inserticons.png";?>" /> Insert into post</a> <a href="javascript:void(0)" class="button nc-add-feature-image" index="<?php echo $index; ?>" url="<?php echo $image->image_large;?>"><img width="16" height="12" src="<?php echo NC_IMAGES_URL."/setf.png";?>" /> Set as a featured</a>
<div class="nc-large-image-url" large_url="<?php echo $image->image_large;?>"></div>
</div>
</div>
</li>
<?php $index++;?>
<?php endforeach; ?>
<?php else: ?>
<p>No image found</p>
<?php endif; ?>
| pranto157/outofcircle | wp-content/plugins/newscred/application/views/metabox/includes/images.php | PHP | gpl-2.0 | 2,562 |
(function($) {
Drupal.wysiwyg.editor.init.ckeditor = function(settings) {
window.CKEDITOR_BASEPATH = settings.global.editorBasePath + '/';
CKEDITOR.basePath = window.CKEDITOR_BASEPATH;
// Drupal.wysiwyg.editor['initialized']['ckeditor'] = true;
// Plugins must only be loaded once. Only the settings from the first format
// will be used but they're identical anyway.
var registeredPlugins = {};
for (var format in settings) {
if (Drupal.settings.wysiwyg.plugins[format]) {
// Register native external plugins.
// Array syntax required; 'native' is a predefined token in JavaScript.
for (var pluginName in Drupal.settings.wysiwyg.plugins[format]['native']) {
if (!registeredPlugins[pluginName]) {
var plugin = Drupal.settings.wysiwyg.plugins[format]['native'][pluginName];
CKEDITOR.plugins.addExternal(pluginName, plugin.path, plugin.fileName);
registeredPlugins[pluginName] = true;
}
}
// Register Drupal plugins.
for (var pluginName in Drupal.settings.wysiwyg.plugins[format].drupal) {
if (!registeredPlugins[pluginName]) {
Drupal.wysiwyg.editor.instance.ckeditor.addPlugin(pluginName, Drupal.settings.wysiwyg.plugins[format].drupal[pluginName], Drupal.settings.wysiwyg.plugins.drupal[pluginName]);
registeredPlugins[pluginName] = true;
}
}
}
}
};
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) {
// Apply editor instance settings.
CKEDITOR.config.customConfig = '';
settings.on = {
instanceReady: function(ev) {
var editor = ev.editor;
// Get a list of block, list and table tags from CKEditor's XHTML DTD.
// @see http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting.
var dtd = CKEDITOR.dtd;
var tags = CKEDITOR.tools.extend({}, dtd.$block, dtd.$listItem, dtd.$tableContent);
// Set source formatting rules for each listed tag except <pre>.
// Linebreaks can be inserted before or after opening and closing tags.
if (settings.apply_source_formatting) {
// Mimic FCKeditor output, by breaking lines between tags.
for (var tag in tags) {
if (tag == 'pre') {
continue;
}
this.dataProcessor.writer.setRules(tag, {
indent: true,
breakBeforeOpen: true,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: true
});
}
}
else {
// CKEditor adds default formatting to <br>, so we want to remove that
// here too.
tags.br = 1;
// No indents or linebreaks;
for (var tag in tags) {
if (tag == 'pre') {
continue;
}
this.dataProcessor.writer.setRules(tag, {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
}
}
},
pluginsLoaded: function(ev) {
// Override the conversion methods to let Drupal plugins modify the data.
var editor = ev.editor;
if (editor.dataProcessor && Drupal.settings.wysiwyg.plugins[params.format]) {
editor.dataProcessor.toHtml = CKEDITOR.tools.override(editor.dataProcessor.toHtml, function(originalToHtml) {
// Convert raw data for display in WYSIWYG mode.
return function(data, fixForBody) {
for (var plugin in Drupal.settings.wysiwyg.plugins[params.format].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].attach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], editor.name);
data = Drupal.wysiwyg.instances[params.field].prepareContent(data);
}
}
return originalToHtml.call(this, data, fixForBody);
};
});
editor.dataProcessor.toDataFormat = CKEDITOR.tools.override(editor.dataProcessor.toDataFormat, function(originalToDataFormat) {
// Convert WYSIWYG mode content to raw data.
return function(data, fixForBody) {
data = originalToDataFormat.call(this, data, fixForBody);
for (var plugin in Drupal.settings.wysiwyg.plugins[params.format].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].detach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], editor.name);
}
}
return data;
};
});
}
},
selectionChange: function (event) {
var pluginSettings = Drupal.settings.wysiwyg.plugins[params.format];
if (pluginSettings && pluginSettings.drupal) {
$.each(pluginSettings.drupal, function (name) {
var plugin = Drupal.wysiwyg.plugins[name];
if ($.isFunction(plugin.isNode)) {
var node = event.data.selection.getSelectedElement();
var state = plugin.isNode(node ? node.$ : null) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
event.editor.getCommand(name).setState(state);
}
});
}
},
focus: function(ev) {
Drupal.wysiwyg.activeId = ev.editor.name;
}
};
// Attach editor.
CKEDITOR.replace(params.field, settings);
};
/**
* Detach a single or all editors.
*
* @todo 3.x: editor.prototype.getInstances() should always return an array
* containing all instances or the passed in params.field instance, but
* always return an array to simplify all detach functions.
*/
Drupal.wysiwyg.editor.detach.ckeditor = function(context, params) {
if (typeof params != 'undefined') {
var instance = CKEDITOR.instances[params.field];
if (instance) {
instance.destroy();
}
}
else {
for (var instanceName in CKEDITOR.instances) {
CKEDITOR.instances[instanceName].destroy();
}
}
};
Drupal.wysiwyg.editor.instance.ckeditor = {
addPlugin: function(pluginName, settings, pluginSettings) {
CKEDITOR.plugins.add(pluginName, {
// Wrap Drupal plugin in a proxy pluygin.
init: function(editor) {
if (settings.css) {
editor.on('mode', function(ev) {
if (ev.editor.mode == 'wysiwyg') {
// Inject CSS files directly into the editing area head tag.
$('head', $('#cke_contents_' + ev.editor.name + ' iframe').eq(0).contents()).append('<link rel="stylesheet" href="' + settings.css + '" type="text/css" >');
}
});
}
if (typeof Drupal.wysiwyg.plugins[pluginName].invoke == 'function') {
var pluginCommand = {
exec: function (editor) {
var data = { format: 'html', node: null, content: '' };
var selection = editor.getSelection();
if (selection) {
data.node = selection.getSelectedElement();
if (data.node) {
data.node = data.node.$;
}
if (selection.getType() == CKEDITOR.SELECTION_TEXT) {
if (CKEDITOR.env.ie) {
data.content = selection.getNative().createRange().text;
}
else {
data.content = selection.getNative().toString();
}
}
else if (data.node) {
// content is supposed to contain the "outerHTML".
data.content = data.node.parentNode.innerHTML;
}
}
Drupal.wysiwyg.plugins[pluginName].invoke(data, pluginSettings, editor.name);
}
};
editor.addCommand(pluginName, pluginCommand);
}
editor.ui.addButton(pluginName, {
label: settings.iconTitle,
command: pluginName,
icon: settings.icon
});
// @todo Add button state handling.
}
});
},
prepareContent: function(content) {
// @todo Don't know if we need this yet.
return content;
},
insert: function(content) {
content = this.prepareContent(content);
CKEDITOR.instances[this.field].insertHtml(content);
}
};
})(jQuery);
;
(function($) {
/**
* Attach this editor to a target element.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* An object containing input format parameters. Default parameters are:
* - editor: The internal editor name.
* - theme: The name/key of the editor theme/profile to use.
* - field: The CSS id of the target element.
* @param settings
* An object containing editor settings for all enabled editor themes.
*/
Drupal.wysiwyg.editor.attach.none = function(context, params, settings) {
if (params.resizable) {
var $wrapper = $('#' + params.field).parents('.form-textarea-wrapper:first');
$wrapper.addClass('resizable');
if (Drupal.behaviors.textarea.attach) {
Drupal.behaviors.textarea.attach();
}
}
};
/**
* Detach a single or all editors.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* (optional) An object containing input format parameters. If defined,
* only the editor instance in params.field should be detached. Otherwise,
* all editors should be detached and saved, so they can be submitted in
* AJAX/AHAH applications.
*/
Drupal.wysiwyg.editor.detach.none = function(context, params) {
if (typeof params != 'undefined') {
var $wrapper = $('#' + params.field).parents('.form-textarea-wrapper:first');
$wrapper.removeOnce('textarea').removeClass('.resizable-textarea')
.find('.grippie').remove();
}
};
/**
* Instance methods for plain text areas.
*/
Drupal.wysiwyg.editor.instance.none = {
insert: function(content) {
var editor = document.getElementById(this.field);
// IE support.
if (document.selection) {
editor.focus();
var sel = document.selection.createRange();
sel.text = content;
}
// Mozilla/Firefox/Netscape 7+ support.
else if (editor.selectionStart || editor.selectionStart == '0') {
var startPos = editor.selectionStart;
var endPos = editor.selectionEnd;
editor.value = editor.value.substring(0, startPos) + content + editor.value.substring(endPos, editor.value.length);
}
// Fallback, just add to the end of the content.
else {
editor.value += content;
}
}
};
})(jQuery);
;
(function($) {
//Global container.
window.imce = {tree: {}, findex: [], fids: {}, selected: {}, selcount: 0, ops: {}, cache: {}, urlId: {},
vars: {previewImages: 1, cache: 1},
hooks: {load: [], list: [], navigate: [], cache: []},
//initiate imce.
initiate: function() {
imce.conf = Drupal.settings.imce || {};
if (imce.conf.error != false) return;
imce.FLW = imce.el('file-list-wrapper'), imce.SBW = imce.el('sub-browse-wrapper');
imce.NW = imce.el('navigation-wrapper'), imce.BW = imce.el('browse-wrapper');
imce.PW = imce.el('preview-wrapper'), imce.FW = imce.el('forms-wrapper');
imce.updateUI();
imce.prepareMsgs();//process initial status messages
imce.initiateTree();//build directory tree
imce.hooks.list.unshift(imce.processRow);//set the default list-hook.
imce.initiateList();//process file list
imce.initiateOps();//prepare operation tabs
imce.refreshOps();
imce.invoke('load', window);//run functions set by external applications.
},
//process navigation tree
initiateTree: function() {
$('#navigation-tree li').each(function(i) {
var a = this.firstChild, txt = a.firstChild;
txt && (txt.data = imce.decode(txt.data));
var branch = imce.tree[a.title] = {'a': a, li: this, ul: this.lastChild.tagName == 'UL' ? this.lastChild : null};
if (a.href) imce.dirClickable(branch);
imce.dirCollapsible(branch);
});
},
//Add a dir to the tree under parent
dirAdd: function(dir, parent, clickable) {
if (imce.tree[dir]) return clickable ? imce.dirClickable(imce.tree[dir]) : imce.tree[dir];
var parent = parent || imce.tree['.'];
parent.ul = parent.ul ? parent.ul : parent.li.appendChild(imce.newEl('ul'));
var branch = imce.dirCreate(dir, imce.decode(dir.substr(dir.lastIndexOf('/')+1)), clickable);
parent.ul.appendChild(branch.li);
return branch;
},
//create list item for navigation tree
dirCreate: function(dir, text, clickable) {
if (imce.tree[dir]) return imce.tree[dir];
var branch = imce.tree[dir] = {li: imce.newEl('li'), a: imce.newEl('a')};
$(branch.a).addClass('folder').text(text).attr('title', dir).appendTo(branch.li);
imce.dirCollapsible(branch);
return clickable ? imce.dirClickable(branch) : branch;
},
//change currently active directory
dirActivate: function(dir) {
if (dir != imce.conf.dir) {
if (imce.tree[imce.conf.dir]){
$(imce.tree[imce.conf.dir].a).removeClass('active');
}
$(imce.tree[dir].a).addClass('active');
imce.conf.dir = dir;
}
return imce.tree[imce.conf.dir];
},
//make a dir accessible
dirClickable: function(branch) {
if (branch.clkbl) return branch;
$(branch.a).attr('href', '#').removeClass('disabled').click(function() {imce.navigate(this.title); return false;});
branch.clkbl = true;
return branch;
},
//sub-directories expand-collapse ability
dirCollapsible: function (branch) {
if (branch.clpsbl) return branch;
$(imce.newEl('span')).addClass('expander').html(' ').click(function() {
if (branch.ul) {
$(branch.ul).toggle();
$(branch.li).toggleClass('expanded');
$.browser.msie && $('#navigation-header').css('top', imce.NW.scrollTop);
}
else if (branch.clkbl){
$(branch.a).click();
}
}).prependTo(branch.li);
branch.clpsbl = true;
return branch;
},
//update navigation tree after getting subdirectories.
dirSubdirs: function(dir, subdirs) {
var branch = imce.tree[dir];
if (subdirs && subdirs.length) {
var prefix = dir == '.' ? '' : dir +'/';
for (var i in subdirs) {//add subdirectories
imce.dirAdd(prefix + subdirs[i], branch, true);
}
$(branch.li).removeClass('leaf').addClass('expanded');
$(branch.ul).show();
}
else if (!branch.ul){//no subdirs->leaf
$(branch.li).removeClass('expanded').addClass('leaf');
}
},
//process file list
initiateList: function(cached) {
var L = imce.hooks.list, dir = imce.conf.dir, token = {'%dir': dir == '.' ? $(imce.tree['.'].a).text() : imce.decode(dir)}
imce.findex = [], imce.fids = {}, imce.selected = {}, imce.selcount = 0, imce.vars.lastfid = null;
imce.tbody = imce.el('file-list').tBodies[0];
if (imce.tbody.rows.length) {
for (var row, i = 0; row = imce.tbody.rows[i]; i++) {
var fid = row.id;
imce.findex[i] = imce.fids[fid] = row;
if (cached) {
if (imce.hasC(row, 'selected')) {
imce.selected[imce.vars.lastfid = fid] = row;
imce.selcount++;
}
}
else {
for (var func, j = 0; func = L[j]; j++) func(row);//invoke list-hook
}
}
}
if (!imce.conf.perm.browse) {
imce.setMessage(Drupal.t('File browsing is disabled in directory %dir.', token), 'error');
}
},
//add a file to the list. (having properties name,size,formatted size,width,height,date,formatted date)
fileAdd: function(file) {
var row, fid = file.name, i = imce.findex.length, attr = ['name', 'size', 'width', 'height', 'date'];
if (!(row = imce.fids[fid])) {
row = imce.findex[i] = imce.fids[fid] = imce.tbody.insertRow(i);
for (var i in attr) row.insertCell(i).className = attr[i];
}
row.cells[0].innerHTML = row.id = fid;
row.cells[1].innerHTML = file.fsize; row.cells[1].id = file.size;
row.cells[2].innerHTML = file.width;
row.cells[3].innerHTML = file.height;
row.cells[4].innerHTML = file.fdate; row.cells[4].id = file.date;
imce.invoke('list', row);
if (imce.vars.prvfid == fid) imce.setPreview(fid);
if (file.id) imce.urlId[imce.getURL(fid)] = file.id;
},
//remove a file from the list
fileRemove: function(fid) {
if (!(row = imce.fids[fid])) return;
imce.fileDeSelect(fid);
imce.findex.splice(row.rowIndex, 1);
$(row).remove();
delete imce.fids[fid];
if (imce.vars.prvfid == fid) imce.setPreview();
},
//return a file object containing all properties.
fileGet: function (fid) {
var row = imce.fids[fid];
var url = imce.getURL(fid);
return row ? {
name: imce.decode(fid),
url: url,
size: row.cells[1].innerHTML,
bytes: row.cells[1].id * 1,
width: row.cells[2].innerHTML * 1,
height: row.cells[3].innerHTML * 1,
date: row.cells[4].innerHTML,
time: row.cells[4].id * 1,
id: imce.urlId[url] || 0, //file id for newly uploaded files
relpath: (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid //rawurlencoded path relative to file directory path.
} : null;
},
//simulate row click. selection-highlighting
fileClick: function(row, ctrl, shft) {
if (!row) return;
var fid = typeof(row) == 'string' ? row : row.id;
if (ctrl || fid == imce.vars.prvfid) {
imce.fileToggleSelect(fid);
}
else if (shft) {
var last = imce.lastFid();
var start = last ? imce.fids[last].rowIndex : -1;
var end = imce.fids[fid].rowIndex;
var step = start > end ? -1 : 1;
while (start != end) {
start += step;
imce.fileSelect(imce.findex[start].id);
}
}
else {
for (var fname in imce.selected) {
imce.fileDeSelect(fname);
}
imce.fileSelect(fid);
}
//set preview
imce.setPreview(imce.selcount == 1 ? imce.lastFid() : null);
},
//file select/deselect functions
fileSelect: function (fid) {
if (imce.selected[fid] || !imce.fids[fid]) return;
imce.selected[fid] = imce.fids[imce.vars.lastfid=fid];
$(imce.selected[fid]).addClass('selected');
imce.selcount++;
},
fileDeSelect: function (fid) {
if (!imce.selected[fid] || !imce.fids[fid]) return;
if (imce.vars.lastfid == fid) imce.vars.lastfid = null;
$(imce.selected[fid]).removeClass('selected');
delete imce.selected[fid];
imce.selcount--;
},
fileToggleSelect: function (fid) {
imce['file'+ (imce.selected[fid] ? 'De' : '') +'Select'](fid);
},
//process file operation form and create operation tabs.
initiateOps: function() {
imce.setHtmlOps();
imce.setUploadOp();//upload
imce.setFileOps();//thumb, delete, resize
},
//process existing html ops.
setHtmlOps: function () {
$(imce.el('ops-list')).children('li').each(function() {
if (!this.firstChild) return $(this).remove();
var name = this.id.substr(8);
var Op = imce.ops[name] = {div: imce.el('op-content-'+ name), li: imce.el('op-item-'+ name)};
Op.a = Op.li.firstChild;
Op.title = Op.a.innerHTML;
$(Op.a).click(function() {imce.opClick(name); return false;});
});
},
//convert upload form to an op.
setUploadOp: function () {
var form = imce.el('imce-upload-form');
if (!form) return;
$(form).ajaxForm(imce.uploadSettings()).find('fieldset').each(function() {//clean up fieldsets
this.removeChild(this.firstChild);
$(this).after(this.childNodes);
}).remove();
imce.opAdd({name: 'upload', title: Drupal.t('Upload'), content: form});//add op
},
//convert fileop form submit buttons to ops.
setFileOps: function () {
var form = imce.el('imce-fileop-form');
if (!form) return;
$(form.elements.filenames).parent().remove();
$(form).find('fieldset').each(function() {//remove fieldsets
var $sbmt = $('input:submit', this);
if (!$sbmt.size()) return;
var Op = {name: $sbmt.attr('id').substr(5)};
var func = function() {imce.fopSubmit(Op.name); return false;};
$sbmt.click(func);
Op.title = $(this).children('legend').remove().text() || $sbmt.val();
Op.name == 'delete' ? (Op.func = func) : (Op.content = this.childNodes);
imce.opAdd(Op);
}).remove();
imce.vars.opform = $(form).serialize();//serialize remaining parts.
},
//refresh ops states. enable/disable
refreshOps: function() {
for (var p in imce.conf.perm) {
if (imce.conf.perm[p]) imce.opEnable(p);
else imce.opDisable(p);
}
},
//add a new file operation
opAdd: function (op) {
var oplist = imce.el('ops-list'), opcons = imce.el('op-contents');
var name = op.name || ('op-'+ $(oplist).children('li').size());
var title = op.title || 'Untitled';
var Op = imce.ops[name] = {title: title};
if (op.content) {
Op.div = imce.newEl('div');
$(Op.div).attr({id: 'op-content-'+ name, 'class': 'op-content'}).appendTo(opcons).append(op.content);
}
Op.a = imce.newEl('a');
Op.li = imce.newEl('li');
$(Op.a).attr({href: '#', name: name, title: title}).html('<span>' + title +'</span>').click(imce.opClickEvent);
$(Op.li).attr('id', 'op-item-'+ name).append(Op.a).appendTo(oplist);
Op.func = op.func || imce.opVoid;
return Op;
},
//click event for file operations
opClickEvent: function(e) {
imce.opClick(this.name);
return false;
},
//void operation function
opVoid: function() {},
//perform op click
opClick: function(name) {
var Op = imce.ops[name], oldop = imce.vars.op;
if (!Op || Op.disabled) {
return imce.setMessage(Drupal.t('You can not perform this operation.'), 'error');
}
if (Op.div) {
if (oldop) {
var toggle = oldop == name;
imce.opShrink(oldop, toggle ? 'fadeOut' : 'hide');
if (toggle) return false;
}
var left = Op.li.offsetLeft;
var $opcon = $('#op-contents').css({left: 0});
$(Op.div).fadeIn('normal', function() {
setTimeout(function() {
if (imce.vars.op) {
var $inputs = $('input', imce.ops[imce.vars.op].div);
$inputs.eq(0).focus();
//form inputs become invisible in IE. Solution is as stupid as the behavior.
$('html').is('.ie') && $inputs.addClass('dummyie').removeClass('dummyie');
}
});
});
var diff = left + $opcon.width() - $('#imce-content').width();
$opcon.css({left: diff > 0 ? left - diff - 1 : left});
$(Op.li).addClass('active');
$(imce.opCloseLink).fadeIn(300);
imce.vars.op = name;
}
Op.func(true);
return true;
},
//enable a file operation
opEnable: function(name) {
var Op = imce.ops[name];
if (Op && Op.disabled) {
Op.disabled = false;
$(Op.li).show();
}
},
//disable a file operation
opDisable: function(name) {
var Op = imce.ops[name];
if (Op && !Op.disabled) {
Op.div && imce.opShrink(name);
$(Op.li).hide();
Op.disabled = true;
}
},
//hide contents of a file operation
opShrink: function(name, effect) {
if (imce.vars.op != name) return;
var Op = imce.ops[name];
$(Op.div).stop(true, true)[effect || 'hide']();
$(Op.li).removeClass('active');
$(imce.opCloseLink).hide();
Op.func(false);
imce.vars.op = null;
},
//navigate to dir
navigate: function(dir) {
if (imce.vars.navbusy || (dir == imce.conf.dir && !confirm(Drupal.t('Do you want to refresh the current directory?')))) return;
var cache = imce.vars.cache && dir != imce.conf.dir;
var set = imce.navSet(dir, cache);
if (cache && imce.cache[dir]) {//load from the cache
set.success({data: imce.cache[dir]});
set.complete();
}
else $.ajax(set);//live load
},
//ajax navigation settings
navSet: function (dir, cache) {
$(imce.tree[dir].li).addClass('loading');
imce.vars.navbusy = dir;
return {url: imce.ajaxURL('navigate', dir),
type: 'GET',
dataType: 'json',
success: function(response) {
if (response.data && !response.data.error) {
if (cache) imce.navCache(imce.conf.dir, dir);//cache the current dir
imce.navUpdate(response.data, dir);
}
imce.processResponse(response);
},
complete: function () {
$(imce.tree[dir].li).removeClass('loading');
imce.vars.navbusy = null;
}
};
},
//update directory using the given data
navUpdate: function(data, dir) {
var cached = data == imce.cache[dir], olddir = imce.conf.dir;
if (cached) data.files.id = 'file-list';
$(imce.FLW).html(data.files);
imce.dirActivate(dir);
imce.dirSubdirs(dir, data.subdirectories);
$.extend(imce.conf.perm, data.perm);
imce.refreshOps();
imce.initiateList(cached);
imce.setPreview(imce.selcount == 1 ? imce.lastFid() : null);
imce.SBW.scrollTop = 0;
imce.invoke('navigate', data, olddir, cached);
},
//set cache
navCache: function (dir, newdir) {
var C = imce.cache[dir] = {'dir': dir, files: imce.el('file-list'), dirsize: imce.el('dir-size').innerHTML, perm: $.extend({}, imce.conf.perm)};
C.files.id = 'cached-list-'+ dir;
imce.FW.appendChild(C.files);
imce.invoke('cache', C, newdir);
},
//validate upload form
uploadValidate: function (data, form, options) {
var path = data[0].value;
if (!path) return false;
if (imce.conf.extensions != '*') {
var ext = path.substr(path.lastIndexOf('.') + 1);
if ((' '+ imce.conf.extensions +' ').indexOf(' '+ ext.toLowerCase() +' ') == -1) {
return imce.setMessage(Drupal.t('Only files with the following extensions are allowed: %files-allowed.', {'%files-allowed': imce.conf.extensions}), 'error');
}
}
var sep = path.indexOf('/') == -1 ? '\\' : '/';
options.url = imce.ajaxURL('upload');//make url contain current dir.
imce.fopLoading('upload', true);
return true;
},
//settings for upload
uploadSettings: function () {
return {beforeSubmit: imce.uploadValidate, success: function (response) {imce.processResponse($.parseJSON(response));}, complete: function () {imce.fopLoading('upload', false);}, resetForm: true};
},
//validate default ops(delete, thumb, resize)
fopValidate: function(fop) {
if (!imce.validateSelCount(1, imce.conf.filenum)) return false;
switch (fop) {
case 'delete':
return confirm(Drupal.t('Delete selected files?'));
case 'thumb':
if (!$('input:checked', imce.ops['thumb'].div).size()) {
return imce.setMessage(Drupal.t('Please select a thumbnail.'), 'error');
}
return imce.validateImage();
case 'resize':
var w = imce.el('edit-width').value, h = imce.el('edit-height').value;
var maxDim = imce.conf.dimensions.split('x');
var maxW = maxDim[0]*1, maxH = maxW ? maxDim[1]*1 : 0;
if (!(/^[1-9][0-9]*$/).test(w) || !(/^[1-9][0-9]*$/).test(h) || (maxW && (maxW < w*1 || maxH < h*1))) {
return imce.setMessage(Drupal.t('Please specify dimensions within the allowed range that is from 1x1 to @dimensions.', {'@dimensions': maxW ? imce.conf.dimensions : Drupal.t('unlimited')}), 'error');
}
return imce.validateImage();
}
var func = fop +'OpValidate';
if (imce[func]) return imce[func](fop);
return true;
},
//submit wrapper for default ops
fopSubmit: function(fop) {
switch (fop) {
case 'thumb': case 'delete': case 'resize': return imce.commonSubmit(fop);
}
var func = fop +'OpSubmit';
if (imce[func]) return imce[func](fop);
},
//common submit function shared by default ops
commonSubmit: function(fop) {
if (!imce.fopValidate(fop)) return false;
imce.fopLoading(fop, true);
$.ajax(imce.fopSettings(fop));
},
//settings for default file operations
fopSettings: function (fop) {
return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ imce.serialNames() +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
},
//toggle loading state
fopLoading: function(fop, state) {
var el = imce.el('edit-'+ fop), func = state ? 'addClass' : 'removeClass'
if (el) {
$(el)[func]('loading').attr('disabled', state);
}
else {
$(imce.ops[fop].li)[func]('loading');
imce.ops[fop].disabled = state;
}
},
//preview a file.
setPreview: function (fid) {
var row, html = '';
imce.vars.prvfid = fid;
if (fid && (row = imce.fids[fid])) {
var width = row.cells[2].innerHTML * 1;
html = imce.vars.previewImages && width ? imce.imgHtml(fid, width, row.cells[3].innerHTML) : imce.decodePlain(fid);
html = '<a href="#" onclick="imce.send(\''+ fid +'\'); return false;" title="'+ (imce.vars.prvtitle||'') +'">'+ html +'</a>';
}
imce.el('file-preview').innerHTML = html;
},
//default file send function. sends the file to the new window.
send: function (fid) {
fid && window.open(imce.getURL(fid));
},
//add an operation for an external application to which the files are send.
setSendTo: function (title, func) {
imce.send = function (fid) { fid && func(imce.fileGet(fid), window);};
var opFunc = function () {
if (imce.selcount != 1) return imce.setMessage(Drupal.t('Please select a file.'), 'error');
imce.send(imce.vars.prvfid);
};
imce.vars.prvtitle = title;
return imce.opAdd({name: 'sendto', title: title, func: opFunc});
},
//move initial page messages into log
prepareMsgs: function () {
var msgs;
if (msgs = imce.el('imce-messages')) {
$('>div', msgs).each(function (){
var type = this.className.split(' ')[1];
var li = $('>ul li', this);
if (li.size()) li.each(function () {imce.setMessage(this.innerHTML, type);});
else imce.setMessage(this.innerHTML, type);
});
$(msgs).remove();
}
},
//insert log message
setMessage: function (msg, type) {
var $box = $(imce.msgBox);
var logs = imce.el('log-messages') || $(imce.newEl('div')).appendTo('#help-box-content').before('<h4>'+ Drupal.t('Log messages') +':</h4>').attr('id', 'log-messages')[0];
var msg = '<div class="message '+ (type || 'status') +'">'+ msg +'</div>';
$box.queue(function() {
$box.css({opacity: 0, display: 'block'}).html(msg);
$box.dequeue();
});
var q = $box.queue().length, t = imce.vars.msgT || 1000;
q = q < 2 ? 1 : q < 3 ? 0.8 : q < 4 ? 0.7 : 0.4;//adjust speed with respect to queue length
$box.fadeTo(600 * q, 1).fadeTo(t * q, 1).fadeOut(400 * q);
$(logs).append(msg);
return false;
},
//invoke hooks
invoke: function (hook) {
var i, args, func, funcs;
if ((funcs = imce.hooks[hook]) && funcs.length) {
(args = $.makeArray(arguments)).shift();
for (i = 0; func = funcs[i]; i++) func.apply(this, args);
}
},
//process response
processResponse: function (response) {
if (response.data) imce.resData(response.data);
if (response.messages) imce.resMsgs(response.messages);
},
//process response data
resData: function (data) {
var i, added, removed;
if (added = data.added) {
var cnt = imce.findex.length;
for (i in added) {//add new files or update existing
imce.fileAdd(added[i]);
}
if (added.length == 1) {//if it is a single file operation
imce.highlight(added[0].name);//highlight
}
if (imce.findex.length != cnt) {//if new files added, scroll to bottom.
$(imce.SBW).animate({scrollTop: imce.SBW.scrollHeight}).focus();
}
}
if (removed = data.removed) for (i in removed) {
imce.fileRemove(removed[i]);
}
imce.conf.dirsize = data.dirsize;
imce.updateStat();
},
//set response messages
resMsgs: function (msgs) {
for (var type in msgs) for (var i in msgs[type]) {
imce.setMessage(msgs[type][i], type);
}
},
//return img markup
imgHtml: function (fid, width, height) {
return '<img src="'+ imce.getURL(fid) +'" width="'+ width +'" height="'+ height +'" alt="'+ imce.decodePlain(fid) +'">';
},
//check if the file is an image
isImage: function (fid) {
return imce.fids[fid].cells[2].innerHTML * 1;
},
//find the first non-image in the selection
getNonImage: function (selected) {
for (var fid in selected) {
if (!imce.isImage(fid)) return fid;
}
return false;
},
//validate current selection for images
validateImage: function () {
var nonImg = imce.getNonImage(imce.selected);
return nonImg ? imce.setMessage(Drupal.t('%filename is not an image.', {'%filename': imce.decode(nonImg)}), 'error') : true;
},
//validate number of selected files
validateSelCount: function (Min, Max) {
if (Min && imce.selcount < Min) {
return imce.setMessage(Min == 1 ? Drupal.t('Please select a file.') : Drupal.t('You must select at least %num files.', {'%num': Min}), 'error');
}
if (Max && Max < imce.selcount) {
return imce.setMessage(Drupal.t('You are not allowed to operate on more than %num files.', {'%num': Max}), 'error');
}
return true;
},
//update file count and dir size
updateStat: function () {
imce.el('file-count').innerHTML = imce.findex.length;
imce.el('dir-size').innerHTML = imce.conf.dirsize;
},
//serialize selected files. return fids with a colon between them
serialNames: function () {
var str = '';
for (var fid in imce.selected) {
str += ':'+ fid;
}
return str.substr(1);
},
//get file url. re-encode & and # for mod rewrite
getURL: function (fid) {
var path = (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid;
return imce.conf.furl + (imce.conf.modfix ? path.replace(/%(23|26)/g, '%25$1') : path);
},
//el. by id
el: function (id) {
return document.getElementById(id);
},
//find the latest selected fid
lastFid: function () {
if (imce.vars.lastfid) return imce.vars.lastfid;
for (var fid in imce.selected);
return fid;
},
//create ajax url
ajaxURL: function (op, dir) {
return imce.conf.url + (imce.conf.clean ? '?' :'&') +'jsop='+ op +'&dir='+ (dir||imce.conf.dir);
},
//fast class check
hasC: function (el, name) {
return el.className && (' '+ el.className +' ').indexOf(' '+ name +' ') != -1;
},
//highlight a single file
highlight: function (fid) {
if (imce.vars.prvfid) imce.fileClick(imce.vars.prvfid);
imce.fileClick(fid);
},
//process a row
processRow: function (row) {
row.cells[0].innerHTML = '<span>' + imce.decodePlain(row.id) + '</span>';
row.onmousedown = function(e) {
var e = e||window.event;
imce.fileClick(this, e.ctrlKey, e.shiftKey);
return !(e.ctrlKey || e.shiftKey);
};
row.ondblclick = function(e) {
imce.send(this.id);
return false;
};
},
//decode urls. uses unescape. can be overridden to use decodeURIComponent
decode: function (str) {
return unescape(str);
},
//decode and convert to plain text
decodePlain: function (str) {
return Drupal.checkPlain(imce.decode(str));
},
//global ajax error function
ajaxError: function (e, response, settings, thrown) {
imce.setMessage(Drupal.ajaxError(response, settings.url).replace(/\n/g, '<br />'), 'error');
},
//convert button elements to standard input buttons
convertButtons: function(form) {
$('button:submit', form).each(function(){
$(this).replaceWith('<input type="submit" value="'+ $(this).text() +'" name="'+ this.name +'" class="form-submit" id="'+ this.id +'" />');
});
},
//create element
newEl: function(name) {
return document.createElement(name);
},
//scroll syncronization for section headers
syncScroll: function(scrlEl, fixEl, bottom) {
var $fixEl = $(fixEl);
var prop = bottom ? 'bottom' : 'top';
var factor = bottom ? -1 : 1;
var syncScrl = function(el) {
$fixEl.css(prop, factor * el.scrollTop);
}
$(scrlEl).scroll(function() {
var el = this;
syncScrl(el);
setTimeout(function() {
syncScrl(el);
});
});
},
//get UI ready. provide backward compatibility.
updateUI: function() {
//file urls.
var furl = imce.conf.furl, isabs = furl.indexOf('://') > -1;
var absurls = imce.conf.absurls = imce.vars.absurls || imce.conf.absurls;
var host = location.host;
var baseurl = location.protocol + '//' + host;
if (furl.charAt(furl.length - 1) != '/') {
furl = imce.conf.furl = furl + '/';
}
imce.conf.modfix = imce.conf.clean && furl.indexOf(host + '/system/') > -1;
if (absurls && !isabs) {
imce.conf.furl = baseurl + furl;
}
else if (!absurls && isabs && furl.indexOf(baseurl) == 0) {
imce.conf.furl = furl.substr(baseurl.length);
}
//convert button elements to input elements.
imce.convertButtons(imce.FW);
//ops-list
$('#ops-list').removeClass('tabs secondary').addClass('clear-block clearfix');
imce.opCloseLink = $(imce.newEl('a')).attr({id: 'op-close-link', href: '#', title: Drupal.t('Close')}).click(function() {
imce.vars.op && imce.opClick(imce.vars.op);
return false;
}).appendTo('#op-contents')[0];
//navigation-header
if (!$('#navigation-header').size()) {
$(imce.NW).children('.navigation-text').attr('id', 'navigation-header').wrapInner('<span></span>');
}
//log
$('#log-prv-wrapper').before($('#log-prv-wrapper > #preview-wrapper')).remove();
$('#log-clearer').remove();
//content resizer
$('#content-resizer').remove();
//message-box
imce.msgBox = imce.el('message-box') || $(imce.newEl('div')).attr('id', 'message-box').prependTo('#imce-content')[0];
//create help tab
var $hbox = $('#help-box');
$hbox.is('a') && $hbox.replaceWith($(imce.newEl('div')).attr('id', 'help-box').append($hbox.children()));
imce.hooks.load.push(function() {
imce.opAdd({name: 'help', title: $('#help-box-title').remove().text(), content: $('#help-box').show()});
});
//add ie classes
$.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7');
// enable box view for file list
imce.vars.boxW && imce.boxView();
//scrolling file list
imce.syncScroll(imce.SBW, '#file-header-wrapper');
imce.syncScroll(imce.SBW, '#dir-stat', true);
//scrolling directory tree
imce.syncScroll(imce.NW, '#navigation-header');
}
};
//initiate
$(document).ready(imce.initiate).ajaxError(imce.ajaxError);
})(jQuery);;
/*
* IMCE Integration by URL
* Ex-1: http://example.com/imce?app=XEditor|url@urlFieldId|width@widthFieldId|height@heightFieldId
* Creates "Insert file" operation tab, which fills the specified fields with url, width, height properties
* of the selected file in the parent window
* Ex-2: http://example.com/imce?app=XEditor|sendto@functionName
* "Insert file" operation calls parent window's functionName(file, imceWindow)
* Ex-3: http://example.com/imce?app=XEditor|imceload@functionName
* Parent window's functionName(imceWindow) is called as soon as IMCE UI is ready. Send to operation
* needs to be set manually. See imce.setSendTo() method in imce.js
*/
(function($) {
var appFields = {}, appWindow = (top.appiFrm||window).opener || parent;
// Execute when imce loads.
imce.hooks.load.push(function(win) {
var index = location.href.lastIndexOf('app=');
if (index == -1) return;
var data = decodeURIComponent(location.href.substr(index + 4)).split('|');
var arr, prop, str, func, appName = data.shift();
// Extract fields
for (var i = 0, len = data.length; i < len; i++) {
str = data[i];
if (!str.length) continue;
if (str.indexOf('&') != -1) str = str.split('&')[0];
arr = str.split('@');
if (arr.length > 1) {
prop = arr.shift();
appFields[prop] = arr.join('@');
}
}
// Run custom onload function if available
if (appFields.imceload && (func = isFunc(appFields.imceload))) {
func(win);
delete appFields.imceload;
}
// Set custom sendto function. appFinish is the default.
var sendtoFunc = appFields.url ? appFinish : false;
//check sendto@funcName syntax in URL
if (appFields.sendto && (func = isFunc(appFields.sendto))) {
sendtoFunc = func;
delete appFields.sendto;
}
// Check old method windowname+ImceFinish.
else if (win.name && (func = isFunc(win.name +'ImceFinish'))) {
sendtoFunc = func;
}
// Highlight file
if (appFields.url) {
// Support multiple url fields url@field1,field2..
if (appFields.url.indexOf(',') > -1) {
var arr = appFields.url.split(',');
for (var i in arr) {
if ($('#'+ arr[i], appWindow.document).size()) {
appFields.url = arr[i];
break;
}
}
}
var filename = $('#'+ appFields.url, appWindow.document).val() || '';
imce.highlight(filename.substr(filename.lastIndexOf('/')+1));
}
// Set send to
sendtoFunc && imce.setSendTo(Drupal.t('Insert file'), sendtoFunc);
});
// Default sendTo function
var appFinish = function(file, win) {
var $doc = $(appWindow.document);
for (var i in appFields) {
$doc.find('#'+ appFields[i]).val(file[i]);
}
if (appFields.url) {
try{
$doc.find('#'+ appFields.url).blur().change().focus();
}catch(e){
try{
$doc.find('#'+ appFields.url).trigger('onblur').trigger('onchange').trigger('onfocus');//inline events for IE
}catch(e){}
}
}
appWindow.focus();
win.close();
};
// Checks if a string is a function name in the given scope.
// Returns function reference. Supports x.y.z notation.
var isFunc = function(str, scope) {
var obj = scope || appWindow;
var parts = str.split('.'), len = parts.length;
for (var i = 0; i < len && (obj = obj[parts[i]]); i++);
return obj && i == len && (typeof obj == 'function' || typeof obj != 'string' && !obj.nodeName && obj.constructor != Array && /^[\s[]?function/.test(obj.toString())) ? obj : false;
}
})(jQuery);;
/**
* Wysiwyg API integration helper function.
*/
function imceImageBrowser(field_name, url, type, win) {
// TinyMCE.
if (win !== 'undefined') {
win.open(Drupal.settings.imce.url + encodeURIComponent(field_name), '', 'width=760,height=560,resizable=1');
}
}
/**
* CKeditor integration.
*/
var imceCkeditSendTo = function (file, win) {
var parts = /\?(?:.*&)?CKEditorFuncNum=(\d+)(?:&|$)/.exec(win.location.href);
if (parts && parts.length > 1) {
CKEDITOR.tools.callFunction(parts[1], file.url);
win.close();
}
else {
throw 'CKEditorFuncNum parameter not found or invalid: ' + win.location.href;
}
};
;
/**
* @file: Popup dialog interfaces for the media project.
*
* Drupal.media.popups.mediaBrowser
* Launches the media browser which allows users to pick a piece of media.
*
* Drupal.media.popups.mediaStyleSelector
* Launches the style selection form where the user can choose
* what format / style they want their media in.
*
*/
(function ($) {
namespace('Drupal.media.popups');
/**
* Media browser popup. Creates a media browser dialog.
*
* @param {function}
* onSelect Callback for when dialog is closed, received (Array
* media, Object extra);
* @param {Object}
* globalOptions Global options that will get passed upon initialization of the browser.
* @see Drupal.media.popups.mediaBrowser.getDefaults();
*
* @param {Object}
* pluginOptions Options for specific plugins. These are passed
* to the plugin upon initialization. If a function is passed here as
* a callback, it is obviously not passed, but is accessible to the plugin
* in Drupal.settings.variables.
*
* Example
* pluginOptions = {library: {url_include_patterns:'/foo/bar'}};
*
* @param {Object}
* widgetOptions Options controlling the appearance and behavior of the
* modal dialog.
* @see Drupal.media.popups.mediaBrowser.getDefaults();
*/
Drupal.media.popups.mediaBrowser = function (onSelect, globalOptions, pluginOptions, widgetOptions) {
var options = Drupal.media.popups.mediaBrowser.getDefaults();
options.global = $.extend({}, options.global, globalOptions);
options.plugins = pluginOptions;
options.widget = $.extend({}, options.widget, widgetOptions);
// Create it as a modal window.
var browserSrc = options.widget.src;
if ($.isArray(browserSrc) && browserSrc.length) {
browserSrc = browserSrc[browserSrc.length - 1];
}
// Params to send along to the iframe. WIP.
var params = {};
$.extend(params, options.global);
params.plugins = options.plugins;
browserSrc += '&' + $.param(params);
var mediaIframe = Drupal.media.popups.getPopupIframe(browserSrc, 'mediaBrowser');
// Attach the onLoad event
mediaIframe.bind('load', options, options.widget.onLoad);
/**
* Setting up the modal dialog
*/
var ok = 'OK';
var cancel = 'Cancel';
var notSelected = 'You have not selected anything!';
if (Drupal && Drupal.t) {
ok = Drupal.t(ok);
cancel = Drupal.t(cancel);
notSelected = Drupal.t(notSelected);
}
// @todo: let some options come through here. Currently can't be changed.
var dialogOptions = options.dialog;
dialogOptions.buttons[ok] = function () {
var selected = this.contentWindow.Drupal.media.browser.selectedMedia;
if (selected.length < 1) {
alert(notSelected);
return;
}
onSelect(selected);
$(this).dialog("destroy");
$(this).remove();
};
dialogOptions.buttons[cancel] = function () {
$(this).dialog("destroy");
$(this).remove();
};
Drupal.media.popups.setDialogPadding(mediaIframe.dialog(dialogOptions));
// Remove the title bar.
mediaIframe.parents(".ui-dialog").find(".ui-dialog-titlebar").remove();
Drupal.media.popups.overlayDisplace(mediaIframe.parents(".ui-dialog"));
return mediaIframe;
};
Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad = function (e) {
var options = e.data;
if (this.contentWindow.Drupal.media.browser.selectedMedia.length > 0) {
var ok = $(this).dialog('option', 'buttons')['OK'];
ok.call(this);
return;
}
};
Drupal.media.popups.mediaBrowser.getDefaults = function () {
return {
global: {
types: [], // Types to allow, defaults to all.
activePlugins: [] // If provided, a list of plugins which should be enabled.
},
widget: { // Settings for the actual iFrame which is launched.
src: Drupal.settings.media.browserUrl, // Src of the media browser (if you want to totally override it)
onLoad: Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad // Onload function when iFrame loads.
},
dialog: Drupal.media.popups.getDialogOptions()
};
};
Drupal.media.popups.mediaBrowser.finalizeSelection = function () {
var selected = this.contentWindow.Drupal.media.browser.selectedMedia;
if (selected.length < 1) {
alert(notSelected);
return;
}
onSelect(selected);
$(this).dialog("destroy");
$(this).remove();
}
/**
* Style chooser Popup. Creates a dialog for a user to choose a media style.
*
* @param mediaFile
* The mediaFile you are requesting this formatting form for.
* @todo: should this be fid? That's actually all we need now.
*
* @param Function
* onSubmit Function to be called when the user chooses a media
* style. Takes one parameter (Object formattedMedia).
*
* @param Object
* options Options for the mediaStyleChooser dialog.
*/
Drupal.media.popups.mediaStyleSelector = function (mediaFile, onSelect, options) {
var defaults = Drupal.media.popups.mediaStyleSelector.getDefaults();
// @todo: remove this awful hack :(
defaults.src = defaults.src.replace('-media_id-', mediaFile.fid);
options = $.extend({}, defaults, options);
// Create it as a modal window.
var mediaIframe = Drupal.media.popups.getPopupIframe(options.src, 'mediaStyleSelector');
// Attach the onLoad event
mediaIframe.bind('load', options, options.onLoad);
/**
* Set up the button text
*/
var ok = 'OK';
var cancel = 'Cancel';
var notSelected = 'Very sorry, there was an unknown error embedding media.';
if (Drupal && Drupal.t) {
ok = Drupal.t(ok);
cancel = Drupal.t(cancel);
notSelected = Drupal.t(notSelected);
}
// @todo: let some options come through here. Currently can't be changed.
var dialogOptions = Drupal.media.popups.getDialogOptions();
dialogOptions.buttons[ok] = function () {
var formattedMedia = this.contentWindow.Drupal.media.formatForm.getFormattedMedia();
if (!formattedMedia) {
alert(notSelected);
return;
}
onSelect(formattedMedia);
$(this).dialog("destroy");
$(this).remove();
};
dialogOptions.buttons[cancel] = function () {
$(this).dialog("destroy");
$(this).remove();
};
Drupal.media.popups.setDialogPadding(mediaIframe.dialog(dialogOptions));
// Remove the title bar.
mediaIframe.parents(".ui-dialog").find(".ui-dialog-titlebar").remove();
Drupal.media.popups.overlayDisplace(mediaIframe.parents(".ui-dialog"));
return mediaIframe;
};
Drupal.media.popups.mediaStyleSelector.mediaBrowserOnLoad = function (e) {
};
Drupal.media.popups.mediaStyleSelector.getDefaults = function () {
return {
src: Drupal.settings.media.styleSelectorUrl,
onLoad: Drupal.media.popups.mediaStyleSelector.mediaBrowserOnLoad
};
};
/**
* Style chooser Popup. Creates a dialog for a user to choose a media style.
*
* @param mediaFile
* The mediaFile you are requesting this formatting form for.
* @todo: should this be fid? That's actually all we need now.
*
* @param Function
* onSubmit Function to be called when the user chooses a media
* style. Takes one parameter (Object formattedMedia).
*
* @param Object
* options Options for the mediaStyleChooser dialog.
*/
Drupal.media.popups.mediaFieldEditor = function (fid, onSelect, options) {
var defaults = Drupal.media.popups.mediaFieldEditor.getDefaults();
// @todo: remove this awful hack :(
defaults.src = defaults.src.replace('-media_id-', fid);
options = $.extend({}, defaults, options);
// Create it as a modal window.
var mediaIframe = Drupal.media.popups.getPopupIframe(options.src, 'mediaFieldEditor');
// Attach the onLoad event
// @TODO - This event is firing too early in IE on Windows 7,
// - so the height being calculated is too short for the content.
mediaIframe.bind('load', options, options.onLoad);
/**
* Set up the button text
*/
var ok = 'OK';
var cancel = 'Cancel';
var notSelected = 'Very sorry, there was an unknown error embedding media.';
if (Drupal && Drupal.t) {
ok = Drupal.t(ok);
cancel = Drupal.t(cancel);
notSelected = Drupal.t(notSelected);
}
// @todo: let some options come through here. Currently can't be changed.
var dialogOptions = Drupal.media.popups.getDialogOptions();
dialogOptions.buttons[ok] = function () {
alert('hell yeah');
return "poo";
var formattedMedia = this.contentWindow.Drupal.media.formatForm.getFormattedMedia();
if (!formattedMedia) {
alert(notSelected);
return;
}
onSelect(formattedMedia);
$(this).dialog("destroy");
$(this).remove();
};
dialogOptions.buttons[cancel] = function () {
$(this).dialog("destroy");
$(this).remove();
};
Drupal.media.popups.setDialogPadding(mediaIframe.dialog(dialogOptions));
// Remove the title bar.
mediaIframe.parents(".ui-dialog").find(".ui-dialog-titlebar").remove();
Drupal.media.popups.overlayDisplace(mediaIframe.parents(".ui-dialog"));
return mediaIframe;
};
Drupal.media.popups.mediaFieldEditor.mediaBrowserOnLoad = function (e) {
};
Drupal.media.popups.mediaFieldEditor.getDefaults = function () {
return {
// @todo: do this for real
src: '/media/-media_id-/edit?render=media-popup',
onLoad: Drupal.media.popups.mediaFieldEditor.mediaBrowserOnLoad
};
};
/**
* Generic functions to both the media-browser and style selector
*/
/**
* Returns the commonly used options for the dialog.
*/
Drupal.media.popups.getDialogOptions = function () {
return {
buttons: {},
dialogClass: 'media-wrapper',
modal: true,
draggable: false,
resizable: false,
minWidth: 600,
width: 800,
height: 550,
position: 'center',
overlay: {
backgroundColor: '#000000',
opacity: 0.4
}
};
};
/**
* Created padding on a dialog
*
* @param jQuery dialogElement
* The element which has .dialog() attached to it.
*/
Drupal.media.popups.setDialogPadding = function (dialogElement) {
// @TODO: Perhaps remove this hardcoded reference to height.
// - It's included to make IE on Windows 7 display the dialog without
// collapsing. 550 is the height that displays all of the tab panes
// within the Add Media overlay. This is either a bug in the jQuery
// UI library, a bug in IE on Windows 7 or a bug in the way the
// dialog is instantiated. Or a combo of the three.
// All browsers except IE on Win7 ignore these defaults and adjust
// the height of the iframe correctly to match the content in the panes
dialogElement.height(dialogElement.dialog('option', 'height'));
dialogElement.width(dialogElement.dialog('option', 'width'));
};
/**
* Get an iframe to serve as the dialog's contents. Common to both plugins.
*/
Drupal.media.popups.getPopupIframe = function (src, id, options) {
var defaults = {width: '800px', scrolling: 'no'};
var options = $.extend({}, defaults, options);
return $('<iframe class="media-modal-frame"/>')
.attr('src', src)
.attr('width', options.width)
.attr('id', id)
.attr('scrolling', options.scrolling);
};
Drupal.media.popups.overlayDisplace = function (dialog) {
if (parent.window.Drupal.overlay) {
var overlayDisplace = parent.window.Drupal.overlay.getDisplacement('top');
if (dialog.offset().top < overlayDisplace) {
dialog.css('top', overlayDisplace);
}
}
}
})(jQuery);
;
/**
* @file
* Attach Media WYSIWYG behaviors.
*/
(function ($) {
Drupal.media = Drupal.media || {};
// Define the behavior.
Drupal.wysiwyg.plugins.media = {
/**
* Initializes the tag map.
*/
initializeTagMap: function () {
if (typeof Drupal.settings.tagmap == 'undefined') {
Drupal.settings.tagmap = { };
}
},
/**
* Execute the button.
* @TODO: Debug calls from this are never called. What's its function?
*/
invoke: function (data, settings, instanceId) {
if (data.format == 'html') {
Drupal.media.popups.mediaBrowser(function (mediaFiles) {
Drupal.wysiwyg.plugins.media.mediaBrowserOnSelect(mediaFiles, instanceId);
}, settings['global']);
}
},
/**
* Respond to the mediaBrowser's onSelect event.
* @TODO: Debug calls from this are never called. What's its function?
*/
mediaBrowserOnSelect: function (mediaFiles, instanceId) {
var mediaFile = mediaFiles[0];
var options = {};
Drupal.media.popups.mediaStyleSelector(mediaFile, function (formattedMedia) {
Drupal.wysiwyg.plugins.media.insertMediaFile(mediaFile, formattedMedia.type, formattedMedia.html, formattedMedia.options, Drupal.wysiwyg.instances[instanceId]);
}, options);
return;
},
insertMediaFile: function (mediaFile, viewMode, formattedMedia, options, wysiwygInstance) {
this.initializeTagMap();
// @TODO: the folks @ ckeditor have told us that there is no way
// to reliably add wrapper divs via normal HTML.
// There is some method of adding a "fake element"
// But until then, we're just going to embed to img.
// This is pretty hacked for now.
//
var imgElement = $(this.stripDivs(formattedMedia));
this.addImageAttributes(imgElement, mediaFile.fid, viewMode, options);
var toInsert = this.outerHTML(imgElement);
// Create an inline tag
var inlineTag = Drupal.wysiwyg.plugins.media.createTag(imgElement);
// Add it to the tag map in case the user switches input formats
Drupal.settings.tagmap[inlineTag] = toInsert;
wysiwygInstance.insert(toInsert);
},
/**
* Gets the HTML content of an element
*
* @param jQuery element
*/
outerHTML: function (element) {
return $('<div>').append( element.eq(0).clone() ).html();
},
addImageAttributes: function (imgElement, fid, view_mode, additional) {
// imgElement.attr('fid', fid);
// imgElement.attr('view_mode', view_mode);
// Class so we can find this image later.
imgElement.addClass('media-image');
this.forceAttributesIntoClass(imgElement, fid, view_mode, additional);
if (additional) {
for (k in additional) {
if (additional.hasOwnProperty(k)) {
if (k === 'attr') {
imgElement.attr(k, additional[k]);
}
}
}
}
},
/**
* Due to problems handling wrapping divs in ckeditor, this is needed.
*
* Going forward, if we don't care about supporting other editors
* we can use the fakeobjects plugin to ckeditor to provide cleaner
* transparency between what Drupal will output <div class="field..."><img></div>
* instead of just <img>, for now though, we're going to remove all the stuff surrounding the images.
*
* @param String formattedMedia
* Element containing the image
*
* @return HTML of <img> tag inside formattedMedia
*/
stripDivs: function (formattedMedia) {
// Check to see if the image tag has divs to strip
var stripped = null;
if ($(formattedMedia).is('img')) {
stripped = this.outerHTML($(formattedMedia));
} else {
stripped = this.outerHTML($('img', $(formattedMedia)));
}
// This will fail if we pass the img tag without anything wrapping it, like we do when re-enabling WYSIWYG
return stripped;
},
/**
* Attach function, called when a rich text editor loads.
* This finds all [[tags]] and replaces them with the html
* that needs to show in the editor.
*
*/
attach: function (content, settings, instanceId) {
var matches = content.match(/\[\[.*?\]\]/g);
this.initializeTagMap();
var tagmap = Drupal.settings.tagmap;
if (matches) {
var inlineTag = "";
for (i = 0; i < matches.length; i++) {
inlineTag = matches[i];
if (tagmap[inlineTag]) {
// This probably needs some work...
// We need to somehow get the fid propogated here.
// We really want to
var tagContent = tagmap[inlineTag];
var mediaMarkup = this.stripDivs(tagContent); // THis is <div>..<img>
var _tag = inlineTag;
_tag = _tag.replace('[[','');
_tag = _tag.replace(']]','');
try {
mediaObj = JSON.parse(_tag);
}
catch(err) {
mediaObj = null;
}
if(mediaObj) {
var imgElement = $(mediaMarkup);
this.addImageAttributes(imgElement, mediaObj.fid, mediaObj.view_mode);
var toInsert = this.outerHTML(imgElement);
content = content.replace(inlineTag, toInsert);
}
}
else {
debug.debug("Could not find content for " + inlineTag);
}
}
}
return content;
},
/**
* Detach function, called when a rich text editor detaches
*/
detach: function (content, settings, instanceId) {
// Replace all Media placeholder images with the appropriate inline json
// string. Using a regular expression instead of jQuery manipulation to
// prevent <script> tags from being displaced.
// @see http://drupal.org/node/1280758.
if (matches = content.match(/<img[^>]+class=([\'"])media-image[^>]*>/gi)) {
for (var i = 0; i < matches.length; i++) {
var imageTag = matches[i];
var inlineTag = Drupal.wysiwyg.plugins.media.createTag($(imageTag));
Drupal.settings.tagmap[inlineTag] = imageTag;
content = content.replace(imageTag, inlineTag);
}
}
return content;
},
/**
* @param jQuery imgNode
* Image node to create tag from
*/
createTag: function (imgNode) {
// Currently this is the <img> itself
// Collect all attribs to be stashed into tagContent
var mediaAttributes = {};
var imgElement = imgNode[0];
var sorter = [];
// @todo: this does not work in IE, width and height are always 0.
for (i=0; i< imgElement.attributes.length; i++) {
var attr = imgElement.attributes[i];
if (attr.specified == true) {
if (attr.name !== 'class') {
sorter.push(attr);
}
else {
// Exctract expando properties from the class field.
var attributes = this.getAttributesFromClass(attr.value);
for (var name in attributes) {
if (attributes.hasOwnProperty(name)) {
var value = attributes[name];
if (value.type && value.type === 'attr') {
sorter.push(value);
}
}
}
}
}
}
sorter.sort(this.sortAttributes);
for (var prop in sorter) {
mediaAttributes[sorter[prop].name] = sorter[prop].value;
}
// The following 5 ifs are dedicated to IE7
// If the style is null, it is because IE7 can't read values from itself
if (jQuery.browser.msie && jQuery.browser.version == '7.0') {
if (mediaAttributes.style === "null") {
var imgHeight = imgNode.css('height');
var imgWidth = imgNode.css('width');
mediaAttributes.style = {
height: imgHeight,
width: imgWidth
}
if (!mediaAttributes['width']) {
mediaAttributes['width'] = imgWidth;
}
if (!mediaAttributes['height']) {
mediaAttributes['height'] = imgHeight;
}
}
// If the attribute width is zero, get the CSS width
if (Number(mediaAttributes['width']) === 0) {
mediaAttributes['width'] = imgNode.css('width');
}
// IE7 does support 'auto' as a value of the width attribute. It will not
// display the image if this value is allowed to pass through
if (mediaAttributes['width'] === 'auto') {
delete mediaAttributes['width'];
}
// If the attribute height is zero, get the CSS height
if (Number(mediaAttributes['height']) === 0) {
mediaAttributes['height'] = imgNode.css('height');
}
// IE7 does support 'auto' as a value of the height attribute. It will not
// display the image if this value is allowed to pass through
if (mediaAttributes['height'] === 'auto') {
delete mediaAttributes['height'];
}
}
// Remove elements from attribs using the blacklist
for (var blackList in Drupal.settings.media.blacklist) {
delete mediaAttributes[Drupal.settings.media.blacklist[blackList]];
}
tagContent = {
"type": 'media',
// @todo: This will be selected from the format form
"view_mode": attributes['view_mode'].value,
"fid" : attributes['fid'].value,
"attributes": mediaAttributes
};
return '[[' + JSON.stringify(tagContent) + ']]';
},
/**
* Forces custom attributes into the class field of the specified image.
*
* Due to a bug in some versions of Firefox
* (http://forums.mozillazine.org/viewtopic.php?f=9&t=1991855), the
* custom attributes used to share information about the image are
* being stripped as the image markup is set into the rich text
* editor. Here we encode these attributes into the class field so
* the data survives.
*
* @param imgElement
* The image
* @fid
* The file id.
* @param view_mode
* The view mode.
* @param additional
* Additional attributes to add to the image.
*/
forceAttributesIntoClass: function (imgElement, fid, view_mode, additional) {
var wysiwyg = imgElement.attr('wysiwyg');
if (wysiwyg) {
imgElement.addClass('attr__wysiwyg__' + wysiwyg);
}
var format = imgElement.attr('format');
if (format) {
imgElement.addClass('attr__format__' + format);
}
var typeOf = imgElement.attr('typeof');
if (typeOf) {
imgElement.addClass('attr__typeof__' + typeOf);
}
if (fid) {
imgElement.addClass('img__fid__' + fid);
}
if (view_mode) {
imgElement.addClass('img__view_mode__' + view_mode);
}
if (additional) {
for (var name in additional) {
if (additional.hasOwnProperty(name)) {
if (name !== 'alt') {
imgElement.addClass('attr__' + name + '__' + additional[name]);
}
}
}
}
},
/**
* Retrieves encoded attributes from the specified class string.
*
* @param classString
* A string containing the value of the class attribute.
* @return
* An array containing the attribute names as keys, and an object
* with the name, value, and attribute type (either 'attr' or
* 'img', depending on whether it is an image attribute or should
* be it the attributes section)
*/
getAttributesFromClass: function (classString) {
var actualClasses = [];
var otherAttributes = [];
var classes = classString.split(' ');
var regexp = new RegExp('^(attr|img)__([^\S]*)__([^\S]*)$');
for (var index = 0; index < classes.length; index++) {
var matches = classes[index].match(regexp);
if (matches && matches.length === 4) {
otherAttributes[matches[2]] = {name: matches[2], value: matches[3], type: matches[1]};
}
else {
actualClasses.push(classes[index]);
}
}
if (actualClasses.length > 0) {
otherAttributes['class'] = {name: 'class', value: actualClasses.join(' '), type: 'attr'};
}
return otherAttributes;
},
/*
*
*/
sortAttributes: function (a, b) {
var nameA = a.name.toLowerCase();
var nameB = b.name.toLowerCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
}
};
})(jQuery);
;
(function ($) {
// @todo Array syntax required; 'break' is a predefined token in JavaScript.
Drupal.wysiwyg.plugins['break'] = {
/**
* Return whether the passed node belongs to this plugin.
*/
isNode: function(node) {
return ($(node).is('img.wysiwyg-break'));
},
/**
* Execute the button.
*/
invoke: function(data, settings, instanceId) {
if (data.format == 'html') {
// Prevent duplicating a teaser break.
if ($(data.node).is('img.wysiwyg-break')) {
return;
}
var content = this._getPlaceholder(settings);
}
else {
// Prevent duplicating a teaser break.
// @todo data.content is the selection only; needs access to complete content.
if (data.content.match(/<!--break-->/)) {
return;
}
var content = '<!--break-->';
}
if (typeof content != 'undefined') {
Drupal.wysiwyg.instances[instanceId].insert(content);
}
},
/**
* Replace all <!--break--> tags with images.
*/
attach: function(content, settings, instanceId) {
content = content.replace(/<!--break-->/g, this._getPlaceholder(settings));
return content;
},
/**
* Replace images with <!--break--> tags in content upon detaching editor.
*/
detach: function(content, settings, instanceId) {
var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :(
// #404532: document.createComment() required or IE will strip the comment.
// #474908: IE 8 breaks when using jQuery methods to replace the elements.
// @todo Add a generic implementation for all Drupal plugins for this.
$.each($('img.wysiwyg-break', $content), function (i, elem) {
elem.parentNode.insertBefore(document.createComment('break'), elem);
elem.parentNode.removeChild(elem);
});
return $content.html();
},
/**
* Helper function to return a HTML placeholder.
*/
_getPlaceholder: function (settings) {
return '<img src="' + settings.path + '/images/spacer.gif" alt="<--break->" title="<--break-->" class="wysiwyg-break drupal-content" />';
}
};
})(jQuery);
;
(function ($) {
/**
* Auto-hide summary textarea if empty and show hide and unhide links.
*/
Drupal.behaviors.textSummary = {
attach: function (context, settings) {
$('.text-summary', context).once('text-summary', function () {
var $widget = $(this).closest('div.field-type-text-with-summary');
var $summaries = $widget.find('div.text-summary-wrapper');
$summaries.once('text-summary-wrapper').each(function(index) {
var $summary = $(this);
var $summaryLabel = $summary.find('label');
var $full = $widget.find('.text-full').eq(index).closest('.form-item');
var $fullLabel = $full.find('label');
// Create a placeholder label when the field cardinality is
// unlimited or greater than 1.
if ($fullLabel.length == 0) {
$fullLabel = $('<label></label>').prependTo($full);
}
// Setup the edit/hide summary link.
var $link = $('<span class="field-edit-link">(<a class="link-edit-summary" href="#">' + Drupal.t('Hide summary') + '</a>)</span>').toggle(
function () {
$summary.hide();
$(this).find('a').html(Drupal.t('Edit summary')).end().appendTo($fullLabel);
return false;
},
function () {
$summary.show();
$(this).find('a').html(Drupal.t('Hide summary')).end().appendTo($summaryLabel);
return false;
}
).appendTo($summaryLabel);
// If no summary is set, hide the summary field.
if ($(this).find('.text-summary').val() == '') {
$link.click();
}
return;
});
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.textarea = {
attach: function (context, settings) {
$('.form-textarea-wrapper.resizable', context).once('textarea', function () {
var staticOffset = null;
var textarea = $(this).addClass('resizable-textarea').find('textarea');
var grippie = $('<div class="grippie"></div>').mousedown(startDrag);
grippie.insertAfter(textarea);
function startDrag(e) {
staticOffset = textarea.height() - e.pageY;
textarea.css('opacity', 0.25);
$(document).mousemove(performDrag).mouseup(endDrag);
return false;
}
function performDrag(e) {
textarea.height(Math.max(32, staticOffset + e.pageY) + 'px');
return false;
}
function endDrag(e) {
$(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag);
textarea.css('opacity', 1);
}
});
}
};
})(jQuery);
;
(function ($) {
/**
* Automatically display the guidelines of the selected text format.
*/
Drupal.behaviors.filterGuidelines = {
attach: function (context) {
$('.filter-guidelines', context).once('filter-guidelines')
.find(':header').hide()
.parents('.filter-wrapper').find('select.filter-list')
.bind('change', function () {
$(this).parents('.filter-wrapper')
.find('.filter-guidelines-item').hide()
.siblings('.filter-guidelines-' + this.value).show();
})
.change();
}
};
})(jQuery);
;
(function ($) {
/**
* Toggle the visibility of a fieldset using smooth animations.
*/
Drupal.toggleFieldset = function (fieldset) {
var $fieldset = $(fieldset);
if ($fieldset.is('.collapsed')) {
var $content = $('> .fieldset-wrapper', fieldset).hide();
$fieldset
.removeClass('collapsed')
.trigger({ type: 'collapsed', value: false })
.find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide'));
$content.slideDown({
duration: 'fast',
easing: 'linear',
complete: function () {
Drupal.collapseScrollIntoView(fieldset);
fieldset.animating = false;
},
step: function () {
// Scroll the fieldset into view.
Drupal.collapseScrollIntoView(fieldset);
}
});
}
else {
$fieldset.trigger({ type: 'collapsed', value: true });
$('> .fieldset-wrapper', fieldset).slideUp('fast', function () {
$fieldset
.addClass('collapsed')
.find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show'));
fieldset.animating = false;
});
}
};
/**
* Scroll a given fieldset into view as much as possible.
*/
Drupal.collapseScrollIntoView = function (node) {
var h = document.documentElement.clientHeight || document.body.clientHeight || 0;
var offset = document.documentElement.scrollTop || document.body.scrollTop || 0;
var posY = $(node).offset().top;
var fudge = 55;
if (posY + node.offsetHeight + fudge > h + offset) {
if (node.offsetHeight > h) {
window.scrollTo(0, posY);
}
else {
window.scrollTo(0, posY + node.offsetHeight - h + fudge);
}
}
};
Drupal.behaviors.collapse = {
attach: function (context, settings) {
$('fieldset.collapsible', context).once('collapse', function () {
var $fieldset = $(this);
// Expand fieldset if there are errors inside, or if it contains an
// element that is targeted by the uri fragment identifier.
var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : '';
if ($('.error' + anchor, $fieldset).length) {
$fieldset.removeClass('collapsed');
}
var summary = $('<span class="summary"></span>');
$fieldset.
bind('summaryUpdated', function () {
var text = $.trim($fieldset.drupalGetSummary());
summary.html(text ? ' (' + text + ')' : '');
})
.trigger('summaryUpdated');
// Turn the legend into a clickable link, but retain span.fieldset-legend
// for CSS positioning.
var $legend = $('> legend .fieldset-legend', this);
$('<span class="fieldset-legend-prefix element-invisible"></span>')
.append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
.prependTo($legend)
.after(' ');
// .wrapInner() does not retain bound events.
var $link = $('<a class="fieldset-title" href="#"></a>')
.prepend($legend.contents())
.appendTo($legend)
.click(function () {
var fieldset = $fieldset.get(0);
// Don't animate multiple times.
if (!fieldset.animating) {
fieldset.animating = true;
Drupal.toggleFieldset(fieldset);
}
return false;
});
$legend.append(summary);
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.menuFieldsetSummaries = {
attach: function (context) {
$('fieldset.menu-link-form', context).drupalSetSummary(function (context) {
if ($('.form-item-menu-enabled input', context).is(':checked')) {
return Drupal.checkPlain($('.form-item-menu-link-title input', context).val());
}
else {
return Drupal.t('Not in menu');
}
});
}
};
/**
* Automatically fill in a menu link title, if possible.
*/
Drupal.behaviors.menuLinkAutomaticTitle = {
attach: function (context) {
$('fieldset.menu-link-form', context).each(function () {
// Try to find menu settings widget elements as well as a 'title' field in
// the form, but play nicely with user permissions and form alterations.
var $checkbox = $('.form-item-menu-enabled input', this);
var $link_title = $('.form-item-menu-link-title input', context);
var $title = $(this).closest('form').find('.form-item-title input');
// Bail out if we do not have all required fields.
if (!($checkbox.length && $link_title.length && $title.length)) {
return;
}
// If there is a link title already, mark it as overridden. The user expects
// that toggling the checkbox twice will take over the node's title.
if ($checkbox.is(':checked') && $link_title.val().length) {
$link_title.data('menuLinkAutomaticTitleOveridden', true);
}
// Whenever the value is changed manually, disable this behavior.
$link_title.keyup(function () {
$link_title.data('menuLinkAutomaticTitleOveridden', true);
});
// Global trigger on checkbox (do not fill-in a value when disabled).
$checkbox.change(function () {
if ($checkbox.is(':checked')) {
if (!$link_title.data('menuLinkAutomaticTitleOveridden')) {
$link_title.val($title.val());
}
}
else {
$link_title.val('');
$link_title.removeData('menuLinkAutomaticTitleOveridden');
}
$checkbox.closest('fieldset.vertical-tabs-pane').trigger('summaryUpdated');
$checkbox.trigger('formUpdated');
});
// Take over any title change.
$title.keyup(function () {
if (!$link_title.data('menuLinkAutomaticTitleOveridden') && $checkbox.is(':checked')) {
$link_title.val($title.val());
$link_title.val($title.val()).trigger('formUpdated');
}
});
});
}
};
})(jQuery);
;
(function ($) {
/**
* Attaches sticky table headers.
*/
Drupal.behaviors.tableHeader = {
attach: function (context, settings) {
if (!$.support.positionFixed) {
return;
}
$('table.sticky-enabled', context).once('tableheader', function () {
$(this).data("drupal-tableheader", new Drupal.tableHeader(this));
});
}
};
/**
* Constructor for the tableHeader object. Provides sticky table headers.
*
* @param table
* DOM object for the table to add a sticky header to.
*/
Drupal.tableHeader = function (table) {
var self = this;
this.originalTable = $(table);
this.originalHeader = $(table).children('thead');
this.originalHeaderCells = this.originalHeader.find('> tr > th');
// Clone the table header so it inherits original jQuery properties. Hide
// the table to avoid a flash of the header clone upon page load.
this.stickyTable = $('<table class="sticky-header"/>')
.insertBefore(this.originalTable)
.css({ position: 'fixed', top: '0px' });
this.stickyHeader = this.originalHeader.clone(true)
.hide()
.appendTo(this.stickyTable);
this.stickyHeaderCells = this.stickyHeader.find('> tr > th');
this.originalTable.addClass('sticky-table');
$(window)
.bind('scroll.drupal-tableheader', $.proxy(this, 'eventhandlerRecalculateStickyHeader'))
.bind('resize.drupal-tableheader', { calculateWidth: true }, $.proxy(this, 'eventhandlerRecalculateStickyHeader'))
// Make sure the anchor being scrolled into view is not hidden beneath the
// sticky table header. Adjust the scrollTop if it does.
.bind('drupalDisplaceAnchor.drupal-tableheader', function () {
window.scrollBy(0, -self.stickyTable.outerHeight());
})
// Make sure the element being focused is not hidden beneath the sticky
// table header. Adjust the scrollTop if it does.
.bind('drupalDisplaceFocus.drupal-tableheader', function (event) {
if (self.stickyVisible && event.clientY < (self.stickyOffsetTop + self.stickyTable.outerHeight()) && event.$target.closest('sticky-header').length === 0) {
window.scrollBy(0, -self.stickyTable.outerHeight());
}
})
.triggerHandler('resize.drupal-tableheader');
// We hid the header to avoid it showing up erroneously on page load;
// we need to unhide it now so that it will show up when expected.
this.stickyHeader.show();
};
/**
* Event handler: recalculates position of the sticky table header.
*
* @param event
* Event being triggered.
*/
Drupal.tableHeader.prototype.eventhandlerRecalculateStickyHeader = function (event) {
var self = this;
var calculateWidth = event.data && event.data.calculateWidth;
// Reset top position of sticky table headers to the current top offset.
this.stickyOffsetTop = Drupal.settings.tableHeaderOffset ? eval(Drupal.settings.tableHeaderOffset + '()') : 0;
this.stickyTable.css('top', this.stickyOffsetTop + 'px');
// Save positioning data.
var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
if (calculateWidth || this.viewHeight !== viewHeight) {
this.viewHeight = viewHeight;
this.vPosition = this.originalTable.offset().top - 4 - this.stickyOffsetTop;
this.hPosition = this.originalTable.offset().left;
this.vLength = this.originalTable[0].clientHeight - 100;
calculateWidth = true;
}
// Track horizontal positioning relative to the viewport and set visibility.
var hScroll = document.documentElement.scrollLeft || document.body.scrollLeft;
var vOffset = (document.documentElement.scrollTop || document.body.scrollTop) - this.vPosition;
this.stickyVisible = vOffset > 0 && vOffset < this.vLength;
this.stickyTable.css({ left: (-hScroll + this.hPosition) + 'px', visibility: this.stickyVisible ? 'visible' : 'hidden' });
// Only perform expensive calculations if the sticky header is actually
// visible or when forced.
if (this.stickyVisible && (calculateWidth || !this.widthCalculated)) {
this.widthCalculated = true;
// Resize header and its cell widths.
this.stickyHeaderCells.each(function (index) {
var cellWidth = self.originalHeaderCells.eq(index).css('width');
// Exception for IE7.
if (cellWidth == 'auto') {
cellWidth = self.originalHeaderCells.get(index).clientWidth + 'px';
}
$(this).css('width', cellWidth);
});
this.stickyTable.css('width', this.originalTable.css('width'));
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.tokenTree = {
attach: function (context, settings) {
$('table.token-tree', context).once('token-tree', function () {
$(this).treeTable();
});
}
};
Drupal.behaviors.tokenInsert = {
attach: function (context, settings) {
// Keep track of which textfield was last selected/focused.
$('textarea, input[type="text"]', context).focus(function() {
Drupal.settings.tokenFocusedField = this;
});
$('.token-click-insert .token-key', context).once('token-click-insert', function() {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function(){
if (typeof Drupal.settings.tokenFocusedField == 'undefined') {
alert(Drupal.t('First click a text field to insert your tokens into.'));
}
else {
var myField = Drupal.settings.tokenFocusedField;
var myValue = $(this).text();
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
$('html,body').animate({scrollTop: $(myField).offset().top}, 500);
}
return false;
});
$(this).html(newThis);
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.metatagFieldsetSummaries = {
attach: function (context) {
$('fieldset.metatags-form', context).drupalSetSummary(function (context) {
var vals = [];
$("input[type='text'], select, textarea", context).each(function() {
var default_name = $(this).attr('name').replace(/\[value\]/, '[default]');
var default_value = $("input[type='hidden'][name='" + default_name + "']", context);
if (default_value.length && default_value.val() == $(this).val()) {
// Meta tag has a default value and form value matches default value.
return true;
}
else if (!default_value.length && !$(this).val().length) {
// Meta tag has no default value and form value is empty.
return true;
}
var label = $("label[for='" + $(this).attr('id') + "']").text();
vals.push(Drupal.t('@label: @value', {
'@label': label.trim(),
'@value': Drupal.truncate($(this).val(), 25) || Drupal.t('None')
}));
});
if (vals.length === 0) {
return Drupal.t('Using defaults');
}
else {
return vals.join('<br />');
}
});
}
};
/**
* Encode special characters in a plain-text string for display as HTML.
*/
Drupal.truncate = function (str, limit) {
if (str.length > limit) {
return str.substr(0, limit) + '...';
}
else {
return str;
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.pathFieldsetSummaries = {
attach: function (context) {
$('fieldset.path-form', context).drupalSetSummary(function (context) {
var path = $('.form-item-path-alias input').val();
var automatic = $('.form-item-path-pathauto input').attr('checked');
if (automatic) {
return Drupal.t('Automatic alias');
}
if (path) {
return Drupal.t('Alias: @alias', { '@alias': path });
}
else {
return Drupal.t('No alias');
}
});
}
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.commentFieldsetSummaries = {
attach: function (context) {
$('fieldset.comment-node-settings-form', context).drupalSetSummary(function (context) {
return Drupal.checkPlain($('.form-item-comment input:checked', context).next('label').text());
});
// Provide the summary for the node type form.
$('fieldset.comment-node-type-settings-form', context).drupalSetSummary(function(context) {
var vals = [];
// Default comment setting.
vals.push($(".form-item-comment select option:selected", context).text());
// Threading.
var threading = $(".form-item-comment-default-mode input:checked", context).next('label').text();
if (threading) {
vals.push(threading);
}
// Comments per page.
var number = $(".form-item-comment-default-per-page select option:selected", context).val();
vals.push(Drupal.t('@number comments per page', {'@number': number}));
return Drupal.checkPlain(vals.join(', '));
});
}
};
})(jQuery);
;
(function ($) {
/**
* Attaches the autocomplete behavior to all required fields.
*/
Drupal.behaviors.autocomplete = {
attach: function (context, settings) {
var acdb = [];
$('input.autocomplete', context).once('autocomplete', function () {
var uri = this.value;
if (!acdb[uri]) {
acdb[uri] = new Drupal.ACDB(uri);
}
var $input = $('#' + this.id.substr(0, this.id.length - 13))
.attr('autocomplete', 'OFF')
.attr('aria-autocomplete', 'list');
$($input[0].form).submit(Drupal.autocompleteSubmit);
$input.parent()
.attr('role', 'application')
.append($('<span class="element-invisible" aria-live="assertive"></span>')
.attr('id', $input.attr('id') + '-autocomplete-aria-live')
);
new Drupal.jsAC($input, acdb[uri]);
});
}
};
/**
* Prevents the form from submitting if the suggestions popup is open
* and closes the suggestions popup when doing so.
*/
Drupal.autocompleteSubmit = function () {
return $('#autocomplete').each(function () {
this.owner.hidePopup();
}).size() == 0;
};
/**
* An AutoComplete object.
*/
Drupal.jsAC = function ($input, db) {
var ac = this;
this.input = $input[0];
this.ariaLive = $('#' + this.input.id + '-autocomplete-aria-live');
this.db = db;
$input
.keydown(function (event) { return ac.onkeydown(this, event); })
.keyup(function (event) { ac.onkeyup(this, event); })
.blur(function () { ac.hidePopup(); ac.db.cancel(); });
};
/**
* Handler for the "keydown" event.
*/
Drupal.jsAC.prototype.onkeydown = function (input, e) {
if (!e) {
e = window.event;
}
switch (e.keyCode) {
case 40: // down arrow.
this.selectDown();
return false;
case 38: // up arrow.
this.selectUp();
return false;
default: // All other keys.
return true;
}
};
/**
* Handler for the "keyup" event.
*/
Drupal.jsAC.prototype.onkeyup = function (input, e) {
if (!e) {
e = window.event;
}
switch (e.keyCode) {
case 16: // Shift.
case 17: // Ctrl.
case 18: // Alt.
case 20: // Caps lock.
case 33: // Page up.
case 34: // Page down.
case 35: // End.
case 36: // Home.
case 37: // Left arrow.
case 38: // Up arrow.
case 39: // Right arrow.
case 40: // Down arrow.
return true;
case 9: // Tab.
case 13: // Enter.
case 27: // Esc.
this.hidePopup(e.keyCode);
return true;
default: // All other keys.
if (input.value.length > 0)
this.populatePopup();
else
this.hidePopup(e.keyCode);
return true;
}
};
/**
* Puts the currently highlighted suggestion into the autocomplete field.
*/
Drupal.jsAC.prototype.select = function (node) {
this.input.value = $(node).data('autocompleteValue');
};
/**
* Highlights the next suggestion.
*/
Drupal.jsAC.prototype.selectDown = function () {
if (this.selected && this.selected.nextSibling) {
this.highlight(this.selected.nextSibling);
}
else if (this.popup) {
var lis = $('li', this.popup);
if (lis.size() > 0) {
this.highlight(lis.get(0));
}
}
};
/**
* Highlights the previous suggestion.
*/
Drupal.jsAC.prototype.selectUp = function () {
if (this.selected && this.selected.previousSibling) {
this.highlight(this.selected.previousSibling);
}
};
/**
* Highlights a suggestion.
*/
Drupal.jsAC.prototype.highlight = function (node) {
if (this.selected) {
$(this.selected).removeClass('selected');
}
$(node).addClass('selected');
this.selected = node;
$(this.ariaLive).html($(this.selected).html());
};
/**
* Unhighlights a suggestion.
*/
Drupal.jsAC.prototype.unhighlight = function (node) {
$(node).removeClass('selected');
this.selected = false;
$(this.ariaLive).empty();
};
/**
* Hides the autocomplete suggestions.
*/
Drupal.jsAC.prototype.hidePopup = function (keycode) {
// Select item if the right key or mousebutton was pressed.
if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
this.input.value = $(this.selected).data('autocompleteValue');
}
// Hide popup.
var popup = this.popup;
if (popup) {
this.popup = null;
$(popup).fadeOut('fast', function () { $(popup).remove(); });
}
this.selected = false;
$(this.ariaLive).empty();
};
/**
* Positions the suggestions popup and starts a search.
*/
Drupal.jsAC.prototype.populatePopup = function () {
var $input = $(this.input);
var position = $input.position();
// Show popup.
if (this.popup) {
$(this.popup).remove();
}
this.selected = false;
this.popup = $('<div id="autocomplete"></div>')[0];
this.popup.owner = this;
$(this.popup).css({
top: parseInt(position.top + this.input.offsetHeight, 10) + 'px',
left: parseInt(position.left, 10) + 'px',
width: $input.innerWidth() + 'px',
display: 'none'
});
$input.before(this.popup);
// Do search.
this.db.owner = this;
this.db.search(this.input.value);
};
/**
* Fills the suggestion popup with any matches received.
*/
Drupal.jsAC.prototype.found = function (matches) {
// If no value in the textfield, do not show the popup.
if (!this.input.value.length) {
return false;
}
// Prepare matches.
var ul = $('<ul></ul>');
var ac = this;
for (key in matches) {
$('<li></li>')
.html($('<div></div>').html(matches[key]))
.mousedown(function () { ac.select(this); })
.mouseover(function () { ac.highlight(this); })
.mouseout(function () { ac.unhighlight(this); })
.data('autocompleteValue', key)
.appendTo(ul);
}
// Show popup with matches, if any.
if (this.popup) {
if (ul.children().size()) {
$(this.popup).empty().append(ul).show();
$(this.ariaLive).html(Drupal.t('Autocomplete popup'));
}
else {
$(this.popup).css({ visibility: 'hidden' });
this.hidePopup();
}
}
};
Drupal.jsAC.prototype.setStatus = function (status) {
switch (status) {
case 'begin':
$(this.input).addClass('throbbing');
$(this.ariaLive).html(Drupal.t('Searching for matches...'));
break;
case 'cancel':
case 'error':
case 'found':
$(this.input).removeClass('throbbing');
break;
}
};
/**
* An AutoComplete DataBase object.
*/
Drupal.ACDB = function (uri) {
this.uri = uri;
this.delay = 300;
this.cache = {};
};
/**
* Performs a cached and delayed search.
*/
Drupal.ACDB.prototype.search = function (searchString) {
var db = this;
this.searchString = searchString;
// See if this string needs to be searched for anyway.
searchString = searchString.replace(/^\s+|\s+$/, '');
if (searchString.length <= 0 ||
searchString.charAt(searchString.length - 1) == ',') {
return;
}
// See if this key has been searched for before.
if (this.cache[searchString]) {
return this.owner.found(this.cache[searchString]);
}
// Initiate delayed search.
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(function () {
db.owner.setStatus('begin');
// Ajax GET request for autocompletion.
$.ajax({
type: 'GET',
url: db.uri + '/' + encodeURIComponent(searchString),
dataType: 'json',
success: function (matches) {
if (typeof matches.status == 'undefined' || matches.status != 0) {
db.cache[searchString] = matches;
// Verify if these are still the matches the user wants to see.
if (db.searchString == searchString) {
db.owner.found(matches);
}
db.owner.setStatus('found');
}
},
error: function (xmlhttp) {
alert(Drupal.ajaxError(xmlhttp, db.uri));
}
});
}, this.delay);
};
/**
* Cancels the current autocomplete request.
*/
Drupal.ACDB.prototype.cancel = function () {
if (this.owner) this.owner.setStatus('cancel');
if (this.timer) clearTimeout(this.timer);
this.searchString = '';
};
})(jQuery);
;
(function ($) {
Drupal.behaviors.nodeFieldsetSummaries = {
attach: function (context) {
$('fieldset.node-form-revision-information', context).drupalSetSummary(function (context) {
var revisionCheckbox = $('.form-item-revision input', context);
// Return 'New revision' if the 'Create new revision' checkbox is checked,
// or if the checkbox doesn't exist, but the revision log does. For users
// without the "Administer content" permission the checkbox won't appear,
// but the revision log will if the content type is set to auto-revision.
if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $('.form-item-log textarea', context).length)) {
return Drupal.t('New revision');
}
return Drupal.t('No revision');
});
$('fieldset.node-form-author', context).drupalSetSummary(function (context) {
var name = $('.form-item-name input', context).val() || Drupal.settings.anonymous,
date = $('.form-item-date input', context).val();
return date ?
Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
Drupal.t('By @name', { '@name': name });
});
$('fieldset.node-form-options', context).drupalSetSummary(function (context) {
var vals = [];
$('input:checked', context).parent().each(function () {
vals.push(Drupal.checkPlain($.trim($(this).text())));
});
if (!$('.form-item-status input', context).is(':checked')) {
vals.unshift(Drupal.t('Not published'));
}
return vals.join(', ');
});
}
};
})(jQuery);
;
| ghigata/prowood | sites/default/files/js/js_kJRR2EPkdTyr2CIdeTvE1Z1h-ltSkNI_HTuwHAsTNDE.js | JavaScript | gpl-2.0 | 95,145 |
<?php
require_once OPS_APPLICATION_PATH
. '/services/Optimization/Analyzer/Abstract/Base.php';
class Ops_Service_Optimization_Analyzer_KeywordInPattern
extends Ops_Service_Optimization_Analyzer_Abstract_Base
{
public function __invoke($pattern, $keyword=NULL, $contentType='html')
{
$content = $this->_parent->getData($contentType);
if (is_null($keyword)) {
$keyword = $this->_parent->getData('keyword');
}
if (!preg_match_all($pattern, $content, $matches)) {
return FALSE;
}
foreach ($matches[1] as $match) {
if ($this->_parent
->analyzeKeywordInText($match, $keyword)
) {
return TRUE;
}
}
return FALSE;
}
} | tranvanhoa533/ecommerce_assignment2 | wp-content/plugins/wp-onpage-seo/application/services/Optimization/Analyzer/KeywordInPattern.php | PHP | gpl-2.0 | 789 |
/*
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/
YUI.add('ez-dashboardview', function (Y) {
"use strict";
/**
* Provides the Dashboard View class
*
* @module ez-dashboardview
*/
Y.namespace('eZ');
/**
* The dashboard view
*
* @namespace eZ
* @class DashboardView
* @constructor
* @extends eZ.TemplateBasedView
*/
Y.eZ.DashboardView = Y.Base.create('dashboardView', Y.eZ.TemplateBasedView, [Y.eZ.HeightFit], {
initializer: function () {
this.after('activeChange', this._setIFrameSource);
},
/**
* Renders the dashboard view
*
* @method render
* @return {eZ.DashboardView} the view itself
*/
render: function () {
this.get('container').setHTML(this.template());
this._attachedViewEvents.push(Y.on("windowresize", Y.bind(this._uiSetHeight, this, 0)));
return this;
},
/**
* Sets the source of the iframe to the value of the iframeSource attribute.
*
* @method _setIFrameSource
* @private
*/
_setIFrameSource: function () {
this.get('container').one('.ez-dashboard-content').set('src', this.get('iframeSource'));
}
}, {
ATTRS: {
/**
* Stores the iframe Source
*
* @attribute iframeSource
* @type String
* @default 'http://ez.no/in-product/eZ-Platform'
* @readOnly
*/
iframeSource: {
value: '//ez.no/in-product/eZ-Platform',
readOnly: true,
},
},
});
});
| StephaneDiot/PlatformUIBundle-1 | Resources/public/js/views/ez-dashboardview.js | JavaScript | gpl-2.0 | 1,838 |
window.addEvent("domready", function() {
var carousel = new iCarousel("carousel_content", {
idPrevious: "carousel_prev",
idNext: "carousel_next",
idToggle: "undefined",
item: {
klass: "carouselitem_right",
size: 265
},
animation: {
type: "scroll",
duration: 700,
amount: 1
}
});
$$('.carousel_header a').each(function (el,index){
el.addEvent("click", function(event){
new Event(event).stop();
carousel.goTo(index);
$$('.carousel_header a').removeClass('active');
$('carousel_link'+index).addClass('active');
});
});
}); | thtinh/hb | templates/vxg_hb/js/carousel_impl.js | JavaScript | gpl-2.0 | 715 |
/*
* Copyright 2000-2015 Rochus Keller <mailto:rkeller@nmr.ch>
*
* This file is part of the CARA (Computer Aided Resonance Assignment,
* see <http://cara.nmr.ch/>) NMR Application Framework (NAF) library.
*
* The following is the license that applies to this copy of the
* library. For a license to use the library under conditions
* other than those described here, please email to rkeller@nmr.ch.
*
* GNU General Public License Usage
* This file may be used under the terms of the GNU General Public
* License (GPL) versions 2.0 or 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in
* the packaging of this file. Please review the following information
* to ensure GNU General Public Licensing requirements will be met:
* http://www.fsf.org/licensing/licenses/info/GPLv2.html and
* http://www.gnu.org/copyleft/gpl.html.
*/
#include "StarLexer.h"
#include <QtDebug>
#include <QTextStream>
using namespace Star;
enum { BEL = 7,
USC = 0x5F, // Underscore
LCB = 0x7B, // Left Curly Bracket
RCB = 0x7D, // Right Curly Bracket
LSB = 0x5B, // Left Square Bracket
RSB = 0x5D, // Right Square Bracket
CMA = 0x2C, // Comma
APO = 0x27, // Apostrophe
QOT = 0x22, // Quote
SEM = 0x3B, // Semicolon
COL = 0x3A, // Colon
PND = 0x23, // Pound
DLR = 0x24 // Dollar
};
StarLexer::StarLexer(bool newSyntax) :
d_lineNr(0),d_colNr(0),d_newSyntax(newSyntax),d_in(0)
{
}
StarLexer::StarLexer(const StarLexer & rhs):
d_lineNr(0),d_colNr(0),d_newSyntax(true),d_in(0)
{
*this = rhs;
}
StarLexer::~StarLexer()
{
if( d_in )
delete d_in;
}
bool StarLexer::setStream(QIODevice *in, const char *codec)
{
if( in == 0 )
{
if( d_in )
delete d_in;
// das muss so sein; wenn erst im Destruktor gelöscht oder Stream sogar ein Value Object, dann stürzt
// Prozess beim Löschen von Lexer in QObject bzw. dessen Mutex.
d_in = 0;
return false;
}
if( !in->isOpen() )
{
if( !in->open( QIODevice::ReadOnly ) )
return false;
}
if( d_in == 0 )
d_in = new QTextStream();
d_in->setAutoDetectUnicode(false);
d_in->setDevice( in );
d_in->setCodec( codec );
d_in->setAutoDetectUnicode(true);
d_lineNr = 0;
d_colNr = 0;
d_line.clear();
return true;
}
void StarLexer::reset()
{
d_in->seek(0);
d_in->reset();
d_in->resetStatus();
d_lineNr = 0;
d_colNr = 0;
d_line.clear();
}
StarLexer::Token StarLexer::nextToken()
{
skipWhiteSpace();
while( d_colNr >= d_line.size() )
{
if( d_in->atEnd() )
return Token( Token::EndOfStream, d_lineNr, d_colNr );
nextLine();
if( !checkLineChars() )
return Token( Token::InvalidChar, d_lineNr, d_colNr, d_line );
skipWhiteSpace();
}
Q_ASSERT( d_colNr < d_line.size() );
const int uc = d_line[d_colNr].unicode();
switch( uc )
{
case USC:
return readTag();
case QOT:
if( d_newSyntax && matchTuple( d_colNr+1, QOT, 2 ) )
return readTrippleQuotString(QOT);
else
return readSingleQuotString(QOT);
case APO:
if( d_newSyntax && matchTuple( d_colNr+1, APO, 2 ) )
return readTrippleQuotString(APO);
else
return readSingleQuotString(APO);
case SEM:
if( d_colNr == 0 )
return readSemicolonString();
else
return Token( Token::SyntaxError, d_lineNr, d_colNr, QChar(';') );
case PND:
{
const int col = d_colNr;
const QString cmt = d_line.mid(d_colNr);
d_colNr = d_line.size();
return Token( Token::Comment, d_lineNr, col, cmt );
}
default:
break;
}
if( d_newSyntax )
{
switch( uc )
{
case LCB:
return Token( Token::TableStart, d_lineNr, d_colNr++ );
case RCB:
{
if( (d_colNr + 1) < d_line.size() && d_line[d_colNr+1].unicode() == DLR )
{
d_colNr++;
return Token( Token::RefEnd, d_lineNr, d_colNr++ );
}else
return Token( Token::TableEnd, d_lineNr, d_colNr++ );
}
case LSB:
return Token( Token::ListStart, d_lineNr, d_colNr++ );
case RSB:
return Token( Token::ListEnd, d_lineNr, d_colNr++ );
case CMA:
return Token( Token::ElemSep, d_lineNr, d_colNr++ );
case COL:
return Token( Token::KeyValueSep, d_lineNr, d_colNr++ );
default:
break;
}
}
switch( uc )
{
case DLR:
if( d_newSyntax && (d_colNr + 1) < d_line.size() && d_line[d_colNr+1].unicode() == LCB )
{
d_colNr++;
return Token( Token::RefStart, d_lineNr, d_colNr++ );
}// else fall through
default:
{
const int col = d_colNr;
const QString val = readNonWhiteSpace();
if( val.startsWith( QLatin1String("loop_"), Qt::CaseInsensitive ) )
return Token( Token::Loop, d_lineNr, col, val.mid(5) );
else if( val.startsWith( QLatin1String("global_"), Qt::CaseInsensitive ) )
return Token( Token::Global, d_lineNr, col, val.mid(7) );
else if( val.startsWith( QLatin1String("save_"), Qt::CaseInsensitive ) )
return Token( Token::Save, d_lineNr, col, val.mid(5) );
else if( val.startsWith( QLatin1String("stop_"), Qt::CaseInsensitive ) )
return Token( Token::Stop, d_lineNr, col, val.mid(5) );
else if( val.startsWith( QLatin1String("data_"), Qt::CaseInsensitive ) )
return Token( Token::Data, d_lineNr, col, val.mid(5) );
else
return Token( Token::NonQuoted, d_lineNr, col, val );
}
}
Q_ASSERT( false );
return Token( Token::SyntaxError, d_lineNr, d_colNr, QChar(';') );
}
StarLexer::Token StarLexer::nextTokenNoComments()
{
Token t = nextToken();
while( t.d_type == Token::Comment )
t = nextToken();
return t;
}
void StarLexer::dump()
{
Token t = nextToken();
while( t.d_type < Token::EndOfStream )
{
qDebug() << "****" << t.typeName() << t.d_line << t.d_col << t.d_text;
t = nextToken();
}
qDebug() << "****" << t.typeName() << t.d_line << t.d_col << t.d_text;
}
StarLexer &StarLexer::operator =(const StarLexer &rhs)
{
d_newSyntax = rhs.d_newSyntax;
return *this;
}
void StarLexer::nextLine()
{
d_colNr = 0;
d_lineNr++;
d_line = d_in->readLine();
}
void StarLexer::skipWhiteSpace()
{
while( d_colNr < d_line.size() && d_line[d_colNr].isSpace() )
d_colNr++;
}
bool StarLexer::isValid(const QChar &ch) const
{
const ulong uc = ch.unicode();
if( uc <= 127 )
return ch.isSpace() || ch.isPunct() || ch.isPrint() || ( d_newSyntax && uc == BEL );
else if( d_newSyntax && uc >= 128 && uc <= 0xD7FF )
return true;
else if( d_newSyntax && uc >= 0xE000 && uc <= 0xFFFD )
return true;
else if( d_newSyntax && uc >= 0x10000 && uc <= 0x10FFF )
return true;
return false;
}
bool StarLexer::checkLineChars()
{
for( int i = 0; i < d_line.size(); i++ )
{
if( !isValid( d_line[i] ) )
{
d_colNr = i;
return false;
}
}
return true;
}
StarLexer::Token StarLexer::readTag()
{
const int col = d_colNr;
QString res;
res.reserve( d_line.size() - d_colNr );
while( d_colNr < d_line.size() && !d_line[d_colNr].isSpace() )
{
res += d_line[d_colNr];
d_colNr++;
}
return Token( Token::Tag, d_lineNr, col, res.mid(1) ); // mid..ohne USC
}
StarLexer::Token StarLexer::readSingleQuotString(int sym)
{
QString res;
res.reserve( d_line.size() - d_colNr );
Q_ASSERT( d_colNr < d_line.size() && d_line[d_colNr].unicode() == sym );
d_colNr++;
const int col = d_colNr;
while( d_colNr < d_line.size() )
{
if( d_newSyntax && d_line[d_colNr].unicode() == BEL )
{
if( ( d_colNr + 1 ) < d_line.size() && d_line[d_colNr+1].unicode() == sym )
{
res += QChar(sym);
d_colNr++;
}else
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
}else if( d_line[d_colNr].unicode() == sym )
{
if( !d_newSyntax && ( d_colNr + 1 ) < d_line.size() && !d_line[d_colNr+1].isSpace() )
{
res += d_line[d_colNr];
}else
{
d_colNr++;
return Token( Token::Quoted, d_lineNr, col, res );
}
}else
res += d_line[d_colNr];
d_colNr++;
}
return Token( Token::SyntaxError, d_lineNr, d_colNr, res ); // Zeilenende ohne abschliessendes sym
}
StarLexer::Token StarLexer::readTrippleQuotString(int sym)
{
Q_ASSERT( d_newSyntax );
const QString pattern( 3, QChar(sym) );
Q_ASSERT( ( d_colNr + 2 ) < d_line.size() && d_line.mid(d_colNr,3) == pattern );
d_colNr += 3;
const int col = d_colNr;
const int line = d_lineNr;
const int lhsPos = findTripple( pattern, d_colNr );
bool ok;
if( lhsPos >= 0 )
{
// Ende auf gleicher Zeile
const QString res = escapeString( d_line.mid( d_colNr, lhsPos - d_colNr ), sym, &ok );
if( ok )
{
d_colNr = lhsPos + 3;
return Token( Token::Multiline, line, col, res );
}else
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
}else if( lhsPos == -1 )
{
// Ende auf künftiger Zeile
QString res = escapeString( d_line.mid( d_colNr ), sym, &ok ) + QChar('\n');
if( !ok )
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
while( true )
{
if( d_in->atEnd() )
return Token( Token::SyntaxError, d_lineNr, d_colNr, res ); // TrippleQuote without end
nextLine();
if( !checkLineChars() )
return Token( Token::InvalidChar, d_lineNr, d_colNr, QString(d_line[d_colNr]) );
const int rhsPos = findTripple( pattern, d_colNr );
if( rhsPos >= 0 )
{
// Ende auf dieser Zeile
res += escapeString( d_line.mid( d_colNr, rhsPos - d_colNr ), sym, &ok );
if( ok )
{
d_colNr = rhsPos + 3;
return Token( Token::Multiline, line, col, res );
}else
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
}else if( rhsPos == -1 )
{
// Ende noch nicht auf dieser Zeile
res += escapeString(d_line, sym, &ok ) + QChar('\n');
if( !ok )
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
}else
return Token( Token::SyntaxError, d_lineNr, d_colNr, d_line.mid(d_colNr) );
}
Q_ASSERT( false );
return Token( Token::SyntaxError, d_lineNr, d_colNr, res );
}else
return Token( Token::SyntaxError, d_lineNr, d_colNr, d_line.mid(d_colNr) );
}
StarLexer::Token StarLexer::readSemicolonString()
{
Q_ASSERT( d_colNr == 0 && !d_line.isEmpty() && d_line[0].unicode() == SEM );
QString res = d_line.mid(1) + QChar('\n');
const int col = d_colNr + 1;
const int line = d_lineNr;
while( true )
{
if( d_in->atEnd() )
return Token( Token::SyntaxError, d_lineNr, d_colNr, res ); // Semicolon String without end
nextLine();
if( !checkLineChars() )
return Token( Token::InvalidChar, d_lineNr, d_colNr, QString(d_line[d_colNr]) );
if( !d_line.isEmpty() && d_line[0].unicode() == SEM )
{
// Ende gefunden
d_colNr++;
return Token( Token::Multiline, line, col, res );
}else
{
// Ende noch nicht gefunden; ganze Zeile gehört zu String
res += d_line + QChar('\n');
}
}
Q_ASSERT( false );
return Token( Token::SyntaxError, d_lineNr, d_colNr );
}
QString StarLexer::readNonWhiteSpace()
{
QString res;
res.reserve( d_line.size() - d_colNr );
const QString pattern = (d_newSyntax) ? QLatin1String("{}[],") : QLatin1String("");
while( d_colNr < d_line.size() && !d_line[d_colNr].isSpace() && !pattern.contains(d_line[d_colNr]) )
{
res += d_line[d_colNr];
d_colNr++;
}
return res;
}
int StarLexer::findTripple( const QString& pattern, int from) const
{
Q_ASSERT( d_newSyntax );
Q_ASSERT( !pattern.isEmpty() );
int pos = d_line.indexOf( pattern, from );
if( pos != -1 )
{
Q_ASSERT( pos > 0 );
if( d_line[pos-1].unicode() == BEL )
{
if( (pos + 3) < d_line.size() && d_line[pos+3] == pattern[0] )
return pos + 1; // BEL, QOT, QOT, QOT, QOT
else
return -2; // error, BEL, QOT, QOT, QOT
}
}
return pos; // -1..not found
}
QString StarLexer::escapeString(const QString &str, int sym, bool *ok) const
{
Q_ASSERT( d_newSyntax );
int col = 0;
QString res;
res.reserve( str.size() );
while( col < str.size() )
{
if( str[col].unicode() == BEL )
{
if( ( col + 1 ) < str.size() && str[col+1].unicode() == sym )
{
res += QChar(sym);
col++;
}else
{
if( ok )
*ok = false;
return res;
}
}else
res += str[col];
col++;
}
if( ok )
*ok = true;
return res;
}
bool StarLexer::matchTuple(int cur, int sym, int count) const
{
Q_ASSERT( d_newSyntax );
for( int i = cur; i < ( cur + count ); i++ )
{
if( i >= d_line.size() )
return false;
if( d_line[i].unicode() != sym )
return false;
}
return true;
}
const char *StarLexer::Token::typeName() const
{
static const char* names[] = { "Null",
"Comment",
"Global", "Data", "Save", // Cells
"Loop", "Stop", // Loops
"Tag",
"Quoted", "NonQuoted", "Multiline", // Values
"ListStart", "ListEnd",
"TableStart", "TableEnd",
"RefStart", "RefEnd",
"ElemSep",
"KeyValueSep",
"EndOfStream",
"InvalidChar", "SyntaxError"
};
return names[d_type];
}
bool StarLexer::Token::isDataValue() const
{
switch( d_type )
{
case Quoted:
case NonQuoted:
case Multiline:
case ListStart:
case TableStart:
case RefStart:
return true;
default:
return false;
}
}
| rochus-keller/NAF | Star/StarLexer.cpp | C++ | gpl-2.0 | 12,894 |
<?php
/**
* Categorize
*
* Flow controller for category management interfaces
*
* @version 1.0
* @package ecart
* @subpackage categories
**/
class Categorize extends AdminController {
/**
* Categorize constructor
*
* @return void
**/
function __construct () {
parent::__construct();
if (!empty($_GET['id']) && !isset($_GET['a'])) {
wp_enqueue_script('postbox');
if ( user_can_richedit() ) {
wp_enqueue_script('editor');
wp_enqueue_script('quicktags');
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 20 );
}
ecart_enqueue_script('colorbox');
ecart_enqueue_script('editors');
ecart_enqueue_script('category-editor');
ecart_enqueue_script('priceline');
ecart_enqueue_script('ocupload');
ecart_enqueue_script('swfupload');
ecart_enqueue_script('ecart-swfupload-queue');
do_action('ecart_category_editor_scripts');
add_action('admin_head',array(&$this,'layout'));
} elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') {
ecart_enqueue_script('category-arrange');
do_action('ecart_category_arrange_scripts');
add_action('admin_print_scripts',array(&$this,'arrange_cols'));
} elseif (!empty($_GET['a']) && $_GET['a'] == 'products') {
ecart_enqueue_script('products-arrange');
do_action('ecart_category_products_arrange_scripts');
add_action('admin_print_scripts',array(&$this,'products_cols'));
} else add_action('admin_print_scripts',array(&$this,'columns'));
do_action('ecart_category_admin_scripts');
add_action('load-ecart_page_ecart-categories',array(&$this,'workflow'));
}
/**
* Parses admin requests to determine which interface to display
*
* @since 1.0
* @return void
**/
function admin () {
if (!empty($_GET['id']) && !isset($_GET['a'])) $this->editor();
elseif (!empty($_GET['id']) && isset($_GET['a']) && $_GET['a'] == "products") $this->products();
else $this->categories();
}
/**
* Handles loading, saving and deleting categories in a workflow context
*
* @since 1.0
* @return void
**/
function workflow () {
global $Ecart;
$db =& DB::get();
$defaults = array(
'page' => false,
'deleting' => false,
'delete' => false,
'id' => false,
'save' => false,
'duplicate' => false,
'next' => false
);
$args = array_merge($defaults,$_REQUEST);
extract($args,EXTR_SKIP);
if (!defined('WP_ADMIN') || !isset($page)
|| $page != $this->Admin->pagename('categories'))
return false;
$adminurl = admin_url('admin.php');
if ($page == $this->Admin->pagename('categories')
&& !empty($deleting)
&& !empty($delete)
&& is_array($delete)) {
foreach($delete as $deletion) {
$Category = new Category($deletion);
if (empty($Category->id)) continue;
$db->query("UPDATE $Category->_table SET parent=0 WHERE parent=$Category->id");
$Category->delete();
}
$redirect = (add_query_arg(array_merge($_GET,array('delete'=>null,'deleting'=>null)),$adminurl));
ecart_redirect($redirect);
}
if ($id && $id != "new")
$Ecart->Category = new Category($id);
else $Ecart->Category = new Category();
if ($save) {
$this->save($Ecart->Category);
$this->Notice = '<strong>'.stripslashes($Ecart->Category->name).'</strong> '.__('has been saved.','Ecart');
if ($next) {
if ($next != "new")
$Ecart->Category = new Category($next);
else $Ecart->Category = new Category();
} else {
if (empty($id)) $id = $Ecart->Category->id;
$Ecart->Category = new Category($id);
}
}
}
/**
* Interface processor for the category list manager
*
* @since 1.0
* @return void
**/
function categories ($workflow=false) {
global $Ecart;
$db = DB::get();
if ( !(is_ecart_userlevel() || current_user_can('ecart_categories')) )
wp_die(__('You do not have sufficient permissions to access this page.'));
$defaults = array(
'pagenum' => 1,
'per_page' => 20,
's' => '',
'a' => ''
);
$args = array_merge($defaults,$_GET);
extract($args,EXTR_SKIP);
if ('arrange' == $a) {
$this->init_positions();
$per_page = 300;
}
$pagenum = absint( $pagenum );
if ( empty($pagenum) )
$pagenum = 1;
if( !$per_page || $per_page < 0 )
$per_page = 20;
$start = ($per_page * ($pagenum-1));
$filters = array();
// $filters['limit'] = "$start,$per_page";
if (!empty($s)) $filters['where'] = "cat.name LIKE '%$s%'";
$table = DatabaseObject::tablename(Category::$table);
$Catalog = new Catalog();
$Catalog->outofstock = true;
if ($workflow) {
$filters['columns'] = "cat.id,cat.parent,cat.priority";
$results = $Catalog->load_categories($filters,false,true);
return array_slice($results,$start,$per_page);
} else {
if ('arrange' == $a) {
$filters['columns'] = "cat.id,cat.parent,cat.priority,cat.name,cat.uri,cat.slug";
$filters['parent'] = '0';
} else $filters['columns'] = "cat.id,cat.parent,cat.priority,cat.name,cat.description,cat.uri,cat.slug,cat.spectemplate,cat.facetedmenus,count(DISTINCT pd.id) AS total";
$Catalog->load_categories($filters);
$Categories = array_slice($Catalog->categories,$start,$per_page);
}
$count = $db->query("SELECT count(*) AS total FROM $table");
$num_pages = ceil($count->total / $per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( array('edit'=>null,'pagenum' => '%#%' )),
'format' => '',
'total' => $num_pages,
'current' => $pagenum
));
$action = esc_url(
add_query_arg(
array_merge(stripslashes_deep($_GET),array('page'=>$this->Admin->pagename('categories'))),
admin_url('admin.php')
)
);
if ('arrange' == $a) {
include(ECART_ADMIN_PATH."/categories/arrange.php");
return;
}
include(ECART_ADMIN_PATH."/categories/categories.php");
}
/**
* Registers column headings for the category list manager
*
* @since 1.0
* @return void
**/
function columns () {
register_column_headers('ecart_page_ecart-categories', array(
'cb'=>'<input type="checkbox" />',
'name'=>__('Name','Ecart'),
'links'=>__('Products','Ecart'),
'templates'=>__('Templates','Ecart'),
'menus'=>__('Menus','Ecart'))
);
}
/**
* Provides the core interface layout for the category editor
*
* @since 1.0
* @return void
**/
function layout () {
global $Ecart;
$Admin =& $Ecart->Flow->Admin;
include(ECART_ADMIN_PATH."/categories/ui.php");
}
/**
* Registers column headings for the category list manager
*
* @since 1.0
* @return void
**/
function arrange_cols () {
register_column_headers('ecart_page_ecart-categories', array(
'cat'=>__('Category','Ecart'),
'move'=>'<div class="move"> </div>')
);
}
/**
* Interface processor for the category editor
*
* @since 1.0
* @return void
**/
function editor () {
global $Ecart,$CategoryImages;
$db = DB::get();
if ( !(is_ecart_userlevel() || current_user_can('ecart_categories')) )
wp_die(__('You do not have sufficient permissions to access this page.'));
if (empty($Ecart->Category)) $Category = new Category();
else $Category = $Ecart->Category;
$Category->load_images();
$Price = new Price();
$priceTypes = array(
array('value'=>'Shipped','label'=>__('Shipped','Ecart')),
array('value'=>'Virtual','label'=>__('Virtual','Ecart')),
array('value'=>'Download','label'=>__('Download','Ecart')),
array('value'=>'Donation','label'=>__('Donation','Ecart')),
array('value'=>'N/A','label'=>__('N/A','Ecart'))
);
// Build permalink for slug editor
$permalink = trailingslashit(ecarturl())."category/";
$Category->slug = apply_filters('editable_slug',$Category->slug);
if (!empty($Category->slug))
$permalink .= substr($Category->uri,0,strpos($Category->uri,$Category->slug));
$pricerange_menu = array(
"disabled" => __('Price ranges disabled','Ecart'),
"auto" => __('Build price ranges automatically','Ecart'),
"custom" => __('Use custom price ranges','Ecart'),
);
$categories_menu = $this->menu($Category->parent,$Category->id);
$categories_menu = '<option value="0">'.__('Parent Category','Ecart').'…</option>'.$categories_menu;
$uploader = $Ecart->Settings->get('uploader_pref');
if (!$uploader) $uploader = 'flash';
$workflows = array(
"continue" => __('Continue Editing','Ecart'),
"close" => __('Categories Manager','Ecart'),
"new" => __('New Category','Ecart'),
"next" => __('Edit Next','Ecart'),
"previous" => __('Edit Previous','Ecart')
);
include(ECART_ADMIN_PATH."/categories/category.php");
}
/**
* Handles saving updated category information from the category editor
*
* @since 1.0
* @return void
**/
function save ($Category) {
global $Ecart;
$Settings = &EcartSettings();
$db = DB::get();
check_admin_referer('ecart-save-category');
if ( !(is_ecart_userlevel() || current_user_can('ecart_categories')) )
wp_die(__('You do not have sufficient permissions to access this page.'));
$Settings->saveform(); // Save workflow setting
$Ecart->Catalog = new Catalog();
$Ecart->Catalog->load_categories(array(
'columns' => "cat.id,cat.parent,cat.name,cat.description,cat.uri,cat.slug",
'where' => array(),
'joins' => array(),
'orderby' => false,
'order' => false,
'outofstock' => true
));
$Category->update_slug();
if (!empty($_POST['deleteImages'])) {
$deletes = array();
if (strpos($_POST['deleteImages'],",")) $deletes = explode(',',$_POST['deleteImages']);
else $deletes = array($_POST['deleteImages']);
$Category->delete_images($deletes);
}
// Variation price templates
if (!empty($_POST['price']) && is_array($_POST['price'])) {
foreach ($_POST['price'] as &$pricing) {
$pricing['price'] = floatvalue($pricing['price'],false);
$pricing['saleprice'] = floatvalue($pricing['saleprice'],false);
$pricing['shipfee'] = floatvalue($pricing['shipfee'],false);
}
$Category->prices = stripslashes_deep($_POST['price']);
} else $Category->prices = array();
if (empty($_POST['specs'])) $Category->specs = array();
else $_POST['specs'] = stripslashes_deep($_POST['specs']);
if (empty($_POST['options'])
|| (count($_POST['options']['v'])) == 1 && !isset($_POST['options']['v'][1]['options'])) {
$_POST['options'] = $Category->options = array();
$_POST['prices'] = $Category->prices = array();
} else $_POST['options'] = stripslashes_deep($_POST['options']);
if (isset($_POST['content'])) $_POST['description'] = $_POST['content'];
$Category->updates($_POST);
$Category->save();
if (!empty($_POST['images']) && is_array($_POST['images'])) {
$Category->link_images($_POST['images']);
$Category->save_imageorder($_POST['images']);
if (!empty($_POST['imagedetails']) && is_array($_POST['imagedetails'])) {
foreach($_POST['imagedetails'] as $i => $data) {
$Image = new CategoryImage($data['id']);
$Image->title = $data['title'];
$Image->alt = $data['alt'];
$Image->save();
}
}
}
do_action_ref_array('ecart_category_saved',array(&$Category));
$updated = '<strong>'.$Category->name.'</strong> '.__('category saved.','Ecart');
}
/**
* Set
*
* @since 1.1
*
* @return void Description...
**/
function init_positions () {
$db =& DB::get();
// Load the entire catalog structure and update the category positions
$Catalog = new Catalog();
$Catalog->outofstock = true;
$filters['columns'] = "cat.id,cat.parent,cat.priority";
$Catalog->load_categories($filters);
foreach ($Catalog->categories as $Category)
if (!isset($Category->_priority) // Check previous priority and only save changes
|| (isset($Category->_priority) && $Category->_priority != $Category->priority))
$db->query("UPDATE $Category->_table SET priority=$Category->priority WHERE id=$Category->id");
}
/**
* Renders a drop-down menu for selecting parent categories
*
* @since 1.0
* @param int $selection The id of the currently selected parent category
* @param int $current The id of the currently edited category
* @return void Description...
**/
function menu ($selection=false,$current=false) {
$db = DB::get();
$table = DatabaseObject::tablename(Category::$table);
$categories = $db->query("SELECT id,name,parent FROM $table ORDER BY parent,name",AS_ARRAY);
$categories = sort_tree($categories);
$options = '';
foreach ($categories as $category) {
$padding = str_repeat(" ",$category->depth*3);
$selected = ($category->id == $selection)?' selected="selected"':'';
$disabled = ($current && $category->id == $current)?' disabled="disabled"':'';
$options .= '<option value="'.$category->id.'"'.$selected.$disabled.'>'.$padding.esc_html($category->name).'</option>';
}
return $options;
}
/**
* Registers column headings for the category list manager
*
* @since 1.0
* @return void
**/
function products_cols () {
register_column_headers('ecart_page_ecart-categories', array(
'move'=>'<img src="'.ECART_ADMIN_URI.'/icons/updating.gif" alt="updating" width="16" height="16" class="hidden" />',
'p'=>__('Product','Ecart'))
);
}
/**
* Interface processor for the product list manager
*
* @return void
**/
function products ($workflow=false) {
global $Ecart;
$db = DB::get();
if ( !(is_ecart_userlevel() || current_user_can('ecart_categories')) )
wp_die(__('You do not have sufficient permissions to access this page.'));
$defaults = array(
'pagenum' => 1,
'per_page' => 500,
'id' => 0,
's' => ''
);
$args = array_merge($defaults,$_GET);
extract($args,EXTR_SKIP);
$pagenum = absint( $pagenum );
if ( empty($pagenum) )
$pagenum = 1;
if( !$per_page || $per_page < 0 )
$per_page = 20;
$start = ($per_page * ($pagenum-1));
$filters = array();
// $filters['limit'] = "$start,$per_page";
if (!empty($s))
$filters['where'] = "cat.name LIKE '%$s%'";
else $filters['where'] = "true";
$Category = new Category($id);
$catalog_table = DatabaseObject::tablename(Catalog::$table);
$product_table = DatabaseObject::tablename(Product::$table);
$columns = "c.id AS cid,p.id,c.priority,p.name";
$where = "c.parent=$id AND type='category'";
$query = "SELECT $columns FROM $catalog_table AS c LEFT JOIN $product_table AS p ON c.product=p.id WHERE $where ORDER BY c.priority ASC,p.name ASC LIMIT $start,$per_page";
$products = $db->query($query);
$count = $db->query("SELECT count(*) AS total FROM $table");
$num_pages = ceil($count->total / $per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( array('edit'=>null,'pagenum' => '%#%' )),
'format' => '',
'total' => $num_pages,
'current' => $pagenum
));
$action = esc_url(
add_query_arg(
array_merge(stripslashes_deep($_GET),array('page'=>$this->Admin->pagename('categories'))),
admin_url('admin.php')
)
);
include(ECART_ADMIN_PATH."/categories/products.php");
}
} // END class Categorize
?> | robbiespire/paQui | wp-content/plugins/express_store_installer/core/flow/Categorize.php | PHP | gpl-2.0 | 14,969 |
package de.metas.edi.esb.pojo.invoice.cctop;
/*
* #%L
* de.metas.edi.esb
* %%
* Copyright (C) 2015 metas GmbH
* %%
* 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, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
import java.io.Serializable;
import java.util.Date;
public class Cctop111V implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 6774551274028670314L;
private String cOrderID;
private String mInOutID;
private Date dateOrdered;
private Date movementDate;
private String poReference;
private String shipmentDocumentno;
public final String getcOrderID()
{
return cOrderID;
}
public final void setcOrderID(final String cOrderID)
{
this.cOrderID = cOrderID;
}
public final String getmInOutID()
{
return mInOutID;
}
public final void setmInOutID(final String mInOutID)
{
this.mInOutID = mInOutID;
}
public Date getDateOrdered()
{
return dateOrdered;
}
public void setDateOrdered(final Date dateOrdered)
{
this.dateOrdered = dateOrdered;
}
public Date getMovementDate()
{
return movementDate;
}
public void setMovementDate(final Date movementDate)
{
this.movementDate = movementDate;
}
public String getPoReference()
{
return poReference;
}
public void setPoReference(final String poReference)
{
this.poReference = poReference;
}
public String getShipmentDocumentno()
{
return shipmentDocumentno;
}
public void setShipmentDocumentno(final String shipmentDocumentno)
{
this.shipmentDocumentno = shipmentDocumentno;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (cOrderID == null ? 0 : cOrderID.hashCode());
result = prime * result + (dateOrdered == null ? 0 : dateOrdered.hashCode());
result = prime * result + (mInOutID == null ? 0 : mInOutID.hashCode());
result = prime * result + (movementDate == null ? 0 : movementDate.hashCode());
result = prime * result + (poReference == null ? 0 : poReference.hashCode());
result = prime * result + (shipmentDocumentno == null ? 0 : shipmentDocumentno.hashCode());
return result;
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final Cctop111V other = (Cctop111V)obj;
if (cOrderID == null)
{
if (other.cOrderID != null)
{
return false;
}
}
else if (!cOrderID.equals(other.cOrderID))
{
return false;
}
if (dateOrdered == null)
{
if (other.dateOrdered != null)
{
return false;
}
}
else if (!dateOrdered.equals(other.dateOrdered))
{
return false;
}
if (mInOutID == null)
{
if (other.mInOutID != null)
{
return false;
}
}
else if (!mInOutID.equals(other.mInOutID))
{
return false;
}
if (movementDate == null)
{
if (other.movementDate != null)
{
return false;
}
}
else if (!movementDate.equals(other.movementDate))
{
return false;
}
if (poReference == null)
{
if (other.poReference != null)
{
return false;
}
}
else if (!poReference.equals(other.poReference))
{
return false;
}
if (shipmentDocumentno == null)
{
if (other.shipmentDocumentno != null)
{
return false;
}
}
else if (!shipmentDocumentno.equals(other.shipmentDocumentno))
{
return false;
}
return true;
}
@Override
public String toString()
{
return "Cctop111V [cOrderID=" + cOrderID + ", mInOutID=" + mInOutID + ", dateOrdered=" + dateOrdered + ", movementDate=" + movementDate + ", poReference="
+ poReference
+ ", shipmentDocumentno=" + shipmentDocumentno + "]";
}
}
| klst-com/metasfresh | de.metas.edi.esb.camel/src/main/java/de/metas/edi/esb/pojo/invoice/cctop/Cctop111V.java | Java | gpl-2.0 | 4,293 |
<?php declare(strict_types=1);
namespace DrupalCodeGenerator;
use Symfony\Component\String\ByteString;
use Symfony\Component\String\Inflector\EnglishInflector;
/**
* Helper methods for code generators.
*/
class Utils {
/**
* Transforms a machine name to human name.
*/
public static function machine2human(string $machine_name, bool $title_case = FALSE): string {
$output = \trim(\str_replace('_', ' ', $machine_name));
return $title_case ? \ucwords($output) : \ucfirst($output);
}
/**
* Transforms a human name to machine name.
*/
public static function human2machine(string $human_name): string {
return \trim(\preg_replace(
['/^[0-9]+/', '/[^a-z0-9_]+/'],
'_',
\strtolower($human_name),
), '_');
}
/**
* Transforms a camelized sting to machine name.
*/
public static function camel2machine(string $input): string {
return self::human2machine(\preg_replace('/[A-Z]/', ' \0', $input));
}
/**
* Camelize a string.
*/
public static function camelize(string $input, bool $upper_camel = TRUE): string {
$output = \preg_replace('/[^a-z0-9]/i', ' ', $input);
$output = (string) (new ByteString($output))->camel();
return $upper_camel ? \ucfirst($output) : $output;
}
/**
* Returns extension root.
*/
public static function getExtensionRoot(string $directory): ?string {
$extension_root = NULL;
for ($i = 1; $i <= 5; $i++) {
$info_file = $directory . '/' . \basename($directory) . '.info';
if ((\file_exists($info_file) && \basename($directory) !== 'drush') || \file_exists($info_file . '.yml')) {
$extension_root = $directory;
break;
}
$directory = \dirname($directory);
}
return $extension_root;
}
/**
* Replaces all tokens in a given string with appropriate values.
*
* @param string $text
* A string potentially containing replaceable tokens.
* @param array $data
* An array where keys are token names and values are replacements.
*
* @return string|null
* Text with tokens replaced.
*/
public static function replaceTokens(string $text, array $data): ?string {
if (\count($data) === 0) {
return $text;
}
$process_token = static function (array $matches) use ($data): string {
[$name, $filter] = \array_pad(\explode('|', $matches[1], 2), 2, NULL);
if (!\array_key_exists($name, $data)) {
throw new \UnexpectedValueException(\sprintf('Variable "%s" is not defined', $name));
}
$result = (string) $data[$name];
if ($filter) {
switch ($filter) {
case 'u2h';
$result = \str_replace('_', '-', $result);
break;
case 'h2u';
$result = \str_replace('-', '_', $result);
break;
case 'h2m';
$result = self::human2machine($result);
break;
case 'm2h';
$result = self::machine2human($result);
break;
case 'camelize':
$result = self::camelize($result);
break;
case 'pluralize':
$result = self::pluralize($result);
break;
case 'c2m':
$result = self::camel2machine($result);
break;
default;
throw new \UnexpectedValueException(\sprintf('Filter "%s" is not defined', $filter));
}
}
return $result;
};
$escaped_brackets = ['\\{', '\\}'];
$tmp_replacement = ['DCG-open-bracket', 'DCG-close-bracket'];
$text = \str_replace($escaped_brackets, $tmp_replacement, $text);
$text = \preg_replace_callback('/{(.+?)}/', $process_token, $text);
$text = \str_replace($tmp_replacement, $escaped_brackets, $text);
return $text;
}
/**
* Quote curly brackets with slashes.
*/
public static function addSlashes(string $input): string {
return \addcslashes($input, '{}');
}
/**
* Un-quotes a quoted string.
*/
public static function stripSlashes(string $input): string {
return \str_replace(['\{', '\}'], ['{', '}'], $input);
}
/**
* Pluralizes a noun.
*/
public static function pluralize(string $input): string {
return (new EnglishInflector())->pluralize($input)[0];
}
}
| Chi-teck/drupal-code-generator | src/Utils.php | PHP | gpl-2.0 | 4,288 |
<?php
/**
* @package Joomla.Site
* @subpackage Templates.Growwweb
*
* @copyright Copyright (C) 2005 - 2014 Web Studio Growwweb. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl?>/templates/objectiv/css/style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl?>/templates/objectiv/css/other.css" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="<?php echo $this->baseurl?>/templates/objectiv/favicon.ico" type="image/x-icon">
<?php $this->setGenerator('objectiv');?>
</head>
<body>
<div class="all">
<div id="top">
<div class="correct">
<jdoc:include type="modules" name="logo" style="xhtml" />
<jdoc:include type="modules" name="links" style="xhtml" />
<jdoc:include type="modules" name="search" style="xhtml" />
</div>
</div>
<div id="mainblock">
<div id="topmenu">
<jdoc:include type="modules" name="topmenu" style="xhtml" />
</div>
<div id="main">
<div id="content">
<jdoc:include type="modules" name="navigaror" style="xhtml" />
<jdoc:include type="message" style="xhtml" />
<jdoc:include type="component" style="xhtml" />
</div>
<div id="right">
<jdoc:include type="modules" name="right" style="xhtml" />
</div>
</div>
<div id="banners">
<jdoc:include type="modules" name="banners" style="xhtml" />
</div>
</div>
<div id="footer">
<jdoc:include type="modules" name="footmenu" style="xhtml" />
<jdoc:include type="modules" name="copy" style="xhtml" />
<!-- Yandex.Metrika informer -->
<a class="metinformer" href="https://metrika.yandex.ru/stat/?id=29860809&from=informer"
target="_blank" rel="nofollow"><img src="https://informer.yandex.ru/informer/29860809/3_0_FFFFFFFF_FFFFFFFF_0_pageviews"
style="width:88px; height:31px; border:0;" alt="Яндекс.Метрика" title="Яндекс.Метрика: данные за сегодня (просмотры, визиты и уникальные посетители)" onclick="try{Ya.Metrika.informer({i:this,id:29860809,lang:'ru'});return false}catch(e){}" /></a>
<!-- /Yandex.Metrika informer -->
</div>
<script type="text/javascript">
(function($){
$('.contact a').click(function(){
$('#callback').toggleClass('active');
});
})(jQuery);
</script>
</div>
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter29860809 = new Ya.Metrika({
id:29860809,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/watch.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/29860809" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
</body>
</html>
| jan-itor/obyektiv | templates/objectiv/index.php | PHP | gpl-2.0 | 3,978 |
import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters import triple_parameters
def evolve_giant(giant, stop_radius):
stellar_evolution = stellar_evolution_code()
giant_in_code = stellar_evolution.particles.add_particle(giant)
while (giant_in_code.radius < 0.7 | units.AU):
giant_in_code.evolve_one_step()
print "Giant starts to ascend the giant branch, now saving model every step..."
print giant_in_code.as_set()
i = 0
while (giant_in_code.radius < stop_radius):
giant_in_code.evolve_one_step()
print giant_in_code.radius, giant_in_code.age
pickle_file_name = "./model_{0:=04}_".format(i) + "%0.1f"%(giant_in_code.radius.value_in(units.AU))
pickle_stellar_model(giant_in_code, pickle_file_name)
i += 1
if __name__ == "__main__":
model_directory = os.path.join("../../../../../BIGDATA/code/amuse-10.0", "giant_models")
if not os.path.exists(model_directory):
os.mkdir(model_directory)
os.chdir(model_directory)
giant = Particle(mass = triple_parameters["mass_out"])
print "\nEvolving with", stellar_evolution_code.__name__
evolve_giant(giant, 1.0 | units.AU)
print "Done"
| hilaglanz/TCE | articles/A_evolve_outer_star_to_giant.py | Python | gpl-2.0 | 1,405 |
<?php
namespace Elasticsearch\Endpoints;
use Elasticsearch\Serializers\SerializerInterface;
use Elasticsearch\Transport;
/**
* Class Bulk
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints
* @author Zachary Tong <zachary.tong@elasticsearch.com>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/
class Bulk extends AbstractEndpoint implements BulkEndpointInterface
{
/**
* @param Transport $transport
* @param SerializerInterface $serializer
*/
public function __construct(Transport $transport, SerializerInterface $serializer)
{
$this->serializer = $serializer;
parent::__construct($transport);
}
/**
* @param string|array $body
*
* @return $this
*/
public function setBody($body)
{
if (isset($body) !== true) {
return $this;
}
if (is_array($body) === true) {
$bulkBody = "";
foreach ($body as $item) {
$bulkBody .= $this->serializer->serialize($item)."\n";
}
$body = $bulkBody;
}
$this->body = $body;
return $this;
}
/**
* @return string
*/
protected function getURI()
{
return $this->getOptionalURI('_bulk');
}
/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'consistency',
'refresh',
'replication',
'type',
);
}
/**
* @return string
*/
protected function getMethod()
{
return 'POST';
}
}
| htw-pk15/vufind | vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Bulk.php | PHP | gpl-2.0 | 1,685 |
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QCache>
#include <QMutex>
#include <QThreadStorage>
#include "threads.h"
//! [0]
void MyThread::run()
//! [0] //! [1]
{
//! [1] //! [2]
}
//! [2]
#define Counter ReentrantCounter
//! [3]
class Counter
//! [3] //! [4]
{
public:
Counter() { n = 0; }
void increment() { ++n; }
void decrement() { --n; }
int value() const { return n; }
private:
int n;
};
//! [4]
#undef Counter
#define Counter ThreadSafeCounter
//! [5]
class Counter
//! [5] //! [6]
{
public:
Counter() { n = 0; }
void increment() { QMutexLocker locker(&mutex); ++n; }
void decrement() { QMutexLocker locker(&mutex); --n; }
int value() const { QMutexLocker locker(&mutex); return n; }
private:
mutable QMutex mutex;
int n;
};
//! [6]
typedef int SomeClass;
//! [7]
QThreadStorage<QCache<QString, SomeClass> *> caches;
void cacheObject(const QString &key, SomeClass *object)
//! [7] //! [8]
{
if (!caches.hasLocalData())
caches.setLocalData(new QCache<QString, SomeClass>);
caches.localData()->insert(key, object);
}
void removeFromCache(const QString &key)
//! [8] //! [9]
{
if (!caches.hasLocalData())
return;
caches.localData()->remove(key);
}
//! [9]
int main()
{
return 0;
}
| librelab/qtmoko-test | qtopiacore/qt/doc/src/snippets/threads/threads.cpp | C++ | gpl-2.0 | 3,193 |
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Menu\Node;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Filter\OutputFilter;
use Joomla\CMS\Menu\Node;
/**
* A Component type of node for MenuTree
*
* @see Node
*
* @since 3.8.0
*/
class Component extends Node
{
/**
* Node Title
*
* @var string
*
* @since 3.8.0
*/
protected $title = null;
/**
* The component name for this node link
*
* @var string
*
* @since 3.8.0
*/
protected $element = null;
/**
* Node Link
*
* @var string
*
* @since 3.8.0
*/
protected $link = null;
/**
* Link Target
*
* @var string
*
* @since 3.8.0
*/
protected $target = null;
/**
* Link title icon
*
* @var string
*
* @since 3.8.0
*/
protected $icon = null;
/**
* Constructor for the class.
*
* @param string $title The title of the node
* @param string $element The component name
* @param string $link The node link
* @param string $target The link target
* @param string $class The CSS class for the node
* @param string $id The node id
* @param string $icon The title icon for the node
*
* @since 3.8.0
*/
public function __construct($title, $element, $link, $target = null, $class = null, $id = null, $icon = null)
{
$this->title = $title;
$this->element = $element;
$this->link = $link ? OutputFilter::ampReplace($link) : 'index.php?option=' . $element;
$this->target = $target;
$this->class = $class;
$this->id = $id;
$this->icon = $icon;
parent::__construct();
}
/**
* Get an attribute value
*
* @param string $name The attribute name
*
* @return mixed
*
* @since 3.8.0
*/
public function get($name)
{
switch ($name)
{
case 'title':
case 'element':
case 'link':
case 'target':
case 'icon':
return $this->$name;
}
return parent::get($name);
}
}
| joomla-projects/media-manager-improvement | libraries/src/Menu/Node/Component.php | PHP | gpl-2.0 | 2,140 |
<?php
/* SensioDistributionBundle:Configurator:check.html.twig */
class __TwigTemplate_b715c729363426b088b795ac92dc5fcde03ea399e55a86f4c370b333d1e7f13e extends eZ\Bundle\EzPublishDebugBundle\Twig\DebugTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = $this->env->loadTemplate("SensioDistributionBundle::Configurator/layout.html.twig");
$this->blocks = array(
'content' => array($this, 'block_content'),
);
}
protected function doGetParent(array $context)
{
return "SensioDistributionBundle::Configurator/layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_content($context, array $blocks = array())
{
// line 4
echo " ";
if (twig_length_filter($this->env, (isset($context["majors"]) ? $context["majors"] : $this->getContext($context, "majors")))) {
// line 5
echo " <h1>Major Problems that need to be fixed now</h1>
<p>
We have detected <strong>";
// line 7
echo twig_escape_filter($this->env, twig_length_filter($this->env, (isset($context["majors"]) ? $context["majors"] : $this->getContext($context, "majors"))), "html", null, true);
echo "</strong> major problems.
You <em>must</em> fix them before continuing:
</p>
<ol>
";
// line 11
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable((isset($context["majors"]) ? $context["majors"] : $this->getContext($context, "majors")));
foreach ($context['_seq'] as $context["_key"] => $context["message"]) {
// line 12
echo " <li>";
echo twig_escape_filter($this->env, $context["message"], "html", null, true);
echo "</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['message'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 14
echo " </ol>
";
}
// line 16
echo "
";
// line 17
if (twig_length_filter($this->env, (isset($context["minors"]) ? $context["minors"] : $this->getContext($context, "minors")))) {
// line 18
echo " <h1>Some Recommendations</h1>
<p>
";
// line 21
if (twig_length_filter($this->env, (isset($context["majors"]) ? $context["majors"] : $this->getContext($context, "majors")))) {
// line 22
echo " Additionally, we
";
} else {
// line 24
echo " We
";
}
// line 26
echo " have detected some minor problems that we <em>recommend</em> you to fix to have a better Symfony
experience:
<ol>
";
// line 30
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable((isset($context["minors"]) ? $context["minors"] : $this->getContext($context, "minors")));
foreach ($context['_seq'] as $context["_key"] => $context["message"]) {
// line 31
echo " <li>";
echo twig_escape_filter($this->env, $context["message"], "html", null, true);
echo "</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['message'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 33
echo " </ol>
</p>
";
}
// line 37
echo "
";
// line 38
if ((!twig_length_filter($this->env, (isset($context["majors"]) ? $context["majors"] : $this->getContext($context, "majors"))))) {
// line 39
echo " <ul class=\"symfony_list\">
<li><a href=\"";
// line 40
echo twig_escape_filter($this->env, (isset($context["url"]) ? $context["url"] : $this->getContext($context, "url")), "html", null, true);
echo "\">Configure your Symfony Application online</a></li>
</ul>
";
}
}
public function getTemplateName()
{
return "SensioDistributionBundle:Configurator:check.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 115 => 40, 112 => 39, 110 => 38, 107 => 37, 101 => 33, 92 => 31, 88 => 30, 82 => 26, 78 => 24, 74 => 22, 72 => 21, 67 => 18, 65 => 17, 62 => 16, 58 => 14, 49 => 12, 45 => 11, 38 => 7, 34 => 5, 31 => 4, 28 => 3,);
}
}
| ataxel/tp | ezpublish/cache/dev/twig/b7/15/c729363426b088b795ac92dc5fcde03ea399e55a86f4c370b333d1e7f13e.php | PHP | gpl-2.0 | 5,309 |
from gi.repository import Gtk
import gourmet.gtk_extras.dialog_extras as de
from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin
from .recipe_emailer import RecipeEmailer
from gettext import gettext as _
class EmailRecipePlugin (MainPlugin, UIPlugin):
ui_string = '''
<menubar name="RecipeIndexMenuBar">
<menu name="Tools" action="Tools">
<placeholder name="StandaloneTool">
<menuitem action="EmailRecipes"/>
</placeholder>
</menu>
</menubar>
'''
def setup_action_groups (self):
self.actionGroup = Gtk.ActionGroup(name='RecipeEmailerActionGroup')
self.actionGroup.add_actions([
('EmailRecipes',None,_('Email recipes'),
None,_('Email all selected recipes (or all recipes if no recipes are selected'),self.email_selected),
])
self.action_groups.append(self.actionGroup)
def activate (self, pluggable):
self.rg = self.pluggable = pluggable
self.add_to_uimanager(pluggable.ui_manager)
def get_selected_recs (self):
recs = self.rg.get_selected_recs_from_rec_tree()
if not recs:
recs = self.rd.fetch_all(self.rd.recipe_table, deleted=False, sort_by=[('title',1)])
return recs
def email_selected (self, *args):
recs = self.get_selected_recs()
l = len(recs)
if l > 20:
if not de.getBoolean(
title=_('Email recipes'),
# only called for l>20, so fancy gettext methods
# shouldn't be necessary if my knowledge of
# linguistics serves me
sublabel=_('Do you really want to email all %s selected recipes?')%l,
custom_yes=_('Yes, e_mail them'),
cancel=False,
):
return
re = RecipeEmailer(recs)
re.send_email_with_attachments()
| thinkle/gourmet | gourmet/plugins/email_plugin/emailer_plugin.py | Python | gpl-2.0 | 1,934 |
<?php
/**
* Implements Special:Undelete
*
* 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.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup SpecialPage
*/
/**
* Used to show archived pages and eventually restore them.
*
* @ingroup SpecialPage
*/
class PageArchive {
/**
* @var Title
*/
protected $title;
/**
* @var Status
*/
protected $fileStatus;
/**
* @var Status
*/
protected $revisionStatus;
function __construct( $title ) {
if( is_null( $title ) ) {
throw new MWException( __METHOD__ . ' given a null title.' );
}
$this->title = $title;
}
/**
* List all deleted pages recorded in the archive table. Returns result
* wrapper with (ar_namespace, ar_title, count) fields, ordered by page
* namespace/title.
*
* @return ResultWrapper
*/
public static function listAllPages() {
$dbr = wfGetDB( DB_SLAVE );
return self::listPages( $dbr, '' );
}
/**
* List deleted pages recorded in the archive table matching the
* given title prefix.
* Returns result wrapper with (ar_namespace, ar_title, count) fields.
*
* @param $prefix String: title prefix
* @return ResultWrapper
*/
public static function listPagesByPrefix( $prefix ) {
$dbr = wfGetDB( DB_SLAVE );
$title = Title::newFromText( $prefix );
if( $title ) {
$ns = $title->getNamespace();
$prefix = $title->getDBkey();
} else {
// Prolly won't work too good
// @todo handle bare namespace names cleanly?
$ns = 0;
}
$conds = array(
'ar_namespace' => $ns,
'ar_title' . $dbr->buildLike( $prefix, $dbr->anyString() ),
);
return self::listPages( $dbr, $conds );
}
/**
* @param $dbr DatabaseBase
* @param $condition
* @return bool|ResultWrapper
*/
protected static function listPages( $dbr, $condition ) {
return $dbr->resultObject(
$dbr->select(
array( 'archive' ),
array(
'ar_namespace',
'ar_title',
'count' => 'COUNT(*)'
),
$condition,
__METHOD__,
array(
'GROUP BY' => array( 'ar_namespace', 'ar_title' ),
'ORDER BY' => array( 'ar_namespace', 'ar_title' ),
'LIMIT' => 100,
)
)
);
}
/**
* List the revisions of the given page. Returns result wrapper with
* (ar_minor_edit, ar_timestamp, ar_user, ar_user_text, ar_comment) fields.
*
* @return ResultWrapper
*/
function listRevisions() {
global $wgContentHandlerUseDB;
$dbr = wfGetDB( DB_SLAVE );
$fields = array(
'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text',
'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1',
);
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
}
$res = $dbr->select( 'archive',
$fields,
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ),
__METHOD__,
array( 'ORDER BY' => 'ar_timestamp DESC' ) );
$ret = $dbr->resultObject( $res );
return $ret;
}
/**
* List the deleted file revisions for this page, if it's a file page.
* Returns a result wrapper with various filearchive fields, or null
* if not a file page.
*
* @return ResultWrapper
* @todo Does this belong in Image for fuller encapsulation?
*/
function listFiles() {
if( $this->title->getNamespace() == NS_FILE ) {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'filearchive',
array(
'fa_id',
'fa_name',
'fa_archive_name',
'fa_storage_key',
'fa_storage_group',
'fa_size',
'fa_width',
'fa_height',
'fa_bits',
'fa_metadata',
'fa_media_type',
'fa_major_mime',
'fa_minor_mime',
'fa_description',
'fa_user',
'fa_user_text',
'fa_timestamp',
'fa_deleted',
'fa_sha1' ),
array( 'fa_name' => $this->title->getDBkey() ),
__METHOD__,
array( 'ORDER BY' => 'fa_timestamp DESC' ) );
$ret = $dbr->resultObject( $res );
return $ret;
}
return null;
}
/**
* Return a Revision object containing data for the deleted revision.
* Note that the result *may* or *may not* have a null page ID.
*
* @param $timestamp String
* @return Revision
*/
function getRevision( $timestamp ) {
global $wgContentHandlerUseDB;
$dbr = wfGetDB( DB_SLAVE );
$fields = array(
'ar_rev_id',
'ar_text',
'ar_comment',
'ar_user',
'ar_user_text',
'ar_timestamp',
'ar_minor_edit',
'ar_flags',
'ar_text_id',
'ar_deleted',
'ar_len',
'ar_sha1',
);
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
}
$row = $dbr->selectRow( 'archive',
$fields,
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
__METHOD__ );
if( $row ) {
return Revision::newFromArchiveRow( $row, array( 'title' => $this->title ) );
} else {
return null;
}
}
/**
* Return the most-previous revision, either live or deleted, against
* the deleted revision given by timestamp.
*
* May produce unexpected results in case of history merges or other
* unusual time issues.
*
* @param $timestamp String
* @return Revision or null
*/
function getPreviousRevision( $timestamp ) {
$dbr = wfGetDB( DB_SLAVE );
// Check the previous deleted revision...
$row = $dbr->selectRow( 'archive',
'ar_timestamp',
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
'ar_timestamp < ' .
$dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
__METHOD__,
array(
'ORDER BY' => 'ar_timestamp DESC',
'LIMIT' => 1 ) );
$prevDeleted = $row ? wfTimestamp( TS_MW, $row->ar_timestamp ) : false;
$row = $dbr->selectRow( array( 'page', 'revision' ),
array( 'rev_id', 'rev_timestamp' ),
array(
'page_namespace' => $this->title->getNamespace(),
'page_title' => $this->title->getDBkey(),
'page_id = rev_page',
'rev_timestamp < ' .
$dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
__METHOD__,
array(
'ORDER BY' => 'rev_timestamp DESC',
'LIMIT' => 1 ) );
$prevLive = $row ? wfTimestamp( TS_MW, $row->rev_timestamp ) : false;
$prevLiveId = $row ? intval( $row->rev_id ) : null;
if( $prevLive && $prevLive > $prevDeleted ) {
// Most prior revision was live
return Revision::newFromId( $prevLiveId );
} elseif( $prevDeleted ) {
// Most prior revision was deleted
return $this->getRevision( $prevDeleted );
} else {
// No prior revision on this page.
return null;
}
}
/**
* Get the text from an archive row containing ar_text, ar_flags and ar_text_id
*
* @param $row Object: database row
* @return Revision
*/
function getTextFromRow( $row ) {
if( is_null( $row->ar_text_id ) ) {
// An old row from MediaWiki 1.4 or previous.
// Text is embedded in this row in classic compression format.
return Revision::getRevisionText( $row, 'ar_' );
} else {
// New-style: keyed to the text storage backend.
$dbr = wfGetDB( DB_SLAVE );
$text = $dbr->selectRow( 'text',
array( 'old_text', 'old_flags' ),
array( 'old_id' => $row->ar_text_id ),
__METHOD__ );
return Revision::getRevisionText( $text );
}
}
/**
* Fetch (and decompress if necessary) the stored text of the most
* recently edited deleted revision of the page.
*
* If there are no archived revisions for the page, returns NULL.
*
* @return String
*/
function getLastRevisionText() {
$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'archive',
array( 'ar_text', 'ar_flags', 'ar_text_id' ),
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ),
__METHOD__,
array( 'ORDER BY' => 'ar_timestamp DESC' ) );
if( $row ) {
return $this->getTextFromRow( $row );
} else {
return null;
}
}
/**
* Quick check if any archived revisions are present for the page.
*
* @return Boolean
*/
function isDeleted() {
$dbr = wfGetDB( DB_SLAVE );
$n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ),
__METHOD__
);
return ( $n > 0 );
}
/**
* Restore the given (or all) text and file revisions for the page.
* Once restored, the items will be removed from the archive tables.
* The deletion log will be updated with an undeletion notice.
*
* @param $timestamps Array: pass an empty array to restore all revisions, otherwise list the ones to undelete.
* @param $comment String
* @param $fileVersions Array
* @param $unsuppress Boolean
* @param $user User doing the action, or null to use $wgUser
*
* @return array(number of file revisions restored, number of image revisions restored, log message)
* on success, false on failure
*/
function undelete( $timestamps, $comment = '', $fileVersions = array(), $unsuppress = false, User $user = null ) {
// If both the set of text revisions and file revisions are empty,
// restore everything. Otherwise, just restore the requested items.
$restoreAll = empty( $timestamps ) && empty( $fileVersions );
$restoreText = $restoreAll || !empty( $timestamps );
$restoreFiles = $restoreAll || !empty( $fileVersions );
if( $restoreFiles && $this->title->getNamespace() == NS_FILE ) {
$img = wfLocalFile( $this->title );
$this->fileStatus = $img->restore( $fileVersions, $unsuppress );
if ( !$this->fileStatus->isOK() ) {
return false;
}
$filesRestored = $this->fileStatus->successCount;
} else {
$filesRestored = 0;
}
if( $restoreText ) {
$this->revisionStatus = $this->undeleteRevisions( $timestamps, $unsuppress, $comment );
if( !$this->revisionStatus->isOK() ) {
return false;
}
$textRestored = $this->revisionStatus->getValue();
} else {
$textRestored = 0;
}
// Touch the log!
if( $textRestored && $filesRestored ) {
$reason = wfMessage( 'undeletedrevisions-files' )
->numParams( $textRestored, $filesRestored )->inContentLanguage()->text();
} elseif( $textRestored ) {
$reason = wfMessage( 'undeletedrevisions' )->numParams( $textRestored )
->inContentLanguage()->text();
} elseif( $filesRestored ) {
$reason = wfMessage( 'undeletedfiles' )->numParams( $filesRestored )
->inContentLanguage()->text();
} else {
wfDebug( "Undelete: nothing undeleted...\n" );
return false;
}
if( trim( $comment ) != '' ) {
$reason .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
}
if ( $user === null ) {
global $wgUser;
$user = $wgUser;
}
$logEntry = new ManualLogEntry( 'delete', 'restore' );
$logEntry->setPerformer( $user );
$logEntry->setTarget( $this->title );
$logEntry->setComment( $reason );
wfRunHooks( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) );
$logid = $logEntry->insert();
$logEntry->publish( $logid );
return array( $textRestored, $filesRestored, $reason );
}
/**
* This is the meaty bit -- restores archived revisions of the given page
* to the cur/old tables. If the page currently exists, all revisions will
* be stuffed into old, otherwise the most recent will go into cur.
*
* @param $timestamps Array: pass an empty array to restore all revisions, otherwise list the ones to undelete.
* @param $unsuppress Boolean: remove all ar_deleted/fa_deleted restrictions of seletected revs
*
* @param $comment String
* @throws ReadOnlyError
* @return Status, containing the number of revisions restored on success
*/
private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) {
global $wgContentHandlerUseDB;
if ( wfReadOnly() ) {
throw new ReadOnlyError();
}
$restoreAll = empty( $timestamps );
$dbw = wfGetDB( DB_MASTER );
# Does this page already exist? We'll have to update it...
$article = WikiPage::factory( $this->title );
# Load latest data for the current page (bug 31179)
$article->loadPageData( 'fromdbmaster' );
$oldcountable = $article->isCountable();
$page = $dbw->selectRow( 'page',
array( 'page_id', 'page_latest' ),
array( 'page_namespace' => $this->title->getNamespace(),
'page_title' => $this->title->getDBkey() ),
__METHOD__,
array( 'FOR UPDATE' ) // lock page
);
if( $page ) {
$makepage = false;
# Page already exists. Import the history, and if necessary
# we'll update the latest revision field in the record.
$newid = 0;
$pageId = $page->page_id;
$previousRevId = $page->page_latest;
# Get the time span of this page
$previousTimestamp = $dbw->selectField( 'revision', 'rev_timestamp',
array( 'rev_id' => $previousRevId ),
__METHOD__ );
if( $previousTimestamp === false ) {
wfDebug( __METHOD__ . ": existing page refers to a page_latest that does not exist\n" );
$status = Status::newGood( 0 );
$status->warning( 'undeleterevision-missing' );
return $status;
}
} else {
# Have to create a new article...
$makepage = true;
$previousRevId = 0;
$previousTimestamp = 0;
}
if( $restoreAll ) {
$oldones = '1 = 1'; # All revisions...
} else {
$oldts = implode( ',',
array_map( array( &$dbw, 'addQuotes' ),
array_map( array( &$dbw, 'timestamp' ),
$timestamps ) ) );
$oldones = "ar_timestamp IN ( {$oldts} )";
}
$fields = array(
'ar_rev_id',
'ar_text',
'ar_comment',
'ar_user',
'ar_user_text',
'ar_timestamp',
'ar_minor_edit',
'ar_flags',
'ar_text_id',
'ar_deleted',
'ar_page_id',
'ar_len',
'ar_sha1'
);
if ( $wgContentHandlerUseDB ) {
$fields[] = 'ar_content_format';
$fields[] = 'ar_content_model';
}
/**
* Select each archived revision...
*/
$result = $dbw->select( 'archive',
$fields,
/* WHERE */ array(
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
$oldones ),
__METHOD__,
/* options */ array( 'ORDER BY' => 'ar_timestamp' )
);
$ret = $dbw->resultObject( $result );
$rev_count = $dbw->numRows( $result );
if( !$rev_count ) {
wfDebug( __METHOD__ . ": no revisions to restore\n" );
$status = Status::newGood( 0 );
$status->warning( "undelete-no-results" );
return $status;
}
$ret->seek( $rev_count - 1 ); // move to last
$row = $ret->fetchObject(); // get newest archived rev
$ret->seek( 0 ); // move back
// grab the content to check consistency with global state before restoring the page.
$revision = Revision::newFromArchiveRow( $row,
array(
'title' => $article->getTitle(), // used to derive default content model
) );
$m = $revision->getContentModel();
$user = User::newFromName( $revision->getRawUserText(), false );
$content = $revision->getContent( Revision::RAW );
//NOTE: article ID may not be known yet. prepareSave() should not modify the database.
$status = $content->prepareSave( $article, 0, -1, $user );
if ( !$status->isOK() ) {
return $status;
}
if( $makepage ) {
// Check the state of the newest to-be version...
if( !$unsuppress && ( $row->ar_deleted & Revision::DELETED_TEXT ) ) {
return Status::newFatal( "undeleterevdel" );
}
// Safe to insert now...
$newid = $article->insertOn( $dbw );
$pageId = $newid;
} else {
// Check if a deleted revision will become the current revision...
if( $row->ar_timestamp > $previousTimestamp ) {
// Check the state of the newest to-be version...
if( !$unsuppress && ( $row->ar_deleted & Revision::DELETED_TEXT ) ) {
return Status::newFatal( "undeleterevdel" );
}
}
$newid = false;
$pageId = $article->getId();
}
$revision = null;
$restored = 0;
foreach ( $ret as $row ) {
// Check for key dupes due to shitty archive integrity.
if( $row->ar_rev_id ) {
$exists = $dbw->selectField( 'revision', '1',
array( 'rev_id' => $row->ar_rev_id ), __METHOD__ );
if( $exists ) {
continue; // don't throw DB errors
}
}
// Insert one revision at a time...maintaining deletion status
// unless we are specifically removing all restrictions...
$revision = Revision::newFromArchiveRow( $row,
array(
'page' => $pageId,
'title' => $this->title,
'deleted' => $unsuppress ? 0 : $row->ar_deleted
) );
$revision->insertOn( $dbw );
$restored++;
wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) );
}
# Now that it's safely stored, take it out of the archive
$dbw->delete( 'archive',
/* WHERE */ array(
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
$oldones ),
__METHOD__ );
// Was anything restored at all?
if ( $restored == 0 ) {
return Status::newGood( 0 );
}
$created = (bool)$newid;
// Attach the latest revision to the page...
$wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
if ( $created || $wasnew ) {
// Update site stats, link tables, etc
$user = User::newFromName( $revision->getRawUserText(), false );
$article->doEditUpdates( $revision, $user, array( 'created' => $created, 'oldcountable' => $oldcountable ) );
}
wfRunHooks( 'ArticleUndelete', array( &$this->title, $created, $comment ) );
if( $this->title->getNamespace() == NS_FILE ) {
$update = new HTMLCacheUpdate( $this->title, 'imagelinks' );
$update->doUpdate();
}
return Status::newGood( $restored );
}
/**
* @return Status
*/
function getFileStatus() { return $this->fileStatus; }
/**
* @return Status
*/
function getRevisionStatus() { return $this->revisionStatus; }
}
/**
* Special page allowing users with the appropriate permissions to view
* and restore deleted content.
*
* @ingroup SpecialPage
*/
class SpecialUndelete extends SpecialPage {
var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mFilename;
var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken;
/**
* @var Title
*/
var $mTargetObj;
function __construct() {
parent::__construct( 'Undelete', 'deletedhistory' );
}
function loadRequest( $par ) {
$request = $this->getRequest();
$user = $this->getUser();
$this->mAction = $request->getVal( 'action' );
if ( $par !== null && $par !== '' ) {
$this->mTarget = $par;
} else {
$this->mTarget = $request->getVal( 'target' );
}
$this->mTargetObj = null;
if ( $this->mTarget !== null && $this->mTarget !== '' ) {
$this->mTargetObj = Title::newFromURL( $this->mTarget );
}
$this->mSearchPrefix = $request->getText( 'prefix' );
$time = $request->getVal( 'timestamp' );
$this->mTimestamp = $time ? wfTimestamp( TS_MW, $time ) : '';
$this->mFilename = $request->getVal( 'file' );
$posted = $request->wasPosted() &&
$user->matchEditToken( $request->getVal( 'wpEditToken' ) );
$this->mRestore = $request->getCheck( 'restore' ) && $posted;
$this->mInvert = $request->getCheck( 'invert' ) && $posted;
$this->mPreview = $request->getCheck( 'preview' ) && $posted;
$this->mDiff = $request->getCheck( 'diff' );
$this->mDiffOnly = $request->getBool( 'diffonly', $this->getUser()->getOption( 'diffonly' ) );
$this->mComment = $request->getText( 'wpComment' );
$this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' );
$this->mToken = $request->getVal( 'token' );
if ( $user->isAllowed( 'undelete' ) && !$user->isBlocked() ) {
$this->mAllowed = true; // user can restore
$this->mCanView = true; // user can view content
} elseif ( $user->isAllowed( 'deletedtext' ) ) {
$this->mAllowed = false; // user cannot restore
$this->mCanView = true; // user can view content
$this->mRestore = false;
} else { // user can only view the list of revisions
$this->mAllowed = false;
$this->mCanView = false;
$this->mTimestamp = '';
$this->mRestore = false;
}
if( $this->mRestore || $this->mInvert ) {
$timestamps = array();
$this->mFileVersions = array();
foreach( $request->getValues() as $key => $val ) {
$matches = array();
if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
array_push( $timestamps, $matches[1] );
}
if( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
$this->mFileVersions[] = intval( $matches[1] );
}
}
rsort( $timestamps );
$this->mTargetTimestamp = $timestamps;
}
}
function execute( $par ) {
$this->checkPermissions();
$user = $this->getUser();
$this->setHeaders();
$this->outputHeader();
$this->loadRequest( $par );
$out = $this->getOutput();
if ( is_null( $this->mTargetObj ) ) {
$out->addWikiMsg( 'undelete-header' );
# Not all users can just browse every deleted page from the list
if ( $user->isAllowed( 'browsearchive' ) ) {
$this->showSearchForm();
}
return;
}
if ( $this->mAllowed ) {
$out->setPageTitle( $this->msg( 'undeletepage' ) );
} else {
$out->setPageTitle( $this->msg( 'viewdeletedpage' ) );
}
$this->getSkin()->setRelevantTitle( $this->mTargetObj );
if ( $this->mTimestamp !== '' ) {
$this->showRevision( $this->mTimestamp );
} elseif ( $this->mFilename !== null ) {
$file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
// Check if user is allowed to see this file
if ( !$file->exists() ) {
$out->addWikiMsg( 'filedelete-nofile', $this->mFilename );
} elseif ( !$file->userCan( File::DELETED_FILE, $user ) ) {
if( $file->isDeleted( File::DELETED_RESTRICTED ) ) {
throw new PermissionsError( 'suppressrevision' );
} else {
throw new PermissionsError( 'deletedtext' );
}
} elseif ( !$user->matchEditToken( $this->mToken, $this->mFilename ) ) {
$this->showFileConfirmationForm( $this->mFilename );
} else {
$this->showFile( $this->mFilename );
}
} elseif ( $this->mRestore && $this->mAction == 'submit' ) {
$this->undelete();
} else {
$this->showHistory();
}
}
function showSearchForm() {
global $wgScript;
$out = $this->getOutput();
$out->setPageTitle( $this->msg( 'undelete-search-title' ) );
$out->addHTML(
Xml::openElement( 'form', array(
'method' => 'get',
'action' => $wgScript ) ) .
Xml::fieldset( $this->msg( 'undelete-search-box' )->text() ) .
Html::hidden( 'title',
$this->getTitle()->getPrefixedDbKey() ) .
Xml::inputLabel( $this->msg( 'undelete-search-prefix' )->text(),
'prefix', 'prefix', 20,
$this->mSearchPrefix ) . ' ' .
Xml::submitButton( $this->msg( 'undelete-search-submit' )->text() ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' )
);
# List undeletable articles
if( $this->mSearchPrefix ) {
$result = PageArchive::listPagesByPrefix( $this->mSearchPrefix );
$this->showList( $result );
}
}
/**
* Generic list of deleted pages
*
* @param $result ResultWrapper
* @return bool
*/
private function showList( $result ) {
$out = $this->getOutput();
if( $result->numRows() == 0 ) {
$out->addWikiMsg( 'undelete-no-results' );
return false;
}
$out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );
$undelete = $this->getTitle();
$out->addHTML( "<ul>\n" );
foreach ( $result as $row ) {
$title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
if ( $title !== null ) {
$item = Linker::linkKnown(
$undelete,
htmlspecialchars( $title->getPrefixedText() ),
array(),
array( 'target' => $title->getPrefixedText() )
);
} else {
// The title is no longer valid, show as text
$item = Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
Linker::getInvalidTitleDescription( $this->getContext(), $row->ar_namespace, $row->ar_title ) );
}
$revs = $this->msg( 'undeleterevisions' )->numParams( $row->count )->parse();
$out->addHTML( "<li>{$item} ({$revs})</li>\n" );
}
$result->free();
$out->addHTML( "</ul>\n" );
return true;
}
private function showRevision( $timestamp ) {
if( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
return;
}
$archive = new PageArchive( $this->mTargetObj );
if ( !wfRunHooks( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj ) ) ) {
return;
}
$rev = $archive->getRevision( $timestamp );
$out = $this->getOutput();
$user = $this->getUser();
if( !$rev ) {
$out->addWikiMsg( 'undeleterevision-missing' );
return;
}
if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
if( !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
$out->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' );
return;
} else {
$out->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' );
$out->addHTML( '<br />' );
// and we are allowed to see...
}
}
if( $this->mDiff ) {
$previousRev = $archive->getPreviousRevision( $timestamp );
if( $previousRev ) {
$this->showDiff( $previousRev, $rev );
if( $this->mDiffOnly ) {
return;
} else {
$out->addHTML( '<hr />' );
}
} else {
$out->addWikiMsg( 'undelete-nodiff' );
}
}
$link = Linker::linkKnown(
$this->getTitle( $this->mTargetObj->getPrefixedDBkey() ),
htmlspecialchars( $this->mTargetObj->getPrefixedText() )
);
$lang = $this->getLanguage();
// date and time are separate parameters to facilitate localisation.
// $time is kept for backward compat reasons.
$time = $lang->userTimeAndDate( $timestamp, $user );
$d = $lang->userDate( $timestamp, $user );
$t = $lang->userTime( $timestamp, $user );
$userLink = Linker::revUserTools( $rev );
$content = $rev->getContent( Revision::FOR_THIS_USER, $user );
$isText = ( $content instanceof TextContent );
if( $this->mPreview || $isText ) {
$openDiv = '<div id="mw-undelete-revision" class="mw-warning">';
} else {
$openDiv = '<div id="mw-undelete-revision">';
}
$out->addHTML( $openDiv );
// Revision delete links
if ( !$this->mDiff ) {
$revdel = Linker::getRevDeleteLink( $user, $rev, $this->mTargetObj );
if ( $revdel ) {
$out->addHTML( "$revdel " );
}
}
$out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params(
$time )->rawParams( $userLink )->params( $d, $t )->parse() . '</div>' );
if ( !wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ) ) {
return;
}
if( $this->mPreview || !$isText ) {
// NOTE: non-text content has no source view, so always use rendered preview
// Hide [edit]s
$popts = $out->parserOptions();
$popts->setEditSection( false );
$pout = $content->getParserOutput( $this->mTargetObj, $rev->getId(), $popts, true );
$out->addParserOutput( $pout );
}
if ( $isText ) {
// source view for textual content
$sourceView = Xml::element( 'textarea', array(
'readonly' => 'readonly',
'cols' => intval( $user->getOption( 'cols' ) ),
'rows' => intval( $user->getOption( 'rows' ) ) ),
$content->getNativeData() . "\n" );
$previewButton = Xml::element( 'input', array(
'type' => 'submit',
'name' => 'preview',
'value' => $this->msg( 'showpreview' )->text() ) );
} else {
$sourceView = '';
$previewButton = '';
}
$diffButton = Xml::element( 'input', array(
'name' => 'diff',
'type' => 'submit',
'value' => $this->msg( 'showdiff' )->text() ) );
$out->addHTML(
$sourceView .
Xml::openElement( 'div', array(
'style' => 'clear: both' ) ) .
Xml::openElement( 'form', array(
'method' => 'post',
'action' => $this->getTitle()->getLocalURL( array( 'action' => 'submit' ) ) ) ) .
Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'target',
'value' => $this->mTargetObj->getPrefixedDbKey() ) ) .
Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'timestamp',
'value' => $timestamp ) ) .
Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'wpEditToken',
'value' => $user->getEditToken() ) ) .
$previewButton .
$diffButton .
Xml::closeElement( 'form' ) .
Xml::closeElement( 'div' ) );
}
/**
* Build a diff display between this and the previous either deleted
* or non-deleted edit.
*
* @param $previousRev Revision
* @param $currentRev Revision
* @return String: HTML
*/
function showDiff( $previousRev, $currentRev ) {
$diffContext = clone $this->getContext();
$diffContext->setTitle( $currentRev->getTitle() );
$diffContext->setWikiPage( WikiPage::factory( $currentRev->getTitle() ) );
$diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
$diffEngine->showDiffStyle();
$this->getOutput()->addHTML(
"<div>" .
"<table style='width: 98%;' cellpadding='0' cellspacing='4' class='diff'>" .
"<col class='diff-marker' />" .
"<col class='diff-content' />" .
"<col class='diff-marker' />" .
"<col class='diff-content' />" .
"<tr>" .
"<td colspan='2' style='width: 50%; text-align: center' class='diff-otitle'>" .
$this->diffHeader( $previousRev, 'o' ) .
"</td>\n" .
"<td colspan='2' style='width: 50%; text-align: center' class='diff-ntitle'>" .
$this->diffHeader( $currentRev, 'n' ) .
"</td>\n" .
"</tr>" .
$diffEngine->generateContentDiffBody(
$previousRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ),
$currentRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ) ) .
"</table>" .
"</div>\n"
);
}
/**
* @param $rev Revision
* @param $prefix
* @return string
*/
private function diffHeader( $rev, $prefix ) {
$isDeleted = !( $rev->getId() && $rev->getTitle() );
if( $isDeleted ) {
/// @todo FIXME: $rev->getTitle() is null for deleted revs...?
$targetPage = $this->getTitle();
$targetQuery = array(
'target' => $this->mTargetObj->getPrefixedText(),
'timestamp' => wfTimestamp( TS_MW, $rev->getTimestamp() )
);
} else {
/// @todo FIXME: getId() may return non-zero for deleted revs...
$targetPage = $rev->getTitle();
$targetQuery = array( 'oldid' => $rev->getId() );
}
// Add show/hide deletion links if available
$user = $this->getUser();
$lang = $this->getLanguage();
$rdel = Linker::getRevDeleteLink( $user, $rev, $this->mTargetObj );
if ( $rdel ) $rdel = " $rdel";
return
'<div id="mw-diff-' . $prefix . 'title1"><strong>' .
Linker::link(
$targetPage,
$this->msg(
'revisionasof',
$lang->userTimeAndDate( $rev->getTimestamp(), $user ),
$lang->userDate( $rev->getTimestamp(), $user ),
$lang->userTime( $rev->getTimestamp(), $user )
)->escaped(),
array(),
$targetQuery
) .
'</strong></div>' .
'<div id="mw-diff-' . $prefix . 'title2">' .
Linker::revUserTools( $rev ) . '<br />' .
'</div>' .
'<div id="mw-diff-' . $prefix . 'title3">' .
Linker::revComment( $rev ) . $rdel . '<br />' .
'</div>';
}
/**
* Show a form confirming whether a tokenless user really wants to see a file
*/
private function showFileConfirmationForm( $key ) {
$out = $this->getOutput();
$lang = $this->getLanguage();
$user = $this->getUser();
$file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
$out->addWikiMsg( 'undelete-show-file-confirm',
$this->mTargetObj->getText(),
$lang->userDate( $file->getTimestamp(), $user ),
$lang->userTime( $file->getTimestamp(), $user ) );
$out->addHTML(
Xml::openElement( 'form', array(
'method' => 'POST',
'action' => $this->getTitle()->getLocalURL(
'target=' . urlencode( $this->mTarget ) .
'&file=' . urlencode( $key ) .
'&token=' . urlencode( $user->getEditToken( $key ) ) )
)
) .
Xml::submitButton( $this->msg( 'undelete-show-file-submit' )->text() ) .
'</form>'
);
}
/**
* Show a deleted file version requested by the visitor.
*/
private function showFile( $key ) {
$this->getOutput()->disable();
# We mustn't allow the output to be Squid cached, otherwise
# if an admin previews a deleted image, and it's cached, then
# a user without appropriate permissions can toddle off and
# nab the image, and Squid will serve it
$response = $this->getRequest()->response();
$response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
$response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
$response->header( 'Pragma: no-cache' );
$repo = RepoGroup::singleton()->getLocalRepo();
$path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
$repo->streamFile( $path );
}
private function showHistory() {
$out = $this->getOutput();
if( $this->mAllowed ) {
$out->addModules( 'mediawiki.special.undelete' );
}
$out->wrapWikiMsg(
"<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
array( 'undeletepagetitle', wfEscapeWikiText( $this->mTargetObj->getPrefixedText() ) )
);
$archive = new PageArchive( $this->mTargetObj );
wfRunHooks( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj ) );
/*
$text = $archive->getLastRevisionText();
if( is_null( $text ) ) {
$out->addWikiMsg( 'nohistory' );
return;
}
*/
$out->addHTML( '<div class="mw-undelete-history">' );
if ( $this->mAllowed ) {
$out->addWikiMsg( 'undeletehistory' );
$out->addWikiMsg( 'undeleterevdel' );
} else {
$out->addWikiMsg( 'undeletehistorynoadmin' );
}
$out->addHTML( '</div>' );
# List all stored revisions
$revisions = $archive->listRevisions();
$files = $archive->listFiles();
$haveRevisions = $revisions && $revisions->numRows() > 0;
$haveFiles = $files && $files->numRows() > 0;
# Batch existence check on user and talk pages
if( $haveRevisions ) {
$batch = new LinkBatch();
foreach ( $revisions as $row ) {
$batch->addObj( Title::makeTitleSafe( NS_USER, $row->ar_user_text ) );
$batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->ar_user_text ) );
}
$batch->execute();
$revisions->seek( 0 );
}
if( $haveFiles ) {
$batch = new LinkBatch();
foreach ( $files as $row ) {
$batch->addObj( Title::makeTitleSafe( NS_USER, $row->fa_user_text ) );
$batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->fa_user_text ) );
}
$batch->execute();
$files->seek( 0 );
}
if ( $this->mAllowed ) {
$action = $this->getTitle()->getLocalURL( array( 'action' => 'submit' ) );
# Start the form here
$top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
$out->addHTML( $top );
}
# Show relevant lines from the deletion log:
$deleteLogPage = new LogPage( 'delete' );
$out->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj );
# Show relevant lines from the suppression log:
$suppressLogPage = new LogPage( 'suppress' );
if( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
$out->addHTML( Xml::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj );
}
if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
if( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
$unsuppressBox =
"<tr>
<td> </td>
<td class='mw-input'>" .
Xml::checkLabel( $this->msg( 'revdelete-unsuppress' )->text(),
'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress ).
"</td>
</tr>";
} else {
$unsuppressBox = '';
}
$table =
Xml::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
Xml::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
"<tr>
<td colspan='2' class='mw-undelete-extrahelp'>" .
$this->msg( 'undeleteextrahelp' )->parseAsBlock() .
"</td>
</tr>
<tr>
<td class='mw-label'>" .
Xml::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
"</td>
<td class='mw-input'>" .
Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment' ) ) .
"</td>
</tr>
<tr>
<td> </td>
<td class='mw-submit'>" .
Xml::submitButton( $this->msg( 'undeletebtn' )->text(), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) . ' ' .
Xml::submitButton( $this->msg( 'undeleteinvert' )->text(), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
"</td>
</tr>" .
$unsuppressBox .
Xml::closeElement( 'table' ) .
Xml::closeElement( 'fieldset' );
$out->addHTML( $table );
}
$out->addHTML( Xml::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" );
if( $haveRevisions ) {
# The page's stored (deleted) history:
$out->addHTML( '<ul>' );
$remaining = $revisions->numRows();
$earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
foreach ( $revisions as $row ) {
$remaining--;
$out->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining ) );
}
$revisions->free();
$out->addHTML( '</ul>' );
} else {
$out->addWikiMsg( 'nohistory' );
}
if( $haveFiles ) {
$out->addHTML( Xml::element( 'h2', null, $this->msg( 'filehist' )->text() ) . "\n" );
$out->addHTML( '<ul>' );
foreach ( $files as $row ) {
$out->addHTML( $this->formatFileRow( $row ) );
}
$files->free();
$out->addHTML( '</ul>' );
}
if ( $this->mAllowed ) {
# Slip in the hidden controls here
$misc = Html::hidden( 'target', $this->mTarget );
$misc .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
$misc .= Xml::closeElement( 'form' );
$out->addHTML( $misc );
}
return true;
}
private function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
$rev = Revision::newFromArchiveRow( $row,
array(
'title' => $this->mTargetObj
) );
$revTextSize = '';
$ts = wfTimestamp( TS_MW, $row->ar_timestamp );
// Build checkboxen...
if( $this->mAllowed ) {
if( $this->mInvert ) {
if( in_array( $ts, $this->mTargetTimestamp ) ) {
$checkBox = Xml::check( "ts$ts" );
} else {
$checkBox = Xml::check( "ts$ts", true );
}
} else {
$checkBox = Xml::check( "ts$ts" );
}
} else {
$checkBox = '';
}
$user = $this->getUser();
// Build page & diff links...
if( $this->mCanView ) {
$titleObj = $this->getTitle();
# Last link
if( !$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
$pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
$last = $this->msg( 'diff' )->escaped();
} elseif( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
$pageLink = $this->getPageLink( $rev, $titleObj, $ts );
$last = Linker::linkKnown(
$titleObj,
$this->msg( 'diff' )->escaped(),
array(),
array(
'target' => $this->mTargetObj->getPrefixedText(),
'timestamp' => $ts,
'diff' => 'prev'
)
);
} else {
$pageLink = $this->getPageLink( $rev, $titleObj, $ts );
$last = $this->msg( 'diff' )->escaped();
}
} else {
$pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
$last = $this->msg( 'diff' )->escaped();
}
// User links
$userLink = Linker::revUserTools( $rev );
// Revision text size
$size = $row->ar_len;
if( !is_null( $size ) ) {
$revTextSize = Linker::formatRevisionSize( $size );
}
// Edit summary
$comment = Linker::revComment( $rev );
// Revision delete links
$revdlink = Linker::getRevDeleteLink( $user, $rev, $this->mTargetObj );
$revisionRow = $this->msg( 'undelete-revisionrow' )->rawParams( $checkBox, $revdlink, $last, $pageLink, $userLink, $revTextSize, $comment )->escaped();
return "<li>$revisionRow</li>";
}
private function formatFileRow( $row ) {
$file = ArchivedFile::newFromRow( $row );
$ts = wfTimestamp( TS_MW, $row->fa_timestamp );
$user = $this->getUser();
if( $this->mAllowed && $row->fa_storage_key ) {
$checkBox = Xml::check( 'fileid' . $row->fa_id );
$key = urlencode( $row->fa_storage_key );
$pageLink = $this->getFileLink( $file, $this->getTitle(), $ts, $key );
} else {
$checkBox = '';
$pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user );
}
$userLink = $this->getFileUser( $file );
$data = $this->msg( 'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text();
$bytes = $this->msg( 'parentheses' )->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size )->text() )->plain();
$data = htmlspecialchars( $data . ' ' . $bytes );
$comment = $this->getFileComment( $file );
// Add show/hide deletion links if available
$canHide = $user->isAllowed( 'deleterevision' );
if( $canHide || ( $file->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) ) {
if( !$file->userCan( File::DELETED_RESTRICTED, $user ) ) {
$revdlink = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
} else {
$query = array(
'type' => 'filearchive',
'target' => $this->mTargetObj->getPrefixedDBkey(),
'ids' => $row->fa_id
);
$revdlink = Linker::revDeleteLink( $query,
$file->isDeleted( File::DELETED_RESTRICTED ), $canHide );
}
} else {
$revdlink = '';
}
return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
}
/**
* Fetch revision text link if it's available to all users
*
* @param $rev Revision
* @param $titleObj Title
* @param $ts string Timestamp
* @return string
*/
function getPageLink( $rev, $titleObj, $ts ) {
$user = $this->getUser();
$time = $this->getLanguage()->userTimeAndDate( $ts, $user );
if( !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
return '<span class="history-deleted">' . $time . '</span>';
} else {
$link = Linker::linkKnown(
$titleObj,
htmlspecialchars( $time ),
array(),
array(
'target' => $this->mTargetObj->getPrefixedText(),
'timestamp' => $ts
)
);
if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
$link = '<span class="history-deleted">' . $link . '</span>';
}
return $link;
}
}
/**
* Fetch image view link if it's available to all users
*
* @param $file File
* @param $titleObj Title
* @param $ts string A timestamp
* @param $key String: a storage key
*
* @return String: HTML fragment
*/
function getFileLink( $file, $titleObj, $ts, $key ) {
$user = $this->getUser();
$time = $this->getLanguage()->userTimeAndDate( $ts, $user );
if( !$file->userCan( File::DELETED_FILE, $user ) ) {
return '<span class="history-deleted">' . $time . '</span>';
} else {
$link = Linker::linkKnown(
$titleObj,
htmlspecialchars( $time ),
array(),
array(
'target' => $this->mTargetObj->getPrefixedText(),
'file' => $key,
'token' => $user->getEditToken( $key )
)
);
if( $file->isDeleted( File::DELETED_FILE ) ) {
$link = '<span class="history-deleted">' . $link . '</span>';
}
return $link;
}
}
/**
* Fetch file's user id if it's available to this user
*
* @param $file File
* @return String: HTML fragment
*/
function getFileUser( $file ) {
if( !$file->userCan( File::DELETED_USER, $this->getUser() ) ) {
return '<span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$link = Linker::userLink( $file->getRawUser(), $file->getRawUserText() ) .
Linker::userToolLinks( $file->getRawUser(), $file->getRawUserText() );
if( $file->isDeleted( File::DELETED_USER ) ) {
$link = '<span class="history-deleted">' . $link . '</span>';
}
return $link;
}
}
/**
* Fetch file upload comment if it's available to this user
*
* @param $file File
* @return String: HTML fragment
*/
function getFileComment( $file ) {
if( !$file->userCan( File::DELETED_COMMENT, $this->getUser() ) ) {
return '<span class="history-deleted"><span class="comment">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span></span>';
} else {
$link = Linker::commentBlock( $file->getRawDescription() );
if( $file->isDeleted( File::DELETED_COMMENT ) ) {
$link = '<span class="history-deleted">' . $link . '</span>';
}
return $link;
}
}
function undelete() {
global $wgUploadMaintenance;
if ( $wgUploadMaintenance && $this->mTargetObj->getNamespace() == NS_FILE ) {
throw new ErrorPageError( 'undelete-error', 'filedelete-maintenance' );
}
if ( wfReadOnly() ) {
throw new ReadOnlyError;
}
$out = $this->getOutput();
$archive = new PageArchive( $this->mTargetObj );
wfRunHooks( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj ) );
$ok = $archive->undelete(
$this->mTargetTimestamp,
$this->mComment,
$this->mFileVersions,
$this->mUnsuppress,
$this->getUser()
);
if( is_array( $ok ) ) {
if ( $ok[1] ) { // Undeleted file count
wfRunHooks( 'FileUndeleteComplete', array(
$this->mTargetObj, $this->mFileVersions,
$this->getUser(), $this->mComment ) );
}
$link = Linker::linkKnown( $this->mTargetObj );
$out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
} else {
$out->setPageTitle( $this->msg( 'undelete-error' ) );
}
// Show revision undeletion warnings and errors
$status = $archive->getRevisionStatus();
if( $status && !$status->isGood() ) {
$out->addWikiText( '<div class="error">' . $status->getWikiText( 'cannotundelete', 'cannotundelete' ) . '</div>' );
}
// Show file undeletion warnings and errors
$status = $archive->getFileStatus();
if( $status && !$status->isGood() ) {
$out->addWikiText( '<div class="error">' . $status->getWikiText( 'undelete-error-short', 'undelete-error-long' ) . '</div>' );
}
}
}
| tychay/mediawiki-core | includes/specials/SpecialUndelete.php | PHP | gpl-2.0 | 46,697 |
package com.myselia.stem.communication.seekers;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import com.myselia.stem.communication.CommunicationDock;
public class LocalHostSeek implements Seek {
private volatile static LocalHostSeek uniqueInstance;
private DatagramSocket socket = null;
private String seekerName = "Local Host Seeker";
private LocalHostSeek() {
}
public void discoverComponents(byte[] infoPacket) throws IOException {
DatagramPacket networkPacket = new DatagramPacket(infoPacket, infoPacket.length,
InetAddress.getByName("127.0.0.1"), CommunicationDock.Component_Listen_Port);
socket.send(networkPacket);
}
@Override
public boolean hasSocket() {
if (socket == null)
return false;
return true;
}
@Override
public void setSocket(DatagramSocket socket) {
this.socket = socket;
}
public String printStatus(String componentType, String packet) {
return seekerName
+ "\n\t|-> Looking for: " + componentType + " on local port: " + CommunicationDock.Stem_Broadcast_Port
+ "\n\t|-> With packet: " + packet;
}
public static LocalHostSeek getInstance() {
if (uniqueInstance == null) {
synchronized (LocalNetworkSeek.class) {
if (uniqueInstance == null) {
uniqueInstance = new LocalHostSeek();
}
}
}
return uniqueInstance;
}
}
| Myselia/MyseliaStem | src/main/java/com/myselia/stem/communication/seekers/LocalHostSeek.java | Java | gpl-2.0 | 1,391 |
<?php
/**
* Single Product Sale Flash
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $post, $product;
?>
| teloniusz/rwwwdev | wp-content/themes/nimva/woocommerce/single-product/sale-flash.php | PHP | gpl-2.0 | 233 |
package kata;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class MyCollections {
public static String join(Collection collection) {
return join(collection, "");
}
public static String join(Collection collection, String separator) {
StringBuilder sb = new StringBuilder();
for (Object o : collection) {
sb.append(separator).append(o.toString());
}
return sb.substring(separator.length());
}
public static <T> List<T> filter(List<T> items, Predicate<T> predicate) {
List<T> result = new ArrayList<T>();
for (T item : items) {
if (predicate.evaluate(item)) {
result.add(item);
}
}
return result;
}
public static <T> boolean exists(List<T> items, Predicate<T> predicate) {
for (T item : items) {
if (predicate.evaluate(item)) {
return true;
}
}
return false;
}
public static <S> S reduce(List<S> items, FoldFunction<S, S> foldFunction) {
Iterator<S> iterator = items.iterator();
S first = iterator.next();
return reduce(iterator, first, foldFunction);
}
public static <S, T> T reduce(List<S> items, T initial, FoldFunction<S, T> foldFunction) {
return reduce(items.iterator(), initial, foldFunction);
}
private static <S, T> T reduce(Iterator<S> items, T initial, FoldFunction<S, T> foldFunction) {
T result = initial;
while (items.hasNext()) {
result = foldFunction.execute(result, items.next());
}
return result;
}
}
| graeme-lockley/string-calculator-java6-pbt | src/test/java/kata/MyCollections.java | Java | gpl-2.0 | 1,712 |
# encoding: utf-8
# module PIL._imaging
# from /usr/lib/python2.7/dist-packages/PIL/_imaging.so
# by generator 1.135
# no doc
# no imports
# Variables with simple values
DEFAULT_STRATEGY = 0
FILTERED = 1
FIXED = 4
HUFFMAN_ONLY = 2
jpeglib_version = '8.0'
PILLOW_VERSION = '2.5.1'
RLE = 3
zlib_version = '1.2.8'
# functions
def alpha_composite(*args, **kwargs): # real signature unknown
pass
def bit_decoder(*args, **kwargs): # real signature unknown
pass
def blend(*args, **kwargs): # real signature unknown
pass
def convert(*args, **kwargs): # real signature unknown
pass
def copy(*args, **kwargs): # real signature unknown
pass
def crc32(*args, **kwargs): # real signature unknown
pass
def draw(*args, **kwargs): # real signature unknown
pass
def effect_mandelbrot(*args, **kwargs): # real signature unknown
pass
def effect_noise(*args, **kwargs): # real signature unknown
pass
def eps_encoder(*args, **kwargs): # real signature unknown
pass
def fill(*args, **kwargs): # real signature unknown
pass
def fli_decoder(*args, **kwargs): # real signature unknown
pass
def font(*args, **kwargs): # real signature unknown
pass
def getcodecstatus(*args, **kwargs): # real signature unknown
pass
def getcount(*args, **kwargs): # real signature unknown
pass
def gif_decoder(*args, **kwargs): # real signature unknown
pass
def gif_encoder(*args, **kwargs): # real signature unknown
pass
def hex_decoder(*args, **kwargs): # real signature unknown
pass
def hex_encoder(*args, **kwargs): # real signature unknown
pass
def jpeg_decoder(*args, **kwargs): # real signature unknown
pass
def jpeg_encoder(*args, **kwargs): # real signature unknown
pass
def libtiff_decoder(*args, **kwargs): # real signature unknown
pass
def libtiff_encoder(*args, **kwargs): # real signature unknown
pass
def linear_gradient(*args, **kwargs): # real signature unknown
pass
def map_buffer(*args, **kwargs): # real signature unknown
pass
def msp_decoder(*args, **kwargs): # real signature unknown
pass
def new(*args, **kwargs): # real signature unknown
pass
def open_ppm(*args, **kwargs): # real signature unknown
pass
def outline(*args, **kwargs): # real signature unknown
pass
def packbits_decoder(*args, **kwargs): # real signature unknown
pass
def path(*args, **kwargs): # real signature unknown
pass
def pcd_decoder(*args, **kwargs): # real signature unknown
pass
def pcx_decoder(*args, **kwargs): # real signature unknown
pass
def pcx_encoder(*args, **kwargs): # real signature unknown
pass
def radial_gradient(*args, **kwargs): # real signature unknown
pass
def raw_decoder(*args, **kwargs): # real signature unknown
pass
def raw_encoder(*args, **kwargs): # real signature unknown
pass
def sun_rle_decoder(*args, **kwargs): # real signature unknown
pass
def tga_rle_decoder(*args, **kwargs): # real signature unknown
pass
def tiff_lzw_decoder(*args, **kwargs): # real signature unknown
pass
def wedge(*args, **kwargs): # real signature unknown
pass
def xbm_decoder(*args, **kwargs): # real signature unknown
pass
def xbm_encoder(*args, **kwargs): # real signature unknown
pass
def zip_decoder(*args, **kwargs): # real signature unknown
pass
def zip_encoder(*args, **kwargs): # real signature unknown
pass
# no classes
| ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PIL/_imaging.py | Python | gpl-2.0 | 3,425 |
<?php
# Inlcuir comentários e informações sobre o sistema
#
################################################################################
# CHANGELOG #
################################################################################
# incluir um changelog
################################################################################
include ("../../includes/include_geral.inc.php");
include ("../../includes/include_geral_II.inc.php");
//$hoje = datab(time());
?>
<HTML>
<BODY bgcolor=<?php print BODY_COLOR?>>
<TABLE bgcolor="black" cellspacing="1" border="1" cellpadding="1" align="center" width="100%">
<TD bgcolor=<?php print TD_COLOR?>>
<TABLE cellspacing="0" border="0" cellpadding="0" bgcolor=<?php print TD_COLOR?>>
<TR>
<?php
$cor1 = TD_COLOR;
print "<TD bgcolor=$cor1 nowrap><b>OcoMon - Módulo de Ocorrências</b></TD>";
echo menu_usuario();
if ($s_usuario=='admin')
{
echo menu_admin();
}
?>
</TR>
</TABLE>
</TD>
</TABLE>
<BR>
<B>Relatório de ocorrências por equipamento - COM BUG</B>
<BR>
<FORM method="POST" action=mostra_relatorio_periodo_equipamento.php>
<TABLE border="1" align="center" width="100%" bgcolor=<?php print BODY_COLOR?>>
<TR>
<TABLE border="1" align="center" width="100%" bgcolor=<?php print TD_COLOR?>>
<TD width="20%" align="left" bgcolor=<?php print TD_COLOR?>>Data abertura (inicial):</TD>
<TD width="30%" align="left" bgcolor=<?php print BODY_COLOR?>><?php print "<INPUT type=text name=data_inicial value=\"$hoje\" size=15 maxlength=15>";?></TD>
<TD width="20%" align="left" bgcolor=<?php print TD_COLOR?>>Data abertura (final):</TD>
<TD width="30%" align="left" bgcolor=<?php print BODY_COLOR?>><?php print "<INPUT type=text name=data_final value=\"$hoje\" size=15 maxlength=15>";?></TD>
</TABLE>
</TR>
<TR>
<TABLE border="0" cellpadding="0" cellspacing="0" align="center" width="100%" bgcolor=<?php print TD_COLOR?>>
<BR>
<TD align="center" width="50%" bgcolor=<?php print BODY_COLOR?>><input type="submit" value=" Ok " name="ok" onclick="ok=sim">
<input type="hidden" name="rodou" value="sim">
</TD>
<TD align="center" width="50%" bgcolor=<?php print BODY_COLOR?>><INPUT type="reset" value="Cancelar" name="cancelar"></TD>
</TABLE>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
| danfmsouza/yipservicedesk | ocomon/geral/relatorio_periodo_equipamento.php | PHP | gpl-2.0 | 2,865 |
/*
* Mesh.hpp
*
* RTfact - Real-Time Ray Tracing Library
*
* Copyright (C) 2010 Saarland University
*
* 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
*
* Created on: 2010-09-26 19:11:26 +0200
* Author(s): Felix Klein
*/
#ifndef RTFACT_RTPIE__MESH_HPP
#define RTFACT_RTPIE__MESH_HPP
#include "Config/InternalCommon.hpp"
#include <RTpie/Scene/IMesh.hpp>
RTFACT_RTPIE_FORWARD(Mesh)
#include "Base/SceneObject.hpp"
#include "Scene/Appearance.hpp"
RTFACT_RTPIE_NAMESPACE_BEGIN
class Mesh : public SceneObject, public IMesh
{
friend class Scene;
friend class Renderer;
friend class Instance;
public:
// IUnknown
RTFACT_RTPIE_DECLARE_QI
RTFACT_RTPIE_FORWARD_BASE
// IMesh
virtual HRESULT GetGeometry(IGeometry **_retval);
virtual HRESULT SetPrimitives(
const uint32 aTriangleCount,
const int32* aIndices,
const float* aVertices,
const float* aNormals,
const float* aVertexColors,
const float* aTexCoords
);
//virtual void addPrimitive(
// const RTfact::RTpie::Triangle& aPrim);
virtual HRESULT ClearPrimitives();
virtual HRESULT GetPrimitiveCount(unsigned int *_retval);
virtual HRESULT SetAppearance(
IAppearance *aApp);
// Internal
private:
t_InternMeshHandle mMesh;
AppearancePtr mAppearance;
public:
Mesh(Scene *aScene, t_InternMeshHandle aMesh);
virtual ~Mesh();
};
RTFACT_RTPIE_NAMESPACE_END
#endif // RTFACT_RTPIE__MESH_HPP
| BALL-Contrib/contrib_rtfact_4f1d028 | rtpie/src/Scene/Mesh.hpp | C++ | gpl-2.0 | 2,200 |
// Copyright © 2004, 2011, 2013, Oracle and/or its affiliates. All rights reserved.
//
// MySQL Connector/NET is licensed under the terms of the GPLv2
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
// MySQL Connectors. There are special exceptions to the terms and
// conditions of the GPLv2 as it is applied to this software, see the
// FLOSS License Exception
// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Management;
using System.Reflection;
namespace MySql.Data.MySqlClient {
/// <summary>
/// Summary description for ClientParam.
/// </summary>
[Flags]
internal enum ClientFlags : ulong {
LongPassword = 1, // new more secure passwords
FoundRows = 2, // found instead of affected rows
LongFlag = 4, // Get all column flags
ConnectWithDb = 8, // One can specify db on connect
NoSchema = 16, // Don't allow db.table.column
Compress = 32, // Client can use compression protocol
Odbc = 64, // ODBC client
LocalFiles = 128, // Can use LOAD DATA LOCAL
IgnoreSpace = 256, // Ignore spaces before '('
Protocol41 = 512, // Support new 4.1 protocol
Interactive = 1024, // This is an interactive client
Ssl = 2048, // Switch to SSL after handshake
IgnoreSigpipe = 4096, // IGNORE sigpipes
Transactions = 8192, // Client knows about transactions
Reserved = 16384, // old 4.1 protocol flag
SecureConnection = 32768, // new 4.1 authentication
MultiStatements = 65536, // Allow multi-stmt support
MultiResults = 131072, // Allow multiple resultsets
PsMultiResults = 1UL << 18, // allow multi results using PS protocol
PluginAuth = ( 1UL << 19 ), //Client supports plugin authentication
ConnectAttrs = ( 1UL << 20 ), // Allows client connection attributes
CanHandleExpiredPassword = ( 1UL << 22 ), // Support for password expiration > 5.6.6
ClientSslVerifyServerCert = ( 1UL << 30 ),
ClientRememberOptions = ( 1UL << 31 )
}
[Flags]
internal enum ServerStatusFlags {
InTransaction = 1, // Transaction has started
AutoCommitMode = 2, // Server in auto_commit mode
MoreResults = 4, // More results on server
AnotherQuery = 8, // Multi query - next query exists
BadIndex = 16,
NoIndex = 32,
CursorExists = 64,
LastRowSent = 128,
OutputParameters = 4096
}
/// <summary>
/// DB Operations Code
/// </summary>
internal enum DbCmd : byte {
Sleep = 0,
Quit = 1,
InitDb = 2,
Query = 3,
FieldList = 4,
CreateDb = 5,
DropDb = 6,
Reload = 7,
Shutdown = 8,
Statistics = 9,
ProcessInfo = 10,
Connect = 11,
ProcessKill = 12,
Debug = 13,
Ping = 14,
Time = 15,
DelayedInsert = 16,
ChangeUser = 17,
BinlogDump = 18,
TableDump = 19,
ConnectOut = 20,
RegisterSlave = 21,
Prepare = 22,
Execute = 23,
LongData = 24,
CloseStmt = 25,
ResetStmt = 26,
SetOption = 27,
Fetch = 28
}
/// <summary>
/// Specifies MySQL specific data type of a field, property, for use in a <see cref="MySqlParameter"/>.
/// </summary>
public enum MySqlDbType {
/// <summary>
/// <see cref="Decimal"/>
/// <para>A fixed precision and scale numeric value between -1038
/// -1 and 10 38 -1.</para>
/// </summary>
Decimal = 0,
/// <summary>
/// <see cref="Byte"/><para>The signed range is -128 to 127. The unsigned
/// range is 0 to 255.</para>
/// </summary>
Byte = 1,
/// <summary>
/// <see cref="Int16"/><para>A 16-bit signed integer. The signed range is
/// -32768 to 32767. The unsigned range is 0 to 65535</para>
/// </summary>
Int16 = 2,
/// <summary>
/// Specifies a 24 (3 byte) signed or unsigned value.
/// </summary>
Int24 = 9,
/// <summary>
/// <see cref="Int32"/><para>A 32-bit signed integer</para>
/// </summary>
Int32 = 3,
/// <summary>
/// <see cref="long"/><para>A 64-bit signed integer.</para>
/// </summary>
Int64 = 8,
/// <summary>
/// <see cref="float"/><para>A small (single-precision) floating-point
/// number. Allowable values are -3.402823466E+38 to -1.175494351E-38,
/// 0, and 1.175494351E-38 to 3.402823466E+38.</para>
/// </summary>
Float = 4,
/// <summary>
/// <see cref="double"/><para>A normal-size (double-precision)
/// floating-point number. Allowable values are -1.7976931348623157E+308
/// to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to
/// 1.7976931348623157E+308.</para>
/// </summary>
Double = 5,
/// <summary>
/// A timestamp. The range is '1970-01-01 00:00:00' to sometime in the
/// year 2037
/// </summary>
Timestamp = 7,
///<summary>
///Date The supported range is '1000-01-01' to '9999-12-31'.
///</summary>
Date = 10,
/// <summary>
/// Time <para>The range is '-838:59:59' to '838:59:59'.</para>
/// </summary>
Time = 11,
///<summary>
///DateTime The supported range is '1000-01-01 00:00:00' to
///'9999-12-31 23:59:59'.
///</summary>
DateTime = 12,
///<summary>
///Datetime The supported range is '1000-01-01 00:00:00' to
///'9999-12-31 23:59:59'.
///</summary>
[Obsolete( "The Datetime enum value is obsolete. Please use DateTime." )]
Datetime = 12,
/// <summary>
/// A year in 2- or 4-digit format (default is 4-digit). The
/// allowable values are 1901 to 2155, 0000 in the 4-digit year
/// format, and 1970-2069 if you use the 2-digit format (70-69).
/// </summary>
Year = 13,
/// <summary>
/// <b>Obsolete</b> Use Datetime or Date type
/// </summary>
Newdate = 14,
/// <summary>
/// A variable-length string containing 0 to 65535 characters
/// </summary>
VarString = 15,
/// <summary>
/// Bit-field data type
/// </summary>
Bit = 16,
/// <summary>
/// New Decimal
/// </summary>
NewDecimal = 246,
/// <summary>
/// An enumeration. A string object that can have only one value,
/// chosen from the list of values 'value1', 'value2', ..., NULL
/// or the special "" error value. An ENUM can have a maximum of
/// 65535 distinct values
/// </summary>
Enum = 247,
/// <summary>
/// A set. A string object that can have zero or more values, each
/// of which must be chosen from the list of values 'value1', 'value2',
/// ... A SET can have a maximum of 64 members.
/// </summary>
Set = 248,
/// <summary>
/// A binary column with a maximum length of 255 (2^8 - 1)
/// characters
/// </summary>
TinyBlob = 249,
/// <summary>
/// A binary column with a maximum length of 16777215 (2^24 - 1) bytes.
/// </summary>
MediumBlob = 250,
/// <summary>
/// A binary column with a maximum length of 4294967295 or
/// 4G (2^32 - 1) bytes.
/// </summary>
LongBlob = 251,
/// <summary>
/// A binary column with a maximum length of 65535 (2^16 - 1) bytes.
/// </summary>
Blob = 252,
/// <summary>
/// A variable-length string containing 0 to 255 bytes.
/// </summary>
VarChar = 253,
/// <summary>
/// A fixed-length string.
/// </summary>
String = 254,
/// <summary>
/// Geometric (GIS) data type.
/// </summary>
Geometry = 255,
/// <summary>
/// Unsigned 8-bit value.
/// </summary>
UByte = 501,
/// <summary>
/// Unsigned 16-bit value.
/// </summary>
UInt16 = 502,
/// <summary>
/// Unsigned 24-bit value.
/// </summary>
UInt24 = 509,
/// <summary>
/// Unsigned 32-bit value.
/// </summary>
UInt32 = 503,
/// <summary>
/// Unsigned 64-bit value.
/// </summary>
UInt64 = 508,
/// <summary>
/// Fixed length binary string.
/// </summary>
Binary = 600,
/// <summary>
/// Variable length binary string.
/// </summary>
VarBinary = 601,
/// <summary>
/// A text column with a maximum length of 255 (2^8 - 1) characters.
/// </summary>
TinyText = 749,
/// <summary>
/// A text column with a maximum length of 16777215 (2^24 - 1) characters.
/// </summary>
MediumText = 750,
/// <summary>
/// A text column with a maximum length of 4294967295 or
/// 4G (2^32 - 1) characters.
/// </summary>
LongText = 751,
/// <summary>
/// A text column with a maximum length of 65535 (2^16 - 1) characters.
/// </summary>
Text = 752,
/// <summary>
/// A guid column
/// </summary>
Guid = 800
};
internal enum FieldType : byte {
Decimal = 0,
Byte = 1,
Short = 2,
Long = 3,
Float = 4,
Double = 5,
Null = 6,
Timestamp = 7,
Longlong = 8,
Int24 = 9,
Date = 10,
Time = 11,
Datetime = 12,
Year = 13,
Newdate = 14,
Enum = 247,
Set = 248,
TinyBlob = 249,
MediumBlob = 250,
LongBlob = 251,
Blob = 252,
VarString = 253,
String = 254
}
/// <summary>
/// Allows the user to specify the type of connection that should
/// be used.
/// </summary>
public enum MySqlConnectionProtocol {
/// <summary>
/// TCP/IP style connection. Works everywhere.
/// </summary>
Sockets = 1,
Socket = 1,
Tcp = 1,
/// <summary>
/// Named pipe connection. Works only on Windows systems.
/// </summary>
Pipe = 2,
NamedPipe = 2,
/// <summary>
/// Unix domain socket connection. Works only with Unix systems.
/// </summary>
UnixSocket = 3,
Unix = 3,
/// <summary>
/// Shared memory connection. Currently works only with Windows systems.
/// </summary>
SharedMemory = 4,
Memory = 4
}
/// <summary>
/// SSL options for connection.
/// </summary>
public enum MySqlSslMode {
/// <summary>
/// Do not use SSL.
/// </summary>
None,
/// <summary>
/// Use SSL, if server supports it.
/// </summary>
Preferred,
Prefered = Preferred,
/// <summary>
/// Always use SSL. Deny connection if server does not support SSL.
/// Do not perform server certificate validation.
/// </summary>
Required,
/// <summary>
/// Always use SSL. Validate server SSL certificate, but different host name mismatch.
/// </summary>
VerifyCa,
/// <summary>
/// Always use SSL and perform full certificate validation.
/// </summary>
VerifyFull
}
/// <summary>
/// Specifies the connection types supported
/// </summary>
public enum MySqlDriverType {
/// <summary>
/// Use TCP/IP sockets.
/// </summary>
Native,
/// <summary>
/// Use client library.
/// </summary>
Client,
/// <summary>
/// Use MySQL embedded server.
/// </summary>
Embedded
}
public enum MySqlCertificateStoreLocation {
/// <summary>
/// Do not use certificate store
/// </summary>
None,
/// <summary>
/// Use certificate store for the current user
/// </summary>
CurrentUser,
/// <summary>
/// User certificate store for the machine
/// </summary>
LocalMachine
}
internal class MySqlConnectAttrs {
[DisplayName( "_client_name" )]
public string ClientName => "MySql Connector/NET";
[DisplayName( "_pid" )]
public string Pid {
get {
var pid = string.Empty;
try {
pid = Process.GetCurrentProcess().Id.ToString();
}
catch ( Exception ex ) {
Debug.WriteLine( ex.ToString() );
}
return pid;
}
}
[DisplayName( "_client_version" )]
public string ClientVersion {
get {
var version = string.Empty;
try {
version = Assembly.GetAssembly( typeof( MySqlConnectAttrs ) ).GetName().Version.ToString();
}
catch ( Exception ex ) {
Debug.WriteLine( ex.ToString() );
}
return version;
}
}
[DisplayName( "_platform" )]
public string Platform => Is64BitOs() ? "x86_64" : "x86_32";
[DisplayName( "program_name" )]
public string ProgramName {
get {
string name;
try {
var path = Environment.CommandLine.Substring( 0, Environment.CommandLine.InvariantIndexOf( "\" " ) ).Trim( '"' );
name = Path.GetFileName( path );
if ( Assembly.GetEntryAssembly() != null ) name = Assembly.GetEntryAssembly().ManifestModule.Name;
}
catch ( Exception ex ) {
name = string.Empty;
Debug.WriteLine( ex.ToString() );
}
return name;
}
}
[DisplayName( "_os" )]
public string Os {
get {
var os = string.Empty;
try {
os = Environment.OSVersion.Platform.ToString();
if ( os == "Win32NT" ) {
os = "Win";
os += Is64BitOs() ? "64" : "32";
}
}
catch ( Exception ex ) {
Debug.WriteLine( ex.ToString() );
}
return os;
}
}
[DisplayName( "_os_details" )]
public string OsDetails {
get {
var os = string.Empty;
try {
var searcher = new ManagementObjectSearcher( "SELECT * FROM Win32_OperatingSystem" );
var collection = searcher.Get();
foreach ( var mgtObj in collection ) {
os = mgtObj.GetPropertyValue( "Caption" ).ToString();
break;
}
}
catch ( Exception ex ) {
Debug.WriteLine( ex.ToString() );
}
return os;
}
}
[DisplayName( "_thread" )]
public string Thread {
get {
var thread = string.Empty;
try {
thread = Process.GetCurrentProcess().Threads[ 0 ].Id.ToString();
}
catch ( Exception ex ) {
Debug.WriteLine( ex.ToString() );
}
return thread;
}
}
private bool Is64BitOs() {
return Environment.Is64BitOperatingSystem;
}
}
} | old-kasthack-s-projects/connectornet | Source/MySql.Data/MysqlDefs.cs | C# | gpl-2.0 | 16,986 |
<?php
global $base_path;
$about_company_path = $base_path . "about/company";
$about_team_path = $base_path . "about/team";
$theme_path = $base_path . drupal_get_path('theme', 'changshanews');
$about_memberdetail_path = $base_path . "about/memberdetail";
$theme_path = $base_path . drupal_get_path('theme', 'changshanews');
//$member = array();
$consultants = array();
$experts = array();
$result = db_query("SELECT nid FROM node WHERE type = :type", array(':type' => 'member'))->fetchAll();
$nids = array();
foreach ($result as $row) {
$node = node_load($row->nid);
$member = new stdClass();
$member->nid = $row->nid;
$member->m_name = $node->field_m_name['und'][0]['value'];
$member->m_s_image = $node->field_image['und'][0]['uri'];
$member->m_weight = $node->field_m_weight['und'][0]['value'];
$member->m_type = $node->field_m_type['und'][0]['value'];
if ($member->m_type == 0) {
$consultants[] = $member;
} else {
$experts[] = $member;
}
}
function compareItems($a, $b){
if ( $a->m_weight < $b->m_weight ) return -1;
if ( $a->m_weight > $b->m_weight ) return 1;
return 0; // equality
}
uasort($consultants, "compareItems");
uasort($experts, "compareItems");
?>
<script type="text/javascript">
jQuery(function(){
jQuery( ".active" ).find('a').css('color','black');
jQuery( ".unactive" ).find('a').css('color','#666666');
});
</script>
<div id="work_about" class="work_about ">
<ul class="ul_left">
<li class="unactive"><a href="<?php print $about_company_path; ?>">关于公司</a></li>
<li class="active"><a href="<?php print $about_team_path; ?>">关于团队</a></li>
</ul>
<div class="div_right">
<span class="en_right">A BRAND / A SOUND</span>
<span class="chinese_right">一个品牌一个声音</span>
</div>
<div class="work_about_team_main" >
<div class="team_member_list">
<div><p>顾问专家</p></div>
<div class="team_member_imgs">
<?php $i=0; foreach($experts as $expert):
$i++;
$url = file_create_url($expert->m_s_image);
$url = parse_url($url);
$path = $url['path'];
?>
<?php if($i%4 == 0) :?>
<div class="team_member_imglast ">
<?php else:?>
<div class="team_member_img ">
<?php endif?>
<div class="member_img ">
<a href="<?php print $about_memberdetail_path.'/'.$expert->nid ?>" >
<img src="<?php print $path; ?>" />
</a>
</div>
<div class="member_name"><?php print $expert->m_name; ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<div style="clear:both;">
<div class="team_member_list">
<div><p>团队成员</p></div>
<div class="team_member_imgs">
<?php $i=0; foreach($consultants as $consultant):
$i++;
$url = '';
if(empty($consultant->m_s_image)){
$path = $theme_path.'/images/no-image.png';
} else {
$url = $consultant->m_s_image;
$url = file_create_url($url);
$url = parse_url($url);
$path = $url['path'];
}
?>
<?php if($i%4 == 0) :?>
<div class="team_member_imglast ">
<?php else:?>
<div class="team_member_img ">
<?php endif?>
<div class="member_img ">
<a href="<?php print $about_memberdetail_path.'/'.$consultant->nid ?>" >
<img src="<?php print $path; ?>" />
</a>
</div>
<div class="member_name"><?php print $consultant->m_name; ?></div>
</div>
<?php endforeach; ?>
</div>
</div>
<div style="clear:both;padding-bottom: 30px;"></div>
</div>
</div>
| Tomtang2013/changsha2 | sites/all/themes/changshanews/templates/about/team.tpl.php | PHP | gpl-2.0 | 4,470 |
<?php
namespace ElmarHinz\TypoScriptParser\Tokens;
final class TypoScriptConditionToken extends AbstractTypoScriptToken
{
CONST TYPE = 'condition';
protected $classes = 'ts-condition';
}
| elmar-hinz/TX.tsp | Classes/Tokens/TypoScriptConditionToken.php | PHP | gpl-2.0 | 198 |
# include <stdio.h>
int n;
int a[25][25];
int main()
{
while (~scanf("%d", &n)) {
int cnt = 0;
int xl = 1, yl = 1, xr = n, yr = n;
while (cnt < n*n) {
for (int i = xl; cnt<n*n && i <= xr; ++i) a[yl][i] = ++cnt;
for (int i = yl+1; cnt<n*n && i <= yr; ++i) a[i][xr] = ++cnt;
for (int i = xr-1; cnt<n*n && i >= xl; --i) a[yr][i] = ++cnt;
for (int i = yr-1; cnt<n*n && i >= yl+1; --i) a[i][xl] = ++cnt;
++xl, ++yl, --xr, --yr;
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (j>1) putchar(' ');
printf("%d", a[i][j]);
}
printf("\n");
}
printf("\n");
}
return 0;
}
| fyh/training | other/nc-ha/79.cpp | C++ | gpl-2.0 | 778 |
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.eclipse.org/org/documents/epl-v10.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.ide.eclipse.adt.internal.wizards.newxmlfile;
import static com.android.SdkConstants.DOT_XML;
import static com.android.SdkConstants.HORIZONTAL_SCROLL_VIEW;
import static com.android.SdkConstants.LINEAR_LAYOUT;
import static com.android.SdkConstants.RES_QUALIFIER_SEP;
import static com.android.SdkConstants.SCROLL_VIEW;
import static com.android.SdkConstants.VALUE_FILL_PARENT;
import static com.android.SdkConstants.VALUE_MATCH_PARENT;
import static com.android.ide.eclipse.adt.AdtConstants.WS_SEP_CHAR;
import static com.android.ide.eclipse.adt.internal.wizards.newxmlfile.ChooseConfigurationPage.RES_FOLDER_ABS;
import com.android.SdkConstants;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.ResourceQualifier;
import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AdtUtils;
import com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.descriptors.DocumentDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.descriptors.IDescriptorProvider;
import com.android.ide.eclipse.adt.internal.project.ProjectChooserHelper;
import com.android.ide.eclipse.adt.internal.project.ProjectChooserHelper.ProjectCombo;
import com.android.ide.eclipse.adt.internal.resources.ResourceNameValidator;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.sdk.Sdk.TargetChangeListener;
import com.android.resources.ResourceFolderType;
import com.android.sdklib.IAndroidTarget;
import com.android.utils.Pair;
import com.android.utils.SdkUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
/**
* This is the first page of the {@link NewXmlFileWizard} which provides the ability to create
* skeleton XML resources files for Android projects.
* <p/>
* This page is used to select the project, resource type and file name.
*/
class NewXmlFileCreationPage extends WizardPage {
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
// Ensure the initial focus is in the Name field; you usually don't need
// to edit the default text field (the project name)
if (visible && mFileNameTextField != null) {
mFileNameTextField.setFocus();
}
validatePage();
}
/**
* Information on one type of resource that can be created (e.g. menu, pref, layout, etc.)
*/
static class TypeInfo {
private final String mUiName;
private final ResourceFolderType mResFolderType;
private final String mTooltip;
private final Object mRootSeed;
private ArrayList<String> mRoots = new ArrayList<String>();
private final String mXmlns;
private final String mDefaultAttrs;
private final String mDefaultRoot;
private final int mTargetApiLevel;
public TypeInfo(String uiName,
String tooltip,
ResourceFolderType resFolderType,
Object rootSeed,
String defaultRoot,
String xmlns,
String defaultAttrs,
int targetApiLevel) {
mUiName = uiName;
mResFolderType = resFolderType;
mTooltip = tooltip;
mRootSeed = rootSeed;
mDefaultRoot = defaultRoot;
mXmlns = xmlns;
mDefaultAttrs = defaultAttrs;
mTargetApiLevel = targetApiLevel;
}
/** Returns the UI name for the resource type. Unique. Never null. */
String getUiName() {
return mUiName;
}
/** Returns the tooltip for the resource type. Can be null. */
String getTooltip() {
return mTooltip;
}
/**
* Returns the name of the {@link ResourceFolderType}.
* Never null but not necessarily unique,
* e.g. two types use {@link ResourceFolderType#XML}.
*/
String getResFolderName() {
return mResFolderType.getName();
}
/**
* Returns the matching {@link ResourceFolderType}.
* Never null but not necessarily unique,
* e.g. two types use {@link ResourceFolderType#XML}.
*/
ResourceFolderType getResFolderType() {
return mResFolderType;
}
/**
* Returns the seed used to fill the root element values.
* The seed might be either a String, a String array, an {@link ElementDescriptor},
* a {@link DocumentDescriptor} or null.
*/
Object getRootSeed() {
return mRootSeed;
}
/**
* Returns the default root element that should be selected by default. Can be
* null.
*
* @param project the associated project, or null if not known
*/
String getDefaultRoot(IProject project) {
return mDefaultRoot;
}
/**
* Returns the list of all possible root elements for the resource type.
* This can be an empty ArrayList but not null.
* <p/>
* TODO: the root list SHOULD depend on the currently selected project, to include
* custom classes.
*/
ArrayList<String> getRoots() {
return mRoots;
}
/**
* If the generated resource XML file requires an "android" XMLNS, this should be set
* to {@link SdkConstants#NS_RESOURCES}. When it is null, no XMLNS is generated.
*/
String getXmlns() {
return mXmlns;
}
/**
* When not null, this represent extra attributes that must be specified in the
* root element of the generated XML file. When null, no extra attributes are inserted.
*
* @param project the project to get the attributes for
* @param root the selected root element string, never null
*/
String getDefaultAttrs(IProject project, String root) {
return mDefaultAttrs;
}
/**
* When not null, represents an extra string that should be written inside
* the element when constructed
*
* @param project the project to get the child content for
* @param root the chosen root element
* @return a string to be written inside the root element, or null if nothing
*/
String getChild(IProject project, String root) {
return null;
}
/**
* The minimum API level required by the current SDK target to support this feature.
*
* @return the minimum API level
*/
public int getTargetApiLevel() {
return mTargetApiLevel;
}
}
/**
* TypeInfo, information for each "type" of file that can be created.
*/
private static final TypeInfo[] sTypes = {
new TypeInfo(
"Layout", // UI name
"An XML file that describes a screen layout.", // tooltip
ResourceFolderType.LAYOUT, // folder type
AndroidTargetData.DESCRIPTOR_LAYOUT, // root seed
LINEAR_LAYOUT, // default root
SdkConstants.NS_RESOURCES, // xmlns
"", // not used, see below
1 // target API level
) {
@Override
String getDefaultRoot(IProject project) {
// TODO: Use GridLayout by default for new SDKs
// (when we've ironed out all the usability issues)
//Sdk currentSdk = Sdk.getCurrent();
//if (project != null && currentSdk != null) {
// IAndroidTarget target = currentSdk.getTarget(project);
// // fill_parent was renamed match_parent in API level 8
// if (target != null && target.getVersion().getApiLevel() >= 13) {
// return GRID_LAYOUT;
// }
//}
return LINEAR_LAYOUT;
};
// The default attributes must be determined dynamically since whether
// we use match_parent or fill_parent depends on the API level of the
// project
@Override
String getDefaultAttrs(IProject project, String root) {
Sdk currentSdk = Sdk.getCurrent();
String fill = VALUE_FILL_PARENT;
if (currentSdk != null) {
IAndroidTarget target = currentSdk.getTarget(project);
// fill_parent was renamed match_parent in API level 8
if (target != null && target.getVersion().getApiLevel() >= 8) {
fill = VALUE_MATCH_PARENT;
}
}
// Only set "vertical" orientation of LinearLayouts by default;
// for GridLayouts for example we want to rely on the real default
// of the layout
String size = String.format(
"android:layout_width=\"%1$s\"\n" //$NON-NLS-1$
+ "android:layout_height=\"%2$s\"", //$NON-NLS-1$
fill, fill);
if (LINEAR_LAYOUT.equals(root)) {
return "android:orientation=\"vertical\"\n" + size; //$NON-NLS-1$
} else {
return size;
}
}
@Override
String getChild(IProject project, String root) {
// Create vertical linear layouts inside new scroll views
if (SCROLL_VIEW.equals(root) || HORIZONTAL_SCROLL_VIEW.equals(root)) {
return " <LinearLayout " //$NON-NLS-1$
+ getDefaultAttrs(project, root).replace('\n', ' ')
+ "></LinearLayout>\n"; //$NON-NLS-1$
}
return null;
}
},
new TypeInfo("Values", // UI name
"An XML file with simple values: colors, strings, dimensions, etc.", // tooltip
ResourceFolderType.VALUES, // folder type
SdkConstants.TAG_RESOURCES, // root seed
null, // default root
null, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("Drawable", // UI name
"An XML file that describes a drawable.", // tooltip
ResourceFolderType.DRAWABLE, // folder type
AndroidTargetData.DESCRIPTOR_DRAWABLE, // root seed
null, // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("Menu", // UI name
"An XML file that describes an menu.", // tooltip
ResourceFolderType.MENU, // folder type
SdkConstants.TAG_MENU, // root seed
null, // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("Color List", // UI name
"An XML file that describes a color state list.", // tooltip
ResourceFolderType.COLOR, // folder type
AndroidTargetData.DESCRIPTOR_COLOR, // root seed
"selector", //$NON-NLS-1$ // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("Property Animation", // UI name
"An XML file that describes a property animation", // tooltip
ResourceFolderType.ANIMATOR, // folder type
AndroidTargetData.DESCRIPTOR_ANIMATOR, // root seed
"set", //$NON-NLS-1$ // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
11 // target API level
),
new TypeInfo("Tween Animation", // UI name
"An XML file that describes a tween animation.", // tooltip
ResourceFolderType.ANIM, // folder type
AndroidTargetData.DESCRIPTOR_ANIM, // root seed
"set", //$NON-NLS-1$ // default root
null, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("AppWidget Provider", // UI name
"An XML file that describes a widget provider.", // tooltip
ResourceFolderType.XML, // folder type
AndroidTargetData.DESCRIPTOR_APPWIDGET_PROVIDER, // root seed
null, // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
3 // target API level
),
new TypeInfo("Preference", // UI name
"An XML file that describes preferences.", // tooltip
ResourceFolderType.XML, // folder type
AndroidTargetData.DESCRIPTOR_PREFERENCES, // root seed
SdkConstants.CLASS_NAME_PREFERENCE_SCREEN, // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
1 // target API level
),
new TypeInfo("Searchable", // UI name
"An XML file that describes a searchable.", // tooltip
ResourceFolderType.XML, // folder type
AndroidTargetData.DESCRIPTOR_SEARCHABLE, // root seed
null, // default root
SdkConstants.NS_RESOURCES, // xmlns
null, // default attributes
1 // target API level
),
// Still missing: Interpolator, Raw and Mipmap. Raw should probably never be in
// this menu since it's not often used for creating XML files.
};
private NewXmlFileWizard.Values mValues;
private ProjectCombo mProjectButton;
private Text mFileNameTextField;
private Combo mTypeCombo;
private IStructuredSelection mInitialSelection;
private ResourceFolderType mInitialFolderType;
private boolean mInternalTypeUpdate;
private TargetChangeListener mSdkTargetChangeListener;
private Table mRootTable;
private TableViewer mRootTableViewer;
// --- UI creation ---
/**
* Constructs a new {@link NewXmlFileCreationPage}.
* <p/>
* Called by {@link NewXmlFileWizard#createMainPage}.
*/
protected NewXmlFileCreationPage(String pageName, NewXmlFileWizard.Values values) {
super(pageName);
mValues = values;
setPageComplete(false);
}
public void setInitialSelection(IStructuredSelection initialSelection) {
mInitialSelection = initialSelection;
}
public void setInitialFolderType(ResourceFolderType initialType) {
mInitialFolderType = initialType;
}
/**
* Called by the parent Wizard to create the UI for this Wizard Page.
*
* {@inheritDoc}
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
@SuppressWarnings("unused") // SWT constructors have side effects, they aren't unused
public void createControl(Composite parent) {
// This UI is maintained with WindowBuilder.
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout(2, false /*makeColumnsEqualWidth*/));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// label before type radios
Label typeLabel = new Label(composite, SWT.NONE);
typeLabel.setText("Resource Type:");
mTypeCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
mTypeCombo.setToolTipText("What type of resource would you like to create?");
mTypeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (mInitialFolderType != null) {
mTypeCombo.setEnabled(false);
}
mTypeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TypeInfo type = getSelectedType();
if (type != null) {
onSelectType(type);
}
}
});
// separator
Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData gd2 = new GridData(GridData.GRAB_HORIZONTAL);
gd2.horizontalAlignment = SWT.FILL;
gd2.horizontalSpan = 2;
separator.setLayoutData(gd2);
// Project: [button]
String tooltip = "The Android Project where the new resource file will be created.";
Label projectLabel = new Label(composite, SWT.NONE);
projectLabel.setText("Project:");
projectLabel.setToolTipText(tooltip);
ProjectChooserHelper helper =
new ProjectChooserHelper(getShell(), null /* filter */);
mProjectButton = new ProjectCombo(helper, composite, mValues.project);
mProjectButton.setToolTipText(tooltip);
mProjectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mProjectButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IProject project = mProjectButton.getSelectedProject();
if (project != mValues.project) {
changeProject(project);
}
};
});
// Filename: [text]
Label fileLabel = new Label(composite, SWT.NONE);
fileLabel.setText("File:");
fileLabel.setToolTipText("The name of the resource file to create.");
mFileNameTextField = new Text(composite, SWT.BORDER);
mFileNameTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mFileNameTextField.setToolTipText(tooltip);
mFileNameTextField.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
mValues.name = mFileNameTextField.getText();
validatePage();
}
});
// separator
Label rootSeparator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData gd = new GridData(GridData.GRAB_HORIZONTAL);
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
rootSeparator.setLayoutData(gd);
// Root Element:
// [TableViewer]
Label rootLabel = new Label(composite, SWT.NONE);
rootLabel.setText("Root Element:");
new Label(composite, SWT.NONE);
mRootTableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
mRootTable = mRootTableViewer.getTable();
GridData tableGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
tableGridData.heightHint = 200;
mRootTable.setLayoutData(tableGridData);
setControl(composite);
// Update state the first time
setErrorMessage(null);
setMessage(null);
initializeFromSelection(mInitialSelection);
updateAvailableTypes();
initializeFromFixedType();
initializeRootValues();
installTargetChangeListener();
initialSelectType();
validatePage();
}
private void initialSelectType() {
TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
int typeIndex = getTypeComboIndex(mValues.type);
if (typeIndex == -1) {
typeIndex = 0;
} else {
assert mValues.type == types[typeIndex];
}
mTypeCombo.select(typeIndex);
onSelectType(types[typeIndex]);
updateRootCombo(types[typeIndex]);
}
private void installTargetChangeListener() {
mSdkTargetChangeListener = new TargetChangeListener() {
@Override
public IProject getProject() {
return mValues.project;
}
@Override
public void reload() {
if (mValues.project != null) {
changeProject(mValues.project);
}
}
};
AdtPlugin.getDefault().addTargetListener(mSdkTargetChangeListener);
}
@Override
public void dispose() {
if (mSdkTargetChangeListener != null) {
AdtPlugin.getDefault().removeTargetListener(mSdkTargetChangeListener);
mSdkTargetChangeListener = null;
}
super.dispose();
}
/**
* Returns the selected root element string, if any.
*
* @return The selected root element string or null.
*/
public String getRootElement() {
int index = mRootTable.getSelectionIndex();
if (index >= 0) {
Object[] roots = (Object[]) mRootTableViewer.getInput();
return roots[index].toString();
}
return null;
}
/**
* Called by {@link NewXmlFileWizard} to initialize the page with the selection
* received by the wizard -- typically the current user workbench selection.
* <p/>
* Things we expect to find out from the selection:
* <ul>
* <li>The project name, valid if it's an android nature.</li>
* <li>The current folder, valid if it's a folder under /res</li>
* <li>An existing filename, in which case the user will be asked whether to override it.</li>
* </ul>
* <p/>
* The selection can also be set to a {@link Pair} of {@link IProject} and a workspace
* resource path (where the resource path does not have to exist yet, such as res/anim/).
*
* @param selection The selection when the wizard was initiated.
*/
private boolean initializeFromSelection(IStructuredSelection selection) {
if (selection == null) {
return false;
}
// Find the best match in the element list. In case there are multiple selected elements
// select the one that provides the most information and assign them a score,
// e.g. project=1 + folder=2 + file=4.
IProject targetProject = null;
String targetWsFolderPath = null;
String targetFileName = null;
int targetScore = 0;
for (Object element : selection.toList()) {
if (element instanceof IAdaptable) {
IResource res = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
IProject project = res != null ? res.getProject() : null;
// Is this an Android project?
try {
if (project == null || !project.hasNature(AdtConstants.NATURE_DEFAULT)) {
continue;
}
} catch (CoreException e) {
// checking the nature failed, ignore this resource
continue;
}
int score = 1; // we have a valid project at least
IPath wsFolderPath = null;
String fileName = null;
assert res != null; // Eclipse incorrectly thinks res could be null, so tell it no
if (res.getType() == IResource.FOLDER) {
wsFolderPath = res.getProjectRelativePath();
} else if (res.getType() == IResource.FILE) {
if (SdkUtils.endsWithIgnoreCase(res.getName(), DOT_XML)) {
fileName = res.getName();
}
wsFolderPath = res.getParent().getProjectRelativePath();
}
// Disregard this folder selection if it doesn't point to /res/something
if (wsFolderPath != null &&
wsFolderPath.segmentCount() > 1 &&
SdkConstants.FD_RESOURCES.equals(wsFolderPath.segment(0))) {
score += 2;
} else {
wsFolderPath = null;
fileName = null;
}
score += fileName != null ? 4 : 0;
if (score > targetScore) {
targetScore = score;
targetProject = project;
targetWsFolderPath = wsFolderPath != null ? wsFolderPath.toString() : null;
targetFileName = fileName;
}
} else if (element instanceof Pair<?,?>) {
// Pair of Project/String
@SuppressWarnings("unchecked")
Pair<IProject,String> pair = (Pair<IProject,String>)element;
targetScore = 1;
targetProject = pair.getFirst();
targetWsFolderPath = pair.getSecond();
targetFileName = "";
}
}
if (targetProject == null) {
// Try to figure out the project from the active editor
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof AndroidXmlEditor) {
Object input = ((AndroidXmlEditor) activeEditor).getEditorInput();
if (input instanceof FileEditorInput) {
FileEditorInput fileInput = (FileEditorInput) input;
targetScore = 1;
IFile file = fileInput.getFile();
targetProject = file.getProject();
IPath path = file.getParent().getProjectRelativePath();
targetWsFolderPath = path != null ? path.toString() : null;
}
}
}
}
}
if (targetProject == null) {
// If we didn't find a default project based on the selection, check how many
// open Android projects we can find in the current workspace. If there's only
// one, we'll just select it by default.
IJavaProject[] projects = AdtUtils.getOpenAndroidProjects();
if (projects != null && projects.length == 1) {
targetScore = 1;
targetProject = projects[0].getProject();
}
}
// Now set the UI accordingly
if (targetScore > 0) {
mValues.project = targetProject;
mValues.folderPath = targetWsFolderPath;
mProjectButton.setSelectedProject(targetProject);
mFileNameTextField.setText(targetFileName != null ? targetFileName : ""); //$NON-NLS-1$
// If the current selection context corresponds to a specific file type,
// select it.
if (targetWsFolderPath != null) {
int pos = targetWsFolderPath.lastIndexOf(WS_SEP_CHAR);
if (pos >= 0) {
targetWsFolderPath = targetWsFolderPath.substring(pos + 1);
}
String[] folderSegments = targetWsFolderPath.split(RES_QUALIFIER_SEP);
if (folderSegments.length > 0) {
String folderName = folderSegments[0];
selectTypeFromFolder(folderName);
}
}
}
return true;
}
private void initializeFromFixedType() {
if (mInitialFolderType != null) {
for (TypeInfo type : sTypes) {
if (type.getResFolderType() == mInitialFolderType) {
mValues.type = type;
updateFolderPath(type);
break;
}
}
}
}
/**
* Given a folder name, such as "drawable", select the corresponding type in
* the dropdown.
*/
void selectTypeFromFolder(String folderName) {
List<TypeInfo> matches = new ArrayList<TypeInfo>();
boolean selected = false;
TypeInfo selectedType = getSelectedType();
for (TypeInfo type : sTypes) {
if (type.getResFolderName().equals(folderName)) {
matches.add(type);
selected |= type == selectedType;
}
}
if (matches.size() == 1) {
// If there's only one match, select it if it's not already selected
if (!selected) {
selectType(matches.get(0));
}
} else if (matches.size() > 1) {
// There are multiple type candidates for this folder. This can happen
// for /res/xml for example. Check to see if one of them is currently
// selected. If yes, leave the selection unchanged. If not, deselect all type.
if (!selected) {
selectType(null);
}
} else {
// Nothing valid was selected.
selectType(null);
}
}
/**
* Initialize the root values of the type infos based on the current framework values.
*/
private void initializeRootValues() {
IProject project = mValues.project;
for (TypeInfo type : sTypes) {
// Clear all the roots for this type
ArrayList<String> roots = type.getRoots();
if (roots.size() > 0) {
roots.clear();
}
// depending of the type of the seed, initialize the root in different ways
Object rootSeed = type.getRootSeed();
if (rootSeed instanceof String) {
// The seed is a single string, Add it as-is.
roots.add((String) rootSeed);
} else if (rootSeed instanceof String[]) {
// The seed is an array of strings. Add them as-is.
for (String value : (String[]) rootSeed) {
roots.add(value);
}
} else if (rootSeed instanceof Integer && project != null) {
// The seed is a descriptor reference defined in AndroidTargetData.DESCRIPTOR_*
// In this case add all the children element descriptors defined, recursively,
// and avoid infinite recursion by keeping track of what has already been added.
// Note: if project is null, the root list will be empty since it has been
// cleared above.
// get the AndroidTargetData from the project
IAndroidTarget target = null;
AndroidTargetData data = null;
target = Sdk.getCurrent().getTarget(project);
if (target == null) {
// A project should have a target. The target can be missing if the project
// is an old project for which a target hasn't been affected or if the
// target no longer exists in this SDK. Simply log the error and dismiss.
AdtPlugin.log(IStatus.INFO,
"NewXmlFile wizard: no platform target for project %s", //$NON-NLS-1$
project.getName());
continue;
} else {
data = Sdk.getCurrent().getTargetData(target);
if (data == null) {
// We should have both a target and its data.
// However if the wizard is invoked whilst the platform is still being
// loaded we can end up in a weird case where we have a target but it
// doesn't have any data yet.
// Lets log a warning and silently ignore this root.
AdtPlugin.log(IStatus.INFO,
"NewXmlFile wizard: no data for target %s, project %s", //$NON-NLS-1$
target.getName(), project.getName());
continue;
}
}
IDescriptorProvider provider = data.getDescriptorProvider((Integer)rootSeed);
ElementDescriptor descriptor = provider.getDescriptor();
if (descriptor != null) {
HashSet<ElementDescriptor> visited = new HashSet<ElementDescriptor>();
initRootElementDescriptor(roots, descriptor, visited);
}
// Sort alphabetically.
Collections.sort(roots);
}
}
}
/**
* Helper method to recursively insert all XML names for the given {@link ElementDescriptor}
* into the roots array list. Keeps track of visited nodes to avoid infinite recursion.
* Also avoids inserting the top {@link DocumentDescriptor} which is generally synthetic
* and not a valid root element.
*/
private void initRootElementDescriptor(ArrayList<String> roots,
ElementDescriptor desc, HashSet<ElementDescriptor> visited) {
if (!(desc instanceof DocumentDescriptor)) {
String xmlName = desc.getXmlName();
if (xmlName != null && xmlName.length() > 0) {
roots.add(xmlName);
}
}
visited.add(desc);
for (ElementDescriptor child : desc.getChildren()) {
if (!visited.contains(child)) {
initRootElementDescriptor(roots, child, visited);
}
}
}
/**
* Changes mProject to the given new project and update the UI accordingly.
* <p/>
* Note that this does not check if the new project is the same as the current one
* on purpose, which allows a project to be updated when its target has changed or
* when targets are loaded in the background.
*/
private void changeProject(IProject newProject) {
mValues.project = newProject;
// enable types based on new API level
updateAvailableTypes();
initialSelectType();
// update the folder name based on API level
updateFolderPath(mValues.type);
// update the Type with the new descriptors.
initializeRootValues();
// update the combo
updateRootCombo(mValues.type);
validatePage();
}
private void onSelectType(TypeInfo type) {
// Do nothing if this is an internal modification or if the widget has been
// deselected.
if (mInternalTypeUpdate) {
return;
}
mValues.type = type;
if (type == null) {
return;
}
// update the combo
updateRootCombo(type);
// update the folder path
updateFolderPath(type);
validatePage();
}
/** Updates the selected type in the type dropdown control */
private void setSelectedType(TypeInfo type) {
TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
if (types != null) {
for (int i = 0, n = types.length; i < n; i++) {
if (types[i] == type) {
mTypeCombo.select(i);
break;
}
}
}
}
/** Returns the selected type in the type dropdown control */
private TypeInfo getSelectedType() {
int index = mTypeCombo.getSelectionIndex();
if (index != -1) {
TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
return types[index];
}
return null;
}
/** Returns the selected index in the type dropdown control */
private int getTypeComboIndex(TypeInfo type) {
TypeInfo[] types = (TypeInfo[]) mTypeCombo.getData();
for (int i = 0, n = types.length; i < n; i++) {
if (type == types[i]) {
return i;
}
}
return -1;
}
/** Updates the folder path to reflect the given type */
private void updateFolderPath(TypeInfo type) {
String wsFolderPath = mValues.folderPath;
String newPath = null;
FolderConfiguration config = mValues.configuration;
ResourceQualifier qual = config.getInvalidQualifier();
if (qual == null) {
// The configuration is valid. Reformat the folder path using the canonical
// value from the configuration.
newPath = RES_FOLDER_ABS + config.getFolderName(type.getResFolderType());
} else {
// The configuration is invalid. We still update the path but this time
// do it manually on the string.
if (wsFolderPath.startsWith(RES_FOLDER_ABS)) {
wsFolderPath = wsFolderPath.replaceFirst(
"^(" + RES_FOLDER_ABS +")[^-]*(.*)", //$NON-NLS-1$ //$NON-NLS-2$
"\\1" + type.getResFolderName() + "\\2"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
newPath = RES_FOLDER_ABS + config.getFolderName(type.getResFolderType());
}
}
if (newPath != null && !newPath.equals(wsFolderPath)) {
mValues.folderPath = newPath;
}
}
/**
* Helper method that fills the values of the "root element" combo box based
* on the currently selected type radio button. Also disables the combo is there's
* only one choice. Always select the first root element for the given type.
*
* @param type The currently selected {@link TypeInfo}, or null
*/
private void updateRootCombo(TypeInfo type) {
IBaseLabelProvider labelProvider = new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {
return IconFactory.getInstance().getIcon(element.toString());
}
};
mRootTableViewer.setContentProvider(new ArrayContentProvider());
mRootTableViewer.setLabelProvider(labelProvider);
if (type != null) {
// get the list of roots. The list can be empty but not null.
ArrayList<String> roots = type.getRoots();
mRootTableViewer.setInput(roots.toArray());
int index = 0; // default is to select the first one
String defaultRoot = type.getDefaultRoot(mValues.project);
if (defaultRoot != null) {
index = roots.indexOf(defaultRoot);
}
mRootTable.select(index < 0 ? 0 : index);
mRootTable.showSelection();
}
}
/**
* Helper method to select the current type in the type dropdown
*
* @param type The TypeInfo matching the radio button to selected or null to deselect them all.
*/
private void selectType(TypeInfo type) {
mInternalTypeUpdate = true;
mValues.type = type;
if (type == null) {
if (mTypeCombo.getSelectionIndex() != -1) {
mTypeCombo.deselect(mTypeCombo.getSelectionIndex());
}
} else {
setSelectedType(type);
}
updateRootCombo(type);
mInternalTypeUpdate = false;
}
/**
* Add the available types in the type combobox, based on whether they are available
* for the current SDK.
* <p/>
* A type is available either if:
* - if mProject is null, API level 1 is considered valid
* - if mProject is !null, the project->target->API must be >= to the type's API level.
*/
private void updateAvailableTypes() {
IProject project = mValues.project;
IAndroidTarget target = project != null ? Sdk.getCurrent().getTarget(project) : null;
int currentApiLevel = 1;
if (target != null) {
currentApiLevel = target.getVersion().getApiLevel();
}
List<String> items = new ArrayList<String>(sTypes.length);
List<TypeInfo> types = new ArrayList<TypeInfo>(sTypes.length);
for (int i = 0, n = sTypes.length; i < n; i++) {
TypeInfo type = sTypes[i];
if (type.getTargetApiLevel() <= currentApiLevel) {
items.add(type.getUiName());
types.add(type);
}
}
mTypeCombo.setItems(items.toArray(new String[items.size()]));
mTypeCombo.setData(types.toArray(new TypeInfo[types.size()]));
}
/**
* Validates the fields, displays errors and warnings.
* Enables the finish button if there are no errors.
*/
private void validatePage() {
String error = null;
String warning = null;
// -- validate type
TypeInfo type = mValues.type;
if (error == null) {
if (type == null) {
error = "One of the types must be selected (e.g. layout, values, etc.)";
}
}
// -- validate project
if (mValues.project == null) {
error = "Please select an Android project.";
}
// -- validate type API level
if (error == null) {
IAndroidTarget target = Sdk.getCurrent().getTarget(mValues.project);
int currentApiLevel = 1;
if (target != null) {
currentApiLevel = target.getVersion().getApiLevel();
}
assert type != null;
if (type.getTargetApiLevel() > currentApiLevel) {
error = "The API level of the selected type (e.g. AppWidget, etc.) is not " +
"compatible with the API level of the project.";
}
}
// -- validate filename
if (error == null) {
String fileName = mValues.getFileName();
assert type != null;
ResourceFolderType folderType = type.getResFolderType();
error = ResourceNameValidator.create(true, folderType).isValid(fileName);
}
// -- validate destination file doesn't exist
if (error == null) {
IFile file = mValues.getDestinationFile();
if (file != null && file.exists()) {
warning = "The destination file already exists";
}
}
// -- update UI & enable finish if there's no error
setPageComplete(error == null);
if (error != null) {
setMessage(error, IMessageProvider.ERROR);
} else if (warning != null) {
setMessage(warning, IMessageProvider.WARNING);
} else {
setErrorMessage(null);
setMessage(null);
}
}
/**
* Returns the {@link TypeInfo} for the given {@link ResourceFolderType}, or null if
* not found
*
* @param folderType the {@link ResourceFolderType} to look for
* @return the corresponding {@link TypeInfo}
*/
static TypeInfo getTypeInfo(ResourceFolderType folderType) {
for (TypeInfo typeInfo : sTypes) {
if (typeInfo.getResFolderType() == folderType) {
return typeInfo;
}
}
return null;
}
}
| rex-xxx/mt6572_x201 | sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java | Java | gpl-2.0 | 49,017 |
/**
* Copyright (C) 2011, 2012 Commission Junction Inc.
*
* This file is part of httpobjects.
*
* httpobjects 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.
*
* httpobjects 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 httpobjects; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* Linking this library statically or dynamically with other modules is
* making a combined work based on this library. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* As a special exception, the copyright holders of this library give you
* permission to link this library with independent modules to produce an
* executable, regardless of the license terms of these independent
* modules, and to copy and distribute the resulting executable under
* terms of your choice, provided that you also meet, for each linked
* independent module, the terms and conditions of the license of that
* module. An independent module is a module which is not derived from
* or based on this library. If you modify this library, you may extend
* this exception to your version of the library, but you are not
* obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
package org.httpobjects;
public class ConnectionInfo {
// String protocolVersion
// String protocol;
public final String localAddress;
public final Integer localPort;
public final String remoteAddress;
public final Integer remotePort;
public ConnectionInfo(String localAddress, Integer localPort, String remoteAddress, Integer remotePort) {
super();
this.localAddress = notNull(localAddress);
this.localPort = notNull(localPort);
this.remoteAddress = notNull(remoteAddress);
this.remotePort = notNull(remotePort);
}
private static <T> T notNull(T value){
if(value==null) throw new IllegalArgumentException("Null not allowed");
return value;
}
public String show() {
return "ConnectionInfo(" +
"localAddress = " + localAddress + "," +
"localPort = " + localPort + "," +
"remoteAddress = " + remoteAddress + "," +
"remotePort = " + remotePort + ")";
}
public boolean eq(ConnectionInfo that) {
return this.show().equals(that.show());
}
}
| cjdev/httpobjects | core/src/main/java/org/httpobjects/ConnectionInfo.java | Java | gpl-2.0 | 2,931 |
/****************************************************************************
KHotKeys
Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
Distributed under the terms of the GNU General Public License version 2.
****************************************************************************/
#define _CONDITIONS_LIST_WIDGET_CPP_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "condition_list_widget.h"
#include <assert.h>
#include <qpushbutton.h>
#include <qheader.h>
#include <qlineedit.h>
#include <qpopupmenu.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <khlistview.h>
#include <conditions.h>
#include "windowdef_list_widget.h"
#include "kcmkhotkeys.h"
namespace KHotKeys {
// Condition_list_widget
Condition_list_widget::Condition_list_widget(QWidget *parent_P, const char *name_P) : Condition_list_widget_ui(parent_P, name_P), selected_item(NULL)
{
conditions.setAutoDelete(true);
QPopupMenu *popup = new QPopupMenu; // CHECKME looks like setting parent doesn't work
popup->insertItem(i18n("Active Window..."), TYPE_ACTIVE_WINDOW);
popup->insertItem(i18n("Existing Window..."), TYPE_EXISTING_WINDOW);
popup->insertItem(i18n("Not_condition", "Not"), TYPE_NOT);
popup->insertItem(i18n("And_condition", "And"), TYPE_AND);
popup->insertItem(i18n("Or_condition", "Or"), TYPE_OR);
connect(conditions_listview, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), this, SLOT(modify_pressed()));
connect(popup, SIGNAL(activated(int)), SLOT(new_selected(int)));
new_button->setPopup(popup);
conditions_listview->header()->hide();
conditions_listview->addColumn("");
conditions_listview->setSorting(-1);
conditions_listview->setRootIsDecorated(true); // CHECKME
conditions_listview->setForceSelect(true);
copy_button->setEnabled(false);
modify_button->setEnabled(false);
delete_button->setEnabled(false);
clear_data();
// KHotKeys::Module::changed()
connect(new_button, SIGNAL(clicked()), module, SLOT(changed()));
connect(copy_button, SIGNAL(clicked()), module, SLOT(changed()));
connect(modify_button, SIGNAL(clicked()), module, SLOT(changed()));
connect(delete_button, SIGNAL(clicked()), module, SLOT(changed()));
connect(comment_lineedit, SIGNAL(textChanged(const QString &)), module, SLOT(changed()));
}
Condition_list_widget::~Condition_list_widget()
{
delete new_button->popup();
}
void Condition_list_widget::clear_data()
{
comment_lineedit->clear();
conditions.clear();
conditions_listview->clear();
}
void Condition_list_widget::set_data(const Condition_list *data_P)
{
if(data_P == NULL)
{
clear_data();
return;
}
comment_lineedit->setText(data_P->comment());
conditions.clear();
conditions_listview->clear();
insert_listview_items(data_P, conditions_listview, NULL);
#ifdef KHOTKEYS_DEBUG
kdDebug(1217) << "Condition_list_widget::set_data():" << endl;
Condition::debug_list(conditions);
#endif
}
void Condition_list_widget::insert_listview_items(const Condition_list_base *parent_P, QListView *parent1_P, Condition_list_item *parent2_P)
{
Condition_list_item *prev = NULL;
for(Condition_list_base::Iterator it(*parent_P); *it; ++it)
{
prev = create_listview_item(*it, parent1_P, parent2_P, prev, true);
if(Condition_list_base *group = dynamic_cast< Condition_list_base * >(*it))
insert_listview_items(group, NULL, prev);
}
}
Condition_list *Condition_list_widget::get_data(Action_data_base *data_P) const
{
#ifdef KHOTKEYS_DEBUG
kdDebug(1217) << "Condition_list_widget::get_data():" << endl;
Condition::debug_list(conditions);
#endif
// CHECKME TODO hmm, tady to bude chtit asi i children :(
Condition_list *list = new Condition_list(comment_lineedit->text(), data_P);
get_listview_items(list, conditions_listview->firstChild());
return list;
}
void Condition_list_widget::get_listview_items(Condition_list_base *list_P, QListViewItem *first_item_P) const
{
list_P->clear();
for(QListViewItem *pos = first_item_P; pos != NULL; pos = pos->nextSibling())
{
Condition *cond = static_cast< Condition_list_item * >(pos)->condition()->copy(list_P);
if(Condition_list_base *group = dynamic_cast< Condition_list_base * >(cond))
get_listview_items(group, pos->firstChild());
}
}
void Condition_list_widget::new_selected(int type_P)
{
Condition_list_item *parent = NULL;
Condition_list_item *after = NULL;
if(selected_item && selected_item->condition())
{
Condition_list_base *tmp = dynamic_cast< Condition_list_base * >(selected_item->condition());
if(tmp && tmp->accepts_children())
{
int ret = KMessageBox::questionYesNoCancel(NULL, i18n("A group is selected.\nAdd the new condition in this selected group?"),
QString::null, i18n("Add in Group"), i18n("Ignore Group"));
if(ret == KMessageBox::Cancel)
return;
else if(ret == KMessageBox::Yes)
parent = selected_item;
else
parent = NULL;
}
}
if(parent == NULL && selected_item != NULL && selected_item->parent() != NULL)
{
parent = static_cast< Condition_list_item * >(selected_item->parent());
after = selected_item;
}
Condition_list_base *parent_cond = parent ? static_cast< Condition_list_base * >(parent->condition()) : NULL;
assert(!parent || dynamic_cast< Condition_list_base * >(parent->condition()));
Condition_dialog *dlg = NULL;
Condition *condition = NULL;
switch(type_P)
{
case TYPE_ACTIVE_WINDOW: // Active_window_condition
dlg = new Active_window_condition_dialog(new Active_window_condition(new Windowdef_list(""), parent_cond)); // CHECKME NULL
break;
case TYPE_EXISTING_WINDOW: // Existing_window_condition
dlg = new Existing_window_condition_dialog(new Existing_window_condition(new Windowdef_list(""), parent_cond)); // CHECKME NULL
break;
case TYPE_NOT: // Not_condition
condition = new Not_condition(parent_cond);
break;
case TYPE_AND: // And_condition
condition = new And_condition(parent_cond);
break;
case TYPE_OR: // Or_condition
condition = new Or_condition(parent_cond);
break;
}
if(dlg != NULL)
{
condition = dlg->edit_condition();
delete dlg;
}
if(condition != NULL)
{
if(parent != NULL)
conditions_listview->setSelected(create_listview_item(condition, NULL, parent, after, false), true);
else
conditions_listview->setSelected(create_listview_item(condition, conditions_listview, NULL, selected_item, false), true);
}
}
void Condition_list_widget::copy_pressed()
{
if(!selected_item)
return;
conditions_listview->setSelected(create_listview_item(selected_item->condition()->copy(selected_item->condition()->parent()),
selected_item->parent() ? NULL : conditions_listview,
static_cast< Condition_list_item * >(selected_item->parent()), selected_item, true),
true);
}
void Condition_list_widget::delete_pressed()
{
if(selected_item)
{
conditions.remove(selected_item->condition()); // we own it
delete selected_item; // CHECKME snad vyvola signaly pro enable()
selected_item = NULL;
}
}
void Condition_list_widget::modify_pressed()
{
if(!selected_item)
return;
edit_listview_item(selected_item);
}
void Condition_list_widget::current_changed(QListViewItem *item_P)
{
// if( item_P == selected_item )
// return;
selected_item = static_cast< Condition_list_item * >(item_P);
// conditions_listview->setSelected( selected_item, true );
copy_button->setEnabled(selected_item != NULL);
delete_button->setEnabled(selected_item != NULL);
if(selected_item != NULL)
{ // not,and,or can't be modified
if(dynamic_cast< Not_condition * >(selected_item->condition()) == NULL && dynamic_cast< And_condition * >(selected_item->condition()) == NULL
&& dynamic_cast< Or_condition * >(selected_item->condition()) == NULL)
{
modify_button->setEnabled(true);
}
else
modify_button->setEnabled(false);
}
else
modify_button->setEnabled(false);
}
Condition_list_item *Condition_list_widget::create_listview_item(Condition *condition_P, QListView *parent1_P, Condition_list_item *parent2_P,
QListViewItem *after_P, bool copy_P)
{
#ifdef KHOTKEYS_DEBUG
kdDebug(1217) << "Condition_list_widget::create_listview_item():" << endl;
Condition::debug_list(conditions);
kdDebug(1217) << kdBacktrace() << endl;
#endif
Condition *new_cond = copy_P ? condition_P->copy(parent2_P ? static_cast< Condition_list_base * >(parent2_P->condition()) : NULL) : condition_P;
assert(!copy_P || !parent2_P || dynamic_cast< Condition_list_base * >(parent2_P->condition()));
// CHECKME uz by nemelo byt treba
/* if( after_P == NULL )
{
if( parent1_P == NULL )
return new Condition_list_item( parent2_P, new_win );
else
return new Condition_list_item( parent1_P, new_win );
}
else*/
{
if(parent1_P == NULL)
{
parent2_P->setOpen(true);
if(new_cond->parent() == NULL) // own only toplevels, they own the rest
conditions.append(new_cond); // we own it, not the listview
return new Condition_list_item(parent2_P, after_P, new_cond);
}
else
{
if(new_cond->parent() == NULL)
conditions.append(new_cond); // we own it, not the listview
return new Condition_list_item(parent1_P, after_P, new_cond);
}
}
}
void Condition_list_widget::edit_listview_item(Condition_list_item *item_P)
{
Condition_dialog *dlg = NULL;
if(Active_window_condition *condition = dynamic_cast< Active_window_condition * >(item_P->condition()))
dlg = new Active_window_condition_dialog(condition);
else if(Existing_window_condition *condition = dynamic_cast< Existing_window_condition * >(item_P->condition()))
dlg = new Existing_window_condition_dialog(condition);
else if(dynamic_cast< Not_condition * >(item_P->condition()) != NULL)
return;
else if(dynamic_cast< And_condition * >(item_P->condition()) != NULL)
return;
else if(dynamic_cast< Or_condition * >(item_P->condition()) != NULL)
return;
else // CHECKME TODO pridat dalsi
assert(false);
Condition *new_condition = dlg->edit_condition();
if(new_condition != NULL)
{
Condition *old_cond = item_P->condition();
item_P->set_condition(new_condition);
int pos = conditions.find(old_cond);
if(pos >= 0)
{
conditions.remove(pos); // we own it
conditions.insert(pos, new_condition);
}
item_P->widthChanged(0);
conditions_listview->repaintItem(item_P);
}
#ifdef KHOTKEYS_DEBUG
kdDebug(1217) << "Condition_list_widget::edit_listview_item():" << endl;
Condition::debug_list(conditions);
#endif
delete dlg;
}
// Condition_list_item
QString Condition_list_item::text(int column_P) const
{
return column_P == 0 ? condition()->description() : QString::null;
}
// Active_window_condition_dialog
Active_window_condition_dialog::Active_window_condition_dialog(Active_window_condition *condition_P)
: KDialogBase(NULL, NULL, true, i18n("Window Details"), Ok | Cancel), condition(NULL)
{
widget = new Windowdef_list_widget(this);
widget->set_data(condition_P->window());
setMainWidget(widget);
}
Condition *Active_window_condition_dialog::edit_condition()
{
exec();
return condition;
}
void Active_window_condition_dialog::accept()
{
KDialogBase::accept();
condition = new Active_window_condition(widget->get_data(), NULL); // CHECKME NULL ?
}
// Existing_window_condition_dialog
Existing_window_condition_dialog::Existing_window_condition_dialog(Existing_window_condition *condition_P)
: KDialogBase(NULL, NULL, true, i18n("Window Details"), Ok | Cancel), condition(NULL)
{
widget = new Windowdef_list_widget(this);
widget->set_data(condition_P->window());
setMainWidget(widget);
}
Condition *Existing_window_condition_dialog::edit_condition()
{
exec();
return condition;
}
void Existing_window_condition_dialog::accept()
{
KDialogBase::accept();
condition = new Existing_window_condition(widget->get_data(), NULL); // CHECKME NULL ?
}
} // namespace KHotKeys
#include "condition_list_widget.moc"
| serghei/kde3-kdebase | khotkeys/kcontrol/condition_list_widget.cpp | C++ | gpl-2.0 | 13,256 |
<?php
/**
* Database creation and update statements for the Paypal plugin.
* Based on the gl-paypal Plugin for Geeklog CMS by Vincent Furia.
*
* @author Lee Garner <lee@leegarner.com>
* @author Vincent Furia <vinny01@users.sourceforge.net
* @copyright Copyright (c) 2009-2018 Lee Garner <lee@leegarner.com>
* @copyright Copyright (c) 2005-2006 Vincent Furia
* @package paypal
* @version 0.6.0
* @license http://opensource.org/licenses/gpl-2.0.php
* GNU Public License v2 or later
* @filesource
*/
if (!defined ('GVERSION')) {
die ('This file can not be used on its own.');
}
global $_TABLES, $_SQL, $PP_UPGRADE, $_PP_SAMPLEDATA;
$_SQL = array();
$PP_UPGRADE = array();
// Move upgrade 0.5.4 SQL to the top so its large table creation can be used by the $_SQL array also
$PP_UPGRADE['0.5.4'] = array(
"CREATE TABLE `{$_TABLES['paypal.currency']}` (
`code` varchar(3) NOT NULL,
`symbol` varchar(10) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`numeric_code` int(4) DEFAULT NULL,
`symbol_placement` varchar(10) DEFAULT NULL,
`symbol_spacer` varchar(2) DEFAULT ' ',
`code_placement` varchar(10) DEFAULT 'after',
`decimals` int(3) DEFAULT '2',
`rounding_step` float(5,2) DEFAULT '0.00',
`thousands_sep` varchar(2) DEFAULT ',',
`decimal_sep` varchar(2) DEFAULT '.',
`major_unit` varchar(20) DEFAULT NULL,
`minor_unit` varchar(20) DEFAULT NULL,
`conversion_rate` float(7,5) DEFAULT '1.00000',
`conversion_ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`code`)
) ENGINE=MyISAM",
"INSERT INTO `{$_TABLES['paypal.currency']}` VALUES
('AED','?.?','United Arab Emirates Dirham',784,'hidden',' ','before',2,0.00,',','.','Dirham','Fils',1.00000,'2014-01-03 20:51:17'),
('AFN','Af','Afghan Afghani',971,'hidden',' ','after',0,0.00,',','.','Afghani','Pul',1.00000,'2014-01-03 20:54:44'),
('ANG','NAf.','Netherlands Antillean Guilder',532,'hidden',' ','after',2,0.00,',','.','Guilder','Cent',1.00000,'2014-01-03 20:54:44'),
('AOA','Kz','Angolan Kwanza',973,'hidden',' ','after',2,0.00,',','.','Kwanza','Cêntimo',1.00000,'2014-01-03 20:54:44'),
('ARM','m\$n','Argentine Peso Moneda Nacional',NULL,'hidden',' ','after',2,0.00,',','.','Peso','Centavos',1.00000,'2014-01-03 20:54:44'),
('ARS','AR$','Argentine Peso',32,'hidden',' ','after',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('AUD','$','Australian Dollar',36,'before',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('AWG','Afl.','Aruban Florin',533,'hidden',' ','after',2,0.00,',','.','Guilder','Cent',1.00000,'2014-01-03 20:54:44'),
('AZN','man.','Azerbaijanian Manat',NULL,'hidden',' ','after',2,0.00,',','.','New Manat','Q?pik',1.00000,'2014-01-03 20:54:44'),
('BAM','KM','Bosnia-Herzegovina Convertible Mark',977,'hidden',' ','after',2,0.00,',','.','Convertible Marka','Fening',1.00000,'2014-01-03 20:54:44'),
('BBD','Bds$','Barbadian Dollar',52,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('BDT','Tk','Bangladeshi Taka',50,'hidden',' ','after',2,0.00,',','.','Taka','Paisa',1.00000,'2014-01-03 20:54:44'),
('BGN','??','Bulgarian lev',975,'after',' ','hidden',2,0.00,',',',','Lev','Stotinka',1.00000,'2014-01-03 20:49:55'),
('BHD','BD','Bahraini Dinar',48,'hidden',' ','after',3,0.00,',','.','Dinar','Fils',1.00000,'2014-01-03 20:54:44'),
('BIF','FBu','Burundian Franc',108,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('BMD','BD$','Bermudan Dollar',60,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('BND','BN$','Brunei Dollar',96,'hidden',' ','after',2,0.00,',','.','Dollar','Sen',1.00000,'2014-01-03 20:54:44'),
('BOB','Bs','Bolivian Boliviano',68,'hidden',' ','after',2,0.00,',','.','Bolivianos','Centavo',1.00000,'2014-01-03 20:54:44'),
('BRL','R$','Brazilian Real',986,'before',' ','hidden',2,0.00,'.',',','Reais','Centavo',1.00000,'2014-01-03 20:49:55'),
('BSD','BS$','Bahamian Dollar',44,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('BTN','Nu.','Bhutanese Ngultrum',64,'hidden',' ','after',2,0.00,',','.','Ngultrum','Chetrum',1.00000,'2014-01-03 20:54:44'),
('BWP','BWP','Botswanan Pula',72,'hidden',' ','after',2,0.00,',','.','Pulas','Thebe',1.00000,'2014-01-03 20:54:44'),
('BYR','???.','Belarusian ruble',974,'after',' ','hidden',0,0.00,',','.','Ruble',NULL,1.00000,'2014-01-03 20:49:48'),
('BZD','BZ$','Belize Dollar',84,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('CAD','CA$','Canadian Dollar',124,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('CDF','CDF','Congolese Franc',976,'hidden',' ','after',2,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('CHF','Fr.','Swiss Franc',756,'hidden',' ','after',2,0.05,',','.','Franc','Rappen',1.00000,'2014-01-03 20:54:44'),
('CLP','CL$','Chilean Peso',152,'hidden',' ','after',0,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('CNY','¥','Chinese Yuan Renminbi',156,'before',' ','hidden',2,0.00,',','.','Yuan','Fen',1.00000,'2014-01-03 20:49:55'),
('COP','$','Colombian Peso',170,'before',' ','hidden',0,0.00,'.',',','Peso','Centavo',1.00000,'2014-01-03 20:49:48'),
('CRC','¢','Costa Rican Colón',188,'hidden',' ','after',0,0.00,',','.','Colón','Céntimo',1.00000,'2014-01-03 20:54:44'),
('CUC','CUC$','Cuban Convertible Peso',NULL,'hidden',' ','after',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('CUP','CU$','Cuban Peso',192,'hidden',' ','after',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('CVE','CV$','Cape Verdean Escudo',132,'hidden',' ','after',2,0.00,',','.','Escudo','Centavo',1.00000,'2014-01-03 20:54:44'),
('CZK','K?','Czech Republic Koruna',203,'after',' ','hidden',2,0.00,',',',','Koruna','Halé?',1.00000,'2014-01-03 20:49:55'),
('DJF','Fdj','Djiboutian Franc',262,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('DKK','kr.','Danish Krone',208,'after',' ','hidden',2,0.00,',',',','Kroner','Øre',1.00000,'2014-01-03 20:49:55'),
('DOP','RD$','Dominican Peso',214,'hidden',' ','after',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('DZD','DA','Algerian Dinar',12,'hidden',' ','after',2,0.00,',','.','Dinar','Santeem',1.00000,'2014-01-03 20:54:44'),
('EEK','Ekr','Estonian Kroon',233,'hidden',' ','after',2,0.00,',',',','Krooni','Sent',1.00000,'2014-01-03 20:54:44'),
('EGP','EG£','Egyptian Pound',818,'hidden',' ','after',2,0.00,',','.','Pound','Piastr',1.00000,'2014-01-03 20:54:44'),
('ERN','Nfk','Eritrean Nakfa',232,'hidden',' ','after',2,0.00,',','.','Nakfa','Cent',1.00000,'2014-01-03 20:54:44'),
('ETB','Br','Ethiopian Birr',230,'hidden',' ','after',2,0.00,',','.','Birr','Santim',1.00000,'2014-01-03 20:54:44'),
('EUR','€','Euro',978,'after',' ','hidden',2,0.00,',',',','Euro','Cent',1.00000,'2014-01-03 20:49:55'),
('FJD','FJ$','Fijian Dollar',242,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('FKP','FK£','Falkland Islands Pound',238,'hidden',' ','after',2,0.00,',','.','Pound','Penny',1.00000,'2014-01-03 20:54:44'),
('GBP','£','British Pound Sterling',826,'before',' ','hidden',2,0.00,',','.','Pound','Penny',1.00000,'2014-01-03 20:49:55'),
('GHS','GH?','Ghanaian Cedi',NULL,'hidden',' ','after',2,0.00,',','.','Cedi','Pesewa',1.00000,'2014-01-03 20:54:44'),
('GIP','GI£','Gibraltar Pound',292,'hidden',' ','after',2,0.00,',','.','Pound','Penny',1.00000,'2014-01-03 20:54:44'),
('GMD','GMD','Gambian Dalasi',270,'hidden',' ','after',2,0.00,',','.','Dalasis','Butut',1.00000,'2014-01-03 20:54:44'),
('GNF','FG','Guinean Franc',324,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('GTQ','GTQ','Guatemalan Quetzal',320,'hidden',' ','after',2,0.00,',','.','Quetzales','Centavo',1.00000,'2014-01-03 20:54:44'),
('GYD','GY$','Guyanaese Dollar',328,'hidden',' ','after',0,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('HKD','HK$','Hong Kong Dollar',344,'before',' ','hidden',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:49:55'),
('HNL','HNL','Honduran Lempira',340,'hidden',' ','after',2,0.00,',','.','Lempiras','Centavo',1.00000,'2014-01-03 20:54:44'),
('HRK','kn','Croatian Kuna',191,'hidden',' ','after',2,0.00,',','.','Kuna','Lipa',1.00000,'2014-01-03 20:54:44'),
('HTG','HTG','Haitian Gourde',332,'hidden',' ','after',2,0.00,',','.','Gourde','Centime',1.00000,'2014-01-03 20:54:44'),
('HUF','Ft','Hungarian Forint',348,'after',' ','hidden',0,0.00,',',',','Forint',NULL,1.00000,'2014-01-03 20:49:48'),
('IDR','Rp','Indonesian Rupiah',360,'hidden',' ','after',0,0.00,',','.','Rupiahs','Sen',1.00000,'2014-01-03 20:54:44'),
('ILS','?','Israeli New Shekel',376,'before',' ','hidden',2,0.00,',','.','New Shekels','Agora',1.00000,'2014-01-03 20:49:55'),
('INR','Rs','Indian Rupee',356,'hidden',' ','after',2,0.00,',','.','Rupee','Paisa',1.00000,'2014-01-03 20:54:44'),
('IRR','?','Iranian Rial',364,'after',' ','hidden',2,0.00,',','.','Toman','Rial',1.00000,'2014-01-03 20:49:55'),
('ISK','Ikr','Icelandic Króna',352,'hidden',' ','after',0,0.00,',','.','Kronur','Eyrir',1.00000,'2014-01-03 20:54:44'),
('JMD','J$','Jamaican Dollar',388,'before',' ','hidden',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:49:55'),
('JOD','JD','Jordanian Dinar',400,'hidden',' ','after',3,0.00,',','.','Dinar','Piastr',1.00000,'2014-01-03 20:54:44'),
('JPY','¥','Japanese Yen',392,'before',' ','hidden',0,0.00,',','.','Yen','Sen',1.00000,'2014-01-03 20:49:48'),
('KES','Ksh','Kenyan Shilling',404,'hidden',' ','after',2,0.00,',','.','Shilling','Cent',1.00000,'2014-01-03 20:54:44'),
('KGS','???','Kyrgyzstani Som',417,'after',' ','hidden',2,0.00,',','.','Som','Tyiyn',1.00000,'2014-01-03 20:49:55'),
('KMF','CF','Comorian Franc',174,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('KRW','?','South Korean Won',410,'hidden',' ','after',0,0.00,',','.','Won','Jeon',1.00000,'2014-01-03 20:54:44'),
('KWD','KD','Kuwaiti Dinar',414,'hidden',' ','after',3,0.00,',','.','Dinar','Fils',1.00000,'2014-01-03 20:54:44'),
('KYD','KY$','Cayman Islands Dollar',136,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('KZT','??.','Kazakhstani tenge',398,'after',' ','hidden',2,0.00,',',',','Tenge','Tiyn',1.00000,'2014-01-03 20:49:55'),
('LAK','?N','Laotian Kip',418,'hidden',' ','after',0,0.00,',','.','Kips','Att',1.00000,'2014-01-03 20:54:44'),
('LBP','LB£','Lebanese Pound',422,'hidden',' ','after',0,0.00,',','.','Pound','Piastre',1.00000,'2014-01-03 20:54:44'),
('LKR','SLRs','Sri Lanka Rupee',144,'hidden',' ','after',2,0.00,',','.','Rupee','Cent',1.00000,'2014-01-03 20:54:44'),
('LRD','L$','Liberian Dollar',430,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('LSL','LSL','Lesotho Loti',426,'hidden',' ','after',2,0.00,',','.','Loti','Sente',1.00000,'2014-01-03 20:54:44'),
('LTL','Lt','Lithuanian Litas',440,'hidden',' ','after',2,0.00,',','.','Litai','Centas',1.00000,'2014-01-03 20:54:44'),
('LVL','Ls','Latvian Lats',428,'hidden',' ','after',2,0.00,',','.','Lati','Santims',1.00000,'2014-01-03 20:54:44'),
('LYD','LD','Libyan Dinar',434,'hidden',' ','after',3,0.00,',','.','Dinar','Dirham',1.00000,'2014-01-03 20:54:44'),
('MAD',' Dhs','Moroccan Dirham',504,'after',' ','hidden',2,0.00,',','.','Dirhams','Santimat',1.00000,'2014-01-03 20:49:55'),
('MDL','MDL','Moldovan leu',498,'after',' ','hidden',2,0.00,',','.','Lei','bani',1.00000,'2014-01-03 20:49:55'),
('MMK','MMK','Myanma Kyat',104,'hidden',' ','after',0,0.00,',','.','Kyat','Pya',1.00000,'2014-01-03 20:54:44'),
('MNT','?','Mongolian Tugrik',496,'hidden',' ','after',0,0.00,',','.','Tugriks','Möngö',1.00000,'2014-01-03 20:54:44'),
('MOP','MOP$','Macanese Pataca',446,'hidden',' ','after',2,0.00,',','.','Pataca','Avo',1.00000,'2014-01-03 20:54:44'),
('MRO','UM','Mauritanian Ouguiya',478,'hidden',' ','after',0,0.00,',','.','Ouguiya','Khoums',1.00000,'2014-01-03 20:54:44'),
('MTP','MT£','Maltese Pound',NULL,'hidden',' ','after',2,0.00,',','.','Pound','Shilling',1.00000,'2014-01-03 20:54:44'),
('MUR','MURs','Mauritian Rupee',480,'hidden',' ','after',0,0.00,',','.','Rupee','Cent',1.00000,'2014-01-03 20:54:44'),
('MXN','$','Mexican Peso',484,'before',' ','hidden',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:49:55'),
('MYR','RM','Malaysian Ringgit',458,'before',' ','hidden',2,0.00,',','.','Ringgits','Sen',1.00000,'2014-01-03 20:49:55'),
('MZN','MTn','Mozambican Metical',NULL,'hidden',' ','after',2,0.00,',','.','Metical','Centavo',1.00000,'2014-01-03 20:54:44'),
('NAD','N$','Namibian Dollar',516,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('NGN','?','Nigerian Naira',566,'hidden',' ','after',2,0.00,',','.','Naira','Kobo',1.00000,'2014-01-03 20:54:44'),
('NIO','C$','Nicaraguan Cordoba Oro',558,'hidden',' ','after',2,0.00,',','.','Cordoba','Centavo',1.00000,'2014-01-03 20:54:44'),
('NOK','Nkr','Norwegian Krone',578,'hidden',' ','after',2,0.00,',',',','Krone','Øre',1.00000,'2014-01-03 20:54:44'),
('NPR','NPRs','Nepalese Rupee',524,'hidden',' ','after',2,0.00,',','.','Rupee','Paisa',1.00000,'2014-01-03 20:54:44'),
('NZD','NZ$','New Zealand Dollar',554,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('PAB','B/.','Panamanian Balboa',590,'hidden',' ','after',2,0.00,',','.','Balboa','Centésimo',1.00000,'2014-01-03 20:54:44'),
('PEN','S/.','Peruvian Nuevo Sol',604,'before',' ','hidden',2,0.00,',','.','Nuevos Sole','Céntimo',1.00000,'2014-01-03 20:49:55'),
('PGK','PGK','Papua New Guinean Kina',598,'hidden',' ','after',2,0.00,',','.','Kina ','Toea',1.00000,'2014-01-03 20:54:44'),
('PHP','?','Philippine Peso',608,'hidden',' ','after',2,0.00,',','.','Peso','Centavo',1.00000,'2014-01-03 20:54:44'),
('PKR','PKRs','Pakistani Rupee',586,'hidden',' ','after',0,0.00,',','.','Rupee','Paisa',1.00000,'2014-01-03 20:54:44'),
('PLN','z?','Polish Z?oty',985,'after',' ','hidden',2,0.00,',',',','Z?otych','Grosz',1.00000,'2014-01-03 20:49:55'),
('PYG','?','Paraguayan Guarani',600,'hidden',' ','after',0,0.00,',','.','Guarani','Céntimo',1.00000,'2014-01-03 20:54:44'),
('QAR','QR','Qatari Rial',634,'hidden',' ','after',2,0.00,',','.','Rial','Dirham',1.00000,'2014-01-03 20:54:44'),
('RHD','RH$','Rhodesian Dollar',NULL,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('RON','RON','Romanian Leu',NULL,'hidden',' ','after',2,0.00,',','.','Leu','Ban',1.00000,'2014-01-03 20:54:44'),
('RSD','din.','Serbian Dinar',NULL,'hidden',' ','after',0,0.00,',','.','Dinars','Para',1.00000,'2014-01-03 20:54:44'),
('RUB','???.','Russian Ruble',643,'after',' ','hidden',2,0.00,',',',','Ruble','Kopek',1.00000,'2014-01-03 20:49:55'),
('SAR','SR','Saudi Riyal',682,'hidden',' ','after',2,0.00,',','.','Riyals','Hallallah',1.00000,'2014-01-03 20:54:44'),
('SBD','SI$','Solomon Islands Dollar',90,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('SCR','SRe','Seychellois Rupee',690,'hidden',' ','after',2,0.00,',','.','Rupee','Cent',1.00000,'2014-01-03 20:54:44'),
('SDD','LSd','Old Sudanese Dinar',736,'hidden',' ','after',2,0.00,',','.','Dinar','None',1.00000,'2014-01-03 20:54:44'),
('SEK','kr','Swedish Krona',752,'after',' ','hidden',2,0.00,',',',','Kronor','Öre',1.00000,'2014-01-03 20:49:55'),
('SGD','S$','Singapore Dollar',702,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('SHP','SH£','Saint Helena Pound',654,'hidden',' ','after',2,0.00,',','.','Pound','Penny',1.00000,'2014-01-03 20:54:44'),
('SLL','Le','Sierra Leonean Leone',694,'hidden',' ','after',0,0.00,',','.','Leone','Cent',1.00000,'2014-01-03 20:54:44'),
('SOS','Ssh','Somali Shilling',706,'hidden',' ','after',0,0.00,',','.','Shilling','Cent',1.00000,'2014-01-03 20:54:44'),
('SRD','SR$','Surinamese Dollar',NULL,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('SRG','Sf','Suriname Guilder',740,'hidden',' ','after',2,0.00,',','.','Guilder','Cent',1.00000,'2014-01-03 20:54:44'),
('STD','Db','São Tomé and Príncipe Dobra',678,'hidden',' ','after',0,0.00,',','.','Dobra','Cêntimo',1.00000,'2014-01-03 20:54:44'),
('SYP','SY£','Syrian Pound',760,'hidden',' ','after',0,0.00,',','.','Pound','Piastre',1.00000,'2014-01-03 20:54:44'),
('SZL','SZL','Swazi Lilangeni',748,'hidden',' ','after',2,0.00,',','.','Lilangeni','Cent',1.00000,'2014-01-03 20:54:44'),
('THB','?','Thai Baht',764,'hidden',' ','after',2,0.00,',','.','Baht','Satang',1.00000,'2014-01-03 20:54:44'),
('TND','DT','Tunisian Dinar',788,'hidden',' ','after',3,0.00,',','.','Dinar','Millime',1.00000,'2014-01-03 20:54:44'),
('TOP','T$','Tongan Pa?anga',776,'hidden',' ','after',2,0.00,',','.','Pa?anga','Senit',1.00000,'2014-01-03 20:54:44'),
('TRY','TL','Turkish Lira',949,'after',' ','',2,0.00,'.',',','Lira','Kurus',1.00000,'2014-01-03 20:49:55'),
('TTD','TT$','Trinidad and Tobago Dollar',780,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('TWD','NT$','New Taiwan Dollar',901,'hidden',' ','after',2,0.00,',','.','New Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('TZS','TSh','Tanzanian Shilling',834,'hidden',' ','after',0,0.00,',','.','Shilling','Senti',1.00000,'2014-01-03 20:54:44'),
('UAH','???.','Ukrainian Hryvnia',980,'after',' ','hidden',2,0.00,',','.','Hryvnia','Kopiyka',1.00000,'2014-01-03 20:49:55'),
('UGX','USh','Ugandan Shilling',800,'hidden',' ','after',0,0.00,',','.','Shilling','Cent',1.00000,'2014-01-03 20:54:44'),
('USD','$','United States Dollar',840,'before',' ','hidden',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:49:55'),
('UYU','\$U','Uruguayan Peso',858,'hidden',' ','after',2,0.00,',','.','Peso','Centésimo',1.00000,'2014-01-03 20:54:44'),
('VEF','Bs.F.','Venezuelan Bolívar Fuerte',NULL,'hidden',' ','after',2,0.00,',','.','Bolivares Fuerte','Céntimo',1.00000,'2014-01-03 20:54:44'),
('VND','?','Vietnamese Dong',704,'after','','hidden',0,0.00,'.','.','Dong','Hà',1.00000,'2014-01-03 20:53:33'),
('VUV','VT','Vanuatu Vatu',548,'hidden',' ','after',0,0.00,',','.','Vatu',NULL,1.00000,'2014-01-03 20:54:44'),
('WST','WS$','Samoan Tala',882,'hidden',' ','after',2,0.00,',','.','Tala','Sene',1.00000,'2014-01-03 20:54:44'),
('XAF','FCFA','CFA Franc BEAC',950,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('XCD','EC$','East Caribbean Dollar',951,'hidden',' ','after',2,0.00,',','.','Dollar','Cent',1.00000,'2014-01-03 20:54:44'),
('XOF','CFA','CFA Franc BCEAO',952,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('XPF','CFPF','CFP Franc',953,'hidden',' ','after',0,0.00,',','.','Franc','Centime',1.00000,'2014-01-03 20:54:44'),
('YER','YR','Yemeni Rial',886,'hidden',' ','after',0,0.00,',','.','Rial','Fils',1.00000,'2014-01-03 20:54:44'),
('ZAR','R','South African Rand',710,'before',' ','hidden',2,0.00,',','.','Rand','Cent',1.00000,'2014-01-03 20:49:55'),
('ZMK','ZK','Zambian Kwacha',894,'hidden',' ','after',0,0.00,',','.','Kwacha','Ngwee',1.00000,'2014-01-03 20:54:44');",
"ALTER TABLE `{$_TABLES['paypal.products']}` ADD sale_price DECIMAL(15,4)",
);
$_SQL['paypal.ipnlog'] = "CREATE TABLE {$_TABLES['paypal.ipnlog']} (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip_addr` varchar(15) NOT NULL,
`ts` int(11) unsigned,
`verified` tinyint(1) DEFAULT '0',
`txn_id` varchar(255) DEFAULT NULL,
`gateway` varchar(25) DEFAULT NULL,
`ipn_data` text NOT NULL,
PRIMARY KEY (`id`),
KEY `ipnlog_ts` (`ts`),
KEY `ipnlog_txnid` (`txn_id`)
) ENGINE=MyISAM";
$_SQL['paypal.products'] = "CREATE TABLE {$_TABLES['paypal.products']} (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`cat_id` int(11) unsigned NOT NULL DEFAULT '0',
`short_description` varchar(255) DEFAULT NULL,
`description` text,
`keywords` varchar(255) DEFAULT '',
`price` decimal(12,4) unsigned DEFAULT NULL,
`prod_type` tinyint(2) DEFAULT '0',
`file` varchar(255) DEFAULT NULL,
`expiration` int(11) DEFAULT NULL,
`enabled` tinyint(1) DEFAULT '1',
`featured` tinyint(1) unsigned DEFAULT '0',
`dt_add` datetime NOT NULL,
`views` int(4) unsigned DEFAULT '0',
`comments_enabled` tinyint(1) DEFAULT '0',
`rating_enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`buttons` text,
`rating` double(6,4) NOT NULL DEFAULT '0.0000',
`votes` int(11) unsigned NOT NULL DEFAULT '0',
`weight` decimal(9,4) DEFAULT '0.0000',
`taxable` tinyint(1) unsigned NOT NULL DEFAULT '1',
`shipping_type` tinyint(1) unsigned NOT NULL DEFAULT '0',
`shipping_amt` decimal(9,4) unsigned NOT NULL DEFAULT '0.0000',
`shipping_units` decimal(9,4) unsigned NOT NULL DEFAULT '0.0000',
`show_random` tinyint(1) unsigned NOT NULL DEFAULT '1',
`show_popular` tinyint(1) unsigned NOT NULL DEFAULT '1',
`options` text,
`track_onhand` tinyint(1) unsigned NOT NULL DEFAULT '0',
`onhand` int(10) unsigned DEFAULT '0',
`oversell` tinyint(1) NOT NULL DEFAULT '0',
`qty_discounts` text,
`custom` varchar(255) NOT NULL DEFAULT '',
`avail_beg` date DEFAULT '1900-01-01',
`avail_end` date DEFAULT '9999-12-31',
PRIMARY KEY (`id`),
KEY `products_name` (`name`),
KEY `products_price` (`price`),
KEY `avail_beg` (`avail_beg`),
KEY `avail_end` (`avail_end`)
) ENGINE=MyISAM";
$_SQL['paypal.purchases'] = "CREATE TABLE {$_TABLES['paypal.purchases']} (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` varchar(40) NOT NULL,
`product_id` varchar(128) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`quantity` int(11) NOT NULL DEFAULT '1',
`txn_id` varchar(128) DEFAULT '',
`txn_type` varchar(255) DEFAULT '',
`status` varchar(255) DEFAULT NULL,
`expiration` int(11) unsigned NOT NULL DEFAULT '0',
`price` float(9,4) NOT NULL DEFAULT '0.0000',
`taxable` tinyint(1) unsigned NOT NULL DEFAULT '0',
`token` varchar(40) NOT NULL DEFAULT '',
`options` varchar(40) DEFAULT '',
`options_text` text,
`extras` text,
`shipping` decimal(9,4) NOT NULL DEFAULT '0.0000',
`handling` decimal(9,4) NOT NULL DEFAULT '0.0000',
`tax` decimal(9,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `purchases_productid` (`product_id`),
KEY `purchases_txnid` (`txn_id`)
) ENGINE=MyISAM";
$_SQL['paypal.images'] = "CREATE TABLE {$_TABLES['paypal.images']} (
`img_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`product_id` int(11) unsigned NOT NULL,
`filename` varchar(255) DEFAULT NULL,
PRIMARY KEY (`img_id`),
KEY `idxProd` (`product_id`,`img_id`)
) ENGINE=MyISAM";
/*$_SQL['paypal.prodXcat'] = "CREATE TABLE {$_TABLES['paypal.prodXcat']} (
`prod_id` int(11) unsigned NOT NULL,
`cat_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`prod_id`,`cat_id`)
)";*/
$_SQL['paypal.categories'] = "CREATE TABLE {$_TABLES['paypal.categories']} (
`cat_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`parent_id` smallint(5) unsigned DEFAULT '0',
`cat_name` varchar(128) DEFAULT '',
`description` text,
`enabled` tinyint(1) unsigned DEFAULT '1',
`grp_access` mediumint(8) unsigned NOT NULL DEFAULT '1',
`image` varchar(255) DEFAULT '',
`lft` smallint(5) unsigned NOT NULL DEFAULT '0',
`rgt` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`cat_id`),
KEY `idxName` (`cat_name`,`cat_id`),
KEY `cat_lft` (`lft`),
KEY `cat_rgt` (`rgt`)
) ENGINE=MyISAM";
// since 0.4.5
$_SQL['paypal.prod_attr'] = "CREATE TABLE `{$_TABLES['paypal.prod_attr']}` (
`attr_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`item_id` int(11) unsigned DEFAULT NULL,
`attr_name` varchar(64) DEFAULT NULL,
`attr_value` varchar(64) DEFAULT NULL,
`orderby` int(3) unsigned DEFAULT NULL,
`attr_price` decimal(9,4) DEFAULT NULL,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`attr_id`),
UNIQUE KEY `item_id` (`item_id`,`attr_name`,`attr_value`)
) ENGINE=MyISAM";
// since 0.5.0
$_SQL['paypal.buttons'] = "CREATE TABLE `{$_TABLES['paypal.buttons']}` (
`pi_name` varchar(20) NOT NULL DEFAULT 'paypal',
`item_id` varchar(40) NOT NULL,
`gw_name` varchar(10) NOT NULL DEFAULT '',
`btn_key` varchar(20) NOT NULL,
`button` text,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`pi_name`,`item_id`,`gw_name`,`btn_key`)
) ENGINE=MyISAM";
// since 0.5.0
$_SQL['paypal.orders'] = "CREATE TABLE `{$_TABLES['paypal.orders']}` (
`order_id` varchar(40) NOT NULL,
`uid` int(11) NOT NULL DEFAULT '0',
`order_date` int(11) unsigned NOT NULL DEFAULT '0',
`last_mod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`billto_id` int(11) unsigned NOT NULL DEFAULT '0',
`billto_name` varchar(255) DEFAULT NULL,
`billto_company` varchar(255) DEFAULT NULL,
`billto_address1` varchar(255) DEFAULT NULL,
`billto_address2` varchar(255) DEFAULT NULL,
`billto_city` varchar(255) DEFAULT NULL,
`billto_state` varchar(255) DEFAULT NULL,
`billto_country` varchar(255) DEFAULT NULL,
`billto_zip` varchar(40) DEFAULT NULL,
`shipto_id` int(11) unsigned NOT NULL DEFAULT '0',
`shipto_name` varchar(255) DEFAULT NULL,
`shipto_company` varchar(255) DEFAULT NULL,
`shipto_address1` varchar(255) DEFAULT NULL,
`shipto_address2` varchar(255) DEFAULT NULL,
`shipto_city` varchar(255) DEFAULT NULL,
`shipto_state` varchar(255) DEFAULT NULL,
`shipto_country` varchar(255) DEFAULT NULL,
`shipto_zip` varchar(40) DEFAULT NULL,
`phone` varchar(30) DEFAULT NULL,
`buyer_email` varchar(255) DEFAULT NULL,
`tax` decimal(9,4) unsigned DEFAULT NULL,
`shipping` decimal(9,4) unsigned DEFAULT NULL,
`handling` decimal(9,4) unsigned DEFAULT NULL,
`by_gc` decimal(12,4) unsigned DEFAULT NULL,
`status` varchar(25) DEFAULT 'pending',
`pmt_method` varchar(20) DEFAULT NULL,
`pmt_txn_id` varchar(255) DEFAULT NULL,
`instructions` text,
`token` varchar(20) DEFAULT NULL,
`tax_rate` decimal(7,5) NOT NULL DEFAULT '0.00000',
`info` text,
`currency` varchar(5) NOT NULL DEFAULT 'USD',
`order_seq` int(11) UNSIGNED,
PRIMARY KEY (`order_id`),
KEY (`order_date`),
UNIQUE (order_seq)
) ENGINE=MyISAM";
// since 0.5.0
$_SQL['paypal.address'] = "CREATE TABLE `{$_TABLES['paypal.address']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL DEFAULT '1',
`name` varchar(255) DEFAULT NULL,
`company` varchar(255) DEFAULT NULL,
`address1` varchar(255) DEFAULT NULL,
`address2` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`zip` varchar(40) DEFAULT NULL,
`billto_def` tinyint(1) unsigned NOT NULL DEFAULT '0',
`shipto_def` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `uid` (`uid`,`zip`)
) ENGINE=MyISAM";
// since 0.5.0
$_SQL['paypal.userinfo'] = "CREATE TABLE `{$_TABLES['paypal.userinfo']}` (
`uid` int(11) unsigned NOT NULL,
`cart` text,
PRIMARY KEY (`uid`)
) ENGINE=MyISAM";
// since .5.0
$_SQL['paypal.gateways'] = "CREATE TABLE `{$_TABLES['paypal.gateways']}` (
`id` varchar(25) NOT NULL,
`orderby` int(3) NOT NULL DEFAULT '0',
`enabled` tinyint(1) NOT NULL DEFAULT '1',
`description` varchar(255) DEFAULT NULL,
`config` text,
`services` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`)
) ENGINE=MyISAM";
// since 0.5.0
$_SQL['paypal.workflows'] = "CREATE TABLE `{$_TABLES['paypal.workflows']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wf_name` varchar(40) DEFAULT NULL,
`orderby` int(2) DEFAULT NULL,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`can_disable` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`)
) ENGINE=MyISAM";
// since 0.5.2
$_SQL['paypal.orderstatus'] = "CREATE TABLE `{$_TABLES['paypal.orderstatus']}` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`orderby` int(3) unsigned NOT NULL DEFAULT '0',
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`name` varchar(20) NOT NULL,
`notify_buyer` tinyint(1) NOT NULL DEFAULT '1',
`notify_admin` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`)
) ENGINE=MyISAM";
// since 0.5.2
$_SQL['paypal.order_log'] = "CREATE TABLE `{$_TABLES['paypal.order_log']}` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ts` int(11) unsigned DEFAULT NULL,
`order_id` varchar(40) DEFAULT NULL,
`username` varchar(60) NOT NULL DEFAULT '',
`message` text,
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`)
) ENGINE=MyISAM";
// since 0.5.4
$_SQL['paypal.currency'] = $PP_UPGRADE['0.5.4'][0];
// since 0.6.0
$_SQL['paypal.coupons'] = "CREATE TABLE `{$_TABLES['paypal.coupons']}` (
`code` varchar(128) NOT NULL,
`amount` decimal(12,4) unsigned NOT NULL DEFAULT '0.0000',
`balance` decimal(12,4) unsigned NOT NULL DEFAULT '0.0000',
`buyer` int(11) unsigned NOT NULL DEFAULT '0',
`redeemer` int(11) unsigned NOT NULL DEFAULT '0',
`purchased` int(11) unsigned NOT NULL DEFAULT '0',
`redeemed` int(11) unsigned NOT NULL DEFAULT '0',
`expires` date DEFAULT '9999-12-31',
PRIMARY KEY (`code`),
KEY `owner` (`redeemer`,`balance`,`expires`),
KEY `purchased` (`purchased`)
) ENGINE=MyIsam";
// since 0.6.0
$_SQL['paypal.coupon_log'] = "CREATE TABLE {$_TABLES['paypal.coupon_log']} (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL DEFAULT '0',
`code` varchar(128) NOT NULL,
`ts` int(11) unsigned DEFAULT NULL,
`order_id` varchar(50) DEFAULT NULL,
`amount` float(8,2) DEFAULT NULL,
`msg` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `code` (`code`)
) ENGINE=MyIsam";
// since 0.6.0
$_SQL['paypal.sales'] = "CREATE TABLE {$_TABLES['paypal.sales']} (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(40),
`item_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`item_id` int(11) unsigned NOT NULL,
`start` int(11) unsigned DEFAULT NULL,
`end` int(11) unsigned DEFAULT NULL,
`discount_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`amount` decimal(6,4) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `item_type` (`item_type`,`item_id`,`start`,`end`)
) ENGINE=MyIsam";
// since 0.6.0+
$_SQL['paypal.shipping'] = "CREATE TABLE `{$_TABLES['paypal.shipping']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`min_units` int(11) unsigned NOT NULL DEFAULT '0',
`max_units` int(11) unsigned NOT NULL DEFAULT '0',
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`rates` text,
PRIMARY KEY (`id`)
) ENGINE=MyIsam";
// Sample data to load up the Paypal gateway configuration
$_PP_SAMPLEDATA = array(
"INSERT INTO {$_TABLES['paypal.categories']}
(cat_id, parent_id, cat_name, description, grp_access, lft, rgt)
VALUES
(1, 0, 'Home', 'Root Category', 2, 1, 2)",
/* "INSERT INTO {$_TABLES['paypal.gateways']}
(id, orderby, enabled, description, config, services)
VALUES
('paypal', 10, 0, 'Paypal Website Payments Standard', '',
'a:6:{s:7:\"buy_now\";s:1:\"1\";s:8:\"donation\";s:1:\"1\";s:7:\"pay_now\";s:1:\"1\";s:9:\"subscribe\";s:1:\"1\";s:8:\"checkout\";s:1:\"1\";s:8:\"external\";s:1:\"1\";}')",*/
"INSERT INTO {$_TABLES['paypal.workflows']}
(id, wf_name, orderby, enabled, can_disable)
VALUES
(1, 'viewcart', 10, 3, 0),
(2, 'billto', 20, 0, 1),
(3, 'shipto', 30, 2, 1)",
"INSERT INTO {$_TABLES['paypal.orderstatus']}
(id, orderby, enabled, name, notify_buyer, notify_admin)
VALUES
(1, 10, 1, 'pending', 0, 0),
(2, 20, 1, 'paid', 1, 1),
(3, 30, 1, 'processing', 1, 0),
(4, 40, 1, 'shipped', 1, 0),
(5, 50, 1, 'closed', 0, 0),
(6, 60, 1, 'refunded', 0, 0)",
$PP_UPGRADE['0.5.4'][1],
"INSERT INTO `{$_TABLES['paypal.shipping']}` VALUES
(1,'USPS Priority Flat Rate',0.0001,50.0000,0,'[{\"dscp\":\"Small\",\"units\":5,\"rate\":7.2},{\"dscp\":\"Medium\",\"units\":20,\"rate\":13.65},{\"dscp\":\"Large\",\"units\":50,\"rate\":18.9}]')",
);
// Upgrade information for version 0.1.1 to version 0.2
$PP_UPGRADE['0.2'] = array(
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD COLUMN quantity int NOT NULL DEFAULT 1 AFTER product_id",
"ALTER TABLE {$_TABLES['paypal.products']}
ADD COLUMN category varchar(80) AFTER name,
ADD KEY `products_category` (category)",
);
$PP_UPGRADE['0.4.0'] = array(
$_SQL['paypal.images'],
//$_SQL['paypal.prodXcat'],
$_SQL['paypal.categories'],
"ALTER TABLE {$_TABLES['paypal.products']}
CHANGE download prod_type tinyint(2) default 0,
ADD `enabled` tinyint(1) default 1,
ADD `featured` tinyint(1) unsigned default '0',
ADD `dt_add` INT(11) UNSIGNED,
ADD `views` INT(4) UNSIGNED DEFAULT 0,
ADD `comments` int(5) unsigned default '0',
ADD `comments_enabled` tinyint(1) unsigned default '0',
ADD `buttons` text,
ADD `rating` double(6,4) NOT NULL default '0.0000',
ADD `votes` int(11) unsigned NOT NULL default '0',
ADD `weight` float(6,2) default '0' AFTER `prod_type`,
ADD `taxable` tinyint(1) unsigned NOT NULL default '1',
ADD `shipping_type` tinyint(1) unsigned NOT NULL default '0',
ADD `shipping_amt` float(6,2) unsigned NOT NULL default '0',
ADD `cat_id` int(11) unsigned NOT NULL default '0' AFTER `name`,
ADD `keywords` varchar(255) default '' AFTER `description`,
DROP `small_pic`,
DROP `picture`,
DROP `physical`",
"ALTER TABLE {$_TABLES['paypal.purchases']}
CHANGE `product_id` `product_id` varchar(255) not null,
ADD `txn_type` varchar(255) default '' AFTER `txn_id`,
ADD `price` float(10,2) NOT NULL DEFAULT 0",
"INSERT INTO {$_TABLES['blocks']}
(type, name, title, tid, phpblockfn, is_enabled,
owner_id, group_id,
perm_owner, perm_group, perm_members, perm_anon)
VALUES
('phpblock', 'paypal_featured', 'Featured Product', 'all',
'phpblock_paypal_featured', 0, 2, 13, 3, 2, 2, 2),
('phpblock', 'paypal_random', 'Random Product', 'all',
'phpblock_paypal_random', 0, 2, 13, 3, 2, 2, 2),
('phpblock', 'paypal_categories', 'Product Categories', 'all',
'phpblock_paypal_categories', 0, 2, 13, 3, 2, 2, 2)",
);
$PP_UPGRADE['0.4.1'] = array(
"ALTER TABLE {$_TABLES['paypal.products']}
ADD `show_random` tinyint(1) unsigned NOT NULL default '1',
ADD `show_popular` tinyint(1) unsigned NOT NULL default '1',
CHANGE comments_enabled comments_enabled tinyint(1)",
"UPDATE {$_TABLES['paypal.products']}
SET comments_enabled=-1 WHERE comments_enabled=2",
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD description varchar(255) AFTER product_id",
"UPDATE {$_TABLES['conf_values']} SET
fieldset=50,
sort_order=20
WHERE
name='debug_ipn' AND group_name='" . $_PP_CONF['pi_name'] . "'",
);
$PP_UPGRADE['0.4.2'] = array(
"ALTER TABLE {$_TABLES['paypal.products']}
ADD `rating_enabled` tinyint(1) unsigned NOT NULL default '1'
AFTER `comments_enabled`",
);
$PP_UPGRADE['0.4.3'] = array(
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD description varchar(255) AFTER product_id",
);
$PP_UPGRADE['0.4.4'] = array(
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD `token` varchar(40) AFTER `price`",
"ALTER TABLE {$_TABLES['paypal.products']}
ADD `options` text",
);
$PP_UPGRADE['0.4.5'] = array(
"CREATE TABLE IF NOT EXISTS `{$_TABLES['paypal.prod_attr']}` (
`attr_id` int(11) unsigned NOT NULL auto_increment,
`item_id` int(11) unsigned default NULL,
`attr_name` varchar(32) default NULL,
`attr_value` varchar(32) default NULL,
`orderby` int(3) unsigned default NULL,
`attr_price` float(8,2) default NULL,
`enabled` tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (`attr_id`),
UNIQUE KEY `item_id` (`item_id`,`attr_name`, `attr_value`)
) ENGINE=MyISAM",
);
$PP_UPGRADE['0.4.6'] = array(
"UPDATE {$_TABLES['paypal.products']} SET prod_type=4 WHERE prod_type=2",
"UPDATE {$_TABLES['paypal.products']} SET prod_type=2 WHERE prod_type=1",
"UPDATE {$_TABLES['paypal.products']} SET prod_type=1 WHERE prod_type=0",
);
$PP_UPGRADE['0.5.0'] = array(
"CREATE TABLE `{$_TABLES['paypal.buttons']}` (
`item_id` int(11) NOT NULL,
`gw_name` varchar(10) NOT NULL,
`button` text,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`item_id`,`gw_name`)) ENGINE=MyISAM",
"CREATE TABLE `{$_TABLES['paypal.orders']}` (
`order_id` varchar(40) NOT NULL,
`uid` int(11) NOT NULL DEFAULT '0',
`order_date` datetime NOT NULL,
`last_mod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`billto_name` varchar(255) DEFAULT NULL,
`billto_company` varchar(255) DEFAULT NULL,
`billto_address1` varchar(255) DEFAULT NULL,
`billto_address2` varchar(255) DEFAULT NULL,
`billto_city` varchar(255) DEFAULT NULL,
`billto_state` varchar(255) DEFAULT NULL,
`billto_country` varchar(255) DEFAULT NULL,
`billto_zip` varchar(40) DEFAULT NULL,
`shipto_name` varchar(255) DEFAULT NULL,
`shipto_company` varchar(255) DEFAULT NULL,
`shipto_address1` varchar(255) DEFAULT NULL,
`shipto_address2` varchar(255) DEFAULT NULL,
`shipto_city` varchar(255) DEFAULT NULL,
`shipto_state` varchar(255) DEFAULT NULL,
`shipto_country` varchar(255) DEFAULT NULL,
`shipto_zip` varchar(40) DEFAULT NULL,
`phone` varchar(30) DEFAULT NULL,
`tax` decimal(9,4) unsigned DEFAULT NULL,
`shipping` decimal(9,4) unsigned DEFAULT NULL,
`handling` decimal(9,4) unsigned DEFAULT NULL,
`status` varchar(25) DEFAULT 'pending',
`pmt_method` varchar(20) DEFAULT NULL,
`pmt_txn_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`order_id`) ) ENGINE=MyISAM",
"CREATE TABLE `{$_TABLES['paypal.address']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL DEFAULT '1',
`name` varchar(255) DEFAULT NULL,
`company` varchar(255) DEFAULT NULL,
`address1` varchar(255) DEFAULT NULL,
`address2` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`zip` varchar(40) DEFAULT NULL,
`billto_def` tinyint(1) unsigned NOT NULL DEFAULT '0',
`shipto_def` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) ) ENGINE=MyISAM",
"CREATE TABLE `{$_TABLES['paypal.userinfo']}` (
`uid` int(11) unsigned NOT NULL,
`cart` text,
PRIMARY KEY (`uid`)) ENGINE=MyISAM",
"ALTER TABLE `{$_TABLES['paypal.products']}`
ADD `purch_grp` int(11) unsigned DEFAULT 1 AFTER `options`",
"CREATE TABLE `{$_TABLES['paypal.gateways']}` (
`id` varchar(25) NOT NULL,
`orderby` int(3) NOT NULL DEFAULT '0',
`enabled` tinyint(1) NOT NULL DEFAULT '1',
`description` varchar(255) DEFAULT NULL,
`config` text,
`services` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`) ) ENGINE=MyISAM",
"CREATE TABLE `{$_TABLES['paypal.workflows']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`wf_name` varchar(40) DEFAULT NULL,
`orderby` int(2) DEFAULT NULL,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`) ) ENGINE=MyISAM",
"CREATE TABLE `{$_TABLES['paypal.cart']}` (
`cart_id` varchar(40) NOT NULL,
`cart_uid` int(11) unsigned NOT NULL,
`cart_order_id` varchar(20) DEFAULT NULL,
`cart_info` text,
`cart_contents` text,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`cart_id`)) ENGINE=MyISAM",
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD order_id varchar(40) NOT NULL AFTER `id`,
ADD options varchar(40) default '',
ADD KEY (`order_id`)",
"INSERT INTO {$_TABLES['paypal.workflows']}
(id, wf_name, orderby, enabled)
VALUES
(1, 'viewcart', 10, 0),
(2, 'billto', 20, 0),
(3, 'shipto', 30, 0)",
"ALTER TABLE {$_TABLES['paypal.ipnlog']}
ADD `gateway` varchar(25) AFTER `txn_id`",
"UPDATE {$_TABLES['paypal.ipnlog']} SET gateway='paypal'",
"INSERT INTO {$_TABLES['blocks']}
(bid, is_enabled, name, type, title,
tid, blockorder, content,
rdfurl, rdfupdated, onleft, phpblockfn, help, group_id, owner_id,
perm_owner, perm_group, perm_members,perm_anon)
VALUES
('', 1, 'paypal_cart', 'phpblock', 'Shopping Cart',
'all', 5, '',
'', '', 1, 'phpblock_paypal_cart', '', 13, 2,
3, 2, 2, 2)",
);
$PP_UPGRADE['0.5.2'] = array(
"ALTER TABLE {$_TABLES['paypal.orders']}
ADD buyer_email varchar(255) default '' after phone,
CHANGE status status varchar(25) not null default 'pending'",
"UPDATE {$_TABLES['paypal.orders']} SET status='paid'",
"CREATE TABLE `{$_TABLES['paypal.orderstatus']}` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`orderby` INT(3) UNSIGNED NOT NULL DEFAULT '0',
`enabled` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`name` VARCHAR(20) NOT NULL,
`notify_buyer` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `orderby` (`orderby`) ) ENGINE=MyISAM",
"INSERT INTO {$_TABLES['paypal.orderstatus']}
(id, orderby, enabled, name, notify_buyer)
VALUES
(1, 10, 1, 'pending', 0),
(2, 20, 1, 'paid', 1),
(3, 30, 1, 'processing', 0),
(4, 40, 1, 'shipped', 0),
(5, 50, 1, 'closed', 0)",
"CREATE TABLE `{$_TABLES['paypal.order_log']}` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`order_id` VARCHAR(40) NULL DEFAULT NULL,
`username` VARCHAR(60) NOT NULL DEFAULT '',
`message` TEXT NULL,
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`) ) ENGINE=MyISAM",
"ALTER TABLE `{$_TABLES['paypal.products']}`
ADD track_onhand TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
ADD onhand INT(10) NOT NULL DEFAULT '0'",
);
$PP_UPGRADE['0.5.6'] = array(
"ALTER TABLE {$_TABLES['paypal.products']}
ADD oversell tinyint(1) not null default 0",
);
$PP_UPGRADE['0.5.7'] = array(
"INSERT INTO {$_TABLES['blocks']}
(type, name, title, tid, phpblockfn, is_enabled,
owner_id, group_id,
perm_owner, perm_group, perm_members, perm_anon)
VALUES
('phpblock', 'paypal_recent', 'Newest Items', 'all',
'phpblock_paypal_recent', 0, 2, 13, 3, 2, 2, 2)",
"ALTER TABLE {$_TABLES['paypal.products']}
CHANGE dt_add dt_add datetime not null,
ADD `qty_discounts` text AFTER `oversell`,
ADD `custom` varchar(255) NOT NULL DEFAULT ''",
"UPDATE {$_TABLES['paypal.products']}
SET dt_add = NOW()",
"ALTER TABLE {$_TABLES['paypal.cart']}
CHANGE last_update last_update datetime NOT NULL",
"ALTER TABLE {$_TABLES['paypal.orders']}
CHANGE last_mod last_mod datetime NOT NULL",
"ALTER TABLE {$_TABLES['paypal.order_log']}
CHANGE ts ts datetime NOT NULL",
"ALTER TABLE {$_TABLES['paypal.categories']}
CHANGE description description text",
"TRUNCATE {$_TABLES['paypal.cart']}",
);
$PP_UPGRADE['0.5.8'] = array(
"ALTER TABLE {$_TABLES['paypal.categories']}
CHANGE group_id grp_access mediumint(8) unsigned not null default 13,
DROP owner_id, DROP perm_owner, DROP perm_group, DROP perm_members, DROP perm_anon",
"ALTER TABLE {$_TABLES['paypal.products']}
DROP purch_grp,
ADD sale_beg DATE DEFAULT '1900-01-01',
ADD sale_end DATE DEFAULT '1900-01-01',
ADD avail_beg DATE DEFAULT '1900-01-01',
ADD avail_end DATE DEFAULT '9999-12-31'",
"ALTER TABLE {$_TABLES['paypal.purchases']}
ADD options_text text",
"DELETE FROM {$_TABLES['paypal.gateways']} WHERE id='amazon'",
"ALTER TABLE {$_TABLES['paypal.orders']}
ADD buyer_email varchar(255) DEFAULT NULL AFTER phone",
// Altered in 0.4.1 but installation sql wasn't updated
"ALTER TABLE {$_TABLES['paypal.products']}
CHANGE comments_enabled comments_enabled tinyint(1) default 0",
);
$PP_UPGRADE['0.5.9'] = array(
// Fix the subgroup value, originally used the wrong field
"UPDATE {$_TABLES['conf_values']} SET subgroup=10 where name='sg_shop'",
"ALTER TABLE {$_TABLES['paypal.products']}
CHANGE `name` `name` varchar(128) NOT NULL",
"ALTER TABLE {$_TABLES['paypal.purchases']}
CHANGE `product_id` `product_id` varchar(128) NOT NULL,
CHANGE `txn_id` `txn_id` varchar(128) default ''",
"ALTER TABLE {$_TABLES['paypal.images']}
CHANGE `product_id` `product_id` int(11) unsigned NOT NULL",
"ALTER TABLE {$_TABLES['paypal.categories']}
CHANGE `cat_name` `cat_name` varchar(128) default ''",
"INSERT INTO {$_TABLES['blocks']}
(is_enabled, name, type, title, blockorder, phpblockfn)
VALUES
(0, 'paypal_search', 'phpblock', 'Search Catalog',
9999, 'phpblock_paypal_search')",
);
$PP_UPGRADE['0.5.11'] = array(
"ALTER TABLE {$_TABLES['paypal.address']}
CHANGE `zip` `zip` varchar(40) DEFAUlT NULL,
ADD KEY `uid` (`uid`,`zip`)",
"ALTER TABLE {$_TABLES['paypal.orders']}
CHANGE `billto_zip` `billto_zip` varchar(40) DEFAULT NULL,
CHANGE `shipto_zip` `shipto_zip` varchar(40) DEFAULT NULL",
);
$PP_UPGRADE['0.6.0'] = array(
// Drop new tables in case of a failed previous attempt.
"DROP TABLE IF EXISTS {$_TABLES['paypal.sales']}",
"DROP TABLE IF EXISTS {$_TABLES['paypal.coupons']}",
"DROP TABLE IF EXISTS {$_TABLES['paypal.coupon_log']}",
"ALTER TABLE {$_TABLES['paypal.purchases']} ADD extras text",
"ALTER TABLE {$_TABLES['paypal.purchases']} ADD `shipping` decimal(9,4) NOT NULL DEFAULT '0.0000'",
"ALTER TABLE {$_TABLES['paypal.purchases']} ADD `handling` decimal(9,4) NOT NULL DEFAULT '0.0000'",
"ALTER TABLE {$_TABLES['paypal.purchases']} ADD `tax` decimal(9,4) NOT NULL DEFAULT '0.0000'",
"ALTER TABLE {$_TABLES['paypal.purchases']} ADD taxable tinyint(1) unsigned NOT NULL DEFAULT '0' after `price`",
"ALTER TABLE {$_TABLES['paypal.purchases']} CHANGE price price decimal(12,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD by_gc decimal(12,4) unsigned AFTER handling",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD token varchar(20)",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD tax_rate decimal(7,5) NOT NULL DEFAULT '0.00000'",
"ALTER TABLE {$_TABLES['paypal.orders']} CHANGE shipping shipping decimal(9,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.orders']} CHANGE handling handling decimal(9,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.orders']} CHANGE tax tax decimal(9,4) NOT NULL DEFAULT 0",
"CREATE TABLE `{$_TABLES['paypal.coupons']}` (
`code` varchar(128) NOT NULL,
`amount` decimal(12,4) unsigned NOT NULL DEFAULT '0.0000',
`balance` decimal(12,4) unsigned NOT NULL DEFAULT '0.0000',
`buyer` int(11) unsigned NOT NULL DEFAULT '0',
`redeemer` int(11) unsigned NOT NULL DEFAULT '0',
`purchased` int(11) unsigned NOT NULL DEFAULT '0',
`redeemed` int(11) unsigned NOT NULL DEFAULT '0',
`expires` date DEFAULT '9999-12-31',
PRIMARY KEY (`code`),
KEY `owner` (`redeemer`,`balance`,`expires`),
KEY `purchased` (`purchased`)
) ENGINE=MyIsam",
"CREATE TABLE {$_TABLES['paypal.coupon_log']} (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL DEFAULT '0',
`code` varchar(128) NOT NULL,
`ts` int(11) unsigned DEFAULT NULL,
`order_id` varchar(50) DEFAULT NULL,
`amount` float(8,2) DEFAULT NULL,
`msg` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `code` (`code`)
) ENGINE=MyIsam",
"ALTER TABLE {$_TABLES['paypal.buttons']} ADD `pi_name` varchar(20) NOT NULL DEFAULT 'paypal' FIRST",
"ALTER TABLE {$_TABLES['paypal.buttons']} ADD `btn_key` varchar(20) AFTER gw_name",
"ALTER TABLE {$_TABLES['paypal.buttons']} CHANGE item_id item_id varchar(40)",
"ALTER TABLE {$_TABLES['paypal.buttons']} DROP PRIMARY KEY",
"ALTER TABLE {$_TABLES['paypal.buttons']} ADD PRIMARY KEY (`pi_name`, `item_id`,`gw_name`,`btn_key`)",
"CREATE TABLE {$_TABLES['paypal.sales']} (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(40),
`item_type` varchar(10),
`item_id` int(11) unsigned NOT NULL,
`start` int(11) unsigned,
`end` int(11) unsigned,
`discount_type` varchar(10),
`amount` float DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `item_type` (`item_type`,`item_id`,`start`,`end`)
) ENGINE=MyIsam",
"ALTER TABLE {$_TABLES['paypal.products']} DROP comments",
"ALTER TABLE {$_TABLES['paypal.products']} DROP sale_price",
"ALTER TABLE {$_TABLES['paypal.products']} DROP sale_beg",
"ALTER TABLE {$_TABLES['paypal.products']} DROP sale_end",
"ALTER TABLE {$_TABLES['paypal.products']} CHANGE weight weight decimal(9,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.products']} CHANGE shipping_amt shipping_amt decimal(9,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.products']} CHANGE price price decimal(12,4) NOT NULL DEFAULT 0",
"ALTER TABLE {$_TABLES['paypal.products']} ADD shipping_units decimal(9,4) NOT NULL DEFAULT 0 AFTER shipping_amt",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD `info` text",
"ALTER TABLE {$_TABLES['paypal.orders']} CHANGE last_mod last_mod timestamp",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD `billto_id` int(11) unsigned NOT NULL DEFAULT '0'",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD `shipto_id` int(11) unsigned NOT NULL DEFAULT '0'",
"ALTER TABLE {$_TABLES['paypal.purchases']} DROP purchase_date",
"ALTER TABLE {$_TABLES['paypal.purchases']} DROP user_id",
"DROP TABLE IF EXISTS {$_TABLES['paypal.cart']}",
"ALTER TABLE {$_TABLES['paypal.prod_attr']} CHANGE attr_price `attr_price` decimal(9,4) default '0.00'",
"CREATE TABLE IF NOT EXISTS `{$_TABLES['paypal.shipping']}` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`min_units` int(11) unsigned NOT NULL DEFAULT '0',
`max_units` int(11) unsigned NOT NULL DEFAULT '0',
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`rates` text,
PRIMARY KEY (`id`)
) ENGINE=MyIsam",
);
$PP_UPGRADE['0.6.1'] = array(
"ALTER TABLE {$_TABLES['paypal.orders']} ADD currency varchar(5) NOT NULL DEFAULT 'USD'",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD order_seq int(11) UNSIGNED",
"ALTER TABLE {$_TABLES['paypal.orders']} ADD UNIQUE (order_seq)",
"SET @i:=0",
"UPDATE {$_TABLES['paypal.orders']} SET order_seq = @i:=@i+1
WHERE status NOT IN ('cart','pending') ORDER BY order_date ASC",
);
?>
| leegarner-glfusion/paypal | sql/mysql_install.php | PHP | gpl-2.0 | 52,275 |
<?php
/**
* @Project NUKEVIET 4.x
* @Author VINADES.,JSC (contact@vinades.vn)
* @Copyright (C) 2014 VINADES.,JSC. All rights reserved
* @License GNU/GPL version 2 or any later version
* @Createdate 2-9-2010 14:43
*/
if (!defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}
$page_title = $lang_module['addtotopics'];
$id_array = [];
$listid = $nv_Request->get_string('listid', 'get,post', '');
if ($nv_Request->isset_request('topicsid', 'post')) {
nv_insert_logs(NV_LANG_DATA, $module_name, 'log_add_topic', 'listid ' . $listid, $admin_info['userid']);
$topicsid = $nv_Request->get_int('topicsid', 'post');
$listid = array_filter(array_unique(array_map('intval', explode(',', $listid))));
foreach ($listid as $_id) {
$db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_rows SET topicid=' . $topicsid . ' WHERE id=' . $_id);
$result = $db->query('SELECT listcatid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows WHERE id=' . $_id);
list($listcatid) = $result->fetch(3);
$listcatid = explode(',', $listcatid);
foreach ($listcatid as $catid) {
$db->query('UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_' . $catid . ' SET topicid=' . $topicsid . ' WHERE id=' . $_id);
}
}
$nv_Cache->delMod($module_name);
exit($lang_module['topic_update_success']);
}
$db->sqlreset()
->select('id, title')
->from(NV_PREFIXLANG . '_' . $module_data . '_rows')
->order('id DESC');
if ($listid == '') {
$db->where('inhome=1')->limit(20);
} else {
$id_array = array_map('intval', explode(',', $listid));
$db->where('inhome=1 AND id IN (' . implode(',', $id_array) . ')');
}
$result = $db->query($db->sql());
$xtpl = new XTemplate('addtotopics.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
while (list($id, $title) = $result->fetch(3)) {
$xtpl->assign('ROW', [
'id' => $id,
'title' => $title,
'checked' => in_array($id, $id_array) ? ' checked="checked"' : ''
]);
$xtpl->parse('main.loop');
}
$result = $db->query('SELECT topicid, title FROM ' . NV_PREFIXLANG . '_' . $module_data . '_topics ORDER BY weight ASC');
while ($row = $result->fetch()) {
$xtpl->assign('TOPICSID', [
'key' => $row['topicid'],
'title' => $row['title']
]);
$xtpl->parse('main.topicsid');
}
$xtpl->parse('main');
$contents = $xtpl->text('main');
$set_active_op = 'topics';
include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
| NukeVietCMS/nukeviet | modules/news/admin/addtotopics.php | PHP | gpl-2.0 | 2,686 |
using Android.App;
using Android.Graphics;
using Android.OS;
using Android.Views;
using Android.Widget;
using Dietphone.Tools;
using Dietphone.ViewModels;
using Dietphone.Adapters;
using MvvmCross.Droid.Views;
using MvvmCross.Platform;
namespace Dietphone.Views
{
[Activity]
public class MainView : MvxTabActivity<MainViewModel>
{
private SubViewModelConnector subConnector;
private IMenuItem meal, sugar, insulin, add, search, settings, exportAndImportData, about, welcomeScreen;
private SearchView searchView;
private bool searchExpanded, showProductsOnly;
private const string JOURNAL_TAB = "journal";
private const string PRODUCTS_TAB = "products";
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.MainView);
Title = string.Empty;
InitializeViewModel();
InitializeTabs();
}
protected override void OnRestart()
{
base.OnRestart();
InitializeViewModel();
}
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.mainview_menu, menu);
GetMenu(menu);
TranslateMenu();
InitializeSearchMenu();
BindMenuActions();
SetMenuVisisiblity();
return true;
}
public override bool DispatchTouchEvent(MotionEvent ev)
{
this.HideSoftInputOnTouchOutside(ev, GetGlobalVisibleRect);
return base.DispatchTouchEvent(ev);
}
private void InitializeViewModel()
{
var fullInitialization = subConnector == null;
if (fullInitialization)
{
subConnector = new SubViewModelConnector(ViewModel);
subConnector.Loaded += delegate { ViewModel.UiRendered(); };
var welcome = ViewModel.WelcomeScreen;
welcome.LaunchBrowser += delegate { this.LaunchBrowser(Translations.WelcomeScreenLinkDroid); };
}
ViewModel.ShowProductsOnly += delegate { showProductsOnly = true; };
ViewModel.Untombstone();
var navigator = Mvx.Resolve<Navigator>();
subConnector.Navigator = navigator;
subConnector.Refresh();
ViewModel.Navigator = navigator;
}
private void InitializeTabs()
{
if (!showProductsOnly)
AddJournalTab();
AddProductsTab();
TabHost.TabChanged += TabHost_TabChanged;
SetSubViewModel();
}
private void GetMenu(IMenu menu)
{
meal = menu.FindItem(Resource.Id.mainview_meal);
sugar = menu.FindItem(Resource.Id.mainview_sugar);
insulin = menu.FindItem(Resource.Id.mainview_insulin);
add = menu.FindItem(Resource.Id.mainview_add);
search = menu.FindItem(Resource.Id.mainview_search);
settings = menu.FindItem(Resource.Id.mainview_settings);
exportAndImportData = menu.FindItem(Resource.Id.mainview_exportandimportdata);
about = menu.FindItem(Resource.Id.mainview_about);
welcomeScreen = menu.FindItem(Resource.Id.mainview_welcomescreen);
}
private void TranslateMenu()
{
meal.SetTitleCapitalized(Translations.Meal);
sugar.SetTitleCapitalized(Translations.Sugar);
insulin.SetTitleCapitalized(Translations.Insulin);
add.SetTitleCapitalized(Translations.Add);
search.SetTitleCapitalized(Translations.Search);
settings.SetTitleCapitalized(Translations.Settings);
exportAndImportData.SetTitleCapitalized(Translations.ExportAndImportData);
about.SetTitleCapitalized(Translations.About);
welcomeScreen.SetTitleCapitalized(Translations.WelcomeScreen);
}
private void InitializeSearchMenu()
{
searchView = (SearchView)search.ActionView;
searchView.QueryTextChange += SearchView_QueryTextChange;
search.SetOnActionExpandListener(new ActionExpandListener(() => Search_Expand(), () => Search_Collapse()));
}
private void BindMenuActions()
{
exportAndImportData.SetOnMenuItemClick(() => ViewModel.ExportAndImport());
settings.SetOnMenuItemClick(() => ViewModel.Settings());
var welcome = ViewModel.WelcomeScreen;
welcomeScreen.SetOnMenuItemClick(welcome.Show);
about.SetOnMenuItemClick(ViewModel.EmbeddedAbout);
BindAddMenuAction(meal, new JournalViewModel.AddMealCommand());
BindAddMenuAction(sugar, new JournalViewModel.AddSugarCommand());
BindAddMenuAction(insulin, new JournalViewModel.AddInsulinCommand());
BindAddMenuAction(add, new DefaultAddCommand());
}
private Rect GetGlobalVisibleRect(View view)
{
var rect = new Rect();
if (searchView.IsParentOf(view))
searchView.GetGlobalVisibleRect(rect);
else
view.GetGlobalVisibleRect(rect);
return rect;
}
private void AddJournalTab()
{
var tab = TabHost.NewTabSpec(JOURNAL_TAB);
tab.SetIndicator(Translations.Journal);
tab.SetContent(this.CreateIntentFor(ViewModel.Journal));
TabHost.AddTab(tab);
}
private void AddProductsTab()
{
var tab = TabHost.NewTabSpec(PRODUCTS_TAB);
tab.SetIndicator(Translations.Products);
tab.SetContent(this.CreateIntentFor(ViewModel.ProductListing));
TabHost.AddTab(tab);
}
private void TabHost_TabChanged(object sender, TabHost.TabChangeEventArgs e)
{
SetMenuVisisiblity();
SetSubViewModel();
}
private void SetSubViewModel()
{
if (TabHost.CurrentTabTag == JOURNAL_TAB)
subConnector.SubViewModel = ViewModel.Journal;
else if (TabHost.CurrentTabTag == PRODUCTS_TAB)
subConnector.SubViewModel = ViewModel.ProductListing;
}
private void SearchView_QueryTextChange(object sender, SearchView.QueryTextChangeEventArgs e)
{
ViewModel.Search = e.NewText;
e.Handled = true;
}
private void Search_Expand()
{
searchExpanded = true;
SetMenuVisisiblity();
}
private void Search_Collapse()
{
searchExpanded = false;
SetMenuVisisiblity();
}
private void BindAddMenuAction(IMenuItem item, AddCommand command)
{
item.SetOnMenuItemClick(() => subConnector.Add(command));
}
private void SetMenuVisisiblity()
{
if (meal == null)
return;
var inJournalTab = TabHost.CurrentTabTag == JOURNAL_TAB;
meal.SetVisible(inJournalTab && !searchExpanded);
sugar.SetVisible(inJournalTab && !searchExpanded);
insulin.SetVisible(inJournalTab && !searchExpanded);
add.SetVisible(!inJournalTab && !searchExpanded);
}
}
}
| PawelStroinski/Diettr-GPL | Dietphone.Droid/Views/MainView.cs | C# | gpl-2.0 | 7,595 |
<?php
class perfUnits extends Core{
function perfUnits(){
$this->Core("pupil_performance_assessment");
$this->addField("assessment");
$this->addField("passed");
}
}
?> | ya6adu6adu/schoolmule | schoolmodule/model/perfUnits.php | PHP | gpl-2.0 | 177 |
/*
This file is part of MADNESS.
Copyright (C) 2007,2010 Oak Ridge National Laboratory
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 please contact:
Robert J. Harrison
Oak Ridge National Laboratory
One Bethel Valley Road
P.O. Box 2008, MS-6367
email: harrisonrj@ornl.gov
tel: 865-241-3937
fax: 865-572-0680
$Id$
*/
/// \file nick/hello.cc
/// We are projecting a time evolved wave function onto some bound states
#include <mra/mra.h>
#include <complex>
#include <string>
#include <fstream>
using std::ofstream;
#include <nick/wavef.h>
using namespace madness;
const int nIOProcessors =1;
const std::string prefix = "data";
typedef std::complex<double> complexd;
typedef Function<complexd,NDIM> complex_functionT;
const char* wave_function_filename(int step);
bool wave_function_exists(World& world, int step);
void wave_function_store(World& world, int step, const complex_functionT& psi);
complex_functionT wave_function_load(World& world, int step);
const char* wave_function_filename(int step) {
static char fname[1024];
sprintf(fname, "%s-%5.5d", prefix.c_str(), step);
return fname;
}
bool wave_function_exists(World& world, int step) {
return archive::ParallelInputArchive::exists(world, wave_function_filename(step));
}
void wave_function_store(World& world, int step, const complex_functionT& psi) {
archive::ParallelOutputArchive ar(world, wave_function_filename(step), nIOProcessors);
ar & psi;
}
complex_functionT wave_function_load(World& world, int step) {
complex_functionT psi;
archive::ParallelInputArchive ar(world, wave_function_filename(step));
ar & psi;
return psi;
}
void doWork(World& world) {
PRINTLINE("Creating three basis functions");
Function<complexd,NDIM> psi100 = FunctionFactory<complexd,NDIM>(world).
functor(functorT( new BoundWF(1.0, 1,0,0)));
Function<complexd,NDIM> psi200 = FunctionFactory<complexd,NDIM>(world).
functor(functorT( new BoundWF(1.0, 2,0,0)));
Function<complexd,NDIM> psi210 = FunctionFactory<complexd,NDIM>(world).
functor(functorT( new BoundWF(1.0, 2,1,0)));
int step = 0;
PRINTLINE("Testing our capacity to load a wave function from disk");
if(wave_function_exists(world,step)) {
PRINTLINE("wave_function_exists = true");
Function<complexd, NDIM> loadedFunc = wave_function_load(world, step);
PRINT("<data|100> = ") << loadedFunc.inner(psi100) << endl;
PRINT("<data|200> = ") << loadedFunc.inner(psi200) << endl;
PRINT("<data|210> = ") << loadedFunc.inner(psi210) << endl;
} else PRINTLINE("LoadedFunc doesn't exist");
}
int main(int argc, char**argv) {
// Initialize the parallel programming environment
MPI::Init(argc, argv);
World world(MPI::COMM_WORLD);
// Load info for MADNESS numerical routines
startup(world,argc,argv);
// Setup defaults for numerical functions
FunctionDefaults<NDIM>::set_k(8); // Wavelet order
FunctionDefaults<NDIM>::set_thresh(1e-3); // Accuracy
FunctionDefaults<NDIM>::set_cubic_cell(-20.0, 20.0);
try {
doWork(world);
} catch (const MPI::Exception& e) {
//print(e);
error("caught an MPI exception");
} catch (const madness::MadnessException& e) {
print(e);
error("caught a MADNESS exception");
} catch (const madness::TensorException& e) {
print(e);
error("caught a Tensor exception");
} catch (const char* s) {
print(s);
error("caught a c-string exception");
} catch (char* s) {
print(s);
error("caught a c-string exception");
} catch (const std::string& s) {
print(s);
error("caught a string (class) exception");
} catch (const std::exception& e) {
print(e.what());
error("caught an STL exception");
} catch (...) {
error("caught unhandled exception");
}
MPI::Finalize(); //FLAG
return 0;
}
| spring01/libPSI | madness/src/apps/nick/hello.cc | C++ | gpl-2.0 | 4,494 |
/*
* This file is part of Dune Legacy.
*
* Dune Legacy 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.
*
* Dune Legacy 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 Dune Legacy. If not, see <http://www.gnu.org/licenses/>.
*/
#include <FileClasses/IndexedTextFile.h>
#include <SDL_endian.h>
#include <string>
#include <algorithm>
#include <stdexcept>
IndexedTextFile::IndexedTextFile(SDL_RWops* RWop) {
int IndexedTextFilesize;
unsigned char* Filedata;
Uint16* Index;
if(RWop == NULL) {
throw std::invalid_argument("IndexedTextFile:IndexedTextFile(): RWop == NULL!");
}
IndexedTextFilesize = SDL_RWseek(RWop,0,SEEK_END);
if(IndexedTextFilesize <= 0) {
throw std::runtime_error("IndexedTextFile:IndexedTextFile(): Cannot determine size of this file!");
}
if(IndexedTextFilesize < 2) {
throw std::runtime_error("IndexedTextFile:IndexedTextFile(): No valid indexed textfile: File too small!");
}
if(SDL_RWseek(RWop,0,SEEK_SET) != 0) {
throw std::runtime_error("IndexedTextFile:IndexedTextFile(): Seeking in this indexed textfile failed!");
}
if( (Filedata = (unsigned char*) malloc(IndexedTextFilesize)) == NULL) {
throw std::bad_alloc();
}
if(SDL_RWread(RWop, Filedata, IndexedTextFilesize, 1) != 1) {
free(Filedata);
throw std::runtime_error("IndexedTextFile:IndexedTextFile(): Reading this indexed textfile failed!");
}
numIndexedStrings = (SDL_SwapLE16(((Uint16*) Filedata)[0]))/2 - 1;
Index = (Uint16*) Filedata;
for(unsigned int i=0; i <= numIndexedStrings; i++) {
Index[i] = SDL_SwapLE16(Index[i]);
}
IndexedStrings = new std::string[numIndexedStrings];
for(unsigned int i=0; i < numIndexedStrings;i++) {
IndexedStrings[i] = (const char*) (Filedata+Index[i]);
// Now convert DOS ASCII to ANSI ASCII
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x0D','\x0A'); // '\r' -> '\n'
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x84','\xE4'); // german umlaut "ae"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x94','\xF6'); // german umlaut "oe"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x81','\xFC'); // german umlaut "ue"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x8E','\xC4'); // german umlaut "AE"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x99','\xD6'); // german umlaut "OE"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\x9A','\xDC'); // german umlaut "UE"
replace(IndexedStrings[i].begin(),IndexedStrings[i].end(), '\xE1','\xDF'); // german umlaut "ss"
}
free(Filedata);
}
IndexedTextFile::~IndexedTextFile() {
delete [] IndexedStrings;
}
| thebohemian/dunelegacy-richiesbranch | src/FileClasses/IndexedTextFile.cpp | C++ | gpl-2.0 | 3,196 |
// Copyright (C) 2005 - 2007 Steve Taylor.
// Distributed under the Toot Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.toot.org.uk/LICENSE_1_0.txt)
package uk.org.toot.midi.misc;
import uk.org.toot.music.tonality.Pitch;
/** Support for General MIDI Instrument Family and Family names. */
public class GM
{
// GM Level 2
public final static int HIGH_Q = 27;
public final static int SLAP = 28;
public final static int SCRATCH = 29;
public final static int SCRATCH_2 = 30;
public final static int STICKS = 31;
public final static int SQUARE = 32;
public final static int METRONOME = 33;
public final static int METRONOME_2 = 34;
// GM Level 1
public final static int ACOUSTIC_BASS_DRUM = 35;
public final static int BASS_DRUM_1 = 36;
public final static int SIDE_STICK = 37;
public final static int ACOUSTIC_SNARE = 38;
public final static int HAND_CLAP = 39;
public final static int ELECTRIC_SNARE = 40;
public final static int LOW_FLOOR_TOM = 41;
public final static int CLOSED_HI_HAT = 42;
public final static int HI_FLOOR_TOM = 43;
public final static int PEDAL_HI_HAT = 44;
public final static int LOW_TOM = 45;
public final static int OPEN_HI_HAT = 46;
public final static int LOW_MID_TOM = 47;
public final static int HI_MID_TOM = 48;
public final static int CRASH_CYMBAL_1 = 49;
public final static int HI_TOM = 50;
public final static int RIDE_CYMBAL_1 = 51;
public final static int CHINESE_CYMBAL = 52;
public final static int RIDE_BELL = 53;
public final static int TAMBOURINE = 54;
public final static int SPLASH_CYMBAL = 55;
public final static int COWBELL = 56;
public final static int CRASH_CYMBAL_2 = 57;
public final static int VIBRASLAP = 58;
public final static int RIDE_CYMBAL_2 = 59;
public final static int HI_BONGO = 60;
public final static int LOW_BONGO = 61;
public final static int MUTE_HI_CONGA = 62;
public final static int OPEN_HI_CONGA = 63;
public final static int LOW_CONGA = 64;
public final static int HI_TIMBALE = 65;
public final static int LOW_TIMBALE = 66;
public final static int HI_AGOGO = 67;
public final static int LOW_AGOGO = 68;
public final static int CABASA = 69;
public final static int MARACAS = 70;
public final static int SHORT_WHISTLE = 71;
public final static int LONG_WHISTLE = 72;
public final static int SHORT_GUIRO = 73;
public final static int LONG_GUIRO = 74;
public final static int CLAVES = 75;
public final static int HI_WOOD_BLOCK = 76;
public final static int LOW_WOOD_BLOCK = 77;
public final static int MUTE_CUICA = 78;
public final static int OPEN_CUICA = 79;
public final static int MUTE_TRIANGLE = 80;
public final static int OPEN_TRIANGLE = 81;
// GM Level 2
public final static int SHAKER = 82;
public final static int JINGLE_BELL = 83;
public final static int BELL_TREE = 84;
public final static int CASTANETS = 85;
public final static int MUTE_SURDO = 86;
public final static int OPEN_SURDO = 87;
static public String melodicFamilyName(int family) {
switch (family) {
case 0:
return "Piano";
case 1:
return "Chromatic Percussion";
case 2:
return "Organ";
case 3:
return "Guitar";
case 4:
return "Bass";
case 5:
return "Solo Strings";
case 6:
return "Ensemble";
case 7:
return "Brass";
case 8:
return "Reed";
case 9:
return "Pipe";
case 10:
return "Synth Lead";
case 11:
return "Synth Pad";
case 12:
return "Synth Effects";
case 13:
return "Ethnic";
case 14:
return "Percussive";
case 15:
return "Sound Effects";
}
return family + "?";
}
static public String melodicProgramName(int program) {
switch (program) {
case 0:
return "Acoustic Grand Piano";
case 1:
return "Bright Acoustic Piano";
case 2:
return "Electric Grand Piano";
case 3:
return "Honky-tonk Piano";
case 4:
return "Rhodes Piano";
case 5:
return "Chorused Piano";
case 6:
return "Harpsichord";
case 7:
return "Clavinet";
case 8:
return "Celesta";
case 9:
return "Glockenspiel";
case 10:
return "Music Box";
case 11:
return "Vibraphone";
case 12:
return "Marimba";
case 13:
return "Xylophone";
case 14:
return "Tubular Bells";
case 15:
return "Dulcimer";
case 16:
return "Hammond Organ";
case 17:
return "Percussive Organ";
case 18:
return "Rock Organ";
case 19:
return "Church Organ";
case 20:
return "Reed Organ";
case 21:
return "Accordion";
case 22:
return "Harmonica";
case 23:
return "Tango Accordion";
case 24:
return "Acoustic Guitar (nylon)";
case 25:
return "Acoustic Guitar (steel)";
case 26:
return "Electric Guitar (jazz)";
case 27:
return "Electric Guitar (clean)";
case 28:
return "Electric Guitar (muted)";
case 29:
return "Overdriven Guitar";
case 30:
return "Distortion Guitar";
case 31:
return "Guitar Harmonics";
case 32:
return "Acoustic Bass";
case 33:
return "Electric Bass (finger)";
case 34:
return "Electric Bass (pick)";
case 35:
return "Fretless Bass";
case 36:
return "Slap Bass 1";
case 37:
return "Slap Bass 2";
case 38:
return "Synth Bass 1";
case 39:
return "Synth Bass 2";
case 40:
return "Violin";
case 41:
return "Viola";
case 42:
return "Cello";
case 43:
return "Contrabass";
case 44:
return "Tremelo Strings";
case 45:
return "Pizzicato Strings";
case 46:
return "Orchestral Harp";
case 47:
return "Timpani";
case 48:
return "String Ensemble 1";
case 49:
return "String Ensemble 2";
case 50:
return "SynthStrings 1";
case 51:
return "SynthStrings 2";
case 52:
return "Choir Aahs";
case 53:
return "Voice Oohs";
case 54:
return "Synth Voice";
case 55:
return "Orchestra Hit";
case 56:
return "Trumpet";
case 57:
return "Trombone";
case 58:
return "Tuba";
case 59:
return "Muted Trumpet";
case 60:
return "French Horn";
case 61:
return "Brass Section";
case 62:
return "Synth Brass 1";
case 63:
return "Synth Brass 2";
case 64:
return "Soprano Sax";
case 65:
return "Alto Sax";
case 66:
return "Tenor Sax";
case 67:
return "Baritone Sax";
case 68:
return "Oboe";
case 69:
return "English Horn";
case 70:
return "Bassoon";
case 71:
return "Clarinet";
case 72:
return "Piccolo";
case 73:
return "Flute";
case 74:
return "Recorder";
case 75:
return "Pan Flute";
case 76:
return "Bottle Blow";
case 77:
return "Shakuhachi";
case 78:
return "Whistle";
case 79:
return "Ocarina";
case 80:
return "Lead 1 (square)";
case 81:
return "Lead 2 (sawtooth)";
case 82:
return "Lead 3 (calliope lead)";
case 83:
return "Lead 4 (chiff lead)";
case 84:
return "Lead 5 (charang)";
case 85:
return "Lead 6 (voice)";
case 86:
return "Lead 7 (fifths)";
case 87:
return "Lead 8 (bass + lead)";
case 88:
return "Pad 1 (new age)";
case 89:
return "Pad 2 (warm)";
case 90:
return "Pad 3 (polysynth)";
case 91:
return "Pad 4 (choir)";
case 92:
return "Pad 5 (bowed)";
case 93:
return "Pad 6 (metallic)";
case 94:
return "Pad 7 (halo)";
case 95:
return "Pad 8 (sweep)";
case 96:
return "FX 1 (rain)";
case 97:
return "FX 2 (soundtrack)";
case 98:
return "FX 3 (crystal)";
case 99:
return "FX 4 (atmosphere)";
case 100:
return "FX 5 (brightness)";
case 101:
return "FX 6 (goblins)";
case 102:
return "FX 7 (echoes)";
case 103:
return "FX 8 (sci-fi)";
case 104:
return "Sitar";
case 105:
return "Banjo";
case 106:
return "Shamisen";
case 107:
return "Koto";
case 108:
return "Kalimba";
case 109:
return "Bagpipe";
case 110:
return "Fiddle";
case 111:
return "Shanai";
case 112:
return "Tinkle Bell";
case 113:
return "Agogo";
case 114:
return "Steel Drums";
case 115:
return "Woodblock";
case 116:
return "Taiko Drum";
case 117:
return "Melodic Tom";
case 118:
return "Synth Drum";
case 119:
return "Reverse Cymbal";
case 120:
return "Guitar Fret Noise";
case 121:
return "Breath Noise";
case 122:
return "Seashore";
case 123:
return "Bird Tweet";
case 124:
return "Telephone Ring";
case 125:
return "Helicopter";
case 126:
return "Applause";
case 127:
return "Gunshot";
}
return program + "?";
}
// hats
public final static int[] HATS = {
OPEN_HI_HAT, CLOSED_HI_HAT, PEDAL_HI_HAT
};
// bass drums
public final static int[] BASS_DRUMS = {
ACOUSTIC_BASS_DRUM, BASS_DRUM_1
};
// snares
public final static int[] SNARES = {
ACOUSTIC_SNARE, ELECTRIC_SNARE, SIDE_STICK, HAND_CLAP
};
// toms
public final static int[] TOMS = {
HI_TOM, HI_MID_TOM, LOW_MID_TOM, LOW_TOM, HI_FLOOR_TOM, LOW_FLOOR_TOM
};
// cymbals
public final static int[] CYMBALS = {
RIDE_BELL, RIDE_CYMBAL_1, RIDE_CYMBAL_2, CRASH_CYMBAL_1,
CRASH_CYMBAL_2, CHINESE_CYMBAL, SPLASH_CYMBAL
};
// perc single
public final static int[] PERCS = {
TAMBOURINE, COWBELL, VIBRASLAP, CABASA, MARACAS, CLAVES
};
// perc multi
public final static int[] MULTI_PERCS = {
HI_BONGO, LOW_BONGO,
MUTE_HI_CONGA, OPEN_HI_CONGA, LOW_CONGA,
HI_TIMBALE, LOW_TIMBALE,
HI_AGOGO, LOW_AGOGO,
SHORT_WHISTLE, LONG_WHISTLE,
SHORT_GUIRO, LONG_GUIRO,
HI_WOOD_BLOCK, LOW_WOOD_BLOCK,
MUTE_CUICA, OPEN_CUICA,
MUTE_TRIANGLE, OPEN_TRIANGLE
};
static public int drumFamilyCount() { return 7; }
static public String drumFamilyName(int f) {
switch ( f ) {
case 0: return "Cymbals";
case 1: return "Hi Hats";
case 2: return "Snares";
case 3: return "Toms";
case 4: return "Bass Drums";
case 5: return "Percussion";
case 6: return "Multi Percussion";
default: return "?";
}
}
static public int[] drumFamily(int f) {
switch ( f ) {
case 0: return CYMBALS;
case 1: return HATS;
case 2: return SNARES;
case 3: return TOMS;
case 4: return BASS_DRUMS;
case 5: return PERCS;
case 6: return MULTI_PERCS;
default: return null;
}
}
static public String drumProgramName(int program) {
switch (program) {
case 0: return "Standard Kit";
case 1: return "Standard Kit 1";
case 2: return "Standard Kit 2";
case 3: return "Standard Kit 3";
case 4: return "Standard Kit 4";
case 5: return "Standard Kit 5";
case 6: return "Standard Kit 6";
case 7: return "Standard Kit 7";
case 8: return "Room Kit";
case 9: return "Room Kit 1";
case 10: return "Room Kit 2";
case 11: return "Room Kit 3";
case 12: return "Room Kit 4";
case 13: return "Room Kit 5";
case 14: return "Room Kit 6";
case 15: return "Room Kit 7";
case 16: return "Power Kit";
case 17: return "Power Kit 1";
case 18: return "Power Kit 2";
case 24: return "Electronic Kit";
case 25: return "TR-808 Kit";
case 32: return "Jazz Kit";
case 33: return "Jazz Kit 1";
case 34: return "Jazz Kit 2";
case 35: return "Jazz Kit 3";
case 36: return "Jazz Kit 4";
case 40: return "Brush Kit";
case 41: return "Brush Kit 1";
case 42: return "Brush Kit 2";
case 48: return "Orchestra Kit";
case 56: return "Sound FX Kit";
case 127: return "CM-64/CM-32L Kit";
}
return String.valueOf(program);
}
static public String drumName(int drum) {
if (drum < HIGH_Q || drum > OPEN_SURDO) {
return Pitch.name(drum);
}
switch (drum) {
// Level 2
case HIGH_Q:
return "High Q";
case SLAP:
return "Slap";
case SCRATCH:
return "Scratch";
case SCRATCH_2:
return "Scratch 2";
case STICKS:
return "Sticks";
case SQUARE:
return "Square";
case METRONOME:
return "Metronome";
case METRONOME_2:
return "Metronome 2";
// Level 1
case ACOUSTIC_BASS_DRUM:
return "Acoustic Bass Drum";
case BASS_DRUM_1:
return "Bass Drum 1";
case SIDE_STICK:
return "Side Stick";
case ACOUSTIC_SNARE:
return "Acoustic Snare";
case HAND_CLAP:
return "Hand Clap";
case ELECTRIC_SNARE:
return "Electric Snare";
case LOW_FLOOR_TOM:
return "Low Floor Tom";
case CLOSED_HI_HAT:
return "Closed Hi-Hat";
case HI_FLOOR_TOM:
return "High Floor Tom";
case PEDAL_HI_HAT:
return "Pedal Hi-Hat";
case LOW_TOM:
return "Low Tom";
case OPEN_HI_HAT:
return "Open Hi-Hat";
case LOW_MID_TOM:
return "Low-Mid Tom";
case HI_MID_TOM:
return "Hi-Mid Tom";
case CRASH_CYMBAL_1:
return "Crash Cymbal 1";
case HI_TOM:
return "High Tom";
case RIDE_CYMBAL_1:
return "Ride Cymbal 1";
case CHINESE_CYMBAL:
return "Chinese Cymbal";
case RIDE_BELL:
return "Ride Bell";
case TAMBOURINE:
return "Tambourine";
case SPLASH_CYMBAL:
return "Splash Cymbal";
case COWBELL:
return "Cowbell";
case CRASH_CYMBAL_2:
return "Crash Cymbal 2";
case VIBRASLAP:
return "Vibraslap";
case RIDE_CYMBAL_2:
return "Ride Cymbal 2";
case HI_BONGO:
return "Hi Bongo";
case LOW_BONGO:
return "Low Bongo";
case MUTE_HI_CONGA:
return "Mute Hi Conga";
case OPEN_HI_CONGA:
return "Open Hi Conga";
case LOW_CONGA:
return "Low Conga";
case HI_TIMBALE:
return "High Timbale";
case LOW_TIMBALE:
return "Low Timbale";
case HI_AGOGO:
return "High Agogo";
case LOW_AGOGO:
return "Low Agogo";
case CABASA:
return "Cabasa";
case MARACAS:
return "Maracas";
case SHORT_WHISTLE:
return "Short Whistle";
case LONG_WHISTLE:
return "Long Whistle";
case SHORT_GUIRO:
return "Short Guiro";
case LONG_GUIRO:
return "Long Guiro";
case CLAVES:
return "Claves";
case HI_WOOD_BLOCK:
return "Hi Wood Block";
case LOW_WOOD_BLOCK:
return "Low Wood Block";
case MUTE_CUICA:
return "Mute Cuica";
case OPEN_CUICA:
return "Open Cuica";
case MUTE_TRIANGLE:
return "Mute Triangle";
case OPEN_TRIANGLE:
return "Open Triangle";
// Level 2
case SHAKER:
return "Shaker";
case JINGLE_BELL:
return "Jingle Bell";
case BELL_TREE:
return "Bell Tree";
case CASTANETS:
return "Castanets";
case MUTE_SURDO:
return "Mute Surdo";
case OPEN_SURDO:
return "Open Surdo";
}
return drum + "?";
}
}
| petersalomonsen/frinika | src/uk/org/toot/midi/misc/GM.java | Java | gpl-2.0 | 20,219 |
<?php
function digest_event($event, $start, $end) {
$tz1 = new DateTimeZone('UTC');
$tz2 = new DateTimeZone('Europe/London');
# Get a string representation of the date in UK time.
$datetime = new DateTime($start, $tz1);
$datetime->setTimezone($tz2);
$start = $datetime->format('D, jS F g:ia');
$datetime = new DateTime($end, $tz1);
$datetime->setTimezone($tz2);
$end = $datetime->format('D, jS F g:ia');
$html = '<table><tbody>';
$html .= "<tr><td><b>$start</b></td><td> </td><td><b><span style=\"color: green\">" . htmlspecialchars($event['title']) . "</span></b></td><td align=right><span style=\"color: green\">" . htmlspecialchars($event['location']) . "</font></td></tr>";
$html .= "<tr><td width=20%>to<b> $end</b><td colspan=2></td></tr>";
$html .= "<tr><td colspan=4> </td></tr>";
$html .= "<tr><td><em>Contact details:</em><br />";
if (pres('contactname', $event)) { $html .= ' ' . htmlspecialchars($event['contactname']) . "<br>"; }
if (pres('contactphone', $event)) { $html .= ' ' . htmlspecialchars($event['contactphone']) . "<br>"; }
if (pres('contactemail', $event)) { $html .= ' ' . '<a href="mailto:' . $event['contactemail'] . '">' . htmlspecialchars($event['contactemail']) . "</a><br>"; }
if (pres('contacturl', $event)) { $html .= ' ' . '<a href="' . $event['contacturl'] . '">' . htmlspecialchars($event['contacturl']) . "</a><br>"; }
$text = htmlentities($event['description']);
$text = nl2br($text);
$html .= "</td><td> </td><td colspan=2>$text</td></tr>";
$html .= '<tr><td colspan=4> </td></tr>';
if (pres('url', $event))
{
$html .= '<tr><td colspan=4>For more details see <a href="' . $event['url'] . '">' . $event['url'] . '</a>.</td></tr>';
}
$html .= '<tr><td colspan=4><span style="color: green"><hr></span></td></tr>';
$html .= '</tbody></table>';
return($html);
} | nicksellen/iznik | mailtemplates/digest/event.php | PHP | gpl-2.0 | 1,995 |
// closure to avoid namespace collision
(function(){
//-------
var html_form = '<div id="text_box-form">\
<p class="popup_submit_wrap"><span class="wpp_helper_box"><a onclick="open_win(\'http://www.youtube.com/watch?v=Y_7snOfYato&list=PLI8Gq0WzVWvJ60avoe8rMyfoV5qZr3Atm&index=10\')">Видео урок</a></span><input type="button" id="text_box_submit" class="button-primary" value="Вставить" name="submit" /></p>\
<div class="ps_text_box_form coach_box">\
<div>\
<label class="ps_text_box wppage_checkbox ps_text_box_1"><input type="radio" name="text_box_style" value="1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_1_1"><input type="radio" name="text_box_style" value="1_1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_2"><input type="radio" name="text_box_style" value="2" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_2_1"><input type="radio" name="text_box_style" value="2_1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_3"><input type="radio" name="text_box_style" value="3" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_3_1"><input type="radio" name="text_box_style" value="3_1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_4"><input type="radio" name="text_box_style" value="4" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_4_1"><input type="radio" name="text_box_style" value="4_1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_5"><input type="radio" name="text_box_style" value="5" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_5_1"><input type="radio" name="text_box_style" value="5_1" /></label>\
<label class="ps_text_box wppage_checkbox ps_text_box_6"><input type="radio" name="text_box_style" value="6" /></label>\
</div>\
</div></div>';
//-------
// creates the plugin
tinymce.create('tinymce.plugins.textbox', {
// creates control instances based on the control's id.
// our button's id is "smartresponder_button"
createControl : function(id, controlManager) {
if (id == 'text_box_button') {
// creates the button
var button = controlManager.createButton('text_box_button', {
title : 'Боксы', // title of the button
image : plugin_url+'/wppage/i/box.png', // path to the button's image
onclick : function() {
// triggers the thickbox
tb_show( 'Боксы', '#TB_inline?inlineId=text_box-form' );
jQuery('#TB_ajaxContent').css({'width': '640', 'height': (jQuery('#TB_window').height()-50)+'px'});
jQuery(window).resize(function(){
jQuery('#TB_ajaxContent').css({'width': '640', 'height': (jQuery('#TB_window').height()-50)+'px'});
});
}
});
return button;
}
return null;
}
});
// registers the plugin. DON'T MISS THIS STEP!!!
tinymce.PluginManager.add('textbox', tinymce.plugins.textbox);
// executes this when the DOM is ready
jQuery(function(){
// creates a form to be displayed everytime the button is clicked
// you should achieve this using AJAX instead of direct html code like this
var form = jQuery(html_form);
form.appendTo('body').hide();
// handles the click event of the submit button
form.find('#text_box_submit').click(function(){
// defines the options and their default values
// again, this is not the most elegant way to do this
// but well, this gets the job done nonetheless
var options = {
'id' : ''
};
var text_box_style = jQuery('input[name=text_box_style]:checked').val();
var shortcode = '<p class="aligncenter"><div class="ps_text_box ps_text_box_'+text_box_style+'"><p class="ps_text_box_text">Текст</p></div></p><p> </p>';
// inserts the shortcode into the active editor
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
// closes Thickbox
tb_remove();
});
});
})()
| SergL/aboutttango | wp-content/plugins/wppage/js/box.js | JavaScript | gpl-2.0 | 4,002 |
/*****************************************************************************
* Web3d.org Copyright (c) 2001
* Java Source
*
* This source is licensed under the GNU LGPL v2.1
* Please read http://www.gnu.org/copyleft/lgpl.html for more information
*
* This software comes with the standard NO WARRANTY disclaimer for any
* purpose. Use it at your own risk. If there's a problem you get to fix it.
*
****************************************************************************/
package org.web3d.vrml.renderer.common.nodes.surface;
// Standard imports
import java.awt.Rectangle;
import java.util.HashMap;
// Application specific imports
import org.web3d.vrml.lang.*;
import org.web3d.vrml.nodes.*;
/**
* Common implementation of a Image2D node.
* <p>
*
* @author Justin Couch
* @version $Revision: 1.12 $
*/
public abstract class BaseImage2D extends BaseSurfaceChildNode
implements VRMLSurfaceChildNodeType {
/** Secondary type constant */
private static final int[] SECONDARY_TYPE =
{ TypeConstants.SensorNodeType, TypeConstants.TimeDependentNodeType };
// Field index constants
/** The field index for fixedSize. */
protected static final int FIELD_FIXED_SIZE = LAST_SURFACE_CHILD_INDEX + 1;
/** The field index for texture. */
protected static final int FIELD_TEXTURE = LAST_SURFACE_CHILD_INDEX + 2;
/** The field index for isActive. */
protected static final int FIELD_ISACTIVE = LAST_SURFACE_CHILD_INDEX + 3;
/** The field index for enabled. */
protected static final int FIELD_ENABLED = LAST_SURFACE_CHILD_INDEX + 4;
/** The field index for isOvery. */
protected static final int FIELD_ISOVER = LAST_SURFACE_CHILD_INDEX + 5;
/** The field index for touchTime. */
protected static final int FIELD_TOUCHTIME = LAST_SURFACE_CHILD_INDEX + 6;
/** The field index for trackPoint_changed. */
protected static final int FIELD_TRACKPOINT_CHANGED =
LAST_SURFACE_CHILD_INDEX + 7;
/** The field index for windowRelative. */
protected static final int FIELD_WINDOW_RELATIVE =
LAST_SURFACE_CHILD_INDEX + 8;
/** The last field index used by this class */
protected static final int LAST_IMAGE2D_INDEX = FIELD_WINDOW_RELATIVE;
/** Number of fields constant */
protected static final int NUM_FIELDS = LAST_IMAGE2D_INDEX + 1;
/** Message for when the proto is not a Appearance */
protected static final String TEXTURE_PROTO_MSG =
"Proto does not describe a Texture2D object";
/** Message for when the node in setValue() is not a Appearance */
protected static final String TEXTURE_NODE_MSG =
"Node does not describe a Texture2D object";
/** Array of VRMLFieldDeclarations */
private static VRMLFieldDeclaration[] fieldDecl;
/** Hashmap between a field name and its index */
private static HashMap fieldMap;
/** Listing of field indexes that have nodes */
private static int[] nodeFields;
// The VRML field values
/** The value of the fixedSize field. */
protected boolean vfFixedSize;
/** The value of the texture exposedField. */
protected VRMLTexture2DNodeType vfTexture;
/** Proto version of the texture */
protected VRMLProtoInstance pTexture;
/** The value of the isActive eventOut */
protected boolean vfIsActive;
/** The value of the windowRelative field */
protected boolean vfWindowRelative;
/** The value of the enabled exposedField */
protected boolean vfEnabled;
/** The value of the isOver eventOut */
protected boolean vfIsOver;
/** The value of the touchTime eventOut */
protected double vfTouchTime;
/** The value of th trackPoint_changed eventOut */
protected float[] vfTrackPoint;
/**
* Static constructor to build the field representations of this node
* once for all users.
*/
static {
nodeFields = new int[] { FIELD_TEXTURE, FIELD_METADATA };
fieldDecl = new VRMLFieldDeclaration[NUM_FIELDS];
fieldMap = new HashMap(NUM_FIELDS * 3);
fieldDecl[FIELD_METADATA] =
new VRMLFieldDeclaration(FieldConstants.EXPOSEDFIELD,
"SFNode",
"metadata");
fieldDecl[FIELD_VISIBLE] =
new VRMLFieldDeclaration(FieldConstants.EXPOSEDFIELD,
"SFBool",
"visible");
fieldDecl[FIELD_BBOX_SIZE] =
new VRMLFieldDeclaration(FieldConstants.FIELD,
"SFVec2f",
"bboxSize");
fieldDecl[FIELD_FIXED_SIZE] =
new VRMLFieldDeclaration(FieldConstants.FIELD,
"SFBool",
"fixedSize");
fieldDecl[FIELD_WINDOW_RELATIVE] =
new VRMLFieldDeclaration(FieldConstants.FIELD,
"SFBool",
"windowRelative");
fieldDecl[FIELD_TEXTURE] =
new VRMLFieldDeclaration(FieldConstants.EXPOSEDFIELD,
"SFNode",
"texture");
fieldDecl[FIELD_ENABLED] =
new VRMLFieldDeclaration(FieldConstants.EXPOSEDFIELD,
"SFBool",
"enabled");
fieldDecl[FIELD_ISACTIVE] =
new VRMLFieldDeclaration(FieldConstants.EVENTOUT,
"SFBool",
"isActive");
fieldDecl[FIELD_ISOVER] =
new VRMLFieldDeclaration(FieldConstants.EVENTOUT,
"SFBool",
"isOver");
fieldDecl[FIELD_TOUCHTIME] =
new VRMLFieldDeclaration(FieldConstants.EVENTOUT,
"SFTime",
"touchTime");
fieldDecl[FIELD_TRACKPOINT_CHANGED] =
new VRMLFieldDeclaration(FieldConstants.EVENTOUT,
"SFVec2f",
"trackPoint_changed");
Integer idx = new Integer(FIELD_METADATA);
fieldMap.put("metadata", idx);
fieldMap.put("set_metadata", idx);
fieldMap.put("metadata_changed", idx);
idx = new Integer(FIELD_VISIBLE);
fieldMap.put("visible", idx);
fieldMap.put("set_visible", idx);
fieldMap.put("visible_changed", idx);
idx = new Integer(FIELD_TEXTURE);
fieldMap.put("texture", idx);
fieldMap.put("set_texture", idx);
fieldMap.put("texture_changed", idx);
idx = new Integer(FIELD_ENABLED);
fieldMap.put("enabled", idx);
fieldMap.put("set_enabled", idx);
fieldMap.put("enabled_changed", idx);
fieldMap.put("bboxSize", new Integer(FIELD_BBOX_SIZE));
fieldMap.put("fixedSize", new Integer(FIELD_FIXED_SIZE));
fieldMap.put("windowRelative", new Integer(FIELD_WINDOW_RELATIVE));
fieldMap.put("isActive", new Integer(FIELD_ISACTIVE));
fieldMap.put("isOver", new Integer(FIELD_ISOVER));
fieldMap.put("touchTime", new Integer(FIELD_TOUCHTIME));
fieldMap.put("trackPoint_changed",
new Integer(FIELD_TRACKPOINT_CHANGED));
}
/**
* Construct a new default Overlay object
*/
protected BaseImage2D() {
super("Image2D");
hasChanged = new boolean[NUM_FIELDS];
// Set the default values for the fields
vfFixedSize = true;
vfIsActive = false;
vfEnabled = true;
vfIsOver = false;
vfTouchTime = 0;
vfWindowRelative = false;
vfTrackPoint = new float[2];
}
/**
* Construct a new instance of this node based on the details from the
* given node. If the node is not the same type, an exception will be
* thrown.
*
* @param node The node to copy
* @throws IllegalArgumentException The node is not the same type
*/
protected BaseImage2D(VRMLNodeType node) {
this();
checkNodeType(node);
copy((VRMLSurfaceChildNodeType)node);
try {
int index = node.getFieldIndex("fixedSize");
VRMLFieldData data = node.getFieldValue(index);
vfFixedSize = data.booleanValue;
index = node.getFieldIndex("enabled");
data = node.getFieldValue(index);
vfEnabled = data.booleanValue;
index = node.getFieldIndex("windowRelative");
data = node.getFieldValue(index);
vfWindowRelative = data.booleanValue;
} catch(VRMLException ve) {
throw new IllegalArgumentException(ve.getMessage());
}
}
//----------------------------------------------------------
// Methods required by the VRMLSensorNodeType interface.
//----------------------------------------------------------
/**
* Accessor method to set a new value for the enabled field
*
* @param state The new enabled state
*/
public void setEnabled(boolean state) {
if(state != vfEnabled) {
vfEnabled = state;
hasChanged[FIELD_ENABLED] = true;
fireFieldChanged(FIELD_ENABLED);
}
}
/**
* Accessor method to get current value of the enabled field.
* The default value is <code>true</code>.
*
* @return The value of the enabled field
*/
public boolean getEnabled() {
return vfEnabled;
}
/**
* Accessor method to get current value of the isActive field.
*
* @return The current value of isActive
*/
public boolean getIsActive () {
return vfIsActive;
}
//----------------------------------------------------------
// Methods required by the VRMLNodeType interface.
//----------------------------------------------------------
/**
* Get the index of the given field name. If the name does not exist for
* this node then return a value of -1.
*
* @param fieldName The name of the field we want the index from
* @return The index of the field name or -1
*/
public int getFieldIndex(String fieldName) {
Integer index = (Integer)fieldMap.get(fieldName);
return (index == null) ? -1 : index.intValue();
}
/**
* Get the list of indices that correspond to fields that contain nodes
* ie MFNode and SFNode). Used for blind scene graph traversal without
* needing to spend time querying for all fields etc. If a node does
* not have any fields that contain nodes, this shall return null. The
* field list covers all field types, regardless of whether they are
* readable or not at the VRML-level.
*
* @return The list of field indices that correspond to SF/MFnode fields
* or null if none
*/
public int[] getNodeFieldIndices() {
return nodeFields;
}
/**
* Notification that the construction phase of this node has finished.
* If the node would like to do any internal processing, such as setting
* up geometry, then go for it now.
*/
public void setupFinished() {
if(!inSetup)
return;
super.setupFinished();
if (pTexture != null)
pTexture.setupFinished();
if (vfTexture != null)
vfTexture.setupFinished();
}
/**
* Get the declaration of the field at the given index. This allows for
* reverse lookup if needed. If the field does not exist, this will give
* a value of null.
*
* @param index The index of the field to get information
* @return A representation of this field's information
*/
public VRMLFieldDeclaration getFieldDeclaration(int index) {
if(index < 0 || index > LAST_IMAGE2D_INDEX)
return null;
return fieldDecl[index];
}
/**
* Get the number of fields.
*
* @param The number of fields.
*/
public int getNumFields() {
return fieldDecl.length;
}
/**
* Get the secondary type of this node. Replaces the instanceof mechanism
* for use in switch statements.
*
* @return The secondary type
*/
public int[] getSecondaryType() {
return SECONDARY_TYPE;
}
/**
* Get the value of a field. If the field is a primitive type, it will
* return a class representing the value. For arrays or nodes it will
* return the instance directly.
*
* @param index The index of the field to change.
* @return The class representing the field value
* @throws InvalidFieldException The field index is not known
*/
public VRMLFieldData getFieldValue(int index) throws InvalidFieldException {
VRMLFieldData fieldData = fieldLocalData.get();
switch(index) {
case FIELD_FIXED_SIZE:
fieldData.clear();
fieldData.booleanValue = vfFixedSize;
fieldData.dataType = VRMLFieldData.BOOLEAN_DATA;
break;
case FIELD_WINDOW_RELATIVE:
fieldData.clear();
fieldData.booleanValue = vfWindowRelative;
fieldData.dataType = VRMLFieldData.BOOLEAN_DATA;
break;
case FIELD_ENABLED:
fieldData.clear();
fieldData.booleanValue = vfEnabled;
fieldData.dataType = VRMLFieldData.BOOLEAN_DATA;
break;
case FIELD_ISACTIVE:
fieldData.clear();
fieldData.booleanValue = vfIsActive;
fieldData.dataType = VRMLFieldData.BOOLEAN_DATA;
break;
case FIELD_ISOVER:
fieldData.clear();
fieldData.booleanValue = vfIsOver;
fieldData.dataType = VRMLFieldData.BOOLEAN_DATA;
break;
case FIELD_TOUCHTIME:
fieldData.clear();
fieldData.doubleValue = vfTouchTime;
fieldData.dataType = VRMLFieldData.DOUBLE_DATA;
break;
case FIELD_TRACKPOINT_CHANGED:
fieldData.clear();
fieldData.floatArrayValue = vfTrackPoint;
fieldData.numElements = 1;
fieldData.dataType = VRMLFieldData.FLOAT_ARRAY_DATA;
break;
case FIELD_TEXTURE:
fieldData.clear();
if(pTexture == null)
fieldData.nodeValue = vfTexture;
else
fieldData.nodeValue = pTexture;
fieldData.dataType = VRMLFieldData.NODE_DATA;
break;
default:
super.getFieldValue(index);
}
return fieldData;
}
/**
* Send a routed value from this node to the given destination node. The
* route should use the appropriate setValue() method of the destination
* node. It should not attempt to cast the node up to a higher level.
* Routing should also follow the standard rules for the loop breaking and
* other appropriate rules for the specification.
*
* @param time The time that this route occurred (not necessarily epoch
* time. Should be treated as a relative value only)
* @param srcIndex The index of the field in this node that the value
* should be sent from
* @param destNode The node reference that we will be sending the value to
* @param destIndex The index of the field in the destination node that
* the value should be sent to.
*/
public void sendRoute(double time,
int srcIndex,
VRMLNodeType destNode,
int destIndex) {
// Simple impl for now. ignores time and looping
try {
switch(srcIndex) {
case FIELD_FIXED_SIZE:
destNode.setValue(destIndex, vfFixedSize);
break;
case FIELD_WINDOW_RELATIVE:
destNode.setValue(destIndex, vfWindowRelative);
break;
case FIELD_ENABLED:
destNode.setValue(destIndex, vfEnabled);
break;
case FIELD_ISACTIVE:
destNode.setValue(destIndex, vfIsActive);
break;
case FIELD_ISOVER:
destNode.setValue(destIndex, vfIsOver);
break;
case FIELD_TOUCHTIME:
destNode.setValue(destIndex, vfTouchTime);
break;
case FIELD_TRACKPOINT_CHANGED:
destNode.setValue(destIndex, vfTrackPoint, 2);
break;
default:
super.sendRoute(time, srcIndex, destNode, destIndex);
}
} catch(InvalidFieldException ife) {
System.err.println("sendRoute: No field! " + ife.getFieldName());
} catch(InvalidFieldValueException ifve) {
System.err.println("sendRoute: Invalid field value: " +
ifve.getMessage());
}
}
/**
* Set the value of the field from the raw string. This requires the
* implementation to parse the string in the given format for the field
* type. If the field type does not match the requirements for that index
* then an exception will be thrown. If the destination field is a string,
* then the leading and trailing quote characters will be stripped before
* calling this method.
*
* @param index The index of destination field to set
* @param value The raw value string to be parsed
* @throws InvalidFieldFormatException The string was not in a correct form
* for this field.
*/
public void setValue(int index, boolean value)
throws InvalidFieldFormatException, InvalidFieldValueException,
InvalidFieldException {
switch(index) {
case FIELD_FIXED_SIZE:
if(!inSetup)
throw new InvalidFieldAccessException(
"fixedSize is an initializeOnly field");
vfFixedSize = value;
break;
case FIELD_WINDOW_RELATIVE:
if(!inSetup)
throw new InvalidFieldAccessException(
"windowRelative is an initializeOnly field");
vfWindowRelative = value;
break;
case FIELD_ENABLED:
vfEnabled = value;
if(!inSetup) {
hasChanged[FIELD_ENABLED] = true;
fireFieldChanged(FIELD_ENABLED);
}
break;
default:
super.setValue(index, value);
}
}
/**
* Set the value of the field at the given index as an array of nodes.
* This would be used to set MFNode field types.
*
* @param index The index of destination field to set
* @param value The new value to use for the node
* @throws InvalidFieldException The field index is not know
*/
public void setValue(int index, VRMLNodeType child)
throws InvalidFieldException {
switch(index) {
case FIELD_TEXTURE:
setTextureNode(child);
if(!inSetup) {
hasChanged[FIELD_TEXTURE] = true;
fireFieldChanged(FIELD_TEXTURE);
}
break;
default:
super.setValue(index, child);
}
}
//----------------------------------------------------------
// Local Methods
//----------------------------------------------------------
/**
* Called to set the texture node to be used. May be overridden by the
* derived class, but must also call this version first to ensure
* everything is valid node types and the fields correctly set.
*
* @param texture The new texture node instance to use
* @throws InvalidFieldValueException The node is not the required type
*/
protected void setTextureNode(VRMLNodeType texture)
throws InvalidFieldValueException {
if(texture == null) {
vfTexture = null;
} else {
VRMLNodeType node;
if(texture instanceof VRMLProtoInstance) {
pTexture = (VRMLProtoInstance)texture;
node = pTexture.getImplementationNode();
if(!(node instanceof VRMLTexture2DNodeType)) {
throw new InvalidFieldValueException(TEXTURE_PROTO_MSG);
}
} else if(texture != null &&
(!(texture instanceof VRMLTexture2DNodeType))) {
throw new InvalidFieldValueException(TEXTURE_NODE_MSG);
} else {
pTexture = null;
node = texture;
}
vfTexture = (VRMLTexture2DNodeType)node;
}
if (!inSetup) {
hasChanged[FIELD_TEXTURE] = true;
fireFieldChanged(FIELD_TEXTURE);
}
}
/**
* Send notification that the track point has changed. The values passed
* should be in surface coordinates and this will adjust as necessary for
* the windowRelative field setting when generating the eventOut. Assumes
* standard window coordinates with X across and Y down.
*
* @param x The x position of the mouse
* @param h The y position of the mouse
*/
protected void setTrackPoint(int x, int y) {
if(!vfWindowRelative) {
vfTrackPoint[0] = x;
vfTrackPoint[1] = y;
} else {
vfTrackPoint[0] = x - screenLocation[0];
vfTrackPoint[1] = y - screenLocation[1];
}
hasChanged[FIELD_TRACKPOINT_CHANGED] = true;
fireFieldChanged(FIELD_TRACKPOINT_CHANGED);
}
}
| Norkart/NK-VirtualGlobe | Xj3D/src/java/org/web3d/vrml/renderer/common/nodes/surface/BaseImage2D.java | Java | gpl-2.0 | 22,301 |
/*
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.compiler.phases.common.inlining.info;
import org.graalvm.collections.EconomicSet;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.nodes.Invoke;
import org.graalvm.compiler.nodes.spi.CoreProviders;
import org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable;
import org.graalvm.compiler.phases.util.Providers;
import jdk.vm.ci.meta.ResolvedJavaMethod;
/**
* Represents an inlining opportunity where the compiler can statically determine a monomorphic
* target method and therefore is able to determine the called method exactly.
*/
public class ExactInlineInfo extends AbstractInlineInfo {
protected final ResolvedJavaMethod concrete;
private Inlineable inlineableElement;
private boolean suppressNullCheck;
public ExactInlineInfo(Invoke invoke, ResolvedJavaMethod concrete) {
super(invoke);
this.concrete = concrete;
assert concrete != null;
}
public void suppressNullCheck() {
suppressNullCheck = true;
}
@Override
public EconomicSet<Node> inline(CoreProviders providers, String reason) {
return inline(invoke, concrete, inlineableElement, !suppressNullCheck, reason);
}
@Override
public void tryToDevirtualizeInvoke(Providers providers) {
// nothing todo, can already be bound statically
}
@Override
public int numberOfMethods() {
return 1;
}
@Override
public ResolvedJavaMethod methodAt(int index) {
assert index == 0;
return concrete;
}
@Override
public double probabilityAt(int index) {
assert index == 0;
return 1.0;
}
@Override
public double relevanceAt(int index) {
assert index == 0;
return 1.0;
}
@Override
public String toString() {
return "exact " + concrete.format("%H.%n(%p):%r");
}
@Override
public Inlineable inlineableElementAt(int index) {
assert index == 0;
return inlineableElement;
}
@Override
public void setInlinableElement(int index, Inlineable inlineableElement) {
assert index == 0;
this.inlineableElement = inlineableElement;
}
@Override
public boolean shouldInline() {
return concrete.shouldBeInlined();
}
}
| smarr/Truffle | compiler/src/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/info/ExactInlineInfo.java | Java | gpl-2.0 | 3,520 |
package cs499.examples.semesterproject;
import javax.servlet.*;
import javax.servlet.http.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
public class AndroidFoodBankOwnerServlet extends HttpServlet
{
boolean debug = false;
private String sqlliteDbUrl;
@Override
public void init(ServletConfig config) throws ServletException
{
sqlliteDbUrl = config.getInitParameter("sqlliteDbUrl");
}
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
res.setContentType ("TEXT/HTML");
PrintWriter out = res.getWriter ();
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Food Bank Data </h1> </body>");
out.println("</html");
}
}
public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (!debug)
res.setContentType("application/json");
else if (debug)
res.setContentType ("TEXT/HTML");
PrintWriter out = res.getWriter ();
String action = req.getParameter("action");
if (debug)
out.println("doPost Action: " + action);
if (action.equals("registerfoodplace"))
registerFoodPlace(out, req, res);
else if (action.equals("enterorganization"))
{
registerOrganization(out,req,res);
}
else if (action.equals("searchplaces"))
{
searchPlaces (out,req,res);
}
else if (action.equals("authenticate"))
{
authenticateUser (out,req,res);
}
else if (action.equals("additems"))
{
addItemsToPlace (out,req,res);
}
else if (action.equals("searchitems"))
{
searchItems (out,req,res);
}
else if (action.equals("requestitems"))
{
requestItem (out,req,res);
}
else if (action.equals("viewrequests"))
{
viewRequests (out,req,res);
}
}
public void viewRequests (PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
Statement s = null;
ResultSet rs = null;
//int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
s = c.createStatement();
System.out.println("ownername: " + req.getParameter("ownerName"));
query = "select sender, organization.name as org_name ,itemname from request, foodplace, organization where " +
"request.sender=organization.member and request.placename=foodplace.name and " +
"foodplace.ownername=" + "'" + req.getParameter("ownerName") + "'";
rs = s.executeQuery(query);
if (debug)
out.println("query: " + query);
rs = s.executeQuery(query);
if (rs != null)
{
System.out.println("Creating JSON....");
JSONArray jsonArray = this.convertToJSON(rs);
out.print(jsonArray);
out.flush();
}
else
{
out.println("Hey! Your resultset is null or empty");
out.flush();
}
c.close();
s.close();
out.println("</body> </html> ");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void requestItem (PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Search Food Bank Data </h1>");
}
Statement s = null;
//ResultSet rs = null;
int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
String[] selectedItems = null;
System.out.println("senderName: " + req.getParameter("senderName"));
System.out.println("placeName: " + req.getParameter("placeName"));
System.out.println("selectedItems: " + req.getParameter("selectedItems"));
if (req.getParameter("selectedItems") != null)
{
selectedItems = req.getParameter("selectedItems").split(",");
}
if (selectedItems != null && selectedItems.length > 0)
{
s = c.createStatement();
for (int i = 0; i < selectedItems.length; i ++)
{
query = "insert into request (sender, placename, itemname)"
+ " values (" + "'" + req.getParameter("senderName")
+ "'" + ", " + "'" + req.getParameter("placeName")
+ "'" + ", " + "'" + selectedItems[i]
+ "'" + ")";
queryExecuted = s.executeUpdate(query);
}
c.close();
s.close();
out.println("Data inserted into db");
out.println("</body> </html> ");
System.out.println("Selected items inserted into db");
}
else
{
System.out.println("No selected items");
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void searchItems (PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Search Food Bank Data </h1>");
}
Statement s = null;
ResultSet rs = null;
//int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
System.out.println(req.getParameter("placeName"));
s = c.createStatement();
query = "select * from items where foodplacename=" + "'" + req.getParameter("placeName")
+ "'";
if (debug)
out.println("query: " + query);
rs = s.executeQuery(query);
if (rs != null)
{
System.out.println("Creating JSON....");
JSONArray jsonArray = this.convertToJSON(rs);
out.print(jsonArray);
out.flush();
}
else
{
out.println("Hey! Your resultset is null or empty");
out.flush();
}
c.close();
s.close();
out.println("</body> </html> ");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void addItemsToPlace(PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Food Bank Data </h1>");
}
Statement s = null;
ResultSet rs = null;
int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
s = c.createStatement();
query = "select * from foodplace where ownername=" + "'" + req.getParameter("ownername") + "'";
if (debug)
out.println("query: " + query);
rs = s.executeQuery(query);
if (debug)
{
out.println("username: " + req.getParameter("ownername") + "<br/>");
out.println("itemName: " + req.getParameter("itemName") + "<br/>");
out.println("itemQuantity: " + req.getParameter("itemQuantity") + "<br/>");
out.println("Restaurant name: " + rs.getString("name") + "<br/>");
}
query = "insert into items (foodplacename, itemtype, itemname) values ("
+ "'" + rs.getString("name") + "'" + ", " + req.getParameter("itemQuantity")
+ ", " + "'" + req.getParameter("itemName") + "'" + ")";
queryExecuted = s.executeUpdate(query);
c.close();
s.close();
out.println("Data inserted into db");
out.println("</body> </html> ");
System.out.println("Data inserted into db");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void authenticateUser(PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Food Bank Data </h1>");
}
Statement s = null;
ResultSet rs = null;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
s = c.createStatement();
query = "select * from foodappuser where username=" + "'" + req.getParameter("loginUser") + "'";
if (debug)
out.println("query: " + query);
rs = s.executeQuery(query);
JSONArray jsonArray = this.convertToJSON(rs);
out.print(jsonArray);
out.flush();
c.close();
s.close();
out.println("</body> </html> ");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public JSONArray convertToJSON( ResultSet rs ) throws SQLException, JSONException
{
JSONArray json = new JSONArray();
ResultSetMetaData rsmd = rs.getMetaData();
while(rs.next())
{
int numColumns = rsmd.getColumnCount();
JSONObject obj = new JSONObject();
for (int i=1; i<numColumns+1; i++)
{
String column_name = rsmd.getColumnName(i);
if(rsmd.getColumnType(i)==java.sql.Types.ARRAY){
obj.put(column_name, rs.getArray(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.BIGINT){
obj.put(column_name, rs.getInt(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.BOOLEAN){
obj.put(column_name, rs.getBoolean(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.BLOB){
obj.put(column_name, rs.getBlob(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.DOUBLE){
obj.put(column_name, rs.getDouble(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.FLOAT){
obj.put(column_name, rs.getFloat(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.INTEGER){
obj.put(column_name, rs.getInt(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.NVARCHAR){
obj.put(column_name, rs.getNString(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.VARCHAR){
obj.put(column_name, rs.getString(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.TINYINT){
obj.put(column_name, rs.getInt(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.SMALLINT){
obj.put(column_name, rs.getInt(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.DATE){
obj.put(column_name, rs.getDate(column_name));
}
else if(rsmd.getColumnType(i)==java.sql.Types.TIMESTAMP){
obj.put(column_name, rs.getTimestamp(column_name));
}
else{
obj.put(column_name, rs.getObject(column_name));
}
}
json.put(obj);
}
return json;
}
public void searchPlaces(PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (debug)
{
out.println("<html> <head> <title> FoodBank Test </title> </head>");
out.println("<body> <h1> Food Bank Data </h1>");
}
Statement s = null;
ResultSet rs = null;
int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
if (debug)
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
s = c.createStatement();
if (req.getParameter("searchCity").trim().equals("") && !req.getParameter("searchZip").trim().equals(""))
query = "select * from foodplace where zip=" + req.getParameter("searchZip");
else if (!req.getParameter("searchCity").trim().equals("") && req.getParameter("searchZip").trim().equals(""))
query = "select * from foodplace where city=" + "'" + req.getParameter("searchCity") + "'";
else
{
query = "select * from foodplace where zip=" + req.getParameter("searchZip")
+ " and city=" + "'" + req.getParameter("searchCity") + "'";
}
if (debug)
out.println("query: " + query);
rs = s.executeQuery(query);
JSONArray jsonArray = this.convertToJSON(rs);
out.print(jsonArray);
out.flush();
c.close();
s.close();
out.println("</body> </html> ");
}
catch (Exception e)
{
e.printStackTrace();
}
}
public Connection getDBConnection()
{
Connection c = null;
try
{
//Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName("org.sqlite.JDBC");
String dbPath = "";
//c = DriverManager.getConnection("jdbc:sqlite:/Users/haaris/Workspace/SQLite/sqlite-shell-win32-x86-3080100/foodbank.db");
//c = DriverManager.getConnection("jdbc:sqlite:/Users/haaris/apache-tomcat-7.0.47/webapps/foodapp/foodbank.db");
c = DriverManager.getConnection(sqlliteDbUrl);
return c;
}
catch (Exception e)
{
System.out.println("Where is your Oracle JDBC Driver?");
e.printStackTrace();
return null;
}
}
public void registerFoodPlace(PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
Statement s = null;
int queryExecuted = 0;
String query = "";
Connection c = getDBConnection();
if (c == null)
{
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
out.println("<html> <head> </head> <body> ");
out.println("Place name: " + req.getParameter("foodPlaceName"));
out.println("Place address: " + req.getParameter("foodPlaceStreetAddress")
+ ", " + req.getParameter("foodPlaceCity") + ","
+ req.getParameter("foodPlaceState") +
req.getParameter("foodPlaceZip"));
System.out.println("Place name: " + req.getParameter("foodPlaceName"));
System.out.println("Place address: " + req.getParameter("foodPlaceStreetAddress")
+ ", " + req.getParameter("foodPlaceCity") + ","
+ req.getParameter("foodPlaceState") +
req.getParameter("foodPlaceZip"));
try
{
//c = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.8:1521/XE", "system", "admin");
//c = DriverManager.getConnection("jdbc:oracle:thin:@10.159.226.169:1521/XE", "system", "admin");
s = c.createStatement();
query = "insert into foodappuser (username, password, usertype) values (" + "'"+ req.getParameter("foodPlaceOwnerName") + "'"
+ ", " + "'" + req.getParameter("foodPlaceOwnerPassword") + "'" + ", 'owner')";
out.println("query: " + query);
queryExecuted = s.executeUpdate(query);
query = "insert into foodplace (ownername, name, streetaddress, city, state, zip, phonenumber)"
+ "values (" +"'"+ req.getParameter("foodPlaceOwnerName") + "'"
+ ", " + "'" + req.getParameter("foodPlaceName") + "'" +", '" + req.getParameter("foodPlaceStreetAddress") + "', '"
+ req.getParameter("foodPlaceCity")
+ "'" + ", '" + req.getParameter("foodPlaceState") + "'" + ", " + req.getParameter("foodPlaceZip") + ", "
+ req.getParameter("foodPlacePhone") + ")";
out.println("query: " + query);
queryExecuted = s.executeUpdate(query);
c.close();
s.close();
out.println("Data inserted into db");
out.println("</body> </html> ");
System.out.println("Data inserted into db");
}
catch (SQLException e)
{
out.println("Exception: could not insert data" + e.getMessage());
out.println("</body> </html> ");
e.printStackTrace();
return;
}
}
public void registerOrganization(PrintWriter out, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
Statement s = null;
String query = "";
int queryExecuted = 0;
Connection c = getDBConnection();
if (c == null)
{
out.println("Could not connect to DB");
System.out.println("Could not connect to DB");
return;
}
try
{
//c = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.8:1521/XE", "system", "admin");
//c = DriverManager.getConnection("jdbc:oracle:thin:@10.159.226.169:1521/XE", "system", "admin");
s = c.createStatement();
query = "insert into foodappuser (username, password, usertype) values (" + "'"+ req.getParameter("memberName") + "'"
+ ", " + "'" + req.getParameter("memberPassword") + "'" + ", 'organization')";
out.println("query: " + query);
queryExecuted = s.executeUpdate(query);
query = "insert into organization (member, name) values (" + "'"
+req.getParameter("memberName")+"', " + "'" +
req.getParameter("name")+"')";
out.println("query: " + query);
queryExecuted = s.executeUpdate(query);
c.close();
s.close();
out.println("Data inserted into db");
out.println("</body> </html> ");
System.out.println("Data inserted into db");
}
catch (SQLException e)
{
out.println("Exception: could not insert data" + e.getMessage());
out.println("</body> </html> ");
e.printStackTrace();
return;
}
}
} | hs94/FoodFinderApp | src/cs499/examples/semesterproject/AndroidFoodBankOwnerServlet.java | Java | gpl-2.0 | 18,694 |
<?php
namespace app\models;
use Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "country".
*
* @property integer $id
* @property string $country_name
*
* @property Person[] $people
*/
class Country extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'country';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['country_name'], 'string', 'max' => 255],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'Уникальный идентификатор страны',
'country_name' => 'Название страны',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getPeople()
{
return $this->hasMany(Person::className(), ['country_id' => 'id']);
}
/**
* @inheritdoc
* @return CountryQuery the active query used by this AR class.
*/
public static function find()
{
return new CountryQuery(get_called_class());
}
public static function getList()
{
return ArrayHelper::map(
static::find()->select(['id', 'country_name'])->all(),
'id',
'country_name');
}
}
| FreeWebber/s7 | GRID/p0vidl0-yii2/models/Country.php | PHP | gpl-2.0 | 1,372 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="author" content="Kai Oswald Seidler, Kay Vogelgesang, Carsten Wiedmann">
<link href="xampp.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="xampp.js"></script>
<title></title>
</head>
<body class="n">
<?php
include "lang/".file_get_contents("lang.tmp").".php";
date_default_timezone_set('UTC');
?>
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td align="right" class="navi">
<img src="img/blank.gif" alt="" width="145" height="15"><br>
<span class="nh"> <?php echo $TEXT['navi-xampp']; ?><br>[PHP: <?php echo phpversion(); ?>]</span><br>
</td>
</tr>
<tr>
<td height="1" bgcolor="#fb7922" colspan="1" style="background-image:url(img/strichel.gif)" class="white"></td>
</tr>
<tr valign="top">
<td align="right" class="navi">
<a name="start" id="start" class="n" target="content" onclick="h(this);" href="security.php"><?php echo $TEXT['navi-security']; ?></a><br> <br>
</td>
</tr>
<tr>
<td bgcolor="#fb7922" colspan="1" class="white"></td>
</tr>
<tr valign="top">
<td align="right" class="navi">
<br><span class="nh"><?php echo $TEXT['navi-languages']; ?></span><br>
</td>
</tr>
<tr>
<td height="1" bgcolor="#fb7922" colspan="1" style="background-image:url(img/strichel.gif)" class="white"></td>
</tr>
<tr valign="top">
<td align="right" class="navi">
<a target=_parent class=n href="lang.php?ru">Ðóññêèé</a><br>
<a target=_parent class=n href="lang.php?de"><?php print $TEXT['navi-german']; ?></a><br>
<a target=_parent class=n href="lang.php?en"><?php print $TEXT['navi-english']; ?></a><br>
<a target=_parent class=n href="lang.php?es"><?php print $TEXT['navi-spanish']; ?></a><br>
<a target=_parent class=n href="lang.php?fr"><?php print $TEXT['navi-french']; ?></a><br>
<a target=_parent class=n href="lang.php?it"><?php print $TEXT['navi-italian']; ?></a><br>
<a target=_parent class=n href="lang.php?nl"><?php print $TEXT['navi-dutch']; ?></a><br>
<a target=_parent class=n href="lang.php?no"><?php print $TEXT['navi-norwegian']; ?></a><br>
<a target=_parent class=n href="lang.php?pl"><?php print $TEXT['navi-polish']; ?></a><br>
<a target=_parent class=n href="lang.php?pt"><?php print $TEXT['navi-portuguese']; ?></a><br>
<a target=_parent class=n href="lang.php?sl"><?php print $TEXT['navi-slovenian']; ?></a><br>
<a target=_parent class=n href="lang.php?zh"><?php print $TEXT['navi-chinese']; ?></a><p>
<p class="navi">©2002-<?php echo date("Y"); ?><br>
<?php if (file_get_contents("lang.tmp") == "de") { ?>
<a target="_new" href="http://www.apachefriends.org/index.html"><img border="0" src="img/apachefriends.gif" alt=""></a><p>
<?php } else { ?>
<a target="_new" href="http://www.apachefriends.org/index-en.html"><img border="0" src="img/apachefriends.gif" alt=""></a><p>
<?php } ?>
</td>
</tr>
</table>
</body>
</html>
| adamasantares/XAMPP-Virtual-Host-Manager | security/htdocs/navi.php | PHP | gpl-2.0 | 3,183 |
<?php
namespace Cerbere\Model\Hacked;
class HackedFileIgnoreEndingsHasher extends HackedFileHasher
{
/**
* Ignores file line endings.
* @inheritdoc
*/
public function performHash($filename)
{
if (!HackedFileGroup::isBinary($filename)) {
$file = file($filename, FILE_IGNORE_NEW_LINES);
return sha1(serialize($file));
} else {
return sha1_file($filename);
}
}
/**
* @inheritdoc
*/
public function fetchLines($filename)
{
return file($filename, FILE_IGNORE_NEW_LINES);
}
}
| smalot/drush-cerbere | lib/Cerbere/Model/Hacked/HackedFileIgnoreEndingsHasher.php | PHP | gpl-2.0 | 599 |
package com.ks.net;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import com.ks.activitys.IndexActivity.IndexHandler;
import com.ks.net.enums.MessageEnums;
public class UDPScanThread extends Thread {
private static final int UDPPORT = 9999;
private ArrayList<String> servers;
private DatagramSocket dgSocket = null;
private IndexHandler handler;
public UDPScanThread(ArrayList<String> servers, IndexHandler handler) {
this.servers = servers;
this.handler = handler;
}
public void stopUDP() {
this.interrupt();
if (dgSocket != null) {
dgSocket.close();
dgSocket = null;
}
}
@Override
public void run() {
super.run();
try {
dgSocket = new DatagramSocket();
dgSocket.setSoTimeout(500);
byte b[] = (MessageEnums.UDPSCANMESSAGE + MessageEnums.NETSEPARATOR + android.os.Build.BRAND + "_"
+ android.os.Build.MODEL).getBytes();
DatagramPacket dgPacket = null;
dgPacket = new DatagramPacket(b, b.length, InetAddress.getByName("255.255.255.255"), UDPPORT);
dgSocket.send(dgPacket);
} catch (IOException e3) {
handler.sendEmptyMessage(NUMCODES.NETSTATE.UDPSCANFAIL.getValue());
e3.printStackTrace();
if (dgSocket != null)
dgSocket.close();
return;
}
long start = System.nanoTime();
/** scan for 5 seconds */
while (!isInterrupted() && (System.nanoTime() - start) / 1000000 < 1500) {
byte data[] = new byte[512];
DatagramPacket packet = new DatagramPacket(data, data.length);
try {
dgSocket.receive(packet);
String rec = new String(packet.getData(), packet.getOffset(), packet.getLength());
System.out.println(rec);
String[] msgGet = rec.split(MessageEnums.NETSEPARATOR);
if (msgGet != null && msgGet.length == 3 && msgGet[0].equalsIgnoreCase(MessageEnums.UDPSCANRETURN)) {
if (msgGet[1].trim().length() == 0) {
msgGet[1] = "Unknown";
}
String server = msgGet[1] + MessageEnums.UDPSEPARATOR + packet.getAddress().toString().substring(1)
+ ":" + msgGet[2];
servers.add(server);
}
} catch (SocketTimeoutException ex) {
ex.printStackTrace();
continue;
} catch (IOException e) {
e.printStackTrace();
//handler.sendEmptyMessage(NUMCODES.NETSTATE.UDPSCANFAIL.getValue());
if (dgSocket != null)
dgSocket.close();
return;
}
}
if (dgSocket != null) {
dgSocket.close();
}
if (!isInterrupted()) {
handler.sendEmptyMessage(NUMCODES.NETSTATE.UDPSCANOK.getValue());
}
}
}
| MichaelChansn/RemoteControlSystem2.0_AndroidClient | src/com/ks/net/UDPScanThread.java | Java | gpl-2.0 | 2,601 |
<?php
function tzs_yahoo_get_id() {
global $wpdb;
$res = $wpdb->get_row("SELECT id, appid FROM ".TZS_YAHOO_KEYS_TABLE." ORDER BY last_used ASC LIMIT 1;");
if (count($res) == 0 && $wpdb->last_error != null) {
return NULL;
}
$appid = $res->appid;
$id = $res->id;
$sql = "UPDATE ".TZS_YAHOO_KEYS_TABLE." SET last_used=now() WHERE id=$id;";
if (false === $wpdb->query($sql)) {
return NULL;
}
return $appid;
}
function tzs_yahoo_convert0($key, $city_str) {
$url = "http://where.yahooapis.com/v1/places.q('".urlencode($city_str)."')?format=json&lang=ru&appid=$key";
//echo $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result=curl_exec($ch);
curl_close($ch);
$res = json_decode($result, true);
if (isset($res["error"])) {
return array("error" => $res["error"]["description"]);
}
if (!isset($res["places"])) {
return array("error" => "Неверный ответ сервера: places не найден");
}
if ($res["places"]["count"] <= 0) {
return array("error" => "Совпадений не найдено");
}
$rec = $res["places"]["place"][0];
$country = isset($rec["country"]) ? $rec["country"] : NULL;
$country_code = isset($rec["country attrs"]) && isset($rec["country attrs"]["code"]) ? $rec["country attrs"]["code"] : NULL;
$country_id = isset($rec["country attrs"]) && isset($rec["country attrs"]["woeid"]) ? $rec["country attrs"]["woeid"] : NULL;
$region = isset($rec["admin1"]) ? $rec["admin1"] : NULL;
$region_id = isset($rec["admin1 attrs"]) && isset($rec["admin1 attrs"]["woeid"]) ? $rec["admin1 attrs"]["woeid"] : NULL;
$city = isset($rec["locality1"]) ? $rec["locality1"] : NULL;
$city_id = isset($rec["locality1 attrs"]) && isset($rec["locality1 attrs"]["woeid"]) ? $rec["locality1 attrs"]["woeid"] : NULL;
// KSK - добавляем выбор кооринат города для сохранения в таблице
$lat = isset($rec["centroid"]) && isset($rec["centroid"]["latitude"])? $rec["centroid"]["latitude"] : NULL;
$lng = isset($rec["centroid"]) && isset($rec["centroid"]["longitude"])? $rec["centroid"]["longitude"] : NULL;
// KSK - добавляем проверку данных города, полученных от сервиса Yahoo
if ($country_id == NULL || $city_id == NULL) {
return array("error" => "Совпадений не найдено");
//return array("error" => "Сервис Yahoo не располагает информацией о населенном пункте ".$city_str);
}
$result = array("country" => $country, "country_code" => $country_code, "country_id" => $country_id,
"region" => $region, "region_id" => $region_id, "city" => $city, "city_id" => $city_id,
"lat" => $lat, "lng" => $lng);
return $result;
}
function tzs_check_country($rec) {
if (!isset($rec["country_id"]))
return;
$id = $rec["country_id"];
global $wpdb;
$res = $wpdb->get_row("SELECT COUNT(id) AS cnt FROM ".TZS_COUNTRIES_TABLE." WHERE country_id=$id;");
if (count($res) == 0 && $wpdb->last_error != null)
return;
if ($res->cnt > 0)
return;
tzs_add_country($rec);
}
function tzs_check_region($rec) {
if (!isset($rec["region_id"]))
return;
$id = $rec["region_id"];
global $wpdb;
$res = $wpdb->get_row("SELECT COUNT(id) AS cnt FROM ".TZS_REGIONS_TABLE." WHERE region_id=$id;");
if (count($res) == 0 && $wpdb->last_error != null)
return;
if ($res->cnt > 0)
return;
tzs_add_region($rec);
}
function tzs_check_city($rec) {
if (!isset($rec["city_id"]))
return;
$id = $rec["city_id"];
global $wpdb;
$res = $wpdb->get_row("SELECT COUNT(id) AS cnt FROM ".TZS_CITIES_TABLE." WHERE city_id=$id;");
if (count($res) == 0 && $wpdb->last_error != null)
return;
if ($res->cnt > 0)
return;
tzs_add_city($rec);
}
function tzs_add_country($rec) {
global $wpdb;
$sql = $wpdb->prepare("INSERT INTO ".TZS_COUNTRIES_TABLE.
" (country_id, code, title_ru, title_ua, title_en)".
" VALUES (%d, %s, %s, %s, %s);",
$rec["country_id"], stripslashes_deep($rec["country_code"]),
stripslashes_deep($rec["country"]), stripslashes_deep($rec["country_ua"]), stripslashes_deep($rec["country_en"]));
return ($wpdb->query($sql) !== false);
}
function tzs_add_region($rec) {
global $wpdb;
$sql = $wpdb->prepare("INSERT INTO ".TZS_REGIONS_TABLE.
" (country_id, region_id, title_ru, title_ua, title_en)".
" VALUES (%d, %d, %s, %s, %s);",
$rec["country_id"], $rec["region_id"],
stripslashes_deep($rec["region"]), stripslashes_deep($rec["region_ua"]), stripslashes_deep($rec["region_en"]));
return ($wpdb->query($sql) !== false);
}
function tzs_add_city($rec) {
global $wpdb;
$sql = $wpdb->prepare("INSERT INTO ".TZS_CITIES_TABLE.
" (country_id, region_id, city_id, title_ru, title_ua, title_en, lat, lng)".
" VALUES (%d, %d, %d, %s, %s, %s, %.6F, %.6F);",
$rec["country_id"], $rec["region_id"], $rec["city_id"],
stripslashes_deep($rec["city"]), stripslashes_deep($rec["city_ua"]), stripslashes_deep($rec["city_en"]),
$rec["lat"], $rec["lng"]);
return ($wpdb->query($sql) !== false);
}
function tzs_yahoo_info($id, $lang) {
$key = tzs_yahoo_get_id();
if ($key == NULL)
return false;
$url = "http://where.yahooapis.com/v1/place/$id?format=json&lang=$lang&appid=$key";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result=curl_exec($ch);
curl_close($ch);
$res = json_decode($result, true);
if (isset($res["error"])) {
return false;
}
if (!isset($res["place"])) {
return false;
}
$rec = $res["place"];
$country = isset($rec["country"]) ? $rec["country"] : NULL;
$country_code = isset($rec["country attrs"]) && isset($rec["country attrs"]["code"]) ? $rec["country attrs"]["code"] : NULL;
$country_id = isset($rec["country attrs"]) && isset($rec["country attrs"]["woeid"]) ? $rec["country attrs"]["woeid"] : NULL;
$region = isset($rec["admin1"]) ? $rec["admin1"] : NULL;
$region_id = isset($rec["admin1 attrs"]) && isset($rec["admin1 attrs"]["woeid"]) ? $rec["admin1 attrs"]["woeid"] : NULL;
$city = isset($rec["locality1"]) ? $rec["locality1"] : NULL;
$city_id = isset($rec["locality1 attrs"]) && isset($rec["locality1 attrs"]["woeid"]) ? $rec["locality1 attrs"]["woeid"] : NULL;
$result = array("country" => $country, "country_code" => $country_code, "country_id" => $country_id,
"region" => $region, "region_id" => $region_id, "city" => $city, "city_id" => $city_id);
return $result;
}
function tzs_yahoo_fill($rec) {
$id;
if ($rec["city_id"] != null)
$id = $rec["city_id"];
elseif ($rec["region_id"] != null)
$id = $rec["region_id"];
elseif ($rec["country_id"] != null)
$id = $rec["country_id"];
else
return false;
// yahoo не знает украинский язык!!!
//$ua = tzs_yahoo_info($id, "ua");
//if ($ua === false)
// return false;
$en = tzs_yahoo_info($id, "en");
if ($en === false)
return false;
//$rec["country_ua"] = $ua["country"];
//$rec["region_ua"] = $ua["region"];
//$rec["city_ua"] = $ua["city"];
// поэтому используем рус
$rec["country_ua"] = $rec["country"];
$rec["region_ua"] = $rec["region"];
$rec["city_ua"] = $rec["city"];
$rec["country_en"] = $en["country"];
$rec["region_en"] = $en["region"];
$rec["city_en"] = $en["city"];
return $rec;
}
function tzs_yahoo_convert($city_str) {
$key = tzs_yahoo_get_id();
if ($key == NULL) {
return array("error" => "Внутренняя ошибка. AppID не найден");
}
$res = tzs_yahoo_convert0($key, $city_str);
if (!isset($res["error"])) {
$res = tzs_yahoo_fill($res);
tzs_check_country($res);
tzs_check_region($res);
tzs_check_city($res);
}
return $res;
}
function tzs_get_country($id) {
global $wpdb;
$sql = "SELECT title_ru FROM ".TZS_COUNTRIES_TABLE." WHERE country_id=$id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return "Ошибка";
} else if ($row == null) {
return "Не_найдено";
}
return $row->title_ru;
}
function tzs_get_country_code($id) {
global $wpdb;
$sql = "SELECT code FROM ".TZS_COUNTRIES_TABLE." WHERE country_id=$id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return "Ошибка";
} else if ($row == null) {
return "Не_найдено";
}
return $row->code;
}
function tzs_get_region($id) {
global $wpdb;
$sql = "SELECT title_ru FROM ".TZS_REGIONS_TABLE." WHERE region_id=$id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return "Ошибка";
} else if ($row == null) {
return "Не_найдено";
}
return $row->title_ru;
}
function tzs_get_city($id) {
global $wpdb;
$sql = "SELECT title_ru FROM ".TZS_CITIES_TABLE." WHERE city_id=$id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return "Ошибка";
} else if ($row == null) {
return "Не_найдено";
}
return $row->title_ru;
}
function tzs_city_to_str($country_id, $region_id, $city_id, $def, $title='') {
$def = htmlspecialchars($def);
if ($city_id != NULL && $city_id > 0) {
return '<span title="'.($title !== '' ? $title : $def).'"><strong>'.htmlspecialchars(tzs_get_city($city_id)).'</strong>'.(($region_id != NULL && $region_id > 0 && $region_id != 20070188) ? '<br>'.htmlspecialchars(tzs_get_region($region_id)) : '').(($country_id != 23424976) ? ' ('.htmlspecialchars(tzs_get_country_code($country_id)).')' : '').'</span>';
} elseif ($region_id != NULL && $region_id > 0) {
return "<span title=\"$def\">".htmlspecialchars(tzs_get_region($region_id))." (".htmlspecialchars(tzs_get_country_code($country_id)).")</span>";
} elseif ($country_id != NULL && $country_id > 0) {
return "<span title=\"$def\">".htmlspecialchars(tzs_get_country($country_id))."</span>";
} else
return "<span>".$def."</span>";
}
function tzs_city_to_ids($city, $region_id, $country_id) {
$key = tzs_yahoo_get_id();
if ($key == NULL) {
return array("error" => "Внутренняя ошибка. AppID не найден");
}
$city_str = $city;
global $wpdb;
if ($region_id > 0) {
// convert region_id to title
$sql = "SELECT title_ru FROM ".TZS_REGIONS_TABLE." WHERE region_id=$region_id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return array("error" => "Внутренняя ошибка (область).");
} else if ($row == null) {
return array("error" => "Неизвестная область.");
}
$city_str .= ' '.$row->title_ru;
}
if ($country_id > 0) {
// convert country_id to title
$sql = "SELECT title_ru FROM ".TZS_COUNTRIES_TABLE." WHERE country_id=$country_id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return array("error" => "Внутренняя ошибка (страна).");
} else if ($row == null) {
return array("error" => "Неизвестная страна.");
}
$city_str .= ' '.$row->title_ru;
}
$res = tzs_city_ids_from_db($city_str);
if (!isset($res["error"]) && !isset($res["ids"])) {
$res = tzs_yahoo_convert1($key, $city_str);
if (!isset($res["error"])) {
$ids = $res['ids'];
$ids_str = '';
foreach ($ids as $id) {
if (strlen($ids_str) > 0)
$ids_str .= ' ';
$ids_str .= $id;
}
$sql = $wpdb->prepare("INSERT INTO ".TZS_CITY_IDS_TABLE." (title, ids) VALUES (%s, %s);", $city_str, $ids_str);
if (false === $wpdb->query($sql)) {
return array("error" => "Не удалось сохранить результат в кэш. ".$wpdb->last_error);
}
}
}
if (!isset($res['ids']) || count($res['ids']) == 0)
return array("error" => "Населенный пункт не найден: ".$city_str);
return $res;
}
function tzs_city_ids_from_db($city) {
global $wpdb;
$sql = $wpdb->prepare("SELECT ids FROM ".TZS_CITY_IDS_TABLE." WHERE title=%s;", $city);
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return array('error' => 'Не удалось извлечь информацию из кэша. Свяжитесь, пожалуйста, с администрацией сайта');
} else if ($row == null) {
return array();
} else {
$ids = array();
if (strlen($row->ids) > 0) {
$ids_str = explode(' ', $row->ids);
foreach ($ids_str as $id) {
array_push($ids, floatval($id));
}
}
return array('ids' => $ids);
}
}
//*******************************************************************************
// KSK
function tzs_city_from_radius_to_ids($city, $region_id, $country_id, $radius_value) {
$key = tzs_yahoo_get_id();
if ($key == NULL) {
return array("error" => "Внутренняя ошибка. AppID не найден");
}
$city_str = $city;
$radius = $radius_value + 1;
global $wpdb;
$sql1 = "SELECT city_id, lat, lng FROM ".TZS_CITIES_TABLE." WHERE title_ru='".$city."'";
$lat = null;
$lng = null;
if ($region_id > 0) {
$sql1 .= " AND region_id=".$region_id;
// convert region_id to title
$sql = "SELECT title_ru FROM ".TZS_REGIONS_TABLE." WHERE region_id=$region_id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return array("error" => "Внутренняя ошибка (область).");
} else if ($row == null) {
return array("error" => "Неизвестная область.");
}
$city_str .= ' '.$row->title_ru;
}
if ($country_id > 0) {
$sql1 .= " AND $country_id=".$country_id;
// convert country_id to title
$sql = "SELECT title_ru FROM ".TZS_COUNTRIES_TABLE." WHERE country_id=$country_id;";
$row = $wpdb->get_row($sql);
if (count($row) == 0 && $wpdb->last_error != null) {
return array("error" => "Внутренняя ошибка (страна).");
} else if ($row == null) {
return array("error" => "Неизвестная страна.");
}
$city_str .= ' '.$row->title_ru;
}
ksk_debug($city_str, 'tzs_city_from_radius_to_ids: Поиск населенных пунктов в радиусе '.$radius_value);
$row = $wpdb->get_row($sql1);
if ($wpdb->last_error != null) {
return array("error" => "При поиске населенного пункта погрузки '".$city_str."' возникла ошибка :".$wpdb->last_error);
}
// Запись обнаружена - возьмем координаты
else if ($row != null) {
$lat = $row->lat;
$lng = $row->lng;
ksk_debug($lat.':'.$lng, 'tzs_city_from_radius_to_ids: Запись обнаружена - возьмем координаты');
}
// Запись не обнаружена - поищем в yahoo и возьмем координаты
else {
$res = tzs_yahoo_convert($city_str);
ksk_debug($res, 'tzs_city_from_radius_to_ids: Запись не обнаружена - поищем в yahoo и возьмем координаты');
if (isset($res["error"])) {
return array("error" => "Не удалось распознать населенный пункт погрузки: ".$res["error"]);
}
// Координаты
$lat = $res['lat'];
$lng = $res['lng'];
}
//******************************
//* Поищем в таблице населенные пункты в указанном радиусе от указанного
//******************************
$sql = "SELECT city_id, title_ru, lat, lng,";
$sql .= " (6371.009 * acos(sin(RADIANS(lat)) * sin(RADIANS(".$lat.")) + cos(RADIANS(lat)) * cos(RADIANS(".$lat.")) * cos(RADIANS(lng) - RADIANS(".$lng.")))) as distance";
$sql .= " FROM ".TZS_CITIES_TABLE." WHERE lat IS NOT NULL AND lng IS NOT NULL";
$sql .= " HAVING distance < ".$radius;
$rows = $wpdb->get_results($sql);
if ($wpdb->last_error != null) {
return array("error" => "При поиске пунктов погрузки в радиусе ".$radius_value." км от населенного пункта '".$city_str."' возникла ошибка :".$wpdb->last_error);
}
$ids = array();
ksk_debug($rows, 'tzs_city_from_radius_to_ids: населенные пункты в указанном радиусе от указанного');
foreach ( $rows as $row ) {
if ($row->city_id != null)
// ksk_debug($row->city_id.' - '.$row->title_ru, 'tzs_city_from_radius_to_ids: населенные пункты в указанном радиусе от указанного');
array_push($ids, $row->city_id);
}
$res = array('ids' => $ids);
if (!isset($res['ids']) || count($res['ids']) == 0)
return array("error" => "Пункты погрузки в радиусе ".$radius_value." км от населенного пункта '".$city_str."' не обнаружены");
return $res;
}
//*******************************************************************************
function tzs_yahoo_convert1($key, $city_str) {
$url = "http://where.yahooapis.com/v1/places.q('".urlencode($city_str)."');start=0;count=1000?format=json&lang=ru&appid=$key";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result=curl_exec($ch);
curl_close($ch);
$res = json_decode($result, true);
if (isset($res["error"])) {
return array("error" => $res["error"]["description"]);
}
$ids = array();
if (isset($res["places"]) && isset($res["places"]["count"]) && $res["places"]["count"] > 0) {
foreach ($res["places"]["place"] as $rec) {
$city_id = isset($rec["locality1 attrs"]) && isset($rec["locality1 attrs"]["woeid"]) ? $rec["locality1 attrs"]["woeid"] : NULL;
if ($city_id != null)
array_push($ids, $city_id);
}
}
return array('ids' => $ids);
}
function ksk_debug($val, $label = null) {
$file_name = ABSPATH . 'ksk_debug.log.html';
if ($label != null) {
$out_str = '<p>'.date('d.m.Y H:i:s').' '.$label.'<br/>';
} else {
$out_str = '<p>'.date('d.m.Y H:i:s').'<br/>';
}
if (is_array($val) || is_object($val)) {
$out_str .= '<pre>'.print_r($val, true).'</pre>';
} else {
$out_str .= $val;
}
$out_str .= '</p>';
file_put_contents($file_name, $out_str, FILE_APPEND | LOCK_EX);
}
?> | serker72/T3S_Old | wp-content/plugins/tzs/functions/tzs.yahoo.php | PHP | gpl-2.0 | 18,819 |
<?php
/* Load JS scripts(minified or normal) in admin area only */
add_action( 'admin_head' , 'cutv__load_scripts' );
function cutv__load_scripts() {
if( cutv__DEV_MODE === FALSE && cutv__USE_MIN_JS === TRUE ) {
$js_functions_file = cutv__URL . 'assets/js/cutv_.functions.min.js';
} else {
$js_functions_file = cutv__URL . 'assets/js/cutv_.functions.js';
}
$js_globals_array = array(
'functions_js' => $js_functions_file ,
'api_auth_url' => cutv__AUTH_URL ,
'cutv__js' => cutv__JS ,
);
$js_localize_array = array(
'confirm_import_sample_sources' => __( 'Do you really want to import demo sources ?' , cutv__LANG ) ,
'save_source_first' => __( 'Your source has changed. Please save it before testing it.' , cutv__LANG ) ,
'save_source' => '<i class="fa fa-save"></i> ' . __( 'Save Source' , cutv__LANG ) ,
'group_info' => __( 'Grouped Testing Info' , cutv__LANG ) ,
'add_to_unwanted' => __( 'Add to Unwanted' , cutv__LANG ) ,
'remove_from_unwanted' => __( 'Remove from Unwanted' , cutv__LANG ) ,
'license_cancelled' => __( 'Activation cancelled. You can now use your purchase code on your new domain.' , cutv__LANG ) ,
'license_reset' => __( 'License reset.' , cutv__LANG ) ,
'activation_cancel_confirm' => __( 'Do you really want to cancel your activation ?' , cutv__LANG ) ,
'licence_reset_confirm' => __( 'Do you really want to reset this addon license ?' , cutv__LANG ) ,
'action_done' => __( 'Action done successfully.' , cutv__LANG ) ,
'select_preset' => __( 'Please select a dataFiller Preset.' , cutv__LANG ) ,
'correct_entry' => __( 'Please enter both Data to Add and the custom field name where to add.' , cutv__LANG ) ,
'confirm_add_from_preset' => __( 'Do you really want to add all this preset fillers ?' , cutv__LANG ) ,
'fillers_deleted' => __( 'All the data fillers have been deleted successfully.' , cutv__LANG ) ,
'confirm_delete_fillers' => __( 'Do you really want to delete all the data fillers ?' , cutv__LANG ) ,
'confirm_run_sources' => __( 'Do you really want to run this source ?' , cutv__LANG ) ,
'confirm_merge_items' => __( 'Do you really want to merge the selected items ?' , cutv__LANG ) ,
'confirm_merge_all_items' => __( 'Do you really want to merge all the duplicates ? This make take some time.' , cutv__LANG ) ,
'confirm_merge_dups' => __( 'Do you really want to merge those duplicates ?' , cutv__LANG ) ,
'is_now_connected' => __( 'is now connected !' , cutv__LANG ) ,
'confirm_cancel_access' => __( 'Do you really want to cancel this access ?' , cutv__LANG ) ,
'import_videos' => __( 'Import Videos' , cutv__LANG ) ,
'wp_video_robot' => __( 'WP Video Robot' , cutv__LANG ) ,
'source_with_no_name' => __( 'Do you really want to add this source without a name.' , cutv__LANG ) ,
'source_with_no_type' => __( 'Please choose a source type to continue.' , cutv__LANG ) ,
'source_with_big_wanted' => __( 'Wanted Videos are limited to' , cutv__LANG ) . ' : ' . cutv__MAX_WANTED_VIDEOS ,
'video_preview' => __( 'Video Preview' , cutv__LANG ) ,
'work_completed' => __( 'Work Completed !' , cutv__LANG ) ,
'videos_unanted_successfully' => __( 'videos added to unwanted successfuly' , cutv__LANG ) ,
'videos_added_successfully' => __( 'videos added successfuly' , cutv__LANG ) ,
'cancel_anyway' => ' <i class="fa fa-remove"></i> ' . __( 'Cancel anyway' , cutv__LANG ) ,
'back_to_work' => __( 'Continue the work in progress' , cutv__LANG ) ,
'reset_yes' => ' <i class="fa fa-check"></i> ' . __( 'Confirm Reset' , cutv__LANG ) ,
'reset_no' => ' <i class="fa fa-remove"></i> ' . __( 'Cancel' , cutv__LANG ) ,
'yes' => ' <i class="fa fa-check"></i> ' . __( 'Yes' , cutv__LANG ) ,
'no' => ' <i class="fa fa-remove"></i> ' . __( 'No' , cutv__LANG ) ,
'import_btn' => ' <i class="fa fa-download"></i> ' . __( 'Import' , cutv__LANG ) ,
'are_you_sure' => __( 'Are you sure ?' , cutv__LANG ) ,
'really_want_cancel' => __( 'Do you really want to cancel the work in progress ?' , cutv__LANG ) ,
'continue_button' => ' <i class="fa fa-play"></i> ' . __( 'Continue' , cutv__LANG ) ,
'cancel_button' => ' <i class="fa fa-remove"></i> ' . __( 'Cancel' , cutv__LANG ) ,
'ok_button' => ' <i class="fa fa-check"></i> ' . __( 'OK' , cutv__LANG ) ,
'export_button' => ' <i class="fa fa-download"></i> ' . __( 'Export' , cutv__LANG ) ,
'dismiss_button' => ' <i class="fa fa-close"></i> ' . __( 'DISMISS' , cutv__LANG ) ,
'close_button' => ' <i class="fa fa-close"></i> ' . __( 'Close' , cutv__LANG ) ,
'pause_button' => ' <i class="fa fa-pause"></i> ' . __( 'Pause' , cutv__LANG ) ,
'options_set_to_default' => __( 'cutv_ Options set to default !' , cutv__LANG ) ,
'options_reset_confirm' => __( 'Do you really want to reset options to default ?' , cutv__LANG ) ,
'options_saved' => __( 'Options successfully saved' , cutv__LANG ) ,
'addon_options_saved' => __( 'Addon options successfully saved' , cutv__LANG ) ,
'licences_saved' => __( 'Licences successfully saved' , cutv__LANG ) ,
'options_reset_confirm' => __( 'Do you really want to reset options to default ?' , cutv__LANG ) ,
'adding_selected_videos' => __( ' Adding selected videos' , cutv__LANG ) ,
'work_in_progress' => __( 'Work in progress' , cutv__LANG ) ,
'loading' => __( 'Loading' , cutv__LANG ) . ' <i class="wpvr__spinning_icon fa fa-cog fa-spin"></i> ' ,
'loadingCenter' => '<div class="wpvr__loading_center"><br /><br />' . __( 'Please Wait ...' , cutv__LANG )
. ' <br/><br/><i class="wpvr__spinning_icon fa fa-cog fa-spin"></i></div>' ,
'please_wait' => __( 'Please wait' , cutv__LANG ) ,
'want_clear_log' => __( 'Do you really want to clear the log ?' , cutv__LANG ) ,
'system_infos' => __( 'System Informations' , cutv__LANG ) ,
'item' => __( 'item' , cutv__LANG ) ,
'items' => __( 'items' , cutv__LANG ) ,
'confirm_delete_permanently' => __( 'Do you really want to delete permanently the selected items ?' , cutv__LANG ) ,
'want_remove_items' => __( 'Do you really want to remove permanently the selected items ?' , cutv__LANG ) ,
'videos_removed_successfully' => __( 'video(s) removed from deferred' , cutv__LANG ) ,
'showing' => __( 'Showing' , cutv__LANG ) ,
'on' => __( 'on' , cutv__LANG ) ,
'page' => __( 'Page' , cutv__LANG ) ,
'seconds' => __( 'seconds' , cutv__LANG ) ,
'videos_processed_successfully' => __( 'videos processed successfully' , cutv__LANG ) ,
'duplicates_removed_in' => __( 'duplicates removed in' , cutv__LANG ) ,
'errorJSON' => __( 'Headers already sent by some other scripts. Error thrown :' , cutv__LANG ) ,
'error' => __( 'Error' , cutv__LANG ) ,
'confirm_run_fillers' => __( 'Run fillers on existant videos ? This may take some time.' , cutv__LANG ) ,
'confirm_remove_filler' => __( 'Do you really want to remove this filler ?' , cutv__LANG ) ,
);
wp_enqueue_script( 'jquery' );
//wp_enqueue_script('cutv__functions', cutv__URL.'assets/js/cutv_.functions.js' . '?version='.cutv__VERSION );
if( cutv__DEV_MODE === FALSE && cutv__USE_MIN_JS === TRUE ) {
$js_file = cutv__URL . 'assets/js/cutv_.scripts.min.js';
wp_register_script( 'cutv__scripts' , $js_file . '?version=' . cutv__VERSION , array( 'jquery' ) );
wp_localize_script( 'cutv__scripts' , 'cutv__localize' , $js_localize_array );
wp_localize_script( 'cutv__scripts' , 'cutv__globals' , $js_globals_array );
wp_enqueue_script( 'cutv__scripts' );
} else {
$js_file = cutv__URL . 'assets/js/cutv_.scripts.js';
wp_register_script( 'cutv__scripts_chart' , cutv__URL . 'assets/js/cutv_.chart.min.js' );
wp_enqueue_script( 'cutv__scripts_chart' );
wp_register_script( 'cutv__scripts_clipboard' , cutv__URL . 'assets/js/cutv_.clipboard.min.js' );
wp_enqueue_script( 'cutv__scripts_clipboard' );
wp_register_script( 'cutv__scripts_selectize' , cutv__URL . 'assets/js/cutv_.selectize.min.js' );
wp_enqueue_script( 'cutv__scripts_selectize' );
wp_register_script( 'cutv__scripts_countup' , cutv__URL . 'assets/js/cutv_.countup.js' );
wp_enqueue_script( 'cutv__scripts_countup' );
wp_register_script( 'cutv__scripts_noui' , cutv__URL . 'assets/js/cutv_.slider.min.js' );
wp_enqueue_script( 'cutv__scripts_noui' );
wp_register_script( 'cutv__scripts' , $js_file . '?version=' . cutv__VERSION );
wp_localize_script( 'cutv__scripts' , 'cutv__localize' , $js_localize_array );
wp_localize_script( 'cutv__scripts' , 'cutv__globals' , $js_globals_array );
wp_enqueue_script( 'cutv__scripts' );
}
}
/* Load CSS files (minified or normal version) in admin area only */
add_action( 'admin_head' , 'cutv__load_styles' );
function cutv__load_styles() {
if( cutv__USE_LOCAL_FONTAWESOME ) {
wp_register_style( 'cutv__icons' , cutv__URL . 'assets/css/font-awesome.min.css' );
wp_enqueue_style( 'cutv__icons' );
} else {
wp_register_style( 'cutv__icons' , cutv__FONTAWESOME_CSS_URL );
wp_enqueue_style( 'cutv__icons' );
}
if( cutv__DEV_MODE === FALSE && cutv__USE_MIN_CSS === TRUE ) {
$css_file = cutv__URL . 'assets/css/cutv_.styles.min.css';
wp_register_style( 'cutv__styles' , $css_file . '?version=' . cutv__VERSION );
wp_enqueue_style( 'cutv__styles' );
} else {
$css_file = cutv__URL . 'assets/css/cutv_.styles.css';
wp_register_style( 'cutv__selectize' , cutv__URL . 'assets/css/cutv_.selectize.min.css' );
wp_enqueue_style( 'cutv__selectize' );
wp_register_style( 'cutv__noui_styles' , cutv__URL . 'assets/css/cutv_.slider.min.css' );
wp_enqueue_style( 'cutv__noui_styles' );
wp_register_style( 'cutv__flags_styles' , cutv__URL . 'assets/css/cutv_.flags.min.css' );
wp_enqueue_style( 'cutv__flags_styles' );
wp_register_style( 'cutv__styles' , $css_file . '?version=' . cutv__VERSION );
wp_enqueue_style( 'cutv__styles' );
}
if( is_rtl() ) {
wp_enqueue_style( 'cutv__styles_rtl' , cutv__URL . 'assets/css/cutv_.styles.rtl.css' );
}
}
/* Load CSS fix for embeding youtube player */
add_action( 'wp_head' , 'cutv__load_services_css_styles' , 120 );
add_action( 'admin_head' , 'cutv__load_services_css_styles' , 120 );
function cutv__load_services_css_styles() {
global $cutv__vs;
$css = '';
$css .= '#adminmenu .menu-icon-video div.wp-menu-image:before {content: "\f126";}';
$css .= '#adminmenu .menu-icon-source div.wp-menu-image:before {content: "\f179";}';
if( count( $cutv__vs ) != 0 ) {
foreach ( (array) $cutv__vs as $vs ) {
if( cutv__DEV_MODE === TRUE ) {
$css .= "/*cutv_ DEV MODE */\n";
$css .= "#adminmenuback{display:none;}\n";
$css .= "/*cutv_ DEV MODE */\n";
}
$css .= "/*cutv_ VIDEO SERVICE STYLES ( " . $vs[ 'label' ] . " ) */\n";
//$css .= "/* START */\n";
$css .= trim( preg_replace( '/\t+/' , '' , $vs[ 'get_styles' ]() ) );
//$css .= "<!-- END -->\n";
$css .= "/* cutv_ VIDEO SERVICE STYLES ( " . $vs[ 'label' ] . " ) */\n\n";
}
}
echo "<style>\n $css\n </style>\n";
}
/* Load CSS fix for embeding youtube player */
add_action( 'wp_head' , 'cutv__load_dynamic_css' , 100 );
add_action( 'admin_head' , 'cutv__load_dynamic_css' , 100 );
function cutv__load_dynamic_css() {
global $cutv__status , $cutv__services;
$css = '';
$css .= '.cutv__embed .fluid-width-video-wrapper{ padding-top:56% !important; }';
$css .= '.ad-container.ad-container-single-media-element-annotations.ad-overlay{ background:red !important; }';
/*
$css .= '.cutv__button{ background : '.cutv__BUTTON_BGCOLOR.' !important; color : '.cutv__BUTTON_COLOR.' !important; }';
$css .= '.cutv__button:hover{ background : '.cutv__BUTTON_HOVER_BGCOLOR.' !important; color : '.cutv__BUTTON_HOVER_COLOR.' !important; }';
*/
foreach ( $cutv__status as $value => $data ) {
$css .= '.cutv__video_status.' . $value . '{ background:' . $data[ 'color' ] . ' ;} ';
}
?>
<style><?php echo $css; ?></style><?php
}
/* Load CSS fix for embeding youtube player */
add_action( 'wp_footer' , 'cutv__load_css_fix' );
function cutv__load_css_fix() {
global $cutv__status , $cutv__services;
$css = '';
foreach ( $cutv__status as $value => $data ) {
$css .= '.cutv__video_status.' . $value . '{ background-color:red;}';
}
?>
<style>
<?php echo $css; ?>
.cutv__embed {
position: relative !important;
padding-bottom: 56.25% !important;
padding-top: 30px !important;
height: 0 !important;
overflow: hidden !important;
}
.cutv__embed.cutv__vst_embed {
padding-top: 0px !important;
}
.cutv__embed iframe, .cutv__embed object, .cutv__embed embed {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
}
</style>
<?php
}
add_filter( 'wp_head' , 'cutv__watermark' , 10000 );
function cutv__watermark() {
$act = cutv__get_activation( 'cutv_' );
//_d( $act );
if( $act[ 'act_status' ] == 1 ) {
$licensed = " - License activated by " . $act[ 'buy_user' ] . ".";
} else {
$licensed = " - Not Activated. ";
}
echo "\n <!-- ##cutv_ : WP Video Robot version " . $act[ "act_version" ] . " " . $licensed . "--> \n";
} | erratik/cutv-api | hooks/wpvr.hooks.assets.php | PHP | gpl-2.0 | 14,647 |
package hmod.domain.mkp.scripts;
import flexbuilders.core.BuildException;
import flexbuilders.core.Buildable;
import flexbuilders.scripting.BuildScript;
import flexbuilders.tree.BranchBuilder;
import flexbuilders.tree.TreeHandler;
import static hmod.parser.builders.AlgorithmBuilders.*;
/**
*
* @author Enrique Urra C.
*/
public class RemoveAndGreedyFillScript extends BuildScript
{
private BranchBuilder callLoad, callMultiRemove, callGreedyFill, callSave;
private Buildable loadStart, multiRemoveStart, greedyFillStart, saveStart;
public RemoveAndGreedyFillScript(TreeHandler input) throws BuildException
{
super(input);
callLoad = branch(MKPIds.MKP_HEURISTIC_REMOVE_AND_GREEDY_FILL);
callMultiRemove = branch();
callGreedyFill = branch();
callSave = branch();
loadStart = ref(MKPIds.MKP_LOAD_SOLUTION);
multiRemoveStart = ref(MKPIds.MKP_OPERATION_MULTI_REMOVE);
greedyFillStart = ref(MKPIds.MKP_OPERATION_GREEDY_FILL);
saveStart = ref(MKPIds.MKP_SAVE_SOLUTION);
}
@Override
public void process() throws BuildException
{
callLoad.setBuildable(
subProcessStep().setNextStep(callMultiRemove).
setSubStep(loadStart)
);
callMultiRemove.setBuildable(
subProcessStep().setNextStep(callGreedyFill).
setSubStep(multiRemoveStart)
);
callGreedyFill.setBuildable(
subProcessStep().setNextStep(callSave).
setSubStep(greedyFillStart)
);
callSave.setBuildable(
subProcessStep().
setSubStep(saveStart)
);
}
}
| eurra/hmod-domain-mkp | src/hmod/domain/mkp/scripts/RemoveAndGreedyFillScript.java | Java | gpl-2.0 | 1,721 |
<?php
/**
* Plugin Name: WP useful plugins
* Plugin URI: http://back-end.ir/
* Description: Install the plugins I think are really awesome in one go!
* Version: 1.0
* Author: Masoud Golchin
* Author URI: http://back-end.ir/
* License: GPLv2
*/
function wp_plugins_menu() {
add_menu_page('Useful Plugins', 'Useful Plugins', 'administrator', __FILE__, 'wp_plugins_settings_page');
wp_register_style( 'wp-useful-plugins', plugins_url('/inc/css/main.css',__FILE__));
wp_enqueue_style( 'wp-useful-plugins');
wp_enqueue_script('jquery');
}
add_action('admin_menu', 'wp_plugins_menu');
function wp_plugins_settings_page() {
include 'inc/forms.php';
}
function wp_plugins_ajax(){
header( "Content-Type: application/json" );
WP_Filesystem();
$plugins_dir= plugin_dir_path(__FILE__);
$plugins_dir= preg_replace('/wp-useful-plugins/', '$1', $plugins_dir);
if( isset($_POST) && !empty($_POST)):
foreach($_POST as $value) {
$myplugin[] = $value;
}
// I had no choice :D haha :))
array_pop($myplugin);
$myplugin = implode($myplugin);
$myplugin = explode("=",$myplugin);
array_pop($myplugin);
$myplugin = implode($myplugin);
//echo json_encode($myplugin,true);
$file_address = plugins_url('/inc/js/plugins.json',__FILE__);
$json = file_get_contents($file_address);
if($json):
$myarray = json_decode($json, true);
$myarray = $myarray['plugins'];
foreach( $myarray as $value ) :
if( in_array($myplugin, $value) ):
$dllink = $value['dllink'];
endif;
endforeach;
endif;
$content = file_get_contents($dllink);
$the_plugin = $plugins_dir . basename($dllink);
$zipfile = fopen( $the_plugin , 'wb' );
if( !$zipfile ):
$error_m = 'Error in installation of ' . $myplugin;
echo json_encode($error_m);
else:
fwrite( $zipfile, $content);
fclose($zipfile);
unzip_file($the_plugin,$plugins_dir);
unlink($the_plugin);
$MyMessage = $myplugin . ' installed successfuly.<br />';
echo json_encode($MyMessage);
endif;
endif;
die(1);
}
add_action('wp_ajax_wp_plugins_ajax', 'wp_plugins_ajax');
add_action('wp_ajax_nopriv_wp_plugins_ajax', 'wp_plugins_ajax');
?>
| masoudgolchin/wp-useful-plugins | wp-useful-plugins.php | PHP | gpl-2.0 | 2,311 |
<?php
add_action( 'getnoticed_post_ads', 'getnoticed_post_ads' );
function getnoticed_post_ads( $location ) {
/* do we need an override option?
global $getnoticedMeta;
if ( ! is_array($getnoticedMeta) ) $getnoticedMeta = getnoticed_theme_meta( get_the_ID(), get_post_type() );
if ( ! $getnoticedMeta['postads'] ) return;
*/
$atts = array(
'image' => getnoticed_option("postad-$location-image"),
'url' => getnoticed_option("postad-$location-url"),
'text' => getnoticed_option("postad-$location-text"),
'expire' => getnoticed_option("postad-$location-expire")
);
echo apply_filters( 'getnoticed_filter_post_ads', getnoticed_post_ad( $atts ) );
# Check for post footer
if ( 'bottom' == $location )
echo apply_filters( 'getnoticed_filter_post_footer', getnoticed_option( 'postfooter' ) );
}
function getnoticed_post_ad( $atts ) {
$ad = '';
if ( $atts['image'] || $atts['text'] ) {
# Check for expiration, using GMT
if ( $atts['expire'] ) {
if ( current_time( 'timestamp', true ) > strtotime( $atts['expire'] ) )
return;
}
# Build ad
if ( $atts['image'] )
$ad = sprintf( '<img src="%s" alt="%s">', $atts['image']['url'], $atts['text'] );
elseif ( $atts['text'] )
$ad = $atts['text'];
if ( $atts['url'] )
$ad = sprintf( '<a href="%s" target="_blank">%s</a>', $atts['url'], $ad );
$ad = sprintf( '<div class="getnoticed-postad">%s</div>', $ad );
}
return $ad;
} | drewhagni/evermore | wp-content/themes/getnoticed/inc/post-ads.php | PHP | gpl-2.0 | 1,461 |
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die (__('Please do not load this page directly. Thanks!'));
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.'); ?><p>
<?php
return;
}
}
function wpmobile_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
<?php if ( $comment->comment_approved == '0' ) : ?>
<p><em><?php _e('Your comment is awaiting moderation.'); ?></em></p>
<?php endif; ?>
<?php comment_text() ?>
<p><?php _e('By'); ?> <cite><?php comment_author_link() ?></cite> on <a href="#comment-<?php comment_ID() ?>"><?php comment_date(get_option('date_format')) ?> <?php _e('at'); ?> <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></p>
<?php
}
if ( have_comments() ) : ?>
<h3 id="comments"><?php comments_number(__('No Responses'), __('One Response'), __('% Responses') );?> to “<?php the_title(); ?>”</h3>
<ol class="commentlist">
<?php wp_list_comments(array('callback' => 'wpmobile_comment', 'style' => 'ol')); ?>
</ol>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<h3 id="respond"><?php _e('Leave a Reply'); ?></h3>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo site_url(); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p><?php _e('Logged in as'); ?> <a href="<?php echo site_url(); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo site_url(); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account'); ?>"><?php _e('Logout'); ?> »</a></p>
<?php else : ?>
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) echo "(required)"; ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
<label for="email"><small><?php _e('E-Mail'); ?> <?php if ($req) echo "(required)"; ?></small></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>
<?php endif; ?>
<p><textarea name="comment" id="comment" cols="30" rows="10" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit Comment'); ?>" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
| yondri/newyorkando | wp-content/themes/wp-mobile/comments.php | PHP | gpl-2.0 | 3,248 |
/* File produced by Kranc */
#define KRANC_C
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "GenericFD.h"
#include "Differencing.h"
#include "cctk_Loop.h"
#include "loopcontrol.h"
/* Define macros used in calculations */
#define INITVALUE (42)
#define QAD(x) (SQR(SQR(x)))
#define INV(x) ((1.0) / (x))
#define SQR(x) ((x) * (x))
#define CUB(x) ((x) * (x) * (x))
static void wave_exact_sine_Body(cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[])
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
/* Declare finite differencing variables */
/* Include user-supplied include files */
/* Initialise finite differencing variables */
ptrdiff_t const di = 1;
ptrdiff_t const dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0);
ptrdiff_t const dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0);
ptrdiff_t const cdi = sizeof(CCTK_REAL) * di;
ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj;
ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk;
CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0));
CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1));
CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2));
CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME);
CCTK_REAL const t = ToReal(cctk_time);
CCTK_REAL const dxi = INV(dx);
CCTK_REAL const dyi = INV(dy);
CCTK_REAL const dzi = INV(dz);
CCTK_REAL const khalf = 0.5;
CCTK_REAL const kthird = 1/3.0;
CCTK_REAL const ktwothird = 2.0/3.0;
CCTK_REAL const kfourthird = 4.0/3.0;
CCTK_REAL const keightthird = 8.0/3.0;
CCTK_REAL const hdxi = 0.5 * dxi;
CCTK_REAL const hdyi = 0.5 * dyi;
CCTK_REAL const hdzi = 0.5 * dzi;
/* Initialize predefined quantities */
CCTK_REAL const p1o1 = 1;
CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
CCTK_REAL const p1o2dx = 0.5*INV(dx);
CCTK_REAL const p1o2dy = 0.5*INV(dy);
CCTK_REAL const p1o2dz = 0.5*INV(dz);
CCTK_REAL const p1o4dx2 = 0.25*INV(SQR(dx));
CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy);
CCTK_REAL const p1o4dxdz = 0.25*INV(dx)*INV(dz);
CCTK_REAL const p1o4dy2 = 0.25*INV(SQR(dy));
CCTK_REAL const p1o4dydz = 0.25*INV(dy)*INV(dz);
CCTK_REAL const p1o4dz2 = 0.25*INV(SQR(dz));
CCTK_REAL const p1odx = INV(dx);
CCTK_REAL const p1odx2 = INV(SQR(dx));
CCTK_REAL const p1odxdydz = INV(dx)*INV(dy)*INV(dz);
CCTK_REAL const p1ody = INV(dy);
CCTK_REAL const p1ody2 = INV(SQR(dy));
CCTK_REAL const p1odz = INV(dz);
CCTK_REAL const p1odz2 = INV(SQR(dz));
CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
CCTK_REAL const pm1o2dx = -0.5*INV(dx);
CCTK_REAL const pm1o2dy = -0.5*INV(dy);
CCTK_REAL const pm1o2dz = -0.5*INV(dz);
/* Assign local copies of arrays functions */
/* Calculate temporaries and arrays functions */
/* Copy local copies back to grid functions */
/* Loop over the grid points */
#pragma omp parallel
CCTK_LOOP3 (wave_exact_sine,
i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2],
cctk_lsh[0],cctk_lsh[1],cctk_lsh[2])
{
ptrdiff_t const index = di*i + dj*j + dk*k;
/* Assign local copies of grid functions */
CCTK_REAL xL = x[index];
CCTK_REAL yL = y[index];
CCTK_REAL zL = z[index];
/* Include user supplied include files */
/* Precompute derivatives */
switch(fdOrder)
{
case 2:
break;
case 4:
break;
}
/* Calculate temporaries and grid functions */
CCTK_REAL piconst = 3.1415926535897932385;
CCTK_REAL phiExactL =
Sin(2*piconst*INV(ToReal(periodicity))*(-(cctk_time*sqrt(SQR(ToReal(n1)) +
SQR(ToReal(n2)) + SQR(ToReal(n3)))) + xL*ToReal(n1) + yL*ToReal(n2)
+ zL*ToReal(n3)))*ToReal(amplitude);
CCTK_REAL piExactL =
-2*piconst*Cos(2*piconst*INV(ToReal(periodicity))*(-(cctk_time*sqrt(SQR(ToReal(n1))
+ SQR(ToReal(n2)) + SQR(ToReal(n3)))) + xL*ToReal(n1) +
yL*ToReal(n2) +
zL*ToReal(n3)))*INV(ToReal(periodicity))*sqrt(SQR(ToReal(n1)) +
SQR(ToReal(n2)) + SQR(ToReal(n3)))*ToReal(amplitude);
/* Copy local copies back to grid functions */
phiExact[index] = phiExactL;
piExact[index] = piExactL;
}
CCTK_ENDLOOP3 (wave_exact_sine);
}
extern "C" void wave_exact_sine(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
if (verbose > 1)
{
CCTK_VInfo(CCTK_THORNSTRING,"Entering wave_exact_sine_Body");
}
if (cctk_iteration % wave_exact_sine_calc_every != wave_exact_sine_calc_offset)
{
return;
}
const char *groups[] = {"Wave::exact","grid::coordinates"};
GenericFD_AssertGroupStorage(cctkGH, "wave_exact_sine", 2, groups);
switch(fdOrder)
{
case 2:
break;
case 4:
break;
}
GenericFD_LoopOverEverything(cctkGH, &wave_exact_sine_Body);
if (verbose > 1)
{
CCTK_VInfo(CCTK_THORNSTRING,"Leaving wave_exact_sine_Body");
}
}
| eschnett/Kranc | Examples/Wave/src/wave_exact_sine.cc | C++ | gpl-2.0 | 5,841 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="cs_CZ" version="2.1">
<context>
<name>About</name>
<message>
<location filename="../qml/pages/About.qml" line="25"/>
<source>About</source>
<comment>About page title</comment>
<translation>O programu</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="47"/>
<source>Donations are welcome</source>
<translation>Dary jsou vítány</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="81"/>
<source>You are welcome to contribute to translations</source>
<translation>Budeme vám vděční za pomoc s překladem</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="98"/>
<source>Author %1</source>
<translation>Tvůrce %1</translation>
</message>
</context>
<context>
<name>AddContact</name>
<message>
<location filename="../qml/pages/AddContact.qml" line="24"/>
<source>Add contact</source>
<comment>Add contact page title</comment>
<translation>Přidat kontakt</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="34"/>
<source>Phone number</source>
<comment>Placeholder for phone number in add contact page</comment>
<translation>Telefonní číslo</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="35"/>
<source>Phone number</source>
<comment>Label for phone number in add contact page</comment>
<translation>Telefonní číslo</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="44"/>
<source>First name</source>
<comment>Placeholder for First name in add contact page</comment>
<translation>Jméno</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="45"/>
<source>First name</source>
<comment>Label for First name in add contact page</comment>
<translation>Jméno</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="53"/>
<source>Second name</source>
<comment>Placeholder for second name in add contact page</comment>
<translation>Příjmení</translation>
</message>
<message>
<location filename="../qml/pages/AddContact.qml" line="54"/>
<source>Second name</source>
<comment>Label for second name in add contact page</comment>
<translation>Příjmení</translation>
</message>
</context>
<context>
<name>AddContactsToGroup</name>
<message>
<location filename="../qml/pages/AddContactsToGroup.qml" line="22"/>
<source>Add contacts</source>
<comment>Page title of add contacts to group</comment>
<translation>Přidat kontakty</translation>
</message>
<message>
<location filename="../qml/pages/AddContactsToGroup.qml" line="44"/>
<source>No Contacts</source>
<comment>Placeholder for listview of contact</comment>
<translation>Žádné kontakty</translation>
</message>
</context>
<context>
<name>AddPhoneBook</name>
<message>
<location filename="../qml/pages/AddPhoneBook.qml" line="28"/>
<source>Add contacts</source>
<comment>Page title of phonebook</comment>
<translation>Přidat kontakty</translation>
</message>
<message>
<location filename="../qml/pages/AddPhoneBook.qml" line="120"/>
<source>Search contacts</source>
<comment>Placeholder of search line in phonebook</comment>
<translation>Vyhledat kontakty</translation>
</message>
</context>
<context>
<name>CContactsModel</name>
<message>
<location filename="../src/ccontactmodel.cpp" line="154"/>
<location filename="../src/ccontactmodel.cpp" line="266"/>
<source>Unknown</source>
<translation>Neznámé</translation>
</message>
<message>
<location filename="../src/ccontactmodel.cpp" line="261"/>
<source>Online</source>
<translation>Online</translation>
</message>
<message>
<location filename="../src/ccontactmodel.cpp" line="263"/>
<source>Offline</source>
<translation>Offline</translation>
</message>
</context>
<context>
<name>ContactList</name>
<message>
<location filename="../qml/pages/ContactList.qml" line="10"/>
<source>Contact list</source>
<comment>Page title</comment>
<translation>Seznam kontaktů</translation>
</message>
</context>
<context>
<name>ContactsListView</name>
<message>
<location filename="../qml/pages/common/ContactsListView.qml" line="19"/>
<source>New secret chat</source>
<comment>Pulley menu action</comment>
<translation>Nová soukromá konverzace</translation>
</message>
<message>
<location filename="../qml/pages/common/ContactsListView.qml" line="25"/>
<source>Invite friends</source>
<comment>Pulley menu action</comment>
<translation>Pozvat přátele</translation>
</message>
<message>
<location filename="../qml/pages/common/ContactsListView.qml" line="32"/>
<source>Add contact</source>
<comment>Pulley menu action</comment>
<translation>Přidat kontakt</translation>
</message>
<message>
<location filename="../qml/pages/common/ContactsListView.qml" line="38"/>
<source>Add from phonebook</source>
<comment>Pulley menu action</comment>
<translation>Přidat z mobilního adresáře</translation>
</message>
</context>
<context>
<name>CreateNewGroup</name>
<message>
<location filename="../qml/pages/CreateNewGroup.qml" line="34"/>
<source>Create new group</source>
<comment>Page title</comment>
<translation>Vytvořit novou skupinu</translation>
</message>
<message>
<location filename="../qml/pages/CreateNewGroup.qml" line="43"/>
<source>Choose a name for the group</source>
<comment>Placeholder for text line of group name</comment>
<translation>Vybrat jméno pro skupinu</translation>
</message>
<message>
<location filename="../qml/pages/CreateNewGroup.qml" line="44"/>
<source>Choose a name for the group</source>
<comment>Label for text line of group name</comment>
<translation>Vybrat jméno pro skupinu</translation>
</message>
</context>
<context>
<name>LoadingPage</name>
<message>
<location filename="../qml/pages/LoadingPage.qml" line="33"/>
<source>Connecting...</source>
<comment>Message label for waiting page</comment>
<translation>Připojuji...</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="29"/>
<source>New Broadcast</source>
<comment>Main menu action</comment>
<translation>Nový přenos</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="39"/>
<source>New group chat</source>
<comment>Main menu action</comment>
<translation>Nová skupinová konverzace</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="46"/>
<source>Settings</source>
<comment>Main menu action</comment>
<translation>Nastavení</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="50"/>
<source>Contacts</source>
<comment>Main menu action</comment>
<translation>Kontakty</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="63"/>
<source>No items</source>
<comment>Placeholder for listview of conversation</comment>
<translation>Žádné položky</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="66"/>
<source>jollagram isn't connected</source>
<comment>Page title of conversation for not connected state</comment>
<translation>Jollagram není připojen</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="82"/>
<source>Remove</source>
<comment>Context menu, remove conversation</comment>
<translation>Odstranit</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="82"/>
<source>Wait erasing previous</source>
<comment>Context menu, remove conversation waiting for a previous action</comment>
<translation>Počkejte, mažou se předchozí</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="86"/>
<source>Unmute</source>
<comment>Context menu, unmute conversation</comment>
<translation>Hlasitě</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="86"/>
<source>Mute</source>
<comment>Context menu, mute conversation</comment>
<translation>Tiše</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="101"/>
<source>Deleting</source>
<comment>Delete conversation remorse action text</comment>
<translation>Odstraňuje se</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="193"/>
<source>you</source>
<comment>Name of self-contact in conversation</comment>
<translation>ty</translation>
</message>
</context>
<context>
<name>MessagesView</name>
<message>
<location filename="../qml/pages/conversation/MessagesView.qml" line="167"/>
<source>Deleting</source>
<comment>Remorse action text</comment>
<translation>Odstraňuje se</translation>
</message>
<message>
<location filename="../qml/pages/conversation/MessagesView.qml" line="192"/>
<source>retry message</source>
<comment>Remorse action text</comment>
<translation>Znovu odeslat zprávu</translation>
</message>
<message>
<location filename="../qml/pages/conversation/MessagesView.qml" line="197"/>
<source>copy message</source>
<comment>Remorse action text</comment>
<translation>Kopírovat zprávu</translation>
</message>
<message>
<location filename="../qml/pages/conversation/MessagesView.qml" line="201"/>
<source>delete message</source>
<comment>Remorse action text</comment>
<translation>Smazat zprávu</translation>
</message>
</context>
<context>
<name>OviMapTile</name>
<message>
<location filename="../qml/pages/common/OviMapTile.qml" line="68"/>
<source>latitude: %1</source>
<comment>latitude message received</comment>
<translation>Zeměpisná šířka: %1</translation>
</message>
<message>
<location filename="../qml/pages/common/OviMapTile.qml" line="72"/>
<source>longitude: %1</source>
<comment>longitude message received</comment>
<translation>Zeměpisná délka: %1</translation>
</message>
<message>
<location filename="../qml/pages/common/OviMapTile.qml" line="93"/>
<source>Loading map...</source>
<comment>Placeholder in chat message</comment>
<translation>Načítám mapu...</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="22"/>
<source>Logout, Erase secret and user data</source>
<comment>Pulley menu action</comment>
<translation>Odhlásit, smazat tajná a uživatelská data</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="24"/>
<source>Clearing user data</source>
<comment>Remorse popup from pulley menu</comment>
<translation>Odstraňuji uživatelská data</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="28"/>
<source>About</source>
<translation>O produktu</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="32"/>
<source>Restore Connection</source>
<comment>Pulley menu action</comment>
<translation>Obnovit spojení</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="54"/>
<source>Settings</source>
<comment>Page title</comment>
<translation>Nastavení</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="81"/>
<source>Open chat</source>
<comment>Setting option for chat beavior</comment>
<translation>Otevřená konverzace</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="81"/>
<source>View conversations</source>
<comment>Setting option for chat beavior</comment>
<translation>Zobrazit konverzace</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="82"/>
<source>Behavior of notifications</source>
<comment>Description of setting option for chat beavior</comment>
<translation>Vlastnosti upozornění</translation>
</message>
</context>
<context>
<name>SignIn</name>
<message>
<location filename="../qml/pages/SignIn.qml" line="61"/>
<source>Connecting...</source>
<comment>Message label for waiting page</comment>
<translation>Připojuji...</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="76"/>
<source>Registration</source>
<comment>Page title of signin procedure</comment>
<translation>Registrace</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="86"/>
<source>code recived</source>
<comment>Placeholder of text line for the code received during sign in procedure</comment>
<translation>Kód přijat</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="87"/>
<source>code recived</source>
<comment>Label of text line for the code received during sign in procedure</comment>
<translation>Kód přijat</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="98"/>
<source>Phone number</source>
<comment>Placeholder of text line for sign in procedure</comment>
<translation>Telefonní číslo</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="99"/>
<source>Phone number</source>
<comment>Label of text line for sign in procedure</comment>
<translation>Telefonní číslo</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="108"/>
<source>First name</source>
<comment>Placeholder of text line for sign in procedure</comment>
<translation>Jméno</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="109"/>
<source>First name</source>
<comment>Label of text line for sign in procedure</comment>
<translation>Jméno</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="118"/>
<source>Last name</source>
<comment>Placeholder of text line for sign in procedure</comment>
<translation>Příjmení</translation>
</message>
<message>
<location filename="../qml/pages/SignIn.qml" line="119"/>
<source>Last name</source>
<comment>Label of text line for sign in procedure</comment>
<translation>Příjmení</translation>
</message>
</context>
<context>
<name>TelegramInterface</name>
<message>
<location filename="../src/telegraminterface.cpp" line="309"/>
<source>Registered</source>
<translation>Registrován</translation>
</message>
<message>
<location filename="../src/telegraminterface.cpp" line="309"/>
<source>Not registered</source>
<translation>Neregistrován</translation>
</message>
<message>
<location filename="../src/telegraminterface.cpp" line="310"/>
<source>invited</source>
<translation>Pozván</translation>
</message>
<message>
<location filename="../src/telegraminterface.cpp" line="310"/>
<source>not invited</source>
<translation>Nepozván</translation>
</message>
<message>
<location filename="../src/telegraminterface.cpp" line="591"/>
<location filename="../src/telegraminterface.cpp" line="706"/>
<source>Position received</source>
<translation>Obdržena pozice</translation>
</message>
</context>
</TS> | marco73f/jollagram-translations | harbour-jollagram_cs_CZ.ts | TypeScript | gpl-2.0 | 17,492 |
package trasm;
/**
* Таблица идентификаторов
*/
class IdTable extends AbstractTable {
/**
* Типы идентификаторов
*/
static enum IdType {
DB(1), DW(2), DD(4), LABEL(0);
private int size;
private IdType(int i) {
size = i;
}
/**
* Возвращает тип идентификатора в байтах(для DB,DW,DD)
*
* @return Тип идентификатора
*/
int getSize() {
return size;
}
}
/**
* Добавляет в таблицу новый элемент. Если элемент существует - записывает
* строчку как ошибочную.
*
* @param item Новый элемент
*/
void add(TableItem item) {
if (isExist(item.getName())) {
ErrorList.AddError();
} else {
super.add(item);
}
}
private static IdTable instance = null;
private IdTable() {
}
/**
* Возвращает единственный экземпляр таблицы идентификаторов
*
* @return Таблица идентификаторов
*/
static IdTable getInstance() {
if (instance == null) {
instance = new IdTable();
}
return instance;
}
/**
* Элемент таблицы идентификаторов
*/
static class IdInfo implements TableItem {
private final String name;
private final String segment;
private final int address;
private final IdType type;
/**
* Конструктор элемента таблицы идентификаторов
*
* @param name Имя нового элемента
* @param type Тип нового элемента
*/
public IdInfo(String name, IdType type) {
this.name = name;
this.segment = SegTable.getInstance().getCurrentSegment();
this.address = SegTable.getInstance().getCurrentAddress();
this.type = type;
}
/**
* Возвращает тип идентификатора
*
* @return Тип идентификатора
*/
public IdType getType() {
return type;
}
/**
* Возвращает смещение элемента
*
* @return Смещение элемента
*/
public int getAddress() {
return address;
}
/**
* Возвращает сегмент в котором объявлен элемент
*
* @return Сегмент элемента
*/
public String getSegment() {
return segment;
}
/**
* Возвращает имя элемента
*
* @return Имя элемента
*/
@Override
public String getName() {
return name;
}
/**
* Преобразовывает элемент в удобный для чтения вид
*
* @return Строка для печати
*/
@Override
public String toString() {
return String.format("%1$-8s %2$-8s %3$s:%4$s\n", name, type.toString(), segment, IOLib.toHex(address, 4));
}
}
/**
* Возвращает таблицу идентификторов в удобном для чтения виде
*
* @return Строка для печати
*/
@Override
public String toString() {
StringBuilder outStr;
outStr = new StringBuilder("Ім'я Тип Адреса\n");
for (TableItem tableItem : list) {
outStr = outStr.append(tableItem.toString());
}
return outStr.toString();
}
}
| mchug/trasm | src/trasm/IdTable.java | Java | gpl-2.0 | 4,205 |
<?php
/**
* @file
* @ingroup SMWStore
* @since 1.8
*/
/**
* Class for representing a single (sub)query description. Simple data
* container.
*
* @since 1.8
* @author Markus Krötzsch
* @author Jeroen De Dauw
* @ingroup SMWStore
*/
class SMWSQLStore3Query {
/// Type of empty query without usable condition, dropped as soon as
/// discovered. This is used only during preparing the query (no
/// queries of this type should ever be added).
const Q_NOQUERY = 0;
/// Type of query that is a join with a query (jointable: internal
/// table name; joinfield/components/where use alias.fields;
/// from uses external table names, components interpreted
/// conjunctively (JOIN)).
const Q_TABLE = 1;
/// Type of query that matches a constant value (joinfield is a
/// disjunctive array of unquoted values, jointable empty, components
/// empty).
const Q_VALUE = 2;
/// Type of query that is a disjunction of other queries
/// (joinfield/jointable empty; only components relevant)
const Q_DISJUNCTION = 3;
/// Type of query that is a conjunction of other queries
/// (joinfield/jointable empty; only components relevant).
const Q_CONJUNCTION = 4;
/// Type of query that creates a temporary table of all superclasses
/// of given classes (only joinfield relevant: (disjunctive) array of
/// unquoted values).
const Q_CLASS_HIERARCHY = 5;
/// Type of query that creates a temporary table of all superproperties
/// of given properties (only joinfield relevant: (disjunctive) array
/// of unquoted values).
const Q_PROP_HIERARCHY = 6;
public $type = SMWSQLStore3Query::Q_TABLE;
public $jointable = '';
public $joinfield = '';
public $from = '';
public $where = '';
public $components = array();
/**
* The alias to be used for jointable; read-only after construct!
* @var string
*/
public $alias;
/**
* property dbkey => db field; passed down during query execution.
* @var array
*/
public $sortfields = array();
public $queryNumber;
public static $qnum = 0;
public function __construct() {
$this->queryNumber = self::$qnum;
$this->alias = 't' . self::$qnum;
self::$qnum++;
}
}
/**
* Class that implements query answering for SMWSQLStore3.
* @ingroup SMWStore
*/
class SMWSQLStore3QueryEngine {
/** Database slave to be used */
protected $m_dbs; // TODO: should temporary tables be created on the master DB?
/** Parent SMWSQLStore3. */
protected $m_store;
/** Query mode copied from given query. Some submethods act differently when in SMWQuery::MODE_DEBUG. */
protected $m_qmode;
/** Array of generated SMWSQLStore3Query query descriptions (index => object). */
protected $m_queries = array();
/** Array of arrays of executed queries, indexed by the temporary table names results were fed into. */
protected $m_querylog = array();
/**
* Array of sorting requests ("Property_name" => "ASC"/"DESC"). Used during query
* processing (where these property names are searched while compiling the query
* conditions).
*/
protected $m_sortkeys;
/** Cache of computed hierarchy queries for reuse ("catetgory/property value string" => "tablename"). */
protected $m_hierarchies = array();
/** Local collection of error strings, passed on to callers if possible. */
protected $m_errors = array();
public function __construct( SMWSQLStore3 $parentstore, $dbslave ) {
$this->m_store = $parentstore;
$this->m_dbs = $dbslave;
}
/**
* Refresh the concept cache for the given concept.
*
* @since 1.8
* @param $concept Title
* @return array of error strings (empty if no errors occurred)
*/
public function refreshConceptCache( Title $concept ) {
global $smwgQMaxLimit, $smwgQConceptFeatures, $wgDBtype;
$fname = 'SMW::refreshConceptCache';
$cid = $this->m_store->smwIds->getSMWPageID( $concept->getDBkey(), SMW_NS_CONCEPT, '', '' );
$cid_c = $this->m_store->smwIds->getSMWPageID( $concept->getDBkey(), SMW_NS_CONCEPT, '', '', false );
if ( $cid != $cid_c ) {
$this->m_errors[] = "Skipping redirect concept.";
return $this->m_errors;
}
$values = $this->m_store->getPropertyValues( SMWDIWikiPage::newFromTitle( $concept ), new SMWDIProperty( '_CONC' ) );
$di = end( $values );
$desctxt = ( $di !== false ) ? $di->getConceptQuery() : false;
$this->m_errors = array();
if ( $desctxt ) { // concept found
$this->m_qmode = SMWQuery::MODE_INSTANCES;
$this->m_queries = array();
$this->m_hierarchies = array();
$this->m_querylog = array();
$this->m_sortkeys = array();
SMWSQLStore3Query::$qnum = 0;
// Pre-process query:
$qp = new SMWQueryParser( $smwgQConceptFeatures );
$desc = $qp->getQueryDescription( $desctxt );
$qid = $this->compileQueries( $desc );
if ( $qid < 0 ) {
return;
}
$this->executeQueries( $this->m_queries[$qid] ); // execute query tree, resolve all dependencies
$qobj = $this->m_queries[$qid];
if ( $qobj->joinfield === '' ) {
return;
}
// Update database:
$this->m_dbs->delete( SMWSQLStore3::CONCEPT_CACHE_TABLE, array( 'o_id' => $cid ), $fname );
$smw_conccache = $this->m_dbs->tablename( SMWSQLStore3::CONCEPT_CACHE_TABLE );
if ( $wgDBtype == 'postgres' ) { // PostgresQL: no INSERT IGNORE, check for duplicates explicitly
$where = $qobj->where . ( $qobj->where ? ' AND ' : '' ) .
"NOT EXISTS (SELECT NULL FROM $smw_conccache" .
" WHERE {$smw_conccache}.s_id = {$qobj->alias}.s_id " .
" AND {$smw_conccache}.o_id = {$qobj->alias}.o_id )";
} else { // MySQL just uses INSERT IGNORE, no extra conditions
$where = $qobj->where;
}
$this->m_dbs->query( "INSERT " . ( ( $wgDBtype == 'postgres' ) ? '' : 'IGNORE ' ) .
"INTO $smw_conccache" .
" SELECT DISTINCT {$qobj->joinfield} AS s_id, $cid AS o_id FROM " .
$this->m_dbs->tableName( $qobj->jointable ) . " AS {$qobj->alias}" .
$qobj->from .
( $where ? ' WHERE ' : '' ) . $where . " LIMIT $smwgQMaxLimit",
$fname );
$this->m_dbs->update( 'smw_fpt_conc',
array( 'cache_date' => strtotime( "now" ), 'cache_count' => $this->m_dbs->affectedRows() ),
array( 's_id' => $cid ), $fname );
} else { // no concept found; just delete old data if there is any
$this->m_dbs->delete( SMWSQLStore3::CONCEPT_CACHE_TABLE, array( 'o_id' => $cid ), $fname );
$this->m_dbs->update( 'smw_fpt_conc',
array( 'cache_date' => null, 'cache_count' => null ),
array( 's_id' => $cid ), $fname );
$this->m_errors[] = "No concept description found.";
}
$this->cleanUp();
return $this->m_errors;
}
/**
* Delete the concept cache for the given concept.
*
* @param $concept Title
*/
public function deleteConceptCache( $concept ) {
$cid = $this->m_store->smwIds->getSMWPageID( $concept->getDBkey(), SMW_NS_CONCEPT, '', '', false );
$this->m_dbs->delete( SMWSQLStore3::CONCEPT_CACHE_TABLE, array( 'o_id' => $cid ), 'SMW::refreshConceptCache' );
$this->m_dbs->update( 'smw_fpt_conc', array( 'cache_date' => null, 'cache_count' => null ), array( 's_id' => $cid ), 'SMW::refreshConceptCache' );
}
/**
* The new SQL store's implementation of query answering. This function
* works in two stages: First, the nested conditions of the given query
* object are preprocessed to compute an abstract representation of the
* SQL query that is to be executed. Since query conditions correspond to
* joins with property tables in most cases, this abstract representation
* is essentially graph-like description of how property tables are joined.
* Moreover, this graph is tree-shaped, since all query conditions are
* tree-shaped. Each part of this abstract query structure is represented
* by an SMWSQLStore3Query object in the array m_queries.
*
* As a second stage of processing, the thus prepared SQL query is actually
* executed. Typically, this means that the joins are collapsed into one
* SQL query to retrieve results. In some cases, such as in dbug mode, the
* execution might be restricted and not actually perform the whole query.
*
* The two-stage process helps to separate tasks, and it also allows for
* better optimisations: it is left to the execution engine how exactly the
* query result is to be obtained. For example, one could pre-compute
* partial suib-results in temporary tables (or even cache them somewhere),
* instead of passing one large join query to the DB (of course, it might
* be large only if the configuration of SMW allows it). For some DBMS, a
* step-wise execution of the query might lead to better performance, since
* it exploits the tree-structure of the joins, which is important for fast
* processing -- not all DBMS might be able in seeing this by themselves.
*
* @param SMWQuery $query
*
* @return mixed: depends on $query->querymode
*/
public function getQueryResult( SMWQuery $query ) {
global $smwgIgnoreQueryErrors, $smwgQSortingSupport;
if ( ( !$smwgIgnoreQueryErrors || $query->getDescription() instanceof SMWThingDescription ) &&
$query->querymode != SMWQuery::MODE_DEBUG &&
count( $query->getErrors() ) > 0 ) {
return new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, false );
// NOTE: we check this here to prevent unnecessary work, but we check
// it after query processing below again in case more errors occurred.
} elseif ( $query->querymode == SMWQuery::MODE_NONE ) {
// don't query, but return something to printer
return new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, true );
}
$this->m_qmode = $query->querymode;
$this->m_queries = array();
$this->m_hierarchies = array();
$this->m_querylog = array();
$this->m_errors = array();
SMWSQLStore3Query::$qnum = 0;
$this->m_sortkeys = $query->sortkeys;
// *** First compute abstract representation of the query (compilation) ***//
wfProfileIn( 'SMWSQLStore3Queries::compileMainQuery (SMW)' );
$qid = $this->compileQueries( $query->getDescription() ); // compile query, build query "plan"
wfProfileOut( 'SMWSQLStore3Queries::compileMainQuery (SMW)' );
if ( $qid < 0 ) { // no valid/supported condition; ensure that at least only proper pages are delivered
$qid = SMWSQLStore3Query::$qnum;
$q = new SMWSQLStore3Query();
$q->jointable = SMWSql3SmwIds::tableName;
$q->joinfield = "$q->alias.smw_id";
$q->where = "$q->alias.smw_iw!=" . $this->m_dbs->addQuotes( SMW_SQL3_SMWIW_OUTDATED ) . " AND $q->alias.smw_iw!=" . $this->m_dbs->addQuotes( SMW_SQL3_SMWREDIIW ) . " AND $q->alias.smw_iw!=" . $this->m_dbs->addQuotes( SMW_SQL3_SMWBORDERIW ) . " AND $q->alias.smw_iw!=" . $this->m_dbs->addQuotes( SMW_SQL3_SMWINTDEFIW );
$this->m_queries[$qid] = $q;
}
if ( $this->m_queries[$qid]->jointable != SMWSql3SmwIds::tableName ) {
// manually make final root query (to retrieve namespace,title):
$rootid = SMWSQLStore3Query::$qnum;
$qobj = new SMWSQLStore3Query();
$qobj->jointable = SMWSql3SmwIds::tableName;
$qobj->joinfield = "$qobj->alias.smw_id";
$qobj->components = array( $qid => "$qobj->alias.smw_id" );
$qobj->sortfields = $this->m_queries[$qid]->sortfields;
$this->m_queries[$rootid] = $qobj;
} else { // not such a common case, but worth avoiding the additional inner join:
$rootid = $qid;
}
// Include order conditions (may extend query if needed for sorting):
if ( $smwgQSortingSupport ) {
$this->applyOrderConditions( $rootid );
}
// Possibly stop if new errors happened:
if ( !$smwgIgnoreQueryErrors &&
$query->querymode != SMWQuery::MODE_DEBUG &&
count( $this->m_errors ) > 0 ) {
$query->addErrors( $this->m_errors );
return new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, false );
}
// *** Now execute the computed query ***//
wfProfileIn( 'SMWSQLStore3Queries::executeMainQuery (SMW)' );
$this->executeQueries( $this->m_queries[$rootid] ); // execute query tree, resolve all dependencies
wfProfileOut( 'SMWSQLStore3Queries::executeMainQuery (SMW)' );
switch ( $query->querymode ) {
case SMWQuery::MODE_DEBUG:
$result = $this->getDebugQueryResult( $query, $rootid );
break;
case SMWQuery::MODE_COUNT:
$result = $this->getCountQueryResult( $query, $rootid );
break;
default:
$result = $this->getInstanceQueryResult( $query, $rootid );
break;
}
$this->cleanUp();
$query->addErrors( $this->m_errors );
return $result;
}
/**
* Using a preprocessed internal query description referenced by $rootid, compute
* the proper debug output for the given query.
*
* @param SMWQuery $query
* @param integer $rootid
*
* @return string
*/
protected function getDebugQueryResult( SMWQuery $query, $rootid ) {
$qobj = $this->m_queries[$rootid];
$entries = array();
$sql_options = $this->getSQLOptions( $query, $rootid );
list( $startOpts, $useIndex, $tailOpts ) = $this->m_dbs->makeSelectOptions( $sql_options );
if ( $qobj->joinfield !== '' ) {
$entries['SQL Query'] =
"<tt>SELECT DISTINCT $qobj->alias.smw_title AS t,$qobj->alias.smw_namespace AS ns FROM " .
$this->m_dbs->tableName( $qobj->jointable ) . " AS $qobj->alias" . $qobj->from .
( ( $qobj->where === '' ) ? '':' WHERE ' ) . $qobj->where . "$tailOpts LIMIT " .
$sql_options['LIMIT'] . ' OFFSET ' . $sql_options['OFFSET'] . ';</tt>';
} else {
$entries['SQL Query'] = 'Empty result, no SQL query created.';
}
$auxtables = '';
foreach ( $this->m_querylog as $table => $log ) {
$auxtables .= "<li>Temporary table $table";
foreach ( $log as $q ) {
$auxtables .= "<br />  <tt>$q</tt>";
}
$auxtables .= '</li>';
}
if ( $auxtables ) {
$entries['Auxilliary Tables Used'] = "<ul>$auxtables</ul>";
} else {
$entries['Auxilliary Tables Used'] = 'No auxilliary tables used.';
}
return SMWStore::formatDebugOutput( 'SMWSQLStore3', $entries, $query );
}
/**
* Using a preprocessed internal query description referenced by $rootid, compute
* the proper counting output for the given query.
*
* @param SMWQuery $query
* @param integer $rootid
*
* @return integer
*/
protected function getCountQueryResult( SMWQuery $query, $rootid ) {
wfProfileIn( 'SMWSQLStore3Queries::getCountQueryResult (SMW)' );
$qobj = $this->m_queries[$rootid];
if ( $qobj->joinfield === '' ) { // empty result, no query needed
wfProfileOut( 'SMWSQLStore3Queries::getCountQueryResult (SMW)' );
return 0;
}
$sql_options = array( 'LIMIT' => $query->getLimit() + 1, 'OFFSET' => $query->getOffset() );
$res = $this->m_dbs->select( $this->m_dbs->tableName( $qobj->jointable ) . " AS $qobj->alias" . $qobj->from, "COUNT(DISTINCT $qobj->alias.smw_id) AS count", $qobj->where, 'SMW::getQueryResult', $sql_options );
$row = $this->m_dbs->fetchObject( $res );
$count = $row->count;
$this->m_dbs->freeResult( $res );
wfProfileOut( 'SMWSQLStore3Queries::getCountQueryResult (SMW)' );
return $count;
}
/**
* Using a preprocessed internal query description referenced by $rootid,
* compute the proper result instance output for the given query.
* @todo The SQL standard requires us to select all fields by which we sort, leading
* to wrong results regarding the given limit: the user expects limit to be applied to
* the number of distinct pages, but we can use DISTINCT only to whole rows. Thus, if
* rows contain sortfields, then pages with multiple values for that field are distinct
* and appear multiple times in the result. Filtering duplicates in post processing
* would still allow such duplicates to push aside wanted values, leading to less than
* "limit" results although there would have been "limit" really distinct results. For
* this reason, we select sortfields only for POSTGRES. MySQL is able to perform what
* we want here. It would be nice if we could eliminate the bug in POSTGRES as well.
*
* @param SMWQuery $query
* @param integer $rootid
*
* @return SMWQueryResult
*/
protected function getInstanceQueryResult( SMWQuery $query, $rootid ) {
global $wgDBtype;
wfProfileIn( 'SMWSQLStore3Queries::getInstanceQueryResult (SMW)' );
$qobj = $this->m_queries[$rootid];
if ( $qobj->joinfield === '' ) { // empty result, no query needed
$result = new SMWQueryResult( $query->getDescription()->getPrintrequests(), $query, array(), $this->m_store, false );
wfProfileOut( 'SMWSQLStore3Queries::getInstanceQueryResult (SMW)' );
return $result;
}
$sql_options = $this->getSQLOptions( $query, $rootid );
// Selecting those is required in standard SQL (but MySQL does not require it).
$sortfields = implode( $qobj->sortfields, ',' );
$res = $this->m_dbs->select( $this->m_dbs->tableName( $qobj->jointable ) . " AS $qobj->alias" . $qobj->from,
"DISTINCT $qobj->alias.smw_id AS id,$qobj->alias.smw_title AS t,$qobj->alias.smw_namespace AS ns,$qobj->alias.smw_iw AS iw,$qobj->alias.smw_subobject AS so,$qobj->alias.smw_sortkey AS sortkey" .
( $wgDBtype == 'postgres' ? ( ( $sortfields ? ',' : '' ) . $sortfields ) : '' ),
$qobj->where, 'SMW::getQueryResult', $sql_options );
$qr = array();
$count = 0; // the number of fetched results ( != number of valid results in array $qr)
$prs = $query->getDescription()->getPrintrequests();
$diHandler = $this->m_store->getDataItemHandlerForDIType( SMWDataItem::TYPE_WIKIPAGE );
while ( ( $count < $query->getLimit() ) && ( $row = $this->m_dbs->fetchObject( $res ) ) ) {
if ( $row->iw === '' || $row->iw{0} != ':' ) {
// Catch exception for non-existing predefined properties that
// still registered within non-updated pages (@see bug 48711)
try {
$dataItem = $diHandler->dataItemFromDBKeys( array(
$row->t,
intval( $row->ns ),
$row->iw,
'',
$row->so
) );
} catch ( \SMW\InvalidPredefinedPropertyException $e ) {
wfDebugLog( __CLASS__, __METHOD__ . ': ' . $e->getMessage() );
}
if ( $dataItem instanceof SMWDIWikiPage ) {
$count++;
$qr[] = $dataItem;
// These IDs are usually needed for displaying the page (esp. if more property values are displayed):
$this->m_store->smwIds->setCache( $row->t, $row->ns, $row->iw, $row->so, $row->id, $row->sortkey );
}
}
}
if ( $this->m_dbs->fetchObject( $res ) ) {
$count++;
}
$this->m_dbs->freeResult( $res );
$result = new SMWQueryResult( $prs, $query, $qr, $this->m_store, ( $count > $query->getLimit() ) );
wfProfileOut( 'SMWSQLStore3Queries::getInstanceQueryResult (SMW)' );
return $result;
}
/**
* Create a new SMWSQLStore3Query object that can be used to obtain results
* for the given description. The result is stored in $this->m_queries
* using a numeric key that is returned as a result of the function.
* Returns -1 if no query was created.
* @todo The case of nominal classes (top-level SMWValueDescription) still
* makes some assumptions about the table structure, especially about the
* name of the joinfield (o_id). Better extend
* compilePropertyValueDescription to deal with this case.
*
* @param SMWDescription $description
*
* @return integer
*/
protected function compileQueries( SMWDescription $description ) {
$query = new SMWSQLStore3Query();
if ( $description instanceof SMWSomeProperty ) {
$this->compileSomePropertyDescription( $query, $description );
} elseif ( $description instanceof SMWNamespaceDescription ) {
// TODO: One instance of the SMW IDs table on s_id always suffices (swm_id is KEY)! Doable in execution ... (PERFORMANCE)
$query->jointable = SMWSql3SmwIds::tableName;
$query->joinfield = "$query->alias.smw_id";
$query->where = "$query->alias.smw_namespace=" . $this->m_dbs->addQuotes( $description->getNamespace() );
} elseif ( ( $description instanceof SMWConjunction ) ||
( $description instanceof SMWDisjunction ) ) {
$query->type = ( $description instanceof SMWConjunction ) ? SMWSQLStore3Query::Q_CONJUNCTION : SMWSQLStore3Query::Q_DISJUNCTION;
foreach ( $description->getDescriptions() as $subdesc ) {
$sub = $this->compileQueries( $subdesc );
if ( $sub >= 0 ) {
$query->components[$sub] = true;
}
}
// All subconditions failed, drop this as well.
if ( count( $query->components ) == 0 ) {
$query->type = SMWSQLStore3Query::Q_NOQUERY;
}
} elseif ( $description instanceof SMWClassDescription ) {
$cqid = SMWSQLStore3Query::$qnum;
$cquery = new SMWSQLStore3Query();
$cquery->type = SMWSQLStore3Query::Q_CLASS_HIERARCHY;
$cquery->joinfield = array();
foreach ( $description->getCategories() as $cat ) {
$cid = $this->m_store->smwIds->getSMWPageID( $cat->getDBkey(), NS_CATEGORY, $cat->getInterwiki(), '' );
if ( $cid != 0 ) {
$cquery->joinfield[] = $cid;
}
}
if ( count( $cquery->joinfield ) == 0 ) { // Empty result.
$query->type = SMWSQLStore3Query::Q_VALUE;
$query->jointable = '';
$query->joinfield = '';
} else { // Instance query with disjunction of classes (categories)
$query->jointable = $this->m_dbs->tableName(
$this->m_store->findPropertyTableID(
new SMWDIProperty( '_INST' ) ) );
$query->joinfield = "$query->alias.s_id";
$query->components[$cqid] = "$query->alias.o_id";
$this->m_queries[$cqid] = $cquery;
}
} elseif ( $description instanceof SMWValueDescription ) { // Only type '_wpg' objects can appear on query level (essentially as nominal classes).
if ( $description->getDataItem() instanceof SMWDIWikiPage ) {
if ( $description->getComparator() == SMW_CMP_EQ ) {
$query->type = SMWSQLStore3Query::Q_VALUE;
$oid = $this->m_store->smwIds->getSMWPageID(
$description->getDataItem()->getDBkey(),
$description->getDataItem()->getNamespace(),
$description->getDataItem()->getInterwiki(),
$description->getDataItem()->getSubobjectName() );
$query->joinfield = array( $oid );
} else { // Join with SMW IDs table needed for other comparators (apply to title string).
$query->jointable = SMWSql3SmwIds::tableName;
$query->joinfield = "{$query->alias}.smw_id";
$value = $description->getDataItem()->getSortKey();
switch ( $description->getComparator() ) {
case SMW_CMP_LEQ: $comp = '<='; break;
case SMW_CMP_GEQ: $comp = '>='; break;
case SMW_CMP_LESS: $comp = '<'; break;
case SMW_CMP_GRTR: $comp = '>'; break;
case SMW_CMP_NEQ: $comp = '!='; break;
case SMW_CMP_LIKE: case SMW_CMP_NLKE:
$comp = ' LIKE ';
if ( $description->getComparator() == SMW_CMP_NLKE ) $comp = " NOT{$comp}";
$value = str_replace( array( '%', '_', '*', '?' ), array( '\%', '\_', '%', '_' ), $value );
break;
}
$query->where = "{$query->alias}.smw_sortkey$comp" . $this->m_dbs->addQuotes( $value );
}
}
} elseif ( $description instanceof SMWConceptDescription ) { // fetch concept definition and insert it here
$cid = $this->m_store->smwIds->getSMWPageID( $description->getConcept()->getDBkey(), SMW_NS_CONCEPT, '', '' );
// We bypass the storage interface here (which is legal as we control it, and safe if we are careful with changes ...)
// This should be faster, but we must implement the unescaping that concepts do on getWikiValue()
$row = $this->m_dbs->selectRow(
'smw_fpt_conc',
array( 'concept_txt', 'concept_features', 'concept_size', 'concept_depth', 'cache_date' ),
array( 's_id' => $cid ),
'SMWSQLStore3Queries::compileQueries'
);
if ( $row === false ) { // No description found, concept does not exist.
// keep the above query object, it yields an empty result
// TODO: announce an error here? (maybe not, since the query processor can check for
// non-existing concept pages which is probably the main reason for finding nothing here)
} else {
global $smwgQConceptCaching, $smwgQMaxSize, $smwgQMaxDepth, $smwgQFeatures, $smwgQConceptCacheLifetime;
$may_be_computed = ( $smwgQConceptCaching == CONCEPT_CACHE_NONE ) ||
( ( $smwgQConceptCaching == CONCEPT_CACHE_HARD ) && ( ( ~( ~( $row->concept_features + 0 ) | $smwgQFeatures ) ) == 0 ) &&
( $smwgQMaxSize >= $row->concept_size ) && ( $smwgQMaxDepth >= $row->concept_depth ) );
if ( $row->cache_date &&
( ( $row->cache_date > ( strtotime( "now" ) - $smwgQConceptCacheLifetime * 60 ) ) ||
!$may_be_computed ) ) { // Cached concept, use cache unless it is dead and can be revived.
$query->jointable = SMWSQLStore3::CONCEPT_CACHE_TABLE;
$query->joinfield = "$query->alias.s_id";
$query->where = "$query->alias.o_id=" . $this->m_dbs->addQuotes( $cid );
} elseif ( $row->concept_txt ) { // Parse description and process it recursively.
if ( $may_be_computed ) {
$qp = new SMWQueryParser();
// No defaultnamespaces here; If any, these are already in the concept.
// Unescaping is the same as in SMW_DV_Conept's getWikiValue().
$desc = $qp->getQueryDescription( str_replace( array( '<', '>', '&' ), array( '<', '>', '&' ), $row->concept_txt ) );
$qid = $this->compileQueries( $desc );
if ($qid != -1) {
$query = $this->m_queries[$qid];
} else { // somehow the concept query is no longer valid; maybe some syntax changed (upgrade) or global settings were modified since storing it
$this->m_errors[] = wfMessage( 'smw_emptysubquery' )->text(); // not quite the right message, but this case is very rare; let us not make detailed messages for this
}
} else {
$this->m_errors[] = wfMessage( 'smw_concept_cache_miss', $description->getConcept()->getText() )->text();
}
} // else: no cache, no description (this may happen); treat like empty concept
}
} else { // (e.g. SMWThingDescription)
$query->type = SMWSQLStore3Query::Q_NOQUERY; // no condition
}
$this->registerQuery( $query );
if ( $query->type != SMWSQLStore3Query::Q_NOQUERY ) {
return $query->queryNumber;
} else {
return -1;
}
}
/**
* Register a query object to the internal query list, if the query is
* valid. Also make sure that sortkey information is propagated down
* from subqueries of this query.
*/
protected function registerQuery( SMWSQLStore3Query $query ) {
if ( $query->type != SMWSQLStore3Query::Q_NOQUERY ) {
$this->m_queries[$query->queryNumber] = $query;
// Propagate sortkeys from subqueries:
if ( $query->type != SMWSQLStore3Query::Q_DISJUNCTION ) {
// Sortkeys are killed by disjunctions (not all parts may have them),
// NOTE: preprocessing might try to push disjunctions downwards to safe sortkey, but this seems to be minor
foreach ( $query->components as $cid => $field ) {
$query->sortfields = array_merge( $this->m_queries[$cid]->sortfields, $query->sortfields );
}
}
}
}
/**
* Modify the given query object to account for some property condition for
* the given property. If it is not possible to generate a query for the
* given data, the query type is changed to SMWSQLStore3Query::Q_NOQUERY. Callers need
* to check for this and discard the query in this case.
*
* @note This method does not support sortkey (_SKEY) property queries,
* since they do not have a normal property table. This should not be a
* problem since comparators on sortkeys are supported indirectly when
* using comparators on wikipages. There is no reason to create any
* query with _SKEY ad users cannot do so either (no user label).
*
* @since 1.8
*/
protected function compileSomePropertyDescription( SMWSQLStore3Query $query, SMWSomeProperty $description ) {
$property = $description->getProperty();
$tableid = SMWSQLStore3::findPropertyTableID( $property );
if ( $tableid === '' ) { // Give up
$query->type = SMWSQLStore3Query::Q_NOQUERY;
return;
}
$proptables = SMWSQLStore3::getPropertyTables();
$proptable = $proptables[$tableid];
if ( !$proptable->usesIdSubject() ) {
// no queries with such tables
// (only redirects are affected in practice)
$query->type = SMWSQLStore3Query::Q_NOQUERY;
return;
}
$typeid = $property->findPropertyTypeID();
$diType = SMWDataValueFactory::getDataItemId( $typeid );
if ( $property->isInverse() && $diType != SMWDataItem::TYPE_WIKIPAGE ) {
// can only invert properties that point to pages
$query->type = SMWSQLStore3Query::Q_NOQUERY;
return;
}
$diHandler = $this->m_store->getDataItemHandlerForDIType( $diType );
$indexField = $diHandler->getIndexField();
$sortkey = $property->getKey(); // TODO: strictly speaking, the DB key is not what we want here, since sortkey is based on a "wiki value"
// *** Now construct the query ... ***//
$query->jointable = $proptable->getName();
// *** Add conditions for selecting rows for this property ***//
if ( !$proptable->isFixedPropertyTable() ) {
$pid = $this->m_store->smwIds->getSMWPropertyID( $property );
// Construct property hierarchy:
$pqid = SMWSQLStore3Query::$qnum;
$pquery = new SMWSQLStore3Query();
$pquery->type = SMWSQLStore3Query::Q_PROP_HIERARCHY;
$pquery->joinfield = array( $pid );
$query->components[$pqid] = "{$query->alias}.p_id";
$this->m_queries[$pqid] = $pquery;
// Alternative code without property hierarchies:
// $query->where = "{$query->alias}.p_id=" . $this->m_dbs->addQuotes( $pid );
} // else: no property column, no hierarchy queries
// *** Add conditions on the value of the property ***//
if ( $diType == SMWDataItem::TYPE_WIKIPAGE ) {
$o_id = $indexField;
if ( $property->isInverse() ) {
$s_id = $o_id;
$o_id = 's_id';
} else {
$s_id = 's_id';
}
$query->joinfield = "{$query->alias}.{$s_id}";
// process page description like main query
$sub = $this->compileQueries( $description->getDescription() );
if ( $sub >= 0 ) {
$query->components[$sub] = "{$query->alias}.{$o_id}";
}
if ( array_key_exists( $sortkey, $this->m_sortkeys ) ) {
// TODO: This SMW IDs table is possibly duplicated in the query.
// Example: [[has capital::!Berlin]] with sort=has capital
// Can we prevent that? (PERFORMANCE)
$query->from = ' INNER JOIN ' . $this->m_dbs->tableName( SMWSql3SmwIds::tableName ) .
" AS ids{$query->alias} ON ids{$query->alias}.smw_id={$query->alias}.{$o_id}";
$query->sortfields[$sortkey] = "ids{$query->alias}.smw_sortkey";
}
} else { // non-page value description
$query->joinfield = "{$query->alias}.s_id";
$this->compilePropertyValueDescription( $query, $description->getDescription(), $proptable, $diHandler, 'AND' );
if ( array_key_exists( $sortkey, $this->m_sortkeys ) ) {
$query->sortfields[$sortkey] = "{$query->alias}.{$indexField}";
}
}
}
/**
* Given an SMWDescription that is just a conjunction or disjunction of
* SMWValueDescription objects, create and return a plain WHERE condition
* string for it.
*
* @param $query
* @param SMWDescription $description
* @param SMWSQLStore3Table $proptable
* @param SMWDataItemHandler $diHandler for that table
* @param string $operator SQL operator "AND" or "OR"
*/
protected function compilePropertyValueDescription(
$query, SMWDescription $description, SMWSQLStore3Table $proptable, SMWDataItemHandler $diHandler, $operator ) {
if ( $description instanceof SMWValueDescription ) {
$this->compileValueDescription( $query, $description, $proptable, $diHandler, $operator );
} elseif ( ( $description instanceof SMWConjunction ) ||
( $description instanceof SMWDisjunction ) ) {
$op = ( $description instanceof SMWConjunction ) ? 'AND' : 'OR';
foreach ( $description->getDescriptions() as $subdesc ) {
$this->compilePropertyValueDescription( $query, $subdesc, $proptable, $diHandler, $op );
}
} elseif ( $description instanceof SMWThingDescription ) {
// nothing to do
} else {
throw new MWException( "Cannot process this type of SMWDescription." );
}
}
/**
* Given an SMWDescription that is just a conjunction or disjunction of
* SMWValueDescription objects, create and return a plain WHERE condition
* string for it.
*
* @param $query
* @param SMWDescription $description
* @param SMWSQLStore3Table $proptable
* @param SMWDataItemHandler $diHandler for that table
* @param string $operator SQL operator "AND" or "OR"
*/
protected function compileValueDescription(
$query, SMWValueDescription $description, SMWSQLStore3Table $proptable, SMWDataItemHandler $diHandler, $operator ) {
$where = '';
$dataItem = $description->getDataItem();
// TODO Better get the handle from the property type
// Some comparators (e.g. LIKE) could use DI values of
// a different type; we care about the property table, not
// about the value
$diType = $dataItem->getDIType();
// Try comparison based on value field and comparator,
// but only if no join with SMW IDs table is needed.
if ( $diType != SMWDataItem::TYPE_WIKIPAGE ) {
// Do not support smw_id joined data for now.
// See if the getSQLCondition method exists and call it if this is the case.
if ( method_exists( $description, 'getSQLCondition' ) ) {
$fields = $diHandler->getTableFields();
$where = $description->getSQLCondition( $query->alias, array_keys( $fields ), $this->m_dbs );
}
if ( $where == '' ) {
$indexField = $diHandler->getIndexField();
//Hack to get to the field used as index
$keys = $diHandler->getWhereConds( $dataItem );
$value = $keys[$indexField];
switch ( $description->getComparator() ) {
case SMW_CMP_EQ: $comparator = '='; break;
case SMW_CMP_LESS: $comparator = '<'; break;
case SMW_CMP_GRTR: $comparator = '>'; break;
case SMW_CMP_LEQ: $comparator = '<='; break;
case SMW_CMP_GEQ: $comparator = '>='; break;
case SMW_CMP_NEQ: $comparator = '!='; break;
case SMW_CMP_LIKE: case SMW_CMP_NLKE:
if ( $description->getComparator() == SMW_CMP_LIKE ) {
$comparator = ' LIKE ';
} else {
$comparator = ' NOT LIKE ';
}
// Escape to prepare string matching:
$value = str_replace( array( '%', '_', '*', '?' ), array( '\%', '\_', '%', '_' ), $value );
break;
default:
throw new MWException( "Unsupported comparator '" . $description->getComparator() . "' in query condition." );
}
$where = "$query->alias.{$indexField}{$comparator}" . $this->m_dbs->addQuotes( $value );
}
} else { // exact match (like comparator = above, but not using $valueField
throw new MWException("Debug -- this code might be dead.");
foreach ( $diHandler->getWhereConds( $dataItem ) as $fieldname => $value ) {
$where .= ( $where ? ' AND ' : '' ) . "{$query->alias}.$fieldname=" . $this->m_dbs->addQuotes( $value );
}
}
if ( $where !== '' ) {
$query->where .= ( $query->where ? " $operator " : '' ) . "($where)";
}
}
/**
* Process stored queries and change store accordingly. The query obj is modified
* so that it contains non-recursive description of a select to execute for getting
* the actual result.
*
* @param SMWSQLStore3Query $query
*/
protected function executeQueries( SMWSQLStore3Query &$query ) {
global $wgDBtype;
switch ( $query->type ) {
case SMWSQLStore3Query::Q_TABLE: // Normal query with conjunctive subcondition.
foreach ( $query->components as $qid => $joinfield ) {
$subquery = $this->m_queries[$qid];
$this->executeQueries( $subquery );
if ( $subquery->jointable !== '' ) { // Join with jointable.joinfield
$query->from .= ' INNER JOIN ' . $this->m_dbs->tableName( $subquery->jointable ) . " AS $subquery->alias ON $joinfield=" . $subquery->joinfield;
} elseif ( $subquery->joinfield !== '' ) { // Require joinfield as "value" via WHERE.
$condition = '';
foreach ( $subquery->joinfield as $value ) {
$condition .= ( $condition ? ' OR ':'' ) . "$joinfield=" . $this->m_dbs->addQuotes( $value );
}
if ( count( $subquery->joinfield ) > 1 ) {
$condition = "($condition)";
}
$query->where .= ( ( $query->where === '' ) ? '':' AND ' ) . $condition;
} else { // interpret empty joinfields as impossible condition (empty result)
$query->joinfield = ''; // make whole query false
$query->jointable = '';
$query->where = '';
$query->from = '';
break;
}
if ( $subquery->where !== '' ) {
$query->where .= ( ( $query->where === '' ) ? '':' AND ' ) . '(' . $subquery->where . ')';
}
$query->from .= $subquery->from;
}
$query->components = array();
break;
case SMWSQLStore3Query::Q_CONJUNCTION:
// pick one subquery with jointable as anchor point ...
reset( $query->components );
$key = false;
foreach ( $query->components as $qkey => $qid ) {
if ( $this->m_queries[$qkey]->jointable !== '' ) {
$key = $qkey;
break;
}
}
if ( $key !== false ) {
$result = $this->m_queries[$key];
unset( $query->components[$key] );
// Execute it first (may change jointable and joinfield, e.g. when making temporary tables)
$this->executeQueries( $result );
// ... and append to this query the remaining queries.
foreach ( $query->components as $qid => $joinfield ) {
$result->components[$qid] = $result->joinfield;
}
// Second execute, now incorporating remaining conditions.
$this->executeQueries( $result );
} else { // Only fixed values in conjunction, make a new value without joining.
$key = $qkey;
$result = $this->m_queries[$key];
unset( $query->components[$key] );
foreach ( $query->components as $qid => $joinfield ) {
if ( $result->joinfield != $this->m_queries[$qid]->joinfield ) {
$result->joinfield = ''; // all other values should already be ''
break;
}
}
}
$query = $result;
break;
case SMWSQLStore3Query::Q_DISJUNCTION:
if ( $this->m_qmode !== SMWQuery::MODE_DEBUG ) {
$this->m_dbs->query( $this->getCreateTempIDTableSQL( $this->m_dbs->tableName( $query->alias ) ), 'SMW::executeQueries' );
}
$this->m_querylog[$query->alias] = array();
foreach ( $query->components as $qid => $joinfield ) {
$subquery = $this->m_queries[$qid];
$this->executeQueries( $subquery );
$sql = '';
if ( $subquery->jointable !== '' ) {
$sql = 'INSERT ' . ( ( $wgDBtype == 'postgres' ) ? '':'IGNORE ' ) . 'INTO ' .
$this->m_dbs->tableName( $query->alias ) .
" SELECT $subquery->joinfield FROM " . $this->m_dbs->tableName( $subquery->jointable ) .
" AS $subquery->alias $subquery->from" . ( $subquery->where ? " WHERE $subquery->where":'' );
} elseif ( $subquery->joinfield !== '' ) {
// NOTE: this works only for single "unconditional" values without further
// WHERE or FROM. The execution must take care of not creating any others.
$values = '';
foreach ( $subquery->joinfield as $value ) {
$values .= ( $values ? ',' : '' ) . '(' . $this->m_dbs->addQuotes( $value ) . ')';
}
$sql = 'INSERT ' . ( ( $wgDBtype == 'postgres' ) ? '':'IGNORE ' ) . 'INTO ' . $this->m_dbs->tableName( $query->alias ) . " (id) VALUES $values";
} // else: // interpret empty joinfields as impossible condition (empty result), ignore
if ( $sql ) {
$this->m_querylog[$query->alias][] = $sql;
if ( $this->m_qmode !== SMWQuery::MODE_DEBUG ) {
$this->m_dbs->query( $sql , 'SMW::executeQueries' );
}
}
}
$query->jointable = $query->alias;
$query->joinfield = "$query->alias.id";
$query->sortfields = array(); // Make sure we got no sortfields.
// TODO: currently this eliminates sortkeys, possibly keep them (needs different temp table format though, maybe not such a good thing to do)
break;
case SMWSQLStore3Query::Q_PROP_HIERARCHY:
case SMWSQLStore3Query::Q_CLASS_HIERARCHY: // make a saturated hierarchy
$this->executeHierarchyQuery( $query );
break;
case SMWSQLStore3Query::Q_VALUE: break; // nothing to do
}
}
/**
* Find subproperties or subcategories. This may require iterative computation,
* and temporary tables are used in many cases.
*
* @param SMWSQLStore3Query $query
*/
protected function executeHierarchyQuery( SMWSQLStore3Query &$query ) {
global $wgDBtype, $smwgQSubpropertyDepth, $smwgQSubcategoryDepth;
$fname = "SMWSQLStore3Queries::executeQueries-hierarchy-{$query->type} (SMW)";
wfProfileIn( $fname );
$depth = ( $query->type == SMWSQLStore3Query::Q_PROP_HIERARCHY ) ? $smwgQSubpropertyDepth : $smwgQSubcategoryDepth;
if ( $depth <= 0 ) { // treat as value, no recursion
$query->type = SMWSQLStore3Query::Q_VALUE;
wfProfileOut( $fname );
return;
}
$values = '';
$valuecond = '';
foreach ( $query->joinfield as $value ) {
$values .= ( $values ? ',':'' ) . '(' . $this->m_dbs->addQuotes( $value ) . ')';
$valuecond .= ( $valuecond ? ' OR ':'' ) . 'o_id=' . $this->m_dbs->addQuotes( $value );
}
$propertyKey = ( $query->type == SMWSQLStore3Query::Q_PROP_HIERARCHY ) ? '_SUBP' : '_SUBC';
$smwtable = $this->m_dbs->tableName(
$this->m_store->findPropertyTableID( new SMWDIProperty( $propertyKey ) ) );
// Try to safe time (SELECT is cheaper than creating/dropping 3 temp tables):
$res = $this->m_dbs->select( $smwtable, 's_id', $valuecond, __METHOD__, array( 'LIMIT' => 1 ) );
if ( !$this->m_dbs->fetchObject( $res ) ) { // no subobjects, we are done!
$this->m_dbs->freeResult( $res );
$query->type = SMWSQLStore3Query::Q_VALUE;
wfProfileOut( $fname );
return;
}
$this->m_dbs->freeResult( $res );
$tablename = $this->m_dbs->tableName( $query->alias );
$this->m_querylog[$query->alias] = array( "Recursively computed hierarchy for element(s) $values." );
$query->jointable = $query->alias;
$query->joinfield = "$query->alias.id";
if ( $this->m_qmode == SMWQuery::MODE_DEBUG ) {
wfProfileOut( $fname );
return; // No real queries in debug mode.
}
$this->m_dbs->query( $this->getCreateTempIDTableSQL( $tablename ), 'SMW::executeHierarchyQuery' );
if ( array_key_exists( $values, $this->m_hierarchies ) ) { // Just copy known result.
$this->m_dbs->query( "INSERT INTO $tablename (id) SELECT id" .
' FROM ' . $this->m_hierarchies[$values],
'SMW::executeHierarchyQuery' );
wfProfileOut( $fname );
return;
}
// NOTE: we use two helper tables. One holds the results of each new iteration, one holds the
// results of the previous iteration. One could of course do with only the above result table,
// but then every iteration would use all elements of this table, while only the new ones
// obtained in the previous step are relevant. So this is a performance measure.
$tmpnew = 'smw_new';
$tmpres = 'smw_res';
$this->m_dbs->query( $this->getCreateTempIDTableSQL( $tmpnew ), 'SMW::executeQueries' );
$this->m_dbs->query( $this->getCreateTempIDTableSQL( $tmpres ), 'SMW::executeQueries' );
$this->m_dbs->query( "INSERT " . ( ( $wgDBtype == 'postgres' ) ? "" : "IGNORE" ) . " INTO $tablename (id) VALUES $values", 'SMW::executeHierarchyQuery' );
$this->m_dbs->query( "INSERT " . ( ( $wgDBtype == 'postgres' ) ? "" : "IGNORE" ) . " INTO $tmpnew (id) VALUES $values", 'SMW::executeHierarchyQuery' );
for ( $i = 0; $i < $depth; $i++ ) {
$this->m_dbs->query( "INSERT " . ( ( $wgDBtype == 'postgres' ) ? '' : 'IGNORE ' ) . "INTO $tmpres (id) SELECT s_id" . ( $wgDBtype == 'postgres' ? '::integer':'' ) . " FROM $smwtable, $tmpnew WHERE o_id=id",
'SMW::executeHierarchyQuery' );
if ( $this->m_dbs->affectedRows() == 0 ) { // no change, exit loop
break;
}
$this->m_dbs->query( "INSERT " . ( ( $wgDBtype == 'postgres' ) ? '' : 'IGNORE ' ) . "INTO $tablename (id) SELECT $tmpres.id FROM $tmpres",
'SMW::executeHierarchyQuery' );
if ( $this->m_dbs->affectedRows() == 0 ) { // no change, exit loop
break;
}
$this->m_dbs->query( 'TRUNCATE TABLE ' . $tmpnew, 'SMW::executeHierarchyQuery' ); // empty "new" table
$tmpname = $tmpnew;
$tmpnew = $tmpres;
$tmpres = $tmpname;
}
$this->m_hierarchies[$values] = $tablename;
$this->m_dbs->query( ( ( $wgDBtype == 'postgres' ) ? 'DROP TABLE IF EXISTS smw_new' : 'DROP TEMPORARY TABLE smw_new' ), 'SMW::executeHierarchyQuery' );
$this->m_dbs->query( ( ( $wgDBtype == 'postgres' ) ? 'DROP TABLE IF EXISTS smw_res' : 'DROP TEMPORARY TABLE smw_res' ), 'SMW::executeHierarchyQuery' );
wfProfileOut( $fname );
}
/**
* This function modifies the given query object at $qid to account for all ordering conditions
* in the SMWQuery $query. It is always required that $qid is the id of a query that joins with
* SMW IDs table so that the field alias.smw_title is $available for default sorting.
*
* @param integer $qid
*/
protected function applyOrderConditions( $qid ) {
$qobj = $this->m_queries[$qid];
// (1) collect required extra property descriptions:
$extraproperties = array();
foreach ( $this->m_sortkeys as $propkey => $order ) {
if ( !array_key_exists( $propkey, $qobj->sortfields ) ) { // Find missing property to sort by.
if ( $propkey === '' ) { // Sort by first result column (page titles).
$qobj->sortfields[$propkey] = "$qobj->alias.smw_sortkey";
} else { // Try to extend query.
$sortprop = SMWPropertyValue::makeUserProperty( $propkey );
if ( $sortprop->isValid() ) {
$extraproperties[] = new SMWSomeProperty( $sortprop->getDataItem(), new SMWThingDescription() );
}
}
}
}
// (2) compile according conditions and hack them into $qobj:
if ( count( $extraproperties ) > 0 ) {
$desc = new SMWConjunction( $extraproperties );
$newqid = $this->compileQueries( $desc );
$newqobj = $this->m_queries[$newqid]; // This is always an SMWSQLStore3Query::Q_CONJUNCTION ...
foreach ( $newqobj->components as $cid => $field ) { // ... so just re-wire its dependencies
$qobj->components[$cid] = $qobj->joinfield;
$qobj->sortfields = array_merge( $qobj->sortfields, $this->m_queries[$cid]->sortfields );
}
$this->m_queries[$qid] = $qobj;
}
}
/**
* Get a SQL option array for the given query and preprocessed query object at given id.
*
* @param SMWQuery $query
* @param integer $rootid
*/
protected function getSQLOptions( SMWQuery $query, $rootid ) {
global $smwgQSortingSupport, $smwgQRandSortingSupport;
$result = array( 'LIMIT' => $query->getLimit() + 1, 'OFFSET' => $query->getOffset() );
// Build ORDER BY options using discovered sorting fields.
if ( $smwgQSortingSupport ) {
$qobj = $this->m_queries[$rootid];
foreach ( $this->m_sortkeys as $propkey => $order ) {
if ( ( $order != 'RANDOM' ) && array_key_exists( $propkey, $qobj->sortfields ) ) { // Field was successfully added.
$result['ORDER BY'] = ( array_key_exists( 'ORDER BY', $result ) ? $result['ORDER BY'] . ', ' : '' ) . $qobj->sortfields[$propkey] . " $order ";
} elseif ( ( $order == 'RANDOM' ) && $smwgQRandSortingSupport ) {
$result['ORDER BY'] = ( array_key_exists( 'ORDER BY', $result ) ? $result['ORDER BY'] . ', ' : '' ) . ' RAND() ';
}
}
}
return $result;
}
/**
* After querying, make sure no temporary database tables are left.
* @todo I might be better to keep the tables and possibly reuse them later
* on. Being temporary, the tables will vanish with the session anyway.
*/
protected function cleanUp() {
global $wgDBtype;
if ( $this->m_qmode !== SMWQuery::MODE_DEBUG ) {
foreach ( $this->m_querylog as $table => $log ) {
$this->m_dbs->query( ( ( $wgDBtype == 'postgres' ) ? "DROP TABLE IF EXISTS ":"DROP TEMPORARY TABLE " ) . $this->m_dbs->tableName( $table ), 'SMW::getQueryResult' );
}
}
}
/**
* Get SQL code suitable to create a temporary table of the given name, used to store ids.
* MySQL can do that simply by creating new temporary tables. PostgreSQL first checks if such
* a table exists, so the code is ready to reuse existing tables if the code was modified to
* keep them after query answering. Also, PostgreSQL tables will use a RULE to achieve built-in
* duplicate elimination. The latter is done using INSERT IGNORE in MySQL.
*
* @param string $tablename
*/
protected function getCreateTempIDTableSQL( $tablename ) {
global $wgDBtype;
if ( $wgDBtype == 'postgres' ) { // PostgreSQL: no memory tables, use RULE to emulate INSERT IGNORE
return "CREATE OR REPLACE FUNCTION create_" . $tablename . "() RETURNS void AS "
. "$$ "
. "BEGIN "
. " IF EXISTS(SELECT NULL FROM pg_tables WHERE tablename='" . $tablename . "' AND schemaname = ANY (current_schemas(true))) "
. " THEN DELETE FROM " . $tablename . "; "
. " ELSE "
. " CREATE TEMPORARY TABLE " . $tablename . " (id INTEGER PRIMARY KEY); "
. " CREATE RULE " . $tablename . "_ignore AS ON INSERT TO " . $tablename . " WHERE (EXISTS (SELECT NULL FROM " . $tablename
. " WHERE (" . $tablename . ".id = new.id))) DO INSTEAD NOTHING; "
. " END IF; "
. "END; "
. "$$ "
. "LANGUAGE 'plpgsql'; "
. "SELECT create_" . $tablename . "(); ";
} else { // MySQL_ just a temporary table, use INSERT IGNORE later
return "CREATE TEMPORARY TABLE " . $tablename . "( id INT UNSIGNED KEY ) ENGINE=MEMORY";
}
}
}
| JeroenDeDauw/SemanticMediaWiki | includes/storage/SQLStore/SMW_SQLStore3_Queries.php | PHP | gpl-2.0 | 49,492 |
<?php
/*
Plugin Name: WP User Control
Plugin URI: http://palmspark.com/wordpress-user-control/
Version: 1.5.1
Author: Bill Edgar
Author URI: http://palmspark.com
Text Domain: wp-uc-widget
Description: WP User Control adds a sidebar widget that allows a user to login, register, retrieve lost passwords, etc. without leaving a page/post within your site.
Package: wp-uc-widget
License: BSD New (3-CLause License)
Copyright (c) 2012, PalmSpark LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Oakton Data LLC nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Oakton Data LLC BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// define constants
define( 'WP_USER_CONTROL_WIDGET_VERSION', '1.5.1' );
define( 'WP_USER_CONTROL_WIDGET_BASE_URL', network_site_url() );
// directory locations
define( 'WP_USER_CONTROL_WIDGET_DIR', plugin_dir_url(__FILE__) );
define( 'WP_USER_CONTROL_PLUGIN_DIR', basename( dirname( __FILE__ ) ) );
define( 'WP_USER_CONTROL_WIDGET_CSS', WP_USER_CONTROL_WIDGET_DIR . 'css/' );
define( 'WP_USER_CONTROL_WIDGET_WP_INCLUDES', ABSPATH . WPINC );
define( 'WP_USER_CONTROL_WIDGET_INCLUDES', dirname(__FILE__) . '/' . 'inc/' );
define( 'WP_USER_CONTROL_WIDGET_JS', WP_USER_CONTROL_WIDGET_DIR . 'js/' );
define( 'WP_USER_CONTROL_WIDGET_HTML', WP_USER_CONTROL_WIDGET_DIR . 'html/' );
// php class files
define( 'WP_USER_CONTROL_WIDGET_SIDEBAR_CLASS', 'SidebarWidget' );
define( 'WP_USER_CONTROL_WIDGET_CLASS', 'WPUserControlWidget' );
define( 'WP_USER_CONTROL_WIDGET_EXCEPTION_CLASS', 'Exception' );
define( 'WP_USER_CONTROL_WIDGET_UTILITIES_CLASS', 'Utilities' );
// definition and configuration files
define( 'WP_USER_CONTROL_WIDGET_STYLE', 'style.css' );
// generic include method
function wp_uc__autoinclude( $class_name ) {
try {
include_once( WP_USER_CONTROL_WIDGET_INCLUDES . $class_name . '.php' );
} catch ( Exception $e ) {
echo "<p>" . $e->getMessage() . "</p>";
exit();
}
}
// generic getter method
function wp_uc__get( $property, $obj ) { // generic getter
if ( array_key_exists( $property, get_class_vars( get_class( $obj ) ) ) ) {
return $obj->$property;
} else {
die("<p>$property does not exist in " . get_class( $obj ) . "</p>");
}
}
// generic setter method
function wp_uc__set( $property, $value, $obj ) { // generic setter
if ( array_key_exists( $property, get_class_vars( get_class( $obj ) ) ) ) {
$obj->$property = $value;
} else {
die( "<p>$property does not exist in " . get_class( $obj ) . "</p>" );
}
}
// generic toString method
function wp_uc__toString( $obj ) { // generic object toString
$attributes = get_class_vars( get_class( $obj ) );
$str = 'Class = ' . get_class( $obj ) . '\n';
foreach ( $attributes as $name => $value ) {
$str .= $name . ' = ' . $value . '\n';
}
return $str;
}
// count images for the current user
function count_user_images( $userid , $post_type = 'images' ) {
global $wpdb;
$where = get_posts_by_author_sql( $post_type, true, $userid );
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
return apply_filters( 'get_usernumposts', $count, $userid );
}
// count videos for the current user
function count_user_videos( $userid , $post_type = 'videos' ) {
global $wpdb;
$where = get_posts_by_author_sql( $post_type, true, $userid );
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
return apply_filters( 'get_usernumposts', $count, $userid );
}
if ( !class_exists( 'wp_uc_widget' ) ) {
// wp_uc_widget class
class wp_uc_widget {
// public constructor method
function wp_uc_widget() {
$this->__construct();
}
// hidden constructor method
function __construct() {
wp_uc__autoinclude( WP_USER_CONTROL_WIDGET_EXCEPTION_CLASS );
wp_uc__autoinclude( WP_USER_CONTROL_WIDGET_SIDEBAR_CLASS ); // must be loaded first... base class
wp_uc__autoinclude( WP_USER_CONTROL_WIDGET_UTILITIES_CLASS );
wp_uc__autoinclude( WP_USER_CONTROL_WIDGET_CLASS );
wp_uc__autoinclude( WP_USER_CONTROL_WIDGET_CLASS );
try {
$this->include_wp_functions();
} catch ( wp_pluginException $e ) {
echo $e->getError();
die( '<p>WP User Control ' . __( 'exiting.' ) . '</p>' );
}
// add action hook for output of jquery.sparkline script
add_action(
$tag = 'wp_loaded',
$callback = array( &$this, 'loadScripts' ),
$priority = 10
);
// add action hook for loading of plugin text domain and language files
add_action(
$tag = 'plugins_loaded',
$callback = array( &$this, 'loadText' ),
$priority = 10
);
// verify we're on admin pages
if ( is_admin() ) {
// runs when plugin is activated
register_activation_hook( __FILE__, array( &$this, 'activate' ) );
// runs when plugin is deactivated
register_deactivation_hook( __FILE__, array( &$this, 'deactivate' ) );
}
}
// activate method
function activate() {
// call setup function
$this->setup();
}
// deactivate method
function deactivate() {
// remove action and filter hooks
remove_action(
$tag = 'wp_login_failed',
$function_to_remove = 'wp_user_control_login_fail_action',
$priority = 10,
$accepted_args = 1
); // remove action hook for failed login
remove_filter(
$tag = 'registration_errors',
$function_to_remove = 'wp_user_control_registration_errors_filter',
$priority = 10,
$accepted_args = 3
); // remove filter for registration errors
remove_filter(
$tag = 'login_url',
$function_to_remove = 'wp_user_control_login_url_filter',
$priority = 10,
$accepted_args = 2
); // remove filter for custom login url
remove_filter(
$tag = 'wp_mail_from',
$function_to_remove = 'wp_user_control_mail_from_filter',
$priority = 10,
$accepted_args = 1
); // remove filter for custom mail from address
remove_filter(
$tag = 'wp_mail_from_name',
$function_to_remove = 'wp_user_control_mail_from_name_filter',
$priority = 10,
$accepted_args = 1
); // remove filter for custom mail from name
}
function include_wp_functions() {
// check for theme.php file existence
if ( is_file( WP_USER_CONTROL_WIDGET_WP_INCLUDES . '/registration.php' ) ) {
// check for get_page_templates function existence
if ( !function_exists( 'username_exists' ) || !function_exists( 'email_exists' ) ) {
// include get_page_templates function if necessary
if ( !include_once( WP_USER_CONTROL_WIDGET_WP_INCLUDES . '/registration.php' ) ) { // for WP get_page_templates function
throw new wp_PluginException( 'WP username_exists or email_exists function INCLUDE failed.</p>' );
}
}
// otherwise path is incorrect, throw error
} else {
throw new wp_PluginException( WP_USER_CONTROL_WIDGET_WP_INCLUDES . '/registration.php file not found.' );
}
}
function loadScripts() {
// register script with wordpress
wp_register_script(
$handle = 'wp-user-control-widget',
$src = WP_USER_CONTROL_WIDGET_JS . 'wp-user-control-widget.js',
$deps = array( 'jquery' ),
$ver = WP_USER_CONTROL_WIDGET_VERSION,
$in_footer = false
);
// print script
wp_enqueue_script( $handle = 'wp-user-control-widget' );
} // end method loadScripts
function loadText() {
// load plugin text domain
load_plugin_textdomain(
$domain = 'wp-user-control',
$abs_rel_path = false,
$plugin_rel_path = WP_USER_CONTROL_PLUGIN_DIR . '/languages/'
);
}
// setup method
function setup() {
}
// uninstall method
function uninstall() {
if ( !defined( 'ABSPATH' ) || !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
}
// validate method
function validate( $rawinput ) {
return $rawinput;
}
}
} // end class wp_uc_widget
// instantiate new wp_uc_widget object
if ( class_exists( 'wp_uc_widget' ) ) {
new wp_uc_widget();
}
?> | denoramco/ohmybike | wp-content/plugins/wp-user-control/wp_uc_widget.php | PHP | gpl-2.0 | 9,257 |
/**
* Lists the number of different characters
*/
/* global document: true, Node: true, window: true */
exports.version = '1.0';
exports.module = function(phantomas) {
'use strict';
//phantomas.setMetric('differentCharacters'); // @desc the number of different characters in the body @offenders
phantomas.on('report', function() {
phantomas.log("charactersCount: starting to analyze characters on page...");
phantomas.evaluate(function() {
(function(phantomas) {
phantomas.spyEnabled(false, 'analyzing characters on page');
function getLetterCount(arr){
return arr.reduce(function(prev, next){
prev[next] = 1;
return prev;
}, {});
}
if (document.body && document.body.textContent) {
var allText = '';
// Traverse all DOM Tree to read text
var runner = new phantomas.nodeRunner();
runner.walk(document.body, function(node, depth) {
switch (node.nodeType) {
// Grabing text nodes
case Node.TEXT_NODE:
if (node.parentNode.tagName !== 'SCRIPT' && node.parentNode.tagName !== 'STYLE') {
allText += node.nodeValue;
}
break;
// Grabing CSS content properties
case Node.ELEMENT_NODE:
if (node.tagName !== 'SCRIPT' && node.tagName !== 'STYLE') {
allText += window.getComputedStyle(node).getPropertyValue('content');
allText += window.getComputedStyle(node, ':before').getPropertyValue('content');
allText += window.getComputedStyle(node, ':after').getPropertyValue('content');
}
break;
}
});
// Reduce all text found in page into a string of unique chars
var charactersList = getLetterCount(allText.split(''));
var charsetString = Object.keys(charactersList).sort().join('');
// Remove blank characters
charsetString = charsetString.replace(/\s/g, '');
phantomas.setMetric('differentCharacters', charsetString.length);
phantomas.addOffender('differentCharacters', charsetString);
}
phantomas.spyEnabled(true);
}(window.__phantomas));
});
phantomas.log("charactersCount: analyzing characters done.");
});
};
| gmetais/YellowLabTools | lib/tools/phantomas/custom_modules/modules/charactersCount/charactersCount.js | JavaScript | gpl-2.0 | 2,928 |
#include "Feed.h"
Feed::Feed(QObject *parent) :
QObject(parent)
{
}
| Streon/Janus_RSS | RSS_Translator/Entities/Feed.cpp | C++ | gpl-2.0 | 74 |