answer
stringlengths 15
1.25M
|
|---|
var icms = icms || {};
icms.wall = (function ($) {
var self = this;
this.add = function (parent_id) {
var form = $('#wall_add_form');
if (typeof (parent_id) === 'undefined') {
parent_id = 0;
}
$('#wall_widget #wall_add_link').show();
$('#wall_widget #entries_list .links *').removeClass('disabled');
if (parent_id == 0){
$('#wall_widget #wall_add_link').hide();
form.detach().prependTo('#wall_widget #entries_list');
} else {
$('#wall_widget #entries_list #entry_'+parent_id+' > .media-body > .links .reply').addClass('disabled');
form.detach().appendTo('#wall_widget #entries_list #entry_'+parent_id+' > .media-body');
}
form.show();
$('input[name=parent_id]', form).val(parent_id);
$('input[name=id]', form).val('');
$('input[name=action]', form).val('add');
$('input[name=submit]', form).val( LANG_SEND );
icms.forms.wysiwygInit('content').wysiwygInsertText('content', '');
return false;
};
this.submit = function (action) {
var form = $('#wall_add_form form');
var form_data = icms.forms.toJSON( form );
var url = form.attr('action');
if (action) {form_data.action = action;}
$('.buttons > *', form).addClass('disabled');
$('.button-'+form_data.action, form).addClass('is-busy');
$('textarea', form).prop('disabled', true);
$.post(url, form_data, function(result){
if (form_data.action === 'add') { self.result(result);}
if (form_data.action === 'preview') { self.previewResult(result);}
if (form_data.action === 'update') { self.updateResult(result);}
}, "json");
};
this.preview = function () {
this.submit('preview');
};
this.previewResult = function (result) {
if (result.error){
this.error(result.message);
return;
}
var form = $('#wall_add_form');
var preview_box = $('.preview_box', form).html(result.html);
$(preview_box).addClass('shadow').removeClass('d-none');
setTimeout(function (){ $(preview_box).removeClass('shadow'); }, 1000);
this.restoreForm(false);
};
this.more = function(){
var widget = $('#wall_widget');
$('.show_more', widget).hide();
$('.entry', widget).show();
$('.wall_pages', widget).show();
return false;
};
this.replies = function(id, callback){
var e = $('#wall_widget #entry_'+id);
if (!e.data('replies')) { return false; }
var url = $('#wall_urls').data('replies-url');
$('.<API key>', e).addClass('is-busy');
$.post(url, {id: id}, function(result){
$('.<API key>', e).removeClass('is-busy').hide();
if (result.error){
self.error(result.message);
return false;
}
$('.replies', e).html( result.html );
if (typeof(callback)=='function'){
callback();
}
}, "json");
return false;
};
this.append = function(entry){
$('#wall_widget #entries_list .no_entries').remove();
if (entry.parent_id == 0){
$('#wall_widget #entries_list').prepend( entry.html );
return;
}
if (entry.parent_id > 0){
$('#wall_widget #entry_'+entry.parent_id+' .replies').append( entry.html );
return;
}
};
this.result = function(result){
if (result.error){
this.error(result.message);
return;
}
this.append(result);
this.restoreForm();
};
this.updateResult = function(result){
if (result.error){
this.error(result.message);
return;
}
$('#entries_list #entry_'+result.id+'> .media-body > .icms-wall-html').html(result.html);
this.restoreForm();
};
this.edit = function (id){
var form = $('#wall_add_form');
$('#wall_widget #wall_add_link').show();
$('#wall_widget #entries_list .links *').removeClass('disabled');
$('#wall_widget #entries_list #entry_'+id+' > .media-body > .links .edit').addClass('is-busy disabled');
form.detach().insertAfter('#wall_widget #entries_list #entry_'+id+' > .media-body > .links').show();
$('input[name=id]', form).val(id);
$('input[name=action]', form).val('update');
$('input[name=submit]', form).val( LANG_SAVE );
$('textarea', form).prop('disabled', true);
icms.forms.wysiwygInit('content');
var url = $('#wall_urls').data('get-url');
$.post(url, {id: id}, function(result){
$('#wall_widget #entries_list #entry_'+id+' > .media-body > .links .edit').removeClass('is-busy');
if (result.error){
self.error(result.message);
return;
}
self.restoreForm(false);
icms.forms.wysiwygInsertText('content', result.html);
}, 'json');
return false;
};
this.remove = function (id){
var c = $('#entries_list #entry_'+id);
var username = $('> .media-body > h6 .user', c).text();
if (!confirm(<API key>.replace('%s', username))) {
return false;
}
var url = $('#wall_urls').data('delete-url');
$.post(url, {id: id}, function(result){
if (result.error){
self.error(result.message);
return;
}
c.remove();
self.restoreForm();
}, "json");
return false;
};
this.show = function(id, reply_id, go_reply){
var e = $('#entry_'+id);
if (e.length){
$.scrollTo( e, 500, {
offset: {
left:0,
top:-10
},
onAfter: function(){
self.replies(id, function(){
if (reply_id>0){
self.show(reply_id);
}
});
if (go_reply){
self.add(id);
}
}
});
} else {
if (go_reply){
$.scrollTo( $('#wall_widget'), 500, {
offset: {
left:0,
top:-10
},
onAfter: function(){
self.add();
}
});
}
}
return false;
};
this.error = function(message){
icms.modal.alert(message);
this.restoreForm(false);
};
this.restoreForm = function(clear_text){
if (typeof (clear_text) === 'undefined') {
clear_text = true;
}
var form = $('#wall_add_form');
$('.buttons *', form).removeClass('disabled is-busy');
$('textarea', form).prop('disabled', false);
if (clear_text) {
form.hide();
icms.forms.wysiwygInsertText('content', '');
$('#wall_widget #wall_add_link').show();
$('#wall_widget #entries_list .links *').removeClass('disabled');
$('.preview_box', form).html('').hide();
}
};
return this;
}).call(icms.wall || {},jQuery);
|
<html>
<head>
<title>
TEAMMATES - Instructor
</title>
<link href="/favicon.png" rel="shortcut icon">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="https://unpkg.com/bootstrap@3.1.1/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="https://unpkg.com/bootstrap@3.1.1/dist/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
<link href="/stylesheets/teammatesCommon.css" rel="stylesheet" type="text/css">
<link href="/stylesheets/datepicker.css" media="screen" rel="stylesheet" type="text/css">
<link href="https://unpkg.com/tinymce@4.5.1/skins/lightgray/skin.min.css" id="u0" rel="stylesheet" type="text/css">
<link href="https://unpkg.com/tinymce@4.5.1/skins/lightgray/content.inline.min.css" rel="stylesheet">
</head>
<body spellcheck="false">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#contentLinks" data-toggle="collapse" type="button">
<span class="sr-only">
Toggle navigation
</span>
<span class="icon-bar">
</span>
<span class="icon-bar">
</span>
<span class="icon-bar">
</span>
</button>
<a class="navbar-brand" href="/index.jsp">
TEAMMATES
</a>
</div>
<div class="collapse navbar-collapse" id="contentLinks">
<ul class="nav navbar-nav">
<li>
<a class="nav home" data-link="instructorHome" href="/page/instructorHomePage?user=CFeedbackUiT.nocourses">
Home
</a>
</li>
<li>
<a class="nav courses" data-link="instructorCourse" href="/page/<API key>?user=CFeedbackUiT.nocourses">
Courses
</a>
</li>
<li class="active">
<a class="nav evaluations" data-link="instructorEval" href="/page/<API key>?user=CFeedbackUiT.nocourses">
Sessions
</a>
</li>
<li>
<a class="nav students" data-link="instructorStudent" href="/page/<API key>?user=CFeedbackUiT.nocourses">
Students
</a>
</li>
<li>
<a class="nav comments" data-link="instructorComments" href="/page/<API key>?user=CFeedbackUiT.nocourses">
Comments
</a>
</li>
<li>
<a class="nav search" data-link="instructorSearch" href="/page/<API key>?user=CFeedbackUiT.nocourses">
Search
</a>
</li>
<li>
<a class="nav help" href="/instructorHelp.jsp" rel="noopener noreferrer" target="_blank">
Help
</a>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
<li>
<a class="nav logout" href="/logout" id="btnLogout">
Logout (
<span class="text-info tool-tip-decorate" data-original-title="CFeedbackUiT.nocourses" data-placement="bottom" data-toggle="tooltip" title="">
CFeedbackUiT.nocourses
</span>
)
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container" id="mainContent">
<div id="topOfPage">
</div>
<h1>
Add New Feedback Session
</h1>
<br>
<div class="well well-plain">
<form action="/page/<API key>" class="form-group" id="<API key>" method="post">
<div class="row">
<h4 class="label-control col-md-2 text-md">
Create new
</h4>
<div class="col-md-5">
<div class="col-xs-10 tablet-no-padding" data-original-title="Select a session type here." data-placement="top" data-toggle="tooltip" title="">
<select class="form-control" id="fstype" name="fstype">
<option value="STANDARD">
Session with your own questions
</option>
<option selected="" value="TEAMEVALUATION">
Team peer evaluation session
</option>
</select>
</div>
<div class="col-xs-1">
<h5>
<a href="/instructorHelp.jsp#fbSetupSession" rel="noopener noreferrer" target="_blank">
<span class="glyphicon glyphicon-info-sign">
</span>
</a>
</h5>
</div>
</div>
<h4 class="label-control col-xs-12 col-md-1 text-md">
Or:
</h4>
<div class="col-xs-12 col-md-3">
<a class="btn btn-info" id="button_copy" style="vertical-align:middle;">
Copy from previous feedback sessions
</a>
</div>
</div>
<br>
<div class="panel panel-primary">
<div class="panel-body">
<div class="row">
<div class="col-sm-12 col-md-6" data-original-title="Please select the course for which the feedback session is to be created." data-placement="top" data-toggle="tooltip" title="">
<div class="form-group has-error">
<h5 class="col-sm-2 col-md-4">
<label class="control-label" for="courseid">
Course ID
</label>
</h5>
<div class="col-sm-10 col-md-8">
<select class="form-control text-color-red" id="courseid" name="courseid">
<option selected="" value="">
No un-archived courses
</option>
</select>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 <API key>" data-original-title="You should not need to change this as your timezone is auto-detected. <br><br>However, note that daylight saving is not taken into account i.e. if you are in UTC -8:00 and there is daylight saving, you should choose UTC -7:00 and its corresponding timings." data-placement="top" data-toggle="tooltip" title="">
<div class="form-group">
<h5 class="col-sm-2 col-md-4">
<label class="control-label" for="timezone">
Timezone
</label>
</h5>
<div class="col-sm-10 col-md-8">
<select class="form-control" id="timezone" name="timezone">
<option value="-12">
(UTC -12:00) Baker Island, Howland Island
</option>
<option value="-11">
(UTC -11:00) American Samoa, Niue
</option>
<option value="-10">
(UTC -10:00) Hawaii, Cook Islands
</option>
<option value="-9.5">
(UTC -09:30) Marquesas Islands
</option>
<option value="-9">
(UTC -09:00) Gambier Islands, Alaska
</option>
<option value="-8">
(UTC -08:00) Los Angeles, Vancouver, Tijuana
</option>
<option value="-7">
(UTC -07:00) Phoenix, Calgary, Ciudad Juárez
</option>
<option value="-6">
(UTC -06:00) Chicago, Guatemala City, Mexico City, San José, San Salvador, Tegucigalpa, Winnipeg
</option>
<option value="-5">
(UTC -05:00) New York, Lima, Toronto, Bogotá, Havana, Kingston
</option>
<option value="-4.5">
(UTC -04:30) Caracas
</option>
<option value="-4">
(UTC -04:00) Santiago, La Paz, San Juan de Puerto Rico, Manaus, Halifax
</option>
<option value="-3.5">
(UTC -03:30) St. John's
</option>
<option value="-3">
(UTC -03:00) Buenos Aires, Montevideo, São Paulo
</option>
<option value="-2">
(UTC -02:00) Fernando de Noronha, South Georgia and the South Sandwich Islands
</option>
<option value="-1">
(UTC -01:00) Cape Verde, Greenland, Azores islands
</option>
<option value="0">
(UTC) Accra, Abidjan, Casablanca, Dakar, Dublin, Lisbon, London
</option>
<option value="1">
(UTC +01:00) Belgrade, Berlin, Brussels, Lagos, Madrid, Paris, Rome, Tunis, Vienna, Warsaw
</option>
<option value="2">
(UTC +02:00) Athens, Sofia, Cairo, Kiev, Istanbul, Beirut, Helsinki, Jerusalem, Johannesburg, Bucharest
</option>
<option value="3">
(UTC +03:00) Nairobi, Baghdad, Doha, Khartoum, Minsk, Riyadh
</option>
<option value="3.5">
(UTC +03:30) Tehran
</option>
<option value="4">
(UTC +04:00) Baku, Dubai, Moscow
</option>
<option value="4.5">
(UTC +04:30) Kabul
</option>
<option value="5">
(UTC +05:00) Karachi, Tashkent
</option>
<option value="5.5">
(UTC +05:30) Colombo, Delhi
</option>
<option value="5.75">
(UTC +05:45) Kathmandu
</option>
<option value="6">
(UTC +06:00) Almaty, Dhaka, Yekaterinburg
</option>
<option value="6.5">
(UTC +06:30) Yangon
</option>
<option value="7">
(UTC +07:00) Jakarta, Bangkok, Novosibirsk, Hanoi
</option>
<option value="8">
(UTC +08:00) Perth, Beijing, Manila, Singapore, Kuala Lumpur, Denpasar, Krasnoyarsk
</option>
<option value="8.75">
(UTC +08:45) Eucla
</option>
<option value="9">
(UTC +09:00) Seoul, Tokyo, Pyongyang, Ambon, Irkutsk
</option>
<option value="9.5">
(UTC +09:30) Adelaide
</option>
<option value="10">
(UTC +10:00) Canberra, Yakutsk, Port Moresby
</option>
<option value="10.5">
(UTC +10:30) Lord Howe Islands
</option>
<option value="11">
(UTC +11:00) Vladivostok, Noumea
</option>
<option value="12">
(UTC +12:00) Auckland, Suva
</option>
<option value="12.75">
(UTC +12:45) Chatham Islands
</option>
<option value="13">
(UTC +13:00) Phoenix Islands, Tokelau, Tonga
</option>
<option value="14">
(UTC +14:00) Line Islands
</option>
</select>
</div>
</div>
</div>
</div>
<br class="hidden-xs">
<div class="row">
<div class="col-sm-12" data-original-title="Enter the name of the feedback session e.g. Feedback Session 1." data-placement="top" data-toggle="tooltip" title="">
<div class="form-group">
<h5 class="col-sm-2">
<label class="control-label" for="fsname">
Session name
</label>
</h5>
<div class="col-sm-10">
<input class="form-control" id="fsname" maxlength="38" name="fsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value="">
</div>
</div>
</div>
</div>
<br class="hidden-xs">
<div class="row" id="instructionsRow">
<div class="col-sm-12" data-original-title="Enter instructions for this feedback session. e.g. Avoid comments which are too critical.<br> It will be displayed at the top of the page when users respond to the session." data-placement="top" data-toggle="tooltip" title="">
<div class="form-group">
<h5 class="col-sm-2 margin-top-0">
<label class="control-label" for="instructions">
Instructions
</label>
</h5>
<div class="col-sm-10">
<div id="<API key>">
</div>
<div class="panel panel-default panel-body mce-content-body content-editor" contenteditable="true" id="instructions" spellcheck="false" style="position: relative;">
<p>
Please answer all the given questions.
</p>
</div>
<input name="instructions" type="hidden">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-primary" id="timeFramePanel">
<div class="panel-body">
<div class="row">
<div class="col-md-5" data-original-title="Please select the date and time for which users can start submitting responses for the feedback session." data-placement="top" data-toggle="tooltip" title="">
<div class="row">
<div class="col-xs-12">
<label class="label-control" for="startdate">
Submission opening time
</label>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input class="form-control col-sm-2 hasDatepicker" id="startdate" name="startdate" placeholder="Date" type="text" value="${date.nexthour}">
</div>
<div class="col-xs-6">
<select class="form-control" id="starttime" name="starttime">
<option value="1">
0100H
</option>
<option value="2">
0200H
</option>
<option value="3">
0300H
</option>
<option value="4">
0400H
</option>
<option value="5">
0500H
</option>
<option value="6">
0600H
</option>
<option value="7">
0700H
</option>
<option value="8">
0800H
</option>
<option value="9">
0900H
</option>
<option value="10">
1000H
</option>
<option value="11">
1100H
</option>
<option value="12">
1200H
</option>
<option value="13">
1300H
</option>
<option value="14">
1400H
</option>
<option value="15">
1500H
</option>
<option value="16">
1600H
</option>
<option value="17">
1700H
</option>
<option value="18">
1800H
</option>
<option value="19">
1900H
</option>
<option value="20">
2000H
</option>
<option value="21">
2100H
</option>
<option value="22">
2200H
</option>
<option value="23">
2300H
</option>
<option selected="" value="24">
2359H
</option>
</select>
</div>
</div>
</div>
<div class="col-md-5 border-left-gray" data-original-title="Please select the date and time after which the feedback session will no longer accept submissions from users." data-placement="top" data-toggle="tooltip" title="">
<div class="row">
<div class="col-xs-12">
<label class="label-control" for="enddate">
Submission closing time
</label>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<input class="form-control col-sm-2 hasDatepicker" id="enddate" name="enddate" placeholder="Date" type="text" value="">
</div>
<div class="col-xs-6">
<select class="form-control" id="endtime" name="endtime">
<option value="1">
0100H
</option>
<option value="2">
0200H
</option>
<option value="3">
0300H
</option>
<option value="4">
0400H
</option>
<option value="5">
0500H
</option>
<option value="6">
0600H
</option>
<option value="7">
0700H
</option>
<option value="8">
0800H
</option>
<option value="9">
0900H
</option>
<option value="10">
1000H
</option>
<option value="11">
1100H
</option>
<option value="12">
1200H
</option>
<option value="13">
1300H
</option>
<option value="14">
1400H
</option>
<option value="15">
1500H
</option>
<option value="16">
1600H
</option>
<option value="17">
1700H
</option>
<option value="18">
1800H
</option>
<option value="19">
1900H
</option>
<option value="20">
2000H
</option>
<option value="21">
2100H
</option>
<option value="22">
2200H
</option>
<option value="23">
2300H
</option>
<option selected="" value="24">
2359H
</option>
</select>
</div>
</div>
</div>
<div class="col-md-2 border-left-gray" data-original-title="Please select the amount of time that the system will continue accepting <br>submissions after the specified deadline." data-placement="top" data-toggle="tooltip" title="">
<div class="row">
<div class="col-xs-12">
<label class="control-label" for="graceperiod">
Grace period
</label>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<select class="form-control" id="graceperiod" name="graceperiod">
<option value="0">
0 mins
</option>
<option value="5">
5 mins
</option>
<option value="10">
10 mins
</option>
<option selected="" value="15">
15 mins
</option>
<option value="20">
20 mins
</option>
<option value="25">
25 mins
</option>
<option value="30">
30 mins
</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="<API key>">
<div class="panel panel-primary" id="<API key>" style="display:none;">
<div class="panel-body">
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="row">
<div class="col-xs-12" data-original-title="Please select when you want the questions for the feedback session to be visible to users who need to participate. Note that users cannot submit their responses until the submissions opening time set below." data-placement="top" data-toggle="tooltip" title="">
<label class="label-control">
Session visible from
</label>
</div>
</div>
<div class="row radio">
<h5 class="col-xs-2" data-original-title="Select this option to enter in a custom date and time for which the feedback session will become visible.<br>Note that you can make a session visible before it is open for submissions so that users can preview the questions." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
At
</label>
<input id="<API key>" name="<API key>" type="radio" value="custom">
</h5>
<div class="col-xs-5">
<input class="form-control col-sm-2 hasDatepicker" disabled="" id="visibledate" name="visibledate" type="text" value="">
</div>
<div class="col-xs-5">
<select class="form-control" disabled="" id="visibletime" name="visibletime">
<option value="1">
0100H
</option>
<option value="2">
0200H
</option>
<option value="3">
0300H
</option>
<option value="4">
0400H
</option>
<option value="5">
0500H
</option>
<option value="6">
0600H
</option>
<option value="7">
0700H
</option>
<option value="8">
0800H
</option>
<option value="9">
0900H
</option>
<option value="10">
1000H
</option>
<option value="11">
1100H
</option>
<option value="12">
1200H
</option>
<option value="13">
1300H
</option>
<option value="14">
1400H
</option>
<option value="15">
1500H
</option>
<option value="16">
1600H
</option>
<option value="17">
1700H
</option>
<option value="18">
1800H
</option>
<option value="19">
1900H
</option>
<option value="20">
2000H
</option>
<option value="21">
2100H
</option>
<option value="22">
2200H
</option>
<option value="23">
2300H
</option>
<option selected="" value="24">
2359H
</option>
</select>
</div>
</div>
<div class="row radio">
<div class="col-xs-12" data-original-title="Select this option to have the feedback session become visible when it is open for submissions (as selected above)." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
Submission opening time
</label>
<input checked="" id="<API key>" name="<API key>" type="radio" value="atopen">
</div>
</div>
<div class="row radio">
<div class="col-xs-12" data-original-title="Select this option if you want the feedback session to be private. A private session is never visible to anyone. Private sessions can be used to record your own comments about others, for your own reference." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
Never
</label>
<input id="<API key>" name="<API key>" type="radio" value="never">
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 border-left-gray" id="<API key>">
<div class="row">
<div class="col-xs-12" data-original-title="Please select when the responses for the feedback session will be visible to the designated recipients.<br>You can select the response visibility for each type of user and question later." data-placement="top" data-toggle="tooltip" title="">
<label class="label-control">
Responses visible from
</label>
</div>
</div>
<div class="row radio">
<h5 class="col-xs-2" data-original-title="Select this option to use a custom time for when the responses of the feedback session<br>will be visible to the designated recipients." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
At
</label>
<input id="<API key>" name="<API key>" type="radio" value="custom">
</h5>
<div class="col-xs-5">
<input class="form-control hasDatepicker" disabled="" id="publishdate" name="publishdate" type="text" value="">
</div>
<div class="col-xs-5">
<select class="form-control" data-original-title="Select this option to enter in a custom date and time for which</br>the responses for this feedback session will become visible." data-placement="top" data-toggle="tooltip" disabled="" id="publishtime" name="publishtime" title="">
<option value="1">
0100H
</option>
<option value="2">
0200H
</option>
<option value="3">
0300H
</option>
<option value="4">
0400H
</option>
<option value="5">
0500H
</option>
<option value="6">
0600H
</option>
<option value="7">
0700H
</option>
<option value="8">
0800H
</option>
<option value="9">
0900H
</option>
<option value="10">
1000H
</option>
<option value="11">
1100H
</option>
<option value="12">
1200H
</option>
<option value="13">
1300H
</option>
<option value="14">
1400H
</option>
<option value="15">
1500H
</option>
<option value="16">
1600H
</option>
<option value="17">
1700H
</option>
<option value="18">
1800H
</option>
<option value="19">
1900H
</option>
<option value="20">
2000H
</option>
<option value="21">
2100H
</option>
<option value="22">
2200H
</option>
<option value="23">
2300H
</option>
<option selected="" value="24">
2359H
</option>
</select>
</div>
</div>
<div class="row radio">
<div class="col-xs-12" data-original-title="Select this option to have the feedback responses be immediately visible<br>when the session becomes visible to users." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
Immediately
</label>
<input id="<API key>" name="<API key>" type="radio" value="atvisible">
</div>
</div>
<div class="row radio">
<div class="col-xs-12" data-original-title="Select this option if you intend to manually publish the responses for this session later on." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
Publish manually
</label>
<input checked="" id="<API key>" name="<API key>" type="radio" value="later">
</div>
</div>
<div class="row radio">
<div class="col-xs-12" data-original-title="Select this option if you intend never to publish the responses." data-placement="top" data-toggle="tooltip" title="">
<label for="<API key>">
Never
</label>
<input id="<API key>" name="<API key>" type="radio" value="never">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-primary" id="sendEmailsForPanel" style="display:none;">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<label class="control-label">
Send emails for
</label>
</div>
</div>
<div class="row">
<div class="col-md-3" data-original-title="Select this option to automatically send an email to students to notify them when the session is open for submission." data-placement="top" data-toggle="tooltip" title="">
<div class="checkbox">
<label>
Session opening reminder
</label>
<input checked="" disabled="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_OPENING">
</div>
</div>
<div class="col-md-3" data-original-title="Select this option to automatically send an email to students to remind them to submit 24 hours before the end of the session." data-placement="top" data-toggle="tooltip" title="">
<div class="checkbox">
<label for="<API key>">
Session closing reminder
</label>
<input checked="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_CLOSING">
</div>
</div>
<div class="col-md-4" data-original-title="Select this option to automatically send an email to students to notify them when the session results is published." data-placement="top" data-toggle="tooltip" title="">
<div class="checkbox">
<label for="<API key>">
Results published announcement
</label>
<input checked="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_PUBLISHED">
</div>
</div>
</div>
</div>
</div>
<div class="margin-bottom-15px text-muted" id="<API key>">
<span id="<API key>">
Session is visible at submission opening time, responses are only visible when you publish the results.
</span>
<a class="<API key>" data-done="[Done]" data-edit="[Edit]" id="<API key>">
[Change]
</a>
</div>
<div class="margin-bottom-15px text-muted" id="<API key>">
<span id="<API key>">
Emails are sent when session opens (within 15 mins), 24 hrs before session closes and when results are published.
</span>
<a class="<API key>" data-done="[Done]" data-edit="[Edit]" id="<API key>">
[Change]
</a>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-offset-5 col-md-3">
<button class="btn btn-primary" disabled="" id="button_submit" type="submit">
Create Feedback Session
</button>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<b>
You need to have an active(unarchived) course to create a session!
</b>
</div>
</div>
<input name="user" type="hidden" value="CFeedbackUiT.nocourses">
</form>
</div>
<form action="/page/<API key>" class="ajaxForSessionsForm" id="ajaxForSessions" style="display:none;">
<input name="user" type="hidden" value="CFeedbackUiT.nocourses">
<input name="isusingAjax" type="hidden" value="on">
</form>
<br>
<div id="<API key>" style="display: block;">
<div class="overflow-auto alert alert-warning statusMessage">
You have not created any courses yet, or you have no active courses. Go
<a href="/page/<API key>?user=CFeedbackUiT.nocourses">
here
</a>
to create or unarchive a course.
</div>
</div>
<script defer="" src="/js/statusMessage.js" type="text/javascript">
</script>
<br>
<div class="" id="sessionList">
<table class="table-responsive table table-striped table-bordered" id="table-sessions">
<thead>
<tr class="fill-primary">
<th class="<API key> <API key>" id="button_sortid" onclick="toggleSort(this);">
Course ID
<span class="icon-sort unsorted">
</span>
</th>
<th class="button-sort-none <API key>" id="button_sortname" onclick="toggleSort(this)">
Session Name
<span class="icon-sort unsorted">
</span>
</th>
<th>
Status
</th>
<th>
<span class="tool-tip-decorate" data-original-title="Number of students submitted / Class size" data-placement="top" data-toggle="tooltip" title="">
Response Rate
</span>
</th>
<th class="no-print">
Action(s)
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<p class="col-md-12 text-muted">
Note: The table above doesn't contain sessions from archived courses. To view sessions from an archived course, unarchive the course first.
</p>
<br>
<br>
<br>
<div class="align-center">
No records found.
</div>
<br>
<br>
<br>
</div>
<div aria-hidden="true" aria-labelledby="remindModal" class="modal fade" id="remindModal" role="dialog" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<form action="/page/<API key>?next=%2Fpage%<API key>" method="post" name="form_remind_list" role="form">
<div class="modal-header">
<button aria-hidden="true" class="close" data-dismiss="modal" type="button">
×
</button>
<h4 class="modal-title">
Remind Particular Students
<small>
(Select the student(s) you want to remind)
</small>
</h4>
</div>
<div class="modal-body">
<div class="form-group" id="studentList">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">
Cancel
</button>
<input class="btn btn-primary" type="submit" value="Remind">
<input name="user" type="hidden" value="CFeedbackUiT.nocourses">
</div>
</form>
</div>
</div>
</div>
<div aria-hidden="true" aria-labelledby="copyModalTitle" class="modal fade" id="copyModal" role="dialog" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal" type="button">
<span aria-hidden="true">
×
</span>
<span class="sr-only">
Close
</span>
</button>
<h4 class="modal-title" id="copyModalTitle">
Creating a new session by copying a previous session
</h4>
</div>
<div class="modal-body" id="copySessionsBody">
<form action="/page/<API key>" class="form" id="copyModalForm" method="post" role="form">
<div class="form-group">
<label class="control-label" for="modalCopiedCourseId">
Create in course
</label>
<select class="form-control" id="modalCopiedCourseId" name="copiedcourseid">
<option selected="" value="">
No un-archived courses
</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="<API key>">
Name for new session
</label>
<input class="form-control" id="<API key>" maxlength="38" name="copiedfsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value="">
</div>
<label>
Copy sessions/questions from
</label>
<table class="table-responsive table table-bordered table-hover margin-0" id="copyTableModal">
<thead class="fill-primary">
<tr>
<th style="width:20px;">
</th>
<th>
Course ID
</th>
<th>
Feedback Session Name
</th>
</tr>
</thead>
</table>
<input id="modalSessionName" name="fsname" type="hidden" value="">
<input id="modalCourseId" name="courseid" type="hidden" value="">
<input name="user" type="hidden" value="CFeedbackUiT.nocourses">
</form>
</div>
<div class="modal-footer margin-0">
<button class="btn btn-primary" disabled="" id="button_copy_submit" type="button">
Copy
</button>
<button class="btn btn-default" data-dismiss="modal" type="button">
Cancel
</button>
</div>
</div>
</div>
</div>
<div aria-hidden="true" aria-labelledby="fsCopyModal" class="modal fade" id="fsCopyModal" role="dialog" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<form action="/page/<API key>?next=%2Fpage%<API key>" id="<API key>" method="post" role="form">
<div class="modal-header">
<button aria-hidden="true" class="close" data-dismiss="modal" type="button">
×
</button>
<h4 class="modal-title">
Copy this feedback session to other courses
<br>
<small>
(Select the course(s) you want to copy this feedback session to)
</small>
</h4>
</div>
<div class="modal-body">
<div class="form-group" id="courseList">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">
Cancel
</button>
<input class="btn btn-primary" id="fscopy_submit" type="submit" value="Copy">
<input name="user" type="hidden" value="CFeedbackUiT.nocourses">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container-fluid" id="footerComponent">
<div class="container">
<div class="row">
<div class="col-md-2">
<span>
[
<a href="/index.jsp">
TEAMMATES
</a>
V${version}]
</span>
</div>
<div class="col-md-8">
[for
<span class="highlight-white">
TEAMMATES Test Institute 1
</span>
]
</div>
<div class="col-md-2">
<span>
[Send
<a class="link" href="/contact.jsp" rel="noopener noreferrer" target="_blank">
Feedback
</a>
]
</span>
</div>
</div>
</div>
</div>
<script async="" src="https://ssl.google-analytics.com/ga.js" type="text/javascript">
</script>
<script src="/js/googleAnalytics.js" type="text/javascript">
</script>
<script src="https://unpkg.com/jquery@1.12.4/dist/jquery.min.js" type="text/javascript">
</script>
<script src="https://unpkg.com/jquery-ui-dist@1.12.1/jquery-ui.min.js" type="text/javascript">
</script>
<script src="https://unpkg.com/bootstrap@3.1.1/dist/js/bootstrap.min.js" type="text/javascript">
</script>
<script src="https://unpkg.com/bootbox@4.4.0/bootbox.min.js" type="text/javascript">
</script>
<script src="/js/common.js" type="text/javascript">
</script>
<script src="https://unpkg.com/tinymce@4.5.1/tinymce.min.js" type="text/javascript">
</script>
<script src="/js/richTextEditor.js" type="text/javascript">
</script>
<script src="/js/datepicker.js" type="text/javascript">
</script>
<script src="/js/instructor.js" type="text/javascript">
</script>
<script src="/js/ajaxResponseRate.js" type="text/javascript">
</script>
<script src="/js/<API key>.js" type="text/javascript">
</script>
<script src="/js/<API key>.js" type="text/javascript">
</script>
<script src="/js/instructorFeedbacks.js" type="text/javascript">
</script>
<script src="/js/<API key>.js" type="text/javascript">
</script>
<div class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" id="ui-datepicker-div">
</div>
</body>
</html>
|
<?php
// This program is distributed in the hope that it will be useful, //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
/**
* Debug on/off
*/
define("DEBUG", 0);
$query_counter = 0;
if (!extension_loaded('mysql')) {
/**
* MySQLi database layer
*
*/
if (!($db_config = @parse_ini_file('config/' . 'signup.ini'))) {
print('Cannot load mysql configuration');
exit;
}
$dbport = (empty($db_config['port'])) ? 3306 : $db_config['port'];
$loginDB = new mysqli($db_config['server'], $db_config['username'], $db_config['password'], $db_config['db'], $dbport);
if ($loginDB->connect_error) {
die('Connection error (' . $loginDB->connect_errno . ') '
. $loginDB->connect_error);
} else {
$loginDB->query("set <API key>='" . $db_config['character'] . "'");
$loginDB->query("set <API key>='" . $db_config['character'] . "'");
$loginDB->query("set <API key>='" . $db_config['character'] . "_general_ci'");
}
/**
* Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
*
* @global mysqli $loginDB
* @param aata to filter $parametr
*
* @return string
*/
function <API key>($parametr) {
global $loginDB;
$result = $loginDB->real_escape_string($parametr);
return($result);
}
if (!function_exists('<API key>')) {
/**
* Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
*
* @param string $data
*
* @return string
*/
function <API key>($data) {
return(<API key>($data));
}
}
/**
* Executing query and returns result as array
*
* @global int $query_counter
* @param string $query
* @return array
*/
function simple_queryall($query) {
global $loginDB, $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$result = array();
$queried = $loginDB->query($query) or die('wrong data input: ' . $query);
while ($row = mysqli_fetch_assoc($queried)) {
$result[] = $row;
}
$query_counter++;
return($result);
}
/**
* Executing query and returns array of first result
*
* @global int $query_counter
* @param string $query
* @return array
*/
function simple_query($query) {
global $loginDB, $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$queried = $loginDB->query($query) or die('wrong data input: ' . $query);
$result = mysqli_fetch_assoc($queried);
$query_counter++;
return($result);
}
/**
* Updates single field in table with where expression
*
* @param string $tablename
* @param string $field
* @param string $value
* @param string $where
* @param bool $NoQuotesAroundValue
*/
function simple_update_field($tablename, $field, $value, $where = '', $NoQuotesAroundValue = false) {
$tablename = <API key>($tablename);
$value = <API key>($value);
$field = <API key>($field);
if ($NoQuotesAroundValue) {
$query = "UPDATE `" . $tablename . "` SET `" . $field . "` = " . $value . " " . $where . "";
} else {
$query = "UPDATE `" . $tablename . "` SET `" . $field . "` = '" . $value . "' " . $where . "";
}
nr_query($query);
}
/**
* Returns last used `id` field available in some table
*
* @param string $tablename
* @return int
*/
function simple_get_lastid($tablename) {
$tablename = <API key>($tablename);
$query = "SELECT `id` from `" . $tablename . "` ORDER BY `id` DESC LIMIT 1";
$result = simple_query($query);
return($result['id']);
}
/**
* Just executing single query
*
* @global int $query_counter
* @param string $query
* @return mixed
*/
function nr_query($query) {
global $loginDB, $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$queried = $loginDB->query($query) or die('wrong data input: ' . $query);
$query_counter++;
return($queried);
}
} else {
/**
* MySQL database old driver abstraction class
*
*/
class MySQLDB {
var $connection;
var $last_query_num = 0;
var $db_config = array();
/**
* last query result id
*
* @var MySQL result
*/
var $lastresult;
/**
* last query assoc value
*
* @var bool
*/
var $assoc = true;
/**
* Initialises connection with MySQL database server and selects needed db
*
* @param MySQL Connection Id $connection
* @return MySQLDB
*/
public function __construct($connection = false) {
if ($connection)
$this->connection = $connection;
else {
if (!($this->db_config = @parse_ini_file('config/' . 'signup.ini'))) {
print(('Cannot load mysql configuration'));
return false;
}
if (!extension_loaded('mysql')) {
print(('Unable to load module for database server "mysql": PHP mysql extension not available!'));
return false;
}
$dbport = (empty($this->db_config['port'])) ? 3306 : $this->db_config['port'];
$this->connection = @mysql_connect($this->db_config['server'] . ':' . $dbport, $this->db_config['username'], $this->db_config['password']);
}
if (empty($this->connection)) {
print(('Unable to connect to database server!'));
return false;
} else if (!@mysql_select_db($this->db_config['db'], $this->connection)) {
$this->db_error();
return false;
}
mysql_query("set <API key>='" . $this->db_config['character'] . "'");
mysql_query("set <API key>='" . $this->db_config['character'] . "'");
mysql_query("set <API key>='" . $this->db_config['character'] . "_general_ci'");
return true;
}
/**
* Executes query and returns result identifier
*
* @param string $query
* @return MySQL result
*/
function query($query) {
// use escape/vf function for input data.
$result = @mysql_query($query, $this->connection) or $this->db_error(0, $query);
$this->last_query_num++;
return $result;
}
/**
* Executes query and makes abstract data read available
*
* @param string $query
* @param bool $assoc
*/
function ExecuteReader($query, $assoc = true) {
$this->lastresult = $this->query($query);
$this->assoc = $assoc;
}
/**
* Link to query method
*
* @param string $query
* @return MySQL result
*/
function ExecuteNonQuery($query) {
$result = $this->query($query);
return (mysql_affected_rows() == 0 ? false : $result);
}
/**
* Returns array with from the current query result
*
* @return array
*/
function Read() {
if ($this->assoc) {
$result = @mysql_fetch_assoc($this->lastresult) or false;
} else {
$result = @mysql_fetch_row($this->lastresult) or false;
}
return $result;
}
/**
* Returns one row from the current query result
*
* @param int $row
* @return string
*/
function ReadSingleRow($row) {
return mysql_result($this->lastresult, $row) or false;
}
/**
* Prints MySQL error message; swithing DEBUG, prints MySQL error description or sends it to administrator
*
*/
function db_error($show = 0, $query = '') {
global $system;
if (!in_array(mysql_errno(), array(1062, 1065, 1191))) { // Errcodes in array are handled at another way :)
if (DEBUG == 1 || $show == 1) {
$warning = '<br><b>' . ('MySQL Error') . ':</b><br><i>';
$warning.=mysql_errno() . ' : ' . mysql_error() . (empty($query) ? '</i>' : '<br>In query: <textarea cols="50" rows="7">' . $query . '</textarea></i>');
print($warning) or print($warning);
} else {
print('An error occured. Please, try again later. Thank You !');
@$message.=mysql_errno() . ':' . mysql_error() . "\r\n";
$message.=(empty($query) ? '' : "In query: \r\n" . $query . "\r\n");
die('MySQL error ' . $message);
}
}
}
/**
* Escapes string to use in SQL query
*
* @param string $string
* @return string
*/
function escape($string) {
if (!<API key>())
return <API key>($string, $this->connection);
else
return <API key>(stripslashes($string), $this->connection);
}
/**
* Disconnects from database server
*
*/
function disconnect() {
@mysql_close($this->connection);
}
}
/**
* Executing query and returns result as array
*
* @global int $query_counter
* @param string $query
* @return array
*/
function simple_queryall($query) {
global $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$result = '';
$queried = mysql_query($query) or die('wrong data input: ' . $query);
while ($row = mysql_fetch_assoc($queried)) {
$result[] = $row;
}
$query_counter++;
return($result);
}
/**
* Executing query and returns array of first result
*
* @global int $query_counter
* @param string $query
* @return array
*/
function simple_query($query) {
global $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$queried = mysql_query($query) or die('wrong data input: ' . $query);
$result = mysql_fetch_assoc($queried);
$query_counter++;
return($result);
}
/**
* Updates single field in table with where expression
*
* @param string $tablename
* @param string $field
* @param string $value
* @param string $where
* @param bool $NoQuotesAroundValue
*/
function simple_update_field($tablename, $field, $value, $where = '', $NoQuotesAroundValue = false) {
$tablename = <API key>($tablename);
$value = <API key>($value);
$field = <API key>($field);
if ($NoQuotesAroundValue) {
$query = "UPDATE `" . $tablename . "` SET `" . $field . "` = " . $value . " " . $where . "";
} else {
$query = "UPDATE `" . $tablename . "` SET `" . $field . "` = '" . $value . "' " . $where . "";
}
nr_query($query);
}
/**
* Returns last used `id` field available in some table
*
* @param string $tablename
* @return int
*/
function simple_get_lastid($tablename) {
$tablename = <API key>($tablename);
$query = "SELECT `id` from `" . $tablename . "` ORDER BY `id` DESC LIMIT 1";
$result = simple_query($query);
return ($result['id']);
}
/**
* Just executing single query
*
* @global int $query_counter
* @param string $query
* @return mixed
*/
function nr_query($query) {
global $query_counter;
if (DEBUG) {
print ($query . "\n");
}
$queried = mysql_query($query) or die('wrong data input: ' . $query);
$query_counter++;
return($queried);
}
//creating mysql connection object instance
$db = new MySQLDB();
}
/**
* Returns cutted down data entry
* Available modes:
* 1 - digits, letters
* 2 - only letters
* 3 - only digits
* 4 - digits, letters, "-", "_", "."
* 5 - current lang alphabet + digits + punctuation
* default - filter only blacklist chars
*
* @param string $data
* @param int $mode
* @return string
*/
function vf($data, $mode = 0) {
switch ($mode) {
case 1:
return preg_replace("#[^a-z0-9A-Z]#Uis", '', $data); // digits, letters
break;
case 2:
return preg_replace("#[^a-zA-Z]#Uis", '', $data); // letters
break;
case 3:
return preg_replace("#[^0-9]#Uis", '', $data); // digits
break;
case 4:
return preg_replace("#[^a-z0-9A-Z\-_\.]#Uis", '', $data); // digits, letters, "-", "_", "."
break;
case 5:
return preg_replace("#[^ [:punct:]" . ('a-zA-Z') . "0-9]#Uis", '', $data); // current lang alphabet + digits + punctuation
break;
default:
return preg_replace("#[~@\+\?\%\/\;=\*\>\<\"\'\-]#Uis", '', $data); // black list anyway
break;
}
}
?>
|
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRegExpValidator>
#include <QSizePolicy>
#include "qgslogger.h"
#include "qgsnewnamedialog.h"
QgsNewNameDialog::QgsNewNameDialog( const QString& source, const QString& initial,
const QStringList& extensions, const QStringList& existing,
const QRegExp& regexp, Qt::CaseSensitivity cs,
QWidget *parent, Qt::WindowFlags flags )
: QgsDialog( parent, flags, QDialogButtonBox::Ok | QDialogButtonBox::Cancel )
, mExiting( existing )
, mExtensions( extensions )
, mCaseSensitivity( cs )
, mNamesLabel( 0 )
, mRegexp( regexp )
{
setWindowTitle( tr( "New name" ) );
QDialog::layout()->setSizeConstraint( QLayout::SetMinimumSize );
layout()->setSizeConstraint( QLayout::SetMinimumSize );
layout()->setSpacing( 6 );
mOkString = buttonBox()->button( QDialogButtonBox::Ok )->text();
QString hintString;
QString nameDesc = mExtensions.isEmpty() ? tr( "name" ) : tr( "base name" );
if ( source.isEmpty() )
{
hintString = tr( "Enter new %1" ).arg( nameDesc );
}
else
{
hintString = tr( "Enter new %1 for %2" ).arg( nameDesc ).arg( source );
}
QLabel* hintLabel = new QLabel( hintString, this );
layout()->addWidget( hintLabel );
mLineEdit = new QLineEdit( initial, this );
if ( !regexp.isEmpty() )
{
QRegExpValidator *validator = new QRegExpValidator( regexp, this );
mLineEdit->setValidator( validator );
}
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( nameChanged() ) );
layout()->addWidget( mLineEdit );
mNamesLabel = new QLabel( " ", this );
mNamesLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
if ( !mExtensions.isEmpty() )
{
mNamesLabel->setWordWrap( true );
layout()->addWidget( mNamesLabel );
}
mErrorLabel = new QLabel( " ", this );
mErrorLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
mErrorLabel->setWordWrap( true );
layout()->addWidget( mErrorLabel );
nameChanged();
}
QString QgsNewNameDialog::highlightText( const QString& text )
{
return "<b>" + text + "</b>";
}
void QgsNewNameDialog::nameChanged()
{
QgsDebugMsg( "entered" );
QString namesString = tr( "Full names" ) + ": ";
if ( !mExtensions.isEmpty() )
{
mNamesLabel->setText( namesString );
}
mErrorLabel->setText( " " ); // space to keep vertical space
QPushButton* okButton = buttonBox()->button( QDialogButtonBox::Ok );
okButton->setText( mOkString );
okButton->setEnabled( true );
QString newName = name();
if ( newName.length() == 0 || ( !mRegexp.isEmpty() && !mRegexp.exactMatch( newName ) ) )
{
//mErrorLabel->setText( highlightText( tr( "Enter new name" ) );
okButton->setEnabled( false );
return;
}
QStringList newNames = fullNames( newName, mExtensions );
if ( !mExtensions.isEmpty() )
{
namesString += " " + newNames.join( ", " );
mNamesLabel->setText( namesString );
}
QStringList conflicts = matching( newNames, mExiting, mCaseSensitivity );
if ( !conflicts.isEmpty() )
{
mErrorLabel->setText( highlightText( tr( "%n Name(s) %1 exists", 0, conflicts.size() ).arg( conflicts.join( ", " ) ) ) );
okButton->setText( tr( "Overwrite" ) );
return;
}
}
QString QgsNewNameDialog::name() const
{
return mLineEdit->text().trimmed();
}
QStringList QgsNewNameDialog::fullNames( const QString& name, const QStringList& extensions )
{
QStringList list;
foreach ( QString ext, extensions )
{
list << name + ext;
}
if ( list.isEmpty() )
{
list << name;
}
return list;
}
QStringList QgsNewNameDialog::matching( const QStringList& newNames, const QStringList& existingNames,
Qt::CaseSensitivity cs )
{
QStringList list;
foreach ( QString newName, newNames )
{
foreach ( QString existingName, existingNames )
{
if ( existingName.compare( newName, cs ) == 0 )
{
list << existingName;
}
}
}
return list;
}
bool QgsNewNameDialog::exists( const QString& name, const QStringList& extensions,
const QStringList& existing, Qt::CaseSensitivity cs )
{
QStringList newNames = fullNames( name, extensions );
QStringList conflicts = matching( newNames, existing, cs );
return conflicts.size() > 0;
}
|
<?php
/**
* Download a package by passing in its location
*
* @var modX $this->modx
*
* @package modx
* @subpackage processors.workspace.packages.rest
*/
class <API key> extends modProcessor {
/** @var <API key> $provider */
public $provider;
/** @var string $location The actual file location of the download */
public $location;
/** @var string $signature The signature of the transport package */
public $signature;
/** @var modTransportPackage $package */
public $package;
/**
* Ensure user has access to do this
*
* {@inheritDoc}
* @return boolean
*/
public function checkPermissions() {
return $this->modx->hasPermission('packages');
}
/**
* The language topics to load
*
* {@inheritDoc}
* @return array
*/
public function getLanguageTopics() {
return array('workspace');
}
/**
* Ensure the info was properly passed and initialize the processor
*
* {@inheritDoc}
* @return boolean
*/
public function initialize() {
@set_time_limit(0);
$info = $this->getProperty('info','');
if (empty($info)) return $this->modx->lexicon('<API key>');
if (!$this->parseInfo($info)) {
return $this->modx->lexicon('invalid_data');
}
return parent::initialize();
}
/**
* Run the processor, downloading and transferring the package, and creating the metadata in the database
* {@inheritDoc}
* @return mixed
*/
public function process() {
if (!$this->loadProvider()) {
return $this->failure($this->modx->lexicon('provider_err_nf'));
}
$this->package = $this->provider->transfer($this->signature, null, array('location' => $this->location));
if (!$this->package) {
return $this->failure($this->modx->lexicon('<API key>', array('signature' => $this->signature)));
}
return $this->success('', $this->package);
}
/**
* Load the provider for the package
* @return boolean
*/
public function loadProvider() {
$provider = $this->getProperty('provider');
if (empty($provider)) {
$c = $this->modx->newQuery('transport.<API key>');
$c->where(array(
'name:=' => 'modxcms.com',
'OR:name:=' => 'modx.com',
));
$this->provider = $this->modx->getObject('transport.<API key>',$c);
if (!empty($this->provider)) {
$this->setProperty('provider',$this->provider->get('id'));
}
} else {
$this->provider = $this->modx->getObject('transport.<API key>',$provider);
}
return !empty($this->provider);
}
/**
* Parse the information sent to the processor
* @param string $info
* @return boolean
*/
public function parseInfo($info) {
$parsed = false;
$parsedInfo = explode('::',$info);
if (!empty($parsedInfo) && !empty($parsedInfo[1])) {
$this->location = $parsedInfo[0];
$this->signature = $parsedInfo[1];
$parsed = true;
}
return $parsed;
}
}
return '<API key>';
|
CKEDITOR.plugins.setLang( 'find', 'cs', {
find: 'Hledat',
findOptions: 'Možnosti hledání',
findWhat: 'Co hledat:',
matchCase: 'Rozlišovat velikost písma',
matchCyclic: 'Procházet opakovaně',
matchWord: 'Pouze celá slova',
notFoundMsg: 'Hledaný text nebyl nalezen.',
replace: 'Nahradit',
replaceAll: 'Nahradit vše',
replaceSuccessMsg: '%1 nahrazení.',
replaceWith: 'Čím nahradit:',
title: 'Najít a nahradit'
} );
|
/* about */
body#about label, body#about input[type='radio']{
display: inline;
float: none;
}
|
//>>built
define("dojox/editor/plugins/nls/zh-tw/SafePaste",({"instructions":""}));
|
{extends} {#language.function.extends}
======
`{extends}` tags are used in child templates in template inheritance for
extending parent templates. For details see section of [Template
Interitance](#advanced.features.template.inheritance).
- The `{extends}` tag must be on the first line of the template.
- If a child template extends a parent template with the `{extends}`
tag it may contain only `{block}` tags. Any other template content
is ignored.
- Use the syntax for [template resources](#resources) to extend files
outside of the [`$template_dir`](#variable.template.dir) directory.
> **Note**
>
> When extending a variable parent like `{extends file=$parent_file}`,
> make sure you include `$parent_file` in the
> [`$compile_id`](#variable.compile.id). Otherwise Smarty cannot
> distinguish between different `$parent_file`s.
**Attributes:**
Attribute Name Type Required Default Description
file string Yes *n/a* The name of the template file which is extended
{extends file='parent.tpl'}
{extends 'parent.tpl'} {* short-hand *}
See also [Template Interitance](#advanced.features.template.inheritance)
and [`{block}`](#language.function.block).
|
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/cdev.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/uaccess.h>
#include <linux/platform_device.h>
#include <linux/major.h>
#include <media/davinci/dm365_a3_hw.h>
#include <media/davinci/vpss.h>
/* Global structure */
static struct class *aew_class;
struct aew_device *aew_dev_configptr;
struct device *aewdev;
/* device structure to make entry in device*/
static dev_t dev;
/* For registeration of charatcer device*/
static struct cdev c_dev;
int <API key>(void)
{
int result = 0;
/* Check horizontal Count */
if ((aew_dev_configptr->config->window_config.hz_cnt <
<API key>)
|| (aew_dev_configptr->config->window_config.hz_cnt >
<API key>)) {
dev_err(aewdev, "\n Horizontal Count is incorrect");
result = -EINVAL;
}
/* Check Vertical Count */
if ((aew_dev_configptr->config->window_config.vt_cnt <
<API key>)
|| (aew_dev_configptr->config->window_config.vt_cnt >
<API key>)) {
dev_err(aewdev, "\n Vertical Count is incorrect");
result = -EINVAL;
}
/* Check line increment */
if ((NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->window_config.
hz_line_incr))
|| (aew_dev_configptr->config->window_config.hz_line_incr <
AEW_HZ_LINEINCR_MIN)
|| (aew_dev_configptr->config->window_config.hz_line_incr >
AEW_HZ_LINEINCR_MAX)) {
dev_err(aewdev, "\n Invalid Parameters");
dev_err(aewdev, "\n Horizontal Line Increment is incorrect");
result = -EINVAL;
}
/* Check line increment */
if ((NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->window_config.
vt_line_incr))
|| (aew_dev_configptr->config->window_config.vt_line_incr <
AEW_VT_LINEINCR_MIN)
|| (aew_dev_configptr->config->window_config.vt_line_incr >
AEW_VT_LINEINCR_MAX)) {
dev_err(aewdev, "\n Invalid Parameters");
dev_err(aewdev, "\n Vertical Line Increment is incorrect");
result = -EINVAL;
}
/* Check width */
if ((NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->window_config.width))
|| (aew_dev_configptr->config->window_config.width <
AEW_WIDTH_MIN)
|| (aew_dev_configptr->config->window_config.width >
AEW_WIDTH_MAX)) {
dev_err(aewdev, "\n Width is incorrect");
result = -EINVAL;
}
/* Check Height */
if ((NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->window_config.height))
|| (aew_dev_configptr->config->window_config.height <
AEW_HEIGHT_MIN)
|| (aew_dev_configptr->config->window_config.height >
AEW_HEIGHT_MAX)) {
dev_err(aewdev, "\n height incorrect");
result = -EINVAL;
}
/* Check Horizontal Start */
if ((aew_dev_configptr->config->window_config.hz_start <
AEW_HZSTART_MIN)
|| (aew_dev_configptr->config->window_config.hz_start >
AEW_HZSTART_MAX)) {
dev_err(aewdev, "\n horizontal start is incorrect");
result = -EINVAL;
}
if ((aew_dev_configptr->config->window_config.vt_start >
AEW_VTSTART_MAX)) {
dev_err(aewdev, "\n Vertical start is incorrect");
result = -EINVAL;
}
if ((aew_dev_configptr->config->alaw_enable > H3A_AEW_ENABLE)
|| (aew_dev_configptr->config->alaw_enable < H3A_AEW_DISABLE)) {
dev_err(aewdev, "\n A Law setting is incorrect");
result = -EINVAL;
}
if (aew_dev_configptr->config->saturation_limit > AEW_AVELMT_MAX) {
dev_err(aewdev, "\n Saturation Limit is incorrect");
result = -EINVAL;
}
/* Check Black Window Height */
if (NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->blackwindow_config.height)
|| (aew_dev_configptr->config->blackwindow_config.height <
<API key>)
|| (aew_dev_configptr->config->blackwindow_config.height >
<API key>)) {
dev_err(aewdev, "\n Black Window height incorrect");
result = -EINVAL;
}
/* Check Black Window Height */
if ((NOT_EVEN ==
CHECK_EVEN(aew_dev_configptr->config->blackwindow_config.
height))
|| (aew_dev_configptr->config->blackwindow_config.vt_start <
<API key>)
|| (aew_dev_configptr->config->blackwindow_config.vt_start >
<API key>)) {
dev_err(aewdev, "\n Black Window vertical Start is incorrect");
result = -EINVAL;
}
if (aew_dev_configptr->config->out_format < <API key> ||
aew_dev_configptr->config->out_format > AEW_OUT_SUM_ONLY) {
dev_err(aewdev, "\n Invalid out_format");
result = -EINVAL;
}
if (aew_dev_configptr->config->sum_shift > AEW_SUMSHIFT_MAX) {
dev_err(aewdev, "\n sum_shift param is invalid, max = %d",
AEW_SUMSHIFT_MAX);
result = -EINVAL;
}
return result;
}
/* inline function to free reserver pages */
inline void aew_free_pages(unsigned long addr, unsigned long bufsize)
{
unsigned long tempaddr;
unsigned long size;
tempaddr = addr;
if (!addr)
return;
size = PAGE_SIZE << (get_order(bufsize));
while (size > 0) {
ClearPageReserved(virt_to_page(addr));
addr += PAGE_SIZE;
size -= PAGE_SIZE;
}
free_pages(tempaddr, get_order(bufsize));
}
/* Function to perform hardware Configuration */
int aew_hardware_setup(void)
{
int result;
/* Size for buffer in bytes */
int buff_size = 0;
unsigned long adr;
unsigned long size;
unsigned int busyaew;
/* Get the value of PCR register */
busyaew = aew_get_hw_state();
/* If H3A Engine is busy then return */
if (busyaew == 1) {
dev_err(aewdev, "\n Error : AEW Engine is busy");
return -EBUSY;
}
result = <API key>();
dev_dbg(aewdev, "Result = %d\n", result);
if (result < 0) {
dev_err(aewdev, "Error : Parameters are incorrect \n");
return result;
}
/* Deallocate the previously allocated buffers */
if (aew_dev_configptr->buff_old)
aew_free_pages((unsigned long)aew_dev_configptr->buff_old,
aew_dev_configptr->size_window);
if (aew_dev_configptr->buff_curr)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_curr, aew_dev_configptr->size_window);
if (aew_dev_configptr->buff_app)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_app, aew_dev_configptr->size_window);
/*
* Allocat the buffers as per the new buffer size
* Allocate memory for old buffer
*/
if (aew_dev_configptr->config->out_format == AEW_OUT_SUM_ONLY)
buff_size = (aew_dev_configptr->config->window_config.hz_cnt) *
(aew_dev_configptr->config->window_config.vt_cnt) *
<API key>;
else
buff_size = (aew_dev_configptr->config->window_config.hz_cnt) *
(aew_dev_configptr->config->window_config.vt_cnt) *
AEW_WINDOW_SIZE;
aew_dev_configptr->buff_old =
(void *)__get_free_pages(GFP_KERNEL | GFP_DMA,
get_order(buff_size));
if (aew_dev_configptr->buff_old == NULL)
return -ENOMEM;
/* Make pges reserved so that they will be swapped out */
adr = (unsigned long)aew_dev_configptr->buff_old;
size = PAGE_SIZE << (get_order(buff_size));
while (size > 0) {
/*
* make sure the frame buffers
* are never swapped out of memory
*/
SetPageReserved(virt_to_page(adr));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
/* Allocate memory for current buffer */
aew_dev_configptr->buff_curr =
(void *)__get_free_pages(GFP_KERNEL | GFP_DMA,
get_order(buff_size));
if (aew_dev_configptr->buff_curr == NULL) {
/*Free all buffer that are allocated */
if (aew_dev_configptr->buff_old)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_old, buff_size);
return -ENOMEM;
}
/* Make pges reserved so that they will be swapped out */
adr = (unsigned long)aew_dev_configptr->buff_curr;
size = PAGE_SIZE << (get_order(buff_size));
while (size > 0) {
/*
* make sure the frame buffers
* are never swapped out of memory
*/
SetPageReserved(virt_to_page(adr));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
/* Allocate memory for application buffer */
aew_dev_configptr->buff_app =
(void *)__get_free_pages(GFP_KERNEL | GFP_DMA,
get_order(buff_size));
if (aew_dev_configptr->buff_app == NULL) {
/* Free all buffer that were allocated previously */
if (aew_dev_configptr->buff_old)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_old, buff_size);
if (aew_dev_configptr->buff_curr)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_curr, buff_size);
return -ENOMEM;
}
/* Make pages reserved so that they will be swapped out */
adr = (unsigned long)aew_dev_configptr->buff_app;
size = PAGE_SIZE << (get_order(buff_size));
while (size > 0) {
/*
* make sure the frame buffers
* are never swapped out of memory
*/
SetPageReserved(virt_to_page(adr));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
/* Set the registers */
aew_register_setup(aewdev, aew_dev_configptr);
aew_dev_configptr->size_window = buff_size;
aew_dev_configptr->aew_config = H3A_AEW_CONFIG;
return 0;
}
/* This Function is called when driver is opened */
static int aew_open(struct inode *inode, struct file *filp)
{
/* Return if Device is in use (Single Channel Support is provided) */
if (aew_dev_configptr->in_use == AEW_IN_USE)
return -EBUSY;
/* Set the aew_dev_configptr structure */
aew_dev_configptr->config = NULL;
/* Allocate memory for configuration structure of this channel */
aew_dev_configptr->config = (struct aew_configuration *)
kmalloc(sizeof(struct aew_configuration), GFP_KERNEL);
if (aew_dev_configptr->config == NULL) {
dev_err(aewdev, "Error : Kmalloc fail\n");
return -ENOMEM;
}
/* Initiaze the wait queue */
init_waitqueue_head(&(aew_dev_configptr->aew_wait_queue));
/* Device is in use */
aew_dev_configptr->in_use = AEW_IN_USE;
/* No Hardware Set up done */
aew_dev_configptr->aew_config = <API key>;
/* No statistics are available */
aew_dev_configptr->buffer_filled = 0;
/* Set Window Size to 0 */
aew_dev_configptr->size_window = 0;
/* Initialize the mutex */
mutex_init(&(aew_dev_configptr->read_blocked));
return 0;
}
static void <API key>(struct device *device)
{
/* This is called when the reference count goes to zero */
}
static int aew_probe(struct device *device)
{
aewdev = device;
return 0;
}
static int aew_remove(struct device *device)
{
return 0;
}
/* This Function is called when driver is closed */
static int aew_release(struct inode *inode, struct file *filp)
{
aew_engine_setup(aewdev, 0);
/* The Application has closed device so device is not in use */
aew_dev_configptr->in_use = AEW_NOT_IN_USE;
/* Release memory for configuration structure of this channel */
kfree(aew_dev_configptr->config);
/* Free Old Buffer */
if (aew_dev_configptr->buff_old)
aew_free_pages((unsigned long)aew_dev_configptr->buff_old,
aew_dev_configptr->size_window);
/* Free Current Buffer */
if (aew_dev_configptr->buff_curr)
aew_free_pages((unsigned long)aew_dev_configptr->
buff_curr, aew_dev_configptr->size_window);
/* Free Application Buffer */
if (aew_dev_configptr->buff_app)
aew_free_pages((unsigned long)aew_dev_configptr->buff_app,
aew_dev_configptr->size_window);
aew_dev_configptr->buff_old = NULL;
aew_dev_configptr->buff_curr = NULL;
aew_dev_configptr->config = NULL;
aew_dev_configptr->buff_app = NULL;
return 0;
}
/*
* This function will process IOCTL commands sent by the application and
* control the devices IO operations.
*/
static int aew_ioctl(struct inode *inode, struct file *filep,
unsigned int cmd, unsigned long arg)
{
/* Stores Previous Configurations */
struct aew_configuration aewconfig = *(aew_dev_configptr->config);
int result = 0;
/* Decrement the semaphore */
result = <API key>(&aew_dev_configptr->read_blocked);
if (result)
return result;
/*
* Extract the type and number bitfields, and don't decode wrong cmds:
* verify the magic number
*/
if (_IOC_TYPE(cmd) != AEW_MAGIC_NO) {
mutex_unlock(&aew_dev_configptr->read_blocked);
return -ENOTTY;
}
/* verify the command number */
if (_IOC_NR(cmd) > AEW_IOC_MAXNR) {
/* Release mutex in case of fault */
mutex_unlock(&aew_dev_configptr->read_blocked);
return -ENOTTY;
}
if (_IOC_DIR(cmd) & _IOC_READ)
result =
!access_ok(VERIFY_WRITE, (void __user *)arg,
_IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE)
result =
!access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd));
if (result) {
/* Release mutex in case of fault */
mutex_unlock(&aew_dev_configptr->read_blocked);
return -EFAULT;
}
/* Switch according to IOCTL command */
switch (cmd) {
/*
* This ioctl is used to perform hardware set up
* and will set all the registers for AF engine
*/
case AEW_S_PARAM:
/* Copy config structure passed by user */
if (copy_from_user(aew_dev_configptr->config,
(struct aew_configuration *)arg,
sizeof(struct aew_configuration))) {
*(aew_dev_configptr->config) = aewconfig;
mutex_unlock(&aew_dev_configptr->read_blocked);
return -EFAULT;
}
/* Call aew_hardware_setup to perform register configuration */
result = aew_hardware_setup();
if (!result) {
/*
* Hardware Set up is successful
* Return the no of bytes required for buffer
*/
result = aew_dev_configptr->size_window;
} else {
/* Change Configuration Structure to original */
*(aew_dev_configptr->config) = aewconfig;
dev_err(aewdev, "Error : AEW_S_PARAM failed\n");
}
break;
/* This ioctl is used to return parameters in user space */
case AEW_G_PARAM:
if (aew_dev_configptr->aew_config == H3A_AEW_CONFIG) {
if (copy_to_user
((struct aew_configuration *)arg,
aew_dev_configptr->config,
sizeof(struct aew_configuration))) {
mutex_unlock(&aew_dev_configptr->read_blocked);
return -EFAULT;
} else
result = aew_dev_configptr->size_window;
} else {
dev_err(aewdev,
"Error : AEW Hardware is not configured.\n");
result = -EINVAL;
}
break;
/* This ioctl is used to enable AEW Engine */
case AEW_ENABLE:
/* Enable AEW Engine if Hardware set up is done */
if (aew_dev_configptr->aew_config == <API key>) {
dev_err(aewdev,
"Error : AEW Hardware is not configured.\n");
result = -EINVAL;
} else
/* Enable AF Engine */
aew_engine_setup(aewdev, 1);
break;
/* This ioctl is used to disable AEW Engine */
case AEW_DISABLE:
/* Disable AEW Engine */
aew_engine_setup(aewdev, 0);
break;
/* Invalid Command */
default:
dev_err(aewdev, "Error: It should not come here!!\n");
result = -ENOTTY;
break;
}
/* Release the mutex */
mutex_unlock(&aew_dev_configptr->read_blocked);
return result;
}
/* This function will return statistics to user */
static ssize_t aew_read(struct file *filep, char *kbuff,
size_t size, loff_t *offset)
{
void *buffer_temp;
int result = 0;
int ret;
/* Semaphore will return immediately if read call is busy */
ret = mutex_trylock(&(aew_dev_configptr->read_blocked));
if (!ret) {
dev_dbg(aewdev, "Read Call : busy : %d\n", ret);
return -EBUSY;
}
/* First Check the size given by user */
if (size < aew_dev_configptr->size_window) {
/*
* Return Failure to applicaiton
* if size is less than required size
*/
dev_dbg(aewdev, "Error : Invalid size of buffer\n");
mutex_unlock(&(aew_dev_configptr->read_blocked));
return -EINVAL;
}
/*
* The value of buffer_filled flag determines
* the status of statistics
*/
if (aew_dev_configptr->buffer_filled == 0) {
/* Decrement the semaphore */
dev_dbg(aewdev, "READ CALL IS BLOCKED............\n");
/* Block the read call */
<API key>(aew_dev_configptr->
aew_wait_queue,
aew_dev_configptr->
buffer_filled, AEW_TIMEOUT);
dev_dbg(aewdev, "Read Call is unbloked and waking up.......\n");
dev_dbg(aewdev, "Buffer Filled.... %d\n",
aew_dev_configptr->buffer_filled);
}
if (aew_dev_configptr->buffer_filled == 1) {
/* Disable the interrupts and then swap the buffers */
dev_dbg(aewdev, "READING............\n");
disable_irq(6);
/* New Statistics are availaible */
aew_dev_configptr->buffer_filled = 0;
/* Swap application buffer and old buffer */
buffer_temp = aew_dev_configptr->buff_old;
aew_dev_configptr->buff_old = aew_dev_configptr->buff_app;
aew_dev_configptr->buff_app = buffer_temp;
/* Interrupts are enabled */
enable_irq(6);
/*
* Copy the entire statistics located in application
* buffer to user space
*/
if (copy_to_user(kbuff, aew_dev_configptr->buff_app,
aew_dev_configptr->size_window)) {
dev_err(aewdev, "Error : Read Fault\n");
mutex_unlock(&(aew_dev_configptr->read_blocked));
return -EFAULT;
} else
result = aew_dev_configptr->size_window;
dev_dbg(aewdev, "Reading Done........................\n");
}
dev_dbg(aewdev, "APP BUFF VALUE %x\n",
(*((unsigned int *)(aew_dev_configptr->buff_app))));
/* release the mutex */
mutex_unlock(&(aew_dev_configptr->read_blocked));
return result;
}
/* This function will handle interrupt generated by H3A Engine. */
static irqreturn_t aew_isr(int irq, void *dev_id)
{
/* EN AF Bit */
unsigned int enaew;
/* Temporary Buffer for Swapping */
void *buffer_temp;
/* Get the value of PCR register */
enaew = aew_get_enable();
/* If AEW engine is not enabled, interrupt is not for AEW */
if (!enaew)
return IRQ_RETVAL(IRQ_NONE);
/*
* Interrupt is generated by AEW, so Service the Interrupt
* Swap current buffer and old buffer
*/
if (aew_dev_configptr) {
buffer_temp = aew_dev_configptr->buff_curr;
aew_dev_configptr->buff_curr = aew_dev_configptr->buff_old;
aew_dev_configptr->buff_old = buffer_temp;
/* Set the AEWBUFSTAT REgister to current buffer Address */
aew_set_address(aewdev, (unsigned
long)(virt_to_phys(aew_dev_configptr->buff_curr)));
/*
* Set buffer filled flag to indicate statistics are available
*/
aew_dev_configptr->buffer_filled = 1;
/* new statistics are available. Wake up the read call */
wake_up(&(aew_dev_configptr->aew_wait_queue));
return IRQ_RETVAL(IRQ_HANDLED);
}
return IRQ_RETVAL(IRQ_NONE);
}
/* file Operation Structure*/
static const struct file_operations aew_fops = {
.owner = THIS_MODULE,
.open = aew_open,
.read = aew_read,
.ioctl = aew_ioctl,
.release = aew_release,
};
static struct platform_device aewdevice = {
.name = "dm365_aew",
.id = 2,
.dev = {
.release = <API key>,
}
};
static struct device_driver aew_driver = {
.name = "dm365_aew",
.bus = &platform_bus_type,
.probe = aew_probe,
.remove = aew_remove,
};
#define DRIVERNAME "DM365AEW"
/* Function to register the AF character device driver. */
int __init aew_init(void)
{
int err;
int result = 0;
/*
* Register the driver in the kernel
* dynmically get the major number for the driver using
* alloc_chrdev_region function
*/
result = alloc_chrdev_region(&dev, 0, 1, DRIVERNAME);
if (result < 0) {
printk(KERN_ERR "Error : Could not register character device");
return -ENODEV;
}
printk(KERN_INFO "aew major#: %d, minor# %d\n", MAJOR(dev), MINOR(dev));
/* allocate memory for device structure and initialize it with 0 */
aew_dev_configptr =
kmalloc(sizeof(struct aew_device), GFP_KERNEL);
if (!aew_dev_configptr) {
printk(KERN_ERR "Error : kmalloc fail");
<API key>(dev, AEW_NR_DEVS);
return -ENOMEM;
}
/* Initialize character device */
cdev_init(&c_dev, &aew_fops);
c_dev.owner = THIS_MODULE;
c_dev.ops = &aew_fops;
err = cdev_add(&c_dev, dev, 1);
if (err) {
printk(KERN_ERR "Error : Error in Adding Davinci AEW");
<API key>(dev, AEW_NR_DEVS);
kfree(aew_dev_configptr);
return -err;
}
/* register driver as a platform driver */
if (driver_register(&aew_driver) != 0) {
<API key>(dev, 1);
cdev_del(&c_dev);
return -EINVAL;
}
/* Register the drive as a platform device */
if (<API key>(&aewdevice) != 0) {
driver_unregister(&aew_driver);
<API key>(dev, 1);
cdev_del(&c_dev);
return -EINVAL;
}
aew_class = class_create(THIS_MODULE, "dm365_aew");
if (!aew_class) {
printk(KERN_ERR "aew_init: error in creating device class\n");
driver_unregister(&aew_driver);
<API key>(&aewdevice);
<API key>(dev, 1);
unregister_chrdev(MAJOR(dev), DRIVERNAME);
cdev_del(&c_dev);
return -EINVAL;
}
device_create(aew_class, NULL, dev, NULL, "dm365_aew");
/* Set up the Interrupt handler for H3AINT interrupt */
result = request_irq(6, aew_isr, IRQF_SHARED, "dm365_h3a_aew",
(void *)aew_dev_configptr);
if (result != 0) {
printk(KERN_ERR "Error : Request IRQ Failed");
<API key>(dev, AEW_NR_DEVS);
device_destroy(aew_class, dev);
class_destroy(aew_class);
kfree(aew_dev_configptr);
driver_unregister(&aew_driver);
<API key>(&aewdevice);
cdev_del(&c_dev);
return result;
}
/* Initialize device structure */
memset(aew_dev_configptr, 0, sizeof(struct aew_device));
aew_dev_configptr->in_use = AEW_NOT_IN_USE;
aew_dev_configptr->buffer_filled = 0;
printk(KERN_NOTICE "AEW Driver initialized\n");
return 0;
}
/*
* This Function is called by the kernel while unloading the driver
* This will unregister the Character Device Driver
*/
void __exit aew_cleanup(void)
{
/* Device is in use */
if (aew_dev_configptr->in_use == AEW_IN_USE) {
printk(KERN_ERR "Error : Driver in use");
return;
}
free_irq(6, aew_dev_configptr);
/* Free device structure */
kfree(aew_dev_configptr);
aew_dev_configptr = NULL;
<API key>(dev, AEW_NR_DEVS);
driver_unregister(&aew_driver);
device_destroy(aew_class, dev);
class_destroy(aew_class);
<API key>(&aewdevice);
cdev_del(&c_dev);
/* unregistering the driver from the kernel */
unregister_chrdev(MAJOR(dev), DRIVERNAME);
}
module_init(aew_init)
module_exit(aew_cleanup)
MODULE_LICENSE("GPL");
|
// This file has been generated by the GUI designer. Do not modify.
namespace Smuxi.Frontend.Gnome
{
public partial class <API key>
{
private global::Gtk.VBox vbox2;
private global::Gtk.VBox vbox3;
private global::Gtk.Label f_EngineNameLabel;
private global::Gtk.Entry f_EngineNameEntry;
private global::Gtk.Label label2;
private global::Gtk.VBox vbox4;
private global::Gtk.Label label7;
private global::Gtk.CheckButton <API key>;
private global::Gtk.Label label8;
protected virtual void Build ()
{
global::Stetic.Gui.Initialize (this);
// Widget Smuxi.Frontend.Gnome.<API key>
global::Stetic.BinContainer.Attach (this);
this.Name = "Smuxi.Frontend.Gnome.<API key>";
// Container child Smuxi.Frontend.Gnome.<API key>.Gtk.Container+ContainerChild
this.vbox2 = new global::Gtk.VBox ();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 10;
this.vbox2.BorderWidth = ((uint)(5));
// Container child vbox2.Gtk.Box+BoxChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
// Container child vbox3.Gtk.Box+BoxChild
this.f_EngineNameLabel = new global::Gtk.Label ();
this.f_EngineNameLabel.Name = "f_EngineNameLabel";
this.f_EngineNameLabel.Xalign = 0f;
this.f_EngineNameLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("_Engine Name:");
this.f_EngineNameLabel.UseUnderline = true;
this.vbox3.Add (this.f_EngineNameLabel);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.f_EngineNameLabel]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.f_EngineNameEntry = new global::Gtk.Entry ();
this.f_EngineNameEntry.CanFocus = true;
this.f_EngineNameEntry.Name = "f_EngineNameEntry";
this.f_EngineNameEntry.IsEditable = true;
this.f_EngineNameEntry.InvisibleChar = '';
this.vbox3.Add (this.f_EngineNameEntry);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.f_EngineNameEntry]));
w2.Position = 1;
w2.Expand = false;
w2.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.label2 = new global::Gtk.Label ();
this.label2.Name = "label2";
this.label2.Xpad = 50;
this.label2.Xalign = 0f;
this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("<span size=\"small\">Profile name of the new engine</span>");
this.label2.UseMarkup = true;
this.vbox3.Add (this.label2);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.label2]));
w3.Position = 2;
w3.Expand = false;
w3.Fill = false;
this.vbox2.Add (this.vbox3);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.vbox3]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
this.vbox4.Spacing = 6;
this.vbox4.BorderWidth = ((uint)(5));
// Container child vbox4.Gtk.Box+BoxChild
this.label7 = new global::Gtk.Label ();
this.label7.Name = "label7";
this.label7.Xalign = 0f;
this.label7.LabelProp = global::Mono.Unix.Catalog.GetString ("_Default Engine:");
this.label7.UseUnderline = true;
this.vbox4.Add (this.label7);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.label7]));
w5.Position = 0;
w5.Expand = false;
w5.Fill = false;
// Container child vbox4.Gtk.Box+BoxChild
this.<API key> = new global::Gtk.CheckButton ();
this.<API key>.CanFocus = true;
this.<API key>.Name = "<API key>";
this.<API key>.Label = global::Mono.Unix.Catalog.GetString ("Use as new default engine");
this.<API key>.DrawIndicator = true;
this.<API key>.UseUnderline = true;
this.vbox4.Add (this.<API key>);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.<API key>]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
// Container child vbox4.Gtk.Box+BoxChild
this.label8 = new global::Gtk.Label ();
this.label8.Name = "label8";
this.label8.Xpad = 50;
this.label8.Xalign = 0f;
this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("<span size=\"small\">If enabled, the current engine will be the default next time Smuxi is started</span>");
this.label8.UseMarkup = true;
this.label8.Wrap = true;
this.vbox4.Add (this.label8);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.label8]));
w7.Position = 2;
w7.Expand = false;
w7.Fill = false;
this.vbox2.Add (this.vbox4);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.vbox4]));
w8.Position = 1;
w8.Expand = false;
w8.Fill = false;
this.Add (this.vbox2);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.f_EngineNameLabel.MnemonicWidget = this.f_EngineNameEntry;
this.label7.MnemonicWidget = this.<API key>;
this.Hide ();
}
}
}
|
package org.opennms.netmgt.threshd;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.opennms.netmgt.EventConstants;
import org.opennms.netmgt.xml.event.Event;
import org.springframework.util.Assert;
/**
* Implements a relative change threshold check. A 'value' setting of
* less than 1.0 means that a threshold will fire if the current value
* is less than or equal to the previous value multiplied by the 'value'
* setting. A 'value' setting greater than 1.0 causes the threshold to
* fire if the current value is greater than or equal to the previous
* value multiplied by the 'value' setting. A 'value' setting of 1.0
* (unity) is not allowed, as it represents no change. Zero valued
* samples (0.0) are ignored, as 0.0 multiplied by anything is 0.0 (if
* they were not ignored, an interface that gets no traffic would always
* trigger a threshold, for example).
*
* @author ranger
* @version $Id: $
*/
public class <API key> implements ThresholdEvaluator {
private static final String TYPE = "relativeChange";
/** {@inheritDoc} */
@Override
public <API key> <API key>(<API key> threshold) {
return new <API key>(threshold);
}
/** {@inheritDoc} */
@Override
public boolean supportsType(String type) {
return TYPE.equals(type);
}
public static class <API key> extends <API key> {
private <API key> m_thresholdConfig;
private double m_multiplier;
private double m_lastSample = 0.0;
private double <API key>;
public <API key>(<API key> threshold) {
Assert.notNull(threshold, "threshold argument cannot be null");
setThresholdConfig(threshold);
}
public void setThresholdConfig(<API key> thresholdConfig) {
Assert.notNull(thresholdConfig.getType(), "threshold must have a 'type' value set");
Assert.notNull(thresholdConfig.<API key>(), "threshold must have a 'ds-name' value set");
Assert.notNull(thresholdConfig.getDsType(), "threshold must have a 'ds-type' value set");
Assert.isTrue(thresholdConfig.hasValue(), "threshold must have a 'value' value set");
Assert.isTrue(thresholdConfig.hasRearm(), "threshold must have a 'rearm' value set");
Assert.isTrue(thresholdConfig.hasTrigger(), "threshold must have a 'trigger' value set");
Assert.isTrue(TYPE.equals(thresholdConfig.getType()), "threshold for ds-name '" + thresholdConfig.<API key>() + "' has type of '" + thresholdConfig.getType() + "', but this evaluator only supports thresholds with a 'type' value of '" + TYPE + "'");
Assert.isTrue(!Double.isNaN(thresholdConfig.getValue()), "threshold must have a 'value' value that is a number");
Assert.isTrue(thresholdConfig.getValue() != Double.POSITIVE_INFINITY && thresholdConfig.getValue() != Double.NEGATIVE_INFINITY, "threshold must have a 'value' value that is not positive or negative infinity");
Assert.isTrue(thresholdConfig.getValue() != 1.0, "threshold must not be unity (1.0)");
m_thresholdConfig = thresholdConfig;
setMultiplier(thresholdConfig.getValue());
}
@Override
public <API key> getThresholdConfig() {
return m_thresholdConfig;
}
@Override
public Status evaluate(double dsValue) {
//Fix for Bug 2275 so we handle negative numbers
//It will not handle values which cross the 0 boundary (from - to +, or v.v.) properly, but
// after some discussion, we can't come up with a sensible scenario when that would actually happen.
// If such a scenario eventuates, reconsider
dsValue=Math.abs(dsValue);
if (getLastSample() != 0.0) {
double threshold = getMultiplier() * getLastSample();
if (getMultiplier() < 1.0) {
if (dsValue <= threshold) {
<API key>(getLastSample());
setLastSample(dsValue);
return Status.TRIGGERED;
}
} else {
if (dsValue >= threshold) {
<API key>(getLastSample());
setLastSample(dsValue);
return Status.TRIGGERED;
}
}
setLastSample(dsValue);
}
setLastSample(dsValue);
return Status.NO_CHANGE;
}
public Double getLastSample() {
return m_lastSample;
}
public void setLastSample(double lastSample) {
m_lastSample = lastSample;
}
@Override
public Event getEventForState(Status status, Date date, double dsValue, <API key> resource) {
if (status == Status.TRIGGERED) {
String uei=getThresholdConfig().getTriggeredUEI();
if(uei==null || "".equals(uei)) {
uei=EventConstants.<API key>;
}
return createBasicEvent(uei, date, dsValue, resource);
} else {
return null;
}
}
private Event createBasicEvent(String uei, Date date, double dsValue, <API key> resource) {
Map<String,String> params = new HashMap<String,String>();
params.put("previousValue", formatValue(<API key>()));
params.put("multiplier", Double.toString(getThresholdConfig().getValue()));
// params.put("trigger", Integer.toString(getThresholdConfig().getTrigger()));
// params.put("rearm", Double.toString(getThresholdConfig().getRearm()));
return createBasicEvent(uei, date, dsValue, resource, params);
}
public double <API key>() {
return <API key>;
}
public void <API key>(double <API key>) {
<API key> = <API key>;
}
public double getMultiplier() {
return m_multiplier;
}
public void setMultiplier(double multiplier) {
m_multiplier = multiplier;
}
@Override
public <API key> getCleanClone() {
return new <API key>(m_thresholdConfig);
}
// FIXME This must be implemented correctly
@Override
public boolean isTriggered() {
return false;
}
// FIXME This must be implemented correctly
@Override
public void clearState() {
}
}
}
|
package org.jpc.emulator.execution.opcodes.vm;
import org.jpc.emulator.execution.*;
import org.jpc.emulator.execution.decoder.*;
import org.jpc.emulator.processor.*;
import org.jpc.emulator.processor.fpu64.*;
import static org.jpc.emulator.processor.Processor.*;
public class add_o32_rAX_Id extends Executable
{
final int immd;
public add_o32_rAX_Id(int blockStart, int eip, int prefices, PeekableInputStream input)
{
super(blockStart, eip);
immd = Modrm.Id(input);
}
public Branch execute(Processor cpu)
{
cpu.flagOp1 = cpu.r_eax.get32();
cpu.flagOp2 = immd;
cpu.flagResult = (cpu.flagOp1 + cpu.flagOp2);
cpu.r_eax.set32(cpu.flagResult);
cpu.flagIns = UCodes.ADD32;
cpu.flagStatus = OSZAPC;
return Branch.None;
}
public boolean isBranch()
{
return false;
}
public String toString()
{
return this.getClass().getName();
}
}
|
#include <algorithm>
#include <iostream>
#include <WARMUX_file_tools.h>
#include <WARMUX_team_config.h>
#include "character/character.h"
#include "character/body_list.h"
#include "game/config.h"
#include "network/network.h"
#include "network/randomsync.h"
#include "team/team.h"
#include "team/team_energy.h"
#include "team/teams_list.h"
#include "tool/ansi_convert.h"
TeamsList::TeamsList():
full_list(),
playing_list(),
selection(),
groups(),
active_group(groups.end())
{
LoadList();
}
TeamsList::~TeamsList()
{
UnloadGamingData();
Clear();
for (full_iterator it = full_list.begin(); it != full_list.end(); ++it)
delete (*it);
full_list.clear();
groups.clear();
}
void TeamsList::NextTeam()
{
ActiveCharacter().StopPlaying();
Team* next = GetNextTeam();
SetActive(next->GetId());
next->NextCharacter(true);
printf("\nPlaying character : %i %s\n", ActiveCharacter().GetCharacterIndex(), ActiveCharacter().GetName().c_str());
printf("Playing team : %i %s\n", ActiveCharacter().GetTeamIndex(), ActiveTeam().GetName().c_str());
printf("Alive characters: %i / %i\n\n", ActiveTeam().NbAliveCharacter(),ActiveTeam().GetNbCharacters());
}
Team* TeamsList::GetNextTeam()
{
// Next group
GroupList::iterator git = active_group;
std::vector<Team*>::iterator it;
do {
++git;
if (git == groups.end())
git = groups.begin();
it = git->second.active_team;
do {
++it;
if (it == git->second.end())
it = git->second.begin();
} while (!(*it)->NbAliveCharacter() && it != git->second.active_team);
} while (git != active_group && !(*it)->NbAliveCharacter());
return (*it);
}
Team& TeamsList::ActiveTeam()
{
return **(active_group->second.active_team);
}
bool TeamsList::LoadOneTeam(const std::string &dir, const std::string &team_name)
{
// Skip '.', '..' and hidden files
if (team_name[0] == '.' || team_name == "SVN~1")
return false;
// Is it a directory ?
if (!DoesFolderExist(dir+team_name))
return false;
// Add the team
std::string real_name = ANSIToUTF8(dir, team_name);
std::string error;
Team *team = Team::LoadTeam(dir, real_name, error);
if (team) {
full_list.push_back(team);
std::cout << ((1<full_list.size())?", ":" ") << real_name;
std::cout.flush();
return true;
}
std::cerr << std::endl
<< Format(_("Error loading team :")) << real_name <<":"<< error
<< std::endl;
return false;
}
void TeamsList::LoadList()
{
playing_list.clear();
std::cout << "o " << _("Load teams:");
const Config * config = Config::GetInstance();
// Load Warmux teams
std::string dirname = config->GetDataDir() + "team" PATH_SEPARATOR;
FolderSearch *f = OpenFolder(dirname);
if (f) {
const char *name;
bool search_file = false;
while ((name = FolderSearchNext(f, search_file)) != NULL)
LoadOneTeam(dirname, name);
CloseFolder(f);
} else {
Error(Format(_("Cannot open teams directory (%s)!"), dirname.c_str()));
}
// Load personal teams
dirname = config->GetPersonalDataDir() + "team" PATH_SEPARATOR;
f = OpenFolder(dirname);
if (f) {
bool search_files = false;
const char *name;
while ((name = FolderSearchNext(f, search_files)) != NULL)
LoadOneTeam(dirname, name);
CloseFolder(f);
} else {
std::cerr << std::endl
<< Format(_("Cannot open personal teams directory (%s)!"), dirname.c_str())
<< std::endl;
}
full_list.sort(compareTeams);
// We need at least 2 teams
if (full_list.size() < 2)
Error(_("You need at least two valid teams!"));
// Default selection
std::list<uint> nv_selection;
nv_selection.push_back(0);
nv_selection.push_back(1);
ChangeSelection(nv_selection);
std::cout << std::endl;
InitList(Config::GetInstance()->AccessTeamList());
}
void TeamsList::LoadGamingData(WeaponsList * weapons_list)
{
//std::sort(playing_list.begin(), playing_list.end(), compareTeams); // needed to fix bug #9820
iterator it=playing_list.begin(), end=playing_list.end();
// Load the data of all teams
for (; it != end; ++it) {
(*it)->LoadGamingData(weapons_list);
}
groups.clear();
for (it=playing_list.begin(); it != end; ++it) {
groups[ (*it)->GetGroup() ].push_back(*it);
if ((*it)->IsLocalAI())
(*it)->LoadAI();
}
}
void TeamsList::<API key>()
{
MSG_DEBUG("random.get", "TeamList::<API key>()");
int skip = RandomSync().GetInt(0, groups.size()-1);
for (GroupList::iterator git = groups.begin(); git != groups.end(); ++git) {
if (!(skip
active_group = git;
TeamGroup& g = git->second;
int skip2 = RandomSync().GetInt(1, g.size());
g.active_team = g.begin();
while (--skip2)
g.active_team++;
}
}
void TeamsList::UnloadGamingData()
{
groups.clear();
// Iterate over all teams not just he playing ones
// in order to unload leaver teams.
full_iterator it=full_list.begin(), end = full_list.end();
// Unload the data of all teams
for (; it != end; ++it)
(**it).UnloadGamingData();
// Run this now as no reference from Character are left
BodyList::GetRef().FreeMem();
}
Team *TeamsList::FindById(const std::string &id, int &pos)
{
full_iterator it=full_list.begin(), end = full_list.end();
int i=0;
for (; it != end; ++it, ++i) {
if ((*it)->GetId() == id) {
pos = i;
return (*it);
}
}
pos = -1;
return NULL;
}
Team *TeamsList::FindByIndex(uint index)
{
if (full_list.size() < index+1) {
ASSERT(false);
return NULL;
}
full_iterator it = full_list.begin(), end = full_list.end();
uint i=0;
for (; it != end; ++it, ++i) {
if (i == index)
return (*it);
}
return NULL;
}
Team* TeamsList::FindPlayingById(const std::string &id, int &index)
{
iterator it = playing_list.begin(), end = playing_list.end();
index=0;
for (; it != end; ++it, ++index) {
if ((*it) -> GetId() == id)
return *it;
}
index = -1;
ASSERT(false);
return NULL;
}
void TeamsList::InitList(const std::list<ConfigTeam> &lst)
{
Clear();
std::list<ConfigTeam>::const_iterator it=lst.begin(), end=lst.end();
for (; it != end; ++it)
AddTeam(*it, true, false);
}
void TeamsList::InitEnergy()
{
// Looking at team with the greatest energy
// (in case teams does not have same amount of character)
iterator it = playing_list.begin(), end = playing_list.end();
uint max = 0;
for (; it != end; ++it) {
if ((**it).ReadEnergy() > max)
max = (**it).ReadEnergy();
}
// Init each team's energy bar
it=playing_list.begin();
for (; it != end; ++it)
(**it).InitEnergy(max);
// Initial ranking
it=playing_list.begin();
for (; it != end; ++it) {
uint rank = 0;
iterator it2=playing_list.begin();
for (; it2 != end; ++it2) {
if (it != it2 && (**it2).ReadEnergy() > (**it).ReadEnergy())
++rank;
}
(**it).energy.rank_tmp = rank;
}
it=playing_list.begin();
for (; it != end; ++it) {
uint rank = (**it).energy.rank_tmp;
iterator it2=playing_list.begin();
for (it2 = it; it2 != end; ++it2) {
if (it != it2 && (**it2).ReadEnergy() == (**it).ReadEnergy())
++rank;
}
(**it).energy.SetRanking(rank);
}
}
void TeamsList::RefreshEnergy()
{
// In the order of the priorit :
// - finish current action
// - change a teams energy
// - change ranking
// - prepare energy bar for next event
iterator it=playing_list.begin(), end = playing_list.end();
energy_t status;
bool waiting = true; // every energy bar are waiting
for (; it != end; ++it) {
if ((**it).energy.status != EnergyStatusWait) {
waiting = false;
break;
}
}
// one of the energy bar is changing ?
if (!waiting) {
status = EnergyStatusOK;
// change an energy bar value ?
for (it=playing_list.begin(); it != end; ++it) {
if ((**it).energy.status == <API key>) {
status = <API key>;
break;
}
}
// change a ranking ?
for (it=playing_list.begin(); it != end; ++it) {
if ((**it).energy.status == <API key>
&& ((**it).energy.IsMoving() || status == EnergyStatusOK)) {
status = <API key>;
break;
}
}
}
else {
// every energy bar are waiting
// -> set state ready for a new event
status = EnergyStatusOK;
}
// Setting event to process in every energy bar
if (status != EnergyStatusOK || waiting) {
it = playing_list.begin();
for (; it != end; ++it) {
(**it).energy.status = status;
}
}
// Actualisation des valeurs (pas d'actualisation de l'affichage)
for (it=playing_list.begin(); it != end; ++it) {
(**it).UpdateEnergyBar();
}
RefreshSort();
}
void TeamsList::RefreshSort()
{
iterator it=playing_list.begin(), end = playing_list.end();
uint rank;
// Find a ranking without taking acount of the equalities
it = playing_list.begin();
for (; it != end; ++it) {
rank = 0;
iterator it2=playing_list.begin();
for (; it2 != end; ++it2) {
if (it != it2 && (**it2).ReadEnergy() > (**it).ReadEnergy())
++rank;
}
(**it).energy.rank_tmp = rank;
}
// Fix equalities
it = playing_list.begin();
for (; it != end; ++it) {
rank = (**it).energy.rank_tmp;
iterator it2=playing_list.begin();
for (it2 = it; it2 != end; ++it2) {
if (it != it2 && (**it2).ReadEnergy() == (**it).ReadEnergy())
++rank;
}
(**it).energy.NewRanking(rank);
}
}
void TeamsList::ChangeSelection(const std::list<uint>& nv_selection)
{
selection = nv_selection;
selection_iterator it=selection.begin(), end = selection.end();
playing_list.clear();
for (; it != end; ++it)
playing_list.push_back(FindByIndex(*it));
}
bool TeamsList::IsSelected(uint index)
{
selection_iterator pos = std::find(selection.begin(), selection.end(), index);
return pos != selection.end();
}
void TeamsList::AddTeam(Team* the_team, int pos, const ConfigTeam &the_team_cfg,
bool is_local)
{
ASSERT(the_team != NULL);
the_team->SetRemote(!is_local);
UpdateTeam(the_team, the_team_cfg);
selection.push_back(pos);
playing_list.push_back(the_team);
}
void TeamsList::AddTeam(const ConfigTeam &the_team_cfg, bool is_local,
bool generate_error)
{
MSG_DEBUG("team", "%s, local: %d\n", the_team_cfg.id.c_str(), is_local);
int pos;
Team *the_team = FindById(the_team_cfg.id, pos);
if (the_team != NULL) {
AddTeam(the_team, pos, the_team_cfg, is_local);
} else {
std::string msg = Format(_("Can't find team %s!"), the_team_cfg.id.c_str());
if (generate_error)
Error (msg);
else
std::cout << "! " << msg << std::endl;
}
}
void TeamsList::UpdateTeam(Team* the_team, const ConfigTeam &the_team_cfg)
{
ASSERT(the_team);
// set the player name and number of characters
the_team->SetPlayerName(the_team_cfg.player_name);
the_team->SetNbCharacters(the_team_cfg.nb_characters);
the_team->SetAIName(the_team_cfg.ai);
the_team->SetGroup(the_team_cfg.group);
}
Team* TeamsList::UpdateTeam(const std::string& old_team_id,
const ConfigTeam &the_team_cfg)
{
int pos;
Team *the_team = NULL;
MSG_DEBUG("team", "%s/%s\n", old_team_id.c_str(), the_team_cfg.id.c_str());
if (old_team_id == the_team_cfg.id) {
// this is a simple update
the_team = FindById(the_team_cfg.id, pos);
if (the_team) {
UpdateTeam(the_team, the_team_cfg);
} else {
Error(Format(_("Can't find team %s!"), the_team_cfg.id.c_str()));
}
return the_team;
}
// here we are replacing a team by another one
Team *the_old_team = FindById(old_team_id, pos);
if (!the_old_team) {
Error(Format(_("Can't find team %s!"), old_team_id.c_str()));
return NULL;
}
the_team = FindById(the_team_cfg.id, pos);
if (!the_team) {
Error(Format(_("Can't find team %s!"), old_team_id.c_str()));
return NULL;
}
bool is_local = the_old_team->IsLocal();
DelTeam(the_old_team);
AddTeam(the_team, pos, the_team_cfg, is_local);
return the_team;
}
void TeamsList::DelTeam(Team* the_team)
{
uint pos = 0;
ASSERT(the_team);
MSG_DEBUG("team", "%s\n", the_team->GetId().c_str());
the_team-><API key>();
selection_iterator it = std::find(selection.begin(), selection.end(), pos);
if (it != selection.end())
selection.erase(it);
iterator playing_it = std::find(playing_list.begin(), playing_list.end(), the_team);
ASSERT(playing_it != playing_list.end());
if (playing_it != playing_list.end())
playing_list.erase(playing_it);
}
void TeamsList::DelTeam(const std::string &id)
{
int pos;
Team *the_team = FindById(id, pos);
DelTeam(the_team);
}
void TeamsList::SetActive(const std::string &id)
{
for (GroupList::iterator git = groups.begin(); git != groups.end(); ++git) {
for (TeamGroup::iterator it = git->second.begin(); it != git->second.end(); ++it) {
if ((*it)->GetId() == id) {
active_group = git;
git->second.active_team = it;
(*it)->PrepareTurn();
return;
}
}
}
Error(Format(_("Can't find team %s!"), id.c_str()));
}
Character& ActiveCharacter()
{
return ActiveTeam().ActiveCharacter();
}
bool compareTeams(const Team *a, const Team *b)
{
return a->GetName() < b->GetName();
}
|
package org.jpc.emulator.execution.opcodes.vm;
import org.jpc.emulator.execution.*;
import org.jpc.emulator.execution.decoder.*;
import org.jpc.emulator.processor.*;
import org.jpc.emulator.processor.fpu64.*;
import static org.jpc.emulator.processor.Processor.*;
public class fdiv_ST1_ST1 extends Executable
{
public fdiv_ST1_ST1(int blockStart, int eip, int prefices, PeekableInputStream input)
{
super(blockStart, eip);
int modrm = input.readU8();
}
public Branch execute(Processor cpu)
{
double freg0 = cpu.fpu.ST(1);
double freg1 = cpu.fpu.ST(1);
if (((freg0 == 0.0) && (freg1 == 0.0)) || (Double.isInfinite(freg0) && Double.isInfinite(freg1)))
cpu.fpu.setInvalidOperation();
if ((freg0 == 0.0) && !Double.isNaN(freg1) && !Double.isInfinite(freg1))
cpu.fpu.setZeroDivide();
cpu.fpu.setST(1, freg0/freg1);
return Branch.None;
}
public boolean isBranch()
{
return false;
}
public String toString()
{
return this.getClass().getName();
}
}
|
/*
* COM1 NS16550 support
* originally from linux source (arch/ppc/boot/ns16550.c)
* modified to use CONFIG_SYS_ISA_MEM and new defines
*/
#include <config.h>
#include <ns16550.h>
#define LCRVAL LCR_8N1 /* 8 data, 1 stop, no parity */
#define MCRVAL (MCR_DTR | MCR_RTS) /* RTS/DTR */
#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR) /* Clear & enable FIFOs */
void NS16550_init (NS16550_t com_port, int baud_divisor)
{
com_port->ier = 0x00;
#ifdef CONFIG_OMAP
com_port->mdr1 = 0x7; /* mode select reset TL16C750*/
#endif
com_port->lcr = LCR_BKSE | LCRVAL;
com_port->dll = 0;
com_port->dlm = 0;
com_port->lcr = LCRVAL;
com_port->mcr = MCRVAL;
com_port->fcr = FCRVAL;
com_port->lcr = LCR_BKSE | LCRVAL;
com_port->dll = baud_divisor & 0xff;
com_port->dlm = (baud_divisor >> 8) & 0xff;
com_port->lcr = LCRVAL;
#if defined(CONFIG_OMAP)
#if defined(CONFIG_APTIX)
com_port->mdr1 = 3; /* /13 mode so Aptix 6MHz can hit 115200 */
#else
com_port->mdr1 = 0; /* /16 is proper to hit 115200 with 48MHz */
#endif
#endif /* CONFIG_OMAP */
}
#ifndef <API key>
void NS16550_reinit (NS16550_t com_port, int baud_divisor)
{
com_port->ier = 0x00;
com_port->lcr = LCR_BKSE | LCRVAL;
com_port->dll = 0;
com_port->dlm = 0;
com_port->lcr = LCRVAL;
com_port->mcr = MCRVAL;
com_port->fcr = FCRVAL;
com_port->lcr = LCR_BKSE;
com_port->dll = baud_divisor & 0xff;
com_port->dlm = (baud_divisor >> 8) & 0xff;
com_port->lcr = LCRVAL;
}
#endif /* <API key> */
void NS16550_putc (NS16550_t com_port, char c)
{
while ((com_port->lsr & LSR_THRE) == 0);
com_port->thr = c;
}
#ifndef <API key>
char NS16550_getc (NS16550_t com_port)
{
while ((com_port->lsr & LSR_DR) == 0) {
#ifdef CONFIG_USB_TTY
extern void usbtty_poll(void);
usbtty_poll();
#endif
}
return (com_port->rbr);
}
int NS16550_tstc (NS16550_t com_port)
{
return ((com_port->lsr & LSR_DR) != 0);
}
#endif /* <API key> */
|
<?php
// no direct access
defined('_JEXEC') or die('Restircted access');
abstract class JHtmlCreativeForm
{
/**
* @param int $value The featured value
* @param int $i
* @param bool $canChange Whether the value can be changed or not
*
* @return string The anchor tag to toggle featured/unfeatured contacts.
* @since 1.6
*/
static function featured($value = 0, $i, $canChange = true)
{
// Array of image, task, title, action
$states = array(
0 => array('disabled.png', 'creativeforms.featured', '<API key>', '<API key>'),
1 => array('featured.png', 'creativeforms.unfeatured', '<API key>', '<API key>'),
);
$state = JArrayHelper::getValue($states, (int) $value, $states[1]);
$html = JHtml::_('image', 'admin/'.$state[0], JText::_($state[2]), NULL, true);
if ($canChange) {
$html = '<a href="#" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" title="'.JText::_($state[3]).'">'
. $html .'</a>';
}
return $html;
}
}
|
#include "mod_sftp.h"
#include "keys.h"
#include "keystore.h"
#include "crypto.h"
#include "rfc4716.h"
/* File-based keystore implementation */
struct filestore_key {
/* Supported headers. We don't really care about the Comment header
* at the moment.
*/
const char *subject;
/* Key data */
unsigned char *key_data;
uint32_t key_datalen;
};
struct filestore_data {
pr_fh_t *fh;
const char *path;
unsigned int lineno;
};
static const char *trace_channel = "ssh2";
/* This getline() function is quite similar to pr_fsio_getline(), except
* that it a) enforces the 72-byte max line length from RFC4716, and b)
* properly handles lines ending with CR, LF, or CRLF.
*
* Technically it allows one more byte than necessary, since the worst case
* is 74 bytes (72 + CRLF); this also means 73 + CR or 73 + LF. The extra
* byte is for the terminating NUL.
*/
static char *filestore_getline(sftp_keystore_t *store, pool *p) {
char linebuf[75], *line = "", *res;
struct filestore_data *store_data = store->keystore_data;
while (TRUE) {
size_t linelen;
pr_signals_handle();
memset(&linebuf, '\0', sizeof(linebuf));
res = pr_fsio_gets(linebuf, sizeof(linebuf) - 1, store_data->fh);
if (res == NULL) {
if (errno == EINTR) {
continue;
}
pr_trace_msg(trace_channel, 10, "reached end of '%s', no matching "
"key found", store_data->path);
errno = EOF;
return NULL;
}
linelen = strlen(linebuf);
if (linelen >= 1) {
if (linebuf[linelen - 1] == '\r' ||
linebuf[linelen - 1] == '\n') {
char *tmp;
unsigned int header_taglen, header_valuelen;
int <API key> = FALSE;
store_data->lineno++;
linebuf[linelen - 1] = '\0';
line = pstrcat(p, line, linebuf, NULL);
if (line[strlen(line) - 1] == '\\') {
<API key> = TRUE;
line[strlen(line) - 1] = '\0';
}
tmp = strchr(line, ':');
if (tmp == NULL) {
return line;
}
/* We have a header. Make sure the header tag is not longer than
* the specified length of 64 bytes, and that the header value is
* not longer than 1024 bytes.
*/
header_taglen = tmp - line;
if (header_taglen > 64) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"header tag too long (%u) on line %u of '%s'", header_taglen,
store_data->lineno, store_data->path);
errno = EINVAL;
return NULL;
}
/* Header value starts at 2 after the ':' (one for the mandatory
* space character.
*/
header_valuelen = strlen(line) - (header_taglen + 2);
if (header_valuelen > 1024) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"header value too long (%u) on line %u of '%s'", header_valuelen,
store_data->lineno, store_data->path);
errno = EINVAL;
return NULL;
}
if (!<API key>) {
return line;
}
continue;
} else if (linelen >= 2 &&
linebuf[linelen - 2] == '\r' &&
linebuf[linelen - 1] == '\n') {
char *tmp;
unsigned int header_taglen, header_valuelen;
int <API key> = FALSE;
store_data->lineno++;
linebuf[linelen - 2] = '\0';
linebuf[linelen - 1] = '\0';
line = pstrcat(p, line, linebuf, NULL);
if (line[strlen(line) - 1] == '\\') {
<API key> = TRUE;
line[strlen(line) - 1] = '\0';
}
tmp = strchr(line, ':');
if (tmp == NULL) {
return line;
}
/* We have a header. Make sure the header tag is not longer than
* the specified length of 64 bytes, and that the header value is
* not longer than 1024 bytes.
*/
header_taglen = tmp - line;
if (header_taglen > 64) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"header tag too long (%u) on line %u of '%s'", header_taglen,
store_data->lineno, store_data->path);
errno = EINVAL;
return NULL;
}
/* Header value starts at 2 after the ':' (one for the mandatory
* space character.
*/
header_valuelen = strlen(line) - (header_taglen + 2);
if (header_valuelen > 1024) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"header value too long (%u) on line %u of '%s'", header_valuelen,
store_data->lineno, store_data->path);
errno = EINVAL;
return NULL;
}
if (!<API key>) {
return line;
}
continue;
} else if (linelen < sizeof(linebuf)) {
/* No CR or LF terminator; maybe a badly formatted file? Try to
* work with the data, if we can.
*/
line = pstrcat(p, line, linebuf, NULL);
return line;
} else {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"line too long (%lu) on line %u of '%s'", (unsigned long) linelen,
store_data->lineno, store_data->path);
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"Make sure that '%s' is a RFC4716 formatted key", store_data->path);
errno = EINVAL;
break;
}
}
}
return NULL;
}
static struct filestore_key *filestore_get_key(sftp_keystore_t *store,
pool *p) {
char *line;
BIO *bio = NULL;
struct filestore_key *key = NULL;
struct filestore_data *store_data = store->keystore_data;
size_t begin_markerlen = 0, end_markerlen = 0;
line = filestore_getline(store, p);
while (line == NULL &&
errno == EINVAL) {
line = filestore_getline(store, p);
}
begin_markerlen = strlen(<API key>);
end_markerlen = strlen(<API key>);
while (line) {
pr_signals_handle();
if (key == NULL &&
strncmp(line, <API key>,
begin_markerlen + 1) == 0) {
key = pcalloc(p, sizeof(struct filestore_key));
bio = BIO_new(BIO_s_mem());
} else if (key != NULL &&
strncmp(line, <API key>,
end_markerlen + 1) == 0) {
if (bio) {
BIO *b64 = NULL, *bmem = NULL;
char chunk[1024], *data = NULL;
int chunklen;
long datalen = 0;
/* Add a base64 filter BIO, and read the data out, thus base64-decoding
* the key. Write the decoded data into another memory BIO.
*/
b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, <API key>);
bio = BIO_push(b64, bio);
bmem = BIO_new(BIO_s_mem());
memset(chunk, '\0', sizeof(chunk));
chunklen = BIO_read(bio, chunk, sizeof(chunk));
if (chunklen < 0 &&
!BIO_should_retry(bio)) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"unable to base64-decode data in '%s': %s",
store_data->path, <API key>());
BIO_free_all(bio);
BIO_free_all(bmem);
errno = EPERM;
return NULL;
}
while (chunklen > 0) {
pr_signals_handle();
if (BIO_write(bmem, chunk, chunklen) < 0) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error writing to memory BIO: %s", <API key>());
BIO_free_all(bio);
BIO_free_all(bmem);
errno = EPERM;
return NULL;
}
memset(chunk, '\0', sizeof(chunk));
chunklen = BIO_read(bio, chunk, sizeof(chunk));
}
datalen = BIO_get_mem_data(bmem, &data);
if (data != NULL &&
datalen > 0) {
key->key_data = palloc(p, datalen);
key->key_datalen = datalen;
memcpy(key->key_data, data, datalen);
} else {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error base64-decoding key data in '%s'", store_data->path);
}
BIO_free_all(bio);
bio = NULL;
BIO_free_all(bmem);
}
break;
} else {
if (key) {
if (strstr(line, ": ") != NULL) {
if (strncasecmp(line, "Subject: ", 9) == 0) {
key->subject = pstrdup(p, line + 9);
}
} else {
if (BIO_write(bio, line, strlen(line)) < 0) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error buffering base64 data");
}
}
}
}
line = filestore_getline(store, p);
while (line == NULL &&
errno == EINVAL) {
line = filestore_getline(store, p);
}
}
return key;
}
static int <API key>(sftp_keystore_t *store, pool *p,
const char *user, const char *host_fqdn, const char *host_user,
unsigned char *key_data, uint32_t key_len) {
struct filestore_key *key = NULL;
struct filestore_data *store_data = store->keystore_data;
int res = -1;
if (!store_data->path) {
errno = EPERM;
return -1;
}
/* XXX Note that this will scan the file from the beginning, each time.
* There's room for improvement; perhaps mmap() the file into memory?
*/
key = filestore_get_key(store, p);
while (key) {
int ok;
pr_signals_handle();
ok = <API key>(p, key_data, key_len, key->key_data,
key->key_datalen);
if (ok != TRUE) {
if (ok == -1) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error comparing keys from '%s': %s", store_data->path,
strerror(errno));
}
} else {
/* XXX Verify that the user and the host_user match?? */
res = 0;
break;
}
key = filestore_get_key(store, p);
}
if (res == 0) {
pr_trace_msg(trace_channel, 10, "found matching public key for host '%s' "
"in '%s'", host_fqdn, store_data->path);
}
if (pr_fsio_lseek(store_data->fh, 0, SEEK_SET) < 0) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error seeking to start of '%s': %s", store_data->path, strerror(errno));
return -1;
}
store_data->lineno = 0;
return res;
}
static int <API key>(sftp_keystore_t *store, pool *p,
const char *user, unsigned char *key_data, uint32_t key_len) {
struct filestore_key *key = NULL;
struct filestore_data *store_data = store->keystore_data;
unsigned int count = 0;
int res = -1;
if (!store_data->path) {
errno = EPERM;
return -1;
}
/* XXX Note that this will scan the file from the beginning, each time.
* There's room for improvement; perhaps mmap() the file into memory?
*/
key = filestore_get_key(store, p);
while (key) {
int ok;
pr_signals_handle();
count++;
ok = <API key>(p, key_data, key_len, key->key_data,
key->key_datalen);
if (ok != TRUE) {
if (ok == -1) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error comparing keys from '%s': %s", store_data->path,
strerror(errno));
} else {
pr_trace_msg(trace_channel, 10,
"failed to match key #%u from file '%s'", count, store_data->path);
}
} else {
/* If we are configured to check for Subject headers, and if the file key
* has a Subject header, and that header value does not match the
* logging in user, then continue looking.
*/
if ((sftp_opts & <API key>) &&
key->subject != NULL) {
if (strcmp(key->subject, user) != 0) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"found matching key for user '%s' in '%s', but Subject "
"header ('%s') does not match, skipping key", user,
store_data->path, key->subject);
} else {
res = 0;
break;
}
} else {
res = 0;
break;
}
}
key = filestore_get_key(store, p);
}
if (res == 0) {
pr_trace_msg(trace_channel, 10, "found matching public key for user '%s' "
"in '%s'", user, store_data->path);
}
if (pr_fsio_lseek(store_data->fh, 0, SEEK_SET) < 0) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
"error seeking to start of '%s': %s", store_data->path, strerror(errno));
return -1;
}
store_data->lineno = 0;
return res;
}
static int filestore_close(sftp_keystore_t *store) {
struct filestore_data *store_data = store->keystore_data;
pr_fsio_close(store_data->fh);
return 0;
}
static sftp_keystore_t *filestore_open(pool *parent_pool,
int requested_key_type, const char *store_info, const char *user) {
int xerrno;
sftp_keystore_t *store;
pool *filestore_pool;
struct filestore_data *store_data;
pr_fh_t *fh;
char buf[PR_TUNABLE_PATH_MAX+1], *path;
struct stat st;
filestore_pool = make_sub_pool(parent_pool);
pr_pool_tag(filestore_pool, "SFTP File-based Keystore Pool");
store = pcalloc(filestore_pool, sizeof(sftp_keystore_t));
store->keystore_pool = filestore_pool;
/* Open the file. The given path (store_info) may need to be
* interpolated.
*/
session.user = (char *) user;
memset(buf, '\0', sizeof(buf));
switch (pr_fs_interpolate(store_info, buf, sizeof(buf)-1)) {
case 1:
/* Interpolate occurred; make a copy of the interpolated path. */
path = pstrdup(filestore_pool, buf);
break;
default:
/* Otherwise, use the path as is. */
path = pstrdup(filestore_pool, store_info);
break;
}
session.user = NULL;
PRIVS_ROOT
fh = pr_fsio_open(path, O_RDONLY|O_NONBLOCK);
xerrno = errno;
PRIVS_RELINQUISH
if (fh == NULL) {
destroy_pool(filestore_pool);
errno = xerrno;
return NULL;
}
if (pr_fsio_set_block(fh) < 0) {
xerrno = errno;
destroy_pool(filestore_pool);
(void) pr_fsio_close(fh);
errno = xerrno;
return NULL;
}
/* Stat the opened file to determine the optimal buffer size for IO. */
memset(&st, 0, sizeof(st));
if (pr_fsio_fstat(fh, &st) < 0) {
xerrno = errno;
destroy_pool(filestore_pool);
(void) pr_fsio_close(fh);
errno = xerrno;
return NULL;
}
if (S_ISDIR(st.st_mode)) {
destroy_pool(filestore_pool);
(void) pr_fsio_close(fh);
errno = EISDIR;
return NULL;
}
fh->fh_iosz = st.st_blksize;
store_data = pcalloc(filestore_pool, sizeof(struct filestore_data));
store->keystore_data = store_data;
store_data->path = path;
store_data->fh = fh;
store_data->lineno = 0;
store->store_ktypes = requested_key_type;
switch (requested_key_type) {
case <API key>:
store->verify_host_key = <API key>;
break;
case <API key>:
store->verify_user_key = <API key>;
break;
}
store->store_close = filestore_close;
return store;
}
int sftp_rfc4716_init(void) {
<API key>("file", filestore_open,
<API key>|<API key>);
return 0;
}
int sftp_rfc4716_free(void) {
<API key>("file",
<API key>|<API key>);
return 0;
}
|
<?php
class FrmListEntries extends WP_Widget {
function __construct() {
$widget_ops = array( 'description' => __( "Display a list of Formidable entries", 'formidable') );
$this->WP_Widget('frm_list_items', __('Formidable Entries List', 'formidable'), $widget_ops);
}
function widget( $args, $instance ) {
global $frmdb, $wpdb, $frm_entry, $frmpro_display, $frm_entry_meta;
extract($args);
$display = $frmpro_display->getOne($instance['display_id'], false, true);
$title = apply_filters('widget_title', (empty($instance['title']) and $display) ? $display->post_title : $instance['title']);
$limit = empty($instance['limit']) ? ' LIMIT 100' : " LIMIT {$instance['limit']}";
$post_id = (!$display or empty($display->frm_post_id)) ? $instance['post_id'] : $display->frm_post_id;
$page_url = get_permalink($post_id);
$order_by = '';
if ($display && is_numeric($display->frm_form_id) && !empty($display->frm_form_id) ) {
//Set up order for Entries List Widget
if ( isset($display->frm_order_by) && !empty($display->frm_order_by) ) {
//Get only the first order field and order
$order_field = reset($display->frm_order_by);
$order = reset($display->frm_order);
if ( $order_field == 'rand' ) {//If random is set, set the order to random
$order_by = ' RAND()';
} else if ( is_numeric($order_field) ) {//If ordering by a field
//Get all post IDs for this form
$posts = $wpdb->get_results($wpdb->prepare("SELECT id, post_id FROM {$wpdb->prefix}frm_items WHERE form_id=%d and post_id>%d AND is_draft=%d", $display->frm_form_id, 1, 0));
$linked_posts = array();
foreach ( $posts as $post_meta ) {
$linked_posts[$post_meta->post_id] = $post_meta->id;
}
//Get all field information
$frm_field = new FrmField();
$o_field = $frm_field->getOne($order_field);
//create query with ordered values
if ( isset($o_field->field_options['post_field']) and $o_field->field_options['post_field'] ) { //if field is some type of post field
if ( $o_field->field_options['post_field'] == 'post_custom' && ! empty($linked_posts) ) { //if field is custom field
$query = "SELECT m.id FROM {$wpdb->prefix}frm_items m INNER JOIN {$wpdb->postmeta} pm ON pm.post_id=m.post_id AND pm.meta_key='". $o_field->field_options['custom_field']."' WHERE pm.post_id in (". implode(',', array_keys($linked_posts)).") ORDER BY CASE when pm.meta_value IS NULL THEN 1 ELSE 0 END, pm.meta_value {$order}";
} else if ( $o_field->field_options['post_field'] != 'post_category' && ! empty($linked_posts) ) {//if field is a non-category post field
$query = "SELECT m.id FROM {$wpdb->prefix}frm_items m INNER JOIN {$wpdb->posts} p ON p.ID=m.post_id WHERE p.ID in (". implode(',', array_keys($linked_posts)).") ORDER BY CASE p.".$o_field->field_options['post_field']." WHEN '' THEN 1 ELSE 0 END, p.".$o_field->field_options['post_field']." {$order}";
}
} else { //if field is a normal, non-post field
$query = "SELECT m.id FROM {$wpdb->prefix}frm_items m INNER JOIN {$wpdb->prefix}frm_item_metas em ON em.item_id=m.id WHERE em.field_id=$o_field->id ORDER BY CASE when em.meta_value IS NULL THEN 1 ELSE 0 END, em.meta_value".($o_field->type == 'number' ? ' +0 ' : '')." {$order}";
}
//Get ordered values
$metas = $wpdb->get_results($query);
unset($query);
if (is_array($metas) and !empty($metas)){
$desc_order = ' DESC';
foreach ($metas as $meta)
$order_by .= $wpdb->prepare('it.id=%d'. $desc_order.', ', $meta->id);
$order_by = rtrim($order_by, ', ');
} else {
$order_by .= 'it.created_at '. $order;
}
} else if ( !empty($order_field) ) { //If ordering by created_at or updated_at
$order_by = 'it.'.$order_field.' '.$order;
}
if ( !empty($order_by) ) {
$order_by = ' ORDER BY '. $order_by;
}
}
if (isset($instance['cat_list']) and (int)$instance['cat_list'] == 1 and is_numeric($instance['cat_id'])){
global $frm_field;
if ($cat_field = $frm_field->getOne($instance['cat_id']))
$categories = maybe_unserialize($cat_field->options);
}
}
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo "<ul id='frm_entry_list". (($display) ? $display->frm_form_id : '') ."'>\n";
//if Listing entries by category
if ( isset($instance['cat_list']) and (int)$instance['cat_list'] == 1 and isset($categories) and is_array($categories) ) {
foreach ($categories as $cat_order => $cat){
if ($cat == '') continue;
echo '<li>';
if (isset($instance['cat_name']) and (int)$instance['cat_name'] == 1)
echo '<a href="'. add_query_arg(array('frm_cat' => $cat_field->field_key, 'frm_cat_id' => $cat_order), $page_url) .'">';
echo $cat;
if (isset($instance['cat_count']) and (int)$instance['cat_count'] == 1)
echo ' ('. FrmProFieldsHelper::get_field_stats($instance['cat_id'], 'count', false, $cat) .')';
if (isset($instance['cat_name']) and (int)$instance['cat_name'] == 1){
echo '</a>';
}else{
$entry_ids = $frm_entry_meta->getEntryIds("meta_value LIKE '%$cat%' and fi.id=". $instance['cat_id']);
$items = false;
if ($entry_ids)
$items = $frm_entry->getAll("it.id in (". implode(',', $entry_ids) .") and it.form_id =". (int)$display->frm_form_id, $order_by, $limit);
if ($items){
echo '<ul>';
foreach ($items as $item){
$url_id = $display->frm_type == 'id' ? $item->id : $item->item_key;
$current = (isset($_GET[$display->frm_param]) and $_GET[$display->frm_param] == $url_id) ? ' class="current_page"' : '';
if($item->post_id)
$entry_link = get_permalink($item->post_id);
else
$entry_link = add_query_arg(array($display->frm_param => $url_id), $page_url);
echo '<li'. $current .'><a href="'. $entry_link .'">'. $item->name .'</a></li>'. "\n";
}
echo '</ul>';
}
}
echo '</li>';
}
}else{ // if not listing entries by category
if($display)
$items = $frm_entry->getAll(array('it.form_id' => $display->frm_form_id, 'is_draft' => '0'), $order_by, $limit);
else
$items = array();
foreach ($items as $item){
$url_id = $display->frm_type == 'id' ? $item->id : $item->item_key;
$current = (isset($_GET[$display->frm_param]) and $_GET[$display->frm_param] == $url_id) ? ' class="current_page"' : '';
echo "<li". $current ."><a href='".add_query_arg(array($display->frm_param => $url_id), $page_url)."'>". $item->name ."</a></li>\n";
}
}
echo "</ul>\n";
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
return $new_instance;
}
function form( $instance ) {
global $frmpro_display;
$pages = get_posts( array('post_type' => 'page', 'post_status' => 'publish', 'numberposts' => 999, 'order_by' => 'post_title', 'order' => 'ASC'));
$displays = $frmpro_display->getAll(array('meta_key' => 'show_count', 'meta_value' => 'dynamic'));
//Defaults
$instance = wp_parse_args( (array) $instance, array('title' => false, 'display_id' => false, 'post_id' => false, 'title_id' => false, 'cat_list' => false, 'cat_name' => false, 'cat_count' => false, 'cat_id' => false, 'limit' => false) );
$cat_opts = false;
if ($instance['display_id']){
global $frm_field;
$selected_display = $frmpro_display->getOne($instance['display_id']);
if($selected_display){
$selected_form_id = get_post_meta($selected_display->ID, 'frm_form_id', true);
$title_opts = $frm_field->getAll("fi.form_id=". (int)$selected_form_id ." and type not in ('divider','captcha','break','html')", ' ORDER BY field_order');
$instance['display_id'] = $selected_display->ID;
}
}
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'formidable') ?>:</label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( stripslashes($instance['title']) ); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('display_id'); ?>"><?php _e('Use Settings from View', 'formidable') ?>:</label>
<select name="<?php echo $this->get_field_name('display_id'); ?>" id="<?php echo $this->get_field_id('display_id'); ?>" class="widefat" onchange="<API key>(this.value)">
<option value=""></option>
<?php foreach ($displays as $display)
echo "<option value=". $display->ID . selected( $instance['display_id'], $display->ID ) .">" . $display->post_title . "</option>";
?>
</select>
</p>
<p class="description"><?php _e('Views with a "Both (Dynamic)" format will show here.', 'formidable') ?></p>
<p><label for="<?php echo $this->get_field_id('post_id'); ?>"><?php _e('Page if not specified in View settings', 'formidable') ?>:</label>
<select name="<?php echo $this->get_field_name('post_id'); ?>" id="<?php echo $this->get_field_id('post_id'); ?>" class="widefat">
<option value=""></option>
<?php foreach ($pages as $page)
echo "<option value=". $page->ID . selected( $instance['post_id'], $page->ID ) . ">" . $page->post_title . "</option>";
?>
</select>
</p>
<p><label for="<?php echo $this->get_field_id('title_id'); ?>"><?php _e('Title Field', 'formidable') ?>:</label>
<select name="<?php echo $this->get_field_name('title_id'); ?>" id="<?php echo $this->get_field_id('title_id'); ?>" class="widefat">
<option value=""></option>
<?php
if (isset($title_opts) and $title_opts){
foreach ($title_opts as $title_opt)
if($title_opt->type != 'checkbox')
echo "<option value=". $title_opt->id . selected( $instance['title_id'], $title_opt->id ) . ">" . $title_opt->name . "</option>";
}
?>
</select>
</p>
<p><label for="<?php echo $this->get_field_id('cat_list'); ?>"><input class="checkbox" type="checkbox" <?php checked($instance['cat_list'], true) ?> id="<?php echo $this->get_field_id('cat_list'); ?>" name="<?php echo $this->get_field_name('cat_list'); ?>" value="1" onclick="frm_toggle_cat_opt(this.checked)"/>
<?php _e('List Entries by Category', 'formidable') ?></label></p>
<div id="<?php echo $this->get_field_id('hide_cat_opts'); ?>">
<p><label for="<?php echo $this->get_field_id('cat_id'); ?>"><?php _e('Category Field', 'formidable') ?>:</label>
<select name="<?php echo $this->get_field_name('cat_id'); ?>" id="<?php echo $this->get_field_id('cat_id'); ?>" class="widefat">
<option value=""></option>
<?php
if (isset($title_opts) and $title_opts){
foreach ($title_opts as $title_opt){
if(in_array($title_opt->type, array('select', 'radio', 'checkbox')))
echo "<option value=". $title_opt->id . selected( $instance['cat_id'], $title_opt->id ) . ">" . $title_opt->name . "</option>";
}
}
?>
</select>
</p>
<p><label for="<?php echo $this->get_field_id('cat_count'); ?>"><input class="checkbox" type="checkbox" <?php checked($instance['cat_count'], true) ?> id="<?php echo $this->get_field_id('cat_count'); ?>" name="<?php echo $this->get_field_name('cat_count'); ?>" value="1" />
<?php _e('Show Entry Counts', 'formidable') ?></label></p>
<p><input class="checkbox" type="radio" <?php checked($instance['cat_name'], 1) ?> id="<?php echo $this->get_field_id('cat_name'); ?>" name="<?php echo $this->get_field_name('cat_name'); ?>" value="1" />
<label for="<?php echo $this->get_field_id('cat_name'); ?>"><?php _e('Show Only Category Name', 'formidable') ?></label><br/>
<input class="checkbox" type="radio" <?php checked($instance['cat_name'], 0) ?> id="<?php echo $this->get_field_id('cat_name'); ?>" name="<?php echo $this->get_field_name('cat_name'); ?>" value="0" />
<label for="<?php echo $this->get_field_id('cat_name'); ?>"><?php _e('Show Entries Beneath Categories', 'formidable') ?></label></p>
</div>
<p><label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Entry Limit (leave blank to list all)', 'formidable') ?>:</label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" /></p>
<script type="text/javascript">
jQuery(document).ready(function($){
jQuery("#<?php echo $this->get_field_id('hide_cat_opts') ?>").hide();
if (jQuery("#<?php echo $this->get_field_id('cat_list'); ?>").attr("checked"))
jQuery("#<?php echo $this->get_field_id('hide_cat_opts') ?>").show();
});
function frm_toggle_cat_opt(checked){
if (checked) jQuery("#<?php echo $this->get_field_id('hide_cat_opts') ?>").fadeIn('slow');
else jQuery("#<?php echo $this->get_field_id('hide_cat_opts') ?>").fadeOut('slow');
}
function <API key>(display_id){
if (display_id != ''){
jQuery.ajax({ type:"POST", url:"<?php echo admin_url('admin-ajax.php') ?>",
data:"action=frm_get_cat_opts&display_id="+display_id,
success:function(msg){jQuery("#<?php echo $this->get_field_id('cat_id'); ?>").html(msg);}
});
jQuery.ajax({ type:"POST", url:"<?php echo admin_url('admin-ajax.php') ?>",
data:"action=frm_get_title_opts&display_id="+display_id,
success:function(msg){jQuery("#<?php echo $this->get_field_id('title_id'); ?>").html(msg);}
});
}
}
</script>
<?php
}
}
?>
|
<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php $form = @$this->form; ?>
<?php $row = @$this->row;
JFilterOutput::objectHTMLSafe( $row );
?>
<form action="<?php echo JRoute::_( @$form['action'] ) ?>" method="post" class="adminform" name="adminForm" >
<fieldset>
<legend><?php echo JText::_('Form'); ?></legend>
<table class="admintable">
<tr>
<td width="100" align="right" class="key">
<label for="tax_class_name">
<?php echo JText::_( 'Name' ); ?>:
</label>
</td>
<td>
<input type="text" name="tax_class_name" id="tax_class_name" size="48" maxlength="250" value="<?php echo @$row->tax_class_name; ?>" />
</td>
</tr>
<tr>
<td width="100" align="right" class="key">
<label for="<API key>">
<?php echo JText::_( 'Description' ); ?>:
</label>
</td>
<td>
<textarea name="<API key>" id="<API key>" rows="10" cols="25"><?php echo @$row-><API key>; ?></textarea>
</td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo @$row->tax_class_id; ?>" />
<input type="hidden" name="task" value="" />
</fieldset>
</form>
|
div.contemplate-input .form-textarea {
height: 200px;
border: 1px solid #666;
font-family: Profont, 'lucida console', Monaco, monospace;
}
div.<API key> {
padding: 0 1em;
height: 150px;
overflow: auto;
border: 1px solid #666;
}
|
<!DOCTYPE HTML PUBLIC "-
<HTML
><HEAD
><TITLE
>The Traces Menu</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="The Klusters Handbook"
HREF="index.html"><LINK
REL="UP"
TITLE="Menu Entries"
HREF="c1059.html"><LINK
REL="PREVIOUS"
TITLE="The Correlations Menu"
HREF="x1391.html"><LINK
REL="NEXT"
TITLE="The Displays Menu"
HREF="x1498.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Klusters Handbook</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x1391.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Menu Entries</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x1498.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="menu-traces"
>5.7. The Traces Menu</A
></H1
><P
> <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><SPAN
CLASS="guimenu"
>Traces</SPAN
>-><SPAN
CLASS="guimenuitem"
>Increase Channel Amplitudes</SPAN
> (<B
CLASS="shortcut"
><B
CLASS="keycap"
>Ctrl</B
>-<B
CLASS="keycap"
>Shift</B
>-<B
CLASS="keycap"
>I</B
></B
>)</DT
><DD
><P
>Increases the channel amplitudes</P
></DD
><DT
><SPAN
CLASS="guimenu"
>Traces</SPAN
>-><SPAN
CLASS="guimenuitem"
>Decrease Channel Amplitudes</SPAN
> (<B
CLASS="shortcut"
><B
CLASS="keycap"
>Ctrl</B
>-<B
CLASS="keycap"
>Shift</B
>-<B
CLASS="keycap"
>D</B
></B
>)</DT
><DD
><P
>Decreases the channel amplitudes</P
></DD
><DT
><SPAN
CLASS="guimenu"
>Traces</SPAN
>-><SPAN
CLASS="guimenuitem"
>Show Labels</SPAN
> (<B
CLASS="shortcut"
><B
CLASS="keycap"
>Ctrl</B
>-<B
CLASS="keycap"
>L</B
></B
>)</DT
><DD
><P
>Shows or hides the labels (channel IDs and gains).</P
></DD
></DL
></DIV
>
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x1391.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x1498.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The Correlations Menu</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c1059.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The Displays Menu</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|
<?php
class <API key>
{
/**
* @param int $parentNodeId
* @param eZCLI $cli
*/
public static function deleteThumb( $parentNodeId, $cli = null )
{
/** @var <API key>[] $children */
$children = <API key>::subTreeByNodeID(
array( 'ClassFilterType' => 'include',
'ClassFilterArray' => array( 'image' ) ),
$parentNodeId
);
if ( count( $children ) > 0 )
{
$message = "Remove " . count( $children ) . " images from node $parentNodeId";
if ( $cli )
{
$cli->output( $message );
}
else
{
eZDebug::writeNotice( $message , __METHOD__ );
}
foreach ( $children as $node )
{
$node->removeNodeFromTree();
}
}
}
/**
* @param string $directory
* @param string $imageName
* @param string $parentNodeId
* @return eZContentObject|false
*/
public static function createThumb( $directory, $imageName, $parentNodeId )
{
$user = eZUser::currentUser();
$params = array();
$params['class_identifier'] = 'image';
$params['creator_id'] = $user->attribute( 'contentobject_id' );
$params['parent_node_id'] = $parentNodeId;
$params['storage_dir'] = eZSys::rootDir() . eZSys::fileSeparator() . $directory . '/';
$attributesData = array ( ) ;
$attributesData['name'] = $imageName;
$attributesData['image'] = $imageName;
$params['attributes'] = $attributesData;
$imageContentObject = eZContentFunctions::<API key>($params);
return $imageContentObject;
}
}
?>
|
package org.opennms.netmgt.icmp;
import java.net.InetAddress;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p><API key> class.</p>
*
* @author <a href="mailto:ranger@opennms.org">Ben Reed</a>
* @author <a href="mailto:brozow@opennms.org">Mathew Brozowski</a>
*/
public class <API key> implements <API key> {
private static final Logger LOG = LoggerFactory
.getLogger(<API key>.class);
/**
* Value of round-trip-time for the ping in microseconds.
*/
private Long m_responseTime = null;
private InetAddress m_host;
private Throwable m_error = null;
private CountDownLatch m_latch = new CountDownLatch(1);
/**
* <p>Constructor for <API key>.</p>
*
* @param host a {@link java.net.InetAddress} object.
*/
public <API key>(InetAddress host) {
m_host = host;
}
/** {@inheritDoc} */
@Override
public void handleResponse(InetAddress address, EchoPacket response) {
try {
info("got response for address " + address + ", thread " + response.getIdentifier() + ", seq " + response.getSequenceNumber() + " with a responseTime "+response.elapsedTime(TimeUnit.MILLISECONDS)+"ms");
m_responseTime = (long)Math.round(response.elapsedTime(TimeUnit.MICROSECONDS));
} finally {
m_latch.countDown();
}
}
/** {@inheritDoc} */
@Override
public void handleTimeout(InetAddress address, EchoPacket request) {
try {
assert(request != null);
info("timed out pinging address " + address + ", thread " + request.getIdentifier() + ", seq " + request.getSequenceNumber());
} finally {
m_latch.countDown();
}
}
/** {@inheritDoc} */
@Override
public void handleError(InetAddress address, EchoPacket request, Throwable t) {
try {
m_error = t;
info("an error occurred pinging " + address, t);
} finally {
m_latch.countDown();
}
}
/**
* <p>waitFor</p>
*
* @param timeout a long.
* @throws java.lang.<API key> if any.
*/
public void waitFor(long timeout) throws <API key> {
m_latch.await(timeout, TimeUnit.MILLISECONDS);
}
/**
* <p>waitFor</p>
*
* @throws java.lang.<API key> if any.
*/
public void waitFor() throws <API key> {
info("waiting for ping to "+m_host+" to finish");
m_latch.await();
info("finished waiting for ping to "+m_host+" to finish");
}
public void rethrowError() throws Exception {
if (m_error instanceof Error) {
throw (Error)m_error;
} else if (m_error instanceof Exception) {
throw (Exception)m_error;
}
}
/**
* <p>Getter for the field <code>responseTime</code>.</p>
*
* @return a {@link java.lang.Long} object.
*/
public Long getResponseTime() {
return m_responseTime;
}
public Throwable getError() {
return m_error;
}
/**
* <p>info</p>
*
* @param msg a {@link java.lang.String} object.
*/
public void info(String msg) {
LOG.info(msg);
}
/**
* <p>info</p>
*
* @param msg a {@link java.lang.String} object.
* @param t a {@link java.lang.Throwable} object.
*/
public void info(String msg, Throwable t) {
LOG.info(msg, t);
}
}
|
#ifndef <API key>
#define <API key>
#include "Common.h"
#include "QuestDef.h"
#include "NPCHandler.h"
class WorldSession;
#define <API key> 64 // client supported items unknown, but provided number must be enough
#define <API key> 0xffffff
enum Gossip_Option
{
GOSSIP_OPTION_NONE = 0, //UNIT_NPC_FLAG_NONE (0)
<API key> = 1, //<API key> (1)
<API key> = 2, //<API key> (2)
<API key> = 3, //<API key> (128)
<API key> = 4, //<API key> (8192)
<API key> = 5, //<API key> (16)
<API key> = 6, //<API key> (16384)
<API key> = 7, //<API key> (32768)
<API key> = 8, //<API key> (65536)
<API key> = 9, //<API key> (131072)
<API key> = 10, //<API key> (262144)
<API key> = 11, //<API key> (524288)
<API key> = 12, //<API key> (1048576)
<API key> = 13, //<API key> (2097152)
<API key> = 14, //<API key> (4194304)
<API key> = 15, //<API key> (4096)
<API key> = 16, //<API key> (16) (bonus option for <API key>)
<API key> = 17, //<API key> (16) (bonus option for <API key>)
GOSSIP_OPTION_MAX
};
enum GossipOptionIcon
{
GOSSIP_ICON_CHAT = 0, //white chat bubble
GOSSIP_ICON_VENDOR = 1, //brown bag
GOSSIP_ICON_TAXI = 2, //flight
GOSSIP_ICON_TRAINER = 3, //book
<API key> = 4, //interaction wheel
<API key> = 5, //interaction wheel
<API key> = 6, //brown bag with yellow dot
GOSSIP_ICON_TALK = 7, //white chat bubble with black dots
GOSSIP_ICON_TABARD = 8, //tabard
GOSSIP_ICON_BATTLE = 9, //two swords
GOSSIP_ICON_DOT = 10, //yellow dot
GOSSIP_ICON_CHAT_11 = 11, //This and below are most the same visual as GOSSIP_ICON_CHAT
GOSSIP_ICON_CHAT_12 = 12, //but are still used for unknown reasons.
GOSSIP_ICON_CHAT_13 = 13,
GOSSIP_ICON_CHAT_14 = 14, // probably invalid
GOSSIP_ICON_CHAT_15 = 15, // probably invalid
GOSSIP_ICON_CHAT_16 = 16,
GOSSIP_ICON_CHAT_17 = 17,
GOSSIP_ICON_CHAT_18 = 18,
GOSSIP_ICON_CHAT_19 = 19,
GOSSIP_ICON_CHAT_20 = 20,
GOSSIP_ICON_MAX
};
//POI icons. Many more exist, list not complete.
enum Poi_Icon
{
ICON_POI_BLANK = 0, // Blank (not visible), in 2.4.3 have value 15 with 1..15 values in 0..14 range
<API key> = 1, // Grey mine lorry
<API key> = 2, // Red mine lorry
<API key> = 3, // Blue mine lorry
ICON_POI_BWTOMB = 4, // Blue and White Tomb Stone
<API key> = 5, // Small house
ICON_POI_GREYTOWER = 6, // Grey Tower
ICON_POI_REDFLAG = 7, // Red Flag w/Yellow !
ICON_POI_TOMBSTONE = 8, // Normal tomb stone (brown)
ICON_POI_BWTOWER = 9, // Blue and White Tower
ICON_POI_REDTOWER = 10, // Red Tower
ICON_POI_BLUETOWER = 11, // Blue Tower
ICON_POI_RWTOWER = 12, // Red and White Tower
ICON_POI_REDTOMB = 13, // Red Tomb Stone
ICON_POI_RWTOMB = 14, // Red and White Tomb Stone
ICON_POI_BLUETOMB = 15, // Blue Tomb Stone
ICON_POI_16 = 16, // Grey ?
ICON_POI_17 = 17, // Blue/White ?
ICON_POI_18 = 18, // Blue ?
ICON_POI_19 = 19, // Red and White ?
ICON_POI_20 = 20, // Red ?
ICON_POI_GREYLOGS = 21, // Grey Wood Logs
ICON_POI_BWLOGS = 22, // Blue and White Wood Logs
ICON_POI_BLUELOGS = 23, // Blue Wood Logs
ICON_POI_RWLOGS = 24, // Red and White Wood Logs
ICON_POI_REDLOGS = 25, // Red Wood Logs
ICON_POI_26 = 26, // Grey ?
ICON_POI_27 = 27, // Blue and White ?
ICON_POI_28 = 28, // Blue ?
ICON_POI_29 = 29, // Red and White ?
ICON_POI_30 = 30, // Red ?
ICON_POI_GREYHOUSE = 31, // Grey House
ICON_POI_BWHOUSE = 32, // Blue and White House
ICON_POI_BLUEHOUSE = 33, // Blue House
ICON_POI_RWHOUSE = 34, // Red and White House
ICON_POI_REDHOUSE = 35, // Red House
ICON_POI_GREYHORSE = 36, // Grey Horse
ICON_POI_BWHORSE = 37, // Blue and White Horse
ICON_POI_BLUEHORSE = 38, // Blue Horse
ICON_POI_RWHORSE = 39, // Red and White Horse
ICON_POI_REDHORSE = 40 // Red Horse
};
struct GossipMenuItem
{
uint8 m_gIcon;
bool m_gCoded;
std::string m_gMessage;
uint32 m_gSender;
uint32 m_gOptionId;
std::string m_gBoxMessage;
uint32 m_gBoxMoney;
};
typedef std::vector<GossipMenuItem> GossipMenuItemList;
struct GossipMenuItemData
{
uint32 m_gAction_menu;
uint32 m_gAction_poi;
uint32 m_gAction_script;
};
typedef std::vector<GossipMenuItemData> <API key>;
struct QuestMenuItem
{
uint32 m_qId;
uint8 m_qIcon;
};
typedef std::vector<QuestMenuItem> QuestMenuItemList;
class MANGOS_DLL_SPEC GossipMenu
{
public:
explicit GossipMenu(WorldSession* session);
~GossipMenu();
void AddMenuItem(uint8 Icon, const std::string& Message, bool Coded = false);
void AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded = false);
// for using from scripts, don't must be inlined
void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
void AddMenuItem(uint8 Icon, char const* Message, uint32 dtSender, uint32 dtAction, char const* BoxMessage, uint32 BoxMoney, bool Coded = false);
void AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32 dtAction, int32 boxText, uint32 BoxMoney, bool Coded = false);
void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; }
uint32 GetMenuId() { return m_gMenuId; }
void <API key>(uint32 action_menu, uint32 action_poi, uint32 action_script);
unsigned int MenuItemCount() const
{
return m_gItems.size();
}
bool Empty() const
{
return m_gItems.empty();
}
GossipMenuItem const& GetItem( unsigned int Id )
{
return m_gItems[ Id ];
}
GossipMenuItemData const& GetItemData(unsigned int indexId)
{
return m_gItemsData[indexId];
}
uint32 MenuItemSender( unsigned int ItemId );
uint32 MenuItemAction( unsigned int ItemId );
bool MenuItemCoded( unsigned int ItemId );
void ClearMenu();
WorldSession* GetMenuSession() const { return m_session; }
protected:
GossipMenuItemList m_gItems;
<API key> m_gItemsData;
uint32 m_gMenuId;
private:
WorldSession* m_session;
};
class QuestMenu
{
public:
QuestMenu();
~QuestMenu();
void AddMenuItem( uint32 QuestId, uint8 Icon);
void ClearMenu();
uint8 MenuItemCount() const
{
return m_qItems.size();
}
bool Empty() const
{
return m_qItems.empty();
}
bool HasItem( uint32 questid );
QuestMenuItem const& GetItem( uint16 Id )
{
return m_qItems[ Id ];
}
protected:
QuestMenuItemList m_qItems;
};
class MANGOS_DLL_SPEC PlayerMenu
{
private:
GossipMenu mGossipMenu;
QuestMenu mQuestMenu;
public:
explicit PlayerMenu(WorldSession *Session);
~PlayerMenu();
GossipMenu& GetGossipMenu() { return mGossipMenu; }
QuestMenu& GetQuestMenu() { return mQuestMenu; }
WorldSession* GetMenuSession() const { return mGossipMenu.GetMenuSession(); }
bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); }
void ClearMenus();
uint32 GossipOptionSender( unsigned int Selection );
uint32 GossipOptionAction( unsigned int Selection );
bool GossipOptionCoded( unsigned int Selection );
void SendGossipMenu( uint32 TitleTextId, uint64 npcGUID );
void CloseGossip();
void SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName );
void SendPointOfInterest( uint32 poi_id );
void SendTalking( uint32 textID );
void SendTalking( char const * title, char const * text );
/*** QUEST SYSTEM ***/
void <API key>( uint8 questStatus, uint64 npcGUID );
void <API key>( QEmote eEmote, const std::string& Title, uint64 npcGUID );
void <API key> ( Quest const *pQuest );
void <API key>( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);
void <API key>( Quest const* pQuest, uint64 npcGUID, bool EnbleNext );
void <API key>( Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel );
};
#endif
|
/**
* @requires OpenLayers/Layer.js
*/
/**
* Class: OpenLayers.Layer.Markers
*
* Inherits from:
* - <OpenLayers.Layer>
*/
OpenLayers.Layer.Markers = OpenLayers.Class(OpenLayers.Layer, {
/**
* APIProperty: isBaseLayer
* {Boolean} Markers layer is never a base layer.
*/
isBaseLayer: false,
/**
* APIProperty: markers
* {Array(<OpenLayers.Marker>)} internal marker list
*/
markers: null,
/**
* Property: drawn
* {Boolean} internal state of drawing. This is a workaround for the fact
* that the map does not call moveTo with a zoomChanged when the map is
* first starting up. This lets us catch the case where we have *never*
* drawn the layer, and draw it even if the zoom hasn't changed.
*/
drawn: false,
/**
* Constructor: OpenLayers.Layer.Markers
* Create a Markers layer.
*
* Parameters:
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
this.markers = [];
},
/**
* APIMethod: destroy
*/
destroy: function() {
this.clearMarkers();
this.markers = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/**
* APIMethod: setOpacity
* Sets the opacity for all the markers.
*
* Parameter:
* opacity - {Float}
*/
setOpacity: function(opacity) {
if (opacity != this.opacity) {
this.opacity = opacity;
for (var i=0, len=this.markers.length; i<len; i++) {
this.markers[i].setOpacity(this.opacity);
}
}
},
/**
* Method: moveTo
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* zoomChanged - {Boolean}
* dragging - {Boolean}
*/
moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
if (zoomChanged || !this.drawn) {
for(var i=0, len=this.markers.length; i<len; i++) {
this.drawMarker(this.markers[i]);
}
this.drawn = true;
}
},
/**
* APIMethod: addMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
*/
addMarker: function(marker) {
this.markers.push(marker);
if (this.opacity != null) {
marker.setOpacity(this.opacity);
}
if (this.map && this.map.getExtent()) {
marker.map = this.map;
this.drawMarker(marker);
}
},
/**
* APIMethod: removeMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
*/
removeMarker: function(marker) {
if (this.markers && this.markers.length) {
OpenLayers.Util.removeItem(this.markers, marker);
marker.erase();
}
},
/**
* Method: clearMarkers
* This method removes all markers from a layer. The markers are not
* destroyed by this function, but are removed from the list of markers.
*/
clearMarkers: function() {
if (this.markers != null) {
while(this.markers.length > 0) {
this.removeMarker(this.markers[0]);
}
}
},
/**
* Method: drawMarker
* Calculate the pixel location for the marker, create it, and
* add it to the layer's div
*
* Parameters:
* marker - {<OpenLayers.Marker>}
*/
drawMarker: function(marker) {
var px = this.map.<API key>(marker.lonlat);
if (px == null) {
marker.display(false);
} else {
if (!marker.isDrawn()) {
var markerImg = marker.draw(px);
this.div.appendChild(markerImg);
} else if(marker.icon) {
marker.icon.moveTo(px);
}
}
},
/**
* APIMethod: getDataExtent
* Calculates the max extent which includes all of the markers.
*
* Returns:
* {<OpenLayers.Bounds>}
*/
getDataExtent: function () {
var maxExtent = null;
if ( this.markers && (this.markers.length > 0)) {
var maxExtent = new OpenLayers.Bounds();
for(var i=0, len=this.markers.length; i<len; i++) {
var marker = this.markers[i];
maxExtent.extend(marker.lonlat);
}
}
return maxExtent;
},
CLASS_NAME: "OpenLayers.Layer.Markers"
});
|
#pragma once
#include <array>
#include <fstream>
#include <functional>
#include <cstddef>
#include <cstdio>
#include <string>
#include <vector>
#include "common/common_types.h"
// User directory indices for GetUserPath
enum {
D_USER_IDX,
D_ROOT_IDX,
D_CONFIG_IDX,
D_GAMECONFIG_IDX,
D_MAPS_IDX,
D_CACHE_IDX,
D_SHADERCACHE_IDX,
D_SHADERS_IDX,
D_STATESAVES_IDX,
D_SCREENSHOTS_IDX,
D_SDMC_IDX,
D_NAND_IDX,
D_SYSDATA_IDX,
D_HIRESTEXTURES_IDX,
D_DUMP_IDX,
D_DUMPFRAMES_IDX,
D_DUMPAUDIO_IDX,
D_DUMPTEXTURES_IDX,
D_DUMPDSP_IDX,
D_LOGS_IDX,
D_SYSCONF_IDX,
F_EMUCONFIG_IDX,
<API key>,
F_LOGGERCONFIG_IDX,
F_MAINLOG_IDX,
F_RAMDUMP_IDX,
F_ARAMDUMP_IDX,
F_SYSCONF_IDX,
NUM_PATH_INDICES
};
namespace FileUtil
{
// FileSystem tree node/
struct FSTEntry
{
bool isDirectory;
u64 size; // file length or number of entries from children
std::string physicalName; // name on disk
std::string virtualName; // name in FST names table
std::vector<FSTEntry> children;
};
// Returns true if file filename exists
bool Exists(const std::string &filename);
// Returns true if filename is a directory
bool IsDirectory(const std::string &filename);
// Returns the size of filename (64bit)
u64 GetSize(const std::string &filename);
// Overloaded GetSize, accepts file descriptor
u64 GetSize(const int fd);
// Overloaded GetSize, accepts FILE*
u64 GetSize(FILE *f);
// Returns true if successful, or path already exists.
bool CreateDir(const std::string &filename);
// Creates the full path of fullPath returns true on success
bool CreateFullPath(const std::string &fullPath);
// Deletes a given filename, return true on success
// Doesn't supports deleting a directory
bool Delete(const std::string &filename);
// Deletes a directory filename, returns true on success
bool DeleteDir(const std::string &filename);
// renames file srcFilename to destFilename, returns true on success
bool Rename(const std::string &srcFilename, const std::string &destFilename);
// copies file srcFilename to destFilename, returns true on success
bool Copy(const std::string &srcFilename, const std::string &destFilename);
// creates an empty file filename, returns true on success
bool CreateEmptyFile(const std::string &filename);
/**
* Scans the directory tree, calling the callback for each file/directory found.
* The callback must return the number of files and directories which the provided path contains.
* If the callback's return value is -1, the callback loop is broken immediately.
* If the callback's return value is otherwise negative, the callback loop is broken immediately
* and the callback's return value is returned from this function (to allow for error handling).
* @param directory the parent directory to start scanning from
* @param callback The callback which will be called for each file/directory. It is called
* with the arguments (const std::string& directory, const std::string& virtual_name).
* The `directory `parameter is the path to the directory which contains the file/directory.
* The `virtual_name` parameter is the incomplete file path, without any directory info.
* @return the total number of files/directories found
*/
int <API key>(const std::string &directory, std::function<int(const std::string&, const std::string&)> callback);
/**
* Scans the directory tree, storing the results.
* @param directory the parent directory to start scanning from
* @param parent_entry FSTEntry where the filesystem tree results will be stored.
* @return the total number of files/directories found
*/
int ScanDirectoryTree(const std::string &directory, FSTEntry& parent_entry);
// deletes the given directory and anything under it. Returns true on success.
bool <API key>(const std::string &directory);
// Returns the current directory
std::string GetCurrentDir();
// Create directory and copy contents (does not overwrite existing files)
void CopyDir(const std::string &source_path, const std::string &dest_path);
// Set the current directory to given directory
bool SetCurrentDir(const std::string &directory);
// Returns a pointer to a string with a Citra data dir in the user's home
// directory. To be used in "multi-user" mode (that is, installed).
const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath="");
// Returns the path to where the sys file are
std::string GetSysDirectory();
#ifdef __APPLE__
std::string GetBundleDirectory();
#endif
#ifdef _WIN32
std::string &GetExeDirectory();
#endif
size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename);
size_t ReadFileToString(bool text_file, const char *filename, std::string &str);
void SplitFilename83(const std::string& filename, std::array<char, 9>& short_name,
std::array<char, 4>& extension);
// simple wrapper for cstdlib file functions to
// hopefully will make error checking easier
// and make forgetting an fclose() harder
class IOFile : public NonCopyable
{
public:
IOFile();
IOFile(std::FILE* file);
IOFile(const std::string& filename, const char openmode[]);
~IOFile();
IOFile(IOFile&& other);
IOFile& operator=(IOFile&& other);
void Swap(IOFile& other);
bool Open(const std::string& filename, const char openmode[]);
bool Close();
template <typename T>
size_t ReadArray(T* data, size_t length)
{
if (!IsOpen()) {
m_good = false;
return -1;
}
size_t items_read = std::fread(data, sizeof(T), length, m_file);
if (items_read != length)
m_good = false;
return items_read;
}
template <typename T>
size_t WriteArray(const T* data, size_t length)
{
static_assert(std::is_standard_layout<T>::value, "Given array does not consist of standard layout objects");
// TODO: gcc 4.8 does not support <API key>, but we really should check for it here.
//static_assert(std::<API key><T>::value, "Given array does not consist of trivially copyable objects");
if (!IsOpen()) {
m_good = false;
return -1;
}
size_t items_written = std::fwrite(data, sizeof(T), length, m_file);
if (items_written != length)
m_good = false;
return items_written;
}
size_t ReadBytes(void* data, size_t length)
{
return ReadArray(reinterpret_cast<char*>(data), length);
}
size_t WriteBytes(const void* data, size_t length)
{
return WriteArray(reinterpret_cast<const char*>(data), length);
}
template<typename T>
size_t WriteObject(const T& object) {
static_assert(!std::is_pointer<T>::value, "Given object is a pointer");
return WriteArray(&object, 1);
}
bool IsOpen() { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; }
operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle();
std::FILE* GetHandle() { return m_file; }
void SetHandle(std::FILE* file);
bool Seek(s64 off, int origin);
u64 Tell();
u64 GetSize();
bool Resize(u64 size);
bool Flush();
// clear error state
void Clear() { m_good = true; std::clearerr(m_file); }
std::FILE* m_file;
bool m_good;
private:
IOFile(IOFile&);
IOFile& operator=(IOFile& other);
};
} // namespace
// To deal with Windows being dumb at unicode:
template <typename T>
void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode)
{
#ifdef _MSC_VER
fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode);
#else
fstream.open(filename.c_str(), openmode);
#endif
}
|
<?php
birch_ns( 'birchschedule.upgrader', function( $ns ) {
$ns->init = function() use ( $ns ) {
add_action( '<API key>', array( $ns, 'upgrade_core' ) );
};
$ns-><API key> = function( $staff ) {
$schedule = $staff['<API key>'];
if ( !isset( $schedule ) ) {
$schedule = array();
} else {
$schedule = unserialize( $schedule );
}
$schedule = $schedule ? $schedule : array();
return $schedule;
};
$ns-><API key> = function() use ( $ns ) {
global $birchpress;
$version = $ns-><API key>();
if ( $version != '1.0' ) {
return;
}
$staff = $birchpress->db->query(
array(
'post_type' => 'birs_staff'
),
array(
'meta_keys' => array(
'<API key>'
),
'base_keys' => array()
)
);
foreach ( $staff as $thestaff ) {
$schedules = $ns-><API key>( $thestaff );
$new_all_schedules = array();
foreach ( $schedules as $location_id => $schedule ) {
if ( isset( $schedule['exceptions'] ) ) {
$exceptions = $schedule['exceptions'];
} else {
$exceptions = array();
}
$new_schedules = array();
foreach ( $schedule as $week_day => $day_schedule ) {
if ( isset( $day_schedule['enabled'] ) ) {
$start = $day_schedule['minutes_start'];
$end = $day_schedule['minutes_end'];
$new_schedule = array(
'minutes_start' => $day_schedule['minutes_start'],
'minutes_end' => $day_schedule['minutes_end'],
'weeks' => array(
$week_day => 'on'
)
);
if ( isset( $new_schedules['s'. $start. $end] ) ) {
$new_schedules['s'. $start. $end]['weeks'][$week_day] = 'on';
} else {
$new_schedules['s'. $start. $end] = $new_schedule;
}
}
}
$new_loc_schedules = array();
foreach ( $new_schedules as $tmp_id => $new_schedule ) {
$uid = uniqid();
$new_loc_schedules[$uid] = $new_schedule;
}
$new_all_schedules[$location_id] = array(
'schedules' => $new_loc_schedules,
'exceptions' => $exceptions
);
update_post_meta( $thestaff['ID'], '<API key>', serialize( $new_all_schedules ) );
}
}
update_option( '<API key>', '1.1' );
};
$ns-><API key> = function() {
return get_option( '<API key>', '1.0' );
};
$ns-><API key> = function() use ( $ns ) {
global $birchpress, $birchschedule;
$version = $ns-><API key>();
if ( $version != '1.0' ) {
return;
}
$appointment_fields = array(
'<API key>', '<API key>',
'<API key>', '<API key>',
'<API key>'
);
$<API key> = array(
'<API key>',
'_birs_client_id',
'<API key>',
'<API key>',
'<API key>',
'<API key>'
);
$<API key> = array(
'<API key>'
);
$options = get_option( '<API key>' );
if ( $options != false ) {
$fields_options = $options['fields'];
foreach ( $fields_options as $field_id => $field ) {
if ( $field['belong_to'] == 'appointment' ) {
$meta_key = '_birs_' . $field_id;
if ( !in_array( $meta_key, array( '<API key>' ) ) ) {
$appointment_fields[] = $meta_key;
$<API key>[] = $meta_key;
}
}
}
}
$appointments = $birchschedule->model->query(
array(
'post_type' => 'birs_appointment',
'post_status' => array( 'publish', 'pending' )
),
array(
'base_keys' => array(),
'meta_keys' => $appointment_fields
)
);
foreach ( $appointments as $appointment ) {
if ( isset( $appointment['ID'] ) && isset( $appointment['<API key>'] ) ) {
$appointment1on1 = array(
'post_type' => '<API key>',
'<API key>' => $appointment['ID'],
'_birs_client_id' => $appointment['<API key>']
);
if ( isset( $appointment['<API key>'] ) ) {
$appointment1on1['<API key>'] = $appointment['<API key>'];
}
if ( isset( $appointment['<API key>'] ) ) {
$appointment1on1['<API key>'] =
$appointment['<API key>'];
}
if ( isset( $appointment['<API key>'] ) ) {
$appointment1on1['<API key>'] = $appointment['<API key>'];
}
$appointment1on1['<API key>'] = uniqid();
foreach ( $<API key> as $<API key> ) {
if ( isset( $appointment[$<API key>] ) ) {
$appointment1on1[$<API key>] =
$appointment[$<API key>];
}
}
$<API key> = array_merge( $<API key>, $<API key> );
$birchpress->db->save( $appointment1on1, array(
'base_keys' => array(),
'meta_keys' => $<API key>
)
);
foreach ( $<API key> as $<API key> ) {
delete_post_meta( $appointment['ID'], $<API key> );
}
delete_post_meta( $appointment['ID'], '<API key>' );
delete_post_meta( $appointment['ID'], '<API key>' );
delete_post_meta( $appointment['ID'], '<API key>' );
delete_post_meta( $appointment['ID'], '<API key>' );
delete_post_meta( $appointment['ID'], '<API key>' );
}
}
update_option( '<API key>', '1.1' );
};
$ns-><API key> = function() use ( $ns ) {
global $birchpress, $birchschedule;
$version = $ns-><API key>();
if ( $version != '1.1' ) {
return;
}
$appointments = $birchschedule->model->query(
array(
'post_type' => 'birs_appointment',
'post_status' => array( 'any' )
),
array(
'base_keys' => array( 'post_author' ),
'meta_keys' => array( '<API key>' )
)
);
if ( $appointments ) {
foreach ( $appointments as $appointment_id => $appointment ) {
$staff = $birchschedule->model->get( $appointment['<API key>'],
array(
'base_keys' => array(),
'meta_keys' => array( '_birs_staff_email' )
)
);
if ( $staff ) {
$user = WP_User::get_data_by( 'email', $staff['_birs_staff_email'] );
if ( $user ) {
$appointment['post_author'] = $user->ID;
$birchschedule->model->save( $appointment, array(
'base_keys' => array( 'post_author' ),
'meta_keys' => array()
) );
}
}
}
}
update_option( '<API key>', '1.2' );
};
$ns-><API key> = function() {
return get_option( '<API key>', '1.0' );
};
$ns->upgrade_core = function() use ( $ns ) {
$ns-><API key>();
$ns-><API key>();
$ns-><API key>();
};
} );
|
/* this dissector handles I2C messages on the HDMI Display Data Channel (DDC)
*
* EDID (Extended Display Identification Data) messages are dissected here,
* HDCP messages are passed on to the HDCP dissector
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include <epan/ptvcursor.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>
#include "packet-hdmi.h"
void proto_register_hdmi(void);
void <API key>(void);
static int proto_hdmi = -1;
static dissector_handle_t hdcp_handle;
static gint ett_hdmi = -1;
static gint ett_hdmi_edid = -1;
static int hf_hdmi_addr = -1;
static int hf_hdmi_edid_offset = -1;
static int hf_hdmi_edid_hdr = -1;
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
/* also called Source and Sink in the HDMI spec */
#define ADDR_TRX "Transmitter"
#define ADDR_RCV "Receiver"
/* we use 8bit I2C addresses, including the direction bit */
#define ADDR8_HDCP_WRITE 0x74 /* transmitter->receiver */
#define ADDR8_HDCP_READ 0x75
#define ADDR8_EDID_WRITE 0xA0
#define ADDR8_EDID_READ 0xA1
#define HDCP_ADDR8(x) (x==ADDR8_HDCP_WRITE || x==ADDR8_HDCP_READ)
static const value_string hdmi_addr[] = {
{ ADDR8_HDCP_WRITE, "transmitter writes HDCP data for receiver" },
{ ADDR8_HDCP_READ, "transmitter reads HDCP data from receiver" },
{ ADDR8_EDID_WRITE, "EDID request" },
{ ADDR8_EDID_READ, "EDID read" },
{ 0, NULL }
};
#define EDID_HDR_VALUE G_GUINT64_CONSTANT(0x00ffffffffffff00)
/* grab 5 bits, from bit n to n+4, from a big-endian number x
map those bits to a capital letter such that A==1, B==2, ... */
#define CAPITAL_LETTER(x, n) ('A'-1 + (((x) & (0x1F<<n)) >> n))
gboolean
sub_check_hdmi(packet_info *pinfo _U_)
{
/* by looking at the i2c_phdr only, we can't decide if this packet is HDMI
this function is called when the user explicitly selected HDMI
in the preferences
therefore, we always return TRUE and hand the data to the (new
style) dissector who sees the 8bit address and the packet content */
return TRUE;
}
/* dissect EDID data from the receiver
return the offset after the dissected data */
static gint
dissect_hdmi_edid(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti, *yi;
proto_tree *edid_tree;
guint64 edid_hdr;
guint16 manf_id;
gchar manf_id_str[4]; /* 3 letters + 0-termination */
guint8 week, year;
int year_hf;
guint8 edid_ver, edid_rev;
ti = proto_tree_add_text(tree, tvb,
offset, <API key>(tvb, offset),
"Extended Display Identification Data (EDID)");
edid_tree = <API key>(ti, ett_hdmi_edid);
edid_hdr = tvb_get_ntoh64(tvb, offset);
if (edid_hdr != EDID_HDR_VALUE)
return offset; /* XXX handle fragmented EDID messages */
col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "EDID");
proto_tree_add_item(edid_tree, hf_hdmi_edid_hdr,
tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
/* read as big endian for easier splitting */
manf_id = tvb_get_ntohs(tvb, offset);
/* XXX check that MSB is 0 */
manf_id_str[0] = CAPITAL_LETTER(manf_id, 10);
manf_id_str[1] = CAPITAL_LETTER(manf_id, 5);
manf_id_str[2] = CAPITAL_LETTER(manf_id, 0);
manf_id_str[3] = 0;
<API key>(edid_tree, <API key>,
tvb, offset, 2, manf_id_str);
offset += 2;
proto_tree_add_item(edid_tree, <API key>,
tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(edid_tree, <API key>,
tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
week = tvb_get_guint8(tvb, offset);
proto_tree_add_item(edid_tree, <API key>,
tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
year_hf = week==255 ? <API key> : <API key>;
year = tvb_get_guint8(tvb, offset);
yi = proto_tree_add_item(edid_tree, year_hf,
tvb, offset, 1, ENC_LITTLE_ENDIAN);
<API key>(yi, " (year %d)", 1990+year);
offset++;
edid_ver = tvb_get_guint8(tvb, offset);
edid_rev = tvb_get_guint8(tvb, offset+1);
/* XXX make this filterable */
proto_tree_add_text(edid_tree, tvb, offset, 2,
"EDID Version %d.%d", edid_ver, edid_rev);
/* XXX dissect the parts following the EDID header */
return tvb_reported_length(tvb);
}
static int
dissect_hdmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint8 addr;
gint offset=0;
proto_item *pi;
proto_tree *hdmi_tree;
/* the I2C address in the first byte is always handled by the HDMI
dissector, even if the packet contains HDCP data */
addr = tvb_get_guint8(tvb, 0);
if (!try_val_to_str(addr, hdmi_addr))
return 0; /* no HDMI packet */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDMI");
col_clear(pinfo->cinfo, COL_INFO);
pi = <API key>(tree, proto_hdmi,
tvb, 0, tvb_reported_length(tvb), "HDMI");
hdmi_tree = <API key>(pi, ett_hdmi);
if (addr&0x01) {
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(ADDR_RCV)+1, ADDR_RCV);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(ADDR_TRX)+1, ADDR_TRX);
pinfo->p2p_dir = P2P_DIR_RECV;
}
else {
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(ADDR_TRX)+1, ADDR_TRX);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(ADDR_RCV)+1, ADDR_RCV);
pinfo->p2p_dir = P2P_DIR_SENT;
}
/* there's no explicit statement in the spec saying that the protocol is
big or little endian
there's three cases: one byte values, symmetrical values or values
that are explicitly marked as little endian
for the sake of simplicity, we use little endian everywhere */
proto_tree_add_item(hdmi_tree, hf_hdmi_addr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
if (HDCP_ADDR8(addr)) {
gint hdcp_len;
tvbuff_t *hdcp_tvb;
hdcp_len = <API key>(tvb, offset);
hdcp_tvb = tvb_new_subset(tvb, offset, hdcp_len, hdcp_len);
return call_dissector(hdcp_handle, hdcp_tvb, pinfo, hdmi_tree);
}
if (addr==ADDR8_EDID_WRITE) {
col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "EDID request");
proto_tree_add_item(hdmi_tree, hf_hdmi_edid_offset,
tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
return offset;
}
return dissect_hdmi_edid(tvb, offset, pinfo, hdmi_tree);
}
void
proto_register_hdmi(void)
{
static hf_register_info hf[] = {
{ &hf_hdmi_addr,
{ "8bit I2C address", "hdmi.addr", FT_UINT8, BASE_HEX,
VALS(hdmi_addr), 0, NULL, HFILL } },
{ &hf_hdmi_edid_offset,
{ "Offset", "hdmi.edid.offset",
FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } },
{ &hf_hdmi_edid_hdr,
{ "EDID header", "hdmi.edid.hdr",
FT_UINT64, BASE_HEX, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Manufacturer ID", "hdmi.edid.manf_id",
FT_STRING, STR_ASCII, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Manufacturer product code", "hdmi.edid.manf_prod_code",
FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Serial number", "hdmi.edid.serial_num",
FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Week of manufacture", "hdmi.edid.manf_week",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Model year", "hdmi.edid.model_year",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
{ &<API key>,
{ "Year of manufacture", "hdmi.edid.manf_year",
FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }
};
static gint *ett[] = {
&ett_hdmi,
&ett_hdmi_edid
};
proto_hdmi = <API key>(
"High-Definition Multimedia Interface", "HDMI", "hdmi");
<API key>(proto_hdmi, hf, array_length(hf));
<API key>(ett, array_length(ett));
<API key>("hdmi", dissect_hdmi, proto_hdmi);
}
void
<API key>(void)
{
hdcp_handle = find_dissector("hdcp");
}
|
/* ScriptData
SDName: Silverpine_Forest
SD%Complete: 100
SDComment: Quest support: 435
SDCategory: Silverpine Forest
EndScriptData */
/* ContentData
<API key>
EndContentData */
#include "ScriptMgr.h"
#include "Player.h"
#include "ScriptedEscortAI.h"
enum eErland
{
SAY_QUESTACCEPT = 0,
SAY_START = 1,
SAY_AGGRO = 2,
SAY_PROGRESS = 3,
SAY_LAST = 4,
SAY_RANE = 0,
SAY_RANE_ANSWER = 5,
SAY_MOVE_QUINN = 6,
SAY_QUINN = 7,
SAY_QUINN_ANSWER = 0,
SAY_BYE = 8,
QUEST_ESCORTING = 435,
NPC_RANE = 1950,
NPC_QUINN = 1951
};
class <API key> : public CreatureScript
{
public:
<API key>() : CreatureScript("<API key>") { }
struct <API key> : public EscortAI
{
<API key>(Creature* creature) : EscortAI(creature) { }
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 1:
Talk(SAY_START, player);
break;
case 10:
Talk(SAY_PROGRESS);
break;
case 13:
Talk(SAY_LAST, player);
player->GroupEventHappens(QUEST_ESCORTING, me);
break;
case 15:
if (Creature* rane = me->FindNearestCreature(NPC_RANE, 20.0f))
rane->AI()->Talk(SAY_RANE);
break;
case 16:
Talk(SAY_RANE_ANSWER);
break;
case 17:
Talk(SAY_MOVE_QUINN);
break;
case 24:
Talk(SAY_QUINN);
break;
case 25:
if (Creature* quinn = me->FindNearestCreature(NPC_QUINN, 20.0f))
quinn->AI()->Talk(SAY_QUINN_ANSWER);
break;
case 26:
Talk(SAY_BYE);
break;
}
}
void Reset() override { }
void EnterCombat(Unit* who) override
{
Talk(SAY_AGGRO, who);
}
void QuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_ESCORTING)
{
Talk(SAY_QUESTACCEPT, player);
Start(true, false, player->GetGUID());
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new <API key>(creature);
}
};
void <API key>()
{
new <API key>();
}
|
#ifndef LV2_EVENT_HELPERS_H
#define LV2_EVENT_HELPERS_H
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "lv2_event.h"
/** Pad a size to 64 bits (for event sizes) */
static inline uint16_t
lv2_event_pad_size(uint16_t size)
{
return (size + 7) & (~7);
}
/** Initialize (empty, reset..) an existing event buffer.
* The contents of buf are ignored entirely and overwritten, except capacity
* which is unmodified. */
static inline void
<API key>(LV2_Event_Buffer* buf, uint16_t stamp_type, uint8_t *data)
{
buf->data = data;
buf->header_size = sizeof(LV2_Event_Buffer);
buf->stamp_type = stamp_type;
buf->event_count = 0;
buf->size = 0;
}
/** Allocate a new, empty event buffer. */
static inline LV2_Event_Buffer*
<API key>(uint32_t capacity, uint16_t stamp_type)
{
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)malloc(sizeof(LV2_Event_Buffer) + capacity);
if (buf != NULL) {
buf->capacity = capacity;
<API key>(buf, stamp_type, (uint8_t *)(buf + 1));
return buf;
} else {
return NULL;
}
}
/** An iterator over an LV2_Event_Buffer.
*
* Multiple simultaneous read iterators over a single buffer is fine,
* but changing the buffer invalidates all iterators (e.g. RW Lock). */
typedef struct {
LV2_Event_Buffer* buf;
uint32_t offset;
} LV2_Event_Iterator;
/** Reset an iterator to point to the start of @a buf.
* @return True if @a iter is valid, otherwise false (buffer is empty) */
static inline bool
lv2_event_begin(LV2_Event_Iterator* iter,
LV2_Event_Buffer* buf)
{
iter->buf = buf;
iter->offset = 0;
return (buf->size > 0);
}
/** Check if @a iter is valid..
* @return True if @a iter is valid, otherwise false (past end of buffer) */
static inline bool
lv2_event_is_valid(LV2_Event_Iterator* iter)
{
return (iter->offset < iter->buf->size);
}
/** Advance @a iter forward one event.
* @a iter must be valid.
* @return True if @a iter is valid, otherwise false (reached end of buffer) */
static inline bool
lv2_event_increment(LV2_Event_Iterator* iter)
{
assert(lv2_event_is_valid(iter));
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
iter->offset += lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
return true;
}
/** Dereference an event iterator (get the event currently pointed at).
* @a iter must be valid.
* @a data if non-NULL, will be set to point to the contents of the event
* returned.
* @return A Pointer to the event @a iter is currently pointing at, or NULL
* if the end of the buffer is reached (in which case @a data is
* also set to NULL). */
static inline LV2_Event*
lv2_event_get(LV2_Event_Iterator* iter,
uint8_t** data)
{
assert(lv2_event_is_valid(iter));
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
if (data)
*data = (uint8_t*)ev + sizeof(LV2_Event);
return ev;
}
/** Get the type of the non-POD event referenced by an event iterator.
* @a iter must be valid.
* @return The type of the non-POD event, or 0 if the event is not non-POD. */
static inline uint16_t
<API key>(LV2_Event_Iterator* iter)
{
assert(lv2_event_is_valid(iter));
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
if (ev->type != 0 || ev->size < 2)
return 0;
return *(uint16_t*)((uint8_t*)ev + sizeof(LV2_Event));
}
/** Write an event at @a iter.
* The event (if any) pointed to by @iter will be overwritten, and @a iter
* incremented to point to the following event (i.e. several calls to this
* function can be done in sequence without twiddling iter in-between).
* @return True if event was written, otherwise false (buffer is full). */
static inline bool
lv2_event_write(LV2_Event_Iterator* iter,
uint32_t frames,
uint32_t subframes,
uint16_t type,
uint16_t size,
const uint8_t* data)
{
if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size)
return false;
LV2_Event* const ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
ev->frames = frames;
ev->subframes = subframes;
ev->type = type;
ev->size = size;
memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size);
++iter->buf->event_count;
size = lv2_event_pad_size(sizeof(LV2_Event) + size);
iter->buf->size += size;
iter->offset += size;
return true;
}
/** Reserve space for an event in the buffer and return a pointer to
* the memory where the caller can write the event data, or NULL if there
* is not enough room in the buffer. */
static inline uint8_t*
lv2_event_reserve(LV2_Event_Iterator* iter,
uint32_t frames,
uint32_t subframes,
uint16_t type,
uint16_t size)
{
size = lv2_event_pad_size(size);
if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size)
return NULL;
LV2_Event* const ev = (LV2_Event*)((uint8_t*)iter->buf->data +
iter->offset);
ev->frames = frames;
ev->subframes = subframes;
ev->type = type;
ev->size = size;
++iter->buf->event_count;
size = lv2_event_pad_size(sizeof(LV2_Event) + size);
iter->buf->size += size;
iter->offset += size;
return (uint8_t*)ev + sizeof(LV2_Event);
}
/** Write an event at @a iter.
* The event (if any) pointed to by @iter will be overwritten, and @a iter
* incremented to point to the following event (i.e. several calls to this
* function can be done in sequence without twiddling iter in-between).
* @return True if event was written, otherwise false (buffer is full). */
static inline bool
<API key>(LV2_Event_Iterator* iter,
const LV2_Event* ev,
const uint8_t* data)
{
if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + ev->size)
return false;
LV2_Event* const write_ev = (LV2_Event*)(
(uint8_t*)iter->buf->data + iter->offset);
*write_ev = *ev;
memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size);
++iter->buf->event_count;
const uint16_t size = lv2_event_pad_size(sizeof(LV2_Event) + ev->size);
iter->buf->size += size;
iter->offset += size;
return true;
}
#endif // LV2_EVENT_HELPERS_H
|
#include "main.c"
|
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../common/docs.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale = 1.0" />
<link href="/assets/favicon.ico" rel="shortcut icon" />
<title>Webix : Samples</title></title>
</head>
<body>
<div class='abstop_header'>
<div class='content_area'>
</div>
</div>
<div class="page_header">
<div class='page_inner_header'>
<a href='http://webix.com'><div class='top_webix_logo'></div></a>
Samples
</div>
</div>
<div class="page_space">
<div class="webixdoc_page webixdoc_start">
<div id="webixContent" class='webixdoc_content'>
<div class="<API key>">
<div class="webixdoc_breadcrumb nav_breadcrumb">
<a href="http://docs.webix.com/" class="webixdoc_back">Documentation</a>
<a href="../../index.html" class="webixdoc_back">Samples</a>
<a href='../index.html' class='webixdoc_back'>17 Datatree</a><a href='../../index.html' class='webixdoc_back'>04 Api</a>
</div>
<table class='nav_table'>
<tr>
<td style='width:30px;'>
<a href='01_selection.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='01_selection.html'>Selection</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='02_sort.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='02_sort.html'>Sorting</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='03_filter.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='03_filter.html'>Filtering</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='04_multi_select.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='04_multi_select.html'>Multiline Selection</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='05_sort_custom.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='05_sort_custom.html'>Custom Sorting</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='06_add_delete.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='06_add_delete.html'>Adding and deleting Nodes</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='07_sync.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='07_sync.html'>Data sync</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='08_bind.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='08_bind.html'>Data binding</a> </td>
</tr>
<tr>
<td style='width:30px;'>
<a href='09_subdata.html'><div class='nav_folder_img'> </div></a>
</td><td> <a href='09_subdata.html'>Data binding - subdata</a> </td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
|
<?php
class <API key> extends ezpDatabaseTestCase
{
protected $backupGlobals = false;
/**
* Unit test for eZProductCollection::cleanupList()
*
* Outline:
* 1) Create 10 eZProductCollection objects
* 2) Pick 5 random ID of created items
* 3) Call cleanupList() on these 5 items
* 4) Check that the 5 items have been removed
* 5) Check that the 5 other items haven't been removed
*/
public function testCleanupList()
{
// Create a few collections
$row = array( 'created' => time(), 'currency_code' => 'EUR' );
$collection = new eZProductCollection( $row );
$collection->store();
$collectionIDArray[] = $collection->attribute( 'id' );
for( $i = 0; $i < 1500; $i++ )
{
$newCollection = $collection->copy();
$collectionIDArray[] = $newCollection->attribute( 'id' );
}
// pick a few random ID to delete
$deleteIDArray = array_rand( $collectionIDArray, round( count( $collectionIDArray ) / 2 ) );
$remainingIDArray = array_diff( $collectionIDArray, $deleteIDArray );
eZProductCollection::cleanupList( $deleteIDArray );
// Check that each item of deleteIDArray has been removed
foreach( $deleteIDArray as $id )
{
$this->assertNull( eZProductCollection::fetch( $id ) );
}
// And check that each item of remainingIDArray hasn't been deleted
foreach( $remainingIDArray as $id )
{
$this->assertInstanceOf( 'eZProductCollection', eZProductCollection::fetch( $id ) );
}
}
}
?>
|
package org.graalvm.compiler.lir.asm;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import org.graalvm.compiler.core.common.type.DataPointerConstant;
/**
* Class for chunks of data that go into the data section.
*/
public class <API key> extends DataPointerConstant {
private final byte[] data;
public <API key>(byte[] array, int alignment) {
super(alignment);
data = array.clone();
}
public <API key>(short[] array, int alignment) {
super(alignment);
ByteBuffer byteBuffer = ByteBuffer.allocate(array.length * 2);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.asShortBuffer().put(array);
data = byteBuffer.array();
}
public <API key>(int[] array, int alignment) {
super(alignment);
ByteBuffer byteBuffer = ByteBuffer.allocate(array.length * 4);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.asIntBuffer().put(array);
data = byteBuffer.array();
}
public <API key>(float[] array, int alignment) {
super(alignment);
ByteBuffer byteBuffer = ByteBuffer.allocate(array.length * 4);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.asFloatBuffer().put(array);
data = byteBuffer.array();
}
public <API key>(double[] array, int alignment) {
super(alignment);
ByteBuffer byteBuffer = ByteBuffer.allocate(array.length * 8);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.asDoubleBuffer().put(array);
data = byteBuffer.array();
}
public <API key>(long[] array, int alignment) {
super(alignment);
ByteBuffer byteBuffer = ByteBuffer.allocate(array.length * 8);
byteBuffer.order(ByteOrder.nativeOrder());
byteBuffer.asLongBuffer().put(array);
data = byteBuffer.array();
}
@Override
public boolean isDefaultForKind() {
return false;
}
@Override
public void serialize(ByteBuffer buffer) {
buffer.put(data);
}
@Override
public int getSerializedSize() {
return data.length;
}
@Override
public String toValueString() {
return "<API key>" + Arrays.toString(data);
}
}
|
<style type="text/css">
<!
.msg {
text-align:left;
color: blue;
display: block;
padding: 5px 0;
}
.emsg {
text-align:left;
color: red;
display: block;
padding: 5px 0;
}
#loader{
visibility:hidden;
}
#f1_error{
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight:bold;
color:#FF0000;
}
#f1_ok{
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight:bold;
color:#00FF00;
}
#f1_upload_process {
z-index:100;
visibility:hidden;
position:absolute;
margin: 10px 0 0;
width:220px;
}
#f1_upload_process span { display: block; padding-left: 7px; }
</style>
<script language="javascript" type="text/javascript">
<!
function startUpload(){
document.getElementById('f1_upload_process').style.visibility = 'visible';
document.getElementById('f1_upload_form').style.visibility = 'hidden';
return true;
}
function stopUpload(success, msg, src){
var result = '';
if (success == 1){
result = '<span class="msg">The file was uploaded successfully!<\/span>';
var ed = tinyMCE.get('jform_content'); // get editor instance
var newNode = ed.getDoc().createElement ( "img" ); // create img node
newNode.src = src; // add src attribute
ed.execCommand('mceInsertContent', false, newNode.outerHTML);
}
else {
result = '<span class="emsg">There was an error during file upload!<\/span>';
}
result += '<input type="hidden" name="path_2_upload" value="<?php echo base64_encode(JPATH_ROOT . DS . 'tmp' . DS . session_id() . DS); ?>" />';
result += '<input type="hidden" name="link_2_upload" value="<?php echo base64_encode(JURI::root() . 'tmp/' . session_id() .'/'); ?>" />';
document.getElementById('f1_upload_process').style.visibility = 'hidden';
document.getElementById('f1_upload_form').innerHTML = result + '<input name="myfile" type="file" size="30" style="float:left;" /><input type="button" name="submitBtn" id="submitBtn" class="sbtn" value="Upload" style="float: left;" />';
document.getElementById('f1_upload_form').style.visibility = 'visible';
return true;
}
window.addEvent('domready', function(){
// $$('#submitBtn').addEvent('click', function(e){
document.body.addEvent('click:relay(#submitBtn)', function(e){
var action = '<?php echo JURI::base(); ?>jelibs/ajaxupload/upload.php';
var formAction = $$('form[name="userForm"]').get('action');
$$('form[name="userForm"]').set('target', 'upload_target').set('action', action);
startUpload();
document.userForm.submit();
$$('form[name="userForm"]').set('target', '').set('action', formAction);
});
});
</script>
<?php
defined('JPATH_BASE') or die;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Bannerclient Field class for the Joomla Framework.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class <API key> extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = '<API key>';
public function getInput()
{
$html = '<div>';
$html .= '<p id="f1_upload_process"><span>Loading...</span><img src="'.JURI::base().'jelibs/ajaxupload/loader.gif" /><br/></p>
<p id="f1_upload_form" align="center">
<br />
<span style="float: left;">Upload images to content</span>
<br/>
<input name="myfile" type="file" size="30" style="float: left;" />
<input type="hidden" name="path_2_upload" value="'.base64_encode(JPATH_ROOT . DS . 'tmp' . DS . session_id() . DS) .'" />
<input type="hidden" name="link_2_upload" value="'.base64_encode(JURI::root() . 'tmp/' . session_id() . '/') .'" />
<input type="button" name="submitBtn" id="submitBtn" class="sbtn" value="Upload" style="float: left;" />
</p>
<iframe id="upload_target" name="upload_target" src="" style="width:0;height:0;border:0px solid #fff;"></iframe>
';
$html .= '<div class="clr"></div></div>';
return $html;
}
}
|
/* Ittiam WPS SOFTWARE */
/* ITTIAM SYSTEMS PVT LTD, BANGALORE */
/* agreement. It may not be copied or otherwise reproduced or disclosed to */
/* terms and conditions of such an agreement. All copies and */
/* reproductions shall be the property of Ittiam Systems Private Limited and*/
/* must bear this notice in its entirety. */
/* File Name : wps_key.c */
/* Description : This file contains the functions to generate the */
/* Authentication and Key Wrap Key */
/* List of Functions : wps_kdf */
/* wps_gen_keys */
/* Issues / Problems : None */
/* Revision History : */
/* DD MM YYYY Author(s) Changes */
/* 25 02 2011 Ittiam Draft */
#ifdef INT_WPS_REG_SUPP
/* File Includes */
#include "hmac_sha256.h"
#include "dh_key.h"
#include "wps_key.h"
/* Static Function Declarations */
static void wps_kdf(UWORD8* inp_key, UWORD8* pers_str, UWORD8 pers_str_len,
UWORD8* out_key, UWORD32 total_key_bytes);
/* Function Name : wps_kdf */
/* Description : This function implements the Key Derivation function */
/* as described in WPS standard version v.1.2.2 */
/* Inputs : 1) Input Key used for key hashing */
/* 2) Pointer to personalization string */
/* 3) Length of personalization string */
/* 4) Pointer to location where output key needs to be */
/* stored. The output key buffer should be long */
/* enough to store ((Total Output key bytes + SHA256 */
/* hash length -1)/ SHA256 hash length) of bytes i.e */
/* this module output bytes in multiple of SHA256 */
/* hash length. Calling function should take care of */
/* selecting appropriate number of bytes */
/* 5) Required length in bytes of the output key */
/* Globals : None */
/* Processing : This function implements the following algorithm */
/* kdf(key, <API key>, total_key_bits) : */
/* result := "" */
/* iterations = (total_key_bits+prf_digest_size-1)/ */
/* prf_digest_size */
/* for i = 1 to iterations do */
/* result = result || prf(key, i || */
/* <API key> || total_key_bits)*/
/* return result */
/* The function prf is the keyed hash HMAC-SHA-256 */
/* Outputs : None */
/* Returns : Key bits generating using KDF function */
/* Issues : None */
/* Revision History: */
/* DD MM YYYY Author(s) Changes */
/* 24 02 2010 Ittiam Draft */
void wps_kdf(UWORD8* inp_key, UWORD8* pers_str, UWORD8 pers_str_len,
UWORD8* out_key, UWORD32 total_key_bytes)
{
UWORD8 *msg[3];
UWORD8 iter_buff[4], total_key_bits_buff[4];
UWORD16 msg_len[3];
UWORD32 iter, max_iter;
/* use iter as temporary variable to store total number of bits */
iter = total_key_bytes * 8;
max_iter = (total_key_bytes + SHA_256_HASH_LEN - 1) / SHA_256_HASH_LEN;
total_key_bits_buff[3] = (UWORD8)(iter);
total_key_bits_buff[2] = (UWORD8)(iter >> 8);
total_key_bits_buff[1] = (UWORD8)(iter >> 16);
total_key_bits_buff[0] = (UWORD8)(iter >> 24);
msg[0] = iter_buff;
msg_len[0] = sizeof(iter_buff);
msg[1] = pers_str;
msg_len[1] = pers_str_len;
msg[2] = total_key_bits_buff;
msg_len[2] = sizeof(total_key_bits_buff);
/* This function will generates bytes in multiples of SHA_256_HASH_LEN */
/* calling function to ensure that the out_key has enough space */
for (iter = 1; iter <= max_iter; ++iter)
{
iter_buff[3] = (UWORD8)(iter);
iter_buff[2] = (UWORD8)(iter >> 8);
iter_buff[1] = (UWORD8)(iter >> 16);
iter_buff[0] = (UWORD8)(iter >> 24);
hmac_sha256(inp_key, SHA_256_HASH_LEN, msg, msg_len,3, out_key);
out_key += SHA_256_HASH_LEN;
}
}
/* Function Name : wps_gen_keys */
/* Description : This function generates Diffie-Hellman shared secret */
/* key. This key needs to be hashed before it can be used*/
/* Inputs : 1) Pointer Rxed Public Key (PKe or PKr buffer) */
/* 2) Pointer to Enrollee`s Nonce, N1 */
/* 3) POinter to Registrar`s Nonce, N2 */
/* 4) Pointer to Enrollee`s MAC Address */
/* 5) Pointer to WPS Authentication Key */
/* 6) Pointer to WPS Key Wrap Key */
/* 7) Pointer to DH Private key (A or B) */
/* Globals : None */
/* Processing : Using the received public key and local private key */
/* this functions generate the shared secret key = */
/* = (pubic key ^private Key) mod p) where g =2, p is */
/* predefined prime. It then converts the secret key in */
/* byte format. Public key, Private key, secret key and */
/* Prime are all of length <API key>. */
/* Outputs : Authentication Key and Key Wrap key */
/* Returns : SUCCESS/FAILURE */
/* Issues : None */
/* Revision History: */
/* DD MM YYYY Author(s) Changes */
/* 25 02 2011 Ittiam Draft */
STATUS_T wps_gen_keys(UWORD8 *rx_pub_key,
UWORD8 *enr_nonce,
UWORD8 *reg_nonce,
UWORD8 *enr_mac_addr,
UWORD8 *auth_key,
UWORD8 *key_wrap_key,
long_num_struct_t *priv_key_ptr)
{
UWORD8 *msg[3];
UWORD16 msg_len[3];
const UWORD8 pers_str[] = "Wi-Fi Easy and Secure Key Derivation";
/* Generate pre-hash DH Key = (Public Key ^ Private Key) mod Prime */
/* DH key will be stored in byte format in place of Received Public Key */
if(FAILURE == wps_gen_ph_dh_key((UWORD32 *)rx_pub_key, priv_key_ptr))
{
return FAILURE;
}
/* Generate DH Key = sha256(Pre-Hashed DH-Key) and store DH key in place */
/* of pre-hash DH key */
msg[0] = rx_pub_key;
msg_len[0] = <API key>;
sha256(msg, msg_len, 1, rx_pub_key);
/* Generate KDK = HMAC-SHA256(DHKey) (N1 || EnrolleeMAC || N2). Store KDK*/
/* in place of DH key */
msg[0] = enr_nonce;
msg[1] = enr_mac_addr;
msg[2] = reg_nonce;
msg_len[0] = WPS_NONCE_LEN;
msg_len[1] = MAC_ADDRESS_LEN;
msg_len[2] = WPS_NONCE_LEN;
hmac_sha256(rx_pub_key, SHA_256_HASH_LEN, msg, msg_len, 3, rx_pub_key);
/* Use key derivation function to generate AuthKey and Key Wrap key using*/
/* key derivation function key. */
wps_kdf(rx_pub_key, (UWORD8 *)pers_str, (UWORD8)(sizeof(pers_str) -1),
(rx_pub_key + SHA_256_HASH_LEN),
(WPS_AUTH_KEY_LEN + <API key> + WPS_EMSK_LEN));
/* Copy Auth Key to the WPS persistent memory */
memcpy(auth_key, rx_pub_key + SHA_256_HASH_LEN, WPS_AUTH_KEY_LEN);
/* Copy Key Wrap Key to the WPS persistent memory */
memcpy(key_wrap_key, (rx_pub_key + SHA_256_HASH_LEN + WPS_AUTH_KEY_LEN),
<API key>);
return SUCCESS;
}
#endif /* INT_WPS_REG_SUPP */
|
/* <API key>: GPL-2.0-only */
#include <delay.h>
#include <device/mmio.h>
#include <console/console.h>
#include <console/uart.h>
#include <soc/addressmap.h>
#include <soc/otp.h>
struct <API key> {
u32 pa; /* Address input */
u32 paio; /* Program address input */
u32 pas; /* Program redundancy cell selection input */
u32 pce; /* OTP Macro enable input */
u32 pclk; /* Clock input */
u32 pdin; /* Write data input */
u32 pdout; /* Read data output */
u32 pdstb; /* Deep standby mode enable input (active low) */
u32 pprog; /* Program mode enable input */
u32 ptc; /* Test column enable input */
u32 ptm; /* Test mode enable input */
u32 ptm_rep;/* Repair function test mode enable input */
u32 ptr; /* Test row enable input */
u32 ptrim; /* Repair function enable input */
u32 pwe; /* Write enable input (defines program cycle) */
} __packed;
/*
* Read a 32 bit value addressed by its index from the OTP.
* The FU540 stores 4096x32 bit (16KiB) values.
* Index 0x00-0xff are reserved for SiFive internal use. (first 1KiB)
*/
u32 otp_read_word(u16 idx)
{
u32 w;
if (idx >= 0x1000)
die("otp: idx out of bounds");
struct <API key> *regs = (void *)(FU540_OTP);
// wake up from stand-by
write32(®s->pdstb, 0x01);
// enable repair function
write32(®s->ptrim, 0x01);
// enable input
write32(®s->pce, 0x01);
// address to read
write32(®s->pa, idx);
// cycle clock to read
write32(®s->pclk, 0x01);
mdelay(1);
write32(®s->pclk, 0x00);
mdelay(1);
w = read32(®s->pdout);
// shut down
write32(®s->pce, 0x00);
write32(®s->ptrim, 0x00);
write32(®s->pdstb, 0x00);
return w;
}
u32 otp_read_serial(void)
{
u32 serial = 0;
u32 serial_n = 0;
for (int i = 0xfe; i > 0; i -= 2) {
serial = otp_read_word(i);
serial_n = otp_read_word(i+1);
if (serial == ~serial_n)
break;
}
return serial;
}
|
ifeq ($(CONFIG_OF),y)
# Keep at91 dtb files sorted alphabetically for each SoC
# rm9200
dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb
# sam9260
dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb
dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb
dtb-$(CONFIG_ARCH_AT91) += tny_a9260.dtb
dtb-$(CONFIG_ARCH_AT91) += usb_a9260.dtb
# sam9263
dtb-$(CONFIG_ARCH_AT91) += at91sam9263ek.dtb
dtb-$(CONFIG_ARCH_AT91) += tny_a9263.dtb
dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb
# sam9g20
dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb
dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb
dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb
dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
# sam9g45
dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb
dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
# sam9n12
dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
# sam9x5
dtb-$(CONFIG_ARCH_AT91) += at91-ariag25.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb
dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb
# sama5d3
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
da850-evm.dtb
dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
dove-cubox.dtb \
dove-dove-db.dtb
dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
exynos4210-smdkv310.dtb \
exynos4210-trats.dtb \
<API key>.dtb \
exynos4412-odroidx.dtb \
exynos4412-smdk4412.dtb \
exynos4412-origen.dtb \
exynos5250-arndale.dtb \
exynos5440-sd5v1.dtb \
exynos5250-smdk5250.dtb \
exynos5250-snow.dtb \
exynos5440-ssdk5440.dtb
dtb-$(<API key>) += highbank.dtb \
ecx-2000.dtb
dtb-$(<API key>) += integratorap.dtb \
integratorcp.dtb
dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
dtb-$(<API key>) += kirkwood-cloudbox.dtb \
kirkwood-dns320.dtb \
kirkwood-dns325.dtb \
kirkwood-dockstar.dtb \
kirkwood-dreamplug.dtb \
kirkwood-goflexnet.dtb \
<API key>.dtb \
kirkwood-ib62x0.dtb \
kirkwood-iconnect.dtb \
<API key>.dtb \
kirkwood-is2.dtb \
<API key>.dtb \
kirkwood-lschlv2.dtb \
kirkwood-lsxhl.dtb \
kirkwood-mplcec4.dtb \
<API key>.dtb \
kirkwood-ns2.dtb \
kirkwood-ns2lite.dtb \
kirkwood-ns2max.dtb \
kirkwood-ns2mini.dtb \
kirkwood-nsa310.dtb \
kirkwood-topkick.dtb \
kirkwood-ts219-6281.dtb \
kirkwood-ts219-6282.dtb \
<API key>.dtb
dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
msm8960-cdp.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
armada-370-mirabox.dtb \
armada-370-rd.dtb \
armada-xp-db.dtb \
armada-xp-gp.dtb \
<API key>.dtb
dtb-$(CONFIG_ARCH_MXC) += \
imx25-karo-tx25.dtb \
imx25-pdk.dtb \
imx27-apf27.dtb \
imx27-apf27dev.dtb \
imx27-pdk.dtb \
<API key>.dtb \
imx31-bug.dtb \
imx51-apf51.dtb \
imx51-apf51dev.dtb \
imx51-babbage.dtb \
imx53-ard.dtb \
imx53-evk.dtb \
imx53-mba53.dtb \
imx53-qsb.dtb \
imx53-smd.dtb \
imx6dl-sabreauto.dtb \
imx6dl-sabresd.dtb \
imx6dl-wandboard.dtb \
imx6q-arm2.dtb \
imx6q-sabreauto.dtb \
imx6q-sabrelite.dtb \
imx6q-sabresd.dtb \
imx6q-sbc6x.dtb
dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
imx23-olinuxino.dtb \
imx23-stmp378x_devb.dtb \
imx28-apf28.dtb \
imx28-apf28dev.dtb \
imx28-apx4devkit.dtb \
imx28-cfa10036.dtb \
imx28-cfa10037.dtb \
imx28-cfa10049.dtb \
imx28-evk.dtb \
imx28-m28evk.dtb \
imx28-sps1.dtb \
imx28-tx28.dtb
dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb
dtb-$(<API key>) += omap2420-h4.dtb \
omap3430-sdp.dtb \
omap3-beagle.dtb \
omap3-devkit8000.dtb \
omap3-beagle-xm.dtb \
omap3-evm.dtb \
omap3-tobi.dtb \
omap3-igep0020.dtb \
omap3-igep0030.dtb \
omap4-panda.dtb \
omap4-panda-a4.dtb \
omap4-panda-es.dtb \
omap4-var-som.dtb \
omap4-sdp.dtb \
omap5-evm.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
am335x-bone.dtb
dtb-$(CONFIG_ARCH_ORION5X) += <API key>.dtb
dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
hrefprev60.dtb \
hrefv60plus.dtb \
ccu9540.dtb
dtb-$(<API key>) += emev2-kzm9d.dtb \
<API key>.dtb \
r8a7778-bockw.dtb \
<API key>.dtb \
r8a7790-lager.dtb \
sh73a0-kzm9g.dtb \
<API key>.dtb \
r8a73a4-ape6evm.dtb \
sh7372-mackerel.dtb
dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
socfpga_vt.dtb
dtb-$(<API key>) += spear1310-evb.dtb \
spear1340-evb.dtb
dtb-$(<API key>)+= spear300-evb.dtb \
spear310-evb.dtb \
spear320-evb.dtb \
spear320-hmi.dtb
dtb-$(<API key>)+= spear600-evb.dtb
dtb-$(CONFIG_ARCH_SUNXI) += \
<API key>.dtb \
<API key>.dtb \
sun4i-a10-hackberry.dtb \
sun5i-a13-olinuxino.dtb
dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
tegra20-iris-512.dtb \
tegra20-medcom-wide.dtb \
tegra20-paz00.dtb \
tegra20-plutux.dtb \
tegra20-seaboard.dtb \
tegra20-tec.dtb \
tegra20-trimslice.dtb \
tegra20-ventana.dtb \
tegra20-whistler.dtb \
tegra30-beaver.dtb \
tegra30-cardhu-a02.dtb \
tegra30-cardhu-a04.dtb \
tegra114-dalmore.dtb \
<API key>.dtb \
<API key>.dtb \
tegra114-macallan.dtb \
tegra114-roth.dtb \
tegra114-pluto.dtb \
tegra114-pismo.dtb \
<API key>.dtb \
tegra124-bonaire.dtb \
tegra124-ardbeg.dtb \
<API key>.dtb \
tegra124-laguna.dtb \
tegra124-pm375.dtb \
tegra124-norrin.dtb \
tegra124-loki.dtb \
tegra124-foster.dtb \
tegra124-thor195.dtb \
tegra124-tn8.dtb \
tegra124-tn8-p1761.dtb \
<API key>.dtb \
<API key>.dtb \
<API key>.dtb \
tegra124-tn8-aio.dtb \
<API key>.dtb \
tegra124-tn8-a03-00.dtb \
<API key>.dtb \
tegra124-tn8-a03-01.dtb \
<API key>.dtb \
<API key>.dtb \
tegra124-e1791.dtb \
tegra124-e1922.dtb \
tegra124-e1923.dtb \
<API key>.dtb \
tegra124-vcm30_t124.dtb
dtb-$(<API key>) += versatile-ab.dtb \
versatile-pb.dtb
dtb-$(<API key>) += vexpress-v2p-ca5s.dtb \
vexpress-v2p-ca9.dtb \
<API key>.dtb \
<API key>.dtb
dtb-$(CONFIG_ARCH_VIRT) += xenvm-4.2.dtb
dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
wm8505-ref.dtb \
wm8650-mid.dtb \
wm8850-w70v2.dtb
dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
targets += dtbs
targets += $(dtb-y)
endif
# *.dtb used to be generated in the directory above. Clean out the
# old build results so people don't accidentally use them.
dtbs: $(addprefix $(obj)/, $(dtb-y))
|
<?php
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
/**
* .
*
* @package Page
* @author LOCKON CO.,LTD.
* @version $Id: <API key>.php 23546 2014-06-12 14:47:59Z shutta $
*/
class <API key> extends LC_Page_Admin_Ex
{
/** SC_FormParam */
public $objForm;
public $arrForm;
public $arrErr;
/**
* Page .
*
* @return void
*/
public function init()
{
parent::init();
$this->tpl_mainpage = 'ownersstore/settings.tpl';
$this->tpl_mainno = 'ownersstore';
$this->tpl_subno = 'settings';
$this->tpl_maintitle = '';
$this->tpl_subtitle = '';
$this->httpCacheControl('nocache');
}
/**
* Page .
*
* @return void
*/
public function process()
{
$this->action();
$this->sendResponse();
}
/**
* Page .
*
* @return void
*/
public function action()
{
switch ($this->getMode()) {
case 'register':
$this->execRegisterMode();
break;
default:
$this->execDefaultMode();
}
}
/**
* register.
* DB.
*
* @param void
* @return void
*/
public function execRegisterMode()
{
$this->initRegisterMode();
// POST
$arrErr = $this-><API key>();
if (!empty($arrErr)) {
$this->arrErr = $arrErr;
$this->arrForm = $this->objForm->getHashArray();
return;
}
$arrForm = $this->objForm->getHashArray();
$this-><API key>($arrForm);
$this->arrForm = $arrForm;
$this->tpl_onload = "alert('')";
}
/**
* register.
* SC_FormParam.
*
* @param void
* @return void
*/
public function initRegisterMode()
{
if (isset($_POST['public_key'])) {
$_POST['public_key'] = trim($_POST['public_key']);
}
$objForm = new SC_FormParam_Ex();
$objForm->addParam('', 'public_key', LTEXT_LEN, '', array('EXIST_CHECK', 'ALNUM_CHECK', 'MAX_LENGTH_CHECK'));
$objForm->setParam($_POST);
$this->objForm = $objForm;
}
/**
* register.
*
* @param void
* @return array
*/
public function <API key>()
{
return $this->objForm->checkError();
}
/**
* default.
* DB.
*
* @param void
* @return void
*/
public function execDefaultMode()
{
$this->arrForm = $this-><API key>();
}
/**
* DB.
*
* @param array $arrSettingsData
* @return void
*/
public function <API key>($arrSettingsData)
{
$table = '<API key>';
$objQuery =& SC_Query_Ex::<API key>();
$exists = $objQuery->exists($table);
if ($exists) {
$objQuery->update($table, $arrSettingsData);
} else {
$objQuery->insert($table, $arrSettingsData);
}
}
/**
* DB.
*
* @param void
* @return array
*/
public function <API key>()
{
$table = '<API key>';
$colmuns = '*';
$objQuery =& SC_Query_Ex::<API key>();
$arrRet = $objQuery->select($colmuns, $table);
if (isset($arrRet[0])) return $arrRet[0];
return array();
}
}
|
<?php
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
exit("Do not access this file directly.");
if (!class_exists ("<API key>"))
{
class <API key>
{
public static function clickbank_constants ($c = FALSE, $vars = FALSE)
{
if (!defined ("<API key>"))
define ("<API key>", ($c[] = true));
return $c; // Return $c calculation values.
}
}
}
?>
|
<?php
namespace eZ\Publish\Core\Persistence\Legacy\Tests\User;
use eZ\Publish\API\Repository\Values\User\Role as APIRole;
use eZ\Publish\Core\Persistence\Legacy\Tests\TestCase;
use eZ\Publish\Core\Persistence\Legacy\User;
use eZ\Publish\Core\Persistence\Legacy\User\Role\LimitationConverter;
use eZ\Publish\Core\Persistence\Legacy\User\Role\LimitationHandler\ObjectStateHandler as <API key>;
use eZ\Publish\SPI\Persistence;
/**
* Test case for UserHandlerTest.
*/
class UserHandlerTest extends TestCase
{
protected function getUserHandler()
{
$dbHandler = $this->getDatabaseHandler();
return new User\Handler(
new User\Gateway\DoctrineDatabase($dbHandler),
new User\Role\Gateway\DoctrineDatabase($dbHandler),
new User\Mapper(),
new LimitationConverter(array(new <API key>($dbHandler)))
);
}
protected function getValidUser()
{
$user = new Persistence\User();
$user->id = 42;
$user->login = 'kore';
$user->email = 'kore@example.org';
$user->passwordHash = '1234567890';
$user->hashAlgorithm = 2;
$user->isEnabled = true;
$user->maxLogin = 23;
return $user;
}
public function testCreateUser()
{
$handler = $this->getUserHandler();
$handler->create($this->getValidUser());
$this->assertQueryResult(
array(array(1)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser'),
'Expected one user to be created.'
);
$this->assertQueryResult(
array(array(1)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser_setting'),
'Expected one user setting to be created.'
);
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$handler->create($user);
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
public function <API key>()
{
$handler = $this->getUserHandler();
$user = new Persistence\User();
$user->id = 42;
$handler->create($user);
}
public function testLoadUser()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$this->assertEquals(
$user,
$handler->load($user->id)
);
}
/**
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
*/
public function testLoadUnknownUser()
{
$handler = $this->getUserHandler();
$handler->load(1337);
}
public function testLoadUserByLogin()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$loadedUser = $handler->loadByLogin($user->login);
$this->assertEquals(
$user,
$loadedUser
);
}
/**
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
*/
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$handler->loadByLogin($user->email);
}
public function testLoadUserByEmail()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$users = $handler->loadByEmail($user->email);
$this->assertEquals(
$user,
$users[0]
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$this->assertQueryResult(
array(array(1)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser'),
'Expected one user to be created.'
);
$this->assertQueryResult(
array(array(1)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser_setting'),
'Expected one user setting to be created.'
);
$handler->delete($user->id);
$this->assertQueryResult(
array(array(0)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser'),
'Expected one user to be removed.'
);
$this->assertQueryResult(
array(array(0)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser_setting'),
'Expected one user setting to be removed.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->delete(1337);
$this->assertQueryResult(
array(array(0)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser'),
'Expected no existing user.'
);
}
public function testUpdateUser()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$user->login = 'New_lögin';
$handler->update($user);
$this->assertQueryResult(
array(array(42, 'kore@example.org', 'New_lögin', 'new_lögin', 1234567890, '2')),
$this->handler->createSelectQuery()->select('*')->from('ezuser'),
'Expected user data to be updated.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->create($user = $this->getValidUser());
$user->maxLogin = 42;
$handler->update($user);
$this->assertQueryResult(
array(array(1, 42, 42)),
$this->handler->createSelectQuery()->select('*')->from('ezuser_setting'),
'Expected user data to be updated.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$handler->update($this->getValidUser());
$this->assertQueryResult(
array(array(0)),
$this->handler->createSelectQuery()->select('COUNT( * )')->from('ezuser'),
'Expected no existing user.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$handler->createRole($createStruct);
$this->assertQueryResult(
array(array(1, 'Test', -1)),
$this->handler->createSelectQuery()->select('id', 'name', 'version')->from('ezrole'),
'Expected a new role draft.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$handler->createRoleDraft($roleDraft->id);
$publishedRoleId = 1;
$this->assertQueryResult(
[
[$publishedRoleId, 'Test', APIRole::STATUS_DEFINED],
[2, 'Test', $publishedRoleId],
],
$this->handler->createSelectQuery()->select('id', 'name', 'version')->from('ezrole'),
'Expected a role and a role draft.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$this->assertSame('1', $roleDraft->id);
}
public function testLoadRole()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$this->assertEquals(
$roleDraft->id,
$role->id
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$handler-><API key>($roleDraft->id, $policy);
$handler->publishRoleDraft($roleDraft->id);
$loaded = $handler->loadRole($roleDraft->id);
$this->assertEquals(
array(
new Persistence\User\Policy(
array(
'id' => 1,
'roleId' => 1,
'module' => 'foo',
'function' => 'bar',
'limitations' => '*',
'originalId' => null,
)
),
),
$loaded->policies
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$handler-><API key>($roleDraft->id, $policy);
$handler->assignRole(23, $roleDraft->id);
$handler->assignRole(42, $roleDraft->id);
$handler->publishRoleDraft($roleDraft->id);
$loaded = $handler->loadRole($roleDraft->id);
$this->assertEquals(
array(
new Persistence\User\Policy(
array(
'id' => 1,
'roleId' => 1,
'module' => 'foo',
'function' => 'bar',
'limitations' => '*',
'originalId' => null,
)
),
),
$loaded->policies
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$policy->limitations = array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
);
$handler-><API key>($roleDraft->id, $policy);
$handler->publishRoleDraft($roleDraft->id);
$loaded = $handler->loadRole($roleDraft->id);
$this->assertEquals(
array(
new Persistence\User\Policy(
array(
'id' => 1,
'roleId' => 1,
'module' => 'foo',
'function' => 'bar',
'limitations' => array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
),
'originalId' => null,
)
),
),
$loaded->policies
);
}
public function testLoadRoles()
{
$handler = $this->getUserHandler();
$this->assertEquals(
array(),
$handler->loadRoles()
);
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$this->assertEquals(
array($role),
$handler->loadRoles()
);
}
public function testUpdateRole()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$update = new Persistence\User\RoleUpdateStruct();
$update->id = $role->id;
$update->identifier = 'Changed';
$handler->updateRole($update);
$this->assertQueryResult(
array(array(1, 'Changed')),
$this->handler->createSelectQuery()->select('id', 'name')->from('ezrole'),
'Expected a changed role.'
);
}
public function testDeleteRole()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
// 3 is the ID of Editor role
$handler->deleteRole(3);
$this->assertQueryResult(
array(),
$this->handler->createSelectQuery()->select('id')->from('ezrole')->where('id = 3'),
'Expected an empty set.'
);
$this->assertQueryResult(
array(),
$this->handler->createSelectQuery()->select('role_id')->from('ezpolicy')->where('role_id = 3'),
'Expected an empty set.'
);
$this->assertQueryResult(
array(),
$this->handler->createSelectQuery()->select('role_id')->from('ezuser_role')->where('role_id = 3'),
'Expected an empty set.'
);
}
public function testDeleteRoleDraft()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
// 3 is the ID of Editor role
$roleDraft = $handler->createRoleDraft(3);
$handler->deleteRole($roleDraft->id, APIRole::STATUS_DRAFT);
$this->assertQueryResult(
[['3', APIRole::STATUS_DEFINED]],
$this->handler->createSelectQuery()->select('id, version')->from('ezrole')->where('id = 3'),
'Expected a published role.'
);
$this->assertQueryResult(
[[implode("\n", array_fill(0, 27, '3, ' . APIRole::STATUS_DEFINED))]],
$this->handler->createSelectQuery()->select('role_id, original_id')->from('ezpolicy')->where('role_id = 3'),
'Expected 27 policies for the published role.'
);
$this->assertQueryResult(
[[3], [3]],
$this->handler->createSelectQuery()->select('role_id')->from('ezuser_role')->where('role_id = 3'),
'Expected that role assignments still exist.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$handler->addPolicy($role->id, $policy);
$this->assertQueryResult(
array(array(1, 'foo', 'bar', 1)),
$this->handler->createSelectQuery()->select('id', 'module_name', 'function_name', 'role_id')->from('ezpolicy'),
'Expected a new policy.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$policy = $handler->addPolicy($role->id, $policy);
$this->assertEquals(1, $policy->id);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$policy->limitations = array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
);
$handler->addPolicy($role->id, $policy);
$this->assertQueryResult(
array(
array(1, 'Subtree', 1),
array(2, 'Foo', 1),
),
$this->handler->createSelectQuery()->select('id', 'identifier', 'policy_id')->from('ezpolicy_limitation'),
'Expected a new policy.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$roleDraft = $handler->createRole($createStruct);
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$policy = new Persistence\User\Policy();
$policy->module = 'foo';
$policy->function = 'bar';
$policy->limitations = array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
);
$handler->addPolicy($role->id, $policy);
$this->assertQueryResult(
array(
array(1, '/1', 1),
array(2, '/1/2', 1),
array(3, 'Bar', 2),
),
$this->handler->createSelectQuery()->select('id', 'value', 'limitation_id')->from('<API key>'),
'Expected a new policy.'
);
}
protected function createRole()
{
$handler = $this->getUserHandler();
$policy1 = new Persistence\User\Policy();
$policy1->module = 'foo';
$policy1->function = 'bar';
$policy1->limitations = array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
);
$policy2 = new Persistence\User\Policy();
$policy2->module = 'foo';
$policy2->function = 'blubb';
$policy2->limitations = array(
'Foo' => array('Blubb'),
);
$createStruct = new Persistence\User\RoleCreateStruct();
$createStruct->identifier = 'Test';
$createStruct->policies = array($policy1, $policy2);
return $handler->createRole($createStruct);
}
public function <API key>()
{
$this->createRole();
$this->assertQueryResult(
array(
array(1, 'foo', 'bar', 1),
array(2, 'foo', 'blubb', 1),
),
$this->handler->createSelectQuery()->select('id', 'module_name', 'function_name', 'role_id')->from('ezpolicy'),
'Expected a new policy.'
);
}
public function testDeletePolicy()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->publishRoleDraft($roleDraft->id);
$handler->deletePolicy($roleDraft->policies[0]->id);
$this->assertQueryResult(
array(
array(2, 'foo', 'blubb', 1),
),
$this->handler->createSelectQuery()->select('id', 'module_name', 'function_name', 'role_id')->from('ezpolicy')->where('original_id = 0'),
'Expected a new policy.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->deletePolicy($roleDraft->policies[0]->id);
$this->assertQueryResult(
array(array(3, 'Foo', 2)),
$this->handler->createSelectQuery()->select('*')->from('ezpolicy_limitation')
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->deletePolicy($roleDraft->policies[0]->id);
$this->assertQueryResult(
array(array(4, 3, 'Blubb')),
$this->handler->createSelectQuery()->select('*')->from('<API key>')
);
}
public function testUpdatePolicies()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$policy = $roleDraft->policies[0];
$policy->limitations = array(
'new' => array('something'),
);
$handler->updatePolicy($policy);
$this->assertQueryResult(
array(
array(3, 'Foo', 2),
array(4, 'new', 1),
),
$this->handler->createSelectQuery()->select('*')->from('ezpolicy_limitation')
);
$this->assertQueryResult(
array(
array(4, 3, 'Blubb'),
array(5, 4, 'something'),
),
$this->handler->createSelectQuery()->select('*')->from('<API key>')
);
}
public function testAddRoleToUser()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$handler->create($user = $this->getValidUser());
$handler->assignRole($user->id, $role->id, array());
$this->assertQueryResult(
array(
array(1, 42, 1, null, null),
),
$this->handler->createSelectQuery()->select('id', 'contentobject_id', 'role_id', 'limit_identifier', 'limit_value')->from('ezuser_role'),
'Expected a new user policy association.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$handler->create($user = $this->getValidUser());
$handler->assignRole(
$user->id,
$role->id,
array(
'Subtree' => array('/1'),
)
);
$this->assertQueryResult(
array(
array(1, 42, 1, 'Subtree', '/1'),
),
$this->handler->createSelectQuery()->select('id', 'contentobject_id', 'role_id', 'limit_identifier', 'limit_value')->from('ezuser_role'),
'Expected a new user policy association.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$handler->create($user = $this->getValidUser());
$handler->assignRole(
$user->id,
$role->id,
array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
)
);
$this->assertQueryResult(
array(
array(1, 42, 1, 'Subtree', '/1'),
array(2, 42, 1, 'Subtree', '/1/2'),
array(3, 42, 1, 'Foo', 'Bar'),
),
$this->handler->createSelectQuery()->select('id', 'contentobject_id', 'role_id', 'limit_identifier', 'limit_value')->from('ezuser_role'),
'Expected a new user policy association.'
);
}
public function <API key>()
{
$handler = $this->getUserHandler();
$roleDraft = $this->createRole();
$handler->publishRoleDraft($roleDraft->id);
$role = $handler->loadRole($roleDraft->id);
$handler->create($user = $this->getValidUser());
$handler->assignRole(
$user->id,
$role->id,
array(
'Subtree' => array('/1', '/1/2'),
'Foo' => array('Bar'),
)
);
$handler->unassignRole($user->id, $role->id);
$this->assertQueryResult(
array(),
$this->handler->createSelectQuery()->select('id', 'contentobject_id', 'role_id', 'limit_identifier', 'limit_value')->from('ezuser_role'),
'Expected no user policy associations.'
);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$policies = $handler-><API key>(10); // Anonymous user
// Verify, that we received an array of Policy objects
$this->assertTrue(
array_reduce(
array_map(
function ($policy) {
return $policy instanceof Persistence\User\Policy;
},
$policies
),
function ($a, $b) {
return $a && $b;
},
true
)
);
$this->assertEquals(8, count($policies));
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 28,
'roleId' => 1,
'contentId' => 11,
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 34,
'roleId' => 5,
'contentId' => 11,
)
),
),
$handler-><API key>(11)// 11: Members
);
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 31,
'roleId' => 1,
'contentId' => 42,
)
),
),
$handler-><API key>(42)// 42: Anonymous Users
);
$this->assertEquals(
array(),
$handler-><API key>(10)// 10: Anonymous User
);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 31,
'roleId' => 1,
'contentId' => 42,
)
),
),
$handler-><API key>(10, true)// 10: Anonymous User
);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 32,
'roleId' => 3,
'contentId' => 13,
'<API key>' => 'Subtree',
'values' => array('/1/2/'),
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 33,
'roleId' => 3,
'contentId' => 13,
'<API key>' => 'Subtree',
'values' => array('/1/43/'),
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 38,
'roleId' => 5,
'contentId' => 13,
)
),
),
$handler-><API key>(13)
);
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 32,
'roleId' => 3,
'contentId' => 13,
'<API key>' => 'Subtree',
'values' => array('/1/2/'),
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 33,
'roleId' => 3,
'contentId' => 13,
'<API key>' => 'Subtree',
'values' => array('/1/43/'),
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 38,
'roleId' => 5,
'contentId' => 13,
)
),
),
$handler-><API key>(13, true)
);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$this->assertEquals(
array(
new Persistence\User\RoleAssignment(
array(
'id' => 28,
'roleId' => 1,
'contentId' => 11,
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 31,
'roleId' => 1,
'contentId' => 42,
)
),
new Persistence\User\RoleAssignment(
array(
'id' => 37,
'roleId' => 1,
'contentId' => 59,
)
),
),
$handler-><API key>(1)
);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
// 3 is the ID of Editor role
$originalRoleId = 3;
$draft = $handler->createRoleDraft($originalRoleId);
$loadedDraft = $handler-><API key>($originalRoleId);
self::assertSame($loadedDraft->originalId, $originalRoleId);
self::assertEquals($draft, $loadedDraft);
}
public function <API key>()
{
$this-><API key>(__DIR__ . '/../../../../Repository/Tests/Service/Integration/Legacy/_fixtures/<API key>.php');
$handler = $this->getUserHandler();
$originalRoleId = 3;
$originalRole = $handler->loadRole($originalRoleId);
$originalPolicies = [];
foreach ($originalRole->policies as $policy) {
$originalPolicies[$policy->id] = $policy;
}
$draft = $handler->createRoleDraft($originalRoleId);
$loadedDraft = $handler->loadRole($draft->id, Persistence\User\Role::STATUS_DRAFT);
self::assertSame($loadedDraft->originalId, $originalRoleId);
self::assertEquals($draft, $loadedDraft);
foreach ($loadedDraft->policies as $policy) {
self::assertTrue(isset($originalPolicies[$policy->originalId]));
}
// Now add a new policy. Original ID of the new one must be the same as its actual ID.
$newPolicyModule = 'foo';
$newPolicyFunction = 'bar';
$policy = new Persistence\User\Policy(['module' => $newPolicyModule, 'function' => $newPolicyFunction]);
$policyDraft = $handler-><API key>($loadedDraft->id, $policy);
// Test again by reloading the draft.
$loadedDraft = $handler->loadRole($draft->id, Persistence\User\Role::STATUS_DRAFT);
foreach ($loadedDraft->policies as $policy) {
if ($policy->id != $policyDraft->id) {
continue;
}
self::assertNotNull($policy->originalId);
self::assertSame($policy->id, $policy->originalId);
}
}
}
|
#undef DEBUG
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/usb.h>
#include <linux/module.h>
#include <asm/byteorder.h>
#include <asm/uaccess.h>
#include "pegasus.h"
/*
* Version Information
*/
#define DRIVER_VERSION "v0.6.12 (2005/01/13)"
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
static const char driver_name[] = "pegasus";
#undef <API key>
#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
BMSR_100FULL | BMSR_ANEGCAPABLE)
static int loopback = 0;
static int mii_mode = 0;
static struct usb_eth_dev usb_dev_id[] = {
#define PEGASUS_DEV(pn, vid, pid, flags) \
{.name = pn, .vendor = vid, .device = pid, .private = flags},
#include "pegasus.h"
#undef PEGASUS_DEV
{NULL, 0, 0, 0}
};
static struct usb_device_id pegasus_ids[] = {
#define PEGASUS_DEV(pn, vid, pid, flags) \
{.match_flags = <API key>, .idVendor = vid, .idProduct = pid},
#include "pegasus.h"
#undef PEGASUS_DEV
{}
};
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
module_param(loopback, bool, 0);
module_param(mii_mode, bool, 0);
MODULE_PARM_DESC(loopback, "Enable MAC loopback mode (bit 0)");
MODULE_PARM_DESC(mii_mode, "Enable HomePNA mode (bit 0),default=MII mode = 0");
/* use ethtool to change the level for any given device */
static int msg_level = -1;
module_param (msg_level, int, 0);
MODULE_PARM_DESC (msg_level, "Override default message level");
MODULE_DEVICE_TABLE(usb, pegasus_ids);
static int <API key>(pegasus_t *);
/* Aargh!!! I _really_ hate such tweaks */
static void ctrl_callback(struct urb *urb, struct pt_regs *regs)
{
pegasus_t *pegasus = urb->context;
if (!pegasus)
return;
switch (urb->status) {
case 0:
if (pegasus->flags & ETH_REGS_CHANGE) {
pegasus->flags &= ~ETH_REGS_CHANGE;
pegasus->flags |= ETH_REGS_CHANGED;
<API key>(pegasus);
return;
}
break;
case -EINPROGRESS:
return;
case -ENOENT:
break;
default:
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, urb->status);
}
pegasus->flags &= ~ETH_REGS_CHANGED;
wake_up(&pegasus->ctrl_wait);
}
static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
void *data)
{
int ret;
char *buffer;
DECLARE_WAITQUEUE(wait, current);
buffer = kmalloc(size, GFP_KERNEL);
if (!buffer) {
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "out of memory in %s\n",
__FUNCTION__);
return -ENOMEM;
}
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
while (pegasus->flags & ETH_REGS_CHANGED)
schedule();
remove_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(TASK_RUNNING);
pegasus->dr.bRequestType = PEGASUS_REQT_READ;
pegasus->dr.bRequest = <API key>;
pegasus->dr.wValue = cpu_to_le16(0);
pegasus->dr.wIndex = cpu_to_le16p(&indx);
pegasus->dr.wLength = cpu_to_le16p(&size);
pegasus->ctrl_urb-><API key> = size;
<API key>(pegasus->ctrl_urb, pegasus->usb,
usb_rcvctrlpipe(pegasus->usb, 0),
(char *) &pegasus->dr,
buffer, size, ctrl_callback, pegasus);
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
/* using ATOMIC, we'd never wake up if we slept */
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
goto out;
}
schedule();
out:
remove_wait_queue(&pegasus->ctrl_wait, &wait);
memcpy(data, buffer, size);
kfree(buffer);
return ret;
}
static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
void *data)
{
int ret;
char *buffer;
DECLARE_WAITQUEUE(wait, current);
buffer = kmalloc(size, GFP_KERNEL);
if (!buffer) {
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "out of memory in %s\n",
__FUNCTION__);
return -ENOMEM;
}
memcpy(buffer, data, size);
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
while (pegasus->flags & ETH_REGS_CHANGED)
schedule();
remove_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(TASK_RUNNING);
pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
pegasus->dr.bRequest = <API key>;
pegasus->dr.wValue = cpu_to_le16(0);
pegasus->dr.wIndex = cpu_to_le16p(&indx);
pegasus->dr.wLength = cpu_to_le16p(&size);
pegasus->ctrl_urb-><API key> = size;
<API key>(pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb, 0),
(char *) &pegasus->dr,
buffer, size, ctrl_callback, pegasus);
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
goto out;
}
schedule();
out:
remove_wait_queue(&pegasus->ctrl_wait, &wait);
kfree(buffer);
return ret;
}
static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
{
int ret;
char *tmp;
DECLARE_WAITQUEUE(wait, current);
tmp = kmalloc(1, GFP_KERNEL);
if (!tmp) {
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "out of memory in %s\n",
__FUNCTION__);
return -ENOMEM;
}
memcpy(tmp, &data, 1);
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
while (pegasus->flags & ETH_REGS_CHANGED)
schedule();
remove_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(TASK_RUNNING);
pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
pegasus->dr.bRequest = PEGASUS_REQ_SET_REG;
pegasus->dr.wValue = cpu_to_le16(data);
pegasus->dr.wIndex = cpu_to_le16p(&indx);
pegasus->dr.wLength = cpu_to_le16(1);
pegasus->ctrl_urb-><API key> = 1;
<API key>(pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb, 0),
(char *) &pegasus->dr,
&tmp, 1, ctrl_callback, pegasus);
add_wait_queue(&pegasus->ctrl_wait, &wait);
set_current_state(<API key>);
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
goto out;
}
schedule();
out:
remove_wait_queue(&pegasus->ctrl_wait, &wait);
kfree(tmp);
return ret;
}
static int <API key>(pegasus_t * pegasus)
{
int ret;
pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
pegasus->dr.bRequest = <API key>;
pegasus->dr.wValue = 0;
pegasus->dr.wIndex = cpu_to_le16(EthCtrl0);
pegasus->dr.wLength = cpu_to_le16(3);
pegasus->ctrl_urb-><API key> = 3;
<API key>(pegasus->ctrl_urb, pegasus->usb,
usb_sndctrlpipe(pegasus->usb, 0),
(char *) &pegasus->dr,
pegasus->eth_regs, 3, ctrl_callback, pegasus);
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC)))
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
return ret;
}
static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
{
int i;
__u8 data[4] = { phy, 0, 0, indx };
__le16 regdi;
int ret;
ret = set_register(pegasus, PhyCtrl, 0);
ret = set_registers(pegasus, PhyAddr, sizeof (data), data);
ret = set_register(pegasus, PhyCtrl, (indx | PHY_READ));
for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, PhyCtrl, 1, data);
if (data[0] & PHY_DONE)
break;
}
if (i < REG_TIMEOUT) {
ret = get_registers(pegasus, PhyData, 2, ®di);
*regd = le16_to_cpu(regdi);
return 1;
}
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return 0;
}
static int mdio_read(struct net_device *dev, int phy_id, int loc)
{
pegasus_t *pegasus = (pegasus_t *) netdev_priv(dev);
u16 res;
read_mii_word(pegasus, phy_id, loc, &res);
return (int)res;
}
static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
{
int i;
__u8 data[4] = { phy, 0, 0, indx };
int ret;
data[1] = (u8) regd;
data[2] = (u8) (regd >> 8);
ret = set_register(pegasus, PhyCtrl, 0);
ret = set_registers(pegasus, PhyAddr, sizeof(data), data);
ret = set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, PhyCtrl, 1, data);
if (data[0] & PHY_DONE)
break;
}
if (i < REG_TIMEOUT)
return 0;
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return 1;
}
static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
{
pegasus_t *pegasus = (pegasus_t *) netdev_priv(dev);
write_mii_word(pegasus, phy_id, loc, val);
}
static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
{
int i;
__u8 tmp;
__le16 retdatai;
int ret;
ret = set_register(pegasus, EpromCtrl, 0);
ret = set_register(pegasus, EpromOffset, index);
ret = set_register(pegasus, EpromCtrl, EPROM_READ);
for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
if (tmp & EPROM_DONE)
break;
}
if (i < REG_TIMEOUT) {
ret = get_registers(pegasus, EpromData, 2, &retdatai);
*retdata = le16_to_cpu(retdatai);
return 0;
}
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return -1;
}
#ifdef <API key>
static inline void enable_eprom_write(pegasus_t * pegasus)
{
__u8 tmp;
int ret;
ret = get_registers(pegasus, EthCtrl2, 1, &tmp);
ret = set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
}
static inline void disable_eprom_write(pegasus_t * pegasus)
{
__u8 tmp;
int ret;
ret = get_registers(pegasus, EthCtrl2, 1, &tmp);
ret = set_register(pegasus, EpromCtrl, 0);
ret = set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE);
}
static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
{
int i;
__u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
int ret;
ret = set_registers(pegasus, EpromOffset, 4, d);
enable_eprom_write(pegasus);
ret = set_register(pegasus, EpromOffset, index);
ret = set_registers(pegasus, EpromData, 2, &data);
ret = set_register(pegasus, EpromCtrl, EPROM_WRITE);
for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
if (tmp & EPROM_DONE)
break;
}
disable_eprom_write(pegasus);
if (i < REG_TIMEOUT)
return 0;
if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return -1;
}
#endif /* <API key> */
static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
{
int i;
__u16 w16;
for (i = 0; i < 3; i++) {
read_eprom_word(pegasus, i, &w16);
((__le16 *) id)[i] = cpu_to_le16p(&w16);
}
}
static void set_ethernet_addr(pegasus_t * pegasus)
{
__u8 node_id[6];
int ret;
get_node_id(pegasus, node_id);
ret = set_registers(pegasus, EthID, sizeof (node_id), node_id);
memcpy(pegasus->net->dev_addr, node_id, sizeof (node_id));
}
static inline int reset_mac(pegasus_t * pegasus)
{
__u8 data = 0x8;
int i;
int ret;
ret = set_register(pegasus, EthCtrl1, data);
for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, EthCtrl1, 1, &data);
if (~data & 0x08) {
if (loopback & 1)
break;
if (mii_mode && (pegasus->features & HAS_HOME_PNA))
ret = set_register(pegasus, Gpio1, 0x34);
else
ret = set_register(pegasus, Gpio1, 0x26);
ret = set_register(pegasus, Gpio0, pegasus->features);
ret = set_register(pegasus, Gpio0, DEFAULT_GPIO_SET);
break;
}
}
if (i == REG_TIMEOUT)
return 1;
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
ret = set_register(pegasus, Gpio0, 0x24);
ret = set_register(pegasus, Gpio0, 0x26);
}
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_ELCON) {
__u16 auxmode;
read_mii_word(pegasus, 3, 0x1b, &auxmode);
write_mii_word(pegasus, 3, 0x1b, auxmode | 4);
}
return 0;
}
static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
{
__u16 linkpart;
__u8 data[4];
pegasus_t *pegasus = netdev_priv(dev);
int ret;
read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
data[0] = 0xc9;
data[1] = 0;
if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL))
data[1] |= 0x20; /* set full duplex */
if (linkpart & (ADVERTISE_100FULL | ADVERTISE_100HALF))
data[1] |= 0x10; /* set 100 Mbps */
if (mii_mode)
data[1] = 0;
data[2] = (loopback & 1) ? 0x09 : 0x01;
memcpy(pegasus->eth_regs, data, sizeof (data));
ret = set_registers(pegasus, EthCtrl0, 3, data);
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
u16 auxmode;
read_mii_word(pegasus, 0, 0x1b, &auxmode);
write_mii_word(pegasus, 0, 0x1b, auxmode | 4);
}
return 0;
}
static void fill_skb_pool(pegasus_t * pegasus)
{
int i;
for (i = 0; i < RX_SKBS; i++) {
if (pegasus->rx_pool[i])
continue;
pegasus->rx_pool[i] = dev_alloc_skb(PEGASUS_MTU + 2);
/*
** we give up if the allocation fail. the tasklet will be
** rescheduled again anyway...
*/
if (pegasus->rx_pool[i] == NULL)
return;
pegasus->rx_pool[i]->dev = pegasus->net;
skb_reserve(pegasus->rx_pool[i], 2);
}
}
static void free_skb_pool(pegasus_t * pegasus)
{
int i;
for (i = 0; i < RX_SKBS; i++) {
if (pegasus->rx_pool[i]) {
dev_kfree_skb(pegasus->rx_pool[i]);
pegasus->rx_pool[i] = NULL;
}
}
}
static inline struct sk_buff *pull_skb(pegasus_t * pegasus)
{
int i;
struct sk_buff *skb;
for (i = 0; i < RX_SKBS; i++) {
if (likely(pegasus->rx_pool[i] != NULL)) {
skb = pegasus->rx_pool[i];
pegasus->rx_pool[i] = NULL;
return skb;
}
}
return NULL;
}
static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
{
pegasus_t *pegasus = urb->context;
struct net_device *net;
int rx_status, count = urb->actual_length;
u8 *buf = urb->transfer_buffer;
__u16 pkt_len;
if (!pegasus)
return;
net = pegasus->net;
if (!<API key>(net) || !netif_running(net))
return;
switch (urb->status) {
case 0:
break;
case -ETIMEDOUT:
if (netif_msg_rx_err(pegasus))
pr_debug("%s: reset MAC\n", net->name);
pegasus->flags &= ~PEGASUS_RX_BUSY;
break;
case -EPIPE: /* stall, or disconnect from TT */
/* FIXME schedule work to clear the halt */
if (netif_msg_rx_err(pegasus))
printk(KERN_WARNING "%s: no rx stall recovery\n",
net->name);
return;
case -ENOENT:
case -ECONNRESET:
case -ESHUTDOWN:
if (netif_msg_ifdown(pegasus))
pr_debug("%s: rx unlink, %d\n", net->name, urb->status);
return;
default:
if (netif_msg_rx_err(pegasus))
pr_debug("%s: RX status %d\n", net->name, urb->status);
goto goon;
}
if (!count || count < 4)
goto goon;
rx_status = buf[count - 2];
if (rx_status & 0x1e) {
if (netif_msg_rx_err(pegasus))
pr_debug("%s: RX packet error %x\n",
net->name, rx_status);
pegasus->stats.rx_errors++;
if (rx_status & 0x06) // long or runt
pegasus->stats.rx_length_errors++;
if (rx_status & 0x08)
pegasus->stats.rx_crc_errors++;
if (rx_status & 0x10) // extra bits
pegasus->stats.rx_frame_errors++;
goto goon;
}
if (pegasus->chip == 0x8513) {
pkt_len = le32_to_cpu(*(__le32 *)urb->transfer_buffer);
pkt_len &= 0x0fff;
pegasus->rx_skb->data += 2;
} else {
pkt_len = buf[count - 3] << 8;
pkt_len += buf[count - 4];
pkt_len &= 0xfff;
pkt_len -= 8;
}
/*
* If the packet is unreasonably long, quietly drop it rather than
* kernel panicing by calling skb_put.
*/
if (pkt_len > PEGASUS_MTU)
goto goon;
/*
* at this point we are sure pegasus->rx_skb != NULL
* so we go ahead and pass up the packet.
*/
skb_put(pegasus->rx_skb, pkt_len);
pegasus->rx_skb->protocol = eth_type_trans(pegasus->rx_skb, net);
netif_rx(pegasus->rx_skb);
pegasus->stats.rx_packets++;
pegasus->stats.rx_bytes += pkt_len;
if (pegasus->flags & PEGASUS_UNPLUG)
return;
spin_lock(&pegasus->rx_pool_lock);
pegasus->rx_skb = pull_skb(pegasus);
spin_unlock(&pegasus->rx_pool_lock);
if (pegasus->rx_skb == NULL)
goto tl_sched;
goon:
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
if (usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC)) {
pegasus->flags |= PEGASUS_RX_URB_FAIL;
goto tl_sched;
} else {
pegasus->flags &= ~PEGASUS_RX_URB_FAIL;
}
return;
tl_sched:
tasklet_schedule(&pegasus->rx_tl);
}
static void rx_fixup(unsigned long data)
{
pegasus_t *pegasus;
unsigned long flags;
pegasus = (pegasus_t *) data;
if (pegasus->flags & PEGASUS_UNPLUG)
return;
spin_lock_irqsave(&pegasus->rx_pool_lock, flags);
fill_skb_pool(pegasus);
if (pegasus->flags & PEGASUS_RX_URB_FAIL)
if (pegasus->rx_skb)
goto try_again;
if (pegasus->rx_skb == NULL) {
pegasus->rx_skb = pull_skb(pegasus);
}
if (pegasus->rx_skb == NULL) {
if (netif_msg_rx_err(pegasus))
printk(KERN_WARNING "%s: low on memory\n",
pegasus->net->name);
tasklet_schedule(&pegasus->rx_tl);
goto done;
}
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
try_again:
if (usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC)) {
pegasus->flags |= PEGASUS_RX_URB_FAIL;
tasklet_schedule(&pegasus->rx_tl);
} else {
pegasus->flags &= ~PEGASUS_RX_URB_FAIL;
}
done:
<API key>(&pegasus->rx_pool_lock, flags);
}
static void write_bulk_callback(struct urb *urb, struct pt_regs *regs)
{
pegasus_t *pegasus = urb->context;
struct net_device *net = pegasus->net;
if (!pegasus)
return;
if (!<API key>(net) || !netif_running(net))
return;
switch (urb->status) {
case -EPIPE:
/* FIXME schedule_work() to clear the tx halt */
netif_stop_queue(net);
if (netif_msg_tx_err(pegasus))
printk(KERN_WARNING "%s: no tx stall recovery\n",
net->name);
return;
case -ENOENT:
case -ECONNRESET:
case -ESHUTDOWN:
if (netif_msg_ifdown(pegasus))
pr_debug("%s: tx unlink, %d\n", net->name, urb->status);
return;
default:
if (netif_msg_tx_err(pegasus))
pr_info("%s: TX status %d\n", net->name, urb->status);
/* FALL THROUGH */
case 0:
break;
}
net->trans_start = jiffies;
netif_wake_queue(net);
}
static void intr_callback(struct urb *urb, struct pt_regs *regs)
{
pegasus_t *pegasus = urb->context;
struct net_device *net;
int status;
if (!pegasus)
return;
net = pegasus->net;
switch (urb->status) {
case 0:
break;
case -ECONNRESET: /* unlink */
case -ENOENT:
case -ESHUTDOWN:
return;
default:
/* some Pegasus-I products report LOTS of data
* toggle errors... avoid log spamming
*/
if (netif_msg_timer(pegasus))
pr_debug("%s: intr status %d\n", net->name,
urb->status);
}
if (urb->actual_length >= 6) {
u8 * d = urb->transfer_buffer;
/* byte 0 == tx_status1, reg 2B */
if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
|LATE_COL|JABBER_TIMEOUT)) {
pegasus->stats.tx_errors++;
if (d[0] & TX_UNDERRUN)
pegasus->stats.tx_fifo_errors++;
if (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT))
pegasus->stats.tx_aborted_errors++;
if (d[0] & LATE_COL)
pegasus->stats.tx_window_errors++;
}
/* d[5].LINK_STATUS lies on some adapters.
* d[0].NO_CARRIER kicks in only with failed TX.
* ... so monitoring with MII may be safest.
*/
if (d[0] & NO_CARRIER)
netif_carrier_off(net);
else
netif_carrier_on(net);
/* bytes 3-4 == rx_lostpkt, reg 2E/2F */
pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
}
status = usb_submit_urb(urb, SLAB_ATOMIC);
if (status && netif_msg_timer(pegasus))
printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n",
net->name, status);
}
static void pegasus_tx_timeout(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
if (netif_msg_timer(pegasus))
printk(KERN_WARNING "%s: tx timeout\n", net->name);
usb_unlink_urb(pegasus->tx_urb);
pegasus->stats.tx_errors++;
}
static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
int count = ((skb->len + 2) & 0x3f) ? skb->len + 2 : skb->len + 3;
int res;
__u16 l16 = skb->len;
netif_stop_queue(net);
((__le16 *) pegasus->tx_buff)[0] = cpu_to_le16(l16);
memcpy(pegasus->tx_buff + 2, skb->data, skb->len);
usb_fill_bulk_urb(pegasus->tx_urb, pegasus->usb,
usb_sndbulkpipe(pegasus->usb, 2),
pegasus->tx_buff, count,
write_bulk_callback, pegasus);
if ((res = usb_submit_urb(pegasus->tx_urb, GFP_ATOMIC))) {
if (netif_msg_tx_err(pegasus))
printk(KERN_WARNING "%s: fail tx, %d\n",
net->name, res);
switch (res) {
case -EPIPE: /* stall, or disconnect from TT */
/* cleanup should already have been scheduled */
break;
case -ENODEV: /* disconnect() upcoming */
break;
default:
pegasus->stats.tx_errors++;
netif_start_queue(net);
}
} else {
pegasus->stats.tx_packets++;
pegasus->stats.tx_bytes += skb->len;
net->trans_start = jiffies;
}
dev_kfree_skb(skb);
return 0;
}
static struct net_device_stats *<API key>(struct net_device *dev)
{
return &((pegasus_t *) netdev_priv(dev))->stats;
}
static inline void disable_net_traffic(pegasus_t * pegasus)
{
int tmp = 0;
int ret;
ret = set_registers(pegasus, EthCtrl0, 2, &tmp);
}
static inline void <API key>(pegasus_t * pegasus)
{
__u8 data[2];
read_eprom_word(pegasus, 4, (__u16 *) data);
if (pegasus->usb->speed != USB_SPEED_HIGH) {
if (data[1] < 0x80) {
if (netif_msg_timer(pegasus))
dev_info(&pegasus->intf->dev, "intr interval "
"changed from %ums to %ums\n",
data[1], 0x80);
data[1] = 0x80;
#ifdef <API key>
write_eprom_word(pegasus, 4, *(__u16 *) data);
#endif
}
}
pegasus->intr_interval = data[1];
}
static void set_carrier(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
u16 tmp;
if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
return;
if (tmp & BMSR_LSTATUS)
netif_carrier_on(net);
else
netif_carrier_off(net);
}
static void free_all_urbs(pegasus_t * pegasus)
{
usb_free_urb(pegasus->intr_urb);
usb_free_urb(pegasus->tx_urb);
usb_free_urb(pegasus->rx_urb);
usb_free_urb(pegasus->ctrl_urb);
}
static void unlink_all_urbs(pegasus_t * pegasus)
{
usb_kill_urb(pegasus->intr_urb);
usb_kill_urb(pegasus->tx_urb);
usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->ctrl_urb);
}
static int alloc_urbs(pegasus_t * pegasus)
{
pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->ctrl_urb) {
return 0;
}
pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->rx_urb) {
usb_free_urb(pegasus->ctrl_urb);
return 0;
}
pegasus->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->tx_urb) {
usb_free_urb(pegasus->rx_urb);
usb_free_urb(pegasus->ctrl_urb);
return 0;
}
pegasus->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->intr_urb) {
usb_free_urb(pegasus->tx_urb);
usb_free_urb(pegasus->rx_urb);
usb_free_urb(pegasus->ctrl_urb);
return 0;
}
return 1;
}
static int pegasus_open(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
int res;
if (pegasus->rx_skb == NULL)
pegasus->rx_skb = pull_skb(pegasus);
/*
** Note: no point to free the pool. it is empty :-)
*/
if (!pegasus->rx_skb)
return -ENOMEM;
res = set_registers(pegasus, EthID, 6, net->dev_addr);
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
if (netif_msg_ifup(pegasus))
pr_debug("%s: failed rx_urb, %d", net->name, res);
goto exit;
}
usb_fill_int_urb(pegasus->intr_urb, pegasus->usb,
usb_rcvintpipe(pegasus->usb, 3),
pegasus->intr_buff, sizeof (pegasus->intr_buff),
intr_callback, pegasus, pegasus->intr_interval);
if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) {
if (netif_msg_ifup(pegasus))
pr_debug("%s: failed intr_urb, %d\n", net->name, res);
usb_kill_urb(pegasus->rx_urb);
goto exit;
}
if ((res = enable_net_traffic(net, pegasus->usb))) {
if (netif_msg_ifup(pegasus))
pr_debug("%s: can't enable_net_traffic() - %d\n",
net->name, res);
res = -EIO;
usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->intr_urb);
free_skb_pool(pegasus);
goto exit;
}
set_carrier(net);
netif_start_queue(net);
if (netif_msg_ifup(pegasus))
pr_debug("%s: open\n", net->name);
res = 0;
exit:
return res;
}
static int pegasus_close(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
netif_stop_queue(net);
if (!(pegasus->flags & PEGASUS_UNPLUG))
disable_net_traffic(pegasus);
tasklet_kill(&pegasus->rx_tl);
unlink_all_urbs(pegasus);
return 0;
}
static void pegasus_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
pegasus_t *pegasus = netdev_priv(dev);
strncpy(info->driver, driver_name, sizeof (info->driver) - 1);
strncpy(info->version, DRIVER_VERSION, sizeof (info->version) - 1);
usb_make_path(pegasus->usb, info->bus_info, sizeof (info->bus_info));
}
/* also handles three patterns of some kind in hardware */
#define WOL_SUPPORTED (WAKE_MAGIC|WAKE_PHY)
static void
pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
pegasus_t *pegasus = netdev_priv(dev);
wol->supported = WAKE_MAGIC | WAKE_PHY;
wol->wolopts = pegasus->wolopts;
}
static int
pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
pegasus_t *pegasus = netdev_priv(dev);
u8 reg78 = 0x04;
if (wol->wolopts & ~WOL_SUPPORTED)
return -EINVAL;
if (wol->wolopts & WAKE_MAGIC)
reg78 |= 0x80;
if (wol->wolopts & WAKE_PHY)
reg78 |= 0x40;
/* FIXME this 0x10 bit still needs to get set in the chip... */
if (wol->wolopts)
pegasus->eth_regs[0] |= 0x10;
else
pegasus->eth_regs[0] &= ~0x10;
pegasus->wolopts = wol->wolopts;
return set_register(pegasus, WakeupControl, reg78);
}
static inline void pegasus_reset_wol(struct net_device *dev)
{
struct ethtool_wolinfo wol;
memset(&wol, 0, sizeof wol);
(void) pegasus_set_wol(dev, &wol);
}
static int
<API key>(struct net_device *dev, struct ethtool_cmd *ecmd)
{
pegasus_t *pegasus;
if (in_atomic())
return 0;
pegasus = netdev_priv(dev);
mii_ethtool_gset(&pegasus->mii, ecmd);
return 0;
}
static int
<API key>(struct net_device *dev, struct ethtool_cmd *ecmd)
{
pegasus_t *pegasus = netdev_priv(dev);
return mii_ethtool_sset(&pegasus->mii, ecmd);
}
static int pegasus_nway_reset(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
return mii_nway_restart(&pegasus->mii);
}
static u32 pegasus_get_link(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
return mii_link_ok(&pegasus->mii);
}
static u32 <API key>(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
return pegasus->msg_enable;
}
static void <API key>(struct net_device *dev, u32 v)
{
pegasus_t *pegasus = netdev_priv(dev);
pegasus->msg_enable = v;
}
static struct ethtool_ops ops = {
.get_drvinfo = pegasus_get_drvinfo,
.get_settings = <API key>,
.set_settings = <API key>,
.nway_reset = pegasus_nway_reset,
.get_link = pegasus_get_link,
.get_msglevel = <API key>,
.set_msglevel = <API key>,
.get_wol = pegasus_get_wol,
.set_wol = pegasus_set_wol,
};
static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
{
__u16 *data = (__u16 *) & rq->ifr_ifru;
pegasus_t *pegasus = netdev_priv(net);
int res;
switch (cmd) {
case SIOCDEVPRIVATE:
data[0] = pegasus->phy;
case SIOCDEVPRIVATE + 1:
read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]);
res = 0;
break;
case SIOCDEVPRIVATE + 2:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
write_mii_word(pegasus, pegasus->phy, data[1] & 0x1f, data[2]);
res = 0;
break;
default:
res = -EOPNOTSUPP;
}
return res;
}
static void <API key>(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
if (net->flags & IFF_PROMISC) {
pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
if (netif_msg_link(pegasus))
pr_info("%s: Promiscuous mode enabled.\n", net->name);
} else if (net->mc_count ||
(net->flags & IFF_ALLMULTI)) {
pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
if (netif_msg_link(pegasus))
pr_info("%s: set allmulti\n", net->name);
} else {
pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
}
pegasus->flags |= ETH_REGS_CHANGE;
ctrl_callback(pegasus->ctrl_urb, NULL);
}
static __u8 mii_phy_probe(pegasus_t * pegasus)
{
int i;
__u16 tmp;
for (i = 0; i < 32; i++) {
read_mii_word(pegasus, i, MII_BMSR, &tmp);
if (tmp == 0 || tmp == 0xffff || (tmp & BMSR_MEDIA) == 0)
continue;
else
return i;
}
return 0xff;
}
static inline void setup_pegasus_II(pegasus_t * pegasus)
{
__u8 data = 0xa5;
int ret;
ret = set_register(pegasus, Reg1d, 0);
ret = set_register(pegasus, Reg7b, 1);
mdelay(100);
if ((pegasus->features & HAS_HOME_PNA) && mii_mode)
ret = set_register(pegasus, Reg7b, 0);
else
ret = set_register(pegasus, Reg7b, 2);
ret = set_register(pegasus, 0x83, data);
ret = get_registers(pegasus, 0x83, 1, &data);
if (data == 0xa5) {
pegasus->chip = 0x8513;
} else {
pegasus->chip = 0;
}
ret = set_register(pegasus, 0x80, 0xc0);
ret = set_register(pegasus, 0x83, 0xff);
ret = set_register(pegasus, 0x84, 0x01);
if (pegasus->features & HAS_HOME_PNA && mii_mode)
ret = set_register(pegasus, Reg81, 6);
else
ret = set_register(pegasus, Reg81, 2);
}
static struct workqueue_struct *pegasus_workqueue = NULL;
#define CARRIER_CHECK_DELAY (2 * HZ)
static void check_carrier(void *data)
{
pegasus_t *pegasus = data;
set_carrier(pegasus->net);
if (!(pegasus->flags & PEGASUS_UNPLUG)) {
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
CARRIER_CHECK_DELAY);
}
}
static int pegasus_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev(intf);
struct net_device *net;
pegasus_t *pegasus;
int dev_index = id - pegasus_ids;
int res = -ENOMEM;
usb_get_dev(dev);
net = alloc_etherdev(sizeof(struct pegasus));
if (!net) {
dev_err(&intf->dev, "can't allocate %s\n", "device");
goto out;
}
pegasus = netdev_priv(net);
memset(pegasus, 0, sizeof (struct pegasus));
pegasus->dev_index = dev_index;
init_waitqueue_head(&pegasus->ctrl_wait);
if (!alloc_urbs(pegasus)) {
dev_err(&intf->dev, "can't allocate %s\n", "urbs");
goto out1;
}
tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long) pegasus);
INIT_WORK(&pegasus->carrier_check, check_carrier, pegasus);
pegasus->intf = intf;
pegasus->usb = dev;
pegasus->net = net;
SET_MODULE_OWNER(net);
net->open = pegasus_open;
net->stop = pegasus_close;
net->watchdog_timeo = PEGASUS_TX_TIMEOUT;
net->tx_timeout = pegasus_tx_timeout;
net->do_ioctl = pegasus_ioctl;
net->hard_start_xmit = pegasus_start_xmit;
net->set_multicast_list = <API key>;
net->get_stats = <API key>;
SET_ETHTOOL_OPS(net, &ops);
pegasus->mii.dev = net;
pegasus->mii.mdio_read = mdio_read;
pegasus->mii.mdio_write = mdio_write;
pegasus->mii.phy_id_mask = 0x1f;
pegasus->mii.reg_num_mask = 0x1f;
spin_lock_init(&pegasus->rx_pool_lock);
pegasus->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
| NETIF_MSG_PROBE | NETIF_MSG_LINK);
pegasus->features = usb_dev_id[dev_index].private;
<API key>(pegasus);
if (reset_mac(pegasus)) {
dev_err(&intf->dev, "can't reset MAC\n");
res = -EIO;
goto out2;
}
set_ethernet_addr(pegasus);
fill_skb_pool(pegasus);
if (pegasus->features & PEGASUS_II) {
dev_info(&intf->dev, "setup Pegasus II specific registers\n");
setup_pegasus_II(pegasus);
}
pegasus->phy = mii_phy_probe(pegasus);
if (pegasus->phy == 0xff) {
dev_warn(&intf->dev, "can't locate MII phy, using default\n");
pegasus->phy = 1;
}
pegasus->mii.phy_id = pegasus->phy;
usb_set_intfdata(intf, pegasus);
SET_NETDEV_DEV(net, &intf->dev);
pegasus_reset_wol(net);
res = register_netdev(net);
if (res)
goto out3;
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
CARRIER_CHECK_DELAY);
dev_info(&intf->dev, "%s, %s, %02x:%02x:%02x:%02x:%02x:%02x\n",
net->name,
usb_dev_id[dev_index].name,
net->dev_addr [0], net->dev_addr [1],
net->dev_addr [2], net->dev_addr [3],
net->dev_addr [4], net->dev_addr [5]);
return 0;
out3:
usb_set_intfdata(intf, NULL);
free_skb_pool(pegasus);
out2:
free_all_urbs(pegasus);
out1:
free_netdev(net);
out:
usb_put_dev(dev);
return res;
}
static void pegasus_disconnect(struct usb_interface *intf)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
if (!pegasus) {
dev_dbg(&intf->dev, "unregistering non-bound device?\n");
return;
}
pegasus->flags |= PEGASUS_UNPLUG;
cancel_delayed_work(&pegasus->carrier_check);
unregister_netdev(pegasus->net);
usb_put_dev(interface_to_usbdev(intf));
unlink_all_urbs(pegasus);
free_all_urbs(pegasus);
free_skb_pool(pegasus);
if (pegasus->rx_skb)
dev_kfree_skb(pegasus->rx_skb);
free_netdev(pegasus->net);
}
static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_detach (pegasus->net);
if (netif_running(pegasus->net)) {
cancel_delayed_work(&pegasus->carrier_check);
usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->intr_urb);
}
intf->dev.power.power_state = PMSG_SUSPEND;
return 0;
}
static int pegasus_resume (struct usb_interface *intf)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
intf->dev.power.power_state = PMSG_ON;
netif_device_attach (pegasus->net);
if (netif_running(pegasus->net)) {
pegasus->rx_urb->status = 0;
pegasus->rx_urb->actual_length = 0;
read_bulk_callback(pegasus->rx_urb, NULL);
pegasus->intr_urb->status = 0;
pegasus->intr_urb->actual_length = 0;
intr_callback(pegasus->intr_urb, NULL);
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
CARRIER_CHECK_DELAY);
}
return 0;
}
static struct usb_driver pegasus_driver = {
.name = driver_name,
.probe = pegasus_probe,
.disconnect = pegasus_disconnect,
.id_table = pegasus_ids,
.suspend = pegasus_suspend,
.resume = pegasus_resume,
};
static int __init pegasus_init(void)
{
pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION);
pegasus_workqueue = <API key>("pegasus");
if (!pegasus_workqueue)
return -ENOMEM;
return usb_register(&pegasus_driver);
}
static void __exit pegasus_exit(void)
{
destroy_workqueue(pegasus_workqueue);
usb_deregister(&pegasus_driver);
}
module_init(pegasus_init);
module_exit(pegasus_exit);
|
# filepp is free software; you can redistribute it and/or modify
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# Project : File Pre Processor - cpp module
# Filename : $RCSfile: Makefile.in,v $
# Maintainer : Darren Miller: darren@cabaret.demon.co.uk
# File version : $Revision: 1.3 $
# Description : Makefile for cpp module
# Licence : GNU copyleft
# Paths
srcdir = .
datarootdir = ${prefix}/share
moduledir = /usr/local/share/filepp/modules
# top level of test build directory
TESTBUILD = ../../testbuild
TESTFILEPP = $(TESTBUILD)/bin/filepp
ECHO=echo
DIFF=diff
RM=rm -fr
INSTALL=/usr/bin/install -c
test:
@$(ECHO)
$(TESTFILEPP) -m cpp.pm $(srcdir)/test.in -o test.out
$(DIFF) $(srcdir)/test.good test.out
@$(ECHO)
install:
$(INSTALL) -m 644 $(srcdir)/cpp.pm $(moduledir)
clean:
$(RM) test.out
distclean:
$(RM) Makefile
# End of file
|
# Gramps - a GTK+/GNOME based genealogy program
# This program is free software; you can redistribute it and/or modify
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Python classes
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
# GTK classes
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Pango
_TAB = Gdk.keyval_from_name("Tab")
_ENTER = Gdk.keyval_from_name("Enter")
# Gramps classes
from .surnamemodel import SurnameModel
from .embeddedlist import EmbeddedList, TEXT_EDIT_COL
from ...ddtargets import DdTargets
from gramps.gen.lib import Surname, NameOriginType
from ...utils import match_primary_mask, <API key>
INVISIBLE = dict.fromkeys(list(range(32)))
# SurnameTab
class SurnameTab(EmbeddedList):
_HANDLE_COL = 5
_DND_TYPE = DdTargets.SURNAME
_MSG = {
'add' : _('Create and add a new surname'),
'del' : _('Remove the selected surname'),
'edit' : _('Edit the selected surname'),
'up' : _('Move the selected surname upwards'),
'down' : _('Move the selected surname downwards'),
}
#index = column in model. Value =
# (name, sortcol in model, width, markup/text
_column_names = [
(_('Prefix'), 0, 150, TEXT_EDIT_COL, -1, None),
(_('Surname'), 1, -1, TEXT_EDIT_COL, -1, None),
(_('Connector'), 2, 100, TEXT_EDIT_COL, -1, None),
]
_column_combo = (_('Origin'), -1, 150, 3) # name, sort, width, modelcol
_column_toggle = (_('Primary', 'Name'), -1, 80, 4)
def __init__(self, dbstate, uistate, track, name, on_change=None,
top_label='<b>%s</b>' % _("Multiple Surnames") ):
self.obj = name
self.on_change = on_change
self.curr_col = -1
self.curr_cellr = None
self.curr_celle = None
EmbeddedList.__init__(self, dbstate, uistate, track, _('Family Surnames'),
SurnameModel, move_buttons=True,
top_label=top_label)
def build_columns(self):
#first the standard text columns with normal method
EmbeddedList.build_columns(self)
# now we add the two special columns
# combobox for type
colno = len(self.columns)
name = self._column_combo[0]
renderer = Gtk.CellRendererCombo()
renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
# set up the comboentry editable
no = NameOriginType()
self.cmborig = Gtk.ListStore(GObject.TYPE_INT, GObject.TYPE_STRING)
self.cmborigmap = no.get_map().copy()
#sort the keys based on the value
keys = sorted(self.cmborigmap, key=lambda x: glocale.sort_key(self.cmborigmap[x]))
for key in keys:
if key != no.get_custom():
self.cmborig.append(row=[key, self.cmborigmap[key]])
additional = self.dbstate.db.get_origin_types()
if additional:
for type in additional:
if type:
self.cmborig.append(row=[no.get_custom(), type])
renderer.set_property("model", self.cmborig)
renderer.set_property("text-column", 1)
renderer.set_property('editable', not self.dbstate.db.readonly)
renderer.connect('editing_started', self.on_edit_start_cmb, colno)
renderer.connect('edited', self.on_orig_edited, self._column_combo[3])
# add to treeview
column = Gtk.TreeViewColumn(name, renderer, text=self._column_combo[3])
column.set_resizable(True)
column.set_sort_column_id(self._column_combo[1])
column.set_min_width(self._column_combo[2])
column.set_expand(False)
self.columns.append(column)
self.tree.append_column(column)
# toggle box for primary
colno += 1
name = self._column_toggle[0]
renderer = Gtk.CellRendererToggle()
renderer.set_property('activatable', True)
renderer.set_property('radio', True)
renderer.connect( 'toggled', self.on_prim_toggled, self._column_toggle[3])
# add to treeview
column = Gtk.TreeViewColumn(name, renderer, active=self._column_toggle[3])
column.set_resizable(False)
column.set_sizing(Gtk.<API key>.FIXED)
column.set_alignment(0.5)
column.set_sort_column_id(self._column_toggle[1])
column.set_max_width(self._column_toggle[2])
self.columns.append(column)
self.tree.append_column(column)
## def by_value(self, first, second):
## """
## Method for sorting keys based on the values.
## """
## fvalue = self.cmborigmap[first]
## svalue = self.cmborigmap[second]
## return glocale.strcoll(fvalue, svalue)
def setup_editable_col(self):
"""
inherit this and set the variables needed for editable columns
Variable edit_col_funcs needs to be a dictionary from model col_nr to
function to call for
Example:
self.edit_col_funcs ={1: {'edit_start': self.on_edit_start,
'edited': self.on_edited
}}
"""
self.edit_col_funcs = {
0: {'edit_start': self.on_edit_start,
'edited': self.on_edit_inline},
1: {'edit_start': self.on_edit_start,
'edited': self.on_edit_inline},
2: {'edit_start': self.on_edit_start,
'edited': self.on_edit_inline}}
def get_data(self):
return self.obj.get_surname_list()
def is_empty(self):
return len(self.model)==0
def <API key>(self):
"""
Return new surname_list for storing in the name based on content of
the model
"""
new_list = []
for idx in range(len(self.model)):
node = self.model.get_iter(idx)
surn = self.model.get_value(node, 5)
surn.set_prefix(self.model.get_value(node, 0))
surn.set_surname(self.model.get_value(node, 1))
surn.set_connector(self.model.get_value(node, 2))
surn.get_origintype().set(self.model.get_value(node, 3))
surn.set_primary(self.model.get_value(node, 4))
new_list += [surn]
return new_list
def update(self):
"""
Store the present data in the model to the name object
"""
new_map = self.<API key>()
self.obj.set_surname_list(new_map)
# update name in previews
if self.on_change:
self.on_change()
def post_rebuild(self, prebuildpath):
"""
Called when data model has changed, in particular necessary when row
order is updated.
@param prebuildpath: path selected before rebuild, None if none
@type prebuildpath: tree path
"""
if self.on_change:
self.on_change()
def column_order(self):
# order of columns for EmbeddedList. Only the text columns here
return ((1, 0), (1, 1), (1, 2))
def add_button_clicked(self, obj):
"""Add button is clicked, add a surname to the person"""
prim = False
if len(self.obj.get_surname_list()) == 0:
prim = True
node = self.model.append(row=['', '', '', str(NameOriginType()), prim,
Surname()])
self.selection.select_iter(node)
path = self.model.get_path(node)
self.tree.set_cursor_on_cell(path,
focus_column=self.columns[0],
focus_cell=None,
start_editing=True)
self.update()
def del_button_clicked(self, obj):
"""
Delete button is clicked. Remove from the model
"""
(model, node) = self.selection.get_selected()
if node:
self.model.remove(node)
self.update()
def on_edit_start(self, cellr, celle, path, colnr):
""" start of editing. Store stuff so we know when editing ends where we
are
"""
self.curr_col = colnr
self.curr_cellr = cellr
self.curr_celle = celle
def on_edit_start_cmb(self, cellr, celle, path, colnr):
"""
An edit starts in the origin type column
This means a cmb has been created as celle, and we can set up the stuff
we want this cmb to contain: autocompletion, stop edit when selection
in the cmb happens.
"""
self.on_edit_start(cellr, celle, path, colnr)
#set up autocomplete
entry = celle.get_child()
entry.set_width_chars(10)
completion = Gtk.EntryCompletion()
completion.set_model(self.cmborig)
completion.<API key>(1)
completion.set_text_column(1)
entry.set_completion(completion)
celle.connect('changed', self.on_origcmb_change, path, colnr)
def <API key>(self, cellr, celle, path, colnr):
"""
Edit
"""
self.on_edit_start(cellr, celle, path, colnr)
def on_edit_inline(self, cell, path, new_text, colnr):
"""
Edit is happening. The model is updated and the surname objects updated.
colnr must be the column in the model.
"""
node = self.model.get_iter(path)
text = new_text.translate(INVISIBLE).strip()
self.model.set_value(node, colnr, text)
self.update()
def on_orig_edited(self, cellr, path, new_text, colnr):
"""
An edit is finished in the origin type column. For a cmb in an editor,
the model may only be updated when typing is finished, as editing stops
automatically on update of the model.
colnr must be the column in the model.
"""
self.on_edit_inline(cellr, path, new_text, colnr)
def on_origcmb_change(self, cmb, path, colnr):
"""
A selection occured in the cmb of the origin type column. colnr must
be the column in the model.
"""
act = cmb.get_active()
if act == -1:
return
self.on_orig_edited(None, path,
self.cmborig.get_value(
self.cmborig.get_iter((act,)),1),
colnr)
def on_prim_toggled(self, cell, path, colnr):
"""
Primary surname on path is toggled. colnr must be the col
in the model
"""
#obtain current value
node = self.model.get_iter(path)
old_val = self.model.get_value(node, colnr)
for nr in range(len(self.obj.get_surname_list())):
if nr == int(path[0]):
if old_val:
#True remains True
break
else:
#This value becomes True
self.model.set_value(self.model.get_iter((nr,)), colnr, True)
else:
self.model.set_value(self.model.get_iter((nr,)), colnr, False)
self.update()
return
def edit_button_clicked(self, obj):
""" Edit button clicked
"""
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node)
self.tree.set_cursor_on_cell(path,
focus_column=self.columns[0],
focus_cell=None,
start_editing=True)
def key_pressed(self, obj, event):
"""
Handles the key being pressed.
Here we make sure tab moves to next or previous value in row on TAB
"""
if not EmbeddedList.key_pressed(self, obj, event):
if event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_TAB,):
if <API key>(event.get_state(),
Gdk.ModifierType.SHIFT_MASK):
return self.next_cell()
elif match_primary_mask(event.get_state(), Gdk.ModifierType.SHIFT_MASK):
return self.prev_cell()
else:
return
else:
return
return True
def next_cell(self):
"""
Move to the next cell to edit it
"""
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node).get_indices()[0]
nccol = self.curr_col+1
if nccol < 4:
if self.curr_celle:
self.curr_celle.editing_done()
self.tree.set_cursor_on_cell(Gtk.TreePath((path,)),
focus_column=self.columns[nccol],
focus_cell=None,
start_editing=True)
elif nccol == 4:
#go to next line if there is one
if path < len(self.obj.get_surname_list()):
newpath = Gtk.TreePath((path+1,))
self.curr_celle.editing_done()
self.selection.select_path(newpath)
self.tree.set_cursor_on_cell(newpath,
focus_column=self.columns[0],
focus_cell=None,
start_editing=True)
else:
#stop editing
self.curr_celle.editing_done()
return
return True
def prev_cell(self):
"""
Move to the next cell to edit it
"""
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node).get_indices()[0]
if self.curr_col > 0:
self.tree.set_cursor_on_cell(Gtk.TreePath((path,)),
focus_column=self.columns[self.curr_col-1],
focus_cell=None,
start_editing=True)
elif self.curr_col == 0:
#go to prev line if there is one
if path > 0:
newpath = Gtk.TreePath((path-1,))
self.selection.select_path(newpath)
self.tree.set_cursor_on_cell(newpath,
focus_column=self.columns[-2],
focus_cell=None,
start_editing=True)
else:
#stop editing
self.curr_celle.editing_done()
return
return True
|
function c4896788.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+<API key>)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCondition(c4896788.drcon)
e1:SetOperation(c4896788.drop)
c:RegisterEffect(e1)
end
function c4896788.drcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttackPos()
and re:IsHasType(<API key>) and re:GetHandler():IsCode(55144522)
end
function c4896788.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeTargetParam(ev,3)
end
|
/*
Take the Plunge Wedding Template
Table of Contents:
Reset
Common
Typography
Layout
Supersized Slideshow
Youtube Player
Parallax
Portfolio
About Us
Services
Features
Accordion
Tooltips
Contacts
Form Elements
Flickr
Alert Boxes
Footer
Our Clients
Misc
Media Queries
*/
html, body {
height: 100%;
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
::-moz-selection {background: #af1b5a;color: white; }
::selection {background: #af1b5a;color: white; }
body {
background-color: #fff;
font: 15px 'Oswald', sans-serif;
font-weight: 300;
color: #222;
-<API key>: antialiased;
-<API key>: 100%;
text-align: left;
width: 100%;
height: 100%;
}
.embed-container {
position: relative;
padding-bottom: 56.25%; /* 16/9 ratio */
padding-top: 30px; /* IE6 workaround*/
height: 0;
overflow: hidden;
}
.embed-container iframe,
.embed-container object,
.embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.hidden {
display: none;
}
.parallaxText {
display: table-cell;
vertical-align: middle;
}
img.scale-with-grid {
max-width: 100%;
height: auto; }
h1, h2, h3, h4 {
font-weight: 300;
font-family: 'Oswald',sans-serif;
color: #222;
margin: 0 0 6px;
}
h1 {
font-size: 250px;
text-transform: uppercase;
position: relative;
letter-spacing: -2px;
text-align: left;
line-height: 0.8;
margin-bottom: 35px;
padding-top: 15px;
}
h1 span{
color: #7b133c;
font-size: 150px;
}
h2 {
font-size: 44px;
text-transform: uppercase;
position: relative;
}
h2.white { color: #222;}
h3 {font-size: 22px; line-height: 1; color: #555;}
h3.sectionTitle {
border-bottom: 1px solid #cacaca;
font-size: 28px;
line-height: 30px;
margin-bottom: 10px;
padding: 26px 0 6px;
}
.small {font-size: 36px; font-weight:300;}
.smallBold {font-size: 36px; font-weight:700;}
.medium {font-size: 44px; text-transform: uppercase;}
.mediumBold {font-size: 44px; font-weight:700; text-transform: uppercase;}
.large {font-size: 56px; text-transform: uppercase;}
.largeBold {font-size: 56px; font-weight:700; text-transform: uppercase;}
.author {font-size: 18px; font-weight:300;}
h4 {font-size: 22px;}
p {margin-bottom: 10px;}
p a {color: #222; text-decoration: none;}
p a:hover {color: #a90e4b;transition: color 0.5s;}
a {color:#222;text-decoration:none;}
a:hover{color:#a90e4b;}
.introtext {font-size: 20px;}
.marginTop {
margin-top: 30px;
}
.highlight {
background: #7b133c;
color: #FFFFFF;
padding: 0 6px;
}
.dropcap {
background: #7b133c;
color: #FFFFFF;
display: inline-block;
float: left;
font-size: 30px;
font-weight: bold;
height: 44px;
line-height: 44px;
margin: 7px 7px 0 0;
text-align: center;
width: 44px;
}
blockquote {
color: #999999;
display: block;
font-size: 20px;
font-style: italic;
letter-spacing: 0;
padding: 20px 50px 20px 40px;
position: relative;
}
blockquote:before, blockquote:after {
color: #7B133C;
content: "“";
font-size: 80px;
font-style: italic;
left: -25px;
line-height: 1em;
position: absolute;
top: 0;
}
blockquote:after {
content: "”";
float: right;
margin-right: -30px;
margin-top: 0;
position: relative;
}
.homepage{
position:relative;
overflow:hidden;
z-index:1;
margin-bottom: -70px;
}
.page{
position:relative;
overflow:hidden;
z-index:2;
}
.page.desktop{
position:relative !important;
z-index:6;
}
.page {
padding-top: 100px;
}
.page{
background:#fff;
<API key>:scroll;
}
nav {
background: #000;
background: rgba(0,0,0,0.8);
width: 100%;
position: relative;
z-index: 1000;
height: 50px;
text-align: center;
margin-bottom: 10px;
}
nav ul {
height: 40px;
display: inline-block;
padding-top: 10px;
padding-bottom: 15px;
}
nav ul li {
position: relative;
float: left;
margin: 0;
}
nav ul li a {
font-family: 'Oswald',sans-serif;
font-size: 18px;
font-weight: 400;
color: white;
text-decoration: none;
text-transform: uppercase;
padding: 10px;
}
nav ul li a:hover {
color: #a90e4b;
transition: color 0.5s;
}
.dropmenu {
display: none;
}
#homepage .container {
height: 100%;
}
.logo {
float: right;
margin-top: 50px;
}
.slider-text {
width: 100%;
}
.slider-text {
bottom: 0px;
min-height: 220px;
overflow: hidden;
position: absolute;
}
#prevslide, #nextslide{
position:absolute;
height:40px;
width:40px;
top:64px;
margin-top:-21px;
opacity:0.8;
font-size: 32px;
color: #fff;
background: #000;
display: block;
text-align: center;
}
#prevslide{
right:60px;
}
#nextslide{
right:10px;
}
#prevslide:active, #nextslide:active{
margin-top:-19px;
}
#prevslide:hover, #nextslide:hover{
cursor:pointer;
}
#slidecaption h2, #slidecaption p{
text-shadow: 0 0 5px #000;
font-weight: 700;
font-size: 48px;
color: #fff
}
#slidecaption h2 span{
font-family: 'Shadows Into Light', cursive;
text-transform: capitalize;
font-size: 72px;
font-weight: 400;
}
#supersized-loader { position:absolute; top:50%; left:50%; z-index:0; width:60px; height:60px; margin:-30px 0 0 -30px; text-indent:-999em; background:url(../images/progress.gif) no-repeat center center;}
#supersized { display:block; position:absolute; left:0; top:0; overflow:hidden; z-index:-999; height:100%; width:100%; }
#supersized img { width:auto; height:auto; position:relative; display:none; outline:none; border:none; }
#supersized.speed img { -<API key>:nearest-neighbor; image-rendering: -moz-crisp-edges; } /*Speed*/
#supersized.quality img { -<API key>:bicubic; image-rendering: optimizeQuality; } /*Quality*/
#supersized li { display:block; list-style:none; z-index:-30; position:absolute; overflow:hidden; top:0; left:0; width:100%; height:100%; background:#111; }
#supersized a { width:100%; height:100%; display:block; }
#supersized li.prevslide { z-index:-20; }
#supersized li.activeslide { z-index:-10; }
#supersized li.image-loading { background:#111 url(../images/progress.gif) no-repeat center center; width:100%; height:100%; }
#supersized li.image-loading img{ visibility:hidden; }
#supersized li.prevslide img, #supersized li.activeslide img{ display:inline; }
.parallax{
width:100%;
height:480px;
padding:0;
margin:0;
<API key>:fixed;
background-repeat:no-repeat;
border-top:10px solid rgba(255,255,255,0.3);
border-bottom:10px solid rgba(255,255,255,0.3);
color:#fff;
position:relative;
}
.parallax .quoteWrap{
display:table;
width:100%;
height:100%;
padding:0 !important;
margin:0 !important;
}
.parallax.fixed{
<API key>:fixed;
}
.parallax.fixed-desktop{
<API key>:fixed !important;
}
.parallax .quoteWrap .quote{
display: table-cell;
vertical-align:middle;
}
.parallax {
text-align:center;
}
.parallax h3 span{
text-shadow: 0px 0px 5px #222;
color: #fff;
}
#folio {
background:url(../images/gallery-quote-white.png) center 80px no-repeat #fff;
padding-top:100px;
clear: left;
}
.portfolio_container {
position:relative;
display:block;
overflow:hidden;
width:100%;
}
.portfolio_container .portfolio {
position:relative;
display:block;
float:left;
overflow:hidden;
width:25%;
height:auto;
}
.portfolio_container .portfolio .media_box figure a img {
display:block;
margin-left: auto;
margin-right: auto;
}
.portfolio_container .portfolio .media_box .hover_effect {
top:0;
left:0;
}
.gallerySelector {
background: #E5E5E5;
height: 44px;
width: 100%;
margin-top: 20px;
}
.gallerySelectorList {
margin:0;
width: 100%;
}
.gallerySelectorList li {
float: left;
margin:0;
list-style:none;
width: 20%;
text-align: center;
padding: 0;
}
.gallerySelectorList li:hover {
background: #83103e;
}
.gallerySelectorList li:hover a {
color: #fff;
}
.gallerySelectorList li a {
display:block;
padding:11px 0;
color: #222;
text-decoration: none;
margin: 0;
transition:background-color 0.3s ease, color 0.2s ease;
}
.gallerySelectorList li.current {
background: #7b133c;
}
.gallerySelectorList li.current a {
color: #fff;
}
.portfolio_container .portfolio {
width: 20%;
}
.fullwidth {
display: block;
max-width: 100%;
min-width: 100%;
}
#gallery h3 {
margin-bottom: 20px;
}
.project-title {
font-family: 'Oswald', sans-serif;
font-size: 12px;
text-transform: uppercase;
margin-top: 7px;
}
.project-description {
color: #868991;
font-size: 10px;
text-transform: uppercase;
font-weight: 600;
margin: 0 0 20px 0;
}
.thumbLink {
display: block;
width: 100%;
}
.thumbImage {
float: left;
position: relative;
overflow: hidden;
display: block;
margin-bottom: 0px;
box-sizing: border-box;
text-align: center;
width: 100%;
height: 100%;
}
.thumbImage img{
transition: all 0.7s ease-in-out;
}
.thumbImage .thumbText h3 {
margin-bottom: 10px;
padding-top: 10px;
color: #fff;
border-bottom: 1px solid #fff;
transition: all 1s ease-in-out;
}
.thumbImage .thumbText p {
margin-bottom: 10px;
color: #fff;
transition: all 1s ease-in-out;
}
.thumbImage .thumbTextWrap {
position: absolute;
top: 0;
height: 100%;
opacity: 0;
max-width: 100%;
min-width: 100%;
background: #7b133c;
text-align: center;
transition: all 1s ease-in-out;
-webkit-user-select: none;
}
.ie8 .thumbImage .thumbTextWrap {
display:none;
}
.thumbImage .thumbTextWrap:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.5em; /* Adjusts for spacing */
}
.thumbText {
text-align: center;
transform: scale(0);
transition: all 0.7s ease-in-out;
display: inline-block;
vertical-align: middle;
width: 90%;
}
.thumbImage:hover img {
opacity: 0;
transform: scale(10);
}
.touch-device .thumbImage:hover img {
transform: none;
}
.thumbImage:hover .thumbTextWrap {
opacity: 1;
}
.ie8 .thumbImage:hover .thumbTextWrap {
display: block;
}
.thumbImage:hover .thumbText {
transform: scale(1);
}
.touch-device .thumbImage:hover .thumbTextWrap {
display: block;
}
.touch-device .thumbText,
.touch-device .thumbImage img,
.touch-device .thumbImage .thumbText h3,
.touch-device .thumbImage .thumbText p,
.touch-device .thumbImage .thumbTextWrap {
transition: none;
}
.ie8 .thumbImage:hover .thumbTextWrap {
display: block;
}
.thumbLink {
background:#fff;
color: #7A133C;
font-size: 20px;
width: 30px;
height: 30px;
border-radius: 15px;
opacity: 0.5;
margin: 0 auto;
}
.thumbLink:hover {
opacity: 1;
}
.portfolioBottom {
background: #E5E5E5;
height: 44px;
width: 100%;
clear: left;
}
.isotope-item {
z-index: 2;
}
.isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
.isotope,
.isotope .isotope-item {
transition-duration: 0.8s;
}
.isotope {
transition-property: height, width;
}
.isotope .isotope-item {
-<API key>: top, left, opacity;
transition-property: transform, opacity;
}
.isotope.no-transition,
.isotope.no-transition .isotope-item,
.isotope .isotope-item.no-transition {
transition-duration: 0s;
}
/* End: Recommended Isotope styles */
/* disable CSS transitions for containers with infinite scrolling*/
.isotope.infinite-scrolling {
transition: none;
}
#about {
padding-top: 0px;
}
.aboutContainer {
padding-bottom: 100px;
}
.teamImage {
margin-top: 40px;
margin-bottom: 20px;
cursor: default;
overflow: hidden;
position: relative;
text-align: center;
}
.teamImage img {
transform: scale(1);
transition: all 0.7s ease-in-out 0s;
}
.teamImage .teamName {
background-color: #7b133c;
opacity: 0;
transition: all 0.5s linear 0s;
height: 100%;
left: 0;
overflow: hidden;
position: absolute;
top: 0;
width: 100%;
text-align: center;
-webkit-user-select: none;
}
.touch-device .teamImage .teamName {
display: none;
transition: none;
}
.ie8 .teamImage .teamName {
display: none;
}
.teamImage h2 {
margin-top: 145px;
opacity: 0;
transform: scale(0);
color: #fff;
transition: all 0.5s linear 0s;
}
.teamImage h3 {
opacity: 0;
transform: scale(0);
color: #fff;
transition: all 0.7s linear 0s;
}
.teamImage:hover img {
opacity: 0;
transform: scale(10);
}
.teamImage:hover .teamName {
opacity: 1;
}
.touch-device .teamImage:hover .teamName {
display: block;
}
.touch-device .teamImage:hover img {
opacity: 0;
transform: none;
}
.ie8 .teamImage:hover .teamName {
display: block;
}
.teamImage:hover h2, .teamImage:hover h3 {
opacity: 1;
transform: scale(1);
}
.teamImage:hover .socialLinksTeam {
opacity: 1;
transform: scale(1);
}
.socialLinksTeam {
text-align: center;
width: 100%;
opacity: 0;
transform: scale(0);
transition: all 0.8s linear 0s;
}
.socialLinksTeam li {
display: inline-block;
height: 30px;
margin: 35px 1px 0;
transition: all 0.3s ease-in-out 0s;
width: 30px;
}
.socialLinksTeam li a {
color: #FFFFFF;
display: block;
font-size: 16px;
height: 16px;
margin: 0;
transition: all 0.3s ease-in-out 0s;
width: 16px;
opacity: 0.5;
}
.socialLinksTeam li:hover a {
opacity: 1;
}
.teamSkill {
margin-bottom: 40px;
-webkit-user-select: none;
}
p.skill {
clear: left;
font-size: 11px;
letter-spacing: 0.04em;
margin: 0;
text-transform: uppercase;
}
.bar {
background-color: #7B133C;
border-radius: 11px;
color: #FFFFFF;
display: inline-block;
float: left;
height: 22px;
line-height: 22px;
margin: 0 0 2px;
transition: all 0.6s ease-in-out 0s;
width: 22px;
}
.teamSkill:hover .percent100 {width: 100%;}
.teamSkill:hover .percent95 {width: 95%;}
.teamSkill:hover .percent90 {width: 90%;}
.teamSkill:hover .percent85 {width: 85%;}
.teamSkill:hover .percent80 {width: 80%;}
.teamSkill:hover .percent75 {width: 75%;}
.teamSkill:hover .percent70 {width: 70%;}
.teamSkill:hover .percent65 {width: 65%;}
.teamSkill:hover .percent60 {width: 60%;}
.teamSkill:hover .percent55 {width: 55%;}
.teamSkill:hover .percent50 {width: 50%;}
.teamSkill:hover .percent45 {width: 45%;}
.teamSkill:hover .percent40 {width: 40%;}
.teamSkill:hover .percent35 {width: 35%;}
.teamSkill:hover .percent30 {width: 30%;}
.teamSkill:hover .percent25 {width: 25%;}
.teamSkill:hover .percent20 {width: 20%;}
p.percent {
float: right;
margin-right: 6px;
text-align: right;
opacity: 0;
transition: all 0.6s ease-in-out 0s;
}
.ie8 p.percent {
display:none;
}
.teamSkill:hover p.percent {
opacity: 1;
}
.ie8 .teamSkill:hover p.percent {
display:block;
}
.statsWrap {
width: 130px;
margin: 10px;
float: left;
}
.stats {
display: inline-block;
position: relative;
width: 100%;
transition: all 0.3s ease-in-out 0s;
-webkit-user-select: none;
}
.statDummy {
margin-top: 100%;
}
.statInfo {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #7B133C;
border-radius: 50%;
text-align: center;
}
.statNumber {
font-size: 60px;
transition: all 0.5s ease-in-out 0s;
padding-top: 24px;
margin-bottom: 0;
color: #fff;
}
.statNumberMedium {
font-size: 50px;
transition: all 0.5s ease-in-out 0s;
padding-top: 30px;
margin-bottom: 0;
}
.statNumberSmall {
font-size: 36px;
transition: all 0.5s ease-in-out 0s;
padding-top: 38px;
margin-bottom: 0;
}
.statText {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
margin-top: -25px;
color: #fff;
}
.stats:hover {
transform: scale(2);
z-index: 10;
}
.stats:hover .statNumber {
transform: scale(.6);
}
.stats:hover .statText {
transform: scale(.6);
opacity: 1;
}
#services {
padding-top: 0;
}
.servicesContainer {
padding-bottom: 100px;
}
.serviceItem {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
cursor: default;
height: 236px;
position: relative;
width: 236px;
margin: 20px auto;
}
.serviceInfoWrap, .serviceInfo {
height: 196px;
position: absolute;
width: 196px;
}
.serviceInfoWrap {
background: #F9F9F9;
box-shadow: 0 0 0 20px rgba(255,255,255, 0.4), 0 0 3px rgba(115, 114, 23, 0.8) inset;
left: 20px;
top: 20px;
}
.serviceInfo > div {
background-position: center center;
display: block;
height: 100%;
position: absolute;
width: 100%;
text-align: center;
}
.serviceInfo .serviceInfoFront {
transition: all 0.6s ease-in-out 0s;
}
.serviceInfo .serviceInfoBack {
background:#7B133C;
opacity: 0;
pointer-events: none;
transform: scale(1.5);
transition: all 0.4s ease-in-out 0.2s;
-webkit-user-select: none;
}
.ie8 .serviceInfo .serviceInfoBack {
display: none;
}
.copywriting, .copywriting .serviceInfoFront {background-image: url(../images/services/copywriting.jpg);}
.creativity, .creativity .serviceInfoFront {background-image: url(../images/services/creativity.jpg);}
.production, .production .serviceInfoFront {background-image: url(../images/services/production.jpg);}
.development, .development .serviceInfoFront {background-image: url(../images/services/development.jpg);}
.photography, .photography .serviceInfoFront {background-image: url(../images/services/photography.jpg);}
.strategy, .strategy .serviceInfoFront {background-image: url(../images/services/strategy.jpg);}
.serviceInfo h3 {
color: #FFFFFF;
font-size: 18px;
margin: 0 15px;
padding: 0 0 10px;
text-align: center;
text-transform: uppercase;
}
.serviceInfo p {
border-top: 1px solid rgba(255, 255, 255, 0.5);
color: #FFFFFF;
margin: 0 20px;
padding: 5px 10px 0;
}
.serviceIcon {
width: 35px;
height: 35px;
margin: 20px auto 10px auto;
}
.serviceIcon i{
color: #fff;
font-size: 32px;
}
.serviceItem:hover .serviceInfoFront {
opacity: 0;
transform: scale(0);
}
.serviceItem:hover .serviceInfoBack {
opacity: 1;
pointer-events: auto;
transform: scale(1);
}
.ie8 .serviceItem:hover .serviceInfoBack {
display: block;
}
#features {
padding-top: 0px;
}
.featuresContainer {
padding-bottom: 100px;
}
.accTrigger {
cursor: pointer;
display: block;
margin: 10px 0;
background: #e5e5e5;
border-radius: 6px;
border-left: 3px solid #7B133C;
}
.accTrigger a {
display: block;
color: #222;
outline: none;
padding: 10px;
text-decoration: none;
font-size: 24px;
}
.accTrigger.active a {
cursor: default;
color: #9c2252;
}
.accTrigger.active a:hover {
}
.accTrigger a:hover {
color: #9c2252;
}
.accContainer .content{
padding: 2px 15px 5px 15px;
line-height: 19px;
}
.accContent p {
margin-bottom: 10px;
}
.accContent {
padding: 5px 13px 20px 13px;
}
.tooltip {
position: absolute;
z-index: 1020;
display: block;
padding: 5px;
font-size: 12px;
opacity: 0;
filter: alpha(opacity=0);
visibility: visible;
}
.tooltip.in {
opacity: 0.8;
filter: alpha(opacity=80);
}
.tooltip.top {
margin-top: -2px;
}
.tooltip.right {
margin-left: 2px;
}
.tooltip.bottom {
margin-top: 2px;
}
.tooltip.left {
margin-left: -2px;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-top: 5px solid #555;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid #555;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-right: 5px solid transparent;
border-bottom: 5px solid #555;
border-left: 5px solid transparent;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-top: 5px solid transparent;
border-right: 5px solid #555;
border-bottom: 5px solid transparent;
}
.tooltip-inner {
max-width: 200px;
padding: 4px 10px;
color: #222;
text-align: center;
text-decoration: none;
background-color: #555;
border-radius: 6px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
}
.contactContainer {
padding-bottom: 100px;
}
.contactDetails li span {
padding-right: 5px;
color: #555;
font-size: 12px;
}
.icon-spacer {
padding-left: 12px;
}
.socialLinks {
text-align: center;
}
.socialLinks li {
background-color: #7B133C;
border-radius: 50% 50% 50% 50%;
float: left;
height: 60px;
margin: 10px 5px;
transition: all 0.6s ease-in-out 0s;
width: 60px;
}
.socialLinks li a {
display: block;
}
.socialLinks li a i {
color: #FFFFFF;
display: block;
font-size: 32px;
height: 30px;
margin: 15px 0 0 15px;
width: 30px;
}
.socialLinks li:hover {
background-color: #8A97A6;
}
textarea {
height:156px;
padding:20px;
margin-bottom:20px;
overflow:auto;
}
.formSecWrap {
float: left;
margin-right: 20px;
}
.formSecWrap2 {
margin-right: 0px;
}
input[type="text"], input[type="password"], input[type="email"], textarea, select {
background: #e5e5e5;
border: none;
border-radius: 3px;
color: #222;
display: block;
margin: 0 0 10px 0;
outline: medium none;
padding: 4px 4px;
width: 370px;
font-family:'Oswald', sans-serif;
font-size: 16px;
font-weight: 400;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, textarea:focus {
box-shadow: 0 0 7px #222;
}
.formWrap label{
margin: 0 0 2px 0;
}
.formWrap input[type="submit"]{
margin: 10px 0 20px 0;
float: right;
}
a.button,
button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
background: #7b133c;
border: none;
padding: 4px 12px;
border-radius: 0;
font-family: 'Oswald', sans-serif;
color: #fff;
display: inline-block;
font-size: 13px;
text-decoration: none;
cursor: pointer;
margin: 0 5px 10px 0;
line-height: 21px;
-webkit-appearance: none;
}
a.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
color: #222;
background: #ddd;
}
.flickrListing {
margin-right: -12px;
margin-top: 15px;
margin-bottom: 25px;
}
.flickrListing img {
display: block;
width: 100%;
}
.flickrListing a {
float: left;
margin-right: 12px;
margin-bottom: 12px;
border: 1px solid #333;
padding: 3px;
transition: all 0.2s ease-in-out;
}
.flickrListing a:hover {
border: 1px solid #222;
}
.alert {
padding: 8px 35px 8px 14px;
margin-bottom: 10px;
margin-top: 10px;
clear: left;
color: #c09853;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
background-color: #fcf8e3;
border: 1px solid #fbeed5;
border-radius: 3px;
}
.alert h4 {
margin: 0;
}
.alert p {
margin: 0;
}
.alert .close {
position: relative;
top: -2px;
right: -35px;
line-height: 20px;
}
.alert-success {
color: #468847;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert-danger,
.alert-error {
color: #b94a48;
background-color: #f2dede;
border-color: #eed3d7;
}
.alert-info {
color: #3a87ad;
background-color: #d9edf7;
border-color: #bce8f1;
}
button.close {
background: none;
border: 0 none;
cursor: pointer;
padding: 0;
}
.close {
color: #000000;
float: right;
font-size: 20px;
font-weight: bold;
line-height: 20px;
opacity: 0.2;
text-shadow: 0 1px 0 #FFFFFF;
}
#footer{
position:relative;
overflow:hidden;
padding:30px 0 50px 0;
z-index:1;
background:#fff;
}
margin-bottom:0;
margin-top: 20px;
text-align: center;
color: #888888;
}
.flex-container a:active, .flexslider a:active, .flex-container a:focus, .flexslider a:focus {
outline: medium none;
}
.slides, .flex-control-nav, .flex-direction-nav {
list-style: none outside none;
margin: 0;
padding: 0;
}
.slides li {
margin: 0;
}
.flexslider {
margin: 0;
padding: 0;
}
.flexslider .slides > li {
backface-visibility: hidden;
display: none;
}
.flex-pauseplay span {
text-transform: capitalize;
}
.slides:after {
clear: both;
content: ".";
display: block;
height: 0;
line-height: 0;
visibility: hidden;
}
html[xmlns] .slides {
display: block;
}
* html .slides {
height: 1%;
}
.no-js .slides > li:first-child {
display: block;
}
.flexslider {
position: relative;
z-index: 1;
}
.flexslider .slides > li {
position: relative;
}
.flex-container {
position: relative;
}
.flexslider .slides img {
display: block;
margin: auto;
max-width: 100%;
}
.flex-direction-nav a {
cursor: pointer;
display: block;
height: 60px;
margin: -30px 0 0;
opacity: 0;
position: absolute;
top: 50%;
width: 30px;
background: #555;
font-family: 'surreal';
font-size: 32px;
color: #fff;
line-height: 60px;
}
.flex-direction-nav a:hover {
color: #999;
}
.flex-direction-nav a.flex-next:before {
content: "\e016";
}
.flex-direction-nav a.flex-prev:before {
content: "\e013";
}
.flex-direction-nav a.flex-next {
right: 0;
border-radius:30px 0 0 30px;
}
.flex-direction-nav a.flex-prev {
left: 0;
border-radius:0 30px 30px 0;
}
.flexslider:hover .flex-next {
opacity: 1;
right: 0;
}
.flexslider:hover .flex-prev {
left: 0;
opacity: 1;
}
.flex-direction-nav .disabled {
cursor: default;
opacity: 0.3 !important;
}
.flex-direction-nav .flex-next {
right: -30px;
}
.flex-direction-nav .flex-prev {
left: -30px;
}
#carouselSlider, #carouselSlider .slides, #carouselSlider .slides li {
height: 120px;
}
#carouselSlider li {
border-right: 1px solid #333;
}
.flex-control-nav {
margin-top: 20px;
position: absolute;
text-align: center;
width: 100%;
z-index: 99;
}
.flex-control-nav li {
display: inline-block;
margin: 0 0 0 3px;
}
.flex-control-nav li:first-child {
margin: 0;
}
.flex-control-nav li a {
cursor: pointer;
display: block;
height: 14px;
text-indent: -9000px;
width: 14px;
}
.flex-control-nav li a:hover {
background-position: 0 0;
}
.flex-control-nav li a.active {
background-position: 0 -14px;
cursor: default;
}
.blogTitle {
margin-top: -80px;
}
.blogTitlePost h2{
font-size: 125px;
text-transform: uppercase;
position: relative;
letter-spacing: -2px;
text-align: left;
line-height: 0.8;
margin-bottom: 35px;
padding-top: 0px;
}
.blogTitlePost h2 span{
color: #7B133C;
font-size: 75px;
}
.post {
margin-bottom: 50px;
border-top: 1px solid #333333;
padding-top: 20px;
}
.post-title h3{
font-size: 30px;
}
.dateWrap {
background: #7B133C;
padding: 10px;
position: absolute;
margin-top: 10px;
z-index: 2000;
color: #fff;
}
.date-day {
font-size: 48px;
}
.post-media {
margin: 10px 0 20px 0;
}
.post-media img{
border-bottom: 10px solid #7B133C;
}
.post-body div a {
background: #7B133C;
padding: 2px 10px;
color: #fff;
}
.post-body div a:hover {
background: #333333;
}
.tags {
margin: 30px 0;
overflow: auto;
}
.tags a {
color: #FFFFFF;
float: left;
font-weight: 300;
height: 26px;
line-height: 26px;
margin-bottom: 5px;
margin-right: 5px;
padding: 3px 8px;
text-transform: uppercase;
transition: background-color 0.3s ease 0s;
background: #c3c3c3;
border-left: 1px solid #7B133C;
}
.tags a:hover {
background-color: #7B133C;
}
/* Comments */
#comments {
border-top: 1px solid #333333;
margin-top: 40px;
padding-top: 20px;
clear: both;
}
#comments [class*="span"] {
-moz-box-sizing: border-box;
display: block;
float: left;
margin-left: 2.5641%;
min-height: 30px;
width: 100%;
}
#comments .span11 {
width: 91.453%;
}
.comment-body > .span11 > p:last-child {
margin-bottom: 0;
}
.comment-body > .span11 > p a {
color: #AAAAAA;
}
.comment-body > .span11 > p a:hover {
color: #555555;
}
#commentform [class*="span"] {
margin-left: 0;
}
#comments .span12 {
margin-left: 0;
}
#comments .span1 {
margin-left: 0;
width: 5.98291%;
}
#comments li {
background: none repeat scroll 0 0 transparent;
padding-left: 0;
}
#comments p {
margin-bottom: 20px;
}
#comments .comment-body {
margin-bottom: 10px;
}
#comments-title {
font-size: 28px;
margin-bottom: 30px;
}
#comments-title span {
color: #7B133C;
font-size: 14px;
font-weight: 400;
line-height: 10px;
padding: 0 5px;
vertical-align: middle;
}
.commentlist, #comments .children {
list-style-type: none;
margin: 0;
padding: 0;
}
.pe-offset1 {
margin-left: 8.54701% !important;
}
.commentlist {
margin-bottom: 40px;
}
.row-fluid {
width: 100%;
}
.row-fluid:before, .row-fluid:after {
content: "";
display: table;
line-height: 0;
}
.row-fluid:after {
clear: both;
}
.comment-author img {
border: 2px solid #F5F5F5;
display: block;
max-width: 100%;
}
.bypostauthor > .comment-body > .comment-author img {
border: 2px solid #7B133C;
}
.bypostauthor > .comment-body .fn a {
color: #7B133C;
}
.bypostauthor > .comment-body p {
color: #666666;
}
#comments .fn {
font-weight: 700;
margin-top: 2px;
}
.fn a {
color: #AAAAAA;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
}
.comment-body .fn, .comment-body .says {
float: left;
font-size: 14px;
}
.says {
margin-left: 5px;
margin-top: 2px;
}
#comments [id*="div-comment"] .span11 {
background: #C3C3C3;
padding: 10px;
position: relative;
}
#comments .comment-arrow {
border-bottom: 14px solid transparent;
border-right: 14px solid #333333;
border-top: 14px solid transparent;
height: 0;
left: -14px;
position: absolute;
top: 13px;
width: 0;
}
#comments .fn a:hover {
color: #555555;
text-decoration: none;
}
#comments .comment-meta {
clear: both;
margin-bottom: 10px;
}
#comments .comment-meta a {
color: #AAAAAA;
font-size: 13px;
}
#comments .comment-meta a:hover {
color: #666666;
text-decoration: none;
}
#comments .reply {
float: right;
}
#comments .reply .label {
background-color: #7B133C;
color: #FFFFFF;
font-size: 10px;
padding: 4px 8px;
text-shadow: none;
text-transform: uppercase;
}
#comments .reply .label:hover {
background-color: #555555;
}
#comments .post-pagination {
margin-bottom: 60px;
}
#comments .pagination .active a {
background-color: #666666;
border-color: #666666;
color: #FFFFFF;
}
#respond {
margin-bottom: 50px;
}
#respond #reply-title {
color: #BBBBBB;
font-size: 22px;
font-weight: 400;
margin-bottom: 40px;
}
#commentform .comment-notes {
color: #AAAAAA;
font-size: 12px;
}
#commentform .comment-notes a {
color: #7B133C;
}
#commentform .comment-notes a:hover {
color: #555555;
}
#commentform label {
color: #fff;
padding-top: 0;
text-align: left;
width: auto;
position: absolute;
left: 0px;
top: 0px;
}
#commentform .controls {
margin-left: 0;
}
#commentform .controls input {
border-radius: 0 0 0 0;
float: left;
margin-right: 30px;
}
#commentform .control-group .required {
color: #7B133C;
margin-left: 3px;
margin-top: 3px;
}
#commentform .control-group {
position: relative;
float: left;
width: 33.3%
}
#commentform .control-label {
float: left;
text-align: left;
}
#comment input[type="text"], #commentform textarea {
width: 400px;
}
#commentform input[type="text"] {
margin-right: 20px;
}
#commentform .<API key> .controls {
clear: both;
float: none;
}
#commentform textarea {
width: 100%;
}
#commentform .form-submit .controls {
margin-left: 0;
}
#commentform .form-submit button[type="submit"] {
background: none repeat scroll 0 0 #7B133C;
border: 0 none;
border-radius: 0;
box-shadow: none;
clear: both;
color: #FFFFFF;
float: left;
font-family: 'Oswald', sans-serif;
font-size: 13px;
height: 40px;
padding: 5px 10px;
text-shadow: none;
text-transform: uppercase;
transition: all 0.3s ease-out 0s;
}
#commentform .form-submit button[type="submit"]:hover {
background-color: #555555;
color: #FFFFFF;
}
#commentform input[type="text"], #commentform textarea {
background-color: #333333;
border-radius: 0px;
box-shadow: none;
color: #D0D0D0;
font-size: 14px;
min-height: 30px;
padding: 5px 10px;
font-weight: 400;
}
#commentform input[type="text"]:focus, #commentform textarea:focus {
border-color: #7B133C;
}
#commentform input[type="text"] {
height: 30px;
width: 96%;
}
#commentform .comment-form-url input[type="text"] {
width: 100%;
}
#commentform .control-group .controls {
float: left;
margin-left: 0 !important;
overflow: hidden;
padding-top: 22px;
width: 100%;
}
.<API key> .controls {
float: none;
width: 98%;
}
#commentform .<API key> {
width: 100%
}
#commentform .<API key> .controls{
padding-top: 0px;
}
.form-horizontal .control-group:before, .form-horizontal .control-group:after {
content: "";
line-height: 0;
}
.form-horizontal .control-group:after {
clear: both;
}
.form-horizontal .control-label {
float: left;
padding-top: 5px;
text-align: right;
width: 160px;
}
.form-horizontal .controls {
margin-left: 180px;
}
.form-horizontal .controls:first-child {
}
.form-horizontal .help-block {
margin-bottom: 0;
}
.form-horizontal input + .help-block, .form-horizontal select + .help-block, .form-horizontal textarea + .help-block {
margin-top: 10px;
}
.form-horizontal .form-actions {
padding-left: 180px;
}
/* Widgets */
.sidebar {
margin-bottom: 60px;
padding-top: 20px;
border-top: 1px solid #333333;
}
.sidebar .widget {
font-size: 16px;
line-height: 20px;
margin-bottom: 20px;
}
.sidebar h3 {
border-bottom: 1px solid #333333;
font-size: 28px;
line-height: 30px;
margin-bottom: 10px;
padding: 26px 0 6px;
}
.widget_search {
position: relative;
}
.widget_search button[type="submit"] {
background-color: transparent;
background-position: -44px 7px;
border: 0 none;
cursor: pointer;
height: 27px;
opacity: 0.4;
padding: 5px 10px 8px 5px;
position: absolute;
right: 4px;
top: 4px;
width: 26px;
}
.widget_search button[type="submit"]:hover {
opacity: 0.7;
}
.widget_search input[type="text"] {
background-color: #C3C3C3;
border-radius: 0;
box-shadow: none;
color: #222222;
display: block;
font-size: 12px;
height: 30px;
padding: 2px 10px;
transition: border-color 0.3s ease 0s;
width: 85%;
margin: 0;
box-sizing: border-box;
float: left;
}
.widget_search input[type="text"]:focus {
border-color: #7B133C;
}
.widget_search input[type="submit"] {
width: 15%;
margin: 0;
box-sizing: border-box;
}
.widget_text {
margin-bottom: 65px;
}
.widget_categories ul li {
color: #CCCCCC;
font-size: 11px;
}
.widget_categories a {
color: #666666;
font-size: 16px;
margin-right: 10px;
}
.widget_categories a:hover {
color: #D95137;
}
.widget_archive li {
color: #999999;
font-size: 11px;
}
.widget_archive a {
font-size: 16px;
margin-right: 9px;
}
.widget_menu li:before {
content: "";
}
.widget_menu a {
border: 1px solid #EEEEEE;
height: 26px;
line-height: 26px;
text-shadow: none !important;
text-transform: uppercase;
}
.widget_menu a:hover {
background-color: #DDDDDD;
color: #666666;
}
.widget_menu li.active a {
background: url("../../styles/../img/skin/sidebar_menu_active.png") no-repeat scroll 95% 50% #D95137;
color: #FFFFFF;
}
.widget_menu li.active a:hover {
background-color: #D95137;
color: #FFFFFF;
cursor: default;
}
.widget_tag_cloud li:before {
content: "";
}
.widget_tag_cloud a {
color: #FFFFFF;
float: left;
font-weight: 300;
height: 26px;
line-height: 26px;
margin-bottom: 5px;
margin-right: 5px;
padding: 3px 8px;
text-transform: uppercase;
transition: background-color 0.3s ease 0s;
background: #c3c3c3;
border-left: 1px solid #7B133C;
}
.widget_tag_cloud a:hover {
background-color: #7B133C;
color: #FFFFFF;
}
.widget_tag_cloud .tagcloud {
overflow: hidden;
}
.widget_calendar li:before {
content: "";
}
.widget_calendar #wp-calendar {
color: #999999;
text-align: center;
width: 100%;
}
.widget_calendar caption, .widget_calendar th, .widget_calendar td {
text-align: center;
padding-top: 2px;
padding-bottom: 2px;
}
.widget_calendar caption {
color: #fff;
font-size: 16px;
padding: 25px 0 12px;
text-align: left;
text-transform: uppercase;
}
.widget_calendar th {
background: #C3C3C3;
border-bottom: 0 none;
border-top: 0 none;
font-weight: 600;
padding-bottom: 5px;
padding-top: 5px;
color: #fff;
}
.widget_calendar tbody td a {
background: #E4E4E4;
padding: 0px 5px;
width: 100%;
}
.widget_calendar tfoot td a:hover {
background: #F6F6F6;
}
.widget_calendar tfoot td {
background: none repeat scroll 0 0 transparent;
border-bottom: 0 none;
border-top: 0 none;
}
.widget_calendar tfoot td a {
color: #666666;
text-transform: uppercase;
}
.widget_calendar tfoot td a:hover {
background: none repeat scroll 0 0 transparent;
color: #fff;
}
.widget_calendar tfoot #prev {
text-align: left;
}
.widget_calendar tfoot #next {
text-align: right;
}
.widget_links ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.sidebar li:before {
color: #7B133C;
content: "\e016";
display: inline-block;
font-family: 'surreal';
font-size: 13px;
font-style: normal;
font-weight: normal;
line-height: 1em;
margin-right: 0.2em;
margin-top: 9px;
text-align: center;
text-decoration: inherit;
width: 1em;
transition: all 0.3s ease-in-out;
}
.sidebar li span {
color: #CCCCCC;
font-size: 10px;
font-style: italic;
margin-left: 15px;
}
.widget_links li a,
.widget_pages li a,
.widget_meta li a,
.widget_archive li a,
.widget_calendar tbody td a,
.widget_categories li a,
.<API key> li a,
.<API key> li a {
color: #999999;
transition: all 0.3s ease-in-out;
}
.widget_links li a:hover,
.widget_pages li a:hover,
.widget_meta li a:hover,
.widget_archive li a:hover,
.widget_categories li a:hover,
.widget_calendar tbody td a:hover,
.<API key> li a:hover,
.<API key> li a:hover {
color: #222;
text-decoration: none;
}
.<API key> {
font-size: 16px;
margin-right: 0;
}
.<API key> p {
margin-top: 25px;
}
.comments-num {
display: block;
float: right;
width: 28px;
}
.<API key> span {
text-transform: lowercase;
}
@font-face {
font-family: 'surreal';
src:url('../fonts/surreal.eot');
src:url('../fonts/surreal.eot?#iefix') format('embedded-opentype'),
url('../fonts/surreal.woff') format('woff'),
url('../fonts/surreal.ttf') format('truetype'),
url('../fonts/surreal.svg#surreal') format('svg');
font-weight: normal;
font-style: normal;
}
/* Use the following CSS code if you want to use data attributes for inserting your icons */
[data-icon]:before {
font-family: 'surreal';
content: attr(data-icon);
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-<API key>: antialiased;
}
/* Use the following CSS code if you want to have a class per icon */
/*
Instead of a list of all class selectors,
you can use the generic selector below, but it's slower:
[class*="icon-"] {
*/
.icon-location, .icon-envelop, .icon-phone, .icon-print, .icon-clock, .icon-arrow-right, .icon-arrow-left, .icon-twitter, .icon-google-plus, .icon-facebook, .icon-flickr, .icon-skype, .icon-linkedin, .icon-pinterest, .icon-youtube, .icon-vimeo, .icon-dribbble, .icon-feed, .icon-plus, .icon-arrow-left-2, .icon-arrow-down, .icon-arrow-up, .icon-arrow-right-2, .icon-quote, .icon-search, .icon-brush, .icon-share, .icon-mobile, .icon-camera, .icon-camera-2, .icon-quill {
font-family: 'surreal';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-<API key>: antialiased;
}
.icon-location:before {
content: "\e001";
}
.icon-envelop:before {
content: "\e002";
}
.icon-phone:before {
content: "\e003";
}
.icon-print:before {
content: "\e004";
}
.icon-clock:before {
content: "\e005";
}
.icon-arrow-right:before {
content: "\e006";
}
.icon-arrow-left:before {
content: "\e007";
}
.icon-twitter:before {
content: "\e008";
}
.icon-google-plus:before {
content: "\e009";
}
.icon-facebook:before {
content: "\e00a";
}
.icon-flickr:before {
content: "\e00b";
}
.icon-skype:before {
content: "\e00c";
}
.icon-linkedin:before {
content: "\e00d";
}
.icon-pinterest:before {
content: "\e00e";
}
.icon-youtube:before {
content: "\e00f";
}
.icon-vimeo:before {
content: "\e010";
}
.icon-dribbble:before {
content: "\e011";
}
.icon-feed:before {
content: "\e012";
}
.icon-plus:before {
content: "\e000";
}
.icon-arrow-left-2:before {
content: "\e013";
}
.icon-arrow-down:before {
content: "\e014";
}
.icon-arrow-up:before {
content: "\e015";
}
.icon-arrow-right-2:before {
content: "\e016";
}
.icon-quote:before {
content: "\e017";
}
.icon-search:before {
content: "\e018";
}
.icon-brush:before {
content: "\e019";
}
.icon-share:before {
content: "\e01a";
}
.icon-mobile:before {
content: "\e01b";
}
.icon-camera:before {
content: "\e01c";
}
.icon-camera-2:before {
content: "\e01d";
}
.icon-quill:before {
content: "\e01e";
}
.clear{float:none;}
/* Smaller than standard 1199 (devices and browsers) */
@media only screen and (max-width: 1199px) {
.parallax.fixed{<API key>:scroll; background-position: center center;}
}
/* Higher than 960 (desktop devices) */
@media only screen and (min-width: 960px) and (max-width: 1199px) {
.teamImage h2 {margin-top: 105px; font-size:40px;}
input[type="text"], input[type="password"], input[type="email"], textarea, select {width: 290px;}
}
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {
.small {font-size: 30px; font-weight:300;}
.smallBold {font-size: 30px; font-weight:700;}
.medium {font-size: 38px; text-transform: uppercase;}
.mediumBold {font-size: 38px; font-weight:700; text-transform: uppercase;}
.large {font-size: 50px; text-transform: uppercase;}
.largeBold {font-size: 50px; font-weight:700; text-transform: uppercase;}
.author {font-size: 16px; font-weight:300;}
}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {
h1 {font-size: 200px;}
.teamImage h2 {margin-top: 75px; font-size:32px;}
input[type="text"], input[type="password"], input[type="email"], textarea, select {width: 226px;}
.parallax.fixed{<API key>:scroll; background-position: center center;}
.blogTitle {margin-top: -40px;}
}
/* All Mobile Sizes (devices and browser) */
@media only screen and (max-width: 767px) {
.dropmenu { display: block; margin-top: 5px; }
#nav {display: none;}
#slidecaption { display:none;}
#prevslide, #nextslide{top:120px;}
.parallax.fixed{<API key>:scroll; background-position: center center;}
.logo {margin-top: 10px; transform: scale(.5);}
#prevslide {right: 45px; transform: scale(.5);}
#nextslide {right: 22px; transform: scale(.5);}
.homepage {margin-bottom: -50px;}
.thumbImage .thumbTextWrap {padding: 0 10px;}
.thumbImage .thumbText p {font-size: 12px;}
.thumbImage .thumbText h3 {font-size: 21px;}
.blogTitle {margin-top: 0px;}
}
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) {
h1 {font-size: 110px;}
h1 span{font-size: 80px;}
input[type="text"], input[type="password"], input[type="email"], textarea, select {width: 418px;}
}
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@media only screen and (max-width: 479px) {
h1 {font-size: 80px;}
h1 span{font-size: 60px;}
.teamImage h2 {margin-top: 105px; font-size:40px;}
input[type="text"], input[type="password"], input[type="email"], textarea, select {width: 298px;}
}
|
<?php defined('WPSS_PATH') or die();?>
<?php $util = new WPSS_Util();?>
<?php $question = new WPSS_Question((int) $_GET['id']);?>
<?php $quiz = new WPSS_Quiz($question->quiz_id);?>
<!-- Admin questions#new -->
<div class="wrap wpss">
<img class="left" src="<?php echo WPSS_URL.'assets/images/wpss_admin.png'?>" />
<h2 class="left"><?php echo $quiz->title;?>, Editing Question</h2>
<div class="clear"></div>
<hr />
<p class="wpss-breadcrumb">
<a href="<?php echo $util->admin_url('','','');?>">Quizzes</a> » <a href="<?php echo $util->admin_url('quiz', 'edit', $quiz->id);?>"><?php echo $quiz->title;?></a> » <a href="<?php echo $util->admin_url('quiz', 'questions_index', $quiz->id);?>">Questions</a> » <a class="current">Edit</a>
</p>
<?php include( WPSS_PATH . "admin/questions/_form.php");?>
</div>
|
<?php
namespace Drutiny\Audit;
use Drutiny\Sandbox\Sandbox;
use Drutiny\Audit\AuditInterface;
interface RemediableInterface extends AuditInterface
{
/**
* Attempt to remediate the check after it has failed.
*
* @param Sandbox $sandbox
* @return bool
*/
public function remediate(Sandbox $sandbox);
}
|
<?php
pb_backupbuddy::$ui->start_metabox( 'BackupBuddy Settings', true, 'width: 100%; max-width: 1200px;' );
$settings_form->display_settings( 'Save Settings' );
echo '<br><br>';
pb_backupbuddy::$ui->end_metabox();
/*
REMOVED v3.1.
pb_backupbuddy::$ui->start_metabox( __('Remote Offsite Storage / Destinations', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#177', __( 'Remote Offsite Management / Remote Clients Tutorial', 'it-l10n-backupbuddy' ), false ), true, 'width: 100%; max-width: 1200px;' );
//echo '<h3>' . __('Remote Offsite Storage / Destinations', 'it-l10n-backupbuddy' ) . ' ' . pb_backupbuddy::video( 'PmXLw_tS42Q#177', __( 'Remote Offsite Management / Remote Clients Tutorial', 'it-l10n-backupbuddy' ), false ) . '</h3>';
//echo '<br>';
echo '<a href="' . pb_backupbuddy::ajax_url( 'destination_picker' ) . '&action_verb=to%20manage%20files&TB_iframe=1&width=640&height=600" class="thickbox button secondary-button" style="margin-top: 3px;" title="' . __( 'Manage Destinations & Archives', 'it-l10n-backupbuddy' ) . '">' . __('Manage Destinations & Archives', 'it-l10n-backupbuddy' ) . '</a>';
echo ' ';
_e( 'Add & configure destinations or select a destination to browse & manage its files.', 'it-l10n-backupbuddy' );
echo '<br><br>';
pb_backupbuddy::$ui->end_metabox();
*/
?>
<script type="text/javascript">
function <API key>( destination_id, destination_title, callback_data ) {
window.location.href = '<?php
if ( is_network_admin() ) {
echo network_admin_url( 'admin.php' );
} else {
echo admin_url( 'admin.php' );
}
?>?page=<API key>&custom=remoteclient&destination_id=' + destination_id;
}
</script>
<?php
// Handles thickbox auto-resizing. Keep at bottom of page to avoid issues.
if ( !wp_script_is( 'media-upload' ) ) {
wp_enqueue_script( 'media-upload' );
wp_print_scripts( 'media-upload' );
}
?>
|
#include "Core/Boot/Boot.h"
#include <algorithm>
#include <array>
#include <cstring>
#include <memory>
#include <numeric>
#include <optional>
#include <string>
#include <unordered_set>
#include <vector>
#include <zlib.h>
#include "Common/Align.h"
#include "Common/CDUtils.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/Boot/DolReader.h"
#include "Core/Boot/ElfReader.h"
#include "Core/CommonTitles.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/FifoPlayer/FifoPlayer.h"
#include "Core/HLE/HLE.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/EXI/EXI_DeviceIPL.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/VideoInterface.h"
#include "Core/Host.h"
#include "Core/IOS/IOS.h"
#include "Core/PatchEngine.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
BootParameters::BootParameters(Parameters&& parameters_,
const std::optional<std::string>& savestate_path_)
: parameters(std::move(parameters_)), savestate_path(savestate_path_)
{
}
std::unique_ptr<BootParameters>
BootParameters::GenerateFromFile(const std::string& path,
const std::optional<std::string>& savestate_path)
{
const bool is_drive = cdio_is_cdrom(path);
// Check if the file exist, we may have gotten it from a --elf command line
// that gave an incorrect file name
if (!is_drive && !File::Exists(path))
{
PanicAlertT("The specified file \"%s\" does not exist", path.c_str());
return {};
}
std::string extension;
SplitPath(path, nullptr, nullptr, &extension);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
static const std::unordered_set<std::string> <API key> = {
{".gcm", ".iso", ".tgc", ".wbfs", ".ciso", ".gcz", ".dol", ".elf"}};
if (<API key>.find(extension) != <API key>.end() || is_drive)
{
std::unique_ptr<DiscIO::Volume> volume = DiscIO::<API key>(path);
if (volume)
return std::make_unique<BootParameters>(Disc{path, std::move(volume)}, savestate_path);
if (extension == ".elf")
{
return std::make_unique<BootParameters>(Executable{path, std::make_unique<ElfReader>(path)},
savestate_path);
}
if (extension == ".dol")
{
return std::make_unique<BootParameters>(Executable{path, std::make_unique<DolReader>(path)},
savestate_path);
}
if (is_drive)
{
PanicAlertT("Could not read \"%s\". "
"There is no disc in the drive or it is not a GameCube/Wii backup. "
"Please note that Dolphin cannot play games directly from the original "
"GameCube and Wii discs.",
path.c_str());
}
else
{
PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.", path.c_str());
}
return {};
}
if (extension == ".dff")
return std::make_unique<BootParameters>(DFF{path}, savestate_path);
if (extension == ".wad")
return std::make_unique<BootParameters>(DiscIO::WiiWAD{path}, savestate_path);
PanicAlertT("Could not recognize file %s", path.c_str());
return {};
}
BootParameters::IPL::IPL(DiscIO::Region region_) : region(region_)
{
const std::string directory = SConfig::GetInstance().<API key>(region);
path = SConfig::GetInstance().GetBootROMPath(directory);
}
BootParameters::IPL::IPL(DiscIO::Region region_, Disc&& disc_) : IPL(region_)
{
disc = std::move(disc_);
}
// Inserts a disc into the emulated disc drive and returns a pointer to it.
// The returned pointer must only be used while we are still booting,
// because DVDThread can do whatever it wants to the disc after that.
static const DiscIO::Volume* SetDisc(std::unique_ptr<DiscIO::Volume> volume)
{
const DiscIO::Volume* pointer = volume.get();
DVDInterface::SetDisc(std::move(volume));
return pointer;
}
bool CBoot::DVDRead(const DiscIO::Volume& volume, u64 dvd_offset, u32 output_address, u32 length,
const DiscIO::Partition& partition)
{
std::vector<u8> buffer(length);
if (!volume.Read(dvd_offset, length, buffer.data(), partition))
return false;
Memory::CopyToEmu(output_address, buffer.data(), length);
return true;
}
void CBoot::<API key>()
{
<API key>();
}
// Get map file paths for the active title.
bool CBoot::FindMapFile(std::string* existing_map_file, std::string* writable_map_file)
{
const std::string& game_id = SConfig::GetInstance().m_debugger_game_id;
if (writable_map_file)
*writable_map_file = File::GetUserPath(D_MAPS_IDX) + game_id + ".map";
bool found = false;
static const std::string maps_directories[] = {File::GetUserPath(D_MAPS_IDX),
File::GetSysDirectory() + MAPS_DIR DIR_SEP};
for (size_t i = 0; !found && i < ArraySize(maps_directories); ++i)
{
std::string path = maps_directories[i] + game_id + ".map";
if (File::Exists(path))
{
found = true;
if (existing_map_file)
*existing_map_file = path;
}
}
return found;
}
bool CBoot::LoadMapFromFilename()
{
std::string strMapFilename;
bool found = FindMapFile(&strMapFilename, nullptr);
if (found && g_symbolDB.LoadMap(strMapFilename))
{
<API key>();
return true;
}
return false;
}
// If ipl.bin is not found, this function does *some* of what BS1 does:
// loading IPL(BS2) and jumping to it.
// It does not initialize the hardware or anything else like BS1 does.
bool CBoot::Load_BS2(const std::string& boot_rom_filename)
{
// CRC32 hashes of the IPL file; including source where known
// https://forums.dolphin-emu.org/<API key>?pid=385344#pid385344
constexpr u32 USA_v1_0 = 0x6D740AE7;
// https://forums.dolphin-emu.org/<API key>?pid=385334#pid385334
constexpr u32 USA_v1_1 = 0xD5E6FEEA;
// https://forums.dolphin-emu.org/<API key>?pid=385399#pid385399
constexpr u32 USA_v1_2 = 0x86573808;
// GameCubes sold in Brazil have this IPL. Same as USA v1.2 but localized
constexpr u32 BRA_v1_0 = 0x667D0B64;
// Redump
constexpr u32 JAP_v1_0 = 0x6DAC1F2A;
constexpr u32 JAP_v1_1 = 0xD235E3F9;
constexpr u32 JAP_v1_2 = 0x8BDABBD4;
// Redump
constexpr u32 PAL_v1_0 = 0x4F319F43;
// https://forums.dolphin-emu.org/<API key>?pid=435463#pid435463
constexpr u32 PAL_v1_1 = 0xDD8CAB7C;
// Redump
constexpr u32 PAL_v1_2 = 0xAD1B7F16;
// Load the whole ROM dump
std::string data;
if (!File::ReadFileToString(boot_rom_filename, data))
return false;
// Use zlibs crc32 implementation to compute the hash
u32 ipl_hash = crc32(0L, Z_NULL, 0);
ipl_hash = crc32(ipl_hash, (const Bytef*)data.data(), (u32)data.size());
DiscIO::Region ipl_region;
switch (ipl_hash)
{
case USA_v1_0:
case USA_v1_1:
case USA_v1_2:
case BRA_v1_0:
ipl_region = DiscIO::Region::NTSC_U;
break;
case JAP_v1_0:
case JAP_v1_1:
case JAP_v1_2:
ipl_region = DiscIO::Region::NTSC_J;
break;
case PAL_v1_0:
case PAL_v1_1:
case PAL_v1_2:
ipl_region = DiscIO::Region::PAL;
break;
default:
PanicAlertT("IPL with unknown hash %x", ipl_hash);
ipl_region = DiscIO::Region::Unknown;
break;
}
const DiscIO::Region boot_region = SConfig::GetInstance().m_region;
if (ipl_region != DiscIO::Region::Unknown && boot_region != ipl_region)
PanicAlertT("%s IPL found in %s directory. The disc might not be recognized",
SConfig::<API key>(ipl_region),
SConfig::<API key>(boot_region));
// Run the descrambler over the encrypted section containing BS1/BS2
ExpansionInterface::CEXIIPL::Descrambler((u8*)data.data() + 0x100, 0x1AFE00);
// TODO: Execution is supposed to start at 0xFFF00000, not 0x81200000;
// copying the initial boot code to 0x81200000 is a hack.
// For now, HLE the first few instructions and start at 0x81200150
// to work around this.
Memory::CopyToEmu(0x01200000, data.data() + 0x100, 0x700);
Memory::CopyToEmu(0x01300000, data.data() + 0x820, 0x1AFE00);
PowerPC::ppcState.gpr[3] = 0xfff0001f;
PowerPC::ppcState.gpr[4] = 0x00002030;
PowerPC::ppcState.gpr[5] = 0x0000009c;
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
m_MSR.FP = 1;
m_MSR.DR = 1;
m_MSR.IR = 1;
PowerPC::ppcState.spr[SPR_HID0] = 0x0011c464;
PowerPC::ppcState.spr[SPR_IBAT3U] = 0xfff0001f;
PowerPC::ppcState.spr[SPR_IBAT3L] = 0xfff00001;
PowerPC::ppcState.spr[SPR_DBAT3U] = 0xfff0001f;
PowerPC::ppcState.spr[SPR_DBAT3L] = 0xfff00001;
SetupBAT(/*is_wii*/ false);
PC = 0x81200150;
return true;
}
static void SetDefaultDisc()
{
const SConfig& config = SConfig::GetInstance();
if (!config.m_strDefaultISO.empty())
SetDisc(DiscIO::<API key>(config.m_strDefaultISO));
}
static void <API key>()
{
constexpr u32 <API key>[] = {0x00000100, 0x00000200, 0x00000300, 0x00000400,
0x00000500, 0x00000600, 0x00000700, 0x00000800,
0x00000900, 0x00000C00, 0x00000D00, 0x00000F00,
0x00001300, 0x00001400, 0x00001700};
constexpr u32 RFI_INSTRUCTION = 0x4C000064;
for (const u32 address : <API key>)
Memory::Write_U32(RFI_INSTRUCTION, address);
}
// Third boot step after BootManager and Core. See Call schedule in BootManager.cpp
bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
{
SConfig& config = SConfig::GetInstance();
g_symbolDB.Clear();
// PAL Wii uses NTSC framerate and linecount in 60Hz modes
VideoInterface::Preset(DiscIO::IsNTSC(config.m_region) ||
(config.bWii && Config::Get(Config::SYSCONF_PAL60)));
struct BootTitle
{
BootTitle() : config(SConfig::GetInstance()) {}
bool operator()(BootParameters::Disc& disc) const
{
NOTICE_LOG(BOOT, "Booting from disc: %s", disc.path.c_str());
const DiscIO::Volume* volume = SetDisc(std::move(disc.volume));
if (!volume)
return false;
if (!EmulatedBS2(config.bWii, *volume))
return false;
// Try to load the symbol map if there is one, and then scan it for
// and eventually replace code
if (LoadMapFromFilename())
HLE::PatchFunctions();
return true;
}
bool operator()(const BootParameters::Executable& executable) const
{
NOTICE_LOG(BOOT, "Booting from executable: %s", executable.path.c_str());
if (!executable.reader->IsValid())
return false;
if (!executable.reader->LoadIntoMemory())
{
PanicAlertT("Failed to load the executable to memory.");
return false;
}
SetDefaultDisc();
SetupMSR();
SetupBAT(config.bWii);
<API key>();
if (config.bWii)
{
PowerPC::ppcState.spr[SPR_HID0] = 0x0011c464;
PowerPC::ppcState.spr[SPR_HID4] = 0x82000000;
// Set a value for the SP. It doesn't matter where this points to,
// as long as it is a valid location. This value is taken from a homebrew binary.
PowerPC::ppcState.gpr[1] = 0x8004d4bc;
// Because there is no TMD to get the requested system (IOS) version from,
// we default to IOS58, which is the version used by the Homebrew Channel.
SetupWiiMemory();
IOS::HLE::GetIOS()->BootIOS(Titles::IOS(58));
}
else
{
SetupGCMemory();
}
PC = executable.reader->GetEntryPoint();
if (executable.reader->LoadSymbols() || LoadMapFromFilename())
{
<API key>();
HLE::PatchFunctions();
}
return true;
}
bool operator()(const DiscIO::WiiWAD& wad) const
{
SetDefaultDisc();
return Boot_WiiWAD(wad);
}
bool operator()(const BootParameters::NANDTitle& nand_title) const
{
SetDefaultDisc();
return BootNANDTitle(nand_title.id);
}
bool operator()(const BootParameters::IPL& ipl) const
{
NOTICE_LOG(BOOT, "Booting GC IPL: %s", ipl.path.c_str());
if (!File::Exists(ipl.path))
{
if (ipl.disc)
PanicAlertT("Cannot start the game, because the GC IPL could not be found.");
else
PanicAlertT("Cannot find the GC IPL.");
return false;
}
if (!Load_BS2(ipl.path))
return false;
if (ipl.disc)
{
NOTICE_LOG(BOOT, "Inserting disc: %s", ipl.disc->path.c_str());
SetDisc(DiscIO::<API key>(ipl.disc->path));
}
if (LoadMapFromFilename())
HLE::PatchFunctions();
return true;
}
bool operator()(const BootParameters::DFF& dff) const
{
NOTICE_LOG(BOOT, "Booting DFF: %s", dff.dff_path.c_str());
return FifoPlayer::GetInstance().Open(dff.dff_path);
}
private:
const SConfig& config;
};
if (!std::visit(BootTitle(), boot->parameters))
return false;
PatchEngine::LoadPatches();
HLE::PatchFixedFunctions();
return true;
}
<API key>::<API key>(const std::string& file_name)
: <API key>(File::IOFile{file_name, "rb"})
{
}
<API key>::<API key>(File::IOFile file)
{
file.Seek(0, SEEK_SET);
m_bytes.resize(file.GetSize());
file.ReadBytes(m_bytes.data(), m_bytes.size());
}
<API key>::<API key>(const std::vector<u8>& bytes) : m_bytes(bytes)
{
}
<API key>::~<API key>() = default;
void StateFlags::UpdateChecksum()
{
constexpr size_t length_in_bytes = sizeof(StateFlags) - 4;
constexpr size_t num_elements = length_in_bytes / sizeof(u32);
std::array<u32, num_elements> flag_data;
std::memcpy(flag_data.data(), &flags, length_in_bytes);
checksum = std::accumulate(flag_data.cbegin(), flag_data.cend(), 0U);
}
void UpdateStateFlags(std::function<void(StateFlags*)> update_function)
{
const std::string file_path =
Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + WII_STATE;
File::IOFile file;
StateFlags state;
if (File::Exists(file_path))
{
file.Open(file_path, "r+b");
file.ReadBytes(&state, sizeof(state));
}
else
{
File::CreateFullPath(file_path);
file.Open(file_path, "a+b");
memset(&state, 0, sizeof(state));
}
update_function(&state);
state.UpdateChecksum();
file.Seek(0, SEEK_SET);
file.WriteBytes(&state, sizeof(state));
}
|
package My::Suite::WSREP;
use File::Basename;
use My::Find;
@ISA = qw(My::Suite);
return "Not run for embedded server" if $::opt_embedded_server;
return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
"/usr/lib64/galera-3/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so",
"/usr/lib/galera-3/libgalera_smm.so",
"/usr/lib/galera/libgalera_smm.so";
return "No wsrep provider library" unless -f $provider;
$ENV{WSREP_PROVIDER} = $provider;
my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
return "No SST scripts" unless $spath;
my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
return "No my_print_defaults" unless $epath;
push @::global_suppressions,
(
qr(WSREP: Could not open saved state file for reading: .*),
qr(WSREP: Could not open state file for reading: .*),
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
);
$ENV{PATH}="$epath:$ENV{PATH}";
$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
bless { };
|
<?php
namespace TYPO3\CMS\Extbase\Persistence\Generic;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* The Query class used to run queries against the database
*
* @api
*/
class Query implements QueryInterface {
/**
* An inner join.
*/
const JCR_JOIN_TYPE_INNER = '{http:
/**
* A left-outer join.
*/
const <API key> = '{http:
/**
* A right-outer join.
*/
const <API key> = '{http:
/**
* Charset of strings in QOM
*/
const CHARSET = 'utf-8';
/**
* @var string
*/
protected $type;
/**
* @var \TYPO3\CMS\Extbase\Object\<API key>
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper
* @inject
*/
protected $dataMapper;
/**
* @var \TYPO3\CMS\Extbase\Persistence\<API key>
* @inject
*/
protected $persistenceManager;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\<API key>
* @inject
*/
protected $qomFactory;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface
*/
protected $source;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface
*/
protected $constraint;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement
*/
protected $statement;
/**
* @var int
*/
protected $orderings = array();
/**
* @var int
*/
protected $limit;
/**
* @var int
*/
protected $offset;
/**
* The query settings.
*
* @var <API key>
*/
protected $querySettings;
/**
* Constructs a query object working on the given class name
*
* @param string $type
*/
public function __construct($type) {
$this->type = $type;
}
/**
* Sets the Query Settings. These Query settings must match the settings expected by
* the specific Storage Backend.
*
* @param <API key> $querySettings The Query Settings
* @return void
* @api This method is not part of FLOW3 API
*/
public function setQuerySettings(<API key> $querySettings) {
$this->querySettings = $querySettings;
}
/**
* Returns the Query Settings.
*
* @throws Exception
* @return <API key> $querySettings The Query Settings
* @api This method is not part of FLOW3 API
*/
public function getQuerySettings() {
if (!$this->querySettings instanceof <API key>) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception('Tried to get the query settings without seting them before.', 1248689115);
}
return $this->querySettings;
}
/**
* Returns the type this query cares for.
*
* @return string
* @api
*/
public function getType() {
return $this->type;
}
/**
* Sets the source to fetch the result from
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source
*/
public function setSource(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source) {
$this->source = $source;
}
/**
* Returns the selectorn name or an empty string, if the source is not a selector
* TODO This has to be checked at another place
*
* @return string The selector name
*/
protected function getSelectorName() {
$source = $this->getSource();
if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) {
return $source->getSelectorName();
} else {
return '';
}
}
/**
* Gets the node-tuple source for this query.
*
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface the node-tuple source; non-null
*/
public function getSource() {
if ($this->source === NULL) {
$this->source = $this->qomFactory->selector($this->getType(), $this->dataMapper-><API key>($this->getType()));
}
return $this->source;
}
/**
* Executes the query against the database and returns the result
*
* @param $<API key> boolean avoids the object mapping by the persistence
* @return \TYPO3\CMS\Extbase\Persistence\<API key>|array The query result object or an array if $<API key> is TRUE
* @api
*/
public function execute($<API key> = FALSE) {
if ($<API key> === TRUE || $this->getQuerySettings()-><API key>() === TRUE) {
return $this->persistenceManager-><API key>($this);
} else {
return $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\<API key>', $this);
}
}
/**
* Sets the property names to order the result by. Expected like this:
* array(
* 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
* 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
* )
* where 'foo' and 'bar' are property names.
*
* @param array $orderings The property names to order by
* @return QueryInterface
* @api
*/
public function setOrderings(array $orderings) {
$this->orderings = $orderings;
return $this;
}
/**
* Returns the property names to order the result by. Like this:
* array(
* 'foo' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
* 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
* )
*
* @return array
* @api
*/
public function getOrderings() {
return $this->orderings;
}
/**
* Sets the maximum size of the result set to limit. Returns $this to allow
* for chaining (fluid interface)
*
* @param integer $limit
* @throws \<API key>
* @return QueryInterface
* @api
*/
public function setLimit($limit) {
if (!is_int($limit) || $limit < 1) {
throw new \<API key>('The limit must be an integer >= 1', 1245071870);
}
$this->limit = $limit;
return $this;
}
/**
* Resets a previously set maximum size of the result set. Returns $this to allow
* for chaining (fluid interface)
*
* @return QueryInterface
* @api
*/
public function unsetLimit() {
unset($this->limit);
return $this;
}
/**
* Returns the maximum size of the result set to limit.
*
* @return integer
* @api
*/
public function getLimit() {
return $this->limit;
}
/**
* Sets the start offset of the result set to offset. Returns $this to
* allow for chaining (fluid interface)
*
* @param integer $offset
* @throws \<API key>
* @return QueryInterface
* @api
*/
public function setOffset($offset) {
if (!is_int($offset) || $offset < 0) {
throw new \<API key>('The offset must be a positive integer', 1245071872);
}
$this->offset = $offset;
return $this;
}
/**
* Returns the start offset of the result set.
*
* @return integer
* @api
*/
public function getOffset() {
return $this->offset;
}
/**
* The constraint used to limit the result set. Returns $this to allow
* for chaining (fluid interface)
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint
* @return QueryInterface
* @api
*/
public function matching($constraint) {
$this->constraint = $constraint;
return $this;
}
/**
* Sets the statement of this query. If you use this, you will lose the abstraction from a concrete storage
* backend (database).
*
* @param string|\TYPO3\CMS\Core\Database\PreparedStatement $statement The statement
* @param array $parameters An array of parameters. These will be bound to placeholders '?' in the $statement.
* @return QueryInterface
*/
public function statement($statement, array $parameters = array()) {
$this->statement = $this->qomFactory->statement($statement, $parameters);
return $this;
}
/**
* Returns the statement of this query.
*
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement
*/
public function getStatement() {
return $this->statement;
}
/**
* Gets the constraint for this query.
*
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface|NULL the constraint, or null if none
* @api
*/
public function getConstraint() {
return $this->constraint;
}
/**
* Performs a logical conjunction of the given constraints. The method takes one or more contraints and concatenates them with a boolean AND.
* It also scepts a single array of constraints to be concatenated.
*
* @param mixed $constraint1 The first of multiple constraints or an array of constraints.
* @throws Exception\<API key>
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface
* @api
*/
public function logicalAnd($constraint1) {
if (is_array($constraint1)) {
$resultingConstraint = array_shift($constraint1);
$constraints = $constraint1;
} else {
$constraints = func_get_args();
$resultingConstraint = array_shift($constraints);
}
if ($resultingConstraint === NULL) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\<API key>('There must be at least one constraint or a non-empty array of constraints given.', 1268056288);
}
foreach ($constraints as $constraint) {
$resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint);
}
return $resultingConstraint;
}
/**
* Performs a logical disjunction of the two given constraints
*
* @param mixed $constraint1 The first of multiple constraints or an array of constraints.
* @throws Exception\<API key>
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface
* @api
*/
public function logicalOr($constraint1) {
if (is_array($constraint1)) {
$resultingConstraint = array_shift($constraint1);
$constraints = $constraint1;
} else {
$constraints = func_get_args();
$resultingConstraint = array_shift($constraints);
}
if ($resultingConstraint === NULL) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\<API key>('There must be at least one constraint or a non-empty array of constraints given.', 1268056289);
}
foreach ($constraints as $constraint) {
$resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint);
}
return $resultingConstraint;
}
/**
* Performs a logical negation of the given constraint
*
* @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint Constraint to negate
* @throws \RuntimeException
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\NotInterface
* @api
*/
public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) {
return $this->qomFactory->not($constraint);
}
/**
* Returns an equals criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @param boolean $caseSensitive Whether the equality test should be done case-sensitive
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function equals($propertyName, $operand, $caseSensitive = TRUE) {
if (is_object($operand) || $caseSensitive) {
$comparison = $this->qomFactory->comparison(
$this->qomFactory->propertyValue($propertyName, $this->getSelectorName()),
QueryInterface::OPERATOR_EQUAL_TO,
$operand
);
} else {
$comparison = $this->qomFactory->comparison(
$this->qomFactory->lowerCase($this->qomFactory->propertyValue($propertyName, $this->getSelectorName())),
QueryInterface::OPERATOR_EQUAL_TO,
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter')->conv_case(\TYPO3\CMS\Extbase\Persistence\Generic\Query::CHARSET, $operand, 'toLower')
);
}
return $comparison;
}
/**
* Returns a like criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @param boolean $caseSensitive Whether the matching should be done case-sensitive
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function like($propertyName, $operand, $caseSensitive = TRUE) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LIKE, $operand);
}
/**
* Returns a "contains" criterion used for matching objects against a query.
* It matches if the multivalued property contains the given operand.
*
* @param string $propertyName The name of the (multivalued) property to compare against
* @param mixed $operand The value to compare with
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function contains($propertyName, $operand) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_CONTAINS, $operand);
}
/**
* Returns an "in" criterion used for matching objects against a query. It
* matches if the property's value is contained in the multivalued operand.
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with, multivalued
* @throws Exception\<API key>
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function in($propertyName, $operand) {
if (!is_array($operand) && !$operand instanceof \ArrayAccess && !$operand instanceof \Traversable) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\<API key>('The "in" operator must be given a multivalued operand (array, ArrayAccess, Traversable).', 1264678095);
}
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_IN, $operand);
}
/**
* Returns a less than criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function lessThan($propertyName, $operand) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LESS_THAN, $operand);
}
/**
* Returns a less or equal than criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function lessThanOrEqual($propertyName, $operand) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::<API key>, $operand);
}
/**
* Returns a greater than criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function greaterThan($propertyName, $operand) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::<API key>, $operand);
}
/**
* Returns a greater than or equal criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function greaterThanOrEqual($propertyName, $operand) {
return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::<API key>, $operand);
}
/**
* @return void
*/
public function __wakeup() {
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\<API key>');
$this->dataMapper = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper');
$this->qomFactory = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Qom\\<API key>');
}
/**
* @return array
*/
public function __sleep() {
return array('type', 'source', 'constraint', 'statement', 'orderings', 'limit', 'offset', 'querySettings');
}
/**
* Returns the query result count.
*
* @return integer The query result count
* @api
*/
public function count() {
return $this->execute()->count();
}
/**
* Returns an "isEmpty" criterion used for matching objects against a query.
* It matches if the multivalued property contains no values or is NULL.
*
* @param string $propertyName The name of the multivalued property to compare against
* @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\<API key>
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\<API key> if used on a single-valued property
* @return bool
* @api
*/
public function isEmpty($propertyName) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\<API key>(__METHOD__);
}
}
|
#!/bin/sh
set -e
$GREP_DCTRL -I -sPackage '' 0001.out
|
file(REMOVE_RECURSE
"CMakeFiles/ortp.dir/avprofile.c.o"
"CMakeFiles/ortp.dir/b64.c.o"
"CMakeFiles/ortp.dir/event.c.o"
"CMakeFiles/ortp.dir/extremum.c.o"
"CMakeFiles/ortp.dir/jitterctl.c.o"
"CMakeFiles/ortp.dir/logging.c.o"
"CMakeFiles/ortp.dir/netsim.c.o"
"CMakeFiles/ortp.dir/ortp.c.o"
"CMakeFiles/ortp.dir/payloadtype.c.o"
"CMakeFiles/ortp.dir/port.c.o"
"CMakeFiles/ortp.dir/posixtimer.c.o"
"CMakeFiles/ortp.dir/rtcp.c.o"
"CMakeFiles/ortp.dir/rtcp_fb.c.o"
"CMakeFiles/ortp.dir/rtcp_xr.c.o"
"CMakeFiles/ortp.dir/rtcpparse.c.o"
"CMakeFiles/ortp.dir/rtpparse.c.o"
"CMakeFiles/ortp.dir/rtpprofile.c.o"
"CMakeFiles/ortp.dir/rtpsession.c.o"
"CMakeFiles/ortp.dir/rtpsession_inet.c.o"
"CMakeFiles/ortp.dir/rtpsignaltable.c.o"
"CMakeFiles/ortp.dir/rtptimer.c.o"
"CMakeFiles/ortp.dir/scheduler.c.o"
"CMakeFiles/ortp.dir/sessionset.c.o"
"CMakeFiles/ortp.dir/str_utils.c.o"
"CMakeFiles/ortp.dir/telephonyevents.c.o"
"CMakeFiles/ortp.dir/utils.c.o"
"libortp.pdb"
"libortp.a"
)
# Per-language clean rules from dependency scanning.
foreach(lang C)
include(CMakeFiles/ortp.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
|
<?php
// No direct access
defined('_JEXEC') or die;
/**
* HTML View class for the Oauth component
*/
class OauthViewOauth extends OauthView
{
/**
* The purpose of this view is to retrieve the token generated for the app
* Process flow:
* 1) Navigate to index.php/component/oauth/?view=oauth&task=authenticate&appId=[appId]
* 2) Get the device approved
* 3) Run in the background to retrieve the token generated in this view
*/
public function display() {
$model = OauthFactory::getModel('application');
$token = $model->getAppToken(JRequest::getVar('appId'));
// make sure only the token belongs to the user will be generate
if ($model->isAppBelongToUser(JRequest::getVar('appId'))) {
$vals['token'] = $token;
echo json_encode($vals);
}
exit;
}
}
|
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport('joomla.application.component.controller');
/**
* Content Component Controller
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class ContentController extends JController
{
/**
* Method to show an article as the main page display
*
* @access public
* @since 1.5
*/
function display()
{
JHTML::_('behavior.caption');
// Set a default view if none exists
if ( ! JRequest::getCmd( 'view' ) ) {
$default = JRequest::getInt('id') ? 'article' : 'frontpage';
JRequest::setVar('view', $default );
}
// View caching logic -- simple... are we logged in?
$user = &JFactory::getUser();
$view = JRequest::getVar('view');
$viewcache = JRequest::getVar('viewcache',1,'POST','INT');
if ($user->get('id') ||
($view == 'category' && JRequest::getVar('layout') != 'blog' && $viewcache == 0) ||
$view == 'archive' && $viewcache == 0) {
parent::display(false);
} else {
parent::display(true);
}
}
/**
* Edits an article
*
* @access public
* @since 1.5
*/
function edit()
{
$user =& JFactory::getUser();
// Create a user access object for the user
$access = new stdClass();
$access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
$access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
$access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
// Create the view
$view = & $this->getView('article', 'html');
// Get/Create the model
$model = & $this->getModel('Article');
// new record
if (!($access->canEdit || $access->canEditOwn)) {
JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
}
if( $model->get('id') > 1 && $user->get('gid') <= 19 && $model->get('created_by') != $user->id ) {
JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
}
if ( $model->isCheckedOut($user->get('id')))
{
$msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The item'), $model->get('title'));
$this->setRedirect(JRoute::_('index.php?view=article&id='.$model->get('id'), false), $msg);
return;
}
//Checkout the article
$model->checkout();
// Push the model into the view (as default)
$view->setModel($model, true);
// Set the layout
$view->setLayout('form');
// Display the view
$view->display();
}
/**
* Saves the content item an edit form submit
*
* @todo
*/
function save()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
// Initialize variables
$db = & JFactory::getDBO();
$user = & JFactory::getUser();
$task = JRequest::getVar('task', null, 'default', 'cmd');
// Make sure you are logged in and have the necessary access rights
if ($user->get('gid') < 19) {
JError::raiseError( 403, JText::_('ALERTNOTAUTH') );
return;
}
// Create a user access object for the user
$access = new stdClass();
$access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
$access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
$access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
if (!($access->canEdit || $access->canEditOwn)) {
JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
}
//get data from the request
$model = $this->getModel('article');
//get data from request
$post = JRequest::get('post');
$post['text'] = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW);
//preform access checks
$isNew = ((int) $post['id'] < 1);
if ($model->store($post)) {
$msg = JText::_( 'Article Saved' );
if($isNew) {
$post['id'] = (int) $model->get('id');
}
} else {
$msg = JText::_( 'Error Saving Article' );
JError::raiseError( 500, $model->getError() );
}
// manage frontpage items
//TODO : Move this into a frontpage model
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php');
$fp = new TableFrontPage($db);
if (JRequest::getVar('frontpage', false, '', 'boolean'))
{
// toggles go to first place
if (!$fp->load($post['id']))
{
// new entry
$query = 'INSERT INTO #__content_frontpage' .
' VALUES ( '.(int) $post['id'].', 1 )';
$db->setQuery($query);
if (!$db->query()) {
JError::raiseError( 500, $db->stderr());
}
$fp->ordering = 1;
}
}
else
{
// no frontpage mask
if (!$fp->delete($post['id'])) {
$msg .= $fp->stderr();
}
$fp->ordering = 0;
}
$fp->reorder();
$model->checkin();
// gets section name of item
$query = 'SELECT s.title' .
' FROM #__sections AS s' .
' WHERE s.scope = "content"' .
' AND s.id = ' . (int) $post['sectionid'];
$db->setQuery($query);
// gets category name of item
$section = $db->loadResult();
$query = 'SELECT c.title' .
' FROM #__categories AS c' .
' WHERE c.id = ' . (int) $post['catid'];
$db->setQuery($query);
$category = $db->loadResult();
if ($isNew)
{
// messaging for new items
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_messages'.DS.'tables'.DS.'message.php');
// load language for messaging
$lang =& JFactory::getLanguage();
$lang->load('com_messages');
$query = 'SELECT id' .
' FROM #__users' .
' WHERE sendEmail = 1';
$db->setQuery($query);
$users = $db->loadResultArray();
foreach ($users as $user_id)
{
$msg = new TableMessage($db);
$msg->send($user->get('id'), $user_id, JText::_('New Item'), JText::sprintf('ON_NEW_CONTENT', $user->get('username'), $post['title'], $section, $category));
}
} else {
// If the article isn't new, then we need to clean the cache so that our changes appear realtime :)
$cache = &JFactory::getCache('com_content');
$cache->clean();
}
if ($access->canPublish)
{
// Publishers, admins, etc just get the stock msg
$msg = JText::_('Item successfully saved.');
}
else
{
$msg = $isNew ? JText::_('THANK_SUB') : JText::_('Item successfully saved.');
}
$referer = JRequest::getString('ret', base64_encode(JURI::base()), 'get');
$referer = base64_decode($referer);
if (!JURI::isInternal($referer)) {
$referer = '';
}
$this->setRedirect($referer, $msg);
}
/**
* Cancels an edit article operation
*
* @access public
* @since 1.5
*/
function cancel()
{
// Initialize some variables
$db = & JFactory::getDBO();
$user = & JFactory::getUser();
// Get an article table object and bind post variabes to it [We don't need a full model here]
$article = & JTable::getInstance('content');
$article->bind(JRequest::get('post'));
if ($user->authorize('com_content', 'edit', 'content', 'all') || ($user->authorize('com_content', 'edit', 'content', 'own') && $article->created_by == $user->get('id'))) {
$article->checkin();
}
// If the task was edit or cancel, we go back to the content item
$referer = JRequest::getString('ret', base64_encode(JURI::base()), 'get');
$referer = base64_decode($referer);
if (!JURI::isInternal($referer)) {
$referer = '';
}
$this->setRedirect($referer);
}
/**
* Rates an article
*
* @access public
* @since 1.5
*/
function vote()
{
$url = JRequest::getVar('url', '', 'default', 'string');
$rating = JRequest::getVar('user_rating', 0, '', 'int');
$id = JRequest::getVar('cid', 0, '', 'int');
// Get/Create the model
$model = & $this->getModel('Article' );
$model->setId($id);
if(!JURI::isInternal($url)) {
$url = JRoute::_('index.php?option=com_content&view=article&id='.$id);
}
if ($model->storeVote($rating)) {
$this->setRedirect($url, JText::_('Thanks for rating!'));
} else {
$this->setRedirect($url, JText::_('You already rated this article today!'));
}
}
/**
* Searches for an item by a key parameter
*
* @access public
* @since 1.5
*/
function findkey()
{
// Initialize variables
$db = & JFactory::getDBO();
$keyref = JRequest::getVar('keyref', null, 'default', 'cmd');
JRequest::setVar('keyref', $keyref);
// If no keyref left, throw 404
if( empty($keyref) === true ) {
JError::raiseError( 404, JText::_("Key Not Found") );
}
$keyref = $db->Quote( '%keyref='.$db->getEscaped( $keyref, true ).'%', false );
$query = 'SELECT id' .
' FROM #__content' .
' WHERE attribs LIKE '.$keyref;
$db->setQuery($query);
$id = (int) $db->loadResult();
if ($id > 0)
{
// Create the view
$view =& $this->getView('article', 'html');
// Get/Create the model
$model =& $this->getModel('Article' );
// Set the id of the article to display
$model->setId($id);
// Push the model into the view (as default)
$view->setModel($model, true);
// Display the view
$view->display();
}
else {
JError::raiseError( 404, JText::_( 'Key Not Found' ) );
}
}
/**
* Output the pagebreak dialog
*
* @access public
* @since 1.5
*/
function ins_pagebreak()
{
// Create the view
$view = & $this->getView('article', 'html');
// Set the layout
$view->setLayout('pagebreak');
// Display the view
$view->display();
}
}
|
#include "precompiled.hpp"
#include "ci/bcEscapeAnalyzer.hpp"
#include "compiler/oopMap.hpp"
#include "opto/callGenerator.hpp"
#include "opto/callnode.hpp"
#include "opto/escape.hpp"
#include "opto/locknode.hpp"
#include "opto/machnode.hpp"
#include "opto/matcher.hpp"
#include "opto/parse.hpp"
#include "opto/regalloc.hpp"
#include "opto/regmask.hpp"
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
// Portions of code courtesy of Clifford Click
// Optimization - Graph Style
uint StartNode::size_of() const { return sizeof(*this); }
uint StartNode::cmp( const Node &n ) const
{ return _domain == ((StartNode&)n)._domain; }
const Type *StartNode::bottom_type() const { return _domain; }
const Type *StartNode::Value(PhaseTransform *phase) const { return _domain; }
#ifndef PRODUCT
void StartNode::dump_spec(outputStream *st) const { st->print(" #"); _domain->dump_on(st);}
#endif
Node *StartNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
void StartNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
Matcher::calling_convention( sig_bt, parm_regs, argcnt, false );
}
const RegMask &StartNode::in_RegMask(uint) const {
return RegMask::Empty;
}
// Construct projections for incoming parameters, and their RegMask info
Node *StartNode::match( const ProjNode *proj, const Matcher *match ) {
switch (proj->_con) {
case TypeFunc::Control:
case TypeFunc::I_O:
case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::FramePtr:
return new (match->C) MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP);
case TypeFunc::ReturnAdr:
return new (match->C) MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP);
case TypeFunc::Parms:
default: {
uint parm_num = proj->_con - TypeFunc::Parms;
const Type *t = _domain->field_at(proj->_con);
if (t->base() == Type::Half) // 2nd half of Longs and Doubles
return new (match->C) ConNode(Type::TOP);
uint ideal_reg = t->ideal_reg();
RegMask &rm = match-><API key>[parm_num];
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg);
}
}
return NULL;
}
// The method start node for an on stack replacement adapter
const TypeTuple *StartOSRNode::osr_domain() {
const Type **fields = TypeTuple::fields(2);
fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // address of osr buffer
return TypeTuple::make(TypeFunc::Parms+1, fields);
}
const char * const ParmNode::names[TypeFunc::Parms+1] = {
"Control", "I_O", "Memory", "FramePtr", "ReturnAdr", "Parms"
};
#ifndef PRODUCT
void ParmNode::dump_spec(outputStream *st) const {
if( _con < TypeFunc::Parms ) {
st->print("%s", names[_con]);
} else {
st->print("Parm%d: ",_con-TypeFunc::Parms);
// Verbose and WizardMode dump bottom_type for all nodes
if( !Verbose && !WizardMode ) bottom_type()->dump_on(st);
}
}
#endif
uint ParmNode::ideal_reg() const {
switch( _con ) {
case TypeFunc::Control : // fall through
case TypeFunc::I_O : // fall through
case TypeFunc::Memory : return 0;
case TypeFunc::FramePtr : // fall through
case TypeFunc::ReturnAdr: return Op_RegP;
default : assert( _con > TypeFunc::Parms, "" );
// fall through
case TypeFunc::Parms : {
// Type of argument being passed
const Type *t = in(0)->as_Start()->_domain->field_at(_con);
return t->ideal_reg();
}
}
ShouldNotReachHere();
return 0;
}
ReturnNode::ReturnNode(uint edges, Node *cntrl, Node *i_o, Node *memory, Node *frameptr, Node *retadr ) : Node(edges) {
init_req(TypeFunc::Control,cntrl);
init_req(TypeFunc::I_O,i_o);
init_req(TypeFunc::Memory,memory);
init_req(TypeFunc::FramePtr,frameptr);
init_req(TypeFunc::ReturnAdr,retadr);
}
Node *ReturnNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
const Type *ReturnNode::Value( PhaseTransform *phase ) const {
return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
? Type::TOP
: Type::BOTTOM;
}
// Do we Match on this edge index or not? No edges on return nodes
uint ReturnNode::match_edge(uint idx) const {
return 0;
}
#ifndef PRODUCT
void ReturnNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("returns");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
}
#endif
RethrowNode::RethrowNode(
Node* cntrl,
Node* i_o,
Node* memory,
Node* frameptr,
Node* ret_adr,
Node* exception
) : Node(TypeFunc::Parms + 1) {
init_req(TypeFunc::Control , cntrl );
init_req(TypeFunc::I_O , i_o );
init_req(TypeFunc::Memory , memory );
init_req(TypeFunc::FramePtr , frameptr );
init_req(TypeFunc::ReturnAdr, ret_adr);
init_req(TypeFunc::Parms , exception);
}
Node *RethrowNode::Ideal(PhaseGVN *phase, bool can_reshape){
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
const Type *RethrowNode::Value( PhaseTransform *phase ) const {
return (phase->type(in(TypeFunc::Control)) == Type::TOP)
? Type::TOP
: Type::BOTTOM;
}
uint RethrowNode::match_edge(uint idx) const {
return 0;
}
#ifndef PRODUCT
void RethrowNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("exception");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
}
#endif
// Do we Match on this edge index or not? Match only target address & method
uint TailCallNode::match_edge(uint idx) const {
return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
}
// Do we Match on this edge index or not? Match only target address & oop
uint TailJumpNode::match_edge(uint idx) const {
return TypeFunc::Parms <= idx && idx <= TypeFunc::Parms+1;
}
JVMState::JVMState(ciMethod* method, JVMState* caller) :
_method(method) {
assert(method != NULL, "must be valid call site");
_reexecute = Reexecute_Undefined;
debug_only(_bci = -99); // random garbage value
debug_only(_map = (SafePointNode*)-1);
_caller = caller;
_depth = 1 + (caller == NULL ? 0 : caller->depth());
_locoff = TypeFunc::Parms;
_stkoff = _locoff + _method->max_locals();
_monoff = _stkoff + _method->max_stack();
_scloff = _monoff;
_endoff = _monoff;
_sp = 0;
}
JVMState::JVMState(int stack_size) :
_method(NULL) {
_bci = InvocationEntryBci;
_reexecute = Reexecute_Undefined;
debug_only(_map = (SafePointNode*)-1);
_caller = NULL;
_depth = 1;
_locoff = TypeFunc::Parms;
_stkoff = _locoff;
_monoff = _stkoff + stack_size;
_scloff = _monoff;
_endoff = _monoff;
_sp = 0;
}
JVMState* JVMState::of_depth(int d) const {
const JVMState* jvmp = this;
assert(0 < d && (uint)d <= depth(), "oob");
for (int skip = depth() - d; skip > 0; skip
jvmp = jvmp->caller();
}
assert(jvmp->depth() == (uint)d, "found the right one");
return (JVMState*)jvmp;
}
bool JVMState::same_calls_as(const JVMState* that) const {
if (this == that) return true;
if (this->depth() != that->depth()) return false;
const JVMState* p = this;
const JVMState* q = that;
for (;;) {
if (p->_method != q->_method) return false;
if (p->_method == NULL) return true; // bci is irrelevant
if (p->_bci != q->_bci) return false;
if (p->_reexecute != q->_reexecute) return false;
p = p->caller();
q = q->caller();
if (p == q) return true;
assert(p != NULL && q != NULL, "depth check ensures we don't run off end");
}
}
uint JVMState::debug_start() const {
debug_only(JVMState* jvmroot = of_depth(1));
assert(jvmroot->locoff() <= this->locoff(), "youngest JVMState must be last");
return of_depth(1)->locoff();
}
uint JVMState::debug_end() const {
debug_only(JVMState* jvmroot = of_depth(1));
assert(jvmroot->endoff() <= this->endoff(), "youngest JVMState must be last");
return endoff();
}
uint JVMState::debug_depth() const {
uint total = 0;
for (const JVMState* jvmp = this; jvmp != NULL; jvmp = jvmp->caller()) {
total += jvmp->debug_size();
}
return total;
}
#ifndef PRODUCT
// Given an allocation (a Chaitin object) and a Node decide if the Node carries
// any defined value or not. If it does, print out the register or constant.
static void format_helper( PhaseRegAlloc *regalloc, outputStream* st, Node *n, const char *msg, uint i, GrowableArray<<API key>*> *scobjs ) {
if (n == NULL) { st->print(" NULL"); return; }
if (n-><API key>()) {
// Scalar replacement.
<API key>* spobj = n-><API key>();
scobjs->append_if_missing(spobj);
int sco_n = scobjs->find(spobj);
assert(sco_n >= 0, "");
st->print(" %s%d]=#ScObj" INT32_FORMAT, msg, i, sco_n);
return;
}
if (regalloc->node_regs_max_index() > 0 &&
OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
char buf[50];
regalloc->dump_register(n,buf);
st->print(" %s%d]=%s",msg,i,buf);
} else { // No register, but might be constant
const Type *t = n->bottom_type();
switch (t->base()) {
case Type::Int:
st->print(" %s%d]=#"INT32_FORMAT,msg,i,t->is_int()->get_con());
break;
case Type::AnyPtr:
assert( t == TypePtr::NULL_PTR || n->in_dump(), "" );
st->print(" %s%d]=#NULL",msg,i);
break;
case Type::AryPtr:
case Type::InstPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop()));
break;
case Type::KlassPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass()));
break;
case Type::MetadataPtr:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata()));
break;
case Type::NarrowOop:
st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop()));
break;
case Type::RawPtr:
st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr()));
break;
case Type::DoubleCon:
st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d);
break;
case Type::FloatCon:
st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f);
break;
case Type::Long:
st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con()));
break;
case Type::Half:
case Type::Top:
st->print(" %s%d]=_",msg,i);
break;
default: ShouldNotReachHere();
}
}
}
void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const {
st->print("
if (_method) {
_method->print_short_name(st);
st->print(" @ bci:%d ",_bci);
} else {
st->print_cr(" runtime stub ");
return;
}
if (n->is_MachSafePoint()) {
GrowableArray<<API key>*> scobjs;
MachSafePointNode *mcall = n->as_MachSafePoint();
uint i;
// Print locals
for (i = 0; i < (uint)loc_size(); i++)
format_helper(regalloc, st, mcall->local(this, i), "L[", i, &scobjs);
// Print stack
for (i = 0; i < (uint)stk_size(); i++) {
if ((uint)(_stkoff + i) >= mcall->len())
st->print(" oob ");
else
format_helper(regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs);
}
for (i = 0; (int)i < nof_monitors(); i++) {
Node *box = mcall->monitor_box(this, i);
Node *obj = mcall->monitor_obj(this, i);
if (regalloc->node_regs_max_index() > 0 &&
OptoReg::is_valid(regalloc->get_reg_first(box))) {
box = BoxLockNode::box_node(box);
format_helper(regalloc, st, box, "MON-BOX[", i, &scobjs);
} else {
OptoReg::Name box_reg = BoxLockNode::reg(box);
st->print(" MON-BOX%d=%s+%d",
i,
OptoReg::regname(OptoReg::c_frame_pointer),
regalloc->reg2offset(box_reg));
}
const char* obj_msg = "MON-OBJ[";
if (EliminateLocks) {
if (BoxLockNode::box_node(box)->is_eliminated())
obj_msg = "MON-OBJ(LOCK ELIMINATED)[";
}
format_helper(regalloc, st, obj, obj_msg, i, &scobjs);
}
for (i = 0; i < (uint)scobjs.length(); i++) {
// Scalar replaced objects.
st->cr();
st->print(" # ScObj" INT32_FORMAT " ", i);
<API key>* spobj = scobjs.at(i);
ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass();
assert(cik->is_instance_klass() ||
cik->is_array_klass(), "Not supported allocation.");
ciInstanceKlass *iklass = NULL;
if (cik->is_instance_klass()) {
cik->print_name_on(st);
iklass = cik->as_instance_klass();
} else if (cik->is_type_array_klass()) {
cik->as_array_klass()->base_element_type()->print_name_on(st);
st->print("[%d]", spobj->n_fields());
} else if (cik->is_obj_array_klass()) {
ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
if (cie->is_instance_klass()) {
cie->print_name_on(st);
} else if (cie->is_type_array_klass()) {
cie->as_array_klass()->base_element_type()->print_name_on(st);
} else {
ShouldNotReachHere();
}
st->print("[%d]", spobj->n_fields());
int ndim = cik->as_array_klass()->dimension() - 1;
while (ndim
st->print("[]");
}
}
st->print("={");
uint nf = spobj->n_fields();
if (nf > 0) {
uint first_ind = spobj->first_index(mcall->jvms());
Node* fld_node = mcall->in(first_ind);
ciField* cifield;
if (iklass != NULL) {
st->print(" [");
cifield = iklass->nonstatic_field_at(0);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
} else {
format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
}
for (uint j = 1; j < nf; j++) {
fld_node = mcall->in(first_ind+j);
if (iklass != NULL) {
st->print(", [");
cifield = iklass->nonstatic_field_at(j);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", j, &scobjs);
} else {
format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
}
}
}
st->print(" }");
}
}
st->cr();
if (caller() != NULL) caller()->format(regalloc, n, st);
}
void JVMState::dump_spec(outputStream *st) const {
if (_method != NULL) {
bool printed = false;
if (!Verbose) {
// The JVMS dumps make really, really long lines.
// Take out the most boring parts, which are the package prefixes.
char buf[500];
stringStream namest(buf, sizeof(buf));
_method->print_short_name(&namest);
if (namest.count() < sizeof(buf)) {
const char* name = namest.base();
if (name[0] == ' ') ++name;
const char* endcn = strchr(name, ':'); // end of class name
if (endcn == NULL) endcn = strchr(name, '(');
if (endcn == NULL) endcn = name + strlen(name);
while (endcn > name && endcn[-1] != '.' && endcn[-1] != '/')
--endcn;
st->print(" %s", endcn);
printed = true;
}
}
if (!printed)
_method->print_short_name(st);
st->print(" @ bci:%d",_bci);
if(_reexecute == Reexecute_True)
st->print(" reexecute");
} else {
st->print(" runtime stub");
}
if (caller() != NULL) caller()->dump_spec(st);
}
void JVMState::dump_on(outputStream* st) const {
bool print_map = _map && !((uintptr_t)_map & 1) &&
((caller() == NULL) || (caller()->map() != _map));
if (print_map) {
if (_map->len() > _map->req()) { // _map->has_exceptions()
Node* ex = _map->in(_map->req()); // _map->next_exception()
// skip the first one; it's already being printed
while (ex != NULL && ex->len() > ex->req()) {
ex = ex->in(ex->req()); // ex->next_exception()
ex->dump(1);
}
}
_map->dump(Verbose ? 2 : 1);
}
if (caller() != NULL) {
caller()->dump_on(st);
}
st->print("JVMS depth=%d loc=%d stk=%d arg=%d mon=%d scalar=%d end=%d mondepth=%d sp=%d bci=%d reexecute=%s method=",
depth(), locoff(), stkoff(), argoff(), monoff(), scloff(), endoff(), monitor_depth(), sp(), bci(), should_reexecute()?"true":"false");
if (_method == NULL) {
st->print_cr("(none)");
} else {
_method->print_name(st);
st->cr();
if (bci() >= 0 && bci() < _method->code_size()) {
st->print(" bc: ");
_method->print_codes_on(bci(), bci()+1, st);
}
}
}
// Extra way to dump a jvms from the debugger,
// to avoid a bug with C++ member function calls.
void dump_jvms(JVMState* jvms) {
jvms->dump();
}
#endif
JVMState* JVMState::clone_shallow(Compile* C) const {
JVMState* n = has_method() ? new (C) JVMState(_method, _caller) : new (C) JVMState(0);
n->set_bci(_bci);
n->_reexecute = _reexecute;
n->set_locoff(_locoff);
n->set_stkoff(_stkoff);
n->set_monoff(_monoff);
n->set_scloff(_scloff);
n->set_endoff(_endoff);
n->set_sp(_sp);
n->set_map(_map);
return n;
}
JVMState* JVMState::clone_deep(Compile* C) const {
JVMState* n = clone_shallow(C);
for (JVMState* p = n; p->_caller != NULL; p = p->_caller) {
p->_caller = p->_caller->clone_shallow(C);
}
assert(n->depth() == depth(), "sanity");
assert(n->debug_depth() == debug_depth(), "sanity");
return n;
}
/**
* Reset map for all callers
*/
void JVMState::set_map_deep(SafePointNode* map) {
for (JVMState* p = this; p->_caller != NULL; p = p->_caller) {
p->set_map(map);
}
}
// Adapt offsets in in-array after adding or removing an edge.
// Prerequisite is that the JVMState is used by only one node.
void JVMState::adapt_position(int delta) {
for (JVMState* jvms = this; jvms != NULL; jvms = jvms->caller()) {
jvms->set_locoff(jvms->locoff() + delta);
jvms->set_stkoff(jvms->stkoff() + delta);
jvms->set_monoff(jvms->monoff() + delta);
jvms->set_scloff(jvms->scloff() + delta);
jvms->set_endoff(jvms->endoff() + delta);
}
}
// Mirror the stack size calculation in the deopt code
// How much stack space would we need at this point in the program in
// case of deoptimization?
int JVMState::<API key>() const {
const JVMState* jvms = this;
int size = 0;
int callee_parameters = 0;
int callee_locals = 0;
int extra_args = method()->max_stack() - stk_size();
while (jvms != NULL) {
int locks = jvms->nof_monitors();
int temps = jvms->stk_size();
bool is_top_frame = (jvms == this);
ciMethod* method = jvms->method();
int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(),
temps + callee_parameters,
extra_args,
locks,
callee_parameters,
callee_locals,
is_top_frame);
size += frame_size;
callee_parameters = method->size_of_parameters();
callee_locals = method->max_locals();
extra_args = 0;
jvms = jvms->caller();
}
return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
}
uint CallNode::cmp( const Node &n ) const
{ return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; }
#ifndef PRODUCT
void CallNode::dump_req(outputStream *st) const {
// Dump the required inputs, enclosed in '(' and ')'
uint i; // Exit value of loop
for (i = 0; i < req(); i++) { // For all required inputs
if (i == TypeFunc::Parms) st->print("(");
if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
else st->print("_ ");
}
st->print(")");
}
void CallNode::dump_spec(outputStream *st) const {
st->print(" ");
tf()->dump_on(st);
if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
if (jvms() != NULL) jvms()->dump_spec(st);
}
#endif
const Type *CallNode::bottom_type() const { return tf()->range(); }
const Type *CallNode::Value(PhaseTransform *phase) const {
if (phase->type(in(0)) == Type::TOP) return Type::TOP;
return tf()->range();
}
void CallNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
// Use the standard compiler calling convention
Matcher::calling_convention( sig_bt, parm_regs, argcnt, true );
}
// Construct projections for control, I/O, memory-fields, ..., and
// return result(s) along with their RegMask info
Node *CallNode::match( const ProjNode *proj, const Matcher *match ) {
switch (proj->_con) {
case TypeFunc::Control:
case TypeFunc::I_O:
case TypeFunc::Memory:
return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::Parms+1: // For LONG & DOUBLE returns
assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, "");
// 2nd half of doubles and longs
return new (match->C) MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad);
case TypeFunc::Parms: { // Normal returns
uint ideal_reg = tf()->range()->field_at(TypeFunc::Parms)->ideal_reg();
OptoRegPair regs = is_CallRuntime()
? match->c_return_value(ideal_reg,true) // Calls into C runtime
: match-> return_value(ideal_reg,true); // Calls into compiled Java code
RegMask rm = RegMask(regs.first());
if( OptoReg::is_valid(regs.second()) )
rm.Insert( regs.second() );
return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg);
}
case TypeFunc::ReturnAdr:
case TypeFunc::FramePtr:
default:
ShouldNotReachHere();
}
return NULL;
}
// Do we Match on this edge index or not? Match no edges
uint CallNode::match_edge(uint idx) const {
return 0;
}
// Determine whether the call could modify the field of the specified
// instance at the specified offset.
bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
assert((t_oop != NULL), "sanity");
if (t_oop->is_known_instance()) {
// The instance_id is set only for scalar-replaceable allocations which
// are not passed as arguments according to Escape Analysis.
return false;
}
if (t_oop-><API key>()) {
ciKlass* boxing_klass = t_oop->klass();
if (is_CallStaticJava() && as_CallStaticJava()->is_boxing_method()) {
// Skip unrelated boxing methods.
Node* proj = proj_out(TypeFunc::Parms);
if ((proj == NULL) || (phase->type(proj)->is_instptr()->klass() != boxing_klass)) {
return false;
}
}
if (is_CallJava() && as_CallJava()->method() != NULL) {
ciMethod* meth = as_CallJava()->method();
if (meth->is_accessor()) {
return false;
}
// May modify (by reflection) if an boxing object is passed
// as argument or returned.
if (returns_pointer() && (proj_out(TypeFunc::Parms) != NULL)) {
Node* proj = proj_out(TypeFunc::Parms);
const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
const TypeTuple* d = tf()->domain();
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
const TypeInstPtr* inst_t = d->field_at(i)->isa_instptr();
if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
(inst_t->klass() == boxing_klass))) {
return true;
}
}
return false;
}
}
return true;
}
// Does this call have a direct reference to n other than debug information?
bool CallNode::has_non_debug_use(Node *n) {
const TypeTuple * d = tf()->domain();
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
Node *arg = in(i);
if (arg == n) {
return true;
}
}
return false;
}
// Returns the unique CheckCastPP of a call
// or 'this' if there are several CheckCastPP
// or returns NULL if there is no one.
Node *CallNode::result_cast() {
Node *cast = NULL;
Node *p = proj_out(TypeFunc::Parms);
if (p == NULL)
return NULL;
for (DUIterator_Fast imax, i = p->fast_outs(imax); i < imax; i++) {
Node *use = p->fast_out(i);
if (use->is_CheckCastPP()) {
if (cast != NULL) {
return this; // more than 1 CheckCastPP
}
cast = use;
}
}
return cast;
}
void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj) {
projs->fallthrough_proj = NULL;
projs-><API key> = NULL;
projs->fallthrough_ioproj = NULL;
projs->catchall_ioproj = NULL;
projs->catchall_catchproj = NULL;
projs->fallthrough_memproj = NULL;
projs->catchall_memproj = NULL;
projs->resproj = NULL;
projs->exobj = NULL;
for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
ProjNode *pn = fast_out(i)->as_Proj();
if (pn->outcnt() == 0) continue;
switch (pn->_con) {
case TypeFunc::Control:
{
// For Control (fallthrough) and I_O (catch_all_index) we have CatchProj -> Catch -> Proj
projs->fallthrough_proj = pn;
DUIterator_Fast jmax, j = pn->fast_outs(jmax);
const Node *cn = pn->fast_out(j);
if (cn->is_Catch()) {
ProjNode *cpn = NULL;
for (DUIterator_Fast kmax, k = cn->fast_outs(kmax); k < kmax; k++) {
cpn = cn->fast_out(k)->as_Proj();
assert(cpn->is_CatchProj(), "must be a CatchProjNode");
if (cpn->_con == CatchProjNode::fall_through_index)
projs-><API key> = cpn;
else {
assert(cpn->_con == CatchProjNode::catch_all_index, "must be correct index.");
projs->catchall_catchproj = cpn;
}
}
}
break;
}
case TypeFunc::I_O:
if (pn->_is_io_use)
projs->catchall_ioproj = pn;
else
projs->fallthrough_ioproj = pn;
for (DUIterator j = pn->outs(); pn->has_out(j); j++) {
Node* e = pn->out(j);
if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj() && e->outcnt() > 0) {
assert(projs->exobj == NULL, "only one");
projs->exobj = e;
}
}
break;
case TypeFunc::Memory:
if (pn->_is_io_use)
projs->catchall_memproj = pn;
else
projs->fallthrough_memproj = pn;
break;
case TypeFunc::Parms:
projs->resproj = pn;
break;
default:
assert(false, "unexpected projection from allocation node.");
}
}
// The resproj may not exist because the result couuld be ignored
// and the exception object may not exist if an exception handler
// swallows the exception but all the other must exist and be found.
assert(projs->fallthrough_proj != NULL, "must be found");
assert(Compile::current()-><API key>() || projs-><API key> != NULL, "must be found");
assert(Compile::current()-><API key>() || projs->fallthrough_memproj != NULL, "must be found");
assert(Compile::current()-><API key>() || projs->fallthrough_ioproj != NULL, "must be found");
assert(Compile::current()-><API key>() || projs->catchall_catchproj != NULL, "must be found");
if (separate_io_proj) {
assert(Compile::current()-><API key>() || projs->catchall_memproj != NULL, "must be found");
assert(Compile::current()-><API key>() || projs->catchall_ioproj != NULL, "must be found");
}
}
Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) {
CallGenerator* cg = generator();
if (can_reshape && cg != NULL && cg->is_mh_late_inline() && !cg->already_attempted()) {
// Check whether this MH handle call becomes a candidate for inlining
ciMethod* callee = cg->method();
vmIntrinsics::ID iid = callee->intrinsic_id();
if (iid == vmIntrinsics::_invokeBasic) {
if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
phase->C->prepend_late_inline(cg);
set_generator(NULL);
}
} else {
assert(callee->has_member_arg(), "wrong type of call?");
if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
phase->C->prepend_late_inline(cg);
set_generator(NULL);
}
}
}
return SafePointNode::Ideal(phase, can_reshape);
}
uint CallJavaNode::size_of() const { return sizeof(*this); }
uint CallJavaNode::cmp( const Node &n ) const {
CallJavaNode &call = (CallJavaNode&)n;
return CallNode::cmp(call) && _method == call._method;
}
#ifndef PRODUCT
void CallJavaNode::dump_spec(outputStream *st) const {
if( _method ) _method->print_short_name(st);
CallNode::dump_spec(st);
}
#endif
uint CallStaticJavaNode::size_of() const { return sizeof(*this); }
uint CallStaticJavaNode::cmp( const Node &n ) const {
CallStaticJavaNode &call = (CallStaticJavaNode&)n;
return CallJavaNode::cmp(call);
}
// If this is an uncommon trap, return the request code, else zero.
int CallStaticJavaNode::<API key>() const {
if (_name != NULL && !strcmp(_name, "uncommon_trap")) {
return <API key>(this);
}
return 0;
}
int CallStaticJavaNode::<API key>(const Node* call) {
#ifndef PRODUCT
if (!(call->req() > TypeFunc::Parms &&
call->in(TypeFunc::Parms) != NULL &&
call->in(TypeFunc::Parms)->is_Con())) {
assert(in_dump() != 0, "OK if dumping");
tty->print("[bad uncommon trap]");
return 0;
}
#endif
return call->in(TypeFunc::Parms)->bottom_type()->is_int()->get_con();
}
#ifndef PRODUCT
void CallStaticJavaNode::dump_spec(outputStream *st) const {
st->print("# Static ");
if (_name != NULL) {
st->print("%s", _name);
int trap_req = <API key>();
if (trap_req != 0) {
char buf[100];
st->print("(%s)",
Deoptimization::format_trap_request(buf, sizeof(buf),
trap_req));
}
st->print(" ");
}
CallJavaNode::dump_spec(st);
}
#endif
uint CallDynamicJavaNode::size_of() const { return sizeof(*this); }
uint CallDynamicJavaNode::cmp( const Node &n ) const {
CallDynamicJavaNode &call = (CallDynamicJavaNode&)n;
return CallJavaNode::cmp(call);
}
#ifndef PRODUCT
void CallDynamicJavaNode::dump_spec(outputStream *st) const {
st->print("# Dynamic ");
CallJavaNode::dump_spec(st);
}
#endif
uint CallRuntimeNode::size_of() const { return sizeof(*this); }
uint CallRuntimeNode::cmp( const Node &n ) const {
CallRuntimeNode &call = (CallRuntimeNode&)n;
return CallNode::cmp(call) && !strcmp(_name,call._name);
}
#ifndef PRODUCT
void CallRuntimeNode::dump_spec(outputStream *st) const {
st->print("
st->print("%s", _name);
CallNode::dump_spec(st);
}
#endif
void CallRuntimeNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const {
Matcher::<API key>( sig_bt, parm_regs, argcnt );
}
#ifndef PRODUCT
void CallLeafNode::dump_spec(outputStream *st) const {
st->print("
st->print("%s", _name);
CallNode::dump_spec(st);
}
#endif
void SafePointNode::set_local(JVMState* jvms, uint idx, Node *c) {
assert(verify_jvms(jvms), "jvms must match");
int loc = jvms->locoff() + idx;
if (in(loc)->is_top() && idx > 0 && !c->is_top() ) {
// If current local idx is top then local idx - 1 could
// be a long/double that needs to be killed since top could
// represent the 2nd half ofthe long/double.
uint ideal = in(loc -1)->ideal_reg();
if (ideal == Op_RegD || ideal == Op_RegL) {
// set other (low index) half to top
set_req(loc - 1, in(loc));
}
}
set_req(loc, c);
}
uint SafePointNode::size_of() const { return sizeof(*this); }
uint SafePointNode::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
void SafePointNode::set_next_exception(SafePointNode* n) {
assert(n == NULL || n->Opcode() == Op_SafePoint, "correct value for next_exception");
if (len() == req()) {
if (n != NULL) add_prec(n);
} else {
set_prec(req(), n);
}
}
SafePointNode* SafePointNode::next_exception() const {
if (len() == req()) {
return NULL;
} else {
Node* n = in(req());
assert(n == NULL || n->Opcode() == Op_SafePoint, "no other uses of prec edges");
return (SafePointNode*) n;
}
}
// Skip over any collapsed Regions
Node *SafePointNode::Ideal(PhaseGVN *phase, bool can_reshape) {
return remove_dead_region(phase, can_reshape) ? this : NULL;
}
// Remove obviously duplicate safepoints
Node *SafePointNode::Identity( PhaseTransform *phase ) {
// If you have back to back safepoints, remove one
if( in(TypeFunc::Control)->is_SafePoint() )
return in(TypeFunc::Control);
if( in(0)->is_Proj() ) {
Node *n0 = in(0)->in(0);
// Check if he is a call projection (except Leaf Call)
if( n0->is_Catch() ) {
n0 = n0->in(0)->in(0);
assert( n0->is_Call(), "expect a call here" );
}
if( n0->is_Call() && n0->as_Call()-><API key>() ) {
// Useless Safepoint, so remove it
return in(TypeFunc::Control);
}
}
return this;
}
const Type *SafePointNode::Value( PhaseTransform *phase ) const {
if( phase->type(in(0)) == Type::TOP ) return Type::TOP;
if( phase->eqv( in(0), this ) ) return Type::TOP; // Dead infinite loop
return Type::CONTROL;
}
#ifndef PRODUCT
void SafePointNode::dump_spec(outputStream *st) const {
st->print(" SafePoint ");
}
#endif
const RegMask &SafePointNode::in_RegMask(uint idx) const {
if( idx < TypeFunc::Parms ) return RegMask::Empty;
// Values outside the domain represent debug info
return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
}
const RegMask &SafePointNode::out_RegMask() const {
return RegMask::Empty;
}
void SafePointNode::grow_stack(JVMState* jvms, uint grow_by) {
assert((int)grow_by > 0, "sanity");
int monoff = jvms->monoff();
int scloff = jvms->scloff();
int endoff = jvms->endoff();
assert(endoff == (int)req(), "no other states or debug info after me");
Node* top = Compile::current()->top();
for (uint i = 0; i < grow_by; i++) {
ins_req(monoff, top);
}
jvms->set_monoff(monoff + grow_by);
jvms->set_scloff(scloff + grow_by);
jvms->set_endoff(endoff + grow_by);
}
void SafePointNode::push_monitor(const FastLockNode *lock) {
// Add a LockNode, which points to both the original BoxLockNode (the
// stack space for the monitor) and the Object being locked.
const int MonitorEdges = 2;
assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
assert(req() == jvms()->endoff(), "correct sizing");
int nextmon = jvms()->scloff();
if (<API key>) {
ins_req(nextmon, lock->box_node());
ins_req(nextmon+1, lock->obj_node());
} else {
Node* top = Compile::current()->top();
ins_req(nextmon, top);
ins_req(nextmon, top);
}
jvms()->set_scloff(nextmon + MonitorEdges);
jvms()->set_endoff(req());
}
void SafePointNode::pop_monitor() {
// Delete last monitor from debug info
debug_only(int num_before_pop = jvms()->nof_monitors());
const int MonitorEdges = 2;
assert(JVMState::logMonitorEdges == exact_log2(MonitorEdges), "correct MonitorEdges");
int scloff = jvms()->scloff();
int endoff = jvms()->endoff();
int new_scloff = scloff - MonitorEdges;
int new_endoff = endoff - MonitorEdges;
jvms()->set_scloff(new_scloff);
jvms()->set_endoff(new_endoff);
while (scloff > new_scloff) del_req_ordered(--scloff);
assert(jvms()->nof_monitors() == num_before_pop-1, "");
}
Node *SafePointNode::peek_monitor_box() const {
int mon = jvms()->nof_monitors() - 1;
assert(mon >= 0, "most have a monitor");
return monitor_box(jvms(), mon);
}
Node *SafePointNode::peek_monitor_obj() const {
int mon = jvms()->nof_monitors() - 1;
assert(mon >= 0, "most have a monitor");
return monitor_obj(jvms(), mon);
}
// Do we Match on this edge index or not? Match no edges
uint SafePointNode::match_edge(uint idx) const {
if( !<API key>() )
return 0;
return (TypeFunc::Parms == idx);
}
<API key>::<API key>(const TypeOopPtr* tp,
#ifdef ASSERT
AllocateNode* alloc,
#endif
uint first_index,
uint n_fields) :
TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
#ifdef ASSERT
_alloc(alloc),
#endif
_first_index(first_index),
_n_fields(n_fields)
{
init_class_id(<API key>);
}
// Do not allow value-numbering for <API key> node.
uint <API key>::hash() const { return NO_HASH; }
uint <API key>::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
uint <API key>::ideal_reg() const {
return 0; // No matching to machine instruction
}
const RegMask &<API key>::in_RegMask(uint idx) const {
return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
}
const RegMask &<API key>::out_RegMask() const {
return RegMask::Empty;
}
uint <API key>::match_edge(uint idx) const {
return 0;
}
<API key>*
<API key>::clone(Dict* sosn_map) const {
void* cached = (*sosn_map)[(void*)this];
if (cached != NULL) {
return (<API key>*)cached;
}
<API key>* res = (<API key>*)Node::clone();
sosn_map->Insert((void*)this, (void*)res);
return res;
}
#ifndef PRODUCT
void <API key>::dump_spec(outputStream *st) const {
st->print(" # fields@[%d..%d]", first_index(),
first_index() + n_fields() - 1);
}
#endif
uint AllocateNode::size_of() const { return sizeof(*this); }
AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
Node *ctrl, Node *mem, Node *abio,
Node *size, Node *klass_node, Node *initial_test)
: CallNode(atype, NULL, TypeRawPtr::BOTTOM)
{
init_class_id(Class_Allocate);
init_flags(Flag_is_macro);
<API key> = false;
_is_non_escaping = false;
Node *topnode = C->top();
init_req( TypeFunc::Control , ctrl );
init_req( TypeFunc::I_O , abio );
init_req( TypeFunc::Memory , mem );
init_req( TypeFunc::ReturnAdr, topnode );
init_req( TypeFunc::FramePtr , topnode );
init_req( AllocSize , size);
init_req( KlassNode , klass_node);
init_req( InitialTest , initial_test);
init_req( ALength , topnode);
C->add_macro_node(this);
}
Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
if (remove_dead_region(phase, can_reshape)) return this;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
const Type* type = phase->type(Ideal_length());
if (type->isa_int() && type->is_int()->_hi < 0) {
if (can_reshape) {
PhaseIterGVN *igvn = phase->is_IterGVN();
// Unreachable fall through path (negative array length),
// the allocation can only throw so disconnect it.
Node* proj = proj_out(TypeFunc::Control);
Node* catchproj = NULL;
if (proj != NULL) {
for (DUIterator_Fast imax, i = proj->fast_outs(imax); i < imax; i++) {
Node *cn = proj->fast_out(i);
if (cn->is_Catch()) {
catchproj = cn->as_Multi()->proj_out(CatchProjNode::fall_through_index);
break;
}
}
}
if (catchproj != NULL && catchproj->outcnt() > 0 &&
(catchproj->outcnt() > 1 ||
catchproj->unique_out()->Opcode() != Op_Halt)) {
assert(catchproj->is_CatchProj(), "must be a CatchProjNode");
Node* nproj = catchproj->clone();
igvn-><API key>(nproj);
Node *frame = new (phase->C) ParmNode( phase->C->start(), TypeFunc::FramePtr );
frame = phase->transform(frame);
// Halt & Catch Fire
Node *halt = new (phase->C) HaltNode( nproj, frame );
phase->C->root()->add_req(halt);
phase->transform(halt);
igvn->replace_node(catchproj, phase->C->top());
return this;
}
} else {
// Can't correct it during regular GVN so register for IGVN
phase->C->record_for_igvn(this);
}
}
return NULL;
}
// Retrieve the length from the AllocateArrayNode. Narrow the type with a
// CastII, if appropriate. If we are not allowed to create new nodes, and
// a CastII is appropriate, return NULL.
Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) {
Node *length = in(AllocateNode::ALength);
assert(length != NULL, "length is not null");
const TypeInt* length_type = phase->find_int_type(length);
const TypeAryPtr* ary_type = oop_type->isa_aryptr();
if (ary_type != NULL && length_type != NULL) {
const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
if (narrow_length_type != length_type) {
// Assert one of:
// - the narrow_length is 0
// - the narrow_length is not wider than length
assert(narrow_length_type == TypeInt::ZERO ||
length_type->is_con() && narrow_length_type->is_con() &&
(narrow_length_type->_hi <= length_type->_lo) ||
(narrow_length_type->_hi <= length_type->_hi &&
narrow_length_type->_lo >= length_type->_lo),
"narrow type must be narrower than length type");
// Return NULL if new nodes are not allowed
if (!allow_new_nodes) return NULL;
// Create a cast which is control dependent on the initialization to
// propagate the fact that the array length must be positive.
length = new (phase->C) CastIINode(length, narrow_length_type);
length->set_req(0, initialization()->proj_out(0));
}
}
return length;
}
uint LockNode::size_of() const { return sizeof(*this); }
// Redundant lock elimination
// There are various patterns of locking where we release and
// immediately reacquire a lock in a piece of code where no operations
// occur in between that would be observable. In those cases we can
// skip releasing and reacquiring the lock without violating any
// fairness requirements. Doing this around a loop could cause a lock
// to be held for a very long time so we concentrate on non-looping
// control flow. We also require that the operations are fully
// redundant meaning that we don't introduce new lock operations on
// some paths so to be able to eliminate it on others ala PRE. This
// would probably require some more extensive graph manipulation to
// guarantee that the memory edges were all handled correctly.
// Assuming p is a simple predicate which can't trap in any way and s
// is a synchronized method consider this code:
// if (p)
// else
// 1. The unlocks of the first call to s can be eliminated if the
// locks inside the then and else branches are eliminated.
// 2. The unlocks of the then and else branches can be eliminated if
// the lock of the final call to s is eliminated.
// Either of these cases subsumes the simple case of sequential control flow
// Addtionally we can eliminate versions without the else case:
// if (p)
// 3. In this case we eliminate the unlock of the first s, the lock
// and unlock in the then case and the lock in the final s.
// Note also that in all these cases the then/else pieces don't have
// to be trivial as long as they begin and end with synchronization
// operations.
// if (p)
// The code will work properly for this case, leaving in the unlock
// before the call to f and the relock after it.
// A potentially interesting case which isn't handled here is when the
// locking is partially redundant.
// if (p)
// This could be eliminated putting unlocking on the else case and
// eliminating the first unlock and the lock in the then side.
// Alternatively the unlock could be moved out of the then side so it
// was after the merge and the first unlock and second lock
// eliminated. This might require less manipulation of the memory
// state to get correct.
// Additionally we might allow work between a unlock and lock before
// giving up eliminating the locks. The current code disallows any
// conditional control flow between these operations. A formulation
// similar to partial redundancy elimination computing the
// availability of unlocking and the anticipatability of locking at a
// program point would allow detection of fully redundant locking with
// some amount of work in between. I'm not sure how often I really
// think that would occur though. Most of the cases I've seen
// indicate it's likely non-trivial work would occur in between.
// There may be other more complicated constructs where we could
// eliminate locking but I haven't seen any others appear as hot or
// interesting.
// Locking and unlocking have a canonical form in ideal that looks
// roughly like this:
// <obj>
// | BoxLock \
// | | FastLock
// Lock
// Proj
// MembarAcquire
// Proj
// MembarRelease
// Proj
// Unlock
// Proj
// This code proceeds by processing Lock nodes during PhaseIterGVN
// and searching back through its control for the proper code
// patterns. Once it finds a set of lock and unlock operations to
// eliminate they are marked as eliminatable which causes the
// expansion of the Lock and Unlock macro nodes to make the operation a NOP
// Utility function to skip over uninteresting control nodes. Nodes skipped are:
// - copy regions. (These may not have been optimized away yet.)
// - eliminated locking nodes
static Node *next_control(Node *ctrl) {
if (ctrl == NULL)
return NULL;
while (1) {
if (ctrl->is_Region()) {
RegionNode *r = ctrl->as_Region();
Node *n = r->is_copy();
if (n == NULL)
break; // hit a region, return it
else
ctrl = n;
} else if (ctrl->is_Proj()) {
Node *in0 = ctrl->in(0);
if (in0->is_AbstractLock() && in0->as_AbstractLock()->is_eliminated()) {
ctrl = in0->in(0);
} else {
break;
}
} else {
break; // found an interesting control
}
}
return ctrl;
}
// Given a control, see if it's the control projection of an Unlock which
// operating on the same object as lock.
bool AbstractLockNode::<API key>(const Node* ctrl, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
ProjNode *ctrl_proj = (ctrl->is_Proj()) ? ctrl->as_Proj() : NULL;
if (ctrl_proj != NULL && ctrl_proj->_con == TypeFunc::Control) {
Node *n = ctrl_proj->in(0);
if (n != NULL && n->is_Unlock()) {
UnlockNode *unlock = n->as_Unlock();
if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), unlock->box_node()) &&
!unlock->is_eliminated()) {
lock_ops.append(unlock);
return true;
}
}
}
return false;
}
// Find the lock matching an unlock. Returns null if a safepoint
// or complicated control is encountered first.
LockNode *AbstractLockNode::find_matching_lock(UnlockNode* unlock) {
LockNode *lock_result = NULL;
// find the matching lock, or an intervening safepoint
Node *ctrl = next_control(unlock->in(0));
while (1) {
assert(ctrl != NULL, "invalid control graph");
assert(!ctrl->is_Start(), "missing lock for unlock");
if (ctrl->is_top()) break; // dead control path
if (ctrl->is_Proj()) ctrl = ctrl->in(0);
if (ctrl->is_SafePoint()) {
break; // found a safepoint (may be the lock we are searching for)
} else if (ctrl->is_Region()) {
// Check for a simple diamond pattern. Punt on anything more complicated
if (ctrl->req() == 3 && ctrl->in(1) != NULL && ctrl->in(2) != NULL) {
Node *in1 = next_control(ctrl->in(1));
Node *in2 = next_control(ctrl->in(2));
if (((in1->is_IfTrue() && in2->is_IfFalse()) ||
(in2->is_IfTrue() && in1->is_IfFalse())) && (in1->in(0) == in2->in(0))) {
ctrl = next_control(in1->in(0)->in(0));
} else {
break;
}
} else {
break;
}
} else {
ctrl = next_control(ctrl->in(0)); // keep searching
}
}
if (ctrl->is_Lock()) {
LockNode *lock = ctrl->as_Lock();
if (lock->obj_node()->eqv_uncast(unlock->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), unlock->box_node())) {
lock_result = lock;
}
}
return lock_result;
}
// This code corresponds to case 3 above.
bool AbstractLockNode::<API key>(Node* node, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
Node* if_node = node->in(0);
bool if_true = node->is_IfTrue();
if (if_node->is_If() && if_node->outcnt() == 2 && (if_true || node->is_IfFalse())) {
Node *lock_ctrl = next_control(if_node->in(0));
if (<API key>(lock_ctrl, lock, lock_ops)) {
Node* lock1_node = NULL;
ProjNode* proj = if_node->as_If()->proj_out(!if_true);
if (if_true) {
if (proj->is_IfFalse() && proj->outcnt() == 1) {
lock1_node = proj->unique_out();
}
} else {
if (proj->is_IfTrue() && proj->outcnt() == 1) {
lock1_node = proj->unique_out();
}
}
if (lock1_node != NULL && lock1_node->is_Lock()) {
LockNode *lock1 = lock1_node->as_Lock();
if (lock->obj_node()->eqv_uncast(lock1->obj_node()) &&
BoxLockNode::same_slot(lock->box_node(), lock1->box_node()) &&
!lock1->is_eliminated()) {
lock_ops.append(lock1);
return true;
}
}
}
}
lock_ops.trunc_to(0);
return false;
}
bool AbstractLockNode::<API key>(const RegionNode* region, LockNode* lock,
GrowableArray<AbstractLockNode*> &lock_ops) {
// check each control merging at this point for a matching unlock.
// in(0) should be self edge so skip it.
for (int i = 1; i < (int)region->req(); i++) {
Node *in_node = next_control(region->in(i));
if (in_node != NULL) {
if (<API key>(in_node, lock, lock_ops)) {
// found a match so keep on checking.
continue;
} else if (<API key>(in_node, lock, lock_ops)) {
continue;
}
// If we fall through to here then it was some kind of node we
// don't understand or there wasn't a matching unlock, so give
// up trying to merge locks.
lock_ops.trunc_to(0);
return false;
}
}
return true;
}
#ifndef PRODUCT
// Create a counter which counts the number of times this lock is acquired
void AbstractLockNode::create_lock_counter(JVMState* state) {
_counter = OptoRuntime::new_named_counter(state, NamedCounter::LockCounter);
}
void AbstractLockNode::<API key>() {
if (_counter) {
// Update the counter to indicate that this lock was eliminated.
// The counter update code will stay around even though the
// optimizer will eliminate the lock operation itself.
_counter->set_tag(NamedCounter::<API key>);
}
}
#endif
Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// perform any generic optimizations first (returns 'this' or NULL)
Node *result = SafePointNode::Ideal(phase, can_reshape);
if (result != NULL) return result;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
// Now see if we can optimize away this lock. We don't actually
// remove the locking here, we simply set the _eliminate flag which
// prevents macro expansion from expanding the lock. Since we don't
// modify the graph, the value returned from this function is the
// one computed above.
if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
// If we are locking an unescaped object, the lock/unlock is unnecessary
ConnectionGraph *cgr = phase->C->congraph();
if (cgr != NULL && cgr->not_global_escape(obj_node())) {
assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag
// to eliminate all associated locks/unlocks.
this->set_non_esc_obj();
return result;
}
// Try lock coarsening
PhaseIterGVN* iter = phase->is_IterGVN();
if (iter != NULL && !is_eliminated()) {
GrowableArray<AbstractLockNode*> lock_ops;
Node *ctrl = next_control(in(0));
// now search back for a matching Unlock
if (<API key>(ctrl, this, lock_ops)) {
// found an unlock directly preceding this lock. This is the
// case of single unlock directly control dependent on a
// single lock which is the trivial version of case 1 or 2.
} else if (ctrl->is_Region() ) {
if (<API key>(ctrl->as_Region(), this, lock_ops)) {
// found lock preceded by multiple unlocks along all paths
// joining at this point which is case 3 in description above.
}
} else {
// see if this lock comes from either half of an if and the
// predecessors merges unlocks and the other half of the if
// performs a lock.
if (<API key>(ctrl, this, lock_ops)) {
// found unlock splitting to an if with locks on both branches.
}
}
if (lock_ops.length() > 0) {
// add ourselves to the list of locks to be eliminated.
lock_ops.append(this);
#ifndef PRODUCT
if (PrintEliminateLocks) {
int locks = 0;
int unlocks = 0;
for (int i = 0; i < lock_ops.length(); i++) {
AbstractLockNode* lock = lock_ops.at(i);
if (lock->Opcode() == Op_Lock)
locks++;
else
unlocks++;
if (Verbose) {
lock->dump(1);
}
}
tty->print_cr("***Eliminated %d unlocks and %d locks", unlocks, locks);
}
#endif
// for each of the identified locks, mark them
// as eliminatable
for (int i = 0; i < lock_ops.length(); i++) {
AbstractLockNode* lock = lock_ops.at(i);
// Mark it eliminated by coarsening and update any counters
lock->set_coarsened();
}
} else if (ctrl->is_Region() &&
iter->_worklist.member(ctrl)) {
// We weren't able to find any opportunities but the region this
// lock is control dependent on hasn't been processed yet so put
// this lock back on the worklist so we can check again once any
// region simplification has occurred.
iter->_worklist.push(this);
}
}
}
return result;
}
bool LockNode::<API key>() {
BoxLockNode* box = box_node()->as_BoxLock();
int stk_slot = box->stack_slot();
if (stk_slot <= 0)
return false; // External lock or it is not Box (Phi node).
// Ignore complex cases: merged locks or multiple locks.
Node* obj = obj_node();
LockNode* unique_lock = NULL;
if (!box-><API key>(&unique_lock, obj) ||
(unique_lock != this)) {
return false;
}
// Look for external lock for the same object.
SafePointNode* sfn = this->as_SafePoint();
JVMState* youngest_jvms = sfn->jvms();
int max_depth = youngest_jvms->depth();
for (int depth = 1; depth <= max_depth; depth++) {
JVMState* jvms = youngest_jvms->of_depth(depth);
int num_mon = jvms->nof_monitors();
// Loop over monitors
for (int idx = 0; idx < num_mon; idx++) {
Node* obj_node = sfn->monitor_obj(jvms, idx);
BoxLockNode* box_node = sfn->monitor_box(jvms, idx)->as_BoxLock();
if ((box_node->stack_slot() < stk_slot) && obj_node->eqv_uncast(obj)) {
return true;
}
}
}
return false;
}
uint UnlockNode::size_of() const { return sizeof(*this); }
Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// perform any generic optimizations first (returns 'this' or NULL)
Node *result = SafePointNode::Ideal(phase, can_reshape);
if (result != NULL) return result;
// Don't bother trying to transform a dead node
if (in(0) && in(0)->is_top()) return NULL;
// Now see if we can optimize away this unlock. We don't actually
// remove the unlocking here, we simply set the _eliminate flag which
// prevents macro expansion from expanding the unlock. Since we don't
// modify the graph, the value returned from this function is the
// one computed above.
// Escape state is defined after Parse phase.
if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
// If we are unlocking an unescaped object, the lock/unlock is unnecessary.
ConnectionGraph *cgr = phase->C->congraph();
if (cgr != NULL && cgr->not_global_escape(obj_node())) {
assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag
// to eliminate all associated locks/unlocks.
this->set_non_esc_obj();
}
}
return result;
}
|
<?php namespace Indikator\Backend\ReportWidgets;
use Backend\Classes\ReportWidgetBase;
use Exception;
use DB;
class Logs extends ReportWidgetBase
{
public function render()
{
try {
$this->loadData();
}
catch (Exception $ex) {
$this->vars['error'] = $ex->getMessage();
}
return $this->makePartial('widget');
}
public function defineProperties()
{
return [
'title' => [
'title' => 'backend::lang.dashboard.widget_title_label',
'default' => 'indikator.backend::lang.widgets.logs.label',
'type' => 'string',
'validationPattern' => '^.+$',
'validationMessage' => 'backend::lang.dashboard.widget_title_error'
],
'access' => [
'title' => 'indikator.backend::lang.properties.access',
'default' => true,
'type' => 'checkbox'
],
'event' => [
'title' => 'indikator.backend::lang.properties.event',
'default' => true,
'type' => 'checkbox'
],
'request' => [
'title' => 'indikator.backend::lang.properties.request',
'default' => true,
'type' => 'checkbox'
],
'total' => [
'title' => 'indikator.backend::lang.properties.total',
'default' => true,
'type' => 'checkbox'
]
];
}
protected function loadData()
{
$this->vars['access'] = DB::table('backend_access_log')->count();
$this->vars['event'] = DB::table('system_event_logs')->count();
$this->vars['request'] = DB::table('system_request_logs')->count();
}
}
|
BY-@Sadik_alknani10
BY_CH : @KINGTELE1
]]
local function get_variables_hash(msg)
if msg.to.type == 'chat' or msg.to.type == 'channel' then
return 'chat:bot:variables'
end
end
local function get_value(msg, var_name)
local hash = get_variables_hash(msg)
if hash then
local value = redis:hget(hash, var_name)
if not value then
return
else
return value
end
end
end
local function list_chats(msg)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = 'الردود هي : \n\n'
for i=1, #names do
text = text..'® '..names[i]..'\n'
end
return text
else
return
end
end
local function save_value(msg, name, value)
if (not name or not value) then
return "Usage: !set var_name value"
end
local hash = nil
if msg.to.type == 'chat' or msg.to.type == 'channel' then
hash = 'chat:bot:variables'
end
if hash then
redis:hset(hash, name, value)
return '('..name..')\n تــم اضُافَُه ُهذَا الُرَدِ '
end
end
local function del_value(msg, name)
if not name then
return
end
local hash = nil
if msg.to.type == 'chat' or msg.to.type == 'channel' then
hash = 'chat:bot:variables'
end
if hash then
redis:hdel(hash, name)
return '('..name..')\n تْــم حُذَفَ ُهذَا الُرَدِ '
end
end
local function delallchats(msg)
local hash = 'chat:bot:variables'
if hash then
local names = redis:hkeys(hash)
for i=1, #names do
redis:hdel(hash,names[i])
end
return "saved!"
else
return
end
end
local function run(msg, matches)
if is_sudo(msg) then
local name = matches[3]
local value = matches[4]
if matches[2] == 'حذف الجميع' then
local output = delallchats(msg)
return output
end
if matches[2] == 'اضف' then
local name1 = user_print_name(msg.from)
savelog(msg.to.id, name1.." ["..msg.from.id.."] saved ["..name.."] as > "..value )
local text = save_value(msg, name, value)
return text
elseif matches[2] == 'حذف' then
local text = del_value(msg,name)
return text
end
end
if matches[1] == 'الردود' then
local output = list_chats(msg)
return output
else
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /get ".. matches[1])-- save to logs
local text = get_value(msg, matches[1])
return reply_msg(msg.id,text,ok_cb,false)
end
end
return {
patterns = {
"^(الردود)$",
"^(رد) (اضف) ([^%s]+) (.+)$",
"^(رد) (حذف الجميع)$",
"^(رد) (حذف) (.*)$",
"^(.+)$",
},
run = run
}
-- @KINGTELE1
|
package org.jpc.emulator.execution.opcodes.rm;
import org.jpc.emulator.execution.*;
import org.jpc.emulator.execution.decoder.*;
import org.jpc.emulator.processor.*;
import org.jpc.emulator.processor.fpu64.*;
import static org.jpc.emulator.processor.Processor.*;
public class rep_movsb_a32 extends Executable
{
final int segIndex;
public rep_movsb_a32(int blockStart, int eip, int prefices, PeekableInputStream input)
{
super(blockStart, eip);
segIndex = Prefices.getSegment(prefices, Processor.DS_INDEX);
}
public Branch execute(Processor cpu)
{
Segment seg = cpu.segs[segIndex];
StaticOpcodes.rep_movsb_a32(cpu, seg);
return Branch.None;
}
public boolean isBranch()
{
return false;
}
public String toString()
{
return this.getClass().getName();
}
}
|
obj-$(CONFIG_LCD_NULL) += lcd_null.o
obj-$(CONFIG_LCD_RK2928) += lcd_rk2928.o
obj-$(<API key>) += lcd_rk3168_fac.o
obj-$(<API key>) += lcd_td043mgea1.o
obj-$(<API key>) += lcd_hsd800x480.o
obj-$(<API key>) += lcd_hl070vm4.o
obj-$(<API key>) += lcd_byd1024x600.o
obj-$(<API key>)+= lcd_LG_LP097X02.o
obj-$(<API key>) += lcd_tj048nc01ca.o
obj-$(CONFIG_LCD_A060SE02) += lcd_a060se02.o
obj-$(CONFIG_LCD_S1D13521) += lcd_s1d13521.o
obj-$(CONFIG_LCD_NT35582) += lcd_nt35582.o
obj-$(CONFIG_LCD_NT35580) += lcd_nt35580.o
obj-$(<API key>) += lcd_ips1p5680_v1_e.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_ls035y8dx02a.o
obj-$(<API key>) += lcd_ls035y8dx04a.o
obj-$(<API key>) += <API key>.o
obj-$(CONFIG_LCD_HX8357) += lcd_hx8357.o
obj-$(<API key>) += lcd_hsd100pxn.o
obj-$(<API key>) += lcd_hdmi_1366x768.o
obj-$(<API key>) += lcd_hdmi_1280x800.o
obj-$(<API key>) += lcd_hdmi_1024x768.o
obj-$(<API key>) += lcd_hdmi_800x480.o
obj-$(CONFIG_LCD_B101AW06) += lcd_B101AW06.o
obj-$(CONFIG_LCD_NT35510) += lcd_nt35510.o
obj-$(<API key>) += lcd_ili9803_cpt4_3.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_ls035y8dx02a.o
obj-$(<API key>) += lcd_ips1p5680_v1_e.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_AT070TNA2.o
obj-$(<API key>) += lcd_tx23d88vm.o
obj-$(<API key>) += lcd_at070tn93.o
obj-$(CONFIG_LCD_A050VL01) += lcd_A050VL01.o
obj-$(CONFIG_LCD_B101EW05) += lcd_b101ew05.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_hj050na_06a.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_hv070wsa.o
obj-$(CONFIG_LCD_COMMON) += lcd_common.o
obj-$(<API key>) += lcd_YQ70CPT9160.o
obj-$(<API key>) += lcd_AUO_A080SN03.o
obj-$(<API key>) += lcd_YQ70CPT9160_v86.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_hdmi_1024x600.o
obj-$(CONFIG_LCD_HJ080NA) += lcd_hj080na.o
obj-$(CONFIG_LCD_HJ101NA) += lcd_hj101na.o
obj-$(CONFIG_LCD_AUTO) += lcd_auto.o
obj-$(<API key>) += lcd_I30_800x480.o
obj-$(<API key>) += lcd_tl5001_mipi.o
obj-$(CONFIG_LCD_LP097QX1) += lcd_LP097QX1.o
obj-$(CONFIG_LCD_DS1006H) += lcd_ds1006h.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_wy_800x480.o
obj-$(<API key>) += lcd_hh070d_lvds.o
obj-$(<API key>) += <API key>.o
obj-$(CONFIG_LCD_MQ0801D) += lcd_mq0801d.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_PIPO_m7pro_mipi.o
obj-$(<API key>) += <API key>.o
obj-$(<API key>) += lcd_PIPO_m9pro_mipi.o
obj-$(<API key>) += lcd_PIPO_U8_mipi.o
obj-$(<API key>) += lcd_D33_U8.o
obj-$(<API key>) += lcd_B080XAN02_mipi.o
quiet_cmd_gen = GEN $@
cmd_gen = cmp -s $< $@ || cp $< $@
lcd-obj := $(filter lcd_%.o,$(obj-y))
lcd-cfile := $(patsubst %.o,%.c,$(lcd-obj))
lcd-cpath := $(src)/$(lcd-cfile)
obj-y := $(filter-out $(lcd-obj),$(obj-y))
$(obj)/lcd.h: $(lcd-cpath) FORCE
$(call if_changed,gen)
$(obj)/rk_screen.o: $(obj)/lcd.h
obj-y += rk_screen.o
clean-files := lcd.h
|
#! /usr/local/bin/ruby -Kn
# usage: exyacc.rb [yaccfiles]
# this is coverted from exyacc.pl in the camel book
ARGF.each(nil) do |source|
sbeg = source.index("\n%%") + 1
send = source.rindex("\n%%") + 1
grammar = source[sbeg, send-sbeg]
grammar.sub!(/.*\n/, "")
grammar.gsub!(/'\{'/, "'\001'")
grammar.gsub!(/'\}'/, "'\002'")
grammar.gsub!(%r{\*/}, "\003\003")
grammar.gsub!(%r{/\*[^\003]*\003\003}, '')
while grammar.gsub!(/\{[^{}]*\}/, ''); end
grammar.gsub!(/'\001'/, "'{'")
grammar.gsub!(/'\002'/, "'}'")
while grammar.gsub!(/^[ \t]*\n(\s)/, '\1'); end
grammar.gsub!(/([:|])[ \t\n]+(\w)/, '\1 \2')
print grammar
end
|
#header .top-header .header-navigation ul li.<API key> .sub-menu .sub-menu{width:250px;padding-top:0;border-left:1px solid #eee;top:0;left:250px}
|
package quest.beluslan;
import com.aionemu.gameserver.model.gameobjects.Item;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.HandlerResult;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.model.DialogAction;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;
import com.aionemu.gameserver.services.QuestService;
import com.aionemu.gameserver.world.zone.ZoneName;
/**
* @author Ritsu
*
*/
public class _2533BeritrasCurse extends QuestHandler {
private final static int questId = 2533;
public _2533BeritrasCurse() {
super(questId);
}
@Override
public void register() {
qe.registerQuestNpc(204801).addOnQuestStart(questId); //Gigrite
qe.registerQuestNpc(204801).addOnTalkEvent(questId);
qe.registerQuestItem(182204425, questId);//Empty Durable Potion Bottle
qe.<API key>(questId);
}
@Override
public HandlerResult onItemUseEvent(final QuestEnv env, Item item) {
Player player = env.getPlayer();
QuestState qs = player.getQuestStateList().getQuestState(questId);
if (qs != null && qs.getStatus() == QuestStatus.START) {
if (player.isInsideZone(ZoneName.get("<API key>"))) {
QuestService.questTimerStart(env, 300);
return HandlerResult.fromBoolean(useQuestItem(env, item, 0, 1, false, 182204426, 1, 0));
}
}
return HandlerResult.SUCCESS;
}
@Override
public boolean onDialogEvent(QuestEnv env) {
final Player player = env.getPlayer();
int targetId = 0;
if (env.getVisibleObject() instanceof Npc) {
targetId = ((Npc) env.getVisibleObject()).getNpcId();
}
final QuestState qs = player.getQuestStateList().getQuestState(questId);
DialogAction dialog = env.getDialog();
if (qs == null || qs.getStatus() == QuestStatus.NONE) {
if (targetId == 204801) {
if (dialog == DialogAction.QUEST_SELECT) {
return sendQuestDialog(env, 4762);
} else if (dialog == DialogAction.QUEST_ACCEPT_1) {
if (!giveQuestItem(env, 182204425, 1)) {
return true;
}
return <API key>(env);
} else {
return <API key>(env);
}
}
} else if (qs.getStatus() == QuestStatus.START) {
int var = qs.getQuestVarById(0);
if (targetId == 204801) {
switch (dialog) {
case QUEST_SELECT:
if (var == 1) {
qs.setStatus(QuestStatus.REWARD);
updateQuestStatus(env);
return sendQuestDialog(env, 1352);
}
case SELECT_QUEST_REWARD: {
QuestService.questTimerEnd(env);
return sendQuestDialog(env, 5);
}
}
}
} else if (qs.getStatus() == QuestStatus.REWARD) {
if (targetId == 204801) {
return sendQuestEndDialog(env);
}
}
return false;
}
@Override
public boolean <API key>(QuestEnv env) {
Player player = env.getPlayer();
QuestState qs = player.getQuestStateList().getQuestState(questId);
if (qs != null && qs.getStatus() == QuestStatus.START) {
removeQuestItem(env, 182204426, 1);
QuestService.abandonQuest(player, questId);
player.getController().updateNearbyQuests();
return true;
}
return false;
}
}
|
/* This file is the lexical analyzer for GNU C++. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "input.h"
#include "tree.h"
#include "cp-tree.h"
#include "cpplib.h"
#include "flags.h"
#include "c-family/c-pragma.h"
#include "c-family/c-objc.h"
#include "tm_p.h"
#include "timevar.h"
static int interface_strcmp (const char *);
static void init_cp_pragma (void);
static tree <API key> (const char *, int);
static void <API key> (cpp_reader *);
static void handle_pragma_unit (cpp_reader *);
static void <API key> (cpp_reader *);
static void <API key> (cpp_reader *);
static void <API key> (cpp_reader *);
static void init_operators (void);
static void copy_lang_type (tree);
/* A constraint that can be tested at compile time. */
#define CONSTRAINT(name, expr) extern int constraint_##name [(expr) ? 1 : -1]
/* Functions and data structures for #pragma interface.
`#pragma implementation' means that the main file being compiled
is considered to implement (provide) the classes that appear in
its main body. I.e., if this is file "foo.cc", and class `bar'
is defined in "foo.cc", then we say that "foo.cc implements bar".
All main input files "implement" themselves automagically.
`#pragma interface' means that unless this file (of the form "foo.h"
is not presently being included by file "foo.cc", the
<API key> bit gets set. The effect is that none
of the vtables nor any of the inline functions defined in foo.h
will ever be output.
There are cases when we want to link files such as "defs.h" and
"main.cc". In this case, we give "defs.h" a `#pragma interface',
and "main.cc" has `#pragma implementation "defs.h"'. */
struct impl_files
{
const char *filename;
struct impl_files *next;
};
static struct impl_files *impl_file_chain;
/* True if we saw "#pragma GCC java_exceptions". */
bool <API key>;
void
cxx_finish (void)
{
c_common_finish ();
}
/* A mapping from tree codes to operator name information. */
<API key> operator_name_info[(int) MAX_TREE_CODES];
/* Similar, but for assignment operators. */
<API key> <API key>[(int) MAX_TREE_CODES];
/* Initialize data structures that keep track of operator names. */
#define DEF_OPERATOR(NAME, C, M, AR, AP) \
CONSTRAINT (C, sizeof "operator " + sizeof NAME <= 256);
#include "operators.def"
#undef DEF_OPERATOR
static void
init_operators (void)
{
tree identifier;
char buffer[256];
struct <API key> *oni;
#define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \
sprintf (buffer, ISALPHA (NAME[0]) ? "operator %s" : "operator%s", NAME); \
identifier = get_identifier (buffer); \
IDENTIFIER_OPNAME_P (identifier) = 1; \
\
oni = (ASSN_P \
? &<API key>[(int) CODE] \
: &operator_name_info[(int) CODE]); \
oni->identifier = identifier; \
oni->name = NAME; \
oni->mangled_name = MANGLING; \
oni->arity = ARITY;
#include "operators.def"
#undef DEF_OPERATOR
operator_name_info[(int) ERROR_MARK].identifier
= get_identifier ("<invalid operator>");
/* Handle some special cases. These operators are not defined in
the language, but can be produced internally. We may need them
for error-reporting. (Eventually, we should ensure that this
does not happen. Error messages involving these operators will
be confusing to users.) */
operator_name_info [(int) INIT_EXPR].name
= operator_name_info [(int) MODIFY_EXPR].name;
operator_name_info [(int) EXACT_DIV_EXPR].name = "(ceiling /)";
operator_name_info [(int) CEIL_DIV_EXPR].name = "(ceiling /)";
operator_name_info [(int) FLOOR_DIV_EXPR].name = "(floor /)";
operator_name_info [(int) ROUND_DIV_EXPR].name = "(round /)";
operator_name_info [(int) CEIL_MOD_EXPR].name = "(ceiling %)";
operator_name_info [(int) FLOOR_MOD_EXPR].name = "(floor %)";
operator_name_info [(int) ROUND_MOD_EXPR].name = "(round %)";
operator_name_info [(int) ABS_EXPR].name = "abs";
operator_name_info [(int) TRUTH_AND_EXPR].name = "strict &&";
operator_name_info [(int) TRUTH_OR_EXPR].name = "strict ||";
operator_name_info [(int) RANGE_EXPR].name = "...";
operator_name_info [(int) UNARY_PLUS_EXPR].name = "+";
<API key> [(int) EXACT_DIV_EXPR].name
= "(exact /=)";
<API key> [(int) CEIL_DIV_EXPR].name
= "(ceiling /=)";
<API key> [(int) FLOOR_DIV_EXPR].name
= "(floor /=)";
<API key> [(int) ROUND_DIV_EXPR].name
= "(round /=)";
<API key> [(int) CEIL_MOD_EXPR].name
= "(ceiling %=)";
<API key> [(int) FLOOR_MOD_EXPR].name
= "(floor %=)";
<API key> [(int) ROUND_MOD_EXPR].name
= "(round %=)";
}
/* Initialize the reserved words. */
void
init_reswords (void)
{
unsigned int i;
tree id;
int mask = 0;
if (cxx_dialect < cxx0x)
mask |= D_CXX0X;
if (flag_no_asm)
mask |= D_ASM | D_EXT;
if (<API key>)
mask |= D_EXT;
/* The Objective-C keywords are all context-dependent. */
mask |= D_OBJC;
ridpointers = <API key> ((int) RID_MAX);
for (i = 0; i < <API key>; i++)
{
if (c_common_reswords[i].disable & D_CONLY)
continue;
id = get_identifier (c_common_reswords[i].word);
C_SET_RID_CODE (id, c_common_reswords[i].rid);
ridpointers [(int) c_common_reswords[i].rid] = id;
if (! (c_common_reswords[i].disable & mask))
C_IS_RESERVED_WORD (id) = 1;
}
}
static void
init_cp_pragma (void)
{
c_register_pragma (0, "vtable", <API key>);
c_register_pragma (0, "unit", handle_pragma_unit);
c_register_pragma (0, "interface", <API key>);
c_register_pragma (0, "implementation", <API key>);
c_register_pragma ("GCC", "interface", <API key>);
c_register_pragma ("GCC", "implementation", <API key>);
c_register_pragma ("GCC", "java_exceptions", <API key>);
}
/* TRUE if a code represents a statement. */
bool statement_code_p[MAX_TREE_CODES];
/* Initialize the C++ front end. This function is very sensitive to
the exact order that things are done here. It would be nice if the
initialization done by this routine were moved to its subroutines,
and the ordering dependencies clarified and reduced. */
bool
cxx_init (void)
{
location_t saved_loc;
unsigned int i;
static const enum tree_code stmt_codes[] = {
CTOR_INITIALIZER, TRY_BLOCK, HANDLER,
EH_SPEC_BLOCK, USING_STMT, TAG_DEFN,
IF_STMT, CLEANUP_STMT, FOR_STMT,
RANGE_FOR_STMT, WHILE_STMT, DO_STMT,
BREAK_STMT, CONTINUE_STMT, SWITCH_STMT,
EXPR_STMT
};
memset (&statement_code_p, 0, sizeof (statement_code_p));
for (i = 0; i < ARRAY_SIZE (stmt_codes); i++)
statement_code_p[stmt_codes[i]] = true;
saved_loc = input_location;
input_location = BUILTINS_LOCATION;
init_reswords ();
init_tree ();
init_cp_semantics ();
init_operators ();
init_method ();
init_error ();
<API key> = NULL;
class_type_node = ridpointers[(int) RID_CLASS];
<API key> ();
if (c_common_init () == false)
{
input_location = saved_loc;
return false;
}
init_cp_pragma ();
init_repo ();
input_location = saved_loc;
return true;
}
/* Return nonzero if S is not considered part of an
INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */
static int
interface_strcmp (const char* s)
{
/* Set the interface/implementation bits for this scope. */
struct impl_files *ifiles;
const char *s1;
for (ifiles = impl_file_chain; ifiles; ifiles = ifiles->next)
{
const char *t1 = ifiles->filename;
s1 = s;
if (*s1 == 0 || filename_ncmp (s1, t1, 1) != 0)
continue;
while (*s1 != 0 && filename_ncmp (s1, t1, 1) == 0)
s1++, t1++;
/* A match. */
if (*s1 == *t1)
return 0;
/* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
if (strchr (s1, '.') || strchr (t1, '.'))
continue;
if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
continue;
/* A match. */
return 0;
}
/* No matches. */
return 1;
}
/* Parse a #pragma whose sole argument is a string constant.
If OPT is true, the argument is optional. */
static tree
<API key> (const char* name, int opt)
{
tree result, x;
enum cpp_ttype t;
t = pragma_lex (&result);
if (t == CPP_STRING)
{
if (pragma_lex (&x) != CPP_EOF)
warning (0, "junk at end of #pragma %s", name);
return result;
}
if (t == CPP_EOF && opt)
return NULL_TREE;
error ("invalid #pragma %s", name);
return error_mark_node;
}
static void
<API key> (cpp_reader* /*dfile*/)
{
<API key> ("vtable", 0);
sorry ("#pragma vtable no longer supported");
}
static void
handle_pragma_unit (cpp_reader* /*dfile*/)
{
/* Validate syntax, but don't do anything. */
<API key> ("unit", 0);
}
static void
<API key> (cpp_reader* /*dfile*/)
{
tree fname = <API key> ("interface", 1);
struct c_fileinfo *finfo;
const char *filename;
if (fname == error_mark_node)
return;
else if (fname == 0)
filename = lbasename (input_filename);
else
filename = TREE_STRING_POINTER (fname);
finfo = get_fileinfo (input_filename);
if (impl_file_chain == 0)
{
/* If this is zero at this point, then we are
auto-implementing. */
if (main_input_filename == 0)
main_input_filename = input_filename;
}
finfo->interface_only = interface_strcmp (filename);
/* If <API key> is set, we cannot assume that we can see
a definition in another file. */
if (!<API key> || !finfo->interface_only)
finfo->interface_unknown = 0;
}
/* Note that we have seen a #pragma implementation for the key MAIN_FILENAME.
We used to only allow this at toplevel, but that restriction was buggy
in older compilers and it seems reasonable to allow it in the headers
themselves, too. It only needs to precede the matching #p interface.
We don't touch finfo->interface_only or finfo->interface_unknown;
the user must specify a matching #p interface for this to have
any effect. */
static void
<API key> (cpp_reader* /*dfile*/)
{
tree fname = <API key> ("implementation", 1);
const char *filename;
struct impl_files *ifiles = impl_file_chain;
if (fname == error_mark_node)
return;
if (fname == 0)
{
if (main_input_filename)
filename = main_input_filename;
else
filename = input_filename;
filename = lbasename (filename);
}
else
{
filename = TREE_STRING_POINTER (fname);
if (cpp_included_before (parse_in, filename, input_location))
warning (0, "#pragma implementation for %qs appears after "
"file is included", filename);
}
for (; ifiles; ifiles = ifiles->next)
{
if (! filename_cmp (ifiles->filename, filename))
break;
}
if (ifiles == 0)
{
ifiles = XNEW (struct impl_files);
ifiles->filename = xstrdup (filename);
ifiles->next = impl_file_chain;
impl_file_chain = ifiles;
}
}
/* Indicate that this file uses Java-personality exception handling. */
static void
<API key> (cpp_reader* /*dfile*/)
{
tree x;
if (pragma_lex (&x) != CPP_EOF)
warning (0, "junk at end of #pragma GCC java_exceptions");
<API key> (lang_java);
<API key> = true;
}
/* Issue an error message indicating that the lookup of NAME (an
IDENTIFIER_NODE) failed. Returns the ERROR_MARK_NODE. */
tree
<API key> (tree name)
{
if (IDENTIFIER_OPNAME_P (name))
{
if (name != ansi_opname (ERROR_MARK))
error ("%qD not defined", name);
}
else
{
if (!<API key> (name))
{
error ("%qD was not declared in this scope", name);
<API key> (location_of (name), name);
}
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
if (local_bindings_p ())
{
tree decl;
decl = build_decl (input_location,
VAR_DECL, name, error_mark_node);
DECL_CONTEXT (decl) = <API key>;
push_local_binding (name, decl, 0);
/* Mark the variable as used so that we do not get warnings
about it being unused later. */
TREE_USED (decl) = 1;
}
}
return error_mark_node;
}
/* Like <API key>, but NAME is an unqualified-id
used as a function. Returns an appropriate expression for
NAME. */
tree
<API key> (tree name)
{
if (<API key>)
{
/* In a template, it is invalid to write "f()" or "f(3)" if no
declaration of "f" is available. Historically, G++ and most
other compilers accepted that usage since they deferred all name
lookup until instantiation time rather than doing unqualified
name lookup at template definition time; explain to the user what
is going wrong.
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
permerror (input_location, "there are no arguments to %qD that depend on a template "
"parameter, so a declaration of %qD must be available",
name, name);
if (!flag_permissive)
{
static bool hint;
if (!hint)
{
inform (input_location, "(if you use %<-fpermissive%>, G++ will accept your "
"code, but allowing the use of an undeclared name is "
"deprecated)");
hint = true;
}
}
return name;
}
return <API key> (name);
}
/* Wrapper around build_lang_decl_loc(). Should gradually move to
build_lang_decl_loc() and then rename build_lang_decl_loc() back to
build_lang_decl(). */
tree
build_lang_decl (enum tree_code code, tree name, tree type)
{
return build_lang_decl_loc (input_location, code, name, type);
}
/* Build a decl from CODE, NAME, TYPE declared at LOC, and then add
DECL_LANG_SPECIFIC info to the result. */
tree
build_lang_decl_loc (location_t loc, enum tree_code code, tree name, tree type)
{
tree t;
t = build_decl (loc, code, name, type);
retrofit_lang_decl (t);
return t;
}
/* Add DECL_LANG_SPECIFIC info to T. Called from build_lang_decl
and pushdecl (for functions generated by the back end). */
void
retrofit_lang_decl (tree t)
{
struct lang_decl *ld;
size_t size;
int sel;
if (TREE_CODE (t) == FUNCTION_DECL)
sel = 1, size = sizeof (struct lang_decl_fn);
else if (TREE_CODE (t) == NAMESPACE_DECL)
sel = 2, size = sizeof (struct lang_decl_ns);
else if (TREE_CODE (t) == PARM_DECL)
sel = 3, size = sizeof (struct lang_decl_parm);
else if (LANG_DECL_HAS_MIN (t))
sel = 0, size = sizeof (struct lang_decl_min);
else
gcc_unreachable ();
ld = <API key> (size);
ld->u.base.selector = sel;
DECL_LANG_SPECIFIC (t) = ld;
if (current_lang_name == lang_name_cplusplus
|| decl_linkage (t) == lk_none)
SET_DECL_LANGUAGE (t, lang_cplusplus);
else if (current_lang_name == lang_name_c)
SET_DECL_LANGUAGE (t, lang_c);
else if (current_lang_name == lang_name_java)
SET_DECL_LANGUAGE (t, lang_java);
else
gcc_unreachable ();
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_decl] += 1;
tree_node_sizes[(int)lang_decl] += size;
}
}
void
<API key> (tree node)
{
int size;
struct lang_decl *ld;
if (! DECL_LANG_SPECIFIC (node))
return;
if (TREE_CODE (node) == FUNCTION_DECL)
size = sizeof (struct lang_decl_fn);
else if (TREE_CODE (node) == NAMESPACE_DECL)
size = sizeof (struct lang_decl_ns);
else if (TREE_CODE (node) == PARM_DECL)
size = sizeof (struct lang_decl_parm);
else if (LANG_DECL_HAS_MIN (node))
size = sizeof (struct lang_decl_min);
else
gcc_unreachable ();
ld = ggc_alloc_lang_decl (size);
memcpy (ld, DECL_LANG_SPECIFIC (node), size);
DECL_LANG_SPECIFIC (node) = ld;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_decl] += 1;
tree_node_sizes[(int)lang_decl] += size;
}
}
/* Copy DECL, including any language-specific parts. */
tree
copy_decl (tree decl)
{
tree copy;
copy = copy_node (decl);
<API key> (copy);
return copy;
}
/* Replace the shared language-specific parts of NODE with a new copy. */
static void
copy_lang_type (tree node)
{
int size;
struct lang_type *lt;
if (! TYPE_LANG_SPECIFIC (node))
return;
if (TYPE_LANG_SPECIFIC (node)->u.h.is_lang_type_class)
size = sizeof (struct lang_type);
else
size = sizeof (struct lang_type_ptrmem);
lt = ggc_alloc_lang_type (size);
memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
TYPE_LANG_SPECIFIC (node) = lt;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
tree_node_sizes[(int)lang_type] += size;
}
}
/* Copy TYPE, including any language-specific parts. */
tree
copy_type (tree type)
{
tree copy;
copy = copy_node (type);
copy_lang_type (copy);
return copy;
}
tree
cxx_make_type (enum tree_code code)
{
tree t = make_node (code);
/* Create lang_type structure. */
if (<API key> (code)
|| code == <API key>)
{
struct lang_type *pi
= <API key> (sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (t) = pi;
pi->u.c.h.is_lang_type_class = 1;
if (GATHER_STATISTICS)
{
tree_node_counts[(int)lang_type] += 1;
tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
}
}
/* Set up some flags that give proper default behavior. */
if (<API key> (code))
{
struct c_fileinfo *finfo = get_fileinfo (input_filename);
<API key> (t, finfo->interface_unknown);
<API key> (t) = finfo->interface_only;
}
return t;
}
tree
make_class_type (enum tree_code code)
{
tree t = cxx_make_type (code);
SET_CLASS_TYPE_P (t, 1);
return t;
}
/* Returns true if we are currently in the main source file, or in a
template instantiation started from the main source file. */
bool
<API key> (void)
{
struct tinst_level *tl = <API key>();
if (tl)
return filename_cmp (main_input_filename,
LOCATION_FILE (tl->locus)) == 0;
else
return filename_cmp (main_input_filename, input_filename) == 0;
}
|
<?php
<html>
<head>
<title>Securimage Test Form</title>
</head>
<body>
<?php
if (empty($_POST)) { ?>
<form method="POST">
Username:<br />
<input type="text" name="username" /><br />
Password:<br />
<input type="text" name="password" /><br />
<!-- pass a session id to the query string of the script to prevent ie caching -->
<img src="securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"><br />
<input type="text" name="code" /><br />
<input type="submit" value="Submit Form" />
</form>
<?php
} else { //form is posted
include("securimage.php");
$img = new Securimage();
$valid = $img->check($_POST['code']);
if($valid == true) {
echo "<center>Thanks, you entered the correct code.</center>";
} else {
echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>";
}
}
?>
</body>
</html>
|
#ifndef <API key>
#define <API key>
#include "MarSystem.h"
namespace Marsyas
{
/**
\class <API key>
\ingroup Analysis
\brief <API key> estimates the number of sources placed into different stereo positions.
After computing the Stereo Spectrum we can try to estimate the number of sources playing in different
stereo positions.
*/
class Peaker;
class <API key>: public MarSystem
{
private:
realvec orderedPans_;
realvec panChanges_;
realvec panPeaks_;
Peaker* panPeaker_;
void myUpdate(MarControlPtr sender);
public:
<API key>(std::string name);
<API key>(const <API key>& a);
~<API key>();
MarSystem* clone() const;
void myProcess(realvec& in, realvec& out);
};
}//namespace Marsyas
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
#ifndef <API key>
#define <API key>
#include "nm-device.h"
#define <API key> (<API key> ())
#define <API key>(obj) (<API key> ((obj), <API key>, NMDeviceInfiniband))
#define <API key>(klass) (<API key> ((klass), <API key>, <API key>))
#define <API key>(obj) (<API key> ((obj), <API key>))
#define <API key>(klass) (<API key> ((klass), <API key>))
#define <API key>(obj) (<API key> ((obj), <API key>, <API key>))
typedef struct _NMDeviceInfiniband NMDeviceInfiniband;
typedef struct <API key> <API key>;
GType <API key> (void);
#endif /* <API key> */
|
#ifndef <API key>
#define <API key>
#include <kcmodule.h>
#include "<API key>.h"
namespace KWin
{
class <API key> : public QWidget, public Ui::<API key>
{
Q_OBJECT
public:
explicit <API key>(QWidget* parent);
};
class <API key> : public KCModule
{
Q_OBJECT
public:
explicit <API key>(QWidget* parent = 0, const QVariantList& args = QVariantList());
~<API key>();
public Q_SLOTS:
void save();
void defaults();
private:
<API key>* myUi;
KActionCollection* myActionCollection;
};
} // namespace
#endif
|
<p>No API Key or List Id Exist!</p>
|
package org.opennms.netmgt.dao.api;
import org.opennms.netmgt.model.OnmsMemo;
/**
* @author <a href="mailto:Markus@OpenNMS.com">Markus Neumann</a>
*/
public interface MemoDao extends OnmsDao<OnmsMemo, Integer> {
}
|
<div>
{% for new in news %}
<div widget-toggle="news" id_widget_note="{{new.id_article}}">
<h2 change_key="title" replace="input">{{new.title}}</h2>
<div change_key="content" replace="ck">{{new.content}}</div>
</div>
{% endfor %}
<br clear="both">
</div>
|
#ifndef AOXP_H
#define AOXP_H
#include <stdbool.h>
#include "tracee/reg.h"
#include "arch.h"
typedef struct array_of_xpointers ArrayOfXPointers;
typedef int (*read_xpointee_t)(ArrayOfXPointers *array, size_t index, void **object);
typedef int (*write_xpointee_t)(ArrayOfXPointers *array, size_t index, const void *object);
typedef int (*compare_xpointee_t)(ArrayOfXPointers *array, size_t index, const void *reference);
typedef int (*sizeof_xpointee_t)(ArrayOfXPointers *array, size_t index);
typedef struct mixed_pointer XPointer;
struct array_of_xpointers {
XPointer *_xpointers;
size_t length;
read_xpointee_t read_xpointee;
write_xpointee_t write_xpointee;
compare_xpointee_t compare_xpointee;
sizeof_xpointee_t sizeof_xpointee;
};
static inline int read_xpointee(ArrayOfXPointers *array, size_t index, void **object)
{
return array->read_xpointee(array, index, object);
}
static inline int write_xpointee(ArrayOfXPointers *array, size_t index, const void *object)
{
return array->write_xpointee(array, index, object);
}
static inline int compare_xpointee(ArrayOfXPointers *array, size_t index, const void *reference)
{
return array->compare_xpointee(array, index, reference);
}
static inline int sizeof_xpointee(ArrayOfXPointers *array, size_t index)
{
return array->sizeof_xpointee(array, index);
}
extern int find_xpointee(ArrayOfXPointers *array, const void *reference);
extern int <API key>(ArrayOfXPointers *array, size_t index, ssize_t nb_delta_entries);
extern int <API key>(Tracee *tracee, ArrayOfXPointers **array, Reg reg, size_t nb_entries);
extern int <API key>(ArrayOfXPointers *array, Reg reg);
extern int <API key>(ArrayOfXPointers *array, size_t index, void **object);
extern int <API key>(ArrayOfXPointers *array, size_t index, char **string);
extern int <API key>(ArrayOfXPointers *array, size_t index, const char *string);
extern int write_xpointees(ArrayOfXPointers *array, size_t index, size_t nb_xpointees, ...);
extern int <API key>(ArrayOfXPointers *array, size_t index, const void *reference);
extern int <API key>(ArrayOfXPointers *array, size_t index);
#endif /* AOXP_H */
|
package lejos.robotics.mapping;
import java.io.*;
import java.util.ArrayList;
import lejos.geom.Line;
import lejos.geom.Rectangle;
/*
* WARNING: THIS CLASS IS SHARED BETWEEN THE classes AND pccomms PROJECTS.
* DO NOT EDIT THE VERSION IN pccomms AS IT WILL BE OVERWRITTEN WHEN THE PROJECT IS BUILT.
*/
/**
* <p>This class loads map data from a Shapefile and produces a LineMap object, which can
* be used by the leJOS navigation package.</p>
*
* <p>There are many map editors which can use the Shapefile format (OpenEV, Global Mapper). Once you
* have created a map, export it as Shapefile. This will produce three files ending in .shp .shx and
* .dbf. The only file used by this class is .shp.</p>
*
* <p>NOTE: Shapefiles can only contain one type of shape data (polygon or polyline, not both). A single file can't
* mix polylines with polygons.</p>
*
* <p>This class' code can parse points and multipoints. However, a LineMap object can't deal with
* points (only lines) so points and multipoints are discarded.</p>
*
* @author BB
*
*/
public class ShapefileLoader {
/* OTHER POTENTIAL MAP FILE FORMATS TO ADD:
* (none have really been researched yet for viability)
* KML
* GML
* WMS? (more of a service than a file)
* MIF/MID (MapInfo)
* SVG (Scalable Vector Graphics)
* EPS (Encapsulated Post Script)
* DXF (Autodesk)
* AI (Adobe Illustrator)
*
*/
// 2D shape types types:
private static final byte NULL_SHAPE = 0;
private static final byte POINT = 1;
private static final byte POLYLINE = 3;
private static final byte POLYGON = 5;
private static final byte MULTIPOINT = 8;
private final int SHAPEFILE_ID = 0x0000270a;
DataInputStream data_is = null;
/**
* Creates a ShapefileLoader object using an input stream. Likely you will use a FileInputStream
* which points to the *.shp file containing the map data.
* @param in
*/
public ShapefileLoader(InputStream in) {
this.data_is = new DataInputStream(in);
}
/**
* Retrieves a LineMap object from the Shapefile input stream.
* @return the line map
* @throws IOException
*/
public LineMap readLineMap() throws IOException {
ArrayList <Line> lines = new ArrayList <Line> ();
int fileCode = data_is.readInt(); // Big Endian
if(fileCode != SHAPEFILE_ID) throw new IOException("File is not a Shapefile");
data_is.skipBytes(20); // Five int32 unused by Shapefile
/*int fileLength =*/ data_is.readInt();
//System.out.println("Length: " + fileLength); // TODO: Docs say length is in 16-bit words. Unsure if this is strictly correct. Seems higher than what hex editor shows.
/*int version =*/ readLEInt();
/*int shapeType =*/ readLEInt();
//System.out.println("Shape type: " + shapeType);
// These x and y min/max values define bounding rectangle:
double xMin = readLEDouble();
double yMin = readLEDouble();
double xMax = readLEDouble();
double yMax = readLEDouble();
// Create bounding rectangle:
Rectangle rect = new Rectangle((float)xMin, (float)yMin, (float)(xMax - xMin), (float)(yMax - yMin));
/*double zMin =*/ readLEDouble();
/*double zMax =*/ readLEDouble();
/*double mMin =*/ readLEDouble();
/*double mMax =*/ readLEDouble();
// TODO These values seem to be rounded down to nearest 0.5. Must round them up?
//System.out.println("Xmin " + xMin + " Ymin " + yMin);
//System.out.println("Xmax " + xMax + " Ymax " + yMax);
try { // TODO: This is a cheesy way to detect EOF condition. Not very good coding.
while(2 > 1) { // TODO: Temp code to keep it looping. Should really detect EOF condition.
// NOW ONTO READING INDIVIDUAL SHAPES:
// Record Header (2 values):
/*int recordNum =*/ data_is.readInt();
int recordLen = data_is.readInt(); // TODO: in 16-bit words. Might cause bug if number of shapes gets bigger than 16-bit short?
// Record (variable length depending on shape type):
int recShapeType = readLEInt();
// Now to read the actual shape data
switch (recShapeType) {
case NULL_SHAPE:
break;
case POINT:
// DO WE REALLY NEED TO DEAL WITH POINT? Feature might use them possibly.
/*double pointX =*/ readLEDouble(); // TODO: skip bytes instead
/*double pointY =*/ readLEDouble();
break;
case POLYLINE:
// NOTE: Data structure for polygon/polyline is identical. Code should work for both.
case POLYGON:
// Polygons can contain multiple polygons, such as a donut with outer ring and inner ring for hole.
// Max bounding rect: 4 doubles in a row. TODO: Discard bounding rect. values and skip instead.
/*double polyxMin =*/ readLEDouble();
/*double polyyMin =*/ readLEDouble();
/*double polyxMax =*/ readLEDouble();
/*double polyyMax =*/ readLEDouble();
int numParts = readLEInt();
int numPoints = readLEInt();
// Retrieve array of indexes for each part in the polygon
int [] partIndex = new int[numParts];
for(int i=0;i<numParts;i++) {
partIndex[i] = readLEInt();
}
// Now go through numParts times pulling out points
double firstX=0;
double firstY=0;
for(int i=0;i<numPoints-1;i++) {
// Could check here if onto new polygon (i = next index). If so, do something with line formation.
for(int j=0;j<numParts;j++) {
if(i == partIndex[j]) {
firstX = readLEDouble();
firstY = readLEDouble();
continue;
}
}
double secondX = readLEDouble();
double secondY = readLEDouble();
Line myLine = new Line((float)firstX, (float)firstY, (float)secondX, (float)secondY);
lines.add(myLine);
firstX = secondX;
firstY = secondY;
}
break;
case MULTIPOINT:
// TODO: DO WE REALLY NEED TO DEAL WITH MULTIPOINT? Comment out and skip bytes?
/*double multixMin = */readLEDouble();
/*double multiyMin = */readLEDouble();
/*double multixMax = */readLEDouble();
/*double multiyMax = */readLEDouble();
int multiPoints = readLEInt();
double [] xVals = new double[multiPoints];
double [] yVals = new double[multiPoints];
for(int i=0;i<multiPoints;i++) {
xVals[i] = readLEDouble();
yVals[i] = readLEDouble();
}
break;
default:
// IGNORE REST OF SHAPE TYPES and skip over data using recordLen value
//System.out.println("Some other unknown shape");
data_is.skipBytes(recordLen); // TODO: Check if this works on polyline or point
}
} // END OF WHILE
} catch(EOFException e) {
// End of File, just needs to continue
}
Line [] arrList = new Line [lines.size()];
return new LineMap(lines.toArray(arrList), rect);
}
/**
* Translates a little endian int into a big endian int
*
* @return int A big endian int
*/
private int readLEInt() throws IOException {
int byte1, byte2, byte3, byte4;
synchronized (this) {
byte1 = data_is.read();
byte2 = data_is.read();
byte3 = data_is.read();
byte4 = data_is.read();
}
if (byte4 == -1) {
throw new EOFException();
}
return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
}
/**
* Reads a little endian double into a big endian double
*
* @return double A big endian double
*/
private final double readLEDouble() throws IOException {
return Double.longBitsToDouble(this.readLELong());
}
/**
* Translates a little endian long into a big endian long
*
* @return long A big endian long
*/
private long readLELong() throws IOException {
long byte1 = data_is.read();
long byte2 = data_is.read();
long byte3 = data_is.read();
long byte4 = data_is.read();
long byte5 = data_is.read();
long byte6 = data_is.read();
long byte7 = data_is.read();
long byte8 = data_is.read();
if (byte8 == -1) {
throw new EOFException();
}
return (byte8 << 56) + (byte7 << 48) + (byte6 << 40) + (byte5 << 32)
+ (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
}
}
|
#include <arch/io.h>
#include <gpio.h>
#include <reset.h>
#include "board.h"
void hard_reset(void)
{
gpio_output(GPIO_RESET, 1);
while (1)
;
}
|
<?php
# This file is part of Check_MK.
# check_mk is free software; you can redistribute it and/or modify it
# the Free Software Foundation in version 2. check_mk is distributed
# ails. You should have received a copy of the GNU General Public
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
$queue = str_replace("_", " ", substr($servicedesc, 6));
$opt[1] = "--vertical-label 'Queue length' -l0 --title \"$hostname / Exchange Queue: $queue\" ";
$def[1] = "DEF:length=$RRDFILE[1]:$DS[1]:MAX ";
$def[1] .= "AREA:length#6090ff:\"length\" ";
$def[1] .= "LINE:length#304f80 ";
$def[1] .= "GPRINT:length:LAST:\"last\: %.0lf %s\" ";
$def[1] .= "GPRINT:length:AVERAGE:\"average\: %.0lf %s\" ";
$def[1] .= "GPRINT:length:MAX:\"max\:%.0lf %s\\n\" ";
?>
|
<?php
/**
* @file
* Contains \Drupal\<API key>\Routing\RouteSubscriber.
*/
namespace Drupal\<API key>\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
/**
* Subscriber for google analytics reports routes.
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection->get('<API key>.settings')) {
$route->setDefault('_form', 'Drupal\<API key>\Form\<API key>');
}
}
}
|
#include <locale.h>
#include <bits/libc-lock.h>
#include <stdlib.h>
#include <localeinfo.h>
/* Lock for protecting global data. */
__libc_lock_define (extern , <API key>)
__locale_t
__duplocale (__locale_t dataset)
{
__locale_t result;
/* We modify global data. */
__libc_lock_lock (<API key>);
/* Get memory. */
result = (__locale_t) malloc (sizeof (struct __locale_struct));
if (result != NULL)
{
int cnt;
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL)
{
result->__locales[cnt] = dataset->__locales[cnt];
if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT)
++result->__locales[cnt]->usage_count;
}
}
/* Update the special members. */
result->__ctype_b = dataset->__ctype_b;
result->__ctype_tolower = dataset->__ctype_tolower;
result->__ctype_toupper = dataset->__ctype_toupper;
/* It's done. */
__libc_lock_unlock (<API key>);
return result;
}
|
#include "config.h"
#include <epan/packet.h>
/* Initialize the protocol and registered fields */
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
static int <API key> = -1;
static const value_string code_field_vals[] = {
{0, "Reserved"},
{1, "Reserved"},
{2, "Reserved"},
{3, "Reserved"},
{4, "Auth Request"},
{5, "Auth Reply"},
{6, "Auth Reject"},
{7, "Key Request"},
{8, "Key Reply"},
{9, "Key Reject"},
{10, "Auth Invalid"},
{11, "TEK Invalid"},
{12, "Authent Info"},
{13, "Map Request"},
{14, "Map Reply"},
{15, "Map Reject"},
{0, NULL},
};
/* Initialize the subtree pointers */
static gint ett_docsis_bpkmreq = -1;
static dissector_handle_t attrs_handle;
/* Code to actually dissect the packets */
static void
dissect_bpkmreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *it;
proto_tree *bpkmreq_tree;
guint8 code;
tvbuff_t *attrs_tvb;
code = tvb_get_guint8 (tvb, 0);
col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Request (%s)",
val_to_str (code, code_field_vals, "%d"));
if (tree)
{
it =
<API key> (tree, <API key>, tvb, 0, -1,
"BPKM Request Message");
bpkmreq_tree = <API key> (it, ett_docsis_bpkmreq);
proto_tree_add_item (bpkmreq_tree, <API key>, tvb, 0, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (bpkmreq_tree, <API key>, tvb, 1, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (bpkmreq_tree, <API key>, tvb, 2, 2,
ENC_BIG_ENDIAN);
}
/* Code to Call subdissector */
attrs_tvb = <API key> (tvb, 4);
call_dissector (attrs_handle, attrs_tvb, pinfo, tree);
}
/* Register the protocol with Wireshark */
/* this format is require because a script is used to build the C function
that calls all the protocol registration.
*/
void
<API key> (void)
{
/* Setup list of header fields See Section 1.6.1 for details*/
static hf_register_info hf[] = {
{&<API key>,
{"BPKM Code", "docsis_bpkmreq.code",
FT_UINT8, BASE_DEC, VALS (code_field_vals), 0x0,
"BPKM Request Message", HFILL}
},
{&<API key>,
{"BPKM Identifier", "docsis_bpkmreq.ident",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
{&<API key>,
{"BPKM Length", "docsis_bpkmreq.length",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL}
},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_docsis_bpkmreq,
};
/* Register the protocol name and description */
<API key> =
<API key> ("DOCSIS Baseline Privacy Key Management Request",
"DOCSIS BPKM-REQ", "docsis_bpkmreq");
/* Required function calls to register the header fields and subtrees used */
<API key> (<API key>, hf, array_length (hf));
<API key> (ett, array_length (ett));
register_dissector ("docsis_bpkmreq", dissect_bpkmreq,
<API key>);
}
/* If this dissector uses sub-dissector registration add a registration routine.
This format is required because a script is used to find these routines and
create the code that calls these routines.
*/
void
<API key> (void)
{
dissector_handle_t <API key>;
<API key> = find_dissector ("docsis_bpkmreq");
attrs_handle = find_dissector ("docsis_bpkmattr");
dissector_add_uint ("docsis_mgmt", 0x0C, <API key>);
}
|
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
use PhpMyAdmin\Controllers\Database\Structure\<API key>;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use function json_encode;
/**
* @covers \PhpMyAdmin\Controllers\Database\Structure\<API key>
*/
class <API key> extends AbstractTestCase
{
public function testRealRowCount(): void
{
$GLOBALS['server'] = 1;
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['is_db'] = true;
$GLOBALS['db'] = 'world';
$response = new ResponseStub();
$response->setAjax(true);
$_REQUEST['table'] = 'City';
(new <API key>($response, new Template(), $this->dbi))();
$json = $response->getJSONResult();
$this->assertEquals('4,079', $json['real_row_count']);
$_REQUEST['real_row_count_all'] = 'on';
(new <API key>($response, new Template(), $this->dbi))();
$json = $response->getJSONResult();
$expected = [
['table' => 'City', 'row_count' => 4079],
['table' => 'Country', 'row_count' => 239],
['table' => 'CountryLanguage', 'row_count' => 984],
];
$this->assertEquals(json_encode($expected), $json['real_row_count_all']);
}
}
|
// This file was automatically generated by wxrc, do not edit by hand.
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include <wx/filesys.h>
#include <wx/fs_mem.h>
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xh_all.h>
#if wxCHECK_VERSION(2,8,5) && wxABI_VERSION >= 20805
#define XRC_ADD_FILE(name, data, size, mime) \
wxMemoryFSHandler::AddFileWithMimeType(name, data, size, mime)
#else
#define XRC_ADD_FILE(name, data, size, mime) \
wxMemoryFSHandler::AddFile(name, data, size)
#endif
static size_t xml_res_size_0 = 137;
static unsigned char xml_res_file_0[] = {
60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101,
110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,63,62,10,60,114,101,
115,111,117,114,99,101,32,120,109,108,110,115,61,34,104,116,116,112,58,
47,47,119,119,119,46,119,120,119,105,100,103,101,116,115,46,111,114,103,
47,119,120,120,114,99,34,62,10,32,32,60,33,45,45,32,72,97,110,100,108,101,
114,32,71,101,110,101,114,97,116,105,111,110,32,105,115,32,79,78,32,45,
45,62,10,60,47,114,101,115,111,117,114,99,101,62,10};
void <API key>()
{
// Check for memory FS. If not present, load the handler:
{
wxMemoryFSHandler::AddFile(wxT("XRC_resource/dummy_file"), wxT("dummy one"));
wxFileSystem fsys;
wxFSFile *f = fsys.OpenFile(wxT("memory:XRC_resource/dummy_file"));
wxMemoryFSHandler::RemoveFile(wxT("XRC_resource/dummy_file"));
if (f) delete f;
else wxFileSystem::AddHandler(new <API key>);
}
XRC_ADD_FILE(wxT("XRC_resource/<API key>.cpp$<API key>.xrc"), xml_res_file_0, xml_res_size_0, wxT("text/xml"));
wxXmlResource::Get()->Load(wxT("memory:XRC_resource/<API key>.cpp$<API key>.xrc"));
}
|
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "epan/packet.h"
#include <epan/stat_cmd_args.h>
#include <epan/tap.h>
#include <epan/dissectors/packet-sctp.h>
#include "../stat_menu.h"
#include "ui/gtk/gui_stat_menu.h"
#include "ui/gtk/hostlist_table.h"
void <API key>(void);
static int
<API key>(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const struct _sctp_info *sctphdr=(const struct _sctp_info *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)
XXX - this could probably be done more efficiently inside hostlist_table */
<API key>(hosts, &sctphdr->ip_src, sctphdr->sport, TRUE, 1,
pinfo->fd->pkt_len, SAT_NONE, PT_SCTP);
<API key>(hosts, &sctphdr->ip_dst, sctphdr->dport, FALSE, 1,
pinfo->fd->pkt_len, SAT_NONE, PT_SCTP);
return 1;
}
static void
<API key>(const char *opt_arg, void* userdata _U_)
{
const char *filter=NULL;
if(!strncmp(opt_arg,"hosts,sctp,",11)){
filter=opt_arg+11;
} else {
filter=NULL;
}
init_hostlist_table(FALSE, "SCTP", "sctp", filter, <API key>);
}
void
<API key>(GtkAction *action _U_, gpointer user_data _U_)
{
<API key>("hosts,sctp",NULL);
}
void
<API key>(void)
{
<API key>("hosts,sctp", <API key>,NULL);
<API key>(FALSE, "SCTP", "sctp", NULL /*filter*/, <API key>);
}
|
#include "kinematicCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
<API key>(kinematicCloud, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kinematicCloud::kinematicCloud()
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::kinematicCloud::~kinematicCloud()
{}
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Mon Dec 02 20:33:00 CET 2013 -->
<title>NVTextureRectangle (LWJGL API)</title>
<meta name="date" content="2013-12-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="NVTextureRectangle (LWJGL API)";
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar_top">
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NVTextureRectangle.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/lwjgl/opengl/<API key>.html" title="class in org.lwjgl.opengl"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../org/lwjgl/opengl/NVTextureShader.html" title="class in org.lwjgl.opengl"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/lwjgl/opengl/NVTextureRectangle.html" target="_top">Frames</a></li>
<li><a href="NVTextureRectangle.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#<API key>.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_top">
</a></div>
<div class="header">
<div class="subTitle">org.lwjgl.opengl</div>
<h2 title="Class NVTextureRectangle" class="title">Class NVTextureRectangle</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.lwjgl.opengl.NVTextureRectangle</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="strong">NVTextureRectangle</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="field_summary">
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/lwjgl/opengl/NVTextureRectangle.html#<API key>"><API key></a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/lwjgl/opengl/NVTextureRectangle.html#<API key>"><API key></a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/lwjgl/opengl/NVTextureRectangle.html#<API key>"><API key></a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../org/lwjgl/opengl/NVTextureRectangle.html#<API key>"><API key></a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="method_summary">
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="<API key>.lang.Object">
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="field_detail">
</a>
<h3>Field Detail</h3>
<a name="<API key>">
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public static final int <API key></pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.lwjgl.opengl.NVTextureRectangle.<API key>">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="<API key>">
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public static final int <API key></pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.lwjgl.opengl.NVTextureRectangle.<API key>">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="<API key>">
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre>public static final int <API key></pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.lwjgl.opengl.NVTextureRectangle.<API key>">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="<API key>">
</a>
<ul class="blockListLast">
<li class="blockList">
<h4><API key></h4>
<pre>public static final int <API key></pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.lwjgl.opengl.NVTextureRectangle.<API key>">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar_bottom">
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/NVTextureRectangle.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/lwjgl/opengl/<API key>.html" title="class in org.lwjgl.opengl"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../org/lwjgl/opengl/NVTextureShader.html" title="class in org.lwjgl.opengl"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/lwjgl/opengl/NVTextureRectangle.html" target="_top">Frames</a></li>
<li><a href="NVTextureRectangle.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#<API key>.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_bottom">
</a></div>
<p class="legalCopy"><small><i>Copyright &
</body>
</html>
|
<?php
if(!function_exists ('ew_code')){
function ew_code($atts,$content = false){
extract(shortcode_atts(array(
),$atts));
//add_filter('the_content','ew_do_shortcode',1001);
return "<div class='border-code'><div class='background-code'><pre class='code'>".htmlspecialchars($content)."</pre></div></div>";
}
}
add_shortcode('code','ew_code');
?>
|
#include <impl/Kokkos_Utilities.hpp> // type_list
#include <traits/Kokkos_Traits_fwd.hpp>
#ifndef <API key>
#define <API key>
namespace Kokkos {
namespace Impl {
// <editor-fold desc="Adapter for replacing/adding a trait"> {{{1
// General strategy: given a TraitSpecification, go through the entries in the
// parameter pack of the policy template and find the first one that returns
// `true` for the nested `<API key>` variable template. If
// that nested variable template is not found these overloads should be safely
// ignored, and the trait can specialize <API key> to get the
// desired behavior.
// <editor-fold desc="PolicyTraitMatcher"> {{{2
// To handle the WorkTag case, we need more than just a predicate; we need
// something that we can default to in the unspecialized case, just like we
// do for AnalyzeExecPolicy
template <class TraitSpec, class Trait, class Enable = void>
struct PolicyTraitMatcher;
template <class TraitSpec, class Trait>
struct PolicyTraitMatcher<
TraitSpec, Trait,
std::enable_if_t<
TraitSpec::template <API key><Trait>::value>>
: std::true_type {};
// </editor-fold> end PolicyTraitMatcher }}}2
// <editor-fold desc="<API key> specializations"> {{{2
// Matching version, replace the trait
template <class TraitSpec, template <class...> class PolicyTemplate,
class... ProcessedTraits, class MatchingTrait,
class... ToProcessTraits, class NewTrait>
struct <API key><
TraitSpec, PolicyTemplate, type_list<ProcessedTraits...>,
type_list<MatchingTrait, ToProcessTraits...>, NewTrait,
std::enable_if_t<PolicyTraitMatcher<TraitSpec, MatchingTrait>::value>> {
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value, "");
using type = PolicyTemplate<ProcessedTraits..., NewTrait, ToProcessTraits...>;
};
// Non-matching version, check the next option
template <class TraitSpec, template <class...> class PolicyTemplate,
class... ProcessedTraits, class NonMatchingTrait,
class... ToProcessTraits, class NewTrait>
struct <API key><
TraitSpec, PolicyTemplate, type_list<ProcessedTraits...>,
type_list<NonMatchingTrait, ToProcessTraits...>, NewTrait,
std::enable_if_t<!PolicyTraitMatcher<TraitSpec, NonMatchingTrait>::value>> {
using type = typename <API key><
TraitSpec, PolicyTemplate,
type_list<ProcessedTraits..., NonMatchingTrait>,
type_list<ToProcessTraits...>, NewTrait>::type;
};
// Base case: no matches found; just add the trait to the end of the list
template <class TraitSpec, template <class...> class PolicyTemplate,
class... ProcessedTraits, class NewTrait>
struct <API key><TraitSpec, PolicyTemplate,
type_list<ProcessedTraits...>, type_list<>,
NewTrait> {
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value, "");
using type = PolicyTemplate<ProcessedTraits..., NewTrait>;
};
// </editor-fold> end <API key> specializations }}}2
template <class TraitSpec, template <class...> class PolicyTemplate,
class... Traits, class NewTrait>
struct PolicyTraitAdaptor<TraitSpec, PolicyTemplate<Traits...>, NewTrait>
: <API key><TraitSpec, PolicyTemplate, type_list<>,
type_list<Traits...>, NewTrait> {};
// </editor-fold> end Adapter for replacing/adding a trait }}}1
// <editor-fold desc="CRTP Base class for trait specifications"> {{{1
template <class TraitSpec>
struct <API key> {
using trait_specification = TraitSpec;
template <class Policy, class Trait>
using policy_with_trait =
typename PolicyTraitAdaptor<TraitSpec, Policy, Trait>::type;
};
// </editor-fold> end CRTP Base class for trait specifications }}}1
} // end namespace Impl
} // end namespace Kokkos
#endif // <API key>
|
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/atomic.h>
#include <linux/fence.h>
#define CREATE_TRACE_POINTS
#include <trace/events/fence.h>
<API key>(<API key>);
<API key>(fence_emit);
/*
* fence context counter: each execution context should have its own
* fence context, this allows checking if fences belong to the same
* context or not. One device can have multiple separate contexts,
* and they're used if some engine can run independently of another.
*/
static atomic_t <API key> = ATOMIC_INIT(0);
/**
* fence_context_alloc - allocate an array of fence contexts
* @num: [in] amount of contexts to allocate
*
* This function will return the first index of the number of fences allocated.
* The fence context is used for setting fence->context to a unique number.
*/
unsigned fence_context_alloc(unsigned num)
{
BUG_ON(!num);
return atomic_add_return(num, &<API key>) - num;
}
EXPORT_SYMBOL(fence_context_alloc);
/**
* fence_signal_locked - signal completion of a fence
* @fence: the fence to signal
*
* Signal completion for software callbacks on a fence, this will unblock
* fence_wait() calls and run all the callbacks added with
* fence_add_callback(). Can be called multiple times, but since a fence
* can only go from unsignaled to signaled state, it will only be effective
* the first time.
*
* Unlike fence_signal, this function must be called with fence->lock held.
*/
int fence_signal_locked(struct fence *fence)
{
struct fence_cb *cur, *tmp;
int ret = 0;
if (WARN_ON(!fence))
return -EINVAL;
if (!ktime_to_ns(fence->timestamp)) {
fence->timestamp = ktime_get();
smp_mb();
}
if (test_and_set_bit(<API key>, &fence->flags)) {
ret = -EINVAL;
/*
* we might have raced with the unlocked fence_signal,
* still run through all callbacks
*/
} else
<API key>(fence);
<API key>(cur, tmp, &fence->cb_list, node) {
list_del_init(&cur->node);
cur->func(fence, cur);
}
return ret;
}
EXPORT_SYMBOL(fence_signal_locked);
/**
* fence_signal - signal completion of a fence
* @fence: the fence to signal
*
* Signal completion for software callbacks on a fence, this will unblock
* fence_wait() calls and run all the callbacks added with
* fence_add_callback(). Can be called multiple times, but since a fence
* can only go from unsignaled to signaled state, it will only be effective
* the first time.
*/
int fence_signal(struct fence *fence)
{
unsigned long flags;
if (!fence)
return -EINVAL;
if (!ktime_to_ns(fence->timestamp)) {
fence->timestamp = ktime_get();
smp_mb();
}
if (test_and_set_bit(<API key>, &fence->flags))
return -EINVAL;
<API key>(fence);
if (test_bit(<API key>, &fence->flags)) {
struct fence_cb *cur, *tmp;
spin_lock_irqsave(fence->lock, flags);
<API key>(cur, tmp, &fence->cb_list, node) {
list_del_init(&cur->node);
cur->func(fence, cur);
}
<API key>(fence->lock, flags);
}
return 0;
}
EXPORT_SYMBOL(fence_signal);
/**
* fence_wait_timeout - sleep until the fence gets signaled
* or until timeout elapses
* @fence: [in] the fence to wait on
* @intr: [in] if true, do an interruptible wait
* @timeout: [in] timeout value in jiffies, or <API key>
*
* Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
* remaining timeout in jiffies on success. Other error values may be
* returned on custom implementations.
*
* Performs a synchronous wait on this fence. It is assumed the caller
* directly or indirectly (buf-mgr between reservation and committing)
* holds a reference to the fence, otherwise the fence might be
* freed before return, resulting in undefined behavior.
*/
signed long
fence_wait_timeout(struct fence *fence, bool intr, signed long timeout)
{
signed long ret;
if (WARN_ON(timeout < 0))
return -EINVAL;
<API key>(fence);
ret = fence->ops->wait(fence, intr, timeout);
<API key>(fence);
return ret;
}
EXPORT_SYMBOL(fence_wait_timeout);
void fence_release(struct kref *kref)
{
struct fence *fence =
container_of(kref, struct fence, refcount);
trace_fence_destroy(fence);
BUG_ON(!list_empty(&fence->cb_list));
if (fence->ops->release)
fence->ops->release(fence);
else
fence_free(fence);
}
EXPORT_SYMBOL(fence_release);
void fence_free(struct fence *fence)
{
kfree_rcu(fence, rcu);
}
EXPORT_SYMBOL(fence_free);
/**
* <API key> - enable signaling on fence
* @fence: [in] the fence to enable
*
* this will request for sw signaling to be enabled, to make the fence
* complete as soon as possible
*/
void <API key>(struct fence *fence)
{
unsigned long flags;
if (!test_and_set_bit(<API key>, &fence->flags) &&
!test_bit(<API key>, &fence->flags)) {
<API key>(fence);
spin_lock_irqsave(fence->lock, flags);
if (!fence->ops->enable_signaling(fence))
fence_signal_locked(fence);
<API key>(fence->lock, flags);
}
}
EXPORT_SYMBOL(<API key>);
/**
* fence_add_callback - add a callback to be called when the fence
* is signaled
* @fence: [in] the fence to wait on
* @cb: [in] the callback to register
* @func: [in] the function to call
*
* cb will be initialized by fence_add_callback, no initialization
* by the caller is required. Any number of callbacks can be registered
* to a fence, but a callback can only be registered to one fence at a time.
*
* Note that the callback can be called from an atomic context. If
* fence is already signaled, this function will return -ENOENT (and
* *not* call the callback)
*
* Add a software callback to the fence. Same restrictions apply to
* refcount as it does to fence_wait, however the caller doesn't need to
* keep a refcount to fence afterwards: when software access is enabled,
* the creator of the fence is required to keep the fence alive until
* after it signals with fence_signal. The callback itself can be called
* from irq context.
*
*/
int fence_add_callback(struct fence *fence, struct fence_cb *cb,
fence_func_t func)
{
unsigned long flags;
int ret = 0;
bool was_set;
if (WARN_ON(!fence || !func))
return -EINVAL;
if (test_bit(<API key>, &fence->flags)) {
INIT_LIST_HEAD(&cb->node);
return -ENOENT;
}
spin_lock_irqsave(fence->lock, flags);
was_set = test_and_set_bit(<API key>, &fence->flags);
if (test_bit(<API key>, &fence->flags))
ret = -ENOENT;
else if (!was_set) {
<API key>(fence);
if (!fence->ops->enable_signaling(fence)) {
fence_signal_locked(fence);
ret = -ENOENT;
}
}
if (!ret) {
cb->func = func;
list_add_tail(&cb->node, &fence->cb_list);
} else
INIT_LIST_HEAD(&cb->node);
<API key>(fence->lock, flags);
return ret;
}
EXPORT_SYMBOL(fence_add_callback);
/**
* <API key> - remove a callback from the signaling list
* @fence: [in] the fence to wait on
* @cb: [in] the callback to remove
*
* Remove a previously queued callback from the fence. This function returns
* true if the callback is succesfully removed, or false if the fence has
* already been signaled.
*
* *WARNING*:
* Cancelling a callback should only be done if you really know what you're
* doing, since deadlocks and race conditions could occur all too easily. For
* this reason, it should only ever be done on hardware lockup recovery,
* with a reference held to the fence.
*/
bool
<API key>(struct fence *fence, struct fence_cb *cb)
{
unsigned long flags;
bool ret;
spin_lock_irqsave(fence->lock, flags);
ret = !list_empty(&cb->node);
if (ret)
list_del_init(&cb->node);
<API key>(fence->lock, flags);
return ret;
}
EXPORT_SYMBOL(<API key>);
struct default_wait_cb {
struct fence_cb base;
struct task_struct *task;
};
static void
<API key>(struct fence *fence, struct fence_cb *cb)
{
struct default_wait_cb *wait =
container_of(cb, struct default_wait_cb, base);
wake_up_state(wait->task, TASK_NORMAL);
}
/**
* fence_default_wait - default sleep until the fence gets signaled
* or until timeout elapses
* @fence: [in] the fence to wait on
* @intr: [in] if true, do an interruptible wait
* @timeout: [in] timeout value in jiffies, or <API key>
*
* Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
* remaining timeout in jiffies on success.
*/
signed long
fence_default_wait(struct fence *fence, bool intr, signed long timeout)
{
struct default_wait_cb cb;
unsigned long flags;
signed long ret = timeout;
bool was_set;
if (test_bit(<API key>, &fence->flags))
return timeout;
spin_lock_irqsave(fence->lock, flags);
if (intr && signal_pending(current)) {
ret = -ERESTARTSYS;
goto out;
}
was_set = test_and_set_bit(<API key>, &fence->flags);
if (test_bit(<API key>, &fence->flags))
goto out;
if (!was_set) {
<API key>(fence);
if (!fence->ops->enable_signaling(fence)) {
fence_signal_locked(fence);
goto out;
}
}
cb.base.func = <API key>;
cb.task = current;
list_add(&cb.base.node, &fence->cb_list);
while (!test_bit(<API key>, &fence->flags) && ret > 0) {
if (intr)
__set_current_state(TASK_INTERRUPTIBLE);
else
__set_current_state(<API key>);
<API key>(fence->lock, flags);
ret = schedule_timeout(ret);
spin_lock_irqsave(fence->lock, flags);
if (ret > 0 && intr && signal_pending(current))
ret = -ERESTARTSYS;
}
if (!list_empty(&cb.base.node))
list_del(&cb.base.node);
__set_current_state(TASK_RUNNING);
out:
<API key>(fence->lock, flags);
return ret;
}
EXPORT_SYMBOL(fence_default_wait);
/**
* fence_init - Initialize a custom fence.
* @fence: [in] the fence to initialize
* @ops: [in] the fence_ops for operations on this fence
* @lock: [in] the irqsafe spinlock to use for locking this fence
* @context: [in] the execution context this fence is run on
* @seqno: [in] a linear increasing sequence number for this context
*
* Initializes an allocated fence, the caller doesn't have to keep its
* refcount after committing with this fence, but it will need to hold a
* refcount again if fence_ops.enable_signaling gets called. This can
* be used for other implementing other types of fence.
*
* context and seqno are used for easy comparison between fences, allowing
* to check which fence is later by simply using fence_later.
*/
void
fence_init(struct fence *fence, const struct fence_ops *ops,
spinlock_t *lock, unsigned context, unsigned seqno)
{
BUG_ON(!lock);
BUG_ON(!ops || !ops->wait || !ops->enable_signaling ||
!ops->get_driver_name || !ops->get_timeline_name);
kref_init(&fence->refcount);
fence->ops = ops;
INIT_LIST_HEAD(&fence->cb_list);
fence->lock = lock;
fence->context = context;
fence->seqno = seqno;
fence->flags = 0UL;
trace_fence_init(fence);
}
EXPORT_SYMBOL(fence_init);
|
/* ScriptData
SDName: Boss_Felmyst
SD%Complete: 0
SDComment:
EndScriptData */
#include "ScriptMgr.h"
#include "CellImpl.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
#include "TemporarySummon.h"
enum Yells
{
YELL_BIRTH = 0,
YELL_KILL = 1,
YELL_BREATH = 2,
YELL_TAKEOFF = 3,
YELL_BERSERK = 4,
YELL_DEATH = 5,
//YELL_KALECGOS = 6, Not used. After felmyst's death spawned and say this
};
enum Spells
{
//Aura
<API key> = 45769,
AURA_NOXIOUS_FUMES = 47002,
//Land phase
SPELL_CLEAVE = 19983,
SPELL_CORROSION = 45866,
SPELL_GAS_NOVA = 45855,
<API key> = 45661,
// <API key> = 45665,
// <API key> = 45662,
//Flight phase
SPELL_VAPOR_SELECT = 45391, // fel to player, force cast 45392, 50000y selete target
SPELL_VAPOR_SUMMON = 45392, // player summon vapor, radius around caster, 5y,
SPELL_VAPOR_FORCE = 45388, // vapor to fel, force cast 45389
SPELL_VAPOR_CHANNEL = 45389, // fel to vapor, green beam channel
SPELL_VAPOR_TRIGGER = 45411, // linked to 45389, vapor to self, trigger 45410 and 46931
SPELL_VAPOR_DAMAGE = 46931, // vapor damage, 4000
SPELL_TRAIL_SUMMON = 45410, // vapor summon trail
SPELL_TRAIL_TRIGGER = 45399, // trail to self, trigger 45402
SPELL_TRAIL_DAMAGE = 45402, // trail damage, 2000 + 2000 dot
SPELL_DEAD_SUMMON = 45400, // summon blazing dead, 5min
SPELL_DEAD_PASSIVE = 45415,
SPELL_FOG_BREATH = 45495, // fel to self, speed burst
SPELL_FOG_TRIGGER = 45582, // fog to self, trigger 45782
SPELL_FOG_FORCE = 45782, // fog to player, force cast 45714
SPELL_FOG_INFORM = 45714, // player let fel cast 45717, script effect
SPELL_FOG_CHARM = 45717, // fel to player
SPELL_FOG_CHARM2 = 45726, // link to 45717
<API key> = 44885, // madrigosa to self, trigger 46350
<API key> = 46350, // 46411stun?
<API key> = 45068, // become fel
<API key> = 45069,
//Other
SPELL_BERSERK = 45078,
SPELL_CLOUD_VISUAL = 45212,
SPELL_CLOUD_SUMMON = 45884
};
enum PhaseFelmyst
{
PHASE_NONE,
PHASE_GROUND,
PHASE_FLIGHT
};
enum EventFelmyst
{
EVENT_NONE,
EVENT_BERSERK,
EVENT_CLEAVE,
EVENT_CORROSION,
EVENT_GAS_NOVA,
EVENT_ENCAPSULATE,
EVENT_FLIGHT,
<API key>,
EVENT_SUMMON_DEAD,
EVENT_SUMMON_FOG
};
class boss_felmyst : public CreatureScript
{
public:
boss_felmyst() : CreatureScript("boss_felmyst") { }
struct boss_felmystAI : public ScriptedAI
{
boss_felmystAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
instance = creature->GetInstanceScript();
uiBreathCount = 0;
breathX = 0.f;
breathY = 0.f;
}
void Initialize()
{
phase = PHASE_NONE;
uiFlightCount = 0;
}
InstanceScript* instance;
PhaseFelmyst phase;
EventMap events;
uint32 uiFlightCount;
uint32 uiBreathCount;
float breathX, breathY;
void Reset() override
{
Initialize();
events.Reset();
me->SetDisableGravity(true);
me->SetFloatValue(<API key>, 10);
me->SetFloatValue(<API key>, 10);
DespawnSummons(NPC_VAPOR_TRAIL);
me->setActive(false);
instance->SetBossState(DATA_FELMYST, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/) override
{
events.ScheduleEvent(EVENT_BERSERK, 600000);
me->setActive(true);
DoZoneInCombat();
DoCast(me, <API key>, true);
DoCast(me, AURA_NOXIOUS_FUMES, true);
EnterPhase(PHASE_GROUND);
instance->SetBossState(DATA_FELMYST, IN_PROGRESS);
}
void AttackStart(Unit* who) override
{
if (phase != PHASE_FLIGHT)
ScriptedAI::AttackStart(who);
}
void MoveInLineOfSight(Unit* who) override
{
if (phase != PHASE_FLIGHT)
ScriptedAI::MoveInLineOfSight(who);
}
void KilledUnit(Unit* /*victim*/) override
{
Talk(YELL_KILL);
}
void JustRespawned() override
{
Talk(YELL_BIRTH);
}
void JustDied(Unit* /*killer*/) override
{
Talk(YELL_DEATH);
instance->SetBossState(DATA_FELMYST, DONE);
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
{
caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true);
}*/
// workaround for mind control
if (spell->Id == SPELL_FOG_INFORM)
{
float x, y, z;
caster->GetPosition(x, y, z);
if (Unit* summon = me->SummonCreature(NPC_DEAD, x, y, z, 0, <API key>, 5000))
{
summon->SetMaxHealth(caster->GetMaxHealth());
summon->SetHealth(caster->GetMaxHealth());
summon->CastSpell(summon, SPELL_FOG_CHARM, true);
summon->CastSpell(summon, SPELL_FOG_CHARM2, true);
}
me->DealDamage(caster, caster->GetHealth(), nullptr, DIRECT_DAMAGE, <API key>, nullptr, false);
}
}
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() == NPC_DEAD)
{
summon->AI()->AttackStart(SelectTarget(<API key>));
DoZoneInCombat(summon);
summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true);
}
}
void MovementInform(uint32, uint32) override
{
if (phase == PHASE_FLIGHT)
events.ScheduleEvent(<API key>, 1);
}
void DamageTaken(Unit*, uint32 &damage) override
{
if (phase != PHASE_GROUND && damage >= me->GetHealth())
damage = 0;
}
void EnterPhase(PhaseFelmyst NextPhase)
{
switch (NextPhase)
{
case PHASE_GROUND:
me->CastStop(SPELL_FOG_BREATH);
me-><API key>(SPELL_FOG_BREATH);
me->StopMoving();
me->SetSpeedRate(MOVE_RUN, 2.0f);
events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000));
events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000));
events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000));
events.ScheduleEvent(EVENT_FLIGHT, 60000);
break;
case PHASE_FLIGHT:
me->SetDisableGravity(true);
events.ScheduleEvent(<API key>, 1000);
uiFlightCount = 0;
uiBreathCount = 0;
break;
default:
break;
}
phase = NextPhase;
}
void <API key>()
{
switch (uiFlightCount)
{
case 0:
//me->AttackStop();
me->GetMotionMaster()->Clear(false);
me->HandleEmoteCommand(<API key>);
me->StopMoving();
Talk(YELL_TAKEOFF);
events.ScheduleEvent(<API key>, 2000);
break;
case 1:
me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10);
break;
case 2:
{
Unit* target = SelectTarget(<API key>, 0, 150, true);
if (!target)
target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
EnterEvadeMode();
return;
}
if (Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX() - 5 + rand32() % 10, target->GetPositionY() - 5 + rand32() % 10, target->GetPositionZ(), 0, <API key>, 9000))
{
Vapor->AI()->AttackStart(target);
me-><API key>(false);
DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
}
events.ScheduleEvent(<API key>, 10000);
break;
}
case 3:
{
DespawnSummons(NPC_VAPOR_TRAIL);
//DoCast(me, SPELL_VAPOR_SELECT); need core support
Unit* target = SelectTarget(<API key>, 0, 150, true);
if (!target)
target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
EnterEvadeMode();
return;
}
//target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support
if (Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX() - 5 + rand32() % 10, target->GetPositionY() - 5 + rand32() % 10, target->GetPositionZ(), 0, <API key>, 9000))
{
if (pVapor->AI())
pVapor->AI()->AttackStart(target);
me-><API key>(false);
DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug
pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true);
}
events.ScheduleEvent(<API key>, 10000);
break;
}
case 4:
DespawnSummons(NPC_VAPOR_TRAIL);
events.ScheduleEvent(<API key>, 1);
break;
case 5:
{
Unit* target = SelectTarget(<API key>, 0, 150, true);
if (!target)
target = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PLAYER_GUID));
if (!target)
{
EnterEvadeMode();
return;
}
breathX = target->GetPositionX();
breathY = target->GetPositionY();
float x, y, z;
target->GetContactPoint(me, x, y, z, 70);
me->GetMotionMaster()->MovePoint(0, x, y, z+10);
break;
}
case 6:
me->SetFacingTo(me->GetAngle(breathX, breathY));
//DoTextEmote("takes a deep breath.", nullptr);
events.ScheduleEvent(<API key>, 10000);
break;
case 7:
{
DoCast(me, SPELL_FOG_BREATH, true);
float x, y, z;
me->GetPosition(x, y, z);
x = 2 * breathX - x;
y = 2 * breathY - y;
me->GetMotionMaster()->MovePoint(0, x, y, z);
events.ScheduleEvent(EVENT_SUMMON_FOG, 1);
break;
}
case 8:
me->CastStop(SPELL_FOG_BREATH);
me-><API key>(SPELL_FOG_BREATH);
++uiBreathCount;
events.ScheduleEvent(<API key>, 1);
if (uiBreathCount < 3)
uiFlightCount = 4;
break;
case 9:
if (Unit* target = SelectTarget(<API key>))
DoStartMovement(target);
else
{
EnterEvadeMode();
return;
}
break;
case 10:
me->SetDisableGravity(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
EnterPhase(PHASE_GROUND);
AttackStart(SelectTarget(<API key>));
break;
}
++uiFlightCount;
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
if (phase == PHASE_FLIGHT && !me->IsInEvadeMode())
EnterEvadeMode();
return;
}
events.Update(diff);
if (me->IsNonMeleeSpellCast(false))
return;
if (phase == PHASE_GROUND)
{
switch (events.ExecuteEvent())
{
case EVENT_BERSERK:
Talk(YELL_BERSERK);
DoCast(me, SPELL_BERSERK, true);
events.ScheduleEvent(EVENT_BERSERK, 10000);
break;
case EVENT_CLEAVE:
DoCastVictim(SPELL_CLEAVE, false);
events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
break;
case EVENT_CORROSION:
DoCastVictim(SPELL_CORROSION, false);
events.ScheduleEvent(EVENT_CORROSION, urand(20000, 30000));
break;
case EVENT_GAS_NOVA:
DoCast(me, SPELL_GAS_NOVA, false);
events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000, 25000));
break;
case EVENT_ENCAPSULATE:
if (Unit* target = SelectTarget(<API key>, 0, 150, true))
DoCast(target, <API key>, false);
events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000, 30000));
break;
case EVENT_FLIGHT:
EnterPhase(PHASE_FLIGHT);
break;
default:
<API key>();
break;
}
}
if (phase == PHASE_FLIGHT)
{
switch (events.ExecuteEvent())
{
case EVENT_BERSERK:
Talk(YELL_BERSERK);
DoCast(me, SPELL_BERSERK, true);
break;
case <API key>:
<API key>();
break;
case EVENT_SUMMON_FOG:
{
float x, y, z;
me->GetPosition(x, y, z);
me-><API key>(x, y, z);
if (Creature* Fog = me->SummonCreature(NPC_VAPOR_TRAIL, x, y, z, 0, <API key>, 10000))
{
Fog-><API key>(SPELL_TRAIL_TRIGGER);
Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true);
me->CastSpell(Fog, SPELL_FOG_FORCE, true);
}
}
events.ScheduleEvent(EVENT_SUMMON_FOG, 1000);
break;
}
}
}
void DespawnSummons(uint32 entry)
{
std::list<Creature*> templist;
float x, y, z;
me->GetPosition(x, y, z);
Trinity::<API key> check(me, entry, 100);
Trinity::<API key><Trinity::<API key>> searcher(me, templist, check);
Cell::VisitGridObjects(me, searcher, me-><API key>());
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{
if (entry == NPC_VAPOR_TRAIL && phase == PHASE_FLIGHT)
{
(*i)->GetPosition(x, y, z);
me->SummonCreature(NPC_DEAD, x, y, z, 0, <API key>, 5000);
}
(*i)->SetVisible(false);
(*i)->DespawnOrUnsummon();
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetSunwellPlateauAI<boss_felmystAI>(creature);
}
};
class npc_felmyst_vapor : public CreatureScript
{
public:
npc_felmyst_vapor() : CreatureScript("npc_felmyst_vapor") { }
CreatureAI* GetAI(Creature* creature) const override
{
return GetSunwellPlateauAI<npc_felmyst_vaporAI>(creature);
}
struct npc_felmyst_vaporAI : public ScriptedAI
{
npc_felmyst_vaporAI(Creature* creature) : ScriptedAI(creature)
{
me->SetFlag(UNIT_FIELD_FLAGS, <API key>);
me->SetSpeedRate(MOVE_RUN, 0.8f);
}
void Reset() override { }
void EnterCombat(Unit* /*who*/) override
{
DoZoneInCombat();
//DoCast(me, SPELL_VAPOR_FORCE, true); core bug
}
void UpdateAI(uint32 /*diff*/) override
{
if (!me->GetVictim())
if (Unit* target = SelectTarget(<API key>, 0, 100, true))
AttackStart(target);
}
};
};
class npc_felmyst_trail : public CreatureScript
{
public:
npc_felmyst_trail() : CreatureScript("npc_felmyst_trail") { }
CreatureAI* GetAI(Creature* creature) const override
{
return GetSunwellPlateauAI<npc_felmyst_trailAI>(creature);
}
struct npc_felmyst_trailAI : public ScriptedAI
{
npc_felmyst_trailAI(Creature* creature) : ScriptedAI(creature)
{
me->SetFlag(UNIT_FIELD_FLAGS, <API key>);
DoCast(me, SPELL_TRAIL_TRIGGER, true);
me->SetTarget(me->GetGUID());
me->SetFloatValue(<API key>, 0.01f); // core bug
}
void Reset() override { }
void EnterCombat(Unit* /*who*/) override { }
void AttackStart(Unit* /*who*/) override { }
void MoveInLineOfSight(Unit* /*who*/) override { }
void UpdateAI(uint32 /*diff*/) override { }
};
};
void AddSC_boss_felmyst()
{
new boss_felmyst();
new npc_felmyst_vapor();
new npc_felmyst_trail();
}
|
#include "squid.h"
#include "anyp/PortCfg.h"
#include "comm/Connection.h"
#include "CommCalls.h"
#include "fde.h"
#include "globals.h"
/* CommCommonCbParams */
CommCommonCbParams::CommCommonCbParams(void *aData):
data(cbdataReference(aData)), conn(), flag(Comm::OK), xerrno(0), fd(-1)
{
}
CommCommonCbParams::CommCommonCbParams(const CommCommonCbParams &p):
data(cbdataReference(p.data)), conn(p.conn), flag(p.flag), xerrno(p.xerrno), fd(p.fd)
{
}
CommCommonCbParams::~CommCommonCbParams()
{
cbdataReferenceDone(data);
}
void
CommCommonCbParams::print(std::ostream &os) const
{
if (conn != NULL)
os << conn;
else
os << "FD " << fd;
if (xerrno)
os << ", errno=" << xerrno;
if (flag != Comm::OK)
os << ", flag=" << flag;
if (data)
os << ", data=" << data;
}
/* CommAcceptCbParams */
CommAcceptCbParams::CommAcceptCbParams(void *aData):
CommCommonCbParams(aData), xaction()
{
}
void
CommAcceptCbParams::print(std::ostream &os) const
{
CommCommonCbParams::print(os);
if (xaction != NULL)
os << ", " << xaction->id;
}
/* CommConnectCbParams */
CommConnectCbParams::CommConnectCbParams(void *aData):
CommCommonCbParams(aData)
{
}
bool
CommConnectCbParams::syncWithComm()
{
// drop the call if the call was scheduled before comm_close but
// is being fired after comm_close
if (fd >= 0 && fd_table[fd].closing()) {
debugs(5, 3, HERE << "dropping late connect call: FD " << fd);
return false;
}
return true; // now we are in sync and can handle the call
}
/* CommIoCbParams */
CommIoCbParams::CommIoCbParams(void *aData): CommCommonCbParams(aData),
buf(NULL), size(0)
{
}
bool
CommIoCbParams::syncWithComm()
{
// change parameters if the call was scheduled before comm_close but
// is being fired after comm_close
if ((conn->fd < 0 || fd_table[conn->fd].closing()) && flag != Comm::ERR_CLOSING) {
debugs(5, 3, HERE << "converting late call to Comm::ERR_CLOSING: " << conn);
flag = Comm::ERR_CLOSING;
}
return true; // now we are in sync and can handle the call
}
void
CommIoCbParams::print(std::ostream &os) const
{
CommCommonCbParams::print(os);
if (buf) {
os << ", size=" << size;
os << ", buf=" << (void*)buf;
}
}
/* CommCloseCbParams */
CommCloseCbParams::CommCloseCbParams(void *aData):
CommCommonCbParams(aData)
{
}
/* CommTimeoutCbParams */
CommTimeoutCbParams::CommTimeoutCbParams(void *aData):
CommCommonCbParams(aData)
{
}
/* FdeCbParams */
FdeCbParams::FdeCbParams(void *aData):
CommCommonCbParams(aData)
{
}
/* CommAcceptCbPtrFun */
CommAcceptCbPtrFun::CommAcceptCbPtrFun(IOACB *aHandler,
const CommAcceptCbParams &aParams):
CommDialerParamsT<CommAcceptCbParams>(aParams),
handler(aHandler)
{
}
CommAcceptCbPtrFun::CommAcceptCbPtrFun(const CommAcceptCbPtrFun &o):
CommDialerParamsT<CommAcceptCbParams>(o.params),
handler(o.handler)
{
}
void
CommAcceptCbPtrFun::dial()
{
handler(params);
}
void
CommAcceptCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
/* CommConnectCbPtrFun */
CommConnectCbPtrFun::CommConnectCbPtrFun(CNCB *aHandler,
const CommConnectCbParams &aParams):
CommDialerParamsT<CommConnectCbParams>(aParams),
handler(aHandler)
{
}
void
CommConnectCbPtrFun::dial()
{
handler(params.conn, params.flag, params.xerrno, params.data);
}
void
CommConnectCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
/* CommIoCbPtrFun */
CommIoCbPtrFun::CommIoCbPtrFun(IOCB *aHandler, const CommIoCbParams &aParams):
CommDialerParamsT<CommIoCbParams>(aParams),
handler(aHandler)
{
}
void
CommIoCbPtrFun::dial()
{
handler(params.conn, params.buf, params.size, params.flag, params.xerrno, params.data);
}
void
CommIoCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
/* CommCloseCbPtrFun */
CommCloseCbPtrFun::CommCloseCbPtrFun(CLCB *aHandler,
const CommCloseCbParams &aParams):
CommDialerParamsT<CommCloseCbParams>(aParams),
handler(aHandler)
{
}
void
CommCloseCbPtrFun::dial()
{
handler(params);
}
void
CommCloseCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
/* CommTimeoutCbPtrFun */
CommTimeoutCbPtrFun::CommTimeoutCbPtrFun(CTCB *aHandler,
const CommTimeoutCbParams &aParams):
CommDialerParamsT<CommTimeoutCbParams>(aParams),
handler(aHandler)
{
}
void
CommTimeoutCbPtrFun::dial()
{
handler(params);
}
void
CommTimeoutCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
/* FdeCbPtrFun */
FdeCbPtrFun::FdeCbPtrFun(FDECB *aHandler, const FdeCbParams &aParams) :
CommDialerParamsT<FdeCbParams>(aParams),
handler(aHandler)
{
}
void
FdeCbPtrFun::dial()
{
handler(params);
}
void
FdeCbPtrFun::print(std::ostream &os) const
{
os << '(';
params.print(os);
os << ')';
}
|
#include "common-defs.h"
#if CXX_STD_THREAD
#include "gdbsupport/thread-pool.h"
#include "gdbsupport/alt-stack.h"
#include "gdbsupport/block-signals.h"
#include <algorithm>
/* On the off chance that we have the pthread library on a Windows
host, but std::thread is not using it, avoid calling
pthread_setname_np on Windows. */
#ifndef _WIN32
#ifdef <API key>
#define <API key>
#endif
#endif
#ifdef <API key>
#include <pthread.h>
/* Handle platform discrepancies in pthread_setname_np: macOS uses a
single-argument form, while Linux uses a two-argument form. NetBSD
takes a printf-style format and an argument. This wrapper handles the
difference. */
ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (pthread_t, const char *, void *),
const char *name)
{
set_name (pthread_self (), "%s", const_cast<char *> (name));
}
ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
{
set_name (pthread_self (), name);
}
/* The macOS man page says that pthread_setname_np returns "void", but
the headers actually declare it returning "int". */
ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (const char *), const char *name)
{
set_name (name);
}
#endif /* <API key> */
namespace gdb
{
/* The thread pool detach()s its threads, so that the threads will not
prevent the process from exiting. However, it was discovered that
if any detached threads were still waiting on a condition variable,
then the condition variable's destructor would wait for the threads
to exit -- defeating the purpose.
Allocating the thread pool on the heap and simply "leaking" it
avoids this problem.
*/
thread_pool *thread_pool::g_thread_pool = new thread_pool ();
thread_pool::~thread_pool ()
{
/* Because this is a singleton, we don't need to clean up. The
threads are detached so that they won't prevent process exit.
And, cleaning up here would be actively harmful in at least one
case -- see the comment by the definition of g_thread_pool. */
}
void
thread_pool::set_thread_count (size_t num_threads)
{
std::lock_guard<std::mutex> guard (m_tasks_mutex);
/* If the new size is larger, start some new threads. */
if (m_thread_count < num_threads)
{
/* Ensure that signals used by gdb are blocked in the new
threads. */
block_signals blocker;
for (size_t i = m_thread_count; i < num_threads; ++i)
{
std::thread thread (&thread_pool::thread_function, this);
thread.detach ();
}
}
/* If the new size is smaller, terminate some existing threads. */
if (num_threads < m_thread_count)
{
for (size_t i = num_threads; i < m_thread_count; ++i)
m_tasks.emplace ();
m_tasks_cv.notify_all ();
}
m_thread_count = num_threads;
}
std::future<void>
thread_pool::post_task (std::function<void ()> func)
{
std::packaged_task<void ()> t (func);
std::future<void> f = t.get_future ();
if (m_thread_count == 0)
{
/* Just execute it now. */
t ();
}
else
{
std::lock_guard<std::mutex> guard (m_tasks_mutex);
m_tasks.emplace (std::move (t));
m_tasks_cv.notify_one ();
}
return f;
}
void
thread_pool::thread_function ()
{
#ifdef <API key>
/* This must be done here, because on macOS one can only set the
name of the current thread. */
set_thread_name (pthread_setname_np, "gdb worker");
#endif
/* Ensure that SIGSEGV is delivered to an alternate signal
stack. */
gdb::<API key> signal_stack;
while (true)
{
optional<task> t;
{
/* We want to hold the lock while examining the task list, but
not while invoking the task function. */
std::unique_lock<std::mutex> guard (m_tasks_mutex);
while (m_tasks.empty ())
m_tasks_cv.wait (guard);
t = std::move (m_tasks.front());
m_tasks.pop ();
}
if (!t.has_value ())
break;
(*t) ();
}
}
}
#endif /* CXX_STD_THREAD */
|
GCC_VERSION := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
ifeq ($(GCC_VERSION),0404)
<API key>.o = -Wframe-larger-than=1024
endif
ifeq ($(<API key>),y)
EXTRA_CFLAGS += -Idrivers/media/video/msm/csi
EXTRA_CFLAGS += -Idrivers/media/video/msm/io
EXTRA_CFLAGS += -Idrivers/media/video/msm/sensors
obj-$(CONFIG_MSM_CAMERA) += msm_isp.o msm.o msm_mem.o msm_mctl.o msm_mctl_buf.o msm_mctl_pp.o
obj-$(CONFIG_MSM_CAMERA) += rawchip-v4l2/ io/ sensors/ actuators/ csi/
else
ifeq ($(CONFIG_ARCH_MSM8X60),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera-8x60.o sensors/
ifeq ($(CONFIG_CAMERA_3D),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera_liteon.o sensors/
endif
else
ifeq ($(CONFIG_ARCH_MSM7X30),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera-7x30.o sensors/ rawchip/
else
obj-$(CONFIG_MSM_CAMERA) += msm_camera.o
endif
endif
endif
obj-$(CONFIG_MSM_CAMERA) += msm_axi_qos.o
ifeq ($(<API key>),y)
obj-$(CONFIG_MSM_CAMERA) += gemini/
obj-$(<API key>) += flash_v4l2.o
else
obj-$(CONFIG_MSM_CAMERA) += gemini_8x60/
ifeq ($(<API key>),y)
obj-$(<API key>) += flash.o
else
obj-$(<API key>) += flash_8x60.o
endif
endif
obj-$(<API key>) += msm_vfe7x.o msm_io7x.o
obj-$(<API key>) += msm_vfe7x27a.o msm_io_7x27a.o
obj-$(CONFIG_ARCH_MSM7X30) += msm_vfe_7x30.o msm_io_7x30.o msm_vpe1_7x30.o
obj-$(CONFIG_ARCH_QSD8X50) += msm_vfe8x.o msm_vfe8x_proc.o msm_io8x.o
ifdef CONFIG_S5K4E5YX
obj-$(CONFIG_MACH_BLISS) += s5k4e5yx.o s5k4e5yx_reg_bls.o
obj-$(CONFIG_MACH_BLISSC) += s5k4e5yx.o s5k4e5yx_reg_bls.o
obj-$(CONFIG_MACH_PRIMOU) += s5k4e5yx.o s5k4e5yx_reg_pro.o
obj-$(CONFIG_MACH_PRIMOC) += s5k4e5yx.o s5k4e5yx_reg_pro.o
obj-$(CONFIG_MACH_KINGDOM) += s5k4e5yx.o s5k4e5yx_reg_kin.o
endif
ifdef CONFIG_MACH_VISION
obj-$(CONFIG_S5K4E1GX) += s5k4e1gx.o s5k4e1gx_reg.o
endif
ifeq ($(<API key>),y)
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60_v4l2.o msm_vfe31_v4l2.o msm_vpe_8x60_v4l2.o
else
ifdef CONFIG_CAMERA_ZSL
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60_ZSL.o msm_vpe1_8x60.o
else
ifdef CONFIG_CAMERA_3D
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60.o msm_vpe1_8x60.o
obj-$(CONFIG_ARCH_MSM8X60) += msm_vfe31_liteon.o msm_vpe1_liteon.o
else
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60.o msm_vpe1_8x60.o
endif
endif
endif
obj-$(CONFIG_ARCH_MSM8960) += msm_io_8960.o msm_ispif.o msm_vfe32.o msm_vpe.o
obj-$(CONFIG_MT9T013) += mt9t013.o mt9t013_reg.o
obj-$(CONFIG_SN12M0PZ) += sn12m0pz.o sn12m0pz_reg.o
obj-$(CONFIG_MT9P012) += mt9p012_reg.o
ifeq ($(CONFIG_S5K4E1),y)
ifdef CONFIG_MACH_PRIMOTD
obj-$(CONFIG_S5K4E1) += s5k4e1_td.o s5k4e1_reg_td.o
else
ifdef CONFIG_MACH_GOLFC
obj-$(CONFIG_S5K4E1) += s5k4e1_ff.o s5k4e1_reg_ff.o
else
obj-$(CONFIG_S5K4E1) += s5k4e1.o s5k4e1_reg.o
endif
endif
endif
obj-$(<API key>) += mt9p012_fox.o
obj-$(<API key>) += mt9p012_bam.o
obj-$(CONFIG_MT9P012_KM) += mt9p012_km.o mt9p012_km_reg.o
obj-$(CONFIG_MT9E013) += mt9e013.o mt9e013_reg.o
obj-$(CONFIG_S5K3E2FX) += s5k3e2fx.o
ifdef CONFIG_MACH_PYRAMID
obj-$(CONFIG_S5K3H1GX) += s5k3h1gx.o s5k3h1gx_reg.o
endif
ifdef CONFIG_S5K3H1GX
obj-$(CONFIG_MACH_SPADE) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(CONFIG_MACH_VIVO) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(CONFIG_MACH_VIVOW) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(<API key>) += s5k3h1gx.o s5k3h1gx_reg.o
endif
#FIXME: Merge the two ifeq causes VX6953 preview not coming up.
ifeq ($(<API key>),y)
obj-$(CONFIG_VX6953) += vx6953_v4l2.o vx6953_reg_v4l2.o
obj-$(CONFIG_MT9V113) += mt9v113_v4l2.o <API key>.o
else
obj-$(CONFIG_MT9V113) += mt9v113.o <API key>.o
obj-$(CONFIG_VX6953) += vx6953.o vx6953_reg.o
obj-$(CONFIG_IMX074) += imx074.o imx074_reg.o
endif
obj-$(CONFIG_QS_MT9P017) += qs_mt9p017.o qs_mt9p017_reg.o
obj-$(CONFIG_VB6801) += vb6801.o
obj-$(CONFIG_IMX072) += imx072.o imx072_reg.o
obj-$(<API key>) += ov9726.o ov9726_reg.o
obj-$(<API key>) += ov7692.o
obj-$(CONFIG_OV8810) += ov8810.o
obj-$(CONFIG_MT9D112) += mt9d112.o mt9d112_reg.o
obj-$(CONFIG_MT9D113) += mt9d113.o mt9d113_reg.o
|
require 'spec_helper'
require 'boost_trust_level'
describe BoostTrustLevel do
let(:user) { Fabricate(:user, trust_level: TrustLevel.levels[:newuser]) }
let(:logger) { StaffActionLogger.new(Fabricate(:admin)) }
it "should upgrade the trust level of a user" do
boostr = BoostTrustLevel.new(user: user, level: TrustLevel.levels[:basic], logger: logger)
boostr.save!.should be_true
user.trust_level.should == TrustLevel.levels[:basic]
end
it "should log the action" do
StaffActionLogger.any_instance.expects(:<API key>).with(user, TrustLevel.levels[:newuser], TrustLevel.levels[:basic]).once
boostr = BoostTrustLevel.new(user: user, level: TrustLevel.levels[:basic], logger: logger)
boostr.save!
end
describe "demotions" do
context "for a user that has not done the requisite things to attain their trust level" do
before do
# scenario: admin mistakenly promotes user's trust level
user.update_attributes(trust_level: TrustLevel.levels[:basic])
end
it "should demote the user and log the action" do
StaffActionLogger.any_instance.expects(:<API key>).with(user, TrustLevel.levels[:basic], TrustLevel.levels[:newuser]).once
boostr = BoostTrustLevel.new(user: user, level: TrustLevel.levels[:newuser], logger: logger)
boostr.save!.should be_true
user.trust_level.should == TrustLevel.levels[:newuser]
end
end
context "for a user that has done the requisite things to attain their trust level" do
before do
user.topics_entered = SiteSetting.<API key> + 1
user.posts_read_count = SiteSetting.<API key> + 1
user.time_read = SiteSetting.<API key> * 60
user.save!
user.update_attributes(trust_level: TrustLevel.levels[:basic])
end
it "should not demote the user and not log the action" do
StaffActionLogger.any_instance.expects(:<API key>).never
boostr = BoostTrustLevel.new(user: user, level: TrustLevel.levels[:newuser], logger: logger)
expect { boostr.save! }.to raise_error(Discourse::InvalidAccess, "You attempted to demote #{user.name} to 'newuser'. However their trust level is already 'basic'. #{user.name} will remain at 'basic'")
user.trust_level.should == TrustLevel.levels[:basic]
end
end
end
end
|
.ja-slidewrap_erio {
width: 100%;
position: relative;
}
.ja-slide-item img {
background: #fff;
}
.active .<API key> {
border: none;
color: #fff;
}
.active .<API key> img {
background: #57212A;
border: 1px solid #67373F;
}
.<API key>,
.<API key>,
.<API key> {
float: left;
}
.<API key>, .<API key> {}
/* Mask Desc */
.maskDesc {
z-index: 11;
top: 0;
}
.main .maskDesc .inner {
padding: 0 0 0 510px;
position: absolute;
top: 252px;
left: 0;
z-index: 12;
}
.maskDesc a.readon {
background: #61abd6;
color: #fff;
padding: 7px 15px 6px;
display: inline-block;
border-radius: 3px;
-moz-border-radius: 3px;
-<API key>: 3px;
}
.maskDesc a.readon span { cursor: pointer; }
.maskDesc a.readmore { margin-top: 30px; }
.maskDesc a.readon:hover, .maskDesc a.readon:active, .maskDesc a.readon:focus {
background: #666;
}
.ja-slide-desc {
position: absolute;
top: 0;
right: 0;
height: 268px;
width: 390px;
background: #000;
opacity: .9;
filter: alpha(opacity = 90);
padding: 52px 40px 40px;
}
div.ja-moduletable .ja-slide-desc h3 {
color: #fff;
font-size: 300%;
}
div.ja-moduletable .ja-slide-desc h3 a { color: #fff; }
.ja-slide-desc p { color: #7b7d80; line-height: 2; }
/* Slide buttons */
#ja-slideshow .ja-slide-buttons {
height: 10px;
position: relative;
top: 10px;
width: 28px;
bottom: 0;
left: 470px !important;
z-index: 50;
}
.ja-slide-buttons .ja-slide-playback, .ja-slide-buttons .ja-slide-stop,
.ja-slide-buttons .ja-slide-play {
display: none !important;
}
.ja-slide-buttons span.ja-slide-prev, .ja-slide-buttons span.ja-slide-next {
width: 10px;
height: 10px;
font-size: 0px;
line-height: 0px;
text-indent: -9999em;
background: url("thumb.png") no-repeat scroll left top;
padding: 0px !important;
margin: 0px 0px 0px 3px !important;
}
.ja-slide-buttons span.ja-slide-prev.hover,
.ja-slide-buttons span.ja-slide-next.hover {
background: url("thumb.png") no-repeat scroll left bottom;
}
.ja-slide-buttons span {
color: #fff;
cursor: pointer;
display: block;
float: left;
margin-right: 5px;
padding: 2px 5px;
background: #61abd6;
}
/* From Articles */
.ja-articles .<API key>,
.<API key> .<API key> {
opacity: 0.001 !important;
filter: alpha(opacity = 0.10) !important;
background: #000 ;
}
.ja-slide-thumbs, .<API key>, .<API key> {
width: auto;
height: auto;
position: absolute;
top: 0;
left: 0 !important;
}
.<API key> {
background: none;
border: none;
margin: 0px !important;
padding: 0px !important;
}
#ja-slideshow .ja-slide-thumb img {
padding: 0px !important;
border: none;
margin: 0px !important;
}
#ja-slideshow .<API key> {
bottom: 0px;
right: 0px;
background: none;
}
p.<API key> {
z-index: 1000;
}
.ja-slide-thumb .<API key>,
.ja-slide-thumbs .ja-slide-thumb {
background: #000 !important;
opacity: 0.3;
filter: alpha(opacity = 30);
}
.ja-slide-thumb.active .<API key>,
.ja-slide-thumbs .ja-slide-thumb.active {
opacity: 1;
filter: alpha(opacity = 100);
}
.<API key> h3 {
display: none;
}
.<API key> {
background: #000;
opacity: 0.1;
filter: alpha(opacity = 10);
}
.ja-slide-desc a {
color: #fff;
font-size: 300%;
line-height: 1.2;
margin: 0px 0px 25px;
padding: 0px 0px 13px;
background: url(short_hor_line.gif) no-repeat scroll 0 100%;
display: block;
font-family: Helvetica,Arial,sans-serif;
}
.ja-slide-desc a:hover,
.ja-slide-desc a:focus,
.ja-slide-desc a:active {
color: #fff;
}
|
module test {
// jdk.test.resources.classes.MyResourcesProvider is in named.bundles.
requires named.bundles;
uses jdk.test.resources.classes.MyResourcesProvider;
uses jdk.test.resources.props.MyResourcesProvider;
}
|
#include "OutdoorPvP.h"
#include "Language.h"
#include "World.h"
#include "ObjectMgr.h"
#include "Object.h"
#include "GameObject.h"
#include "Player.h"
/**
Function that adds a player to the players of the affected outdoor pvp zones
@param player to add
@param whether zone is main outdoor pvp zone or a affected zone
*/
void OutdoorPvP::<API key>(Player* player, bool isMainZone)
{
m_zonePlayers[player->GetObjectGuid()] = isMainZone;
}
/**
Function that removes a player from the players of the affected outdoor pvp zones
@param player to remove
@param whether zone is main outdoor pvp zone or a affected zone
*/
void OutdoorPvP::<API key>(Player* player, bool isMainZone)
{
if (m_zonePlayers.erase(player->GetObjectGuid()))
{
// remove the world state information from the player
if (isMainZone && !player->GetSession()->PlayerLogout())
<API key>(player);
sLog.outDebug("Player %s left an Outdoor PvP zone", player->GetName());
}
}
/**
Function that updates the world state for all the players of the outdoor pvp zone
@param world state to update
@param new world state value
*/
void OutdoorPvP::<API key>(uint32 field, uint32 value)
{
for (GuidZoneMap::const_iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
// only send world state update to main zone
if (!itr->second)
continue;
if (!IsMember(itr->first))
continue;
if (Player* player = sObjectMgr.GetPlayer(itr->first))
player-><API key>(field, value);
}
}
/**
Function that updates world state for all the players in an outdoor pvp map
@param world state it to update
@param value which should update the world state
*/
void OutdoorPvP::<API key>(uint32 uiField, uint32 uiValue, Map* map)
{
Map::PlayerList const& pList = map->GetPlayers();
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
{
if (!itr->getSource() || !itr->getSource()->IsInWorld())
continue;
itr->getSource()-><API key>(uiField, uiValue);
}
}
void OutdoorPvP::<API key>(GameObject* go)
{
// set initial data and activate capture points
if (go->GetGOInfo()->type == <API key>)
go-><API key>(sOutdoorPvPMgr.<API key>(go->GetEntry(), <API key>));
}
void OutdoorPvP::<API key>(GameObject* go)
{
// save capture point slider value (negative value if locked)
if (go->GetGOInfo()->type == <API key>)
sOutdoorPvPMgr.<API key>(go->GetEntry(), go->getLootState() == GO_ACTIVATED ? go-><API key>() : -go-><API key>());
}
/**
Function that handles player kills in the main outdoor pvp zones
@param player who killed another player
@param victim who was killed
*/
void OutdoorPvP::HandlePlayerKill(Player* killer, Unit* victim)
{
Player* plr = victim-><API key>();
if (plr && killer->GetTeam() == plr->GetTeam())
return;
if (Group* group = killer->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* groupMember = itr->getSource();
if (!groupMember)
continue;
// skip if too far away
if (!groupMember-><API key>(victim))
continue;
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if (groupMember->CanUseCapturePoint())
<API key>(groupMember, victim);
}
}
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
if (killer && killer->CanUseCapturePoint())
<API key>(killer, victim);
}
}
// apply a team buff for the main and affected zones
void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/, bool onlyMembers /*= true*/, uint32 area /*= 0*/)
{
for (GuidZoneMap::const_iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
Player* player = sObjectMgr.GetPlayer(itr->first);
if (!player)
continue;
if (player && (team == TEAM_NONE || player->GetTeam() == team) && (!onlyMembers || IsMember(player->GetObjectGuid())))
{
if (!area || area == player->GetAreaId())
{
if (remove)
player-><API key>(spellId);
else
player->CastSpell(player, spellId, true);
}
}
}
}
uint32 OutdoorPvP::GetBannerArtKit(Team team, uint32 artKitAlliance /*= <API key>*/, uint32 artKitHorde /*= <API key>*/, uint32 artKitNeutral /*= <API key>*/)
{
switch (team)
{
case ALLIANCE:
return artKitAlliance;
case HORDE:
return artKitHorde;
default:
return artKitNeutral;
}
}
void OutdoorPvP::SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
SetBannerVisual(go, artKit, animId);
}
void OutdoorPvP::SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId)
{
go-><API key>(go->GetObjectGuid(), animId);
go->SetGoArtKit(artKit);
go->Refresh();
}
void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool respawn)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
{
go->SetRespawnTime(7 * DAY);
if (respawn)
go->Refresh();
else if (go->isSpawned())
go->SetLootState(GO_JUST_DEACTIVATED);
}
}
|
/* <API key>: LGPL-2.1+ */
#pragma once
#define VERB_ANY ((unsigned) -1)
typedef enum VerbFlags {
VERB_DEFAULT = 1 << 0,
VERB_ONLINE_ONLY = 1 << 1,
VERB_MUST_BE_ROOT = 1 << 2,
} VerbFlags;
typedef struct {
const char *verb;
unsigned min_args, max_args;
VerbFlags flags;
int (* const dispatch)(int argc, char *argv[], void *userdata);
} Verb;
bool <API key>(void);
int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata);
|
/* <API key>: LGPL-2.1+ */
#include "hostname-setup.h"
#include "util.h"
int main(int argc, char* argv[]) {
int r;
r = hostname_setup();
if (r < 0)
log_error_errno(r, "hostname: %m");
return 0;
}
|
#ifndef <API key>
#define <API key>
#import <Foundation/NSDate.h>
@class NSCalendarDate;
@interface NSDate (MAPIStoreDataTypes)
+ (NSCalendarDate *) <API key>: (uint32_t) minutes;
- (uint32_t) asMinutesSince1601;
+ (id) dateFromFileTime: (const struct FILETIME *) timeValue;
- (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx;
- (BOOL) isNever; /* occurs on 4500-12-31 */
+ (NSCalendarDate *) dateFromSystemTime: (struct SYSTEMTIME) date
andRuleYear: (uint16_t) rYear;
@end
NSComparisonResult NSDateCompare (id date1, id date2, void *);
#endif /* NSCALENDARDATE+MAPISTORE_H */
|
1.7.3 - 15/04/2015
Changes:
* Fixed #114 Background image appears when page is loading
1.7.1 - 08/04/2015
Changes:
* Fixed XSS vulnerability with contact form
1.7.1 - 07/04/2015
Changes:
* Padding issue
* Fixed #104 No image appears on the blog page on IE8
1.6.9 - 04/04/2015
Changes:
* Fixed #85, error in js, when contact form is not displayed, which caused about us circles to stop working
* Fixed #82, problem with Our Focus widget colors
* Replaced screenshot with the new format
1200x900
.jpg -> .png
* Merge pull request #87 from DragosBubu/development
Replaced screenshot with the new format
* Fixed #80 No Compatible with IE9
* Fixed #94 WooCommerce Pagination Issue
* Fixed #95 Featured products issue
* This fixes
New screenshot
* Merge pull request #96 from DragosBubu/development
This fixes
* Fixed #99, removed sidebar from woocommerce templates
* Fixed #100, removed sidebar from checkout page
* Fixed #101, theme not loading on IE8, included scrollReveal.js for versions greater then IE8
* H tags incompatible with plugins
* Fixed large bottom padding on frontpage sections
* Introduced new (large) template for Blog
* Fixed #103 Blog alignment problem
* Fixed #105 New blog template looks very bad on IE8
1.6.0 - 17/03/2015
Changes:
* Woocommerce style issues
* Fixed Shop page mobile issue
* Fixed #79 Responsive menu issues
* Fixed #78, added author link for testimonial widget
1.5.4 - 05/03/2015
Changes:
* Latest news issue on iPad
* Woocommerce display for older versions
* Branding
- Modified background image
+ added focus images
* Branding - follow-up
removed unnecessary images
added screenshot
* Replaced screenshot
* Merge pull request #74 from DragosBubu/development
Branding
1.4.7 - 12/02/2015
Changes:
* Fixed #62, #51 our team widgets default alignment
* Increased version
1.4.6 - 06/02/2015
Changes:
* Open social links in new tab
Open social links in new tab
* added travis
added travis
* fixed travis
* fixed syntax error
* Update style.css
* Merge pull request #56 from HardeepAsrani/development
Open social links in new tab
* remove travis
1.4.5 - 30/01/2015
Changes:
* Update style.css
* Update customizer.php
1.4.5 - 30/01/2015
Changes:
* Update style.css
* Update style.css
* Update style.css
* Fixed #42, big title enclosing tag h1 , not h6
* Fixed #44, disable preloader from customizer
* Fix #38, fixed our focus section hover colors
* Fixed #48, replace wp product review by login customizer
* Fixed #41, reversed telephone and mail icons in footer
* Fixed #40, fixed team member widgets for more than 4
* Fixed #32, load customizer scripts just in customizer, not in all backend pages
* Fix #16, hover efects for our focus widgets, when more than 4
1.4.4 - 19/01/2015
Changes:
* This fixes #35, translate strings plus generate pot file
* Fixes our focus centering when theme is first installed
* Update style.css
1.4.3 - 09/01/2015
Changes:
* This fixes #31 , translation issue
* This fixes #30, wrong textdomain
* This fixes #28, header cuts of title on mobile
* This fixes #9, overlap header with text
* Aliniere compononete Our focus
* Footer apare in partea de jos a ecranului, dar nu a site-ului
* This fixes #22, .pot file
1.4.2 - 08/01/2015
Changes:
* This fixes #13 upsell in customizer
* This fixes #22, updated pot file
* THis fixes #15, responsive background image
* This fixes #23, changing section names in customizer
* This fixes #24, hover radio buttons, + update style version
* Cart without sidebar
* This fixes #25, remove widget customizer for wp greater versions
1.4.1 - 02/01/2015
Changes:
* disable fonts for some languages
* Update style.css
* Update functions.php
1.4.0 - 31/12/2014
Changes:
* Merge pull request #20 from Codeinwp/production
merge back-ward
* added full width page
1.3.5 - 19/11/2014
Changes:
* Update home.php
* Update style.css
1.3.4 - 19/11/2014
Changes:
* fixed form subject issue, added linkedin icon and icons for socials, our focus clickable, contact section button and email, link on read more
* Added pro extra options in customizer
* woocommerce , wpml and rtl support, fixed undefined index errors, changed description, added more themes page and fixed front page
* fixed wrong description, links and tagline
fixed wrong description, links and tagline
* Fixed fotter and added woocommerce style
* Frontpage template
* Fixed wp.org fronpage and blog
* Update home.php
1.1 - 23/10/2014
Changes:
* Fixed dropdown menu
* Updated theme version
1.0.9 - 21/10/2014
Changes:
* Fixed fonts, added fontawesome notification footer links
Fixed fonts, added fontawesome notification footer links
1.0.7 - 21/10/2014
Changes:
* removed widget customizer plugin
* Update style.css
1.0.6 - 20/10/2014
Changes:
* Update functions.php
* fixed the font issue with https websites
1.0.5 - 17/10/2014
Changes:
* First version
* some fixes for responsive
* I added <Product Rewiew> and <Tweet old post> plugin
* removed error.log
* sync with wp.org
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.