repo_name
stringlengths 6
101
| path
stringlengths 4
300
| text
stringlengths 7
1.31M
|
|---|---|---|
RNunes13/biblio
|
src/assets/js/pages/Profile/profile-index.js
|
import ProfileMain from '../../../common/js/modules/Profile';
export default {
init() {
ProfileMain.init();
},
};
|
MrMPN/hivemq-mqtt-client
|
src/main/java/com/hivemq/client/internal/mqtt/mqtt3/Mqtt3RxClientViewBuilder.java
|
/*
* Copyright 2018 dc-square and the HiveMQ MQTT Client Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.hivemq.client.internal.mqtt.mqtt3;
import com.hivemq.client.internal.mqtt.*;
import com.hivemq.client.internal.mqtt.advanced.MqttClientAdvancedConfig;
import com.hivemq.client.internal.mqtt.message.auth.MqttSimpleAuth;
import com.hivemq.client.internal.mqtt.message.auth.mqtt3.Mqtt3SimpleAuthView;
import com.hivemq.client.internal.mqtt.message.auth.mqtt3.Mqtt3SimpleAuthViewBuilder;
import com.hivemq.client.internal.mqtt.message.publish.MqttWillPublish;
import com.hivemq.client.internal.mqtt.message.publish.mqtt3.Mqtt3PublishView;
import com.hivemq.client.internal.mqtt.message.publish.mqtt3.Mqtt3PublishViewBuilder;
import com.hivemq.client.internal.util.Checks;
import com.hivemq.client.mqtt.MqttVersion;
import com.hivemq.client.mqtt.mqtt3.Mqtt3ClientBuilder;
import com.hivemq.client.mqtt.mqtt3.message.auth.Mqtt3SimpleAuth;
import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author <NAME>
*/
public class Mqtt3RxClientViewBuilder extends MqttRxClientBuilderBase<Mqtt3RxClientViewBuilder>
implements Mqtt3ClientBuilder {
private @Nullable MqttSimpleAuth simpleAuth;
private @Nullable MqttWillPublish willPublish;
public Mqtt3RxClientViewBuilder() {}
public Mqtt3RxClientViewBuilder(final @NotNull MqttRxClientBuilderBase clientBuilder) {
super(clientBuilder);
}
@Override
public @NotNull Mqtt3RxClientViewBuilder simpleAuth(final @Nullable Mqtt3SimpleAuth simpleAuth) {
this.simpleAuth = (simpleAuth == null) ? null :
Checks.notImplemented(simpleAuth, Mqtt3SimpleAuthView.class, "Simple auth").getDelegate();
return this;
}
@Override
public @NotNull Mqtt3SimpleAuthViewBuilder.Nested<Mqtt3RxClientViewBuilder> simpleAuth() {
return new Mqtt3SimpleAuthViewBuilder.Nested<>(this::simpleAuth);
}
@Override
public @NotNull Mqtt3RxClientViewBuilder willPublish(final @Nullable Mqtt3Publish willPublish) {
this.willPublish = (willPublish == null) ? null :
Checks.notImplemented(willPublish, Mqtt3PublishView.class, "Will publish").getDelegate().asWill();
return this;
}
@Override
public @NotNull Mqtt3PublishViewBuilder.WillNested<Mqtt3RxClientViewBuilder> willPublish() {
return new Mqtt3PublishViewBuilder.WillNested<>(this::willPublish);
}
@Override
protected @NotNull Mqtt3RxClientViewBuilder self() {
return this;
}
@Override
public @NotNull Mqtt3RxClientView build() {
return buildRx();
}
@Override
public @NotNull Mqtt3RxClientView buildRx() {
return new Mqtt3RxClientView(buildRxDelegate());
}
@Override
public @NotNull Mqtt3AsyncClientView buildAsync() {
return new Mqtt3AsyncClientView(buildAsyncDelegate());
}
@Override
public @NotNull Mqtt3BlockingClientView buildBlocking() {
return new Mqtt3BlockingClientView(buildBlockingDelegate());
}
private @NotNull MqttRxClient buildRxDelegate() {
return new MqttRxClient(buildClientConfig());
}
private @NotNull MqttAsyncClient buildAsyncDelegate() {
return buildRxDelegate().toAsync();
}
private @NotNull MqttBlockingClient buildBlockingDelegate() {
return buildRxDelegate().toBlocking();
}
private @NotNull MqttClientConfig buildClientConfig() {
return buildClientConfig(MqttVersion.MQTT_3_1_1, MqttClientAdvancedConfig.DEFAULT,
MqttClientConfig.ConnectDefaults.of(simpleAuth, null, willPublish));
}
}
|
muescha/website
|
spec/controllers/markdown_converter_controller_test.rb
|
require 'spec_helper'
describe Api::MarkdownConverterController, type: :controller do
it "should render markdown" do
text = '**STRONG**'
get :convert, text: text
expect(response).to be_success
expect(response.body).to eq("<p><strong>STRONG</strong></p>\n")
end
it "should render nothing if no text is given" do
get :convert
expect(response).to be_success
expect(response.body).to be_empty
end
end
|
harfol/harthb
|
application/src/test/java/org/thingsboard/server/mqtt/attributes/request/AbstractMqttAttributesRequestJsonIntegrationTest.java
|
package org.thingsboard.server.mqtt.attributes.request;
import lombok.extern.slf4j.Slf4j;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.thingsboard.server.common.data.TransportPayloadType;
@Slf4j
public abstract class AbstractMqttAttributesRequestJsonIntegrationTest extends AbstractMqttAttributesRequestIntegrationTest {
@Before
public void beforeTest() throws Exception {
processBeforeTest("Test Request attribute values from the server json", "Gateway Test Request attribute values from the server json", TransportPayloadType.JSON, null, null);
}
@After
public void afterTest() throws Exception {
processAfterTest();
}
@Test
public void testRequestAttributesValuesFromTheServer() throws Exception {
processTestRequestAttributesValuesFromTheServer();
}
@Test
public void testRequestAttributesValuesFromTheServerGateway() throws Exception {
processTestGatewayRequestAttributesValuesFromTheServer();
}
}
|
ZHONG007/vxe-table
|
lib/switch/src/switch.js
|
<gh_stars>0
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _vue = require("vue");
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
var _size = require("../../hooks/size");
var _utils = require("../../tools/utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default2 = (0, _vue.defineComponent)({
name: 'VxeSwitch',
props: {
modelValue: [String, Number, Boolean],
disabled: Boolean,
size: {
type: String,
default: function _default() {
return _conf.default.switch.size || _conf.default.size;
}
},
openLabel: String,
closeLabel: String,
openValue: {
type: [String, Number, Boolean],
default: true
},
closeValue: {
type: [String, Number, Boolean],
default: false
},
openIcon: String,
closeIcon: String
},
emits: ['update:modelValue', 'change', 'focus', 'blur'],
setup: function setup(props, context) {
var emit = context.emit;
var xID = _xeUtils.default.uniqueId();
var computeSize = (0, _size.useSize)(props);
var reactData = (0, _vue.reactive)({
isActivated: false,
hasAnimat: false,
offsetLeft: 0
});
var $xeswitch = {
xID: xID,
props: props,
context: context,
reactData: reactData
};
var refButton = (0, _vue.ref)();
var switchMethods = {};
var computeOnShowLabel = (0, _vue.computed)(function () {
return (0, _utils.getFuncText)(props.openLabel);
});
var computeOffShowLabel = (0, _vue.computed)(function () {
return (0, _utils.getFuncText)(props.closeLabel);
});
var computeIsChecked = (0, _vue.computed)(function () {
return props.modelValue === props.openValue;
});
var _atimeout;
var clickEvent = function clickEvent(evnt) {
if (!props.disabled) {
var isChecked = computeIsChecked.value;
clearTimeout(_atimeout);
var value = isChecked ? props.closeValue : props.openValue;
reactData.hasAnimat = true;
emit('update:modelValue', value);
switchMethods.dispatchEvent('change', {
value: value
}, evnt);
_atimeout = setTimeout(function () {
reactData.hasAnimat = false;
}, 400);
}
};
var focusEvent = function focusEvent(evnt) {
reactData.isActivated = true;
switchMethods.dispatchEvent('focus', {
value: props.modelValue
}, evnt);
};
var blurEvent = function blurEvent(evnt) {
reactData.isActivated = false;
switchMethods.dispatchEvent('blur', {
value: props.modelValue
}, evnt);
};
switchMethods = {
dispatchEvent: function dispatchEvent(type, params, evnt) {
emit(type, Object.assign({
$switch: $xeswitch,
$event: evnt
}, params));
},
focus: function focus() {
var btnElem = refButton.value;
reactData.isActivated = true;
btnElem.focus();
return (0, _vue.nextTick)();
},
blur: function blur() {
var btnElem = refButton.value;
btnElem.blur();
reactData.isActivated = false;
return (0, _vue.nextTick)();
}
};
Object.assign($xeswitch, switchMethods);
var renderVN = function renderVN() {
var _a;
var disabled = props.disabled,
openIcon = props.openIcon,
closeIcon = props.closeIcon;
var isChecked = computeIsChecked.value;
var vSize = computeSize.value;
var onShowLabel = computeOnShowLabel.value;
var offShowLabel = computeOffShowLabel.value;
return (0, _vue.h)('div', {
class: ['vxe-switch', isChecked ? 'is--on' : 'is--off', (_a = {}, _a["size--" + vSize] = vSize, _a['is--disabled'] = disabled, _a['is--animat'] = reactData.hasAnimat, _a)]
}, [(0, _vue.h)('button', {
ref: refButton,
class: 'vxe-switch--button',
type: 'button',
disabled: disabled,
onClick: clickEvent,
onFocus: focusEvent,
onBlur: blurEvent
}, [(0, _vue.h)('span', {
class: 'vxe-switch--label vxe-switch--label-on'
}, [openIcon ? (0, _vue.h)('i', {
class: ['vxe-switch--label-icon', openIcon]
}) : (0, _vue.createCommentVNode)(), onShowLabel]), (0, _vue.h)('span', {
class: 'vxe-switch--label vxe-switch--label-off'
}, [closeIcon ? (0, _vue.h)('i', {
class: ['vxe-switch--label-icon', closeIcon]
}) : (0, _vue.createCommentVNode)(), offShowLabel]), (0, _vue.h)('span', {
class: 'vxe-switch--icon'
})])]);
};
$xeswitch.renderVN = renderVN;
return $xeswitch;
},
render: function render() {
return this.renderVN();
}
});
exports.default = _default2;
|
shwestrick/mpl
|
runtime/platform/arm64.h
|
#define MLton_Platform_Arch_host "arm64"
|
larkov/MailTrackerBlocker
|
MailHeaders/Catalina/MailUI/MTMBufferedController.h
|
<filename>MailHeaders/Catalina/MailUI/MTMBufferedController.h<gh_stars>1000+
//
// Generated by class-dump 3.5b1 (64 bit) (Debug version compiled Dec 3 2019 19:59:57).
//
// Copyright (C) 1997-2019 <NAME>.
//
#import <objc/NSObject.h>
#import "MTMMailboxControllerProtocol-Protocol.h"
@class MTMMailbox, NSDictionary, NSMutableDictionary, NSString, NSURL, NSWindow;
@interface MTMBufferedController : NSObject <MTMMailboxControllerProtocol>
{
NSMutableDictionary *_accounts; // 8 = 0x8
NSURL *_mailLibraryURL; // 16 = 0x10
NSDictionary *_tableOfContents; // 24 = 0x18
NSDictionary *_preferences; // 32 = 0x20
MTMMailbox *_rootMailbox; // 40 = 0x28
}
@property(retain, nonatomic) MTMMailbox *rootMailbox; // @synthesize rootMailbox=_rootMailbox;
@property(readonly, copy, nonatomic) NSDictionary *preferences; // @synthesize preferences=_preferences;
@property(copy, nonatomic) NSDictionary *tableOfContents; // @synthesize tableOfContents=_tableOfContents;
@property(readonly, nonatomic) NSURL *mailLibraryURL; // @synthesize mailLibraryURL=_mailLibraryURL;
// - (void).cxx_destruct; // IMP=0x0000000100229118
- (void)updateThumbnailAsGenericWindow; // IMP=0x00000001002290bc
- (void)updateThumbnail; // IMP=0x00000001002290b6
- (void)adjustDisplayStateAfterTimeMachineStarted; // IMP=0x00000001002290b0
- (void)updateMessageListBindingsWithDisplayedMailbox:(id)arg1 scrollerDelta:(double)arg2; // IMP=0x00000001002290aa
- (void)restore:(id)arg1; // IMP=0x00000001002290a4
- (void)deactivate; // IMP=0x000000010022909e
- (void)activate; // IMP=0x0000000100229098
- (void)close; // IMP=0x0000000100229092
- (void)showWindow:(id)arg1; // IMP=0x000000010022908c
@property(readonly, nonatomic) NSWindow *window;
@property(copy, nonatomic) NSDictionary *displayState;
@property(retain, nonatomic) NSURL *focusURL;
@property(readonly, nonatomic) BOOL activated;
@property(readonly, nonatomic) MTMMailbox *selectedMailbox;
@property(readonly, nonatomic) double fadeDuration;
- (void)tearDown; // IMP=0x0000000100229012
- (id)revisionIDForURL:(id)arg1; // IMP=0x0000000100228c75
- (id)accountForAccountID:(id)arg1; // IMP=0x0000000100228c5f
- (id)messageWithID:(id)arg1; // IMP=0x0000000100228b60
- (BOOL)_loadTableOfContentsIfNeeded; // IMP=0x00000001002289d4
- (void)mailboxListWasUpdated:(id)arg1; // IMP=0x00000001002289ce
- (void)mailboxListWillBeUpdated:(id)arg1; // IMP=0x00000001002289c8
@property(readonly, nonatomic) NSURL *tocURL;
- (void)loadPreferences:(id *)arg1 accounts:(id *)arg2 tableOfContents:(id *)arg3 rootMailbox:(id *)arg4 forLibraryURL:(id)arg5; // IMP=0x00000001002287f0
- (id)init; // IMP=0x0000000100228721
- (id)initWithMailLibraryURL:(id)arg1; // IMP=0x0000000100228691
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
|
ruanwenjun/spring-study
|
spring-framework-study/src/test/java/org/example/springframework/contextaware/ApplicationContextAwareConfigTest.java
|
<filename>spring-framework-study/src/test/java/org/example/springframework/contextaware/ApplicationContextAwareConfigTest.java
package org.example.springframework.contextaware;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
* @author ruanwenjun
* @create 2020/05/14/ 11:48 AM
*/
public class ApplicationContextAwareConfigTest {
@Test
public void test() {
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ApplicationContextAwareConfig.class);
System.out.println(applicationContext);
ContextBean bean = applicationContext.getBean(ContextBean.class);
System.out.println(bean);
}
}
|
thepriyakadam/hrms
|
app/controllers/training_approvals_controller.rb
|
class TrainingApprovalsController < ApplicationController
before_action :set_training_approval, only: [:show, :edit, :update, :destroy]
# GET /training_approvals
# GET /training_approvals.json
def index
@training_approvals = TrainingApproval.all
end
# GET /training_approvals/1
# GET /training_approvals/1.json
def show
end
# GET /training_approvals/new
def new
@training_approval = TrainingApproval.new
end
# GET /training_approvals/1/edit
def edit
end
# POST /training_approvals
# POST /training_approvals.json
def create
@training_approval = TrainingApproval.new(training_approval_params)
respond_to do |format|
if @training_approval.save
format.html { redirect_to @training_approval, notice: 'Training approval was successfully created.' }
format.json { render :show, status: :created, location: @training_approval }
else
format.html { render :new }
format.json { render json: @training_approval.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /training_approvals/1
# PATCH/PUT /training_approvals/1.json
def update
respond_to do |format|
if @training_approval.update(training_approval_params)
format.html { redirect_to @training_approval, notice: 'Training approval was successfully updated.' }
format.json { render :show, status: :ok, location: @training_approval }
else
format.html { render :edit }
format.json { render json: @training_approval.errors, status: :unprocessable_entity }
end
end
end
# DELETE /training_approvals/1
# DELETE /training_approvals/1.json
def destroy
@training_approval.destroy
respond_to do |format|
format.html { redirect_to training_approvals_url, notice: 'Training approval was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_training_approval
@training_approval = TrainingApproval.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def training_approval_params
params.require(:training_approval).permit(:training_request_id, :employee_id, :training_topic_master_id, :reporting_master_id, :traininig_period, :training_date, :place, :no_of_employee, :description, :justification)
end
end
|
TOT0RoKR/tensorflow
|
tensorflow/core/distributed_runtime/worker.cc
|
<filename>tensorflow/core/distributed_runtime/worker.cc
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/distributed_runtime/worker.h"
#include "tensorflow/core/common_runtime/collective_executor_mgr.h"
#include "tensorflow/core/common_runtime/device_mgr.h"
#include "tensorflow/core/common_runtime/process_util.h"
#include "tensorflow/core/common_runtime/scoped_allocator_mgr.h"
#include "tensorflow/core/common_runtime/step_stats_collector.h"
#include "tensorflow/core/distributed_runtime/rendezvous_mgr_interface.h"
#include "tensorflow/core/distributed_runtime/tensor_coding.h"
#include "tensorflow/core/distributed_runtime/worker_session.h"
#include "tensorflow/core/platform/tracing.h"
#include "tensorflow/core/profiler/lib/device_profiler_session.h"
namespace tensorflow {
Worker::Worker(WorkerEnv* env) : env_(env), recent_request_ids_(100000) {
// Enable log history collection in StatusGroup so that recent warning and
// error log messages will be attached to the root error status to be
// forwarded to the master.
StatusGroup::ConfigureLogHistory();
}
void Worker::GetStatusAsync(CallOptions* opts, const GetStatusRequest* request,
GetStatusResponse* response, bool fail_fast,
StatusCallback done) {
const DeviceMgr* dm = env_->device_mgr;
std::vector<DeviceAttributes> devices;
dm->ListDeviceAttributes(&devices);
response->mutable_device_attributes()->Reserve(devices.size());
for (auto& d : devices) {
response->add_device_attributes()->Swap(&d);
}
done(Status::OK());
}
void Worker::CreateWorkerSessionAsync(const CreateWorkerSessionRequest* request,
CreateWorkerSessionResponse* response,
StatusCallback done) {
Status s = env_->session_mgr->CreateSession(
request->session_handle(), request->server_def(),
request->cluster_device_attributes(), request->isolate_session_state(),
request->master_task(), request->master_incarnation());
done(s);
}
void Worker::DeleteWorkerSessionAsync(CallOptions* opts,
const DeleteWorkerSessionRequest* request,
DeleteWorkerSessionResponse* response,
StatusCallback done) {
Status s = env_->session_mgr->DeleteSession(request->session_handle());
done(s);
}
void Worker::RegisterGraphAsync(const RegisterGraphRequest* request,
RegisterGraphResponse* response,
StatusCallback done) {
std::shared_ptr<WorkerSession> session;
Status s;
if (request->create_worker_session_called()) {
s = env_->session_mgr->WorkerSessionForSession(request->session_handle(),
&session);
} else {
session = env_->session_mgr->LegacySession();
}
if (s.ok()) {
s = session->graph_mgr()->Register(
request->session_handle(), request->graph_def(), session.get(),
request->graph_options(), request->debug_options(),
request->config_proto(), request->collective_graph_key(),
session->cluster_flr(), response->mutable_graph_handle());
}
done(s);
}
void Worker::DeregisterGraphAsync(const DeregisterGraphRequest* request,
DeregisterGraphResponse* response,
StatusCallback done) {
std::shared_ptr<WorkerSession> session;
Status s;
if (request->create_worker_session_called()) {
s = env_->session_mgr->WorkerSessionForSession(request->session_handle(),
&session);
} else {
session = env_->session_mgr->LegacySession();
}
if (s.ok()) {
s = session->graph_mgr()->Deregister(request->graph_handle());
}
done(s);
}
void Worker::AbortStep(int64 step_id) {
Rendezvous* rendez = env_->rendezvous_mgr->Find(step_id);
SchedNonBlockingClosureAfter(1000000, [rendez, step_id]() {
// Delay a bit before aborting the step. This way, the root
// cause may return first back to the client instead of this
// cancellation generated abort error.
rendez->StartAbort(errors::Aborted("Step ", step_id,
" cancelled. Cancelling rendezvous."));
rendez->Unref();
});
}
Status Worker::PrepareRunGraph(RunGraphRequestWrapper* req,
GraphMgr::NamedTensors* in,
GraphMgr::NamedTensors* out) {
static Tensor empty_tensor(DT_FLOAT);
if (req->num_sends() > 0) {
Tensor val;
for (size_t i = 0; i < req->num_sends(); ++i) {
TF_RETURN_IF_ERROR(req->SendValue(i, &val));
in->insert({req->send_key(i), val});
}
}
for (size_t i = 0; i < req->num_recvs(); ++i) {
out->insert({req->recv_key(i), empty_tensor});
}
return Status::OK();
}
void Worker::RunGraphAsync(CallOptions* opts, RunGraphRequestWrapper* request,
MutableRunGraphResponseWrapper* response,
StatusCallback done) {
if (request->store_errors_in_response_body()) {
done = [response, done](const Status& status) {
response->set_status(status);
done(Status::OK());
};
}
if (request->is_partial()) {
DoPartialRunGraph(opts, request, response, std::move(done));
} else {
DoRunGraph(opts, request, response, std::move(done));
}
}
MutableRunGraphRequestWrapper* Worker::CreateRunGraphRequest() {
return new InMemoryRunGraphRequest;
}
MutableRunGraphResponseWrapper* Worker::CreateRunGraphResponse() {
return new InMemoryRunGraphResponse;
}
void Worker::DoRunGraph(CallOptions* opts, RunGraphRequestWrapper* request,
MutableRunGraphResponseWrapper* response,
StatusCallback done) {
const int64 step_id = request->step_id();
TRACEPRINTF("RunGraph: %lld", step_id);
Status s = recent_request_ids_.TrackUnique(request->request_id(),
"RunGraph (Worker)", request);
if (!s.ok()) {
done(s);
return;
}
std::shared_ptr<WorkerSession> session;
if (request->create_worker_session_called()) {
s = env_->session_mgr->WorkerSessionForSession(request->session_handle(),
&session);
} else {
session = env_->session_mgr->LegacySession();
}
if (!s.ok()) {
done(s);
return;
}
GraphMgr::NamedTensors in;
GraphMgr::NamedTensors* out = new GraphMgr::NamedTensors;
s = PrepareRunGraph(request, &in, out);
if (!s.ok()) {
delete out;
done(s);
return;
}
StepStatsCollector* collector = nullptr;
if (request->exec_opts().report_tensor_allocations_upon_oom() ||
request->exec_opts().record_timeline() ||
request->exec_opts().record_costs()) {
collector = new StepStatsCollector(response->mutable_step_stats());
}
DeviceProfilerSession* device_profiler_session = nullptr;
if (collector && request->exec_opts().record_timeline()) {
// If timeline was requested, assume we want hardware level tracing.
device_profiler_session = DeviceProfilerSession::Create().release();
}
CancellationManager* cm = new CancellationManager;
opts->SetCancelCallback([this, cm, step_id]() {
LOG(INFO) << "Cancellation requested for RunGraph.";
cm->StartCancel();
AbortStep(step_id);
});
CancellationToken token;
token = cancellation_manager_.get_cancellation_token();
bool already_cancelled = !cancellation_manager_.RegisterCallback(
token, [cm]() { cm->StartCancel(); });
if (already_cancelled) {
opts->ClearCancelCallback();
delete cm;
delete collector;
delete device_profiler_session;
delete out;
done(errors::Aborted("Call was aborted"));
return;
}
session->graph_mgr()->ExecuteAsync(
request->graph_handle(), step_id, session.get(), request->exec_opts(),
collector, response, cm, in,
[this, step_id, response, session, cm, out, token, collector,
device_profiler_session, opts, done](const Status& status) {
Status s = status;
if (s.ok()) {
s = session->graph_mgr()->RecvOutputs(step_id, out);
}
opts->ClearCancelCallback();
cancellation_manager_.DeregisterCallback(token);
delete cm;
if (device_profiler_session) {
device_profiler_session->CollectData(response->mutable_step_stats())
.IgnoreError();
}
if (s.ok()) {
for (const auto& p : *out) {
const string& key = p.first;
const Tensor& val = p.second;
response->AddRecv(key, val);
}
}
if (collector) collector->Finalize();
delete collector;
delete device_profiler_session;
delete out;
done(s);
});
}
// TODO(suharshs): Add stats collection support to partial run.
void Worker::DoPartialRunGraph(CallOptions* opts,
RunGraphRequestWrapper* request,
MutableRunGraphResponseWrapper* response,
StatusCallback done) {
const int64 step_id = request->step_id();
const string& graph_handle = request->graph_handle();
TRACEPRINTF("PartialRunGraph: %lld", step_id);
Status s = recent_request_ids_.TrackUnique(
request->request_id(), "PartialRunGraph (Worker)", request);
if (!s.ok()) {
done(s);
return;
}
std::shared_ptr<WorkerSession> session;
if (request->create_worker_session_called()) {
s = env_->session_mgr->WorkerSessionForSession(request->session_handle(),
&session);
} else {
session = env_->session_mgr->LegacySession();
}
if (!s.ok()) {
done(s);
return;
}
GraphMgr::NamedTensors in;
GraphMgr::NamedTensors* out = new GraphMgr::NamedTensors;
s = PrepareRunGraph(request, &in, out);
auto finish = [done, out, opts](const Status& s) {
opts->ClearCancelCallback();
delete out;
done(s);
};
if (!s.ok()) {
finish(s);
return;
}
CancellationManager* cm = nullptr;
bool is_new_partial_run = partial_run_mgr_.FindOrCreate(step_id, &cm);
// Before we start doing anything, we set the RPC cancellation.
opts->SetCancelCallback([this, cm, step_id]() {
LOG(INFO) << "Cancellation requested for PartialRunGraph.";
cm->StartCancel();
AbortStep(step_id);
});
// If this is a new partial run request, the request will need to start the
// executors.
if (is_new_partial_run) {
CancellationToken token;
token = cancellation_manager_.get_cancellation_token();
cancellation_manager_.RegisterCallback(token,
[cm]() { cm->StartCancel(); });
session->graph_mgr()->ExecuteAsync(
graph_handle, step_id, session.get(), request->exec_opts(),
nullptr /* collector */, nullptr /* response */, cm, in,
[this, token, step_id, session](Status s) {
cancellation_manager_.DeregisterCallback(token);
partial_run_mgr_.ExecutorDone(step_id, s);
});
} else {
// Send the partial run's new inputs.
s = session->graph_mgr()->SendInputs(step_id, in);
if (!s.ok()) {
finish(s);
return;
}
}
session->graph_mgr()->RecvOutputsAsync(
step_id, out, [this, out, request, response, step_id, finish](Status s) {
if (s.ok()) {
// Construct and return the resp.
for (const auto& p : *out) {
const string& key = p.first;
const Tensor& val = p.second;
response->AddRecv(key, val);
}
}
if (request->is_last_partial_run()) {
partial_run_mgr_.PartialRunDone(step_id, finish, s);
} else {
finish(s);
}
});
}
void Worker::CleanupGraphAsync(const CleanupGraphRequest* request,
CleanupGraphResponse* response,
StatusCallback done) {
const int64 step_id = request->step_id();
env_->rendezvous_mgr->Cleanup(step_id);
if (env_->collective_executor_mgr) {
env_->collective_executor_mgr->Cleanup(step_id);
}
for (Device* d : env_->local_devices) {
ScopedAllocatorMgr* sam = d->GetScopedAllocatorMgr();
if (sam) {
sam->Cleanup(step_id);
}
}
done(Status::OK());
}
void Worker::CleanupAllAsync(const CleanupAllRequest* request,
CleanupAllResponse* response,
StatusCallback done) {
std::vector<string> containers;
for (const auto& c : request->container()) containers.push_back(c);
env_->device_mgr->ClearContainers(containers);
done(Status::OK());
}
void Worker::LoggingAsync(const LoggingRequest* request,
LoggingResponse* response, StatusCallback done) {
done(errors::Unimplemented("Logging"));
}
void Worker::TracingAsync(const TracingRequest* request,
TracingResponse* response, StatusCallback done) {
done(errors::Unimplemented("Tracing"));
}
void Worker::RecvBufAsync(CallOptions* opts, const RecvBufRequest* request,
RecvBufResponse* response, StatusCallback done) {
// The base Worker class does not implement RecvBufAsync because
// it is not currently used for worker-to-worker communication. Use a
// transport-specific implementation (such as `GrpcWorker::RecvBufAsync()`)
// instead.
done(errors::Unimplemented("Worker::RecvBufAsync()"));
}
void Worker::CompleteGroupAsync(CallOptions* opts,
const CompleteGroupRequest* request,
CompleteGroupResponse* response,
StatusCallback done) {
if (env_->collective_executor_mgr) {
env_->collective_executor_mgr->GetParamResolver()->CompleteGroupAsync(
request, response, &cancellation_manager_, done);
} else {
done(
errors::Internal("Runtime not initialized with CollectiveExecutorMgr"));
}
}
void Worker::CompleteInstanceAsync(CallOptions* opts,
const CompleteInstanceRequest* request,
CompleteInstanceResponse* response,
StatusCallback done) {
if (env_->collective_executor_mgr) {
env_->collective_executor_mgr->GetParamResolver()->CompleteInstanceAsync(
request, response, &cancellation_manager_, done);
} else {
done(
errors::Internal("Runtime not initialized with CollectiveExecutorMgr"));
}
}
void Worker::GetStepSequenceAsync(const GetStepSequenceRequest* request,
GetStepSequenceResponse* response,
StatusCallback done) {
if (env_->collective_executor_mgr) {
env_->collective_executor_mgr->GetStepSequenceAsync(request, response,
done);
} else {
done(
errors::Internal("Runtime not initialized with CollectiveExecutorMgr"));
}
}
// Helper for RecvTensor. Validates "key" and returns the source
// device in "*src_dev".
Status Worker::PrepareRecvTensor(const Rendezvous::ParsedKey& parsed,
Device** src_dev) {
// Figures out which device the tensor is hosted on.
string local_name = DeviceNameUtils::LocalName(parsed.src_device);
TF_RETURN_IF_ERROR(env_->device_mgr->LookupDevice(local_name, src_dev));
// Does the device have the right incarnation number we expect?
if ((*src_dev)->attributes().incarnation() != parsed.src_incarnation) {
return errors::Aborted(
"RecvTensor expects a different device incarnation: ",
parsed.src_incarnation, " vs. ", (*src_dev)->attributes().incarnation(),
". Your worker job (\"",
env_->session_mgr->LegacySession()->worker_name(),
"\") was probably restarted. Check your "
"worker job for the reason why it was restarted.");
}
return Status::OK();
}
void Worker::RecvTensorAsync(CallOptions* opts,
const RecvTensorRequest* request,
TensorResponse* response, StatusCallback done) {
// The base Worker class does not implement RecvTensorAsync, because
// it is not currently used for worker-to-worker communication. Use a
// transport-specific implementation (such as `GrpcWorker::RecvTensorAsync()`)
// instead.
done(errors::Unimplemented("Worker::RecvTensorAsync()"));
}
} // namespace tensorflow
|
whj0401/RLOBF
|
obfs_analysis/test_bins/sha256sum/obfs_5.c
|
/* This file has been generated by the Hex-Rays decompiler.
Copyright (c) 2007-2017 Hex-Rays <<EMAIL>>
Detected compiler: GNU C++
*/
#include <defs.h>
#include <stdarg.h>
//-------------------------------------------------------------------------
// Function declarations
void *init_proc();
int sub_8048CF0();
// int strcmp(const char *s1, const char *s2);
// int __cdecl open64(_DWORD, _DWORD); weak
// int __cdecl getline(_DWORD, _DWORD, _DWORD); weak
// int printf(const char *format, ...);
// int fflush(FILE *stream);
// void _exit(int status);
// void free(void *ptr);
// void *memcpy(void *dest, const void *src, size_t n);
// int tolower(int c);
// int fclose(FILE *stream);
// int getc_unlocked(FILE *stream);
// int __cdecl fseeko64(_DWORD, _DWORD, _DWORD, _DWORD); weak
// char *textdomain(const char *domainname);
// int __cdecl fopen64(_DWORD, _DWORD); weak
// int ferror_unlocked(FILE *stream);
// size_t fwrite(const void *ptr, size_t size, size_t n, FILE *s);
// size_t __ctype_get_mb_cur_max(void);
// char *strcpy(char *dest, const char *src);
// size_t __fpending(FILE *fp);
// size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *p);
// int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD); weak
// void error(int status, int errnum, const char *format, ...);
// char *getenv(const char *name);
// void *realloc(void *ptr, size_t size);
// void *malloc(size_t size);
// int __freading(FILE *fp);
// void exit(int status);
// char *gettext(const char *msgid);
// FILE *fdopen(int fd, const char *modes);
// int __cdecl fputs_unlocked(_DWORD, _DWORD); weak
// int getopt_long(int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind);
// char *strchr(const char *s, int c);
// int fscanf(FILE *stream, const char *format, ...);
// size_t strlen(const char *s);
// int fprintf(FILE *stream, const char *format, ...);
// int fcntl(int fd, int cmd, ...);
// int setvbuf(FILE *stream, char *buf, int modes, size_t n);
// int ungetc(int c, FILE *stream);
// int *__errno_location(void);
// int fileno(FILE *stream);
// char *nl_langinfo(nl_item item);
// char *setlocale(int category, const char *locale);
// char *strrchr(const char *s, int c);
// int __cdecl lseek64(_DWORD, _DWORD, _DWORD, _DWORD); weak
// char *bindtextdomain(const char *domainname, const char *dirname);
// int __cdecl posix_fadvise64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int strncmp(const char *s1, const char *s2, size_t n);
// int feof_unlocked(FILE *stream);
// void abort(void);
// char *ngettext(const char *msgid1, const char *msgid2, unsigned int n);
// int close(int fd);
// const unsigned __int16 **__ctype_b_loc(void);
// int putchar_unlocked(int c);
// int _gmon_start__(void); weak
void sub_8049123();
void sub_8049140();
int sub_8049150();
int sub_80491C0();
int sub_80491E0();
void sub_804923F();
void sub_804925A();
signed int sub_804926A();
void sub_8049365();
void sub_8049380();
int sub_8049390();
void sub_8049472();
void sub_804948D();
int __fastcall sub_804949D(int a1);
void sub_8049598();
void sub_80495B3();
int sub_80495C3();
void sub_80496A5();
void sub_80496C0();
signed int sub_80496D0();
void sub_80497E7();
void sub_8049802();
int sub_8049812();
int sub_804989C();
void sub_8049910();
void sub_804992B();
int sub_804993B();
void sub_8049A6A();
void sub_8049A85();
int sub_8049A95();
void sub_8049B90();
void sub_8049BAB();
int sub_8049BBB();
void sub_8049CB9();
void sub_8049CD4();
int sub_8049CE4();
int __fastcall sub_8049D10(int a1);
int nullsub_3(void); // weak
// int __usercall sub_8049D42@<eax>(int a1@<ecx>, int a2@<ebp>);
// int __usercall sub_8049DE1@<eax>(void (__cdecl *a1)(int *)@<eax>);
void sub_8049E2D();
void sub_8049E48();
int sub_8049E58();
int sub_8049EE2();
void sub_8049F56();
void sub_8049F71();
int sub_8049F81();
void sub_804A098();
void sub_804A0B3();
int sub_804A0C3();
int nullsub_4(void); // weak
int sub_804A121();
int sub_804A166();
void sub_804A20A();
void sub_804A225();
int sub_804A235();
void sub_804A333();
void sub_804A34E();
int sub_804A35E();
// int __usercall sub_804A410@<eax>(void (__cdecl *a1)(int *)@<eax>);
void sub_804A563();
void sub_804A57E();
int __fastcall sub_804A58E(int a1);
void sub_804A7A5();
void sub_804A7C0();
int sub_804A7D0();
// int __usercall sub_804A930@<eax>(signed __int32 a1@<ebx>, unsigned __int64 a2);
unsigned int __cdecl sub_804A9DA(int a1, unsigned int a2);
int sub_804AA0C();
// int __usercall sub_804AA37@<eax>(signed __int32 a1@<edx>, int a2@<ecx>, signed __int32 a3@<ebx>, char *s1);
int __cdecl sub_804AC3F(int a1);
void __cdecl __noreturn sub_804AC47(int status); // idb
// _BYTE *__usercall sub_804ADB7@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, _BYTE *a3, unsigned int a4);
// bool __usercall sub_804AF8B@<al>(signed __int32 a1@<ebx>, _BYTE *a2);
// bool __usercall sub_804B017@<al>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, _BYTE *a3, int a4, _BYTE **a5, _DWORD *a6, char a7);
// bool __usercall sub_804B1A8@<al>(signed __int32 a1@<ebx>, signed __int32 a2, int a3, _BYTE **a4, _DWORD *a5, _DWORD *a6);
int __cdecl sub_804B4B0(_BYTE *a1, char a2);
// int __usercall sub_804B5E8@<eax>(signed __int32 a1@<ebx>, char *s1, int a3, int a4, int a5);
// int __usercall sub_804B81B@<eax>(_BYTE *a1@<ebx>, const char *a2);
void __cdecl __noreturn main(int argc, char **a2);
// void __usercall __noreturn sub_804CB81(signed __int32 a1@<ebx>);
int sub_804CC78(); // weak
_DWORD *__cdecl sub_804CC7E(_DWORD *a1);
_DWORD *__cdecl sub_804CCF2(_DWORD *a1);
_DWORD *__cdecl sub_804CD66(_DWORD *a1, int a2);
int __cdecl sub_804CD73(int a1, int a2);
// int __usercall sub_804CDF6@<eax>(int a1@<edx>, signed __int32 a2@<ecx>, signed __int32 a3@<ebx>, int a4, int a5);
// _DWORD *__usercall sub_804CEB6@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3);
// int __usercall sub_804D090@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3, int a4);
// int __usercall sub_804D0B5@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3, int a4);
int __cdecl sub_804D0DA();
int __cdecl sub_804D54B(void *src, size_t, int); // idb
_DWORD *__cdecl sub_804D766(_DWORD *a1, unsigned int a2, int *a3);
int __cdecl sub_8050785(int a1, int a2, int a3, int a4, int a5, int a6);
void __cdecl sub_80507D6(FILE *stream, int a2);
// FILE *__usercall sub_805081E@<eax>(signed __int32 a1@<ebx>, int a2, char *modes);
char *__cdecl sub_805096E(char *s);
int __cdecl sub_8050AD3(int a1, unsigned __int8 a2, char a3);
void __cdecl __noreturn sub_8050B96(int a1, int a2, int a3);
// _DWORD *__userpurge sub_8050CEF@<eax>(_DWORD *a1, int a2);
// char *__usercall sub_8050D71@<eax>(signed __int32 a1@<ebx>, char *msgid);
// int __usercall sub_8050F2C@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, unsigned int a3, _BYTE *a4, int a5, int a6, int a7, int a8, char *a9, char *a10);
int sub_8051F19(); // weak
_BYTE *__cdecl sub_805200B(_BYTE *a1, int a2, _DWORD *a3, int *a4);
// _BYTE *__usercall sub_80521B2@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4, int a5);
// _BYTE *__usercall sub_8052449@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3);
// _BYTE *__usercall sub_8052473@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4);
// _BYTE *__usercall sub_80524D9@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4);
// _BYTE *__usercall sub_8052517@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4, int a5);
// _BYTE *__usercall sub_805265B@<eax>(signed __int32 a1@<ebx>, int a2, _BYTE *a3);
// _BYTE *__usercall sub_8052685@<eax>(signed __int32 a1@<ebx>, int a2, _BYTE *a3, int a4);
// _BYTE *__usercall sub_80526AE@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, int a3, unsigned __int8 a4);
// _BYTE *__usercall sub_8052758@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, unsigned __int8 a3);
// _BYTE *__usercall sub_8052781@<eax>(signed __int32 a1@<ebx>, _BYTE *a2);
// _BYTE *__usercall sub_805286B@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4);
void __cdecl __noreturn sub_80529A8(int a1, int a2, int a3);
void __cdecl __noreturn sub_80529D8(int a1, int a2, int a3);
// _BYTE *__usercall sub_8052B9E@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4);
// _BYTE *__usercall sub_8052CC9@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3);
// void __usercall __noreturn sub_8052D8A(int a1@<ecx>, signed __int32 a2@<ebx>, int fd);
int __cdecl sub_8052DAD(FILE *stream, int, int, int, int, int); // idb
int __cdecl sub_80533EC(FILE *stream, int, int, int, int); // idb
int sub_8053452(FILE *stream, int a2, int a3, int a4, ...);
// void __usercall __noreturn sub_80535C0(int a1@<ecx>, signed __int32 a2@<ebx>, void *ptr, int a4, int a5);
void *__cdecl sub_8053694(size_t size);
void *__cdecl sub_80536A7(size_t size);
// void __usercall __noreturn sub_80536EA(int a1@<ecx>, signed __int32 a2@<ebx>, void *ptr, size_t size);
int sub_80537B3(); // weak
void *__cdecl sub_8053841(void *src, size_t n);
void __noreturn sub_8053920();
int __cdecl sub_8053959(FILE *stream); // idb
// void __usercall __noreturn sub_8053A4E(int a1@<ecx>, signed __int32 a2@<ebx>, int fd, int cmd, char a5);
int __cdecl sub_8053DDE(FILE *stream); // idb
int __cdecl sub_8053E17(FILE *fp); // idb
int __cdecl sub_8053E70(FILE *stream, int, int, int); // idb
// size_t __usercall sub_8053F5F@<eax>(signed __int32 a1@<ebx>, wchar_t *pwc, char *s, size_t n, mbstate_t *p);
int __cdecl sub_8053FD1(unsigned __int8 *a1, unsigned __int8 *a2);
int __cdecl sub_8054072(FILE *fp); // idb
// int __usercall sub_8054125@<eax>(signed __int32 a1@<ebx>, int category);
int sub_80541CC(); // weak
int sub_80541D2(); // weak
// int __usercall __noreturn sub_805421F@<eax>(int a1@<edx>, int a2@<ecx>, signed __int32 a3@<ebx>);
int sub_80547BA(); // weak
// void __usercall __noreturn sub_80547C3(signed __int32 a1@<ebx>);
int __cdecl sub_8054AF0(int a1);
Elf32_Dyn *__cdecl sub_8054B78(unsigned __int64 a1, __int64 a2);
int __cdecl sub_8054D84(int a1);
int __fastcall sub_8054EA3(_DWORD, _DWORD); // weak
int __fastcall sub_8054F24(_DWORD, _DWORD); // weak
int __fastcall sub_8054F9F(_DWORD, _DWORD); // weak
int __fastcall sub_8055050(_DWORD, _DWORD); // weak
int __fastcall sub_805514A(_DWORD); // weak
int __fastcall sub_80551D4(_DWORD, _DWORD); // weak
int __fastcall sub_8055253(_DWORD); // weak
int __fastcall sub_80552D6(_DWORD, _DWORD); // weak
int sub_805536D(void); // weak
int sub_80553ED(void); // weak
int __fastcall sub_8055473(_DWORD, _DWORD); // weak
int __cdecl sub_80554F4();
int sub_8055571(void); // weak
int __fastcall sub_80555F6(_DWORD); // weak
int (**sub_8055620())();
void term_proc();
//-------------------------------------------------------------------------
// Data declarations
_UNKNOWN locret_80494AC; // weak
_UNKNOWN locret_8049AA4; // weak
_UNKNOWN locret_804A59D; // weak
_UNKNOWN locret_804A9D8; // weak
_UNKNOWN loc_804AAE6; // weak
_UNKNOWN loc_804AB2A; // weak
_UNKNOWN loc_804AB33; // weak
_UNKNOWN loc_804AC1A; // weak
_UNKNOWN loc_804AE11; // weak
_UNKNOWN loc_804AE4B; // weak
_UNKNOWN loc_804AF3E; // weak
_UNKNOWN locret_804AF89; // weak
_UNKNOWN locret_804B015; // weak
_UNKNOWN loc_804B0C8; // weak
_UNKNOWN loc_804B119; // weak
_UNKNOWN locret_804B1A6; // weak
_UNKNOWN loc_804B482; // weak
_UNKNOWN loc_804B4A5; // weak
_UNKNOWN loc_804B4AA; // weak
_UNKNOWN loc_804B4E5; // weak
_UNKNOWN locret_804B5E6; // weak
_UNKNOWN loc_804B66E; // weak
_UNKNOWN loc_804B68A; // weak
_UNKNOWN loc_804B785; // weak
_UNKNOWN loc_804B810; // weak
_UNKNOWN loc_804B815; // weak
_UNKNOWN loc_804B982; // weak
_UNKNOWN loc_804BA35; // weak
_UNKNOWN loc_804BAAB; // weak
_UNKNOWN loc_804BAD3; // weak
_UNKNOWN loc_804BC64; // weak
_UNKNOWN loc_804BC69; // weak
_UNKNOWN loc_804BD39; // weak
_UNKNOWN loc_804BD71; // weak
_UNKNOWN loc_804BD7D; // weak
_UNKNOWN loc_804BDE5; // weak
_UNKNOWN loc_804BE07; // weak
_UNKNOWN loc_804BEAD; // weak
_UNKNOWN loc_804BF2B; // weak
_UNKNOWN loc_804C173; // weak
_UNKNOWN loc_804C1AC; // weak
_UNKNOWN loc_804C1B4; // weak
_UNKNOWN loc_804C2A1; // weak
_UNKNOWN loc_804C50C; // weak
_UNKNOWN loc_804C65E; // weak
_UNKNOWN loc_804C683; // weak
_UNKNOWN unk_804C6B3; // weak
_UNKNOWN loc_804CC6B; // weak
_UNKNOWN loc_804CEAC; // weak
_UNKNOWN loc_804CF0B; // weak
_UNKNOWN loc_804D117; // weak
_UNKNOWN loc_804D121; // weak
_UNKNOWN loc_804D575; // weak
_UNKNOWN loc_804D641; // weak
_UNKNOWN loc_804D6E1; // weak
_UNKNOWN loc_804D760; // weak
_UNKNOWN loc_8050B06; // weak
_UNKNOWN loc_8050B0B; // weak
_UNKNOWN loc_8050BBB; // weak
_UNKNOWN loc_8050BC2; // weak
_UNKNOWN loc_8050BF0; // weak
_UNKNOWN loc_8050BF2; // weak
_UNKNOWN loc_805115E; // weak
_UNKNOWN loc_805116A; // weak
_UNKNOWN loc_8051D71; // weak
_UNKNOWN loc_8051E36; // weak
_UNKNOWN loc_8051E38; // weak
_UNKNOWN loc_8051E7B; // weak
_UNKNOWN loc_8051F14; // weak
_UNKNOWN loc_8052251; // weak
_UNKNOWN loc_805365B; // weak
_UNKNOWN loc_80536DA; // weak
_UNKNOWN loc_80536E5; // weak
_UNKNOWN loc_805370F; // weak
_UNKNOWN loc_805375B; // weak
_UNKNOWN loc_805378F; // weak
_UNKNOWN loc_80537AE; // weak
_UNKNOWN locret_80537B6; // weak
_UNKNOWN loc_80539B9; // weak
_UNKNOWN loc_80539F2; // weak
_UNKNOWN loc_8053A38; // weak
_UNKNOWN loc_8053A49; // weak
_UNKNOWN loc_8053A84; // weak
_UNKNOWN loc_8053AE6; // weak
_UNKNOWN loc_8053AF5; // weak
_UNKNOWN loc_8053B1D; // weak
_UNKNOWN loc_8053BA6; // weak
_UNKNOWN loc_8053DD9; // weak
_UNKNOWN loc_8053E4B; // weak
_UNKNOWN loc_8053E58; // weak
_UNKNOWN loc_8053ECD; // weak
_UNKNOWN loc_8053F3D; // weak
_UNKNOWN loc_80540DC; // weak
_UNKNOWN loc_8054101; // weak
_UNKNOWN loc_805411E; // weak
_UNKNOWN loc_805417B; // weak
_UNKNOWN loc_8054340; // weak
_UNKNOWN loc_80543B1; // weak
_UNKNOWN loc_8054449; // weak
_UNKNOWN loc_8054497; // weak
_UNKNOWN loc_805453E; // weak
_UNKNOWN loc_8054543; // weak
_UNKNOWN loc_8054673; // weak
_UNKNOWN loc_8054771; // weak
_UNKNOWN loc_80547B5; // weak
_UNKNOWN loc_8054BE9; // weak
_UNKNOWN loc_8054D35; // weak
_UNKNOWN loc_8054D6B; // weak
char locale = '\0'; // idb
struct option longopts = { "binary", 0, NULL, 98 }; // idb
char byte_8056315[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a' }; // idb
_UNKNOWN unk_8056340; // weak
_UNKNOWN unk_80565C5; // weak
void *off_8056B54 = &loc_8052E95; // weak
_UNKNOWN unk_8056CE3; // weak
int dword_8056F08 = 3587899391; // weak
_UNKNOWN unk_80571C8; // weak
_UNKNOWN unk_80571CB; // weak
int dword_8057EF4 = 1573519359; // weak
_UNKNOWN unk_8058204; // weak
_UNKNOWN unk_8058207; // weak
int (*off_805AEC4[2])() = { &sub_80491E0, &sub_80491C0 }; // weak
int (*off_805AEC8)() = &sub_80491C0; // weak
Elf32_Dyn stru_805AF08 = { 1879047925, { 134513068u } }; // weak
int (*dword_805B008)(void) = NULL; // weak
int dword_805B110 = 0; // weak
int dword_805B114 = 0; // weak
int dword_805B124 = 0; // weak
int dword_805B138 = 0; // weak
int dword_805B13C = 0; // weak
int dword_805B14C = 0; // weak
int dword_805B150 = 0; // weak
int dword_805B160 = 0; // weak
int dword_805B174 = 0; // weak
int dword_805B188 = 0; // weak
int dword_805B18C = 0; // weak
int dword_805B19C = 0; // weak
int dword_805B1A0 = 0; // weak
int dword_805B1B0 = 0; // weak
int dword_805B1B4 = 0; // weak
int dword_805B1C4 = 0; // weak
int dword_805B1C8 = 0; // weak
int dword_805B1EC = 0; // weak
int dword_805B1F0 = 0; // weak
int dword_805B200 = 0; // weak
int dword_805B204 = 0; // weak
int dword_805B214 = 0; // weak
int dword_805B218 = 0; // weak
int dword_805B228 = 0; // weak
int dword_805B22C = 0; // weak
int dword_805B24C = 0; // weak
int dword_805B250 = 4294967295; // weak
int status = 1; // idb
int dword_805B268 = 1; // weak
int dword_805B26C = 256; // weak
int *off_805B274 = &dword_805B26C; // weak
_UNKNOWN unk_805B288; // weak
_UNKNOWN unk_805B2A4; // weak
_UNKNOWN unk_805B2A7; // weak
_UNKNOWN unk_805B2B8; // weak
_UNKNOWN unk_805B2BB; // weak
int program_invocation_short_name; // weak
FILE *stderr; // idb
int program_invocation_name; // weak
FILE *stdin; // idb
FILE *stdout; // idb
char byte_805B308; // weak
_UNKNOWN unk_805B479; // weak
char byte_805B4BE; // weak
char byte_805B62B; // weak
char byte_805B6BD; // weak
_UNKNOWN unk_805B6C1; // weak
_UNKNOWN unk_805B753; // weak
_UNKNOWN unk_805B763; // weak
char byte_805B7E5; // weak
int dword_805B7E9; // weak
int dword_805B7ED; // weak
char byte_805B7F1; // weak
char byte_805B7F2; // weak
char byte_805B7F3; // weak
char byte_805B7F4; // weak
char byte_805B7F5; // weak
int dword_805B7F9; // weak
char byte_805B7FD; // weak
int dword_805B801; // weak
int dword_805B819; // weak
int dword_805B81D; // weak
int dword_805B821; // weak
int dword_805B825; // weak
int dword_805B829; // weak
int dword_805B82D; // weak
int dword_805B831; // weak
int dword_805B835; // weak
int dword_805B839; // weak
int dword_805B83D; // weak
int dword_805B841; // weak
int dword_805B845; // weak
_UNKNOWN unk_805B859; // weak
int dword_805B959; // weak
int dword_805B95D; // weak
// extern _UNKNOWN __gmon_start__; weak
//----- (08048CCC) --------------------------------------------------------
void *init_proc()
{
void *result; // eax
result = &__gmon_start__;
if ( &__gmon_start__ )
result = (void *)_gmon_start__();
return result;
}
// 80490E0: using guessed type int _gmon_start__(void);
//----- (08048CF0) --------------------------------------------------------
int sub_8048CF0()
{
return dword_805B008();
}
// 805B008: using guessed type int (*dword_805B008)(void);
//----- (080490F0) --------------------------------------------------------
#error "80490F3: positive sp value has been found (funcsize=2)"
//----- (08049123) --------------------------------------------------------
void sub_8049123()
{
;
}
//----- (08049140) --------------------------------------------------------
void sub_8049140()
{
;
}
//----- (08049150) --------------------------------------------------------
int sub_8049150()
{
int result; // eax
result = &unk_805B2BB - &unk_805B2B8;
if ( (unsigned int)(&unk_805B2BB - &unk_805B2B8) > 6 )
result = 0;
return result;
}
// 8049150: could not find valid save-restore pair for ebp
//----- (080491C0) --------------------------------------------------------
int sub_80491C0()
{
int result; // eax
if ( !byte_805B308 )
{
result = sub_8049150();
byte_805B308 = 1;
}
return result;
}
// 80491C0: could not find valid save-restore pair for ebp
// 805B308: using guessed type char byte_805B308;
//----- (080491E0) --------------------------------------------------------
int sub_80491E0()
{
return 0;
}
// 80491E0: could not find valid save-restore pair for ebp
//----- (0804923F) --------------------------------------------------------
void sub_804923F()
{
;
}
//----- (0804925A) --------------------------------------------------------
void sub_804925A()
{
;
}
//----- (0804926A) --------------------------------------------------------
signed int sub_804926A()
{
return 3;
}
// 804926A: could not find valid save-restore pair for ebx
// 804926A: could not find valid save-restore pair for ebp
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
//----- (08049365) --------------------------------------------------------
void sub_8049365()
{
;
}
//----- (08049380) --------------------------------------------------------
void sub_8049380()
{
;
}
//----- (08049390) --------------------------------------------------------
int sub_8049390()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 8049390: could not find valid save-restore pair for ebp
//----- (08049472) --------------------------------------------------------
void sub_8049472()
{
;
}
//----- (0804948D) --------------------------------------------------------
void sub_804948D()
{
;
}
//----- (0804949D) --------------------------------------------------------
int __fastcall sub_804949D(int a1)
{
int result; // eax
int (__stdcall *v2)(void *, int, int, int, int, int); // eax
int v3; // [esp+4h] [ebp-18h]
int v4; // [esp+8h] [ebp-14h]
int v5; // [esp+Ch] [ebp-10h]
int v6; // [esp+10h] [ebp-Ch]
int v7; // [esp+14h] [ebp-8h]
int v8; // [esp+18h] [ebp-4h]
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
{
v8 = 0;
dword_805B110 = (int)&locret_80494AC;
v2 = (int (__stdcall *)(void *, int, int, int, int, int))sub_80555F6(a1);
result = v2(&unk_805B2A4, v3, v4, v5, v6, v7);
}
return result;
}
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
//----- (08049598) --------------------------------------------------------
void sub_8049598()
{
;
}
//----- (080495B3) --------------------------------------------------------
void sub_80495B3()
{
;
}
//----- (080495C3) --------------------------------------------------------
int sub_80495C3()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 80495C3: could not find valid save-restore pair for ebp
//----- (080496A5) --------------------------------------------------------
void sub_80496A5()
{
;
}
//----- (080496C0) --------------------------------------------------------
void sub_80496C0()
{
;
}
//----- (080496D0) --------------------------------------------------------
signed int sub_80496D0()
{
return 3;
}
// 80496D0: could not find valid save-restore pair for ebx
// 80496D0: could not find valid save-restore pair for ebp
// 8055571: using guessed type int sub_8055571(void);
// 805B124: using guessed type int dword_805B124;
//----- (080497E7) --------------------------------------------------------
void sub_80497E7()
{
;
}
//----- (08049802) --------------------------------------------------------
void sub_8049802()
{
;
}
//----- (08049812) --------------------------------------------------------
int sub_8049812()
{
int result; // eax
result = &unk_805B479 - (_UNKNOWN *)&program_invocation_short_name;
if ( (unsigned int)(&unk_805B479 - (_UNKNOWN *)&program_invocation_short_name) > 6 )
result = 0;
return result;
}
// 8049812: could not find valid save-restore pair for ebp
// 805B2C0: using guessed type int program_invocation_short_name;
//----- (0804989C) --------------------------------------------------------
int sub_804989C()
{
int result; // eax
result = sub_8049812();
byte_805B4BE = 1;
return result;
}
// 805B4BE: using guessed type char byte_805B4BE;
//----- (08049910) --------------------------------------------------------
void sub_8049910()
{
;
}
//----- (0804992B) --------------------------------------------------------
void sub_804992B()
{
;
}
//----- (0804993B) --------------------------------------------------------
int sub_804993B()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 804993B: could not find valid save-restore pair for ebp
//----- (08049A6A) --------------------------------------------------------
void sub_8049A6A()
{
;
}
//----- (08049A85) --------------------------------------------------------
void sub_8049A85()
{
;
}
//----- (08049A95) --------------------------------------------------------
int sub_8049A95()
{
int result; // eax
int (__stdcall *v1)(void *, int, int, int, int, int); // eax
int v2; // [esp+4h] [ebp-18h]
int v3; // [esp+8h] [ebp-14h]
int v4; // [esp+Ch] [ebp-10h]
int v5; // [esp+10h] [ebp-Ch]
int v6; // [esp+14h] [ebp-8h]
int v7; // [esp+18h] [ebp-4h]
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
{
v7 = 0;
dword_805B124 = (int)&locret_8049AA4;
v1 = (int (__stdcall *)(void *, int, int, int, int, int))sub_8055571();
result = v1(&unk_805B2A4, v2, v3, v4, v5, v6);
}
return result;
}
// 8055571: using guessed type int sub_8055571(void);
// 805B124: using guessed type int dword_805B124;
//----- (08049B90) --------------------------------------------------------
void sub_8049B90()
{
;
}
//----- (08049BAB) --------------------------------------------------------
void sub_8049BAB()
{
;
}
//----- (08049BBB) --------------------------------------------------------
int sub_8049BBB()
{
int result; // eax
result = &unk_8058207 - &unk_8058204;
if ( (unsigned int)(&unk_8058207 - &unk_8058204) > 6 )
result = 0;
return result;
}
// 8049BBB: could not find valid save-restore pair for ebp
//----- (08049CB9) --------------------------------------------------------
void sub_8049CB9()
{
;
}
//----- (08049CD4) --------------------------------------------------------
void sub_8049CD4()
{
;
}
//----- (08049CE4) --------------------------------------------------------
int sub_8049CE4()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 8049CE4: could not find valid save-restore pair for ebp
//----- (08049D10) --------------------------------------------------------
int __fastcall sub_8049D10(int a1)
{
dword_805B14C = (int)nullsub_3;
sub_8055473(a1, 0);
return nullsub_3();
}
// 8049D41: using guessed type int nullsub_3(void);
// 8055473: using guessed type int __fastcall sub_8055473(_DWORD, _DWORD);
// 805B14C: using guessed type int dword_805B14C;
//----- (08049D42) --------------------------------------------------------
int __usercall sub_8049D42@<eax>(int a1@<ecx>, int a2@<ebp>)
{
int v2; // eax
int (__cdecl *v3)(void *, int); // edx
int v5; // [esp+18h] [ebp-4h]
dword_805B1C4 = (int)nullsub_3;
v2 = sub_805514A(a1);
v5 = a2;
return v3(&unk_805B2A4, v2);
}
// 8049D42: could not find valid save-restore pair for ebp
// 8049D41: using guessed type int nullsub_3(void);
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 805B1C4: using guessed type int dword_805B1C4;
//----- (08049DE1) --------------------------------------------------------
int __usercall sub_8049DE1@<eax>(void (__cdecl *a1)(int *)@<eax>)
{
int v1; // ecx
a1(&dword_8057EF4);
return sub_8049D10(v1);
}
// 8057EF4: using guessed type int dword_8057EF4;
//----- (08049E2D) --------------------------------------------------------
void sub_8049E2D()
{
;
}
//----- (08049E48) --------------------------------------------------------
void sub_8049E48()
{
;
}
//----- (08049E58) --------------------------------------------------------
int sub_8049E58()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 8049E58: could not find valid save-restore pair for ebp
//----- (08049EE2) --------------------------------------------------------
int sub_8049EE2()
{
int result; // eax
result = sub_8049E58();
byte_805B62B = 1;
return result;
}
// 805B62B: using guessed type char byte_805B62B;
//----- (08049F56) --------------------------------------------------------
void sub_8049F56()
{
;
}
//----- (08049F71) --------------------------------------------------------
void sub_8049F71()
{
;
}
//----- (08049F81) --------------------------------------------------------
int sub_8049F81()
{
int result; // eax
result = &unk_80571CB - &unk_80571C8;
if ( (unsigned int)(&unk_80571CB - &unk_80571C8) > 6 )
result = 0;
return result;
}
// 8049F81: could not find valid save-restore pair for ebp
//----- (0804A098) --------------------------------------------------------
void sub_804A098()
{
;
}
//----- (0804A0B3) --------------------------------------------------------
void sub_804A0B3()
{
;
}
//----- (0804A0C3) --------------------------------------------------------
int sub_804A0C3()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 804A0C3: could not find valid save-restore pair for ebp
//----- (0804A121) --------------------------------------------------------
int sub_804A121()
{
return nullsub_4();
}
// 804A121: could not find valid save-restore pair for ebp
// 804A120: using guessed type int nullsub_4(void);
//----- (0804A166) --------------------------------------------------------
int sub_804A166()
{
int result; // eax
result = sub_804A0C3();
byte_805B6BD = 1;
return result;
}
// 805B6BD: using guessed type char byte_805B6BD;
//----- (0804A20A) --------------------------------------------------------
void sub_804A20A()
{
;
}
//----- (0804A225) --------------------------------------------------------
void sub_804A225()
{
;
}
//----- (0804A235) --------------------------------------------------------
int sub_804A235()
{
int result; // eax
result = &unk_805B6C1 - (_UNKNOWN *)&program_invocation_short_name;
if ( (unsigned int)(&unk_805B6C1 - (_UNKNOWN *)&program_invocation_short_name) > 6 )
result = 0;
return result;
}
// 804A235: could not find valid save-restore pair for ebp
// 805B2C0: using guessed type int program_invocation_short_name;
//----- (0804A333) --------------------------------------------------------
void sub_804A333()
{
;
}
//----- (0804A34E) --------------------------------------------------------
void sub_804A34E()
{
;
}
//----- (0804A35E) --------------------------------------------------------
int sub_804A35E()
{
int result; // eax
result = &unk_805B2A7 - &unk_805B2A4;
if ( (unsigned int)(&unk_805B2A7 - &unk_805B2A4) > 6 )
result = 0;
return result;
}
// 804A35E: could not find valid save-restore pair for ebp
//----- (0804A410) --------------------------------------------------------
int __usercall sub_804A410@<eax>(void (__cdecl *a1)(int *)@<eax>)
{
a1(&dword_8056F08);
return 0;
}
// 8056F08: using guessed type int dword_8056F08;
//----- (0804A563) --------------------------------------------------------
void sub_804A563()
{
;
}
//----- (0804A57E) --------------------------------------------------------
void sub_804A57E()
{
;
}
//----- (0804A58E) --------------------------------------------------------
int __fastcall sub_804A58E(int a1)
{
int result; // eax
int (__stdcall *v2)(int *, int, int, int, int, int); // eax
int v3; // [esp+40h] [ebp-18h]
int v4; // [esp+44h] [ebp-14h]
int v5; // [esp+48h] [ebp-10h]
int v6; // [esp+4Ch] [ebp-Ch]
int v7; // [esp+50h] [ebp-8h]
int v8; // [esp+54h] [ebp-4h]
result = &unk_805B753 - (_UNKNOWN *)&program_invocation_short_name;
if ( (unsigned int)(&unk_805B753 - (_UNKNOWN *)&program_invocation_short_name) > 6 )
{
v8 = 0;
dword_805B110 = (int)&locret_804A59D;
v2 = (int (__stdcall *)(int *, int, int, int, int, int))sub_80555F6(a1);
result = v2(&program_invocation_short_name, v3, v4, v5, v6, v7);
}
return result;
}
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
// 805B2C0: using guessed type int program_invocation_short_name;
//----- (0804A7A5) --------------------------------------------------------
void sub_804A7A5()
{
;
}
//----- (0804A7C0) --------------------------------------------------------
void sub_804A7C0()
{
;
}
//----- (0804A7D0) --------------------------------------------------------
int sub_804A7D0()
{
int result; // eax
result = &unk_805B763 - (_UNKNOWN *)&program_invocation_name;
if ( (unsigned int)(&unk_805B763 - (_UNKNOWN *)&program_invocation_name) > 6 )
result = 0;
return result;
}
// 804A7D0: could not find valid save-restore pair for ebp
// 805B2D0: using guessed type int program_invocation_name;
//----- (0804A930) --------------------------------------------------------
int __usercall sub_804A930@<eax>(signed __int32 a1@<ebx>, unsigned __int64 a2)
{
Elf32_Dyn *v2; // eax
signed __int32 v4; // eax
signed __int32 v5; // ecx
int v6; // edx
signed __int32 v7; // ebx
signed __int32 v8; // edx
if ( HIDWORD(a2) )
{
v2 = sub_8054B78(a2, 1000000LL);
dword_805B14C = (int)&locret_804A9D8;
v4 = _InterlockedExchange(&dword_805B150, (signed __int32)&v2[125000]);
_InterlockedExchange(&dword_805B150, v5);
sub_8055473(_InterlockedExchange(&dword_805B150, v4), v6);
v7 = _InterlockedExchange(&dword_805B150, a1);
_InterlockedExchange(&dword_805B150, v8);
_InterlockedExchange(&dword_805B150, v7);
}
return a2;
}
// 8055473: using guessed type int __fastcall sub_8055473(_DWORD, _DWORD);
// 805B14C: using guessed type int dword_805B14C;
// 805B150: using guessed type int dword_805B150;
//----- (0804A9DA) --------------------------------------------------------
unsigned int __cdecl sub_804A9DA(int a1, unsigned int a2)
{
return a2 - 1 + a1 - (a2 - 1 + a1) % a2;
}
//----- (0804AA0C) --------------------------------------------------------
int sub_804AA0C()
{
FILE *v0; // ebx
char *v1; // eax
v0 = stdout;
v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n");
return fputs_unlocked(v1, v0);
}
// 8048F20: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
//----- (0804AA37) --------------------------------------------------------
int __usercall sub_804AA37@<eax>(signed __int32 a1@<edx>, int a2@<ecx>, signed __int32 a3@<ebx>, char *s1)
{
signed __int32 v4; // eax
signed __int32 v5; // ebx
signed __int32 v6; // ecx
signed __int32 v7; // ecx
void *v8; // eax
char *v9; // eax
char *v10; // eax
char *v11; // eax
signed __int32 v12; // ecx
signed __int32 v13; // ebx
signed __int32 v14; // et2
signed __int32 v15; // ebx
signed __int32 v16; // edx
char *v17; // eax
char *v19; // [esp+1Ch] [ebp-4Ch]
const char **v20; // [esp+20h] [ebp-48h]
const char *v21; // [esp+24h] [ebp-44h]
const char *v22; // [esp+28h] [ebp-40h]
const char *v23; // [esp+2Ch] [ebp-3Ch]
const char *v24; // [esp+30h] [ebp-38h]
const char *v25; // [esp+34h] [ebp-34h]
const char *v26; // [esp+38h] [ebp-30h]
const char *v27; // [esp+3Ch] [ebp-2Ch]
const char *v28; // [esp+40h] [ebp-28h]
const char *v29; // [esp+44h] [ebp-24h]
const char *v30; // [esp+48h] [ebp-20h]
const char *v31; // [esp+4Ch] [ebp-1Ch]
const char *v32; // [esp+50h] [ebp-18h]
const char *v33; // [esp+54h] [ebp-14h]
int v34; // [esp+58h] [ebp-10h]
int v35; // [esp+5Ch] [ebp-Ch]
v22 = "[";
v23 = "test invocation";
v24 = "coreutils";
v25 = "Multi-call invocation";
v26 = "sha224sum";
v27 = "sha2 utilities";
v28 = "sha256sum";
v29 = "sha2 utilities";
v30 = "sha384sum";
v31 = "sha2 utilities";
v32 = "sha512sum";
v33 = "sha2 utilities";
v34 = 0;
v35 = 0;
v20 = &v22;
dword_805B14C = (int)&loc_804AAE6;
v4 = _InterlockedExchange(&dword_805B150, (signed __int32)&v22);
_InterlockedExchange(&dword_805B150, a1);
sub_8055473(a2, _InterlockedExchange(&dword_805B150, v4));
v5 = _InterlockedExchange(&dword_805B150, a3);
_InterlockedExchange(&dword_805B150, v6);
v7 = _InterlockedExchange(&dword_805B150, v5);
do
v20 += 2;
while ( *v20 && strcmp(s1, *v20) );
v8 = &loc_804AB2A;
if ( !v20[1] )
v8 = &loc_804AB33;
dword_805B1C4 = (int)v8;
sub_805514A(v7);
v19 = (char *)v20[1];
v9 = gettext("\n%s online help: <%s>\n");
printf(v9, "GNU coreutils", "http://www.gnu.org/software/coreutils/");
v21 = setlocale(5, 0);
if ( v21 && strncmp(v21, "en_", 3u) )
{
v10 = gettext("Report %s translation bugs to <http://translationproject.org/team/>\n");
printf(v10, s1);
}
v11 = gettext("Full documentation at: <%s%s>\n");
printf(v11, "http://www.gnu.org/software/coreutils/", s1);
if ( v19 == s1 )
{
dword_805B19C = (int)&loc_804AC1A;
v13 = _InterlockedExchange(&dword_805B1A0, (signed __int32)" invocation");
v14 = _InterlockedExchange(&dword_805B1A0, v12);
sub_8055253(_InterlockedExchange(&dword_805B1A0, v13));
v15 = _InterlockedExchange(&dword_805B1A0, v14);
_InterlockedExchange(&dword_805B1A0, v16);
_InterlockedExchange(&dword_805B1A0, v15);
}
v17 = gettext("or available locally via: info '(coreutils) %s%s'\n");
return printf(v17, v19, &locale);
}
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 8055253: using guessed type int __fastcall sub_8055253(_DWORD);
// 8055473: using guessed type int __fastcall sub_8055473(_DWORD, _DWORD);
// 805B14C: using guessed type int dword_805B14C;
// 805B150: using guessed type int dword_805B150;
// 805B19C: using guessed type int dword_805B19C;
// 805B1A0: using guessed type int dword_805B1A0;
// 805B1C4: using guessed type int dword_805B1C4;
//----- (0804AC3F) --------------------------------------------------------
int __cdecl sub_804AC3F(int a1)
{
return a1;
}
//----- (0804AC47) --------------------------------------------------------
void __cdecl __noreturn sub_804AC47(int status)
{
int v1; // ebx
char *v2; // eax
int v3; // ebx
char *v4; // eax
FILE *v5; // ebx
char *v6; // eax
char *v7; // eax
FILE *v8; // ebx
char *v9; // eax
FILE *v10; // ebx
char *v11; // eax
FILE *v12; // ebx
char *v13; // eax
FILE *v14; // ebx
char *v15; // eax
FILE *v16; // ebx
char *v17; // eax
char *v18; // eax
signed __int32 v19; // edx
int v20; // ecx
if ( status )
{
v1 = dword_805B801;
v2 = gettext("Try '%s --help' for more information.\n");
fprintf(stderr, v2, v1);
}
else
{
v3 = dword_805B801;
v4 = gettext("Usage: %s [OPTION]... [FILE]...\nPrint or check %s (%d-bit) checksums.\n");
printf(v4, v3, "SHA256", 256);
sub_804AA0C();
v5 = stdout;
v6 = gettext("\n -b, --binary read in binary mode\n");
fputs_unlocked(v6, v5);
v7 = gettext(" -c, --check read %s sums from the FILEs and check them\n");
printf(v7, "SHA256");
v8 = stdout;
v9 = gettext(" --tag create a BSD-style checksum\n");
fputs_unlocked(v9, v8);
v10 = stdout;
v11 = gettext(" -t, --text read in text mode (default)\n");
fputs_unlocked(v11, v10);
v12 = stdout;
v13 = gettext(
"\n"
"The following five options are useful only when verifying checksums:\n"
" --ignore-missing don't fail or report status for missing files\n"
" --quiet don't print OK for each successfully verified file\n"
" --status don't output anything, status code shows success\n"
" --strict exit non-zero for improperly formatted checksum lines\n"
" -w, --warn warn about improperly formatted checksum lines\n"
"\n");
fputs_unlocked(v13, v12);
v14 = stdout;
v15 = gettext(" --help display this help and exit\n");
fputs_unlocked(v15, v14);
v16 = stdout;
v17 = gettext(" --version output version information and exit\n");
fputs_unlocked(v17, v16);
v18 = gettext(
"\n"
"The sums are computed as described in %s. When checking, the input\n"
"should be a former output of this program. The default mode is to print a\n"
"line with checksum, a space, a character indicating input mode ('*' for binary,\n"
"' ' for text or where binary is insignificant), and name for each FILE.\n");
printf(v18, "FIPS-180-2");
sub_804AA37(v19, v20, (signed __int32)v16, "sha256sum");
}
exit(status);
}
// 8048F20: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
// 805B801: using guessed type int dword_805B801;
//----- (0804ADB7) --------------------------------------------------------
_BYTE *__usercall sub_804ADB7@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, _BYTE *a3, unsigned int a4)
{
signed __int32 v4; // ebx
signed __int32 v5; // ecx
signed __int32 v6; // et0
signed __int32 v7; // ecx
signed __int32 v8; // et1
_BYTE *v9; // eax
void *v10; // eax
signed __int32 v11; // eax
signed __int32 v12; // eax
signed __int32 v13; // edx
signed __int32 v14; // edx
signed __int32 v15; // ett
_BYTE *v17; // [esp+8h] [ebp-8h]
unsigned int i; // [esp+Ch] [ebp-4h]
v17 = a3;
for ( i = 0; i < a4; ++i )
{
if ( a3[i] )
{
if ( a3[i] == 92 )
{
v10 = &loc_804AF3E;
if ( a4 - 1 != i )
v10 = &loc_804AE4B;
dword_805B160 = (int)v10;
v11 = sub_80553ED();
dword_805B138 = (int)&loc_804AE11;
v12 = _InterlockedExchange(&dword_805B13C, v11);
_InterlockedExchange(&dword_805B13C, v13);
_InterlockedExchange(&dword_805B13C, v12);
v15 = _InterlockedExchange(&dword_805B13C, sub_80554F4());
_InterlockedExchange(&dword_805B13C, v14);
_InterlockedExchange(&dword_805B13C, v15);
break;
}
}
else
{
dword_805B228 = (int)&locret_804AF89;
v4 = _InterlockedExchange(&dword_805B22C, a2);
v6 = _InterlockedExchange(&dword_805B22C, a1);
v5 = v4;
a2 = v6;
v8 = _InterlockedExchange(&dword_805B22C, sub_8054EA3(_InterlockedExchange(&dword_805B22C, v5), a3));
_InterlockedExchange(&dword_805B22C, v7);
_InterlockedExchange(&dword_805B22C, v8);
}
v9 = v17++;
a1 = (signed __int32)a3;
*v9 = a3[i];
}
if ( &a3[a4] > v17 )
*v17 = 0;
return a3;
}
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 80553ED: using guessed type int sub_80553ED(void);
// 805B138: using guessed type int dword_805B138;
// 805B13C: using guessed type int dword_805B13C;
// 805B160: using guessed type int dword_805B160;
// 805B228: using guessed type int dword_805B228;
// 805B22C: using guessed type int dword_805B22C;
//----- (0804AF8B) --------------------------------------------------------
bool __usercall sub_804AF8B@<al>(signed __int32 a1@<ebx>, _BYTE *a2)
{
const unsigned __int16 **v2; // eax
int v3; // ecx
signed __int32 v4; // edx
signed __int32 v5; // ebx
signed __int32 v6; // edx
signed __int32 v7; // et0
signed __int32 v8; // ecx
signed __int32 v9; // et1
unsigned int i; // [esp+Ch] [ebp-Ch]
for ( i = 0; i < dword_805B7ED; ++i )
{
v2 = __ctype_b_loc();
v4 = (signed __int32)*v2;
if ( !((*v2)[(unsigned __int8)*a2] & 0x1000) )
{
dword_805B214 = (int)&locret_804B015;
v5 = _InterlockedExchange(&dword_805B218, a1);
v7 = _InterlockedExchange(&dword_805B218, v4);
v6 = v5;
a1 = v7;
v9 = _InterlockedExchange(&dword_805B218, sub_8054F24(v3, _InterlockedExchange(&dword_805B218, v6)));
_InterlockedExchange(&dword_805B218, v8);
_InterlockedExchange(&dword_805B218, v9);
}
++a2;
}
return *a2 == 0;
}
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 805B214: using guessed type int dword_805B214;
// 805B218: using guessed type int dword_805B218;
// 805B7ED: using guessed type int dword_805B7ED;
//----- (0804B017) --------------------------------------------------------
bool __usercall sub_804B017@<al>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, _BYTE *a3, int a4, _BYTE **a5, _DWORD *a6, char a7)
{
signed __int32 v8; // eax
signed __int32 v9; // ebx
signed __int32 v10; // ecx
signed __int32 v11; // ecx
signed __int32 v12; // et1
void *v13; // eax
signed __int32 v14; // ecx
signed __int32 v15; // edx
int v16; // ecx
signed __int32 v17; // eax
signed __int32 v18; // ebx
signed __int32 v19; // edx
signed __int32 v20; // edx
signed __int32 v21; // ett
unsigned int v22; // eax
unsigned int i; // [esp+1Ch] [ebp-Ch]
int v24; // [esp+1Ch] [ebp-Ch]
int j; // [esp+1Ch] [ebp-Ch]
if ( !a4 )
return 0;
for ( i = a4 - 1; i && a3[i] != 41; --i )
;
if ( a3[i] != 41 )
{
dword_805B1B0 = (int)&locret_804B1A6;
v8 = _InterlockedExchange(&dword_805B1B4, 0);
_InterlockedExchange(&dword_805B1B4, a1);
sub_80551D4(_InterlockedExchange(&dword_805B1B4, v8), a3);
v9 = _InterlockedExchange(&dword_805B1B4, a2);
v12 = _InterlockedExchange(&dword_805B1B4, v10);
v11 = v9;
a2 = v12;
_InterlockedExchange(&dword_805B1B4, v11);
}
*a6 = a3;
v13 = &loc_804B0C8;
if ( !a7 )
v13 = &loc_804B119;
dword_805B138 = (int)v13;
sub_80554F4();
if ( !sub_804ADB7(v14, a2, a3, i) )
{
dword_805B1C4 = (int)&locret_804B1A6;
v17 = _InterlockedExchange(&dword_805B1C8, 0);
_InterlockedExchange(&dword_805B1C8, v15);
_InterlockedExchange(&dword_805B1C8, v17);
sub_805514A(v16);
v18 = _InterlockedExchange(&dword_805B1C8, a2);
v21 = _InterlockedExchange(&dword_805B1C8, v19);
v20 = v18;
a2 = v21;
_InterlockedExchange(&dword_805B1C8, v20);
}
v22 = i;
v24 = i + 1;
a3[v22] = 0;
while ( a3[v24] == 32 || a3[v24] == 9 )
++v24;
if ( a3[v24] != 61 )
return 0;
for ( j = v24 + 1; a3[j] == 32 || a3[j] == 9; ++j )
;
*a5 = &a3[j];
return sub_804AF8B(a2, *a5);
}
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 80551D4: using guessed type int __fastcall sub_80551D4(_DWORD, _DWORD);
// 805B138: using guessed type int dword_805B138;
// 805B1B0: using guessed type int dword_805B1B0;
// 805B1B4: using guessed type int dword_805B1B4;
// 805B1C4: using guessed type int dword_805B1C4;
// 805B1C8: using guessed type int dword_805B1C8;
//----- (0804B1A8) --------------------------------------------------------
bool __usercall sub_804B1A8@<al>(signed __int32 a1@<ebx>, signed __int32 a2, int a3, _BYTE **a4, _DWORD *a5, _DWORD *a6)
{
bool result; // al
signed __int32 v7; // ecx
signed __int32 v8; // eax
signed __int32 v9; // ecx
signed __int32 v10; // et1
int v11; // eax
int v12; // ecx
int v13; // eax
void *v14; // eax
char v15; // [esp+27h] [ebp-11h]
int i; // [esp+28h] [ebp-10h]
int v17; // [esp+28h] [ebp-10h]
int v18; // [esp+28h] [ebp-10h]
int v19; // [esp+28h] [ebp-10h]
v15 = 0;
for ( i = 0; *(_BYTE *)(a2 + i) == 32 || *(_BYTE *)(a2 + i) == 9; ++i )
;
if ( *(_BYTE *)(a2 + i) == 92 )
{
++i;
v15 = 1;
}
if ( !strncmp((const char *)(i + a2), "SHA256", 6u) )
{
v17 = i + 6;
if ( *(_BYTE *)(a2 + v17) == 32 )
++v17;
if ( *(_BYTE *)(a2 + v17) == 40 )
{
*a5 = 0;
result = sub_804B017(a3 - (v17 + 1), a2, (_BYTE *)(a2 + v17 + 1), a3 - (v17 + 1), a4, a6, v15);
}
else
{
result = 0;
}
}
else
{
v7 = a3 - i;
if ( a3 - i < (unsigned int)(*(_BYTE *)(a2 + i) == 92) + dword_805B7E9 )
return 0;
*a4 = (_BYTE *)(i + a2);
v18 = dword_805B7ED + i;
if ( *(_BYTE *)(a2 + v18) != 32 && *(_BYTE *)(a2 + v18) != 9 )
{
dword_805B19C = (int)&loc_804B4AA;
v8 = _InterlockedExchange(&dword_805B1A0, 0);
_InterlockedExchange(&dword_805B1A0, v7);
v10 = _InterlockedExchange(&dword_805B1A0, sub_8055253(_InterlockedExchange(&dword_805B1A0, v8)));
_InterlockedExchange(&dword_805B1A0, v9);
_InterlockedExchange(&dword_805B1A0, v10);
}
v11 = v18;
v19 = v18 + 1;
*(_BYTE *)(a2 + v11) = 0;
if ( !sub_804AF8B(a1, *a4) )
return 0;
if ( a3 - v19 != 1 && (*(_BYTE *)(a2 + v19) == 32 || *(_BYTE *)(a2 + v19) == 42) )
{
if ( dword_805B250 != 1 )
{
dword_805B250 = 0;
v13 = v19++;
*a5 = *(_BYTE *)(a2 + v13) == 42;
}
}
else
{
if ( !dword_805B250 )
return 0;
dword_805B250 = 1;
}
*a6 = v19 + a2;
v14 = &loc_804B482;
if ( !v15 )
v14 = &loc_804B4A5;
dword_805B1EC = (int)v14;
sub_8055050(v12, v19 + a2);
result = sub_804ADB7(a2, a1, (_BYTE *)(a2 + v19), a3 - v19) != 0;
}
return result;
}
// 8055050: using guessed type int __fastcall sub_8055050(_DWORD, _DWORD);
// 8055253: using guessed type int __fastcall sub_8055253(_DWORD);
// 805B19C: using guessed type int dword_805B19C;
// 805B1A0: using guessed type int dword_805B1A0;
// 805B1EC: using guessed type int dword_805B1EC;
// 805B250: using guessed type int dword_805B250;
// 805B7E9: using guessed type int dword_805B7E9;
// 805B7ED: using guessed type int dword_805B7ED;
//----- (0804B4B0) --------------------------------------------------------
int __cdecl sub_804B4B0(_BYTE *a1, char a2)
{
int v2; // ecx
void *v4; // eax
if ( a2 != 1 )
return fputs_unlocked(a1, stdout);
v4 = &locret_804B5E6;
if ( *a1 )
v4 = &loc_804B4E5;
dword_805B110 = (int)v4;
return sub_80555F6(v2);
}
// 8048F20: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
//----- (0804B5E8) --------------------------------------------------------
int __usercall sub_804B5E8@<eax>(signed __int32 a1@<ebx>, char *s1, int a3, int a4, int a5)
{
void *v5; // eax
int result; // eax
_BYTE *v7; // ebx
int *v8; // eax
int v9; // edx
int v10; // ecx
_BYTE *v11; // ebx
int *v12; // eax
void *v13; // eax
_BYTE *v14; // ebx
int *v15; // eax
signed __int32 v16; // ebx
signed __int32 v17; // edx
signed __int32 v18; // et0
int v19; // ecx
signed __int32 v20; // ebx
signed __int32 v21; // ecx
bool v22; // [esp+17h] [ebp-11h]
FILE *stream; // [esp+18h] [ebp-10h]
v22 = strcmp(s1, "-") == 0;
*(_BYTE *)a5 = 0;
if ( v22 )
{
byte_805B7E5 = 1;
stream = stdin;
sub_80507D6(stdin, 2);
goto LABEL_10;
}
stream = sub_805081E(a1, (int)s1, "r");
if ( stream )
{
sub_80507D6(stream, 2);
LABEL_10:
if ( sub_804D0DA() )
{
v11 = sub_805286B(a1, 0, 3, s1);
v12 = __errno_location();
error(0, *v12, "%s", v11);
if ( stream != stdin )
sub_8053959(stream);
result = 0;
}
else
{
v13 = &loc_804B785;
if ( v22 == 1 )
v13 = &loc_804B810;
dword_805B200 = (int)v13;
sub_8054F9F(v10, v9);
if ( sub_8053959(stream) )
{
v14 = sub_805286B(a1, 0, 3, s1);
v15 = __errno_location();
error(0, *v15, "%s", v14);
dword_805B214 = (int)&loc_804B815;
v16 = _InterlockedExchange(&dword_805B218, (signed __int32)v14);
v18 = _InterlockedExchange(&dword_805B218, v17);
sub_8054F24(v19, _InterlockedExchange(&dword_805B218, v16));
v20 = _InterlockedExchange(&dword_805B218, v18);
_InterlockedExchange(&dword_805B218, v21);
_InterlockedExchange(&dword_805B218, v20);
}
result = 1;
}
return result;
}
v5 = &loc_804B66E;
if ( !byte_805B7F3 )
v5 = &loc_804B68A;
dword_805B174 = (int)v5;
sub_805536D();
if ( *__errno_location() == 2 )
{
*(_BYTE *)a5 = 1;
result = 1;
}
else
{
v7 = sub_805286B(a1, 0, 3, s1);
v8 = __errno_location();
error(0, *v8, "%s", v7);
result = 0;
}
return result;
}
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 8054F9F: using guessed type int __fastcall sub_8054F9F(_DWORD, _DWORD);
// 805536D: using guessed type int sub_805536D(void);
// 805B174: using guessed type int dword_805B174;
// 805B200: using guessed type int dword_805B200;
// 805B214: using guessed type int dword_805B214;
// 805B218: using guessed type int dword_805B218;
// 805B7E5: using guessed type char byte_805B7E5;
// 805B7F3: using guessed type char byte_805B7F3;
//----- (0804B81B) --------------------------------------------------------
int __usercall sub_804B81B@<eax>(_BYTE *a1@<ebx>, const char *a2)
{
signed __int32 v2; // eax
signed __int32 v3; // ecx
int v4; // edx
signed __int32 v5; // ecx
signed __int32 v6; // et1
_BYTE *v7; // ebx
int *v8; // eax
int result; // eax
char *v10; // eax
int v11; // eax
int v12; // edx
int v13; // ecx
bool v14; // zf
bool v15; // sf
void *v16; // eax
void *v17; // eax
char *v18; // eax
bool v19; // al
int v20; // edx
int v21; // ecx
char *v22; // eax
void *v23; // eax
int v24; // eax
int v25; // eax
void *v26; // eax
int v27; // edx
int v28; // ecx
void *v29; // eax
char *v30; // eax
char *v31; // eax
int v32; // edx
signed __int32 v33; // ecx
_BYTE *v34; // ebx
char *v35; // eax
int v36; // edx
int v37; // ecx
void *v38; // eax
_BYTE *v39; // ebx
int *v40; // eax
signed __int32 v41; // ebx
signed __int32 v42; // edx
signed __int32 v43; // edx
signed __int32 v44; // et2
int v45; // ecx
signed __int32 v46; // ecx
signed __int32 v47; // ett
int v48; // eax
char *v49; // eax
int v50; // eax
char *v51; // eax
int v52; // eax
char *v53; // eax
_BYTE *v54; // ebx
char *v55; // eax
_BYTE *v56; // ebx
char *v57; // eax
void *v58; // eax
char v59; // al
char *s1; // [esp+1Ch] [ebp-8Ch]
int v61; // [esp+22h] [ebp-86h]
bool v62; // [esp+26h] [ebp-82h]
unsigned __int8 v63; // [esp+27h] [ebp-81h]
void *ptr; // [esp+28h] [ebp-80h]
int v65; // [esp+2Ch] [ebp-7Ch]
char *s; // [esp+30h] [ebp-78h]
int v67; // [esp+34h] [ebp-74h]
int v68; // [esp+38h] [ebp-70h]
FILE *stream; // [esp+3Ch] [ebp-6Ch]
int v70; // [esp+40h] [ebp-68h]
unsigned int i; // [esp+44h] [ebp-64h]
int v72; // [esp+48h] [ebp-60h]
unsigned int v73; // [esp+4Ch] [ebp-5Ch]
unsigned __int64 v74; // [esp+50h] [ebp-58h]
__int64 v75; // [esp+58h] [ebp-50h]
unsigned __int64 v76; // [esp+60h] [ebp-48h]
unsigned __int64 v77; // [esp+68h] [ebp-40h]
__int64 v78; // [esp+70h] [ebp-38h]
char v79; // [esp+78h] [ebp-30h]
unsigned int v80; // [esp+9Ch] [ebp-Ch]
s1 = (char *)a2;
v80 = __readgsdword(0x14u);
v74 = 0LL;
v75 = 0LL;
v76 = 0LL;
v77 = 0LL;
*(_WORD *)((char *)&v61 + 1) = 0;
v72 = sub_804A9DA((int)&v79, 4u);
HIBYTE(v61) = strcmp(a2, "-") == 0;
if ( HIBYTE(v61) )
{
byte_805B7E5 = 1;
s1 = gettext("standard input");
stream = stdin;
dword_805B1EC = (int)&loc_804B982;
v2 = _InterlockedExchange(&dword_805B1F0, (signed __int32)stdin);
_InterlockedExchange(&dword_805B1F0, v3);
v6 = _InterlockedExchange(&dword_805B1F0, sub_8055050(_InterlockedExchange(&dword_805B1F0, v2), v4));
_InterlockedExchange(&dword_805B1F0, v5);
_InterlockedExchange(&dword_805B1F0, v6);
}
stream = sub_805081E((signed __int32)a1, (int)s1, "r");
if ( stream )
{
v78 = 0LL;
ptr = 0;
v65 = 0;
do
{
if ( !++v78 )
{
a1 = sub_805286B((signed __int32)a1, 0, 3, s1);
v10 = gettext("%s: too many checksum lines");
error(1, 0, v10, a1);
}
v11 = getline(&ptr, &v65, stream);
v70 = v11;
v14 = v11 == 0;
v15 = v11 < 0;
v16 = &loc_804BA35;
if ( v15 || v14 )
v16 = &loc_804BE07;
dword_805B188 = (int)v16;
sub_80552D6(v13, v12);
if ( *(_BYTE *)ptr != 35 )
{
if ( *((_BYTE *)ptr + v70 - 1) == 10 )
*((_BYTE *)ptr + --v70) = 0;
v14 = sub_804B1A8((signed __int32)a1, (signed __int32)ptr, v70, (_BYTE **)&v68, &v67, &s) == 1;
v17 = &loc_804BAAB;
if ( !v14 )
v17 = &loc_804BAD3;
dword_805B160 = (int)v17;
sub_80553ED();
if ( HIBYTE(v61) && !strcmp(s, "-") )
{
++v74;
if ( byte_805B7F2 )
{
a1 = sub_805286B((signed __int32)a1, 0, 3, s1);
v18 = gettext("%s: %llu: improperly formatted %s checksum line");
error(0, 0, v18, a1, v78, "SHA256");
}
++v75;
}
else
{
v19 = byte_805B7F1 != 1 && strchr(s, 10);
v62 = v19;
BYTE1(v61) = 1;
v63 = sub_804B5E8((signed __int32)a1, s, (int)&v67, v72, (int)&v61);
if ( v63 ^ 1 )
{
++v77;
if ( byte_805B7F1 != 1 )
{
if ( v62 )
putchar_unlocked(92);
sub_804B4B0(s, v62);
v22 = gettext("FAILED open or read");
printf(": %s\n", v22);
}
}
else if ( byte_805B7F3 )
{
v23 = &loc_804BC64;
if ( !(_BYTE)v61 )
v23 = &loc_804BC69;
dword_805B138 = (int)v23;
sub_80554F4();
}
else
{
v73 = (unsigned int)dword_805B7ED >> 1;
for ( i = 0; i < v73; ++i )
{
v24 = tolower(*(unsigned __int8 *)(2 * i + v68));
v21 = v72;
v20 = byte_8056315[(unsigned __int8)(*(_BYTE *)(v72 + i) >> 4)];
if ( v24 != v20 )
break;
v25 = tolower(*(unsigned __int8 *)(2 * i + 1 + v68));
v21 = v72;
v20 = byte_8056315[*(_BYTE *)(v72 + i) & 0xF];
if ( v25 != v20 )
break;
}
if ( i == v73 )
BYTE2(v61) = 1;
else
++v76;
v26 = &loc_804BD39;
if ( byte_805B7F1 == 1 )
v26 = &loc_804BDE5;
dword_805B1B0 = (int)v26;
sub_80551D4(v21, v20);
if ( i != v73 || byte_805B7F4 != 1 )
{
v29 = &loc_804BD71;
if ( !v62 )
v29 = &loc_804BD7D;
dword_805B228 = (int)v29;
sub_8054EA3(v28, v27);
putchar_unlocked(92);
sub_804B4B0(s, v62);
}
if ( i == v73 )
{
if ( byte_805B7F4 != 1 )
{
v31 = gettext("OK");
printf(": %s\n", v31);
}
}
else
{
v30 = gettext("FAILED");
printf(": %s\n", v30);
}
}
}
}
}
while ( !feof_unlocked(stream) && !ferror_unlocked(stream) );
free(ptr);
if ( ferror_unlocked(stream) )
{
v34 = sub_805286B((signed __int32)a1, 0, 3, s1);
v35 = gettext("%s: read error");
error(0, 0, v35, v34);
result = 0;
}
else
{
if ( HIBYTE(v61) != 1 )
{
v14 = sub_8053959(stream) == 0;
v38 = &loc_804BEAD;
if ( v14 )
v38 = &loc_804BF2B;
dword_805B14C = (int)v38;
sub_8055473(v37, v36);
v39 = sub_805286B((signed __int32)a1, 0, 3, s1);
v40 = __errno_location();
error(0, *v40, "%s", v39);
dword_805B1B0 = (int)&loc_804C1B4;
v41 = _InterlockedExchange(&dword_805B1B4, (signed __int32)v39);
v44 = _InterlockedExchange(&dword_805B1B4, v42);
v43 = v41;
a1 = (_BYTE *)v44;
v47 = _InterlockedExchange(&dword_805B1B4, sub_80551D4(v45, _InterlockedExchange(&dword_805B1B4, v43)));
_InterlockedExchange(&dword_805B1B4, v46);
v33 = _InterlockedExchange(&dword_805B1B4, v47);
}
if ( BYTE1(v61) == 1 )
{
if ( byte_805B7F1 != 1 )
{
if ( v74 )
{
v48 = sub_804A930((signed __int32)a1, v74);
v49 = ngettext(
"WARNING: %llu line is improperly formatted",
"WARNING: %llu lines are improperly formatted",
v48);
error(0, 0, v49, v74);
}
if ( v77 )
{
v50 = sub_804A930((signed __int32)a1, v77);
v51 = ngettext(
"WARNING: %llu listed file could not be read",
"WARNING: %llu listed files could not be read",
v50);
error(0, 0, v51, v77);
}
v32 = HIDWORD(v76);
if ( v76 )
{
v52 = sub_804A930((signed __int32)a1, v76);
v53 = ngettext(
"WARNING: %llu computed checksum did NOT match",
"WARNING: %llu computed checksums did NOT match",
v52);
error(0, 0, v53, v76);
}
if ( byte_805B7F3 && BYTE2(v61) != 1 )
{
v54 = sub_805286B((signed __int32)a1, 0, 3, s1);
v55 = gettext("%s: no file was verified");
error(0, 0, v55, v54);
}
}
}
else
{
v56 = sub_805286B((signed __int32)a1, 0, 3, s1);
v57 = gettext("%s: no properly formatted %s checksum lines found");
error(0, 0, v57, v56, "SHA256");
}
if ( !BYTE1(v61) )
goto LABEL_85;
v58 = &loc_804C173;
if ( !BYTE2(v61) )
v58 = &loc_804C1AC;
dword_805B200 = (int)v58;
sub_8054F9F(v33, v32);
if ( v76 || v77 || byte_805B7F5 == 1 && v75 )
LABEL_85:
v59 = 0;
else
v59 = 1;
result = v59 & 1;
}
}
else
{
v7 = sub_805286B((signed __int32)a1, 0, 3, s1);
v8 = __errno_location();
error(0, *v8, "%s", v7);
result = 0;
}
return result;
}
// 8048D20: using guessed type int __cdecl getline(_DWORD, _DWORD, _DWORD);
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 8054F9F: using guessed type int __fastcall sub_8054F9F(_DWORD, _DWORD);
// 8055050: using guessed type int __fastcall sub_8055050(_DWORD, _DWORD);
// 80551D4: using guessed type int __fastcall sub_80551D4(_DWORD, _DWORD);
// 80552D6: using guessed type int __fastcall sub_80552D6(_DWORD, _DWORD);
// 80553ED: using guessed type int sub_80553ED(void);
// 8055473: using guessed type int __fastcall sub_8055473(_DWORD, _DWORD);
// 805B138: using guessed type int dword_805B138;
// 805B14C: using guessed type int dword_805B14C;
// 805B160: using guessed type int dword_805B160;
// 805B188: using guessed type int dword_805B188;
// 805B1B0: using guessed type int dword_805B1B0;
// 805B1B4: using guessed type int dword_805B1B4;
// 805B1EC: using guessed type int dword_805B1EC;
// 805B1F0: using guessed type int dword_805B1F0;
// 805B200: using guessed type int dword_805B200;
// 805B228: using guessed type int dword_805B228;
// 805B7E5: using guessed type char byte_805B7E5;
// 805B7ED: using guessed type int dword_805B7ED;
// 805B7F1: using guessed type char byte_805B7F1;
// 805B7F2: using guessed type char byte_805B7F2;
// 805B7F3: using guessed type char byte_805B7F3;
// 805B7F4: using guessed type char byte_805B7F4;
// 805B7F5: using guessed type char byte_805B7F5;
//----- (0804C1CF) --------------------------------------------------------
void __cdecl __noreturn main(int argc, char **a2)
{
bool v2; // zf
void *v3; // eax
int v4; // ecx
char *v5; // eax
void *v6; // eax
int v7; // edx
int v8; // ecx
char *v9; // eax
int v10; // [esp+68h] [ebp-2Ch]
unsigned int v11; // [esp+8Ch] [ebp-8h]
v11 = __readgsdword(0x14u);
sub_804A9DA((int)&v10, 4u);
sub_805096E(*a2);
setlocale(6, &locale);
bindtextdomain("coreutils", "/home/hwangdz/coreutils/coreutils-8.28/install_m32/share/locale");
textdomain("coreutils");
sub_8054D84((int)sub_804CB81);
setvbuf(stdout, 0, 1, 0);
v2 = getopt_long(argc, a2, "bctw", &longopts, 0) == -1;
v3 = &loc_804C50C;
if ( !v2 )
v3 = &loc_804C2A1;
dword_805B124 = (int)v3;
sub_8055571();
dword_805B7E9 = 66;
dword_805B7ED = 64;
if ( byte_805B7F3 )
{
v5 = gettext("the --ignore-missing option is meaningful only when verifying checksums");
error(0, 0, v5);
sub_804AC47(1);
}
v6 = &loc_804C65E;
if ( !byte_805B7F1 )
v6 = &unk_804C6B3;
dword_805B1C4 = (int)v6;
sub_805514A(v4);
dword_805B1B0 = (int)&loc_804C683;
sub_80551D4(v8, v7);
v9 = gettext("the --status option is meaningful only when verifying checksums");
error(0, 0, v9);
sub_804AC47(1);
}
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 80551D4: using guessed type int __fastcall sub_80551D4(_DWORD, _DWORD);
// 8055571: using guessed type int sub_8055571(void);
// 805B124: using guessed type int dword_805B124;
// 805B1B0: using guessed type int dword_805B1B0;
// 805B1C4: using guessed type int dword_805B1C4;
// 805B214: using guessed type int dword_805B214;
// 805B7E9: using guessed type int dword_805B7E9;
// 805B7ED: using guessed type int dword_805B7ED;
// 805B7F1: using guessed type char byte_805B7F1;
// 805B7F3: using guessed type char byte_805B7F3;
//----- (0804CB81) --------------------------------------------------------
void __usercall __noreturn sub_804CB81(signed __int32 a1@<ebx>)
{
_BYTE *v1; // ebx
int *v2; // eax
int *v3; // eax
bool v4; // zf
int v5; // edx
int v6; // ecx
int (*v7)(); // eax
char *v8; // [esp+2Ch] [ebp-Ch]
if ( sub_8054072(stdout) && (byte_805B7FD != 1 || *__errno_location() != 32) )
{
v8 = gettext("write error");
if ( dword_805B7F9 )
{
v1 = sub_8052781(a1, (_BYTE *)dword_805B7F9);
v2 = __errno_location();
error(0, *v2, "%s: %s", v1, v8);
}
else
{
v3 = __errno_location();
error(0, *v3, "%s", v8);
}
_exit(status);
}
v4 = sub_8054072(stderr) == 0;
v7 = (int (*)())&loc_804CC6B;
if ( v4 )
v7 = sub_804CC78;
dword_805B1B0 = (int)v7;
sub_80551D4(v6, v5);
_exit(status);
}
// 804CC78: using guessed type int sub_804CC78();
// 80551D4: using guessed type int __fastcall sub_80551D4(_DWORD, _DWORD);
// 805B1B0: using guessed type int dword_805B1B0;
// 805B7F9: using guessed type int dword_805B7F9;
// 805B7FD: using guessed type char byte_805B7FD;
//----- (0804CC78) --------------------------------------------------------
#error "804CC7B: positive sp value has been found (funcsize=0)"
//----- (0804CC7E) --------------------------------------------------------
_DWORD *__cdecl sub_804CC7E(_DWORD *a1)
{
_DWORD *result; // eax
*a1 = 1779033703;
a1[1] = -1150833019;
a1[2] = 1013904242;
a1[3] = -1521486534;
a1[4] = 1359893119;
a1[5] = -1694144372;
a1[6] = 528734635;
a1[7] = 1541459225;
a1[9] = 0;
a1[8] = a1[9];
result = a1;
a1[10] = 0;
return result;
}
//----- (0804CCF2) --------------------------------------------------------
_DWORD *__cdecl sub_804CCF2(_DWORD *a1)
{
_DWORD *result; // eax
*a1 = -1056596264;
a1[1] = 914150663;
a1[2] = 812702999;
a1[3] = -150054599;
a1[4] = -4191439;
a1[5] = 1750603025;
a1[6] = 1694076839;
a1[7] = -1090891868;
a1[9] = 0;
a1[8] = a1[9];
result = a1;
a1[10] = 0;
return result;
}
//----- (0804CD66) --------------------------------------------------------
_DWORD *__cdecl sub_804CD66(_DWORD *a1, int a2)
{
_DWORD *result; // eax
result = a1;
*a1 = a2;
return result;
}
//----- (0804CD73) --------------------------------------------------------
int __cdecl sub_804CD73(int a1, int a2)
{
signed int i; // [esp+10h] [ebp-8h]
for ( i = 0; i <= 7; ++i )
sub_804CD66(
(_DWORD *)(4 * i + a2),
(*(_DWORD *)(a1 + 4 * i) >> 24) | (*(_DWORD *)(a1 + 4 * i) >> 8) & 0xFF00 | ((*(_DWORD *)(a1 + 4 * i) & 0xFF00) << 8) | (*(_DWORD *)(a1 + 4 * i) << 24));
return a2;
}
//----- (0804CDF6) --------------------------------------------------------
int __usercall sub_804CDF6@<eax>(int a1@<edx>, signed __int32 a2@<ecx>, signed __int32 a3@<ebx>, int a4, int a5)
{
signed __int32 v5; // ebx
signed __int32 v6; // et0
signed __int32 v7; // ebx
signed __int32 v8; // edx
signed int v10; // [esp+10h] [ebp-8h]
v10 = 0;
dword_805B200 = (int)&loc_804CEAC;
v5 = _InterlockedExchange(&dword_805B204, a3);
v6 = _InterlockedExchange(&dword_805B204, a2);
sub_8054F9F(_InterlockedExchange(&dword_805B204, v5), a1);
v7 = _InterlockedExchange(&dword_805B204, v6);
_InterlockedExchange(&dword_805B204, v8);
_InterlockedExchange(&dword_805B204, v7);
do
{
sub_804CD66(
(_DWORD *)(4 * v10 + a5),
(*(_DWORD *)(a4 + 4 * v10) >> 24) | (*(_DWORD *)(a4 + 4 * v10) >> 8) & 0xFF00 | ((*(_DWORD *)(a4 + 4 * v10) & 0xFF00) << 8) | (*(_DWORD *)(a4 + 4 * v10) << 24));
++v10;
}
while ( v10 <= 6 );
return a5;
}
// 8054F9F: using guessed type int __fastcall sub_8054F9F(_DWORD, _DWORD);
// 805B200: using guessed type int dword_805B200;
// 805B204: using guessed type int dword_805B204;
//----- (0804CEB6) --------------------------------------------------------
_DWORD *__usercall sub_804CEB6@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3)
{
signed __int32 v3; // eax
signed __int32 v4; // ebx
signed __int32 v5; // ecx
unsigned int v7; // [esp+18h] [ebp-10h]
v7 = a3[10];
if ( v7 <= 0x37 )
{
dword_805B110 = (int)&loc_804CF0B;
v3 = _InterlockedExchange(&dword_805B114, 16);
_InterlockedExchange(&dword_805B114, a1);
sub_80555F6(_InterlockedExchange(&dword_805B114, v3));
v4 = _InterlockedExchange(&dword_805B114, a2);
_InterlockedExchange(&dword_805B114, v5);
_InterlockedExchange(&dword_805B114, v4);
}
a3[8] += v7;
if ( a3[8] < v7 )
++a3[9];
sub_804CD66(
a3 + 41,
((unsigned int)(*((_QWORD *)a3 + 4) >> 29) >> 24) | ((unsigned int)(*((_QWORD *)a3 + 4) >> 29) >> 8) & 0xFF00 | ((unsigned __int16)((8 * a3[9] | ((unsigned int)a3[8] >> 29)) & 0xFF00) << 8) | ((unsigned int)(*((_QWORD *)a3 + 4) >> 29) << 24));
sub_804CD66(
a3 + 42,
((unsigned int)(8 * a3[8]) >> 24) | ((unsigned int)(8 * a3[8]) >> 8) & 0xFF00 | ((unsigned __int16)(8 * a3[8] & 0xFF00) << 8) | (a3[8] << 27));
memcpy((char *)a3 + v7 + 44, &unk_8056340, 120 - v7);
return sub_804D766(a3 + 11, 0x80u, a3);
}
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
// 805B114: using guessed type int dword_805B114;
//----- (0804D090) --------------------------------------------------------
int __usercall sub_804D090@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3, int a4)
{
sub_804CEB6(a1, a2, a3);
return sub_804CD73((int)a3, a4);
}
//----- (0804D0B5) --------------------------------------------------------
int __usercall sub_804D0B5@<eax>(signed __int32 a1@<ecx>, signed __int32 a2@<ebx>, int *a3, int a4)
{
int v4; // edx
signed __int32 v5; // ecx
sub_804CEB6(a1, a2, a3);
return sub_804CDF6(v4, v5, a2, (int)a3, a4);
}
//----- (0804D0DA) --------------------------------------------------------
int __cdecl sub_804D0DA()
{
bool v0; // zf
int v1; // edx
int v2; // ecx
void *v3; // eax
v0 = malloc(0x8048u) == 0;
v3 = &loc_804D117;
if ( !v0 )
v3 = &loc_804D121;
dword_805B14C = (int)v3;
sub_8055473(v2, v1);
return 1;
}
// 8055473: using guessed type int __fastcall sub_8055473(_DWORD, _DWORD);
// 805B14C: using guessed type int dword_805B14C;
//----- (0804D54B) --------------------------------------------------------
int __cdecl sub_804D54B(void *src, size_t a2, int a3)
{
void *v3; // eax
int v4; // eax
int v5; // ecx
int v6; // edx
_DWORD *v7; // eax
void *v8; // eax
size_t v9; // ST1C_4
int result; // eax
unsigned int v11; // [esp+14h] [ebp-14h]
int v12; // [esp+18h] [ebp-10h]
size_t n; // [esp+1Ch] [ebp-Ch]
char *srca; // [esp+30h] [ebp+8h]
size_t v15; // [esp+34h] [ebp+Ch]
v3 = &loc_804D575;
if ( !*(_DWORD *)(a3 + 40) )
v3 = &loc_804D641;
dword_805B160 = (int)v3;
sub_80553ED();
v12 = *(_DWORD *)(a3 + 40);
v4 = a2;
if ( 128 - v12 <= a2 )
v4 = 128 - v12;
n = v4;
memcpy((void *)(v12 + a3 + 44), src, v4);
v6 = n + *(_DWORD *)(a3 + 40);
*(_DWORD *)(a3 + 40) = v6;
if ( *(_DWORD *)(a3 + 40) > 0x40u )
{
sub_804D766((_DWORD *)(a3 + 44), *(_DWORD *)(a3 + 40) & 0xFFFFFFC0, (int *)a3);
*(_DWORD *)(a3 + 40) &= 0x3Fu;
memcpy((void *)(a3 + 44), (const void *)(a3 + 44 + ((v12 + n) & 0xFFFFFFC0)), *(_DWORD *)(a3 + 40));
}
srca = (char *)src + n;
v15 = a2 - n;
if ( v15 > 0x3F )
{
if ( (unsigned __int8)srca & 3 )
{
while ( v15 > 0x40 )
{
v7 = memcpy((void *)(a3 + 44), srca, 0x40u);
sub_804D766(v7, 0x40u, (int *)a3);
srca += 64;
v15 -= 64;
}
}
else
{
sub_804D766(srca, v15 & 0xFFFFFFC0, (int *)a3);
srca += v15 & 0xFFFFFFC0;
v15 &= 0x3Fu;
}
}
v8 = &loc_804D6E1;
if ( !v15 )
v8 = &loc_804D760;
dword_805B228 = (int)v8;
sub_8054EA3(v5, v6);
v9 = *(_DWORD *)(a3 + 40);
memcpy((void *)(v9 + a3 + 44), srca, v15);
v11 = v15 + v9;
if ( v11 > 0x3F )
{
sub_804D766((_DWORD *)(a3 + 44), 0x40u, (int *)a3);
v11 -= 64;
memcpy((void *)(a3 + 44), (const void *)(a3 + 108), v11);
}
result = a3;
*(_DWORD *)(a3 + 40) = v11;
return result;
}
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 80553ED: using guessed type int sub_80553ED(void);
// 805B160: using guessed type int dword_805B160;
// 805B228: using guessed type int dword_805B228;
//----- (0804D766) --------------------------------------------------------
_DWORD *__cdecl sub_804D766(_DWORD *a1, unsigned int a2, int *a3)
{
int v3; // ST10_4
int v4; // ST20_4
int v5; // ST0C_4
int v6; // ST1C_4
int v7; // ST08_4
int v8; // ST18_4
int v9; // ST04_4
int v10; // ST14_4
int v11; // ST20_4
int v12; // ST10_4
int v13; // ST1C_4
int v14; // ST0C_4
int v15; // ST18_4
int v16; // ST08_4
int v17; // ST14_4
int v18; // ST04_4
int v19; // ST10_4
int v20; // ST20_4
int v21; // ST0C_4
int v22; // ST1C_4
int v23; // ST08_4
int v24; // ST18_4
int v25; // ST04_4
int v26; // ST14_4
int v27; // ST20_4
int v28; // ST10_4
int v29; // ST1C_4
int v30; // ST0C_4
int v31; // ST18_4
int v32; // ST08_4
int v33; // ST14_4
int v34; // ST04_4
int v35; // ST10_4
int v36; // ST20_4
int v37; // ST0C_4
int v38; // ST1C_4
int v39; // ST08_4
int v40; // ST18_4
int v41; // ST04_4
int v42; // ST14_4
int v43; // ST20_4
int v44; // ST10_4
int v45; // ST1C_4
int v46; // ST0C_4
int v47; // ST18_4
int v48; // ST08_4
int v49; // ST14_4
int v50; // ST04_4
int v51; // ST10_4
int v52; // ST20_4
int v53; // ST0C_4
int v54; // ST1C_4
int v55; // ST08_4
int v56; // ST18_4
int v57; // ST04_4
int v58; // ST14_4
int v59; // ST20_4
int v60; // ST10_4
int v61; // ST1C_4
int v62; // ST0C_4
int v63; // ST18_4
int v64; // ST08_4
int v65; // ST14_4
int v66; // ST04_4
int v67; // ST10_4
int v68; // ST20_4
int v69; // ST0C_4
int v70; // ST1C_4
int v71; // ST08_4
int v72; // ST18_4
int v73; // ST04_4
int v74; // ST14_4
int v75; // ST20_4
int v76; // ST10_4
int v77; // ST1C_4
int v78; // ST0C_4
int v79; // ST18_4
int v80; // ST08_4
int v81; // ST14_4
int v82; // ST04_4
int v83; // ST10_4
int v84; // ST20_4
int v85; // ST0C_4
int v86; // ST1C_4
int v87; // ST08_4
int v88; // ST18_4
int v89; // ST04_4
int v90; // ST14_4
int v91; // ST20_4
int v92; // ST10_4
int v93; // ST1C_4
int v94; // ST0C_4
int v95; // ST18_4
int v96; // ST08_4
int v97; // ST14_4
int v98; // ST04_4
int v99; // ST10_4
int v100; // ST20_4
int v101; // ST0C_4
int v102; // ST1C_4
int v103; // ST08_4
int v104; // ST18_4
int v105; // ST04_4
int v106; // ST14_4
int v107; // ST20_4
int v108; // ST10_4
int v109; // ST1C_4
int v110; // ST0C_4
int v111; // ST18_4
int v112; // ST08_4
int v113; // ST14_4
int v114; // ST04_4
int v115; // ST10_4
int v116; // ST20_4
int v117; // ST0C_4
int v118; // ST1C_4
int v119; // ST08_4
int v120; // ST18_4
int v121; // ST04_4
int v122; // ST14_4
int v123; // ST20_4
int v124; // ST10_4
int v125; // ST1C_4
int v126; // ST0C_4
int v127; // ST18_4
int v128; // ST08_4
int v129; // ST38_4
_DWORD *result; // eax
_DWORD *v131; // [esp+0h] [ebp-84h]
int v132; // [esp+4h] [ebp-80h]
int v133; // [esp+8h] [ebp-7Ch]
int v134; // [esp+Ch] [ebp-78h]
int v135; // [esp+10h] [ebp-74h]
int v136; // [esp+14h] [ebp-70h]
int v137; // [esp+18h] [ebp-6Ch]
int v138; // [esp+1Ch] [ebp-68h]
int v139; // [esp+20h] [ebp-64h]
signed int i; // [esp+24h] [ebp-60h]
unsigned int v141; // [esp+40h] [ebp-44h]
unsigned int v142; // [esp+44h] [ebp-40h]
unsigned int v143; // [esp+48h] [ebp-3Ch]
unsigned int v144; // [esp+4Ch] [ebp-38h]
unsigned int v145; // [esp+50h] [ebp-34h]
unsigned int v146; // [esp+54h] [ebp-30h]
unsigned int v147; // [esp+58h] [ebp-2Ch]
unsigned int v148; // [esp+5Ch] [ebp-28h]
unsigned int v149; // [esp+60h] [ebp-24h]
unsigned int v150; // [esp+64h] [ebp-20h]
unsigned int v151; // [esp+68h] [ebp-1Ch]
unsigned int v152; // [esp+6Ch] [ebp-18h]
unsigned int v153; // [esp+70h] [ebp-14h]
unsigned int v154; // [esp+74h] [ebp-10h]
unsigned int v155; // [esp+78h] [ebp-Ch]
unsigned int v156; // [esp+7Ch] [ebp-8h]
v131 = a1;
v132 = *a3;
v133 = a3[1];
v134 = a3[2];
v135 = a3[3];
v136 = a3[4];
v137 = a3[5];
v138 = a3[6];
v139 = a3[7];
a3[8] += a2;
a3[9] += a3[8] < a2;
while ( 1 )
{
result = v131;
if ( v131 >= &a1[a2 >> 2] )
break;
for ( i = 0; i <= 15; ++i )
{
*(&v141 + i) = (*v131 >> 24) | (*v131 >> 8) & 0xFF00 | ((*v131 & 0xFF00) << 8) | (*v131 << 24);
++v131;
}
v3 = (__ROR4__(v136, 25) ^ __ROR4__(v136, 11) ^ __ROR4__(v136, 6))
+ v139
+ (v138 ^ v136 & (v137 ^ v138))
+ 1116352408
+ v141
+ v135;
v4 = (__ROR4__(v132, 22) ^ __ROR4__(v132, 13) ^ __ROR4__(v132, 2))
+ (v133 & v132 | v134 & (v132 | v133))
+ (__ROR4__(v136, 25) ^ __ROR4__(v136, 11) ^ __ROR4__(v136, 6))
+ v139
+ (v138 ^ v136 & (v137 ^ v138))
+ 1116352408
+ v141;
v5 = (__ROR4__(v3, 25) ^ __ROR4__(v3, 11) ^ __ROR4__(v3, 6))
+ v138
+ (v137 ^ v3 & (v136 ^ v137))
+ 1899447441
+ v142
+ v134;
v6 = (__ROR4__(v4, 22) ^ __ROR4__(v4, 13) ^ __ROR4__(v4, 2))
+ (v132 & v4 | v133 & (v4 | v132))
+ (__ROR4__(v3, 25) ^ __ROR4__(v3, 11) ^ __ROR4__(v3, 6))
+ v138
+ (v137 ^ v3 & (v136 ^ v137))
+ 1899447441
+ v142;
v7 = (__ROR4__(v5, 25) ^ __ROR4__(v5, 11) ^ __ROR4__(v5, 6))
+ v137
+ (v136 ^ v5 & (v3 ^ v136))
- 1245643825
+ v143
+ v133;
v8 = (__ROR4__(v6, 22) ^ __ROR4__(v6, 13) ^ __ROR4__(v6, 2))
+ (v4 & v6 | v132 & (v6 | v4))
+ (__ROR4__(v5, 25) ^ __ROR4__(v5, 11) ^ __ROR4__(v5, 6))
+ v137
+ (v136 ^ v5 & (v3 ^ v136))
- 1245643825
+ v143;
v9 = (__ROR4__(v7, 25) ^ __ROR4__(v7, 11) ^ __ROR4__(v7, 6))
+ v136
+ (v3 ^ v7 & (v5 ^ v3))
- 373957723
+ v144
+ v132;
v10 = (__ROR4__(v8, 22) ^ __ROR4__(v8, 13) ^ __ROR4__(v8, 2))
+ (v6 & v8 | v4 & (v8 | v6))
+ (__ROR4__(v7, 25) ^ __ROR4__(v7, 11) ^ __ROR4__(v7, 6))
+ v136
+ (v3 ^ v7 & (v5 ^ v3))
- 373957723
+ v144;
v11 = (__ROR4__(v9, 25) ^ __ROR4__(v9, 11) ^ __ROR4__(v9, 6)) + v3 + (v5 ^ v9 & (v7 ^ v5)) + 961987163 + v145 + v4;
v12 = (__ROR4__(v10, 22) ^ __ROR4__(v10, 13) ^ __ROR4__(v10, 2))
+ (v8 & v10 | v6 & (v10 | v8))
+ (__ROR4__(v9, 25) ^ __ROR4__(v9, 11) ^ __ROR4__(v9, 6))
+ v3
+ (v5 ^ v9 & (v7 ^ v5))
+ 961987163
+ v145;
v13 = (__ROR4__(v11, 25) ^ __ROR4__(v11, 11) ^ __ROR4__(v11, 6))
+ v5
+ (v7 ^ v11 & (v9 ^ v7))
+ 1508970993
+ v146
+ v6;
v14 = (__ROR4__(v12, 22) ^ __ROR4__(v12, 13) ^ __ROR4__(v12, 2))
+ (v10 & v12 | v8 & (v12 | v10))
+ (__ROR4__(v11, 25) ^ __ROR4__(v11, 11) ^ __ROR4__(v11, 6))
+ v5
+ (v7 ^ v11 & (v9 ^ v7))
+ 1508970993
+ v146;
v15 = (__ROR4__(v13, 25) ^ __ROR4__(v13, 11) ^ __ROR4__(v13, 6))
+ v7
+ (v9 ^ v13 & (v11 ^ v9))
- 1841331548
+ v147
+ v8;
v16 = (__ROR4__(v14, 22) ^ __ROR4__(v14, 13) ^ __ROR4__(v14, 2))
+ (v12 & v14 | v10 & (v14 | v12))
+ (__ROR4__(v13, 25) ^ __ROR4__(v13, 11) ^ __ROR4__(v13, 6))
+ v7
+ (v9 ^ v13 & (v11 ^ v9))
- 1841331548
+ v147;
v17 = (__ROR4__(v15, 25) ^ __ROR4__(v15, 11) ^ __ROR4__(v15, 6))
+ v9
+ (v11 ^ v15 & (v13 ^ v11))
- 1424204075
+ v148
+ v10;
v18 = (__ROR4__(v16, 22) ^ __ROR4__(v16, 13) ^ __ROR4__(v16, 2))
+ (v14 & v16 | v12 & (v16 | v14))
+ (__ROR4__(v15, 25) ^ __ROR4__(v15, 11) ^ __ROR4__(v15, 6))
+ v9
+ (v11 ^ v15 & (v13 ^ v11))
- 1424204075
+ v148;
v19 = (__ROR4__(v17, 25) ^ __ROR4__(v17, 11) ^ __ROR4__(v17, 6))
+ v11
+ (v13 ^ v17 & (v15 ^ v13))
- 670586216
+ v149
+ v12;
v20 = (__ROR4__(v18, 22) ^ __ROR4__(v18, 13) ^ __ROR4__(v18, 2))
+ (v16 & v18 | v14 & (v18 | v16))
+ (__ROR4__(v17, 25) ^ __ROR4__(v17, 11) ^ __ROR4__(v17, 6))
+ v11
+ (v13 ^ v17 & (v15 ^ v13))
- 670586216
+ v149;
v21 = (__ROR4__(v19, 25) ^ __ROR4__(v19, 11) ^ __ROR4__(v19, 6))
+ v13
+ (v15 ^ v19 & (v17 ^ v15))
+ 310598401
+ v150
+ v14;
v22 = (__ROR4__(v20, 22) ^ __ROR4__(v20, 13) ^ __ROR4__(v20, 2))
+ (v18 & v20 | v16 & (v20 | v18))
+ (__ROR4__(v19, 25) ^ __ROR4__(v19, 11) ^ __ROR4__(v19, 6))
+ v13
+ (v15 ^ v19 & (v17 ^ v15))
+ 310598401
+ v150;
v23 = (__ROR4__(v21, 25) ^ __ROR4__(v21, 11) ^ __ROR4__(v21, 6))
+ v15
+ (v17 ^ v21 & (v19 ^ v17))
+ 607225278
+ v151
+ v16;
v24 = (__ROR4__(v22, 22) ^ __ROR4__(v22, 13) ^ __ROR4__(v22, 2))
+ (v20 & v22 | v18 & (v22 | v20))
+ (__ROR4__(v21, 25) ^ __ROR4__(v21, 11) ^ __ROR4__(v21, 6))
+ v15
+ (v17 ^ v21 & (v19 ^ v17))
+ 607225278
+ v151;
v25 = (__ROR4__(v23, 25) ^ __ROR4__(v23, 11) ^ __ROR4__(v23, 6))
+ v17
+ (v19 ^ v23 & (v21 ^ v19))
+ 1426881987
+ v152
+ v18;
v26 = (__ROR4__(v24, 22) ^ __ROR4__(v24, 13) ^ __ROR4__(v24, 2))
+ (v22 & v24 | v20 & (v24 | v22))
+ (__ROR4__(v23, 25) ^ __ROR4__(v23, 11) ^ __ROR4__(v23, 6))
+ v17
+ (v19 ^ v23 & (v21 ^ v19))
+ 1426881987
+ v152;
v27 = (__ROR4__(v25, 25) ^ __ROR4__(v25, 11) ^ __ROR4__(v25, 6))
+ v19
+ (v21 ^ v25 & (v23 ^ v21))
+ 1925078388
+ v153
+ v20;
v28 = (__ROR4__(v26, 22) ^ __ROR4__(v26, 13) ^ __ROR4__(v26, 2))
+ (v24 & v26 | v22 & (v26 | v24))
+ (__ROR4__(v25, 25) ^ __ROR4__(v25, 11) ^ __ROR4__(v25, 6))
+ v19
+ (v21 ^ v25 & (v23 ^ v21))
+ 1925078388
+ v153;
v29 = (__ROR4__(v27, 25) ^ __ROR4__(v27, 11) ^ __ROR4__(v27, 6))
+ v21
+ (v23 ^ v27 & (v25 ^ v23))
- 2132889090
+ v154
+ v22;
v30 = (__ROR4__(v28, 22) ^ __ROR4__(v28, 13) ^ __ROR4__(v28, 2))
+ (v26 & v28 | v24 & (v28 | v26))
+ (__ROR4__(v27, 25) ^ __ROR4__(v27, 11) ^ __ROR4__(v27, 6))
+ v21
+ (v23 ^ v27 & (v25 ^ v23))
- 2132889090
+ v154;
v31 = (__ROR4__(v29, 25) ^ __ROR4__(v29, 11) ^ __ROR4__(v29, 6))
+ v23
+ (v25 ^ v29 & (v27 ^ v25))
- 1680079193
+ v155
+ v24;
v32 = (__ROR4__(v30, 22) ^ __ROR4__(v30, 13) ^ __ROR4__(v30, 2))
+ (v28 & v30 | v26 & (v30 | v28))
+ (__ROR4__(v29, 25) ^ __ROR4__(v29, 11) ^ __ROR4__(v29, 6))
+ v23
+ (v25 ^ v29 & (v27 ^ v25))
- 1680079193
+ v155;
v33 = (__ROR4__(v31, 25) ^ __ROR4__(v31, 11) ^ __ROR4__(v31, 6))
+ v25
+ (v27 ^ v31 & (v29 ^ v27))
- 1046744716
+ v156
+ v26;
v34 = (__ROR4__(v32, 22) ^ __ROR4__(v32, 13) ^ __ROR4__(v32, 2))
+ (v30 & v32 | v28 & (v32 | v30))
+ (__ROR4__(v31, 25) ^ __ROR4__(v31, 11) ^ __ROR4__(v31, 6))
+ v25
+ (v27 ^ v31 & (v29 ^ v27))
- 1046744716
+ v156;
v141 += (__ROR4__(v142, 18) ^ __ROR4__(v142, 7) ^ (v142 >> 3))
+ v150
+ ((v155 >> 10) ^ __ROR4__(v155, 19) ^ __ROR4__(v155, 17));
v35 = (__ROR4__(v33, 25) ^ __ROR4__(v33, 11) ^ __ROR4__(v33, 6))
+ v27
+ (v29 ^ v33 & (v31 ^ v29))
- 459576895
+ v141
+ v28;
v36 = (__ROR4__(v34, 22) ^ __ROR4__(v34, 13) ^ __ROR4__(v34, 2))
+ (v32 & v34 | v30 & (v34 | v32))
+ (__ROR4__(v33, 25) ^ __ROR4__(v33, 11) ^ __ROR4__(v33, 6))
+ v27
+ (v29 ^ v33 & (v31 ^ v29))
- 459576895
+ v141;
v142 += (__ROR4__(v143, 18) ^ __ROR4__(v143, 7) ^ (v143 >> 3))
+ v151
+ ((v156 >> 10) ^ __ROR4__(v156, 19) ^ __ROR4__(v156, 17));
v37 = (__ROR4__(v35, 25) ^ __ROR4__(v35, 11) ^ __ROR4__(v35, 6))
+ v29
+ (v31 ^ v35 & (v33 ^ v31))
- 272742522
+ v142
+ v30;
v38 = (__ROR4__(v36, 22) ^ __ROR4__(v36, 13) ^ __ROR4__(v36, 2))
+ (v34 & v36 | v32 & (v36 | v34))
+ (__ROR4__(v35, 25) ^ __ROR4__(v35, 11) ^ __ROR4__(v35, 6))
+ v29
+ (v31 ^ v35 & (v33 ^ v31))
- 272742522
+ v142;
v143 += (__ROR4__(v144, 18) ^ __ROR4__(v144, 7) ^ (v144 >> 3))
+ v152
+ ((v141 >> 10) ^ __ROR4__(v141, 19) ^ __ROR4__(v141, 17));
v39 = (__ROR4__(v37, 25) ^ __ROR4__(v37, 11) ^ __ROR4__(v37, 6))
+ v31
+ (v33 ^ v37 & (v35 ^ v33))
+ 264347078
+ v143
+ v32;
v40 = (__ROR4__(v38, 22) ^ __ROR4__(v38, 13) ^ __ROR4__(v38, 2))
+ (v36 & v38 | v34 & (v38 | v36))
+ (__ROR4__(v37, 25) ^ __ROR4__(v37, 11) ^ __ROR4__(v37, 6))
+ v31
+ (v33 ^ v37 & (v35 ^ v33))
+ 264347078
+ v143;
v144 += (__ROR4__(v145, 18) ^ __ROR4__(v145, 7) ^ (v145 >> 3))
+ v153
+ ((v142 >> 10) ^ __ROR4__(v142, 19) ^ __ROR4__(v142, 17));
v41 = (__ROR4__(v39, 25) ^ __ROR4__(v39, 11) ^ __ROR4__(v39, 6))
+ v33
+ (v35 ^ v39 & (v37 ^ v35))
+ 604807628
+ v144
+ v34;
v42 = (__ROR4__(v40, 22) ^ __ROR4__(v40, 13) ^ __ROR4__(v40, 2))
+ (v38 & v40 | v36 & (v40 | v38))
+ (__ROR4__(v39, 25) ^ __ROR4__(v39, 11) ^ __ROR4__(v39, 6))
+ v33
+ (v35 ^ v39 & (v37 ^ v35))
+ 604807628
+ v144;
v145 += (__ROR4__(v146, 18) ^ __ROR4__(v146, 7) ^ (v146 >> 3))
+ v154
+ ((v143 >> 10) ^ __ROR4__(v143, 19) ^ __ROR4__(v143, 17));
v43 = (__ROR4__(v41, 25) ^ __ROR4__(v41, 11) ^ __ROR4__(v41, 6))
+ v35
+ (v37 ^ v41 & (v39 ^ v37))
+ 770255983
+ v145
+ v36;
v44 = (__ROR4__(v42, 22) ^ __ROR4__(v42, 13) ^ __ROR4__(v42, 2))
+ (v40 & v42 | v38 & (v42 | v40))
+ (__ROR4__(v41, 25) ^ __ROR4__(v41, 11) ^ __ROR4__(v41, 6))
+ v35
+ (v37 ^ v41 & (v39 ^ v37))
+ 770255983
+ v145;
v146 += (__ROR4__(v147, 18) ^ __ROR4__(v147, 7) ^ (v147 >> 3))
+ v155
+ ((v144 >> 10) ^ __ROR4__(v144, 19) ^ __ROR4__(v144, 17));
v45 = (__ROR4__(v43, 25) ^ __ROR4__(v43, 11) ^ __ROR4__(v43, 6))
+ v37
+ (v39 ^ v43 & (v41 ^ v39))
+ 1249150122
+ v146
+ v38;
v46 = (__ROR4__(v44, 22) ^ __ROR4__(v44, 13) ^ __ROR4__(v44, 2))
+ (v42 & v44 | v40 & (v44 | v42))
+ (__ROR4__(v43, 25) ^ __ROR4__(v43, 11) ^ __ROR4__(v43, 6))
+ v37
+ (v39 ^ v43 & (v41 ^ v39))
+ 1249150122
+ v146;
v147 += (__ROR4__(v148, 18) ^ __ROR4__(v148, 7) ^ (v148 >> 3))
+ v156
+ ((v145 >> 10) ^ __ROR4__(v145, 19) ^ __ROR4__(v145, 17));
v47 = (__ROR4__(v45, 25) ^ __ROR4__(v45, 11) ^ __ROR4__(v45, 6))
+ v39
+ (v41 ^ v45 & (v43 ^ v41))
+ 1555081692
+ v147
+ v40;
v48 = (__ROR4__(v46, 22) ^ __ROR4__(v46, 13) ^ __ROR4__(v46, 2))
+ (v44 & v46 | v42 & (v46 | v44))
+ (__ROR4__(v45, 25) ^ __ROR4__(v45, 11) ^ __ROR4__(v45, 6))
+ v39
+ (v41 ^ v45 & (v43 ^ v41))
+ 1555081692
+ v147;
v148 += (__ROR4__(v149, 18) ^ __ROR4__(v149, 7) ^ (v149 >> 3))
+ v141
+ ((v146 >> 10) ^ __ROR4__(v146, 19) ^ __ROR4__(v146, 17));
v49 = (__ROR4__(v47, 25) ^ __ROR4__(v47, 11) ^ __ROR4__(v47, 6))
+ v41
+ (v43 ^ v47 & (v45 ^ v43))
+ 1996064986
+ v148
+ v42;
v50 = (__ROR4__(v48, 22) ^ __ROR4__(v48, 13) ^ __ROR4__(v48, 2))
+ (v46 & v48 | v44 & (v48 | v46))
+ (__ROR4__(v47, 25) ^ __ROR4__(v47, 11) ^ __ROR4__(v47, 6))
+ v41
+ (v43 ^ v47 & (v45 ^ v43))
+ 1996064986
+ v148;
v149 += (__ROR4__(v150, 18) ^ __ROR4__(v150, 7) ^ (v150 >> 3))
+ v142
+ ((v147 >> 10) ^ __ROR4__(v147, 19) ^ __ROR4__(v147, 17));
v51 = (__ROR4__(v49, 25) ^ __ROR4__(v49, 11) ^ __ROR4__(v49, 6))
+ v43
+ (v45 ^ v49 & (v47 ^ v45))
- 1740746414
+ v149
+ v44;
v52 = (__ROR4__(v50, 22) ^ __ROR4__(v50, 13) ^ __ROR4__(v50, 2))
+ (v48 & v50 | v46 & (v50 | v48))
+ (__ROR4__(v49, 25) ^ __ROR4__(v49, 11) ^ __ROR4__(v49, 6))
+ v43
+ (v45 ^ v49 & (v47 ^ v45))
- 1740746414
+ v149;
v150 += (__ROR4__(v151, 18) ^ __ROR4__(v151, 7) ^ (v151 >> 3))
+ v143
+ ((v148 >> 10) ^ __ROR4__(v148, 19) ^ __ROR4__(v148, 17));
v53 = (__ROR4__(v51, 25) ^ __ROR4__(v51, 11) ^ __ROR4__(v51, 6))
+ v45
+ (v47 ^ v51 & (v49 ^ v47))
- 1473132947
+ v150
+ v46;
v54 = (__ROR4__(v52, 22) ^ __ROR4__(v52, 13) ^ __ROR4__(v52, 2))
+ (v50 & v52 | v48 & (v52 | v50))
+ (__ROR4__(v51, 25) ^ __ROR4__(v51, 11) ^ __ROR4__(v51, 6))
+ v45
+ (v47 ^ v51 & (v49 ^ v47))
- 1473132947
+ v150;
v151 += (__ROR4__(v152, 18) ^ __ROR4__(v152, 7) ^ (v152 >> 3))
+ v144
+ ((v149 >> 10) ^ __ROR4__(v149, 19) ^ __ROR4__(v149, 17));
v55 = (__ROR4__(v53, 25) ^ __ROR4__(v53, 11) ^ __ROR4__(v53, 6))
+ v47
+ (v49 ^ v53 & (v51 ^ v49))
- 1341970488
+ v151
+ v48;
v56 = (__ROR4__(v54, 22) ^ __ROR4__(v54, 13) ^ __ROR4__(v54, 2))
+ (v52 & v54 | v50 & (v54 | v52))
+ (__ROR4__(v53, 25) ^ __ROR4__(v53, 11) ^ __ROR4__(v53, 6))
+ v47
+ (v49 ^ v53 & (v51 ^ v49))
- 1341970488
+ v151;
v152 += (__ROR4__(v153, 18) ^ __ROR4__(v153, 7) ^ (v153 >> 3))
+ v145
+ ((v150 >> 10) ^ __ROR4__(v150, 19) ^ __ROR4__(v150, 17));
v57 = (__ROR4__(v55, 25) ^ __ROR4__(v55, 11) ^ __ROR4__(v55, 6))
+ v49
+ (v51 ^ v55 & (v53 ^ v51))
- 1084653625
+ v152
+ v50;
v58 = (__ROR4__(v56, 22) ^ __ROR4__(v56, 13) ^ __ROR4__(v56, 2))
+ (v54 & v56 | v52 & (v56 | v54))
+ (__ROR4__(v55, 25) ^ __ROR4__(v55, 11) ^ __ROR4__(v55, 6))
+ v49
+ (v51 ^ v55 & (v53 ^ v51))
- 1084653625
+ v152;
v153 += (__ROR4__(v154, 18) ^ __ROR4__(v154, 7) ^ (v154 >> 3))
+ v146
+ ((v151 >> 10) ^ __ROR4__(v151, 19) ^ __ROR4__(v151, 17));
v59 = (__ROR4__(v57, 25) ^ __ROR4__(v57, 11) ^ __ROR4__(v57, 6))
+ v51
+ (v53 ^ v57 & (v55 ^ v53))
- 958395405
+ v153
+ v52;
v60 = (__ROR4__(v58, 22) ^ __ROR4__(v58, 13) ^ __ROR4__(v58, 2))
+ (v56 & v58 | v54 & (v58 | v56))
+ (__ROR4__(v57, 25) ^ __ROR4__(v57, 11) ^ __ROR4__(v57, 6))
+ v51
+ (v53 ^ v57 & (v55 ^ v53))
- 958395405
+ v153;
v154 += (__ROR4__(v155, 18) ^ __ROR4__(v155, 7) ^ (v155 >> 3))
+ v147
+ ((v152 >> 10) ^ __ROR4__(v152, 19) ^ __ROR4__(v152, 17));
v61 = (__ROR4__(v59, 25) ^ __ROR4__(v59, 11) ^ __ROR4__(v59, 6))
+ v53
+ (v55 ^ v59 & (v57 ^ v55))
- 710438585
+ v154
+ v54;
v62 = (__ROR4__(v60, 22) ^ __ROR4__(v60, 13) ^ __ROR4__(v60, 2))
+ (v58 & v60 | v56 & (v60 | v58))
+ (__ROR4__(v59, 25) ^ __ROR4__(v59, 11) ^ __ROR4__(v59, 6))
+ v53
+ (v55 ^ v59 & (v57 ^ v55))
- 710438585
+ v154;
v155 += (__ROR4__(v156, 18) ^ __ROR4__(v156, 7) ^ (v156 >> 3))
+ v148
+ ((v153 >> 10) ^ __ROR4__(v153, 19) ^ __ROR4__(v153, 17));
v63 = (__ROR4__(v61, 25) ^ __ROR4__(v61, 11) ^ __ROR4__(v61, 6))
+ v55
+ (v57 ^ v61 & (v59 ^ v57))
+ 113926993
+ v155
+ v56;
v64 = (__ROR4__(v62, 22) ^ __ROR4__(v62, 13) ^ __ROR4__(v62, 2))
+ (v60 & v62 | v58 & (v62 | v60))
+ (__ROR4__(v61, 25) ^ __ROR4__(v61, 11) ^ __ROR4__(v61, 6))
+ v55
+ (v57 ^ v61 & (v59 ^ v57))
+ 113926993
+ v155;
v156 += (__ROR4__(v141, 18) ^ __ROR4__(v141, 7) ^ (v141 >> 3))
+ v149
+ ((v154 >> 10) ^ __ROR4__(v154, 19) ^ __ROR4__(v154, 17));
v65 = (__ROR4__(v63, 25) ^ __ROR4__(v63, 11) ^ __ROR4__(v63, 6))
+ v57
+ (v59 ^ v63 & (v61 ^ v59))
+ 338241895
+ v156
+ v58;
v66 = (__ROR4__(v64, 22) ^ __ROR4__(v64, 13) ^ __ROR4__(v64, 2))
+ (v62 & v64 | v60 & (v64 | v62))
+ (__ROR4__(v63, 25) ^ __ROR4__(v63, 11) ^ __ROR4__(v63, 6))
+ v57
+ (v59 ^ v63 & (v61 ^ v59))
+ 338241895
+ v156;
v141 += (__ROR4__(v142, 18) ^ __ROR4__(v142, 7) ^ (v142 >> 3))
+ v150
+ ((v155 >> 10) ^ __ROR4__(v155, 19) ^ __ROR4__(v155, 17));
v67 = (__ROR4__(v65, 25) ^ __ROR4__(v65, 11) ^ __ROR4__(v65, 6))
+ v59
+ (v61 ^ v65 & (v63 ^ v61))
+ 666307205
+ v141
+ v60;
v68 = (__ROR4__(v66, 22) ^ __ROR4__(v66, 13) ^ __ROR4__(v66, 2))
+ (v64 & v66 | v62 & (v66 | v64))
+ (__ROR4__(v65, 25) ^ __ROR4__(v65, 11) ^ __ROR4__(v65, 6))
+ v59
+ (v61 ^ v65 & (v63 ^ v61))
+ 666307205
+ v141;
v142 += (__ROR4__(v143, 18) ^ __ROR4__(v143, 7) ^ (v143 >> 3))
+ v151
+ ((v156 >> 10) ^ __ROR4__(v156, 19) ^ __ROR4__(v156, 17));
v69 = (__ROR4__(v67, 25) ^ __ROR4__(v67, 11) ^ __ROR4__(v67, 6))
+ v61
+ (v63 ^ v67 & (v65 ^ v63))
+ 773529912
+ v142
+ v62;
v70 = (__ROR4__(v68, 22) ^ __ROR4__(v68, 13) ^ __ROR4__(v68, 2))
+ (v66 & v68 | v64 & (v68 | v66))
+ (__ROR4__(v67, 25) ^ __ROR4__(v67, 11) ^ __ROR4__(v67, 6))
+ v61
+ (v63 ^ v67 & (v65 ^ v63))
+ 773529912
+ v142;
v143 += (__ROR4__(v144, 18) ^ __ROR4__(v144, 7) ^ (v144 >> 3))
+ v152
+ ((v141 >> 10) ^ __ROR4__(v141, 19) ^ __ROR4__(v141, 17));
v71 = (__ROR4__(v69, 25) ^ __ROR4__(v69, 11) ^ __ROR4__(v69, 6))
+ v63
+ (v65 ^ v69 & (v67 ^ v65))
+ 1294757372
+ v143
+ v64;
v72 = (__ROR4__(v70, 22) ^ __ROR4__(v70, 13) ^ __ROR4__(v70, 2))
+ (v68 & v70 | v66 & (v70 | v68))
+ (__ROR4__(v69, 25) ^ __ROR4__(v69, 11) ^ __ROR4__(v69, 6))
+ v63
+ (v65 ^ v69 & (v67 ^ v65))
+ 1294757372
+ v143;
v144 += (__ROR4__(v145, 18) ^ __ROR4__(v145, 7) ^ (v145 >> 3))
+ v153
+ ((v142 >> 10) ^ __ROR4__(v142, 19) ^ __ROR4__(v142, 17));
v73 = (__ROR4__(v71, 25) ^ __ROR4__(v71, 11) ^ __ROR4__(v71, 6))
+ v65
+ (v67 ^ v71 & (v69 ^ v67))
+ 1396182291
+ v144
+ v66;
v74 = (__ROR4__(v72, 22) ^ __ROR4__(v72, 13) ^ __ROR4__(v72, 2))
+ (v70 & v72 | v68 & (v72 | v70))
+ (__ROR4__(v71, 25) ^ __ROR4__(v71, 11) ^ __ROR4__(v71, 6))
+ v65
+ (v67 ^ v71 & (v69 ^ v67))
+ 1396182291
+ v144;
v145 += (__ROR4__(v146, 18) ^ __ROR4__(v146, 7) ^ (v146 >> 3))
+ v154
+ ((v143 >> 10) ^ __ROR4__(v143, 19) ^ __ROR4__(v143, 17));
v75 = (__ROR4__(v73, 25) ^ __ROR4__(v73, 11) ^ __ROR4__(v73, 6))
+ v67
+ (v69 ^ v73 & (v71 ^ v69))
+ 1695183700
+ v145
+ v68;
v76 = (__ROR4__(v74, 22) ^ __ROR4__(v74, 13) ^ __ROR4__(v74, 2))
+ (v72 & v74 | v70 & (v74 | v72))
+ (__ROR4__(v73, 25) ^ __ROR4__(v73, 11) ^ __ROR4__(v73, 6))
+ v67
+ (v69 ^ v73 & (v71 ^ v69))
+ 1695183700
+ v145;
v146 += (__ROR4__(v147, 18) ^ __ROR4__(v147, 7) ^ (v147 >> 3))
+ v155
+ ((v144 >> 10) ^ __ROR4__(v144, 19) ^ __ROR4__(v144, 17));
v77 = (__ROR4__(v75, 25) ^ __ROR4__(v75, 11) ^ __ROR4__(v75, 6))
+ v69
+ (v71 ^ v75 & (v73 ^ v71))
+ 1986661051
+ v146
+ v70;
v78 = (__ROR4__(v76, 22) ^ __ROR4__(v76, 13) ^ __ROR4__(v76, 2))
+ (v74 & v76 | v72 & (v76 | v74))
+ (__ROR4__(v75, 25) ^ __ROR4__(v75, 11) ^ __ROR4__(v75, 6))
+ v69
+ (v71 ^ v75 & (v73 ^ v71))
+ 1986661051
+ v146;
v147 += (__ROR4__(v148, 18) ^ __ROR4__(v148, 7) ^ (v148 >> 3))
+ v156
+ ((v145 >> 10) ^ __ROR4__(v145, 19) ^ __ROR4__(v145, 17));
v79 = (__ROR4__(v77, 25) ^ __ROR4__(v77, 11) ^ __ROR4__(v77, 6))
+ v71
+ (v73 ^ v77 & (v75 ^ v73))
- 2117940946
+ v147
+ v72;
v80 = (__ROR4__(v78, 22) ^ __ROR4__(v78, 13) ^ __ROR4__(v78, 2))
+ (v76 & v78 | v74 & (v78 | v76))
+ (__ROR4__(v77, 25) ^ __ROR4__(v77, 11) ^ __ROR4__(v77, 6))
+ v71
+ (v73 ^ v77 & (v75 ^ v73))
- 2117940946
+ v147;
v148 += (__ROR4__(v149, 18) ^ __ROR4__(v149, 7) ^ (v149 >> 3))
+ v141
+ ((v146 >> 10) ^ __ROR4__(v146, 19) ^ __ROR4__(v146, 17));
v81 = (__ROR4__(v79, 25) ^ __ROR4__(v79, 11) ^ __ROR4__(v79, 6))
+ v73
+ (v75 ^ v79 & (v77 ^ v75))
- 1838011259
+ v148
+ v74;
v82 = (__ROR4__(v80, 22) ^ __ROR4__(v80, 13) ^ __ROR4__(v80, 2))
+ (v78 & v80 | v76 & (v80 | v78))
+ (__ROR4__(v79, 25) ^ __ROR4__(v79, 11) ^ __ROR4__(v79, 6))
+ v73
+ (v75 ^ v79 & (v77 ^ v75))
- 1838011259
+ v148;
v149 += (__ROR4__(v150, 18) ^ __ROR4__(v150, 7) ^ (v150 >> 3))
+ v142
+ ((v147 >> 10) ^ __ROR4__(v147, 19) ^ __ROR4__(v147, 17));
v83 = (__ROR4__(v81, 25) ^ __ROR4__(v81, 11) ^ __ROR4__(v81, 6))
+ v75
+ (v77 ^ v81 & (v79 ^ v77))
- 1564481375
+ v149
+ v76;
v84 = (__ROR4__(v82, 22) ^ __ROR4__(v82, 13) ^ __ROR4__(v82, 2))
+ (v80 & v82 | v78 & (v82 | v80))
+ (__ROR4__(v81, 25) ^ __ROR4__(v81, 11) ^ __ROR4__(v81, 6))
+ v75
+ (v77 ^ v81 & (v79 ^ v77))
- 1564481375
+ v149;
v150 += (__ROR4__(v151, 18) ^ __ROR4__(v151, 7) ^ (v151 >> 3))
+ v143
+ ((v148 >> 10) ^ __ROR4__(v148, 19) ^ __ROR4__(v148, 17));
v85 = (__ROR4__(v83, 25) ^ __ROR4__(v83, 11) ^ __ROR4__(v83, 6))
+ v77
+ (v79 ^ v83 & (v81 ^ v79))
- 1474664885
+ v150
+ v78;
v86 = (__ROR4__(v84, 22) ^ __ROR4__(v84, 13) ^ __ROR4__(v84, 2))
+ (v82 & v84 | v80 & (v84 | v82))
+ (__ROR4__(v83, 25) ^ __ROR4__(v83, 11) ^ __ROR4__(v83, 6))
+ v77
+ (v79 ^ v83 & (v81 ^ v79))
- 1474664885
+ v150;
v151 += (__ROR4__(v152, 18) ^ __ROR4__(v152, 7) ^ (v152 >> 3))
+ v144
+ ((v149 >> 10) ^ __ROR4__(v149, 19) ^ __ROR4__(v149, 17));
v87 = (__ROR4__(v85, 25) ^ __ROR4__(v85, 11) ^ __ROR4__(v85, 6))
+ v79
+ (v81 ^ v85 & (v83 ^ v81))
- 1035236496
+ v151
+ v80;
v88 = (__ROR4__(v86, 22) ^ __ROR4__(v86, 13) ^ __ROR4__(v86, 2))
+ (v84 & v86 | v82 & (v86 | v84))
+ (__ROR4__(v85, 25) ^ __ROR4__(v85, 11) ^ __ROR4__(v85, 6))
+ v79
+ (v81 ^ v85 & (v83 ^ v81))
- 1035236496
+ v151;
v152 += (__ROR4__(v153, 18) ^ __ROR4__(v153, 7) ^ (v153 >> 3))
+ v145
+ ((v150 >> 10) ^ __ROR4__(v150, 19) ^ __ROR4__(v150, 17));
v89 = (__ROR4__(v87, 25) ^ __ROR4__(v87, 11) ^ __ROR4__(v87, 6))
+ v81
+ (v83 ^ v87 & (v85 ^ v83))
- 949202525
+ v152
+ v82;
v90 = (__ROR4__(v88, 22) ^ __ROR4__(v88, 13) ^ __ROR4__(v88, 2))
+ (v86 & v88 | v84 & (v88 | v86))
+ (__ROR4__(v87, 25) ^ __ROR4__(v87, 11) ^ __ROR4__(v87, 6))
+ v81
+ (v83 ^ v87 & (v85 ^ v83))
- 949202525
+ v152;
v153 += (__ROR4__(v154, 18) ^ __ROR4__(v154, 7) ^ (v154 >> 3))
+ v146
+ ((v151 >> 10) ^ __ROR4__(v151, 19) ^ __ROR4__(v151, 17));
v91 = (__ROR4__(v89, 25) ^ __ROR4__(v89, 11) ^ __ROR4__(v89, 6))
+ v83
+ (v85 ^ v89 & (v87 ^ v85))
- 778901479
+ v153
+ v84;
v92 = (__ROR4__(v90, 22) ^ __ROR4__(v90, 13) ^ __ROR4__(v90, 2))
+ (v88 & v90 | v86 & (v90 | v88))
+ (__ROR4__(v89, 25) ^ __ROR4__(v89, 11) ^ __ROR4__(v89, 6))
+ v83
+ (v85 ^ v89 & (v87 ^ v85))
- 778901479
+ v153;
v154 += (__ROR4__(v155, 18) ^ __ROR4__(v155, 7) ^ (v155 >> 3))
+ v147
+ ((v152 >> 10) ^ __ROR4__(v152, 19) ^ __ROR4__(v152, 17));
v93 = (__ROR4__(v91, 25) ^ __ROR4__(v91, 11) ^ __ROR4__(v91, 6))
+ v85
+ (v87 ^ v91 & (v89 ^ v87))
- 694614492
+ v154
+ v86;
v94 = (__ROR4__(v92, 22) ^ __ROR4__(v92, 13) ^ __ROR4__(v92, 2))
+ (v90 & v92 | v88 & (v92 | v90))
+ (__ROR4__(v91, 25) ^ __ROR4__(v91, 11) ^ __ROR4__(v91, 6))
+ v85
+ (v87 ^ v91 & (v89 ^ v87))
- 694614492
+ v154;
v155 += (__ROR4__(v156, 18) ^ __ROR4__(v156, 7) ^ (v156 >> 3))
+ v148
+ ((v153 >> 10) ^ __ROR4__(v153, 19) ^ __ROR4__(v153, 17));
v95 = (__ROR4__(v93, 25) ^ __ROR4__(v93, 11) ^ __ROR4__(v93, 6))
+ v87
+ (v89 ^ v93 & (v91 ^ v89))
- 200395387
+ v155
+ v88;
v96 = (__ROR4__(v94, 22) ^ __ROR4__(v94, 13) ^ __ROR4__(v94, 2))
+ (v92 & v94 | v90 & (v94 | v92))
+ (__ROR4__(v93, 25) ^ __ROR4__(v93, 11) ^ __ROR4__(v93, 6))
+ v87
+ (v89 ^ v93 & (v91 ^ v89))
- 200395387
+ v155;
v156 += (__ROR4__(v141, 18) ^ __ROR4__(v141, 7) ^ (v141 >> 3))
+ v149
+ ((v154 >> 10) ^ __ROR4__(v154, 19) ^ __ROR4__(v154, 17));
v97 = (__ROR4__(v95, 25) ^ __ROR4__(v95, 11) ^ __ROR4__(v95, 6))
+ v89
+ (v91 ^ v95 & (v93 ^ v91))
+ 275423344
+ v156
+ v90;
v98 = (__ROR4__(v96, 22) ^ __ROR4__(v96, 13) ^ __ROR4__(v96, 2))
+ (v94 & v96 | v92 & (v96 | v94))
+ (__ROR4__(v95, 25) ^ __ROR4__(v95, 11) ^ __ROR4__(v95, 6))
+ v89
+ (v91 ^ v95 & (v93 ^ v91))
+ 275423344
+ v156;
v141 += (__ROR4__(v142, 18) ^ __ROR4__(v142, 7) ^ (v142 >> 3))
+ v150
+ ((v155 >> 10) ^ __ROR4__(v155, 19) ^ __ROR4__(v155, 17));
v99 = (__ROR4__(v97, 25) ^ __ROR4__(v97, 11) ^ __ROR4__(v97, 6))
+ v91
+ (v93 ^ v97 & (v95 ^ v93))
+ 430227734
+ v141
+ v92;
v100 = (__ROR4__(v98, 22) ^ __ROR4__(v98, 13) ^ __ROR4__(v98, 2))
+ (v96 & v98 | v94 & (v98 | v96))
+ (__ROR4__(v97, 25) ^ __ROR4__(v97, 11) ^ __ROR4__(v97, 6))
+ v91
+ (v93 ^ v97 & (v95 ^ v93))
+ 430227734
+ v141;
v142 += (__ROR4__(v143, 18) ^ __ROR4__(v143, 7) ^ (v143 >> 3))
+ v151
+ ((v156 >> 10) ^ __ROR4__(v156, 19) ^ __ROR4__(v156, 17));
v101 = (__ROR4__(v99, 25) ^ __ROR4__(v99, 11) ^ __ROR4__(v99, 6))
+ v93
+ (v95 ^ v99 & (v97 ^ v95))
+ 506948616
+ v142
+ v94;
v102 = (__ROR4__(v100, 22) ^ __ROR4__(v100, 13) ^ __ROR4__(v100, 2))
+ (v98 & v100 | v96 & (v100 | v98))
+ (__ROR4__(v99, 25) ^ __ROR4__(v99, 11) ^ __ROR4__(v99, 6))
+ v93
+ (v95 ^ v99 & (v97 ^ v95))
+ 506948616
+ v142;
v143 += (__ROR4__(v144, 18) ^ __ROR4__(v144, 7) ^ (v144 >> 3))
+ v152
+ ((v141 >> 10) ^ __ROR4__(v141, 19) ^ __ROR4__(v141, 17));
v103 = (__ROR4__(v101, 25) ^ __ROR4__(v101, 11) ^ __ROR4__(v101, 6))
+ v95
+ (v97 ^ v101 & (v99 ^ v97))
+ 659060556
+ v143
+ v96;
v104 = (__ROR4__(v102, 22) ^ __ROR4__(v102, 13) ^ __ROR4__(v102, 2))
+ (v100 & v102 | v98 & (v102 | v100))
+ (__ROR4__(v101, 25) ^ __ROR4__(v101, 11) ^ __ROR4__(v101, 6))
+ v95
+ (v97 ^ v101 & (v99 ^ v97))
+ 659060556
+ v143;
v144 += (__ROR4__(v145, 18) ^ __ROR4__(v145, 7) ^ (v145 >> 3))
+ v153
+ ((v142 >> 10) ^ __ROR4__(v142, 19) ^ __ROR4__(v142, 17));
v105 = (__ROR4__(v103, 25) ^ __ROR4__(v103, 11) ^ __ROR4__(v103, 6))
+ v97
+ (v99 ^ v103 & (v101 ^ v99))
+ 883997877
+ v144
+ v98;
v106 = (__ROR4__(v104, 22) ^ __ROR4__(v104, 13) ^ __ROR4__(v104, 2))
+ (v102 & v104 | v100 & (v104 | v102))
+ (__ROR4__(v103, 25) ^ __ROR4__(v103, 11) ^ __ROR4__(v103, 6))
+ v97
+ (v99 ^ v103 & (v101 ^ v99))
+ 883997877
+ v144;
v145 += (__ROR4__(v146, 18) ^ __ROR4__(v146, 7) ^ (v146 >> 3))
+ v154
+ ((v143 >> 10) ^ __ROR4__(v143, 19) ^ __ROR4__(v143, 17));
v107 = (__ROR4__(v105, 25) ^ __ROR4__(v105, 11) ^ __ROR4__(v105, 6))
+ v99
+ (v101 ^ v105 & (v103 ^ v101))
+ 958139571
+ v145
+ v100;
v108 = (__ROR4__(v106, 22) ^ __ROR4__(v106, 13) ^ __ROR4__(v106, 2))
+ (v104 & v106 | v102 & (v106 | v104))
+ (__ROR4__(v105, 25) ^ __ROR4__(v105, 11) ^ __ROR4__(v105, 6))
+ v99
+ (v101 ^ v105 & (v103 ^ v101))
+ 958139571
+ v145;
v146 += (__ROR4__(v147, 18) ^ __ROR4__(v147, 7) ^ (v147 >> 3))
+ v155
+ ((v144 >> 10) ^ __ROR4__(v144, 19) ^ __ROR4__(v144, 17));
v109 = (__ROR4__(v107, 25) ^ __ROR4__(v107, 11) ^ __ROR4__(v107, 6))
+ v101
+ (v103 ^ v107 & (v105 ^ v103))
+ 1322822218
+ v146
+ v102;
v110 = (__ROR4__(v108, 22) ^ __ROR4__(v108, 13) ^ __ROR4__(v108, 2))
+ (v106 & v108 | v104 & (v108 | v106))
+ (__ROR4__(v107, 25) ^ __ROR4__(v107, 11) ^ __ROR4__(v107, 6))
+ v101
+ (v103 ^ v107 & (v105 ^ v103))
+ 1322822218
+ v146;
v147 += (__ROR4__(v148, 18) ^ __ROR4__(v148, 7) ^ (v148 >> 3))
+ v156
+ ((v145 >> 10) ^ __ROR4__(v145, 19) ^ __ROR4__(v145, 17));
v111 = (__ROR4__(v109, 25) ^ __ROR4__(v109, 11) ^ __ROR4__(v109, 6))
+ v103
+ (v105 ^ v109 & (v107 ^ v105))
+ 1537002063
+ v147
+ v104;
v112 = (__ROR4__(v110, 22) ^ __ROR4__(v110, 13) ^ __ROR4__(v110, 2))
+ (v108 & v110 | v106 & (v110 | v108))
+ (__ROR4__(v109, 25) ^ __ROR4__(v109, 11) ^ __ROR4__(v109, 6))
+ v103
+ (v105 ^ v109 & (v107 ^ v105))
+ 1537002063
+ v147;
v148 += (__ROR4__(v149, 18) ^ __ROR4__(v149, 7) ^ (v149 >> 3))
+ v141
+ ((v146 >> 10) ^ __ROR4__(v146, 19) ^ __ROR4__(v146, 17));
v113 = (__ROR4__(v111, 25) ^ __ROR4__(v111, 11) ^ __ROR4__(v111, 6))
+ v105
+ (v107 ^ v111 & (v109 ^ v107))
+ 1747873779
+ v148
+ v106;
v114 = (__ROR4__(v112, 22) ^ __ROR4__(v112, 13) ^ __ROR4__(v112, 2))
+ (v110 & v112 | v108 & (v112 | v110))
+ (__ROR4__(v111, 25) ^ __ROR4__(v111, 11) ^ __ROR4__(v111, 6))
+ v105
+ (v107 ^ v111 & (v109 ^ v107))
+ 1747873779
+ v148;
v149 += (__ROR4__(v150, 18) ^ __ROR4__(v150, 7) ^ (v150 >> 3))
+ v142
+ ((v147 >> 10) ^ __ROR4__(v147, 19) ^ __ROR4__(v147, 17));
v115 = (__ROR4__(v113, 25) ^ __ROR4__(v113, 11) ^ __ROR4__(v113, 6))
+ v107
+ (v109 ^ v113 & (v111 ^ v109))
+ 1955562222
+ v149
+ v108;
v116 = (__ROR4__(v114, 22) ^ __ROR4__(v114, 13) ^ __ROR4__(v114, 2))
+ (v112 & v114 | v110 & (v114 | v112))
+ (__ROR4__(v113, 25) ^ __ROR4__(v113, 11) ^ __ROR4__(v113, 6))
+ v107
+ (v109 ^ v113 & (v111 ^ v109))
+ 1955562222
+ v149;
v150 += (__ROR4__(v151, 18) ^ __ROR4__(v151, 7) ^ (v151 >> 3))
+ v143
+ ((v148 >> 10) ^ __ROR4__(v148, 19) ^ __ROR4__(v148, 17));
v117 = (__ROR4__(v115, 25) ^ __ROR4__(v115, 11) ^ __ROR4__(v115, 6))
+ v109
+ (v111 ^ v115 & (v113 ^ v111))
+ 2024104815
+ v150
+ v110;
v118 = (__ROR4__(v116, 22) ^ __ROR4__(v116, 13) ^ __ROR4__(v116, 2))
+ (v114 & v116 | v112 & (v116 | v114))
+ (__ROR4__(v115, 25) ^ __ROR4__(v115, 11) ^ __ROR4__(v115, 6))
+ v109
+ (v111 ^ v115 & (v113 ^ v111))
+ 2024104815
+ v150;
v151 += (__ROR4__(v152, 18) ^ __ROR4__(v152, 7) ^ (v152 >> 3))
+ v144
+ ((v149 >> 10) ^ __ROR4__(v149, 19) ^ __ROR4__(v149, 17));
v119 = (__ROR4__(v117, 25) ^ __ROR4__(v117, 11) ^ __ROR4__(v117, 6))
+ v111
+ (v113 ^ v117 & (v115 ^ v113))
- 2067236844
+ v151
+ v112;
v120 = (__ROR4__(v118, 22) ^ __ROR4__(v118, 13) ^ __ROR4__(v118, 2))
+ (v116 & v118 | v114 & (v118 | v116))
+ (__ROR4__(v117, 25) ^ __ROR4__(v117, 11) ^ __ROR4__(v117, 6))
+ v111
+ (v113 ^ v117 & (v115 ^ v113))
- 2067236844
+ v151;
v152 += (__ROR4__(v153, 18) ^ __ROR4__(v153, 7) ^ (v153 >> 3))
+ v145
+ ((v150 >> 10) ^ __ROR4__(v150, 19) ^ __ROR4__(v150, 17));
v121 = (__ROR4__(v119, 25) ^ __ROR4__(v119, 11) ^ __ROR4__(v119, 6))
+ v113
+ (v115 ^ v119 & (v117 ^ v115))
- 1933114872
+ v152
+ v114;
v122 = (__ROR4__(v120, 22) ^ __ROR4__(v120, 13) ^ __ROR4__(v120, 2))
+ (v118 & v120 | v116 & (v120 | v118))
+ (__ROR4__(v119, 25) ^ __ROR4__(v119, 11) ^ __ROR4__(v119, 6))
+ v113
+ (v115 ^ v119 & (v117 ^ v115))
- 1933114872
+ v152;
v153 += (__ROR4__(v154, 18) ^ __ROR4__(v154, 7) ^ (v154 >> 3))
+ v146
+ ((v151 >> 10) ^ __ROR4__(v151, 19) ^ __ROR4__(v151, 17));
v123 = (__ROR4__(v121, 25) ^ __ROR4__(v121, 11) ^ __ROR4__(v121, 6))
+ v115
+ (v117 ^ v121 & (v119 ^ v117))
- 1866530822
+ v153
+ v116;
v124 = (__ROR4__(v122, 22) ^ __ROR4__(v122, 13) ^ __ROR4__(v122, 2))
+ (v120 & v122 | v118 & (v122 | v120))
+ (__ROR4__(v121, 25) ^ __ROR4__(v121, 11) ^ __ROR4__(v121, 6))
+ v115
+ (v117 ^ v121 & (v119 ^ v117))
- 1866530822
+ v153;
v154 += (__ROR4__(v155, 18) ^ __ROR4__(v155, 7) ^ (v155 >> 3))
+ v147
+ ((v152 >> 10) ^ __ROR4__(v152, 19) ^ __ROR4__(v152, 17));
v125 = (__ROR4__(v123, 25) ^ __ROR4__(v123, 11) ^ __ROR4__(v123, 6))
+ v117
+ (v119 ^ v123 & (v121 ^ v119))
- 1538233109
+ v154
+ v118;
v126 = (__ROR4__(v124, 22) ^ __ROR4__(v124, 13) ^ __ROR4__(v124, 2))
+ (v122 & v124 | v120 & (v124 | v122))
+ (__ROR4__(v123, 25) ^ __ROR4__(v123, 11) ^ __ROR4__(v123, 6))
+ v117
+ (v119 ^ v123 & (v121 ^ v119))
- 1538233109
+ v154;
v155 += (__ROR4__(v156, 18) ^ __ROR4__(v156, 7) ^ (v156 >> 3))
+ v148
+ ((v153 >> 10) ^ __ROR4__(v153, 19) ^ __ROR4__(v153, 17));
v127 = (__ROR4__(v125, 25) ^ __ROR4__(v125, 11) ^ __ROR4__(v125, 6))
+ v119
+ (v121 ^ v125 & (v123 ^ v121))
- 1090935817
+ v155
+ v120;
v128 = (__ROR4__(v126, 22) ^ __ROR4__(v126, 13) ^ __ROR4__(v126, 2))
+ (v124 & v126 | v122 & (v126 | v124))
+ (__ROR4__(v125, 25) ^ __ROR4__(v125, 11) ^ __ROR4__(v125, 6))
+ v119
+ (v121 ^ v125 & (v123 ^ v121))
- 1090935817
+ v155;
v156 += (__ROR4__(v141, 18) ^ __ROR4__(v141, 7) ^ (v141 >> 3))
+ v149
+ ((v154 >> 10) ^ __ROR4__(v154, 19) ^ __ROR4__(v154, 17));
v129 = (__ROR4__(v127, 25) ^ __ROR4__(v127, 11) ^ __ROR4__(v127, 6))
+ v121
+ (v123 ^ v127 & (v125 ^ v123))
- 965641998
+ v156;
*a3 += (__ROR4__(v128, 22) ^ __ROR4__(v128, 13) ^ __ROR4__(v128, 2)) + (v126 & v128 | v124 & (v128 | v126)) + v129;
v132 = *a3;
a3[1] += v128;
v133 = a3[1];
a3[2] += v126;
v134 = a3[2];
a3[3] += v124;
v135 = a3[3];
a3[4] += v129 + v122;
v136 = a3[4];
a3[5] += v127;
v137 = a3[5];
a3[6] += v125;
v138 = a3[6];
a3[7] += v123;
v139 = a3[7];
}
return result;
}
//----- (08050785) --------------------------------------------------------
int __cdecl sub_8050785(int a1, int a2, int a3, int a4, int a5, int a6)
{
return posix_fadvise64(a1, a2, a3, a4, a5, a6);
}
// 8049050: using guessed type int __cdecl posix_fadvise64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
//----- (080507D6) --------------------------------------------------------
void __cdecl sub_80507D6(FILE *stream, int a2)
{
int v2; // eax
if ( stream )
{
v2 = fileno(stream);
sub_8050785(v2, 0, 0, 0, 0, a2);
}
}
//----- (0805081E) --------------------------------------------------------
FILE *__usercall sub_805081E@<eax>(signed __int32 a1@<ebx>, int a2, char *modes)
{
int v3; // ecx
FILE *stream; // [esp+1Ch] [ebp-1Ch]
signed int v6; // [esp+20h] [ebp-18h]
stream = (FILE *)fopen64(a2, modes);
if ( stream )
{
v6 = fileno(stream);
if ( v6 >= 0 && v6 <= 2 )
sub_8052D8A(v3, a1, v6);
}
return stream;
}
// 8048E10: using guessed type int __cdecl fopen64(_DWORD, _DWORD);
//----- (0805096E) --------------------------------------------------------
char *__cdecl sub_805096E(char *s)
{
char *v1; // eax
char *result; // eax
char *v3; // [esp+18h] [ebp-10h]
char *s1; // [esp+1Ch] [ebp-Ch]
if ( !s )
{
fwrite("A NULL argv[0] was passed through an exec system call.\n", 1u, 0x37u, stderr);
abort();
}
v3 = strrchr(s, 47);
if ( v3 )
v1 = v3 + 1;
else
v1 = s;
s1 = v1;
if ( v1 - s > 6 && !strncmp(v1 - 7, "/.libs/", 7u) )
{
s = s1;
if ( !strncmp(s1, "lt-", 3u) )
{
s = s1 + 3;
program_invocation_short_name = (int)(s1 + 3);
}
}
dword_805B801 = (int)s;
result = s;
program_invocation_name = (int)s;
return result;
}
// 805B2C0: using guessed type int program_invocation_short_name;
// 805B2D0: using guessed type int program_invocation_name;
// 805B801: using guessed type int dword_805B801;
//----- (08050AD3) --------------------------------------------------------
int __cdecl sub_8050AD3(int a1, unsigned __int8 a2, char a3)
{
void *v3; // eax
int v4; // ST18_4
v3 = &loc_8050B06;
if ( !a1 )
v3 = &loc_8050B0B;
dword_805B138 = (int)v3;
sub_80554F4();
v4 = (*(_DWORD *)(4 * (a2 >> 5) + a1 + 8) >> (a2 & 0x1F)) & 1;
*(_DWORD *)(4 * (a2 >> 5) + a1 + 8) ^= (v4 ^ a3 & 1) << (a2 & 0x1F);
return v4;
}
// 805B138: using guessed type int dword_805B138;
//----- (08050B96) --------------------------------------------------------
void __cdecl __noreturn sub_8050B96(int a1, int a2, int a3)
{
void *v3; // eax
int v4; // ecx
void *v5; // eax
v3 = &loc_8050BBB;
if ( a1 )
v3 = &loc_8050BC2;
dword_805B174 = (int)v3;
sub_805536D();
dword_805B819 = 10;
if ( a2 )
{
v5 = &loc_8050BF0;
if ( a3 )
v5 = &loc_8050BF2;
dword_805B1C4 = (int)v5;
sub_805514A(v4);
}
abort();
}
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 805536D: using guessed type int sub_805536D(void);
// 805B174: using guessed type int dword_805B174;
// 805B1C4: using guessed type int dword_805B1C4;
// 805B819: using guessed type int dword_805B819;
//----- (08050CEF) --------------------------------------------------------
_DWORD *__userpurge sub_8050CEF@<eax>(_DWORD *a1, int a2)
{
int v3; // [esp+0h] [ebp-38h]
int v4; // [esp+4h] [ebp-34h]
int v5; // [esp+8h] [ebp-30h]
int v6; // [esp+Ch] [ebp-2Ch]
int v7; // [esp+10h] [ebp-28h]
int v8; // [esp+14h] [ebp-24h]
int v9; // [esp+18h] [ebp-20h]
int v10; // [esp+1Ch] [ebp-1Ch]
int v11; // [esp+20h] [ebp-18h]
int v12; // [esp+24h] [ebp-14h]
int v13; // [esp+28h] [ebp-10h]
int v14; // [esp+2Ch] [ebp-Ch]
memset(&v3, 0, 0x30u);
if ( a2 == 10 )
abort();
*a1 = a2;
a1[1] = v4;
a1[2] = v5;
a1[3] = v6;
a1[4] = v7;
a1[5] = v8;
a1[6] = v9;
a1[7] = v10;
a1[8] = v11;
a1[9] = v12;
a1[10] = v13;
a1[11] = v14;
return a1;
}
//----- (08050D71) --------------------------------------------------------
char *__usercall sub_8050D71@<eax>(signed __int32 a1@<ebx>, char *msgid)
{
char *v3; // [esp+18h] [ebp-10h]
v3 = gettext(msgid);
if ( v3 == msgid )
sub_80547C3(a1);
return v3;
}
//----- (08050F2C) --------------------------------------------------------
int __usercall sub_8050F2C@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, unsigned int a3, _BYTE *a4, int a5, int a6, int a7, int a8, char *a9, char *a10)
{
_BYTE *v10; // edx
int v11; // ecx
bool v12; // ST53_1
int v13; // eax
signed __int32 v14; // ebx
signed __int32 v15; // et0
signed __int32 v16; // ebx
signed __int32 v17; // edx
signed __int32 v18; // eax
signed __int32 v19; // edx
signed __int32 v20; // ett
_BOOL4 v21; // eax
bool v22; // zf
void *v23; // eax
void *v24; // eax
void *v25; // eax
int (*v26)(); // eax
int result; // eax
char *v28; // [esp+2Ch] [ebp-5Ch]
char *v29; // [esp+30h] [ebp-58h]
bool v30; // [esp+41h] [ebp-47h]
unsigned int v31; // [esp+54h] [ebp-34h]
char *s; // [esp+5Ch] [ebp-2Ch]
char *sa; // [esp+5Ch] [ebp-2Ch]
unsigned int v34; // [esp+7Ch] [ebp-Ch]
v29 = a9;
v28 = a10;
v34 = __readgsdword(0x14u);
v31 = 0;
s = 0;
v12 = __ctype_get_mb_cur_max() == 1;
v30 = (a7 & 2) != 0;
v13 = a6;
switch ( a6 )
{
case 0:
goto LABEL_23;
case 1:
case 3:
v30 = 1;
goto LABEL_19;
case 2:
case 4:
LABEL_19:
if ( v30 != 1 && a3 > 0 )
{
v10 = a2;
*a2 = 39;
}
dword_805B188 = (int)&loc_805115E;
v14 = _InterlockedExchange(&dword_805B18C, a1);
v15 = _InterlockedExchange(&dword_805B18C, (signed __int32)v10);
v13 = sub_80552D6(v11, _InterlockedExchange(&dword_805B18C, v14));
v16 = _InterlockedExchange(&dword_805B18C, v15);
_InterlockedExchange(&dword_805B18C, v17);
v10 = (_BYTE *)_InterlockedExchange(&dword_805B18C, v16);
LABEL_23:
dword_805B228 = (int)&loc_805115E;
v18 = _InterlockedExchange(&dword_805B22C, v13);
_InterlockedExchange(&dword_805B22C, (signed __int32)v10);
v20 = _InterlockedExchange(&dword_805B22C, sub_8054EA3(v11, _InterlockedExchange(&dword_805B22C, v18)));
_InterlockedExchange(&dword_805B22C, v19);
_InterlockedExchange(&dword_805B22C, v20);
goto LABEL_24;
case 5:
goto LABEL_3;
case 6:
a6 = 5;
v30 = 1;
LABEL_3:
if ( v30 != 1 )
{
if ( a3 > 0 )
*a2 = 34;
v31 = 1;
}
s = (char *)&unk_80565C5;
break;
case 7:
v30 = 0;
break;
case 8:
case 9:
case 10:
if ( a6 != 10 )
{
v29 = sub_8050D71(a1, "`");
v28 = sub_8050D71(a1, "'");
}
if ( v30 != 1 )
{
for ( sa = v29; *sa; ++sa )
{
if ( v31 < a3 )
a2[v31] = *sa;
++v31;
}
}
s = v28;
strlen(v28);
break;
default:
LABEL_24:
abort();
return result;
}
if ( a5 == -1 )
LOBYTE(v21) = *a4 != 0;
else
v21 = a5 != 0;
v22 = (_BYTE)v21 == 0;
v23 = &loc_8051D71;
if ( !v22 )
v23 = &loc_805116A;
dword_805B110 = (int)v23;
sub_80555F6(v11);
if ( !v31 && a6 == 2 && v30 )
{
sub_8050F2C(a1, a2, a3, a4, a5, 4, a7 & 0xFFFFFFFD, 0, v29, v28);
}
else
{
if ( s )
{
v24 = &loc_8051E36;
if ( v30 == 1 )
v24 = &loc_8051E7B;
dword_805B124 = (int)v24;
sub_8055571();
v25 = &loc_8051E7B;
if ( *s )
v25 = &loc_8051E38;
dword_805B138 = (int)v25;
sub_80554F4();
}
if ( v31 < a3 )
a2[v31] = 0;
}
v26 = (int (*)())&loc_8051F14;
if ( __readgsdword(0x14u) == v34 )
v26 = sub_8051F19;
dword_805B174 = (int)v26;
return sub_805536D();
}
// 8051F19: using guessed type int sub_8051F19();
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 80552D6: using guessed type int __fastcall sub_80552D6(_DWORD, _DWORD);
// 805536D: using guessed type int sub_805536D(void);
// 8055571: using guessed type int sub_8055571(void);
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
// 805B124: using guessed type int dword_805B124;
// 805B138: using guessed type int dword_805B138;
// 805B174: using guessed type int dword_805B174;
// 805B188: using guessed type int dword_805B188;
// 805B18C: using guessed type int dword_805B18C;
// 805B228: using guessed type int dword_805B228;
// 805B22C: using guessed type int dword_805B22C;
//----- (08051F19) --------------------------------------------------------
#error "8051F1C: positive sp value has been found (funcsize=0)"
//----- (0805200B) --------------------------------------------------------
_BYTE *__cdecl sub_805200B(_BYTE *a1, int a2, _DWORD *a3, int *a4)
{
int *v4; // eax
int *v5; // ST3C_4
int v6; // ST40_4
int v7; // ST44_4
int size; // [esp+48h] [ebp-10h]
_BYTE *v10; // [esp+4Ch] [ebp-Ch]
if ( a4 )
v4 = a4;
else
v4 = &dword_805B819;
v5 = v4;
v6 = *__errno_location();
v7 = v5[1] | (a3 == 0);
size = sub_8050F2C((signed __int32)(v5 + 2), 0, 0, a1, a2, *v5, v7, (int)(v5 + 2), (char *)v5[10], (char *)v5[11]) + 1;
v10 = sub_8053694(size);
sub_8050F2C((signed __int32)(v5 + 2), v10, size, a1, a2, *v5, v7, (int)(v5 + 2), (char *)v5[10], (char *)v5[11]);
*__errno_location() = v6;
if ( a3 )
*a3 = size - 1;
return v10;
}
// 805B819: using guessed type int dword_805B819;
//----- (080521B2) --------------------------------------------------------
_BYTE *__usercall sub_80521B2@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4, int a5)
{
int v5; // ecx
int v6; // edx
signed __int32 v7; // eax
signed __int32 v8; // ebx
signed __int32 v9; // edx
signed __int32 v10; // edx
signed __int32 v11; // et1
size_t v12; // ST44_4
int *v14; // [esp+38h] [ebp-20h]
_BYTE *ptr; // [esp+3Ch] [ebp-1Ch]
int v16; // [esp+40h] [ebp-18h]
int size; // [esp+44h] [ebp-14h]
int v18; // [esp+48h] [ebp-10h]
unsigned int v19; // [esp+4Ch] [ebp-Ch]
v16 = *__errno_location();
v14 = off_805B274;
if ( a2 < 0 )
abort();
if ( dword_805B268 <= a2 )
{
if ( (unsigned int)a2 > 0xFFFFFFE )
sub_8053920();
v6 = 8 * (a2 + 1);
if ( off_805B274 == &dword_805B26C )
{
dword_805B110 = (int)&loc_8052251;
v7 = _InterlockedExchange(&dword_805B114, 0);
_InterlockedExchange(&dword_805B114, v6);
_InterlockedExchange(&dword_805B114, v7);
sub_80555F6(v5);
v8 = _InterlockedExchange(&dword_805B114, a1);
v11 = _InterlockedExchange(&dword_805B114, v9);
v10 = v8;
a1 = v11;
v6 = _InterlockedExchange(&dword_805B114, v10);
}
sub_80536EA(v5, a1, v14, v6);
}
v12 = off_805B274[2 * a2];
ptr = (_BYTE *)off_805B274[2 * a2 + 1];
v18 = *(_DWORD *)(a5 + 4) | 1;
v19 = sub_8050F2C(
a5 + 8,
(_BYTE *)off_805B274[2 * a2 + 1],
off_805B274[2 * a2],
a3,
a4,
*(_DWORD *)a5,
v18,
a5 + 8,
*(char **)(a5 + 40),
*(char **)(a5 + 44));
if ( v12 <= v19 )
{
size = v19 + 1;
v14[2 * a2] = v19 + 1;
if ( ptr != (_BYTE *)&unk_805B859 )
free(ptr);
ptr = sub_8053694(size);
v14[2 * a2 + 1] = (int)ptr;
sub_8050F2C(a5 + 8, ptr, size, a3, a4, *(_DWORD *)a5, v18, a5 + 8, *(char **)(a5 + 40), *(char **)(a5 + 44));
}
*__errno_location() = v16;
return ptr;
}
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
// 805B114: using guessed type int dword_805B114;
// 805B268: using guessed type int dword_805B268;
// 805B26C: using guessed type int dword_805B26C;
// 805B274: using guessed type int *off_805B274;
//----- (08052449) --------------------------------------------------------
_BYTE *__usercall sub_8052449@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3)
{
return sub_80521B2(a1, a2, a3, -1, (int)&dword_805B819);
}
// 805B819: using guessed type int dword_805B819;
//----- (08052473) --------------------------------------------------------
_BYTE *__usercall sub_8052473@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4)
{
return sub_80521B2(a1, a2, a3, a4, (int)&dword_805B819);
}
// 805B819: using guessed type int dword_805B819;
//----- (080524D9) --------------------------------------------------------
_BYTE *__usercall sub_80524D9@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4)
{
char v5; // [esp+10h] [ebp-38h]
sub_8050CEF(&v5, a3);
return sub_80521B2(a1, a2, a4, -1, (int)&v5);
}
//----- (08052517) --------------------------------------------------------
_BYTE *__usercall sub_8052517@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4, int a5)
{
char v6; // [esp+10h] [ebp-38h]
sub_8050CEF(&v6, a3);
return sub_80521B2(a1, a2, a4, a5, (int)&v6);
}
//----- (0805265B) --------------------------------------------------------
_BYTE *__usercall sub_805265B@<eax>(signed __int32 a1@<ebx>, int a2, _BYTE *a3)
{
return sub_80524D9(a1, 0, a2, a3);
}
//----- (08052685) --------------------------------------------------------
_BYTE *__usercall sub_8052685@<eax>(signed __int32 a1@<ebx>, int a2, _BYTE *a3, int a4)
{
return sub_8052517(a1, 0, a2, a3, a4);
}
//----- (080526AE) --------------------------------------------------------
_BYTE *__usercall sub_80526AE@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, int a3, unsigned __int8 a4)
{
int v5; // [esp+20h] [ebp-38h]
int v6; // [esp+24h] [ebp-34h]
int v7; // [esp+28h] [ebp-30h]
int v8; // [esp+2Ch] [ebp-2Ch]
int v9; // [esp+30h] [ebp-28h]
int v10; // [esp+34h] [ebp-24h]
int v11; // [esp+38h] [ebp-20h]
int v12; // [esp+3Ch] [ebp-1Ch]
int v13; // [esp+40h] [ebp-18h]
int v14; // [esp+44h] [ebp-14h]
int v15; // [esp+48h] [ebp-10h]
int v16; // [esp+4Ch] [ebp-Ch]
v5 = dword_805B819;
v6 = dword_805B81D;
v7 = dword_805B821;
v8 = dword_805B825;
v9 = dword_805B829;
v10 = dword_805B82D;
v11 = dword_805B831;
v12 = dword_805B835;
v13 = dword_805B839;
v14 = dword_805B83D;
v15 = dword_805B841;
v16 = dword_805B845;
sub_8050AD3((int)&v5, a4, 1);
return sub_80521B2(a1, 0, a2, a3, (int)&v5);
}
// 805B819: using guessed type int dword_805B819;
// 805B81D: using guessed type int dword_805B81D;
// 805B821: using guessed type int dword_805B821;
// 805B825: using guessed type int dword_805B825;
// 805B829: using guessed type int dword_805B829;
// 805B82D: using guessed type int dword_805B82D;
// 805B831: using guessed type int dword_805B831;
// 805B835: using guessed type int dword_805B835;
// 805B839: using guessed type int dword_805B839;
// 805B83D: using guessed type int dword_805B83D;
// 805B841: using guessed type int dword_805B841;
// 805B845: using guessed type int dword_805B845;
//----- (08052758) --------------------------------------------------------
_BYTE *__usercall sub_8052758@<eax>(signed __int32 a1@<ebx>, _BYTE *a2, unsigned __int8 a3)
{
return sub_80526AE(a1, a2, -1, a3);
}
//----- (08052781) --------------------------------------------------------
_BYTE *__usercall sub_8052781@<eax>(signed __int32 a1@<ebx>, _BYTE *a2)
{
return sub_8052758(a1, a2, 0x3Au);
}
//----- (0805286B) --------------------------------------------------------
_BYTE *__usercall sub_805286B@<eax>(signed __int32 a1@<ebx>, signed int a2, int a3, _BYTE *a4)
{
int v5; // [esp+10h] [ebp-68h]
int v6; // [esp+14h] [ebp-64h]
int v7; // [esp+18h] [ebp-60h]
int v8; // [esp+1Ch] [ebp-5Ch]
int v9; // [esp+20h] [ebp-58h]
int v10; // [esp+24h] [ebp-54h]
int v11; // [esp+28h] [ebp-50h]
int v12; // [esp+2Ch] [ebp-4Ch]
int v13; // [esp+30h] [ebp-48h]
int v14; // [esp+34h] [ebp-44h]
int v15; // [esp+38h] [ebp-40h]
int v16; // [esp+3Ch] [ebp-3Ch]
int v17; // [esp+40h] [ebp-38h]
int v18; // [esp+44h] [ebp-34h]
int v19; // [esp+48h] [ebp-30h]
int v20; // [esp+4Ch] [ebp-2Ch]
int v21; // [esp+50h] [ebp-28h]
int v22; // [esp+54h] [ebp-24h]
int v23; // [esp+58h] [ebp-20h]
int v24; // [esp+5Ch] [ebp-1Ch]
int v25; // [esp+60h] [ebp-18h]
int v26; // [esp+64h] [ebp-14h]
int v27; // [esp+68h] [ebp-10h]
int v28; // [esp+6Ch] [ebp-Ch]
sub_8050CEF(&v5, a3);
v17 = v5;
v18 = v6;
v19 = v7;
v20 = v8;
v21 = v9;
v22 = v10;
v23 = v11;
v24 = v12;
v25 = v13;
v26 = v14;
v27 = v15;
v28 = v16;
sub_8050AD3((int)&v17, 0x3Au, 1);
return sub_80521B2(a1, a2, a4, -1, (int)&v17);
}
//----- (080529A8) --------------------------------------------------------
void __cdecl __noreturn sub_80529A8(int a1, int a2, int a3)
{
sub_80529D8(a1, a2, a3);
}
//----- (080529D8) --------------------------------------------------------
void __cdecl __noreturn sub_80529D8(int a1, int a2, int a3)
{
int v3; // [esp+10h] [ebp-38h]
int v4; // [esp+14h] [ebp-34h]
int v5; // [esp+18h] [ebp-30h]
int v6; // [esp+1Ch] [ebp-2Ch]
int v7; // [esp+20h] [ebp-28h]
int v8; // [esp+24h] [ebp-24h]
int v9; // [esp+28h] [ebp-20h]
int v10; // [esp+2Ch] [ebp-1Ch]
int v11; // [esp+30h] [ebp-18h]
int v12; // [esp+34h] [ebp-14h]
int v13; // [esp+38h] [ebp-10h]
int v14; // [esp+3Ch] [ebp-Ch]
v3 = dword_805B819;
v4 = dword_805B81D;
v5 = dword_805B821;
v6 = dword_805B825;
v7 = dword_805B829;
v8 = dword_805B82D;
v9 = dword_805B831;
v10 = dword_805B835;
v11 = dword_805B839;
v12 = dword_805B83D;
v13 = dword_805B841;
v14 = dword_805B845;
sub_8050B96((int)&v3, a2, a3);
}
// 805B819: using guessed type int dword_805B819;
// 805B81D: using guessed type int dword_805B81D;
// 805B821: using guessed type int dword_805B821;
// 805B825: using guessed type int dword_805B825;
// 805B829: using guessed type int dword_805B829;
// 805B82D: using guessed type int dword_805B82D;
// 805B831: using guessed type int dword_805B831;
// 805B835: using guessed type int dword_805B835;
// 805B839: using guessed type int dword_805B839;
// 805B83D: using guessed type int dword_805B83D;
// 805B841: using guessed type int dword_805B841;
// 805B845: using guessed type int dword_805B845;
//----- (08052B9E) --------------------------------------------------------
_BYTE *__usercall sub_8052B9E@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3, int a4)
{
return sub_80521B2(a1, a2, a3, a4, (int)&unk_805B288);
}
//----- (08052CC9) --------------------------------------------------------
_BYTE *__usercall sub_8052CC9@<eax>(signed __int32 a1@<ebx>, signed int a2, _BYTE *a3)
{
return sub_8052B9E(a1, a2, a3, -1);
}
//----- (08052D8A) --------------------------------------------------------
void __usercall __noreturn sub_8052D8A(int a1@<ecx>, signed __int32 a2@<ebx>, int fd)
{
sub_8053A4E(a1, a2, fd, 0, 3);
}
//----- (08052DAD) --------------------------------------------------------
int __cdecl sub_8052DAD(FILE *stream, int a2, int a3, int a4, int a5, int a6)
{
char *v6; // eax
char *v7; // eax
int v8; // edi
int v9; // ST4C_4
int v10; // ST48_4
int v11; // ST44_4
int v12; // ST40_4
int v13; // ST3C_4
int v14; // ST38_4
int v15; // esi
int v16; // ebx
char *v17; // eax
if ( a2 )
fprintf(stream, "%s (%s) %s\n", a2, a3, a4);
else
fprintf(stream, "%s %s\n", a3, a4);
v6 = gettext("(C)");
fprintf(stream, "Copyright %s %d Free Software Foundation, Inc.", v6, 2017);
v7 = gettext(
"\n"
"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
"\n");
fputs_unlocked(v7, stream);
if ( (unsigned int)a6 <= 9 )
JUMPOUT(__CS__, *(&off_8056B54 + a6));
v8 = *(_DWORD *)(a5 + 32);
v9 = *(_DWORD *)(a5 + 28);
v10 = *(_DWORD *)(a5 + 24);
v11 = *(_DWORD *)(a5 + 20);
v12 = *(_DWORD *)(a5 + 16);
v13 = *(_DWORD *)(a5 + 12);
v14 = *(_DWORD *)(a5 + 8);
v15 = *(_DWORD *)(a5 + 4);
v16 = *(_DWORD *)a5;
v17 = gettext("Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n");
return fprintf(stream, v17, v16, v15, v14, v13, v12, v11, v10, v9, v8);
}
// 8048F20: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD);
// 8056B54: using guessed type void *;
//----- (080533EC) --------------------------------------------------------
int __cdecl sub_80533EC(FILE *stream, int a2, int a3, int a4, int a5)
{
int *v5; // eax
unsigned int i; // [esp+24h] [ebp-34h]
int v8[12]; // [esp+28h] [ebp-30h]
for ( i = 0; i <= 9; ++i )
{
v5 = (int *)a5;
a5 += 4;
v8[i] = *v5;
if ( !v8[i] )
break;
}
return sub_8052DAD(stream, a2, a3, a4, (int)v8, i);
}
// 80533EC: using guessed type int var_30[12];
//----- (08053452) --------------------------------------------------------
int sub_8053452(FILE *stream, int a2, int a3, int a4, ...)
{
va_list va; // [esp+50h] [ebp+18h]
va_start(va, a4);
return sub_80533EC(stream, a2, a3, a4, (int)va);
}
//----- (080535C0) --------------------------------------------------------
void __usercall __noreturn sub_80535C0(int a1@<ecx>, signed __int32 a2@<ebx>, void *ptr, int a4, int a5)
{
signed __int32 v5; // edx
signed __int32 v6; // ebx
signed __int32 v7; // ebx
signed __int32 v8; // ecx
unsigned int v9; // [esp+1Ch] [ebp-Ch]
v9 = *(_DWORD *)a4;
if ( ptr )
{
if ( 0x55555554u / a5 <= v9 )
LABEL_6:
sub_8053920();
v9 += (v9 >> 1) + 1;
}
else
{
if ( !v9 )
v9 = (0x40u / a5 == 0) + 0x40u / a5;
if ( 0x7FFFFFFFu / a5 < v9 )
{
dword_805B1C4 = (int)&loc_805365B;
v5 = _InterlockedExchange(&dword_805B1C8, a2);
v6 = _InterlockedExchange(&dword_805B1C8, 0x7FFFFFFFu % a5);
_InterlockedExchange(&dword_805B1C8, v5);
sub_805514A(a1);
v7 = _InterlockedExchange(&dword_805B1C8, v6);
_InterlockedExchange(&dword_805B1C8, v8);
_InterlockedExchange(&dword_805B1C8, v7);
goto LABEL_6;
}
}
*(_DWORD *)a4 = v9;
sub_80536EA(a1, a2, ptr, a5 * v9);
}
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 805B1C4: using guessed type int dword_805B1C4;
// 805B1C8: using guessed type int dword_805B1C8;
//----- (08053694) --------------------------------------------------------
void *__cdecl sub_8053694(size_t size)
{
return sub_80536A7(size);
}
//----- (080536A7) --------------------------------------------------------
void *__cdecl sub_80536A7(size_t size)
{
void *v1; // eax
int v2; // edx
int v3; // ecx
bool v4; // zf
void *v5; // eax
void *v7; // [esp+1Ch] [ebp-Ch]
v1 = malloc(size);
v7 = v1;
v4 = v1 == 0;
v5 = &loc_80536DA;
if ( !v4 )
v5 = &loc_80536E5;
dword_805B200 = (int)v5;
sub_8054F9F(v3, v2);
if ( size )
sub_8053920();
return v7;
}
// 8054F9F: using guessed type int __fastcall sub_8054F9F(_DWORD, _DWORD);
// 805B200: using guessed type int dword_805B200;
//----- (080536EA) --------------------------------------------------------
void __usercall __noreturn sub_80536EA(int a1@<ecx>, signed __int32 a2@<ebx>, void *ptr, size_t size)
{
void *v4; // eax
signed __int32 v5; // eax
signed __int32 v6; // ecx
int v7; // edx
signed __int32 v8; // ebx
signed __int32 v9; // edx
bool v10; // zf
int v11; // edx
int v12; // ecx
int (*v13)(); // eax
int (*v14)(); // eax
v4 = &loc_805370F;
if ( size )
v4 = &loc_805375B;
dword_805B19C = (int)v4;
sub_8055253(a1);
if ( ptr )
{
free(ptr);
dword_805B214 = (int)&locret_80537B6;
v5 = _InterlockedExchange(&dword_805B218, 0);
_InterlockedExchange(&dword_805B218, v6);
sub_8054F24(_InterlockedExchange(&dword_805B218, v5), v7);
v8 = _InterlockedExchange(&dword_805B218, a2);
_InterlockedExchange(&dword_805B218, v9);
_InterlockedExchange(&dword_805B218, v8);
}
v10 = realloc(ptr, size) == 0;
v13 = (int (*)())&loc_805378F;
if ( !v10 )
v13 = sub_80537B3;
dword_805B188 = (int)v13;
sub_80552D6(v12, v11);
v14 = (int (*)())&loc_80537AE;
if ( !size )
v14 = sub_80537B3;
dword_805B138 = (int)v14;
sub_80554F4();
sub_8053920();
}
// 80537B3: using guessed type int sub_80537B3();
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 8055253: using guessed type int __fastcall sub_8055253(_DWORD);
// 80552D6: using guessed type int __fastcall sub_80552D6(_DWORD, _DWORD);
// 805B138: using guessed type int dword_805B138;
// 805B188: using guessed type int dword_805B188;
// 805B19C: using guessed type int dword_805B19C;
// 805B214: using guessed type int dword_805B214;
// 805B218: using guessed type int dword_805B218;
//----- (080537B3) --------------------------------------------------------
#error "80537B7: positive sp value has been found (funcsize=0)"
//----- (08053841) --------------------------------------------------------
void *__cdecl sub_8053841(void *src, size_t n)
{
void *v2; // eax
v2 = sub_80536A7(n);
return memcpy(v2, src, n);
}
//----- (08053920) --------------------------------------------------------
void __noreturn sub_8053920()
{
char *v0; // eax
v0 = gettext("memory exhausted");
error(status, 0, "%s", v0);
abort();
}
//----- (08053959) --------------------------------------------------------
int __cdecl sub_8053959(FILE *stream)
{
bool v2; // zf
int v3; // ecx
void *v4; // eax
int v5; // eax
__int64 v6; // rax
int v7; // ecx
void *v8; // eax
int v9; // [esp+14h] [ebp-14h]
v9 = 0;
if ( fileno(stream) < 0 )
return fclose(stream);
v2 = __freading(stream) == 0;
v4 = &loc_80539B9;
if ( v2 )
v4 = &loc_80539F2;
dword_805B110 = (int)v4;
sub_80555F6(v3);
v5 = fileno(stream);
LODWORD(v6) = lseek64(v5, 0, 0, 1);
if ( v6 != -1 && sub_8053E17(stream) )
v9 = *__errno_location();
fclose(stream);
v8 = &loc_8053A38;
if ( !v9 )
v8 = &loc_8053A49;
dword_805B110 = (int)v8;
sub_80555F6(v7);
*__errno_location() = v9;
return -1;
}
// 8053959: could not find valid save-restore pair for ebx
// 8049030: using guessed type int __cdecl lseek64(_DWORD, _DWORD, _DWORD, _DWORD);
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
//----- (08053A4E) --------------------------------------------------------
void __usercall __noreturn sub_8053A4E(int a1@<ecx>, signed __int32 a2@<ebx>, int fd, int cmd, char a5)
{
void *v5; // eax
signed __int32 v6; // edx
int v7; // ecx
bool v8; // zf
int v9; // ecx
void *v10; // eax
signed __int32 v11; // ebx
int v12; // ecx
signed __int32 v13; // ecx
signed __int32 v14; // et1
int v15; // ST30_4
signed __int32 v16; // edx
signed __int32 v17; // ebx
int v18; // ecx
signed __int32 v19; // ebx
signed __int32 v20; // edx
signed __int32 v21; // edx
signed __int32 v22; // ett
signed __int32 v23; // ebx
signed __int32 v24; // et0
signed __int32 v25; // ebx
signed __int32 v26; // edx
signed __int32 v27; // et1
signed __int32 v28; // edx
signed __int32 v29; // ebx
signed __int32 v30; // et2
int v31; // ecx
signed __int32 v32; // edx
signed __int32 v33; // eax
signed __int32 v34; // ett
signed __int32 v35; // edx
signed __int32 v36; // eax
int v37; // ecx
signed __int32 v38; // ebx
signed __int32 v39; // edx
signed __int32 v40; // edx
signed __int32 v41; // et1
int v42; // [esp+1Ch] [ebp-1Ch]
char v43; // [esp+20h] [ebp-18h]
int v44; // [esp+24h] [ebp-14h]
v5 = &loc_8053A84;
if ( cmd != 1030 )
v5 = &loc_8053B1D;
dword_805B110 = (int)v5;
sub_80555F6(a1);
v43 = a5;
if ( dword_805B959 >= 0 )
{
v42 = fcntl(fd, cmd, a5);
if ( v42 < 0 )
{
v8 = *__errno_location() == 22;
v10 = &loc_8053AE6;
if ( v8 )
v10 = &loc_8053AF5;
dword_805B1C4 = (int)v10;
sub_805514A(v9);
}
dword_805B959 = 1;
if ( v42 >= 0 && dword_805B959 == -1 )
{
v44 = fcntl(v42, 1);
if ( v44 < 0 || fcntl(v42, 2, v44 | 1) == -1 )
{
v15 = *__errno_location();
close(v42);
*__errno_location() = v15;
dword_805B188 = (int)&loc_8053DD9;
v16 = _InterlockedExchange(&dword_805B18C, a2);
v17 = _InterlockedExchange(&dword_805B18C, v15);
sub_80552D6(v18, _InterlockedExchange(&dword_805B18C, v16));
v19 = _InterlockedExchange(&dword_805B18C, v17);
v22 = _InterlockedExchange(&dword_805B18C, v20);
v21 = v19;
a2 = v22;
v6 = _InterlockedExchange(&dword_805B18C, v21);
}
}
dword_805B228 = (int)&loc_8053DD9;
v23 = _InterlockedExchange(&dword_805B22C, a2);
v24 = _InterlockedExchange(&dword_805B22C, v6);
sub_8054EA3(v7, _InterlockedExchange(&dword_805B22C, v23));
v25 = _InterlockedExchange(&dword_805B22C, v24);
v27 = _InterlockedExchange(&dword_805B22C, v26);
v28 = _InterlockedExchange(&dword_805B22C, v25);
dword_805B214 = (int)&loc_8053B1D;
v29 = _InterlockedExchange(&dword_805B218, v27);
v30 = _InterlockedExchange(&dword_805B218, v28);
v34 = _InterlockedExchange(&dword_805B218, sub_8054F24(v31, _InterlockedExchange(&dword_805B218, v29)));
v33 = _InterlockedExchange(&dword_805B218, v32);
v35 = _InterlockedExchange(&dword_805B218, v34);
dword_805B214 = (int)&loc_8053DD9;
v36 = _InterlockedExchange(&dword_805B218, v33);
_InterlockedExchange(&dword_805B218, v35);
sub_8054F24(v37, _InterlockedExchange(&dword_805B218, v36));
v38 = _InterlockedExchange(&dword_805B218, v30);
v41 = _InterlockedExchange(&dword_805B218, v39);
v40 = v38;
dword_805B959 = -1;
dword_805B200 = (int)&loc_8053BA6;
v11 = _InterlockedExchange(&dword_805B204, v41);
_InterlockedExchange(&dword_805B204, _InterlockedExchange(&dword_805B218, v40));
v14 = _InterlockedExchange(&dword_805B204, sub_8054F9F(v12, _InterlockedExchange(&dword_805B204, v11)));
_InterlockedExchange(&dword_805B204, v13);
_InterlockedExchange(&dword_805B204, v14);
}
sub_8053A4E(fd, 0, v43);
}
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 8054F9F: using guessed type int __fastcall sub_8054F9F(_DWORD, _DWORD);
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 80552D6: using guessed type int __fastcall sub_80552D6(_DWORD, _DWORD);
// 80555F6: using guessed type int __fastcall sub_80555F6(_DWORD);
// 805B110: using guessed type int dword_805B110;
// 805B188: using guessed type int dword_805B188;
// 805B18C: using guessed type int dword_805B18C;
// 805B1C4: using guessed type int dword_805B1C4;
// 805B200: using guessed type int dword_805B200;
// 805B204: using guessed type int dword_805B204;
// 805B214: using guessed type int dword_805B214;
// 805B218: using guessed type int dword_805B218;
// 805B228: using guessed type int dword_805B228;
// 805B22C: using guessed type int dword_805B22C;
// 805B959: using guessed type int dword_805B959;
//----- (08053DDE) --------------------------------------------------------
int __cdecl sub_8053DDE(FILE *stream)
{
int result; // eax
result = stream->_flags & 0x100;
if ( result )
result = sub_8053E70(stream, 0, 0, 1);
return result;
}
//----- (08053E17) --------------------------------------------------------
int __cdecl sub_8053E17(FILE *fp)
{
bool v1; // zf
void *v2; // eax
if ( fp )
{
v1 = __freading(fp) == 0;
v2 = &loc_8053E4B;
if ( !v1 )
v2 = &loc_8053E58;
dword_805B174 = (int)v2;
sub_805536D();
}
return fflush(fp);
}
// 805536D: using guessed type int sub_805536D(void);
// 805B174: using guessed type int dword_805B174;
//----- (08053E70) --------------------------------------------------------
int __cdecl sub_8053E70(FILE *stream, int a2, int a3, int a4)
{
int v4; // ecx
char *v5; // edx
void *v6; // eax
int v7; // eax
__off64_t v8; // rax
if ( stream->_IO_read_end != stream->_IO_read_ptr )
return fseeko64(stream, a2, a3, a4);
v5 = stream->_IO_write_ptr;
if ( v5 != stream->_IO_write_base )
return fseeko64(stream, a2, a3, a4);
v6 = &loc_8053ECD;
if ( stream->_IO_save_base )
v6 = &loc_8053F3D;
dword_805B1EC = (int)v6;
sub_8055050(v4, v5);
v7 = fileno(stream);
LODWORD(v8) = lseek64(v7, a2, a3, a4);
if ( v8 == -1 )
return -1;
stream->_flags &= 0xFFFFFFEF;
stream->_offset = v8;
return 0;
}
// 8048DC0: using guessed type int __cdecl fseeko64(_DWORD, _DWORD, _DWORD, _DWORD);
// 8049030: using guessed type int __cdecl lseek64(_DWORD, _DWORD, _DWORD, _DWORD);
// 8055050: using guessed type int __fastcall sub_8055050(_DWORD, _DWORD);
// 805B1EC: using guessed type int dword_805B1EC;
//----- (08053F5F) --------------------------------------------------------
size_t __usercall sub_8053F5F@<eax>(signed __int32 a1@<ebx>, wchar_t *pwc, char *s, size_t n, mbstate_t *p)
{
char v6; // [esp+18h] [ebp-10h]
size_t v7; // [esp+1Ch] [ebp-Ch]
if ( !pwc )
pwc = (wchar_t *)&v6;
v7 = mbrtowc(pwc, s, n, p);
if ( v7 <= 0xFFFFFFFD || !n || !((unsigned __int8)sub_8054125(a1, 0) ^ 1) )
return v7;
*pwc = (unsigned __int8)*s;
return 1;
}
//----- (08053FD1) --------------------------------------------------------
int __cdecl sub_8053FD1(unsigned __int8 *a1, unsigned __int8 *a2)
{
unsigned __int8 *v2; // esi
unsigned __int8 *v3; // ebx
unsigned __int8 v5; // al
unsigned __int8 v6; // [esp+1Eh] [ebp-Ah]
v2 = a1;
v3 = a2;
if ( a1 == a2 )
return 0;
do
{
v6 = sub_8054AF0(*v2);
v5 = sub_8054AF0(*v3);
if ( !v6 )
break;
++v2;
++v3;
}
while ( v6 == v5 );
return v6 - v5;
}
//----- (08054072) --------------------------------------------------------
int __cdecl sub_8054072(FILE *fp)
{
bool v1; // ST26_1
bool v2; // al
void *v3; // eax
bool v4; // zf
int v5; // ecx
void *v6; // eax
bool v8; // [esp+1Dh] [ebp-Bh]
bool v9; // [esp+1Fh] [ebp-9h]
v8 = __fpending(fp) != 0;
v1 = ferror_unlocked(fp) != 0;
v2 = sub_8053959(fp) != 0;
v9 = v2;
if ( !v1 )
{
if ( !v2 )
return 0;
v3 = &loc_80540DC;
if ( v8 )
v3 = &loc_8054101;
dword_805B138 = (int)v3;
sub_80554F4();
v4 = *__errno_location() == 9;
v6 = &loc_8054101;
if ( v4 )
v6 = &loc_805411E;
dword_805B1C4 = (int)v6;
sub_805514A(v5);
}
if ( v9 != 1 )
*__errno_location() = 0;
return -1;
}
// 8054072: could not find valid save-restore pair for ebx
// 805514A: using guessed type int __fastcall sub_805514A(_DWORD);
// 805B138: using guessed type int dword_805B138;
// 805B1C4: using guessed type int dword_805B1C4;
//----- (08054125) --------------------------------------------------------
int __usercall sub_8054125@<eax>(signed __int32 a1@<ebx>, int category)
{
bool v2; // zf
int (*v3)(); // eax
int v4; // eax
signed __int32 v5; // eax
signed __int32 v6; // edx
signed __int32 v7; // ebx
signed __int32 v8; // edx
const char *s1; // [esp+1Ch] [ebp-Ch]
s1 = setlocale(category, 0);
if ( s1 )
{
v2 = strcmp(s1, "C") == 0;
v3 = (int (*)())&loc_805417B;
if ( v2 )
v3 = sub_80541CC;
dword_805B138 = (int)v3;
sub_80554F4();
v4 = strcmp(s1, "POSIX");
dword_805B138 = (int)sub_80541D2;
v5 = _InterlockedExchange(&dword_805B13C, v4);
_InterlockedExchange(&dword_805B13C, v6);
_InterlockedExchange(&dword_805B13C, v5);
sub_80554F4();
v7 = _InterlockedExchange(&dword_805B13C, a1);
_InterlockedExchange(&dword_805B13C, v8);
_InterlockedExchange(&dword_805B13C, v7);
}
return 1;
}
// 80541CC: using guessed type int sub_80541CC();
// 80541D2: using guessed type int sub_80541D2();
// 805B138: using guessed type int dword_805B138;
// 805B13C: using guessed type int dword_805B13C;
//----- (0805421F) --------------------------------------------------------
int __usercall __noreturn sub_805421F@<eax>(int a1@<edx>, int a2@<ecx>, signed __int32 a3@<ebx>)
{
_BOOL4 v3; // eax
char *v4; // eax
int v5; // edx
int v6; // ecx
bool v7; // zf
void *v8; // eax
FILE *v9; // eax
void *v10; // eax
signed __int32 v11; // ebx
signed __int32 v12; // edx
signed __int32 v13; // edx
signed __int32 v14; // ebx
signed __int32 v15; // et0
int v16; // ecx
signed __int32 v17; // ecx
signed __int32 v18; // et1
int v19; // eax
int v20; // edx
int v21; // ecx
void *v22; // eax
signed __int32 v23; // ebx
signed __int32 v24; // edx
signed __int32 v25; // et2
int v26; // ecx
signed __int32 v27; // ebx
signed __int32 v28; // edx
signed __int32 v29; // edx
signed __int32 v30; // ett
signed __int32 v31; // eax
int v32; // edx
signed __int32 v33; // ecx
signed __int32 v34; // eax
signed __int32 v35; // ecx
signed __int32 v36; // et1
int (*v37)(); // eax
void *v39; // [esp+18h] [ebp-B0h]
const char *s; // [esp+1Ch] [ebp-ACh]
void *v41; // [esp+20h] [ebp-A8h]
int v42; // [esp+24h] [ebp-A4h]
size_t n; // [esp+2Ch] [ebp-9Ch]
size_t v44; // [esp+30h] [ebp-98h]
_BOOL4 v45; // [esp+34h] [ebp-94h]
char *dest; // [esp+38h] [ebp-90h]
int fd; // [esp+3Ch] [ebp-8Ch]
FILE *stream; // [esp+40h] [ebp-88h]
int c; // [esp+44h] [ebp-84h]
int ca; // [esp+44h] [ebp-84h]
size_t v51; // [esp+48h] [ebp-80h]
size_t v52; // [esp+4Ch] [ebp-7Ch]
void *v53; // [esp+50h] [ebp-78h]
char src; // [esp+56h] [ebp-72h]
char v55; // [esp+89h] [ebp-3Fh]
unsigned int v56; // [esp+BCh] [ebp-Ch]
v56 = __readgsdword(0x14u);
if ( !dword_805B95D )
{
s = getenv("CHARSETALIASDIR");
if ( !s || !*s )
s = "/home/hwangdz/coreutils/coreutils-8.28/install_m32/lib";
n = strlen(s);
v44 = strlen("charset.alias");
v3 = n && s[n - 1] != 47;
v45 = v3;
v4 = (char *)malloc(n + v3 + v44 + 1);
dest = v4;
v7 = v4 == 0;
v8 = &loc_8054340;
if ( v7 )
v8 = &loc_80543B1;
dword_805B1EC = (int)v8;
sub_8055050(v6, v5);
memcpy(dest, s, n);
if ( v45 )
dest[n] = 47;
memcpy(&dest[n + v45], "charset.alias", v44 + 1);
free(0);
if ( dest )
{
fd = open64(dest, 0x20000);
if ( fd >= 0 )
{
v9 = fdopen(fd, "r");
stream = v9;
v7 = v9 == 0;
v10 = &loc_8054449;
if ( !v7 )
v10 = &loc_8054497;
dword_805B124 = (int)v10;
sub_8055571();
close(fd);
dword_805B188 = (int)&loc_8054771;
v11 = _InterlockedExchange(&dword_805B18C, a3);
v15 = _InterlockedExchange(&dword_805B18C, v12);
v13 = v11;
v14 = v15;
v18 = _InterlockedExchange(&dword_805B18C, sub_80552D6(v16, _InterlockedExchange(&dword_805B18C, v13)));
_InterlockedExchange(&dword_805B18C, v17);
_InterlockedExchange(&dword_805B18C, v18);
v41 = 0;
v42 = 0;
while ( 1 )
{
c = getc_unlocked(stream);
if ( c == -1 )
break;
if ( c != 10 && c != 32 && c != 9 )
{
if ( c == 35 )
{
do
{
v19 = getc_unlocked(stream);
ca = v19;
}
while ( v19 != -1 && v19 != 10 );
v22 = &loc_805453E;
if ( ca != -1 )
v22 = &loc_8054543;
dword_805B188 = (int)v22;
sub_80552D6(v21, v20);
break;
}
ungetc(c, stream);
if ( fscanf(stream, "%50s %50s", &src, &v55) <= 1 )
break;
v51 = strlen(&src);
v52 = strlen(&v55);
v53 = v41;
if ( !v42 )
{
v42 = v51 + v52 + 2;
v41 = malloc(v51 + v52 + 3);
dword_805B1B0 = (int)&loc_8054673;
v23 = _InterlockedExchange(&dword_805B1B4, v14);
v25 = _InterlockedExchange(&dword_805B1B4, v24);
sub_80551D4(v26, _InterlockedExchange(&dword_805B1B4, v23));
v27 = _InterlockedExchange(&dword_805B1B4, v25);
v30 = _InterlockedExchange(&dword_805B1B4, v28);
v29 = v27;
v14 = v30;
_InterlockedExchange(&dword_805B1B4, v29);
}
v42 += v52 + v51 + 2;
v41 = realloc(v41, v42 + 1);
if ( !v41 )
{
v42 = 0;
free(v53);
break;
}
strcpy((char *)v41 + v42 - v52 - v51 - 2, &src);
strcpy((char *)v41 + v42 - v52 - 1, &v55);
}
}
v31 = sub_8053959(stream);
if ( !v42 )
{
dword_805B1B0 = (int)&loc_8054771;
v34 = _InterlockedExchange(&dword_805B1B4, v31);
_InterlockedExchange(&dword_805B1B4, v33);
v36 = _InterlockedExchange(&dword_805B1B4, sub_80551D4(_InterlockedExchange(&dword_805B1B4, v34), v32));
_InterlockedExchange(&dword_805B1B4, v35);
_InterlockedExchange(&dword_805B1B4, v36);
}
*((_BYTE *)v41 + v42) = 0;
v39 = v41;
}
else
{
v39 = &unk_8056CE3;
}
free(dest);
}
else
{
v39 = &unk_8056CE3;
}
dword_805B95D = (int)v39;
}
v37 = (int (*)())&loc_80547B5;
if ( __readgsdword(0x14u) == v56 )
v37 = sub_80547BA;
dword_805B228 = (int)v37;
return sub_8054EA3(a2, a1);
}
// 8048D10: using guessed type int __cdecl open64(_DWORD, _DWORD);
// 80547BA: using guessed type int sub_80547BA();
// 8054EA3: using guessed type int __fastcall sub_8054EA3(_DWORD, _DWORD);
// 8055050: using guessed type int __fastcall sub_8055050(_DWORD, _DWORD);
// 80551D4: using guessed type int __fastcall sub_80551D4(_DWORD, _DWORD);
// 80552D6: using guessed type int __fastcall sub_80552D6(_DWORD, _DWORD);
// 8055571: using guessed type int sub_8055571(void);
// 805B124: using guessed type int dword_805B124;
// 805B188: using guessed type int dword_805B188;
// 805B18C: using guessed type int dword_805B18C;
// 805B1B0: using guessed type int dword_805B1B0;
// 805B1B4: using guessed type int dword_805B1B4;
// 805B1EC: using guessed type int dword_805B1EC;
// 805B228: using guessed type int dword_805B228;
// 805B95D: using guessed type int dword_805B95D;
//----- (080547BA) --------------------------------------------------------
#error "80547C0: positive sp value has been found (funcsize=0)"
//----- (080547C3) --------------------------------------------------------
void __usercall __noreturn sub_80547C3(signed __int32 a1@<ebx>)
{
int v1; // edx
int v2; // ecx
nl_langinfo(14);
sub_805421F(v1, v2, a1);
}
//----- (08054AF0) --------------------------------------------------------
int __cdecl sub_8054AF0(int a1)
{
int result; // eax
if ( (unsigned int)(a1 - 65) > 0x19 )
result = a1;
else
result = a1 + 32;
return result;
}
//----- (08054B78) --------------------------------------------------------
Elf32_Dyn *__cdecl sub_8054B78(unsigned __int64 a1, __int64 a2)
{
Elf32_Dyn *v2; // edx
Elf32_Dyn *result; // eax
int v4; // ebp
int v5; // ebp
unsigned int v6; // ebp
unsigned __int64 v7; // rtt
unsigned __int64 v8; // rax
unsigned int v9; // edi
unsigned __int64 v10; // rax
unsigned int v11; // ecx
signed __int32 v12; // eax
signed __int32 v13; // edx
signed __int32 v14; // et1
int v15; // esi
int v16; // edx
int v17; // ecx
void *v18; // eax
unsigned int v19; // [esp+4h] [ebp-1Ch]
unsigned int v20; // [esp+Ch] [ebp-14h]
if ( HIDWORD(a2) )
{
if ( HIDWORD(a2) > HIDWORD(a1) )
{
result = (Elf32_Dyn *)a1;
}
else
{
_BitScanReverse((unsigned int *)&v4, HIDWORD(a2));
v5 = v4 ^ 0x1F;
if ( v5 )
{
v19 = (HIDWORD(a2) << v5) | ((unsigned int)a2 >> (32 - v5));
HIDWORD(v8) = HIDWORD(a1) >> (32 - v5);
LODWORD(v8) = (HIDWORD(a1) << v5) | ((unsigned int)a1 >> (32 - v5));
v20 = (_DWORD)a1 << v5;
v9 = v8 % v19;
v10 = (unsigned int)((_DWORD)a2 << v5) * (unsigned __int64)(unsigned int)(v8 / v19);
v11 = v10;
if ( v9 < HIDWORD(v10) || v20 < (unsigned int)v10 && v9 == HIDWORD(v10) )
{
HIDWORD(v10) = (v10 - __PAIR__(v19, (_DWORD)a2 << v5)) >> 32;
v11 = v10 - ((_DWORD)a2 << v5);
}
result = (Elf32_Dyn *)(((__PAIR__(v9, v20) - __PAIR__(HIDWORD(v10), v11)) >> 32 << (32 - (unsigned __int8)v5)) | ((v20 - v11) >> v5));
}
else if ( (unsigned int)a2 <= (unsigned int)a1 || HIDWORD(a2) < HIDWORD(a1) )
{
result = (Elf32_Dyn *)(a1 - a2);
}
else
{
dword_805B1EC = (int)&loc_8054BE9;
v12 = _InterlockedExchange(&dword_805B1F0, SHIDWORD(a2));
_InterlockedExchange(&dword_805B1F0, SHIDWORD(a2));
v14 = _InterlockedExchange(&dword_805B1F0, sub_8055050(a1, _InterlockedExchange(&dword_805B1F0, v12)));
_InterlockedExchange(&dword_805B1F0, v13);
_InterlockedExchange(&dword_805B1F0, v14);
init_proc();
result = &stru_805AF08;
v15 = ((char *)&stru_805AF08.d_un - (char *)&stru_805AF08) >> 2;
if ( v15 )
{
((void (__cdecl *)(_DWORD, _DWORD, _DWORD))stru_805AF08.d_tag)(HIDWORD(a1), a1, HIDWORD(a1));
v18 = &loc_8054D6B;
if ( v15 != 1 )
v18 = &loc_8054D35;
dword_805B214 = (int)v18;
result = (Elf32_Dyn *)sub_8054F24(v17, v16);
}
}
}
}
else
{
if ( (unsigned int)a2 <= HIDWORD(a1) )
{
v6 = a2;
if ( !(_DWORD)a2 )
v6 = 1 / 0u;
LODWORD(v7) = a1;
HIDWORD(v7) = HIDWORD(a1) % v6;
v2 = (Elf32_Dyn *)(v7 % v6);
}
else
{
v2 = (Elf32_Dyn *)(a1 % (unsigned int)a2);
}
result = v2;
}
return result;
}
// 8054F24: using guessed type int __fastcall sub_8054F24(_DWORD, _DWORD);
// 8055050: using guessed type int __fastcall sub_8055050(_DWORD, _DWORD);
// 805AF08: using guessed type Elf32_Dyn stru_805AF08;
// 805B1EC: using guessed type int dword_805B1EC;
// 805B1F0: using guessed type int dword_805B1F0;
// 805B214: using guessed type int dword_805B214;
//----- (08054D84) --------------------------------------------------------
int __cdecl sub_8054D84(int a1)
{
return __cxa_atexit(a1, 0, dword_805B24C);
}
// 8048E80: using guessed type int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD);
// 805B24C: using guessed type int dword_805B24C;
//----- (08054DFA) --------------------------------------------------------
#error "8054E33: positive sp value has been found (funcsize=18)"
//----- (08054EA3) --------------------------------------------------------
#error "8054EA9: positive sp value has been found (funcsize=0)"
//----- (08054F24) --------------------------------------------------------
#error "8054F2A: positive sp value has been found (funcsize=0)"
//----- (08054F9F) --------------------------------------------------------
#error "8054FA5: positive sp value has been found (funcsize=0)"
//----- (0805500F) --------------------------------------------------------
#error "8055048: positive sp value has been found (funcsize=18)"
//----- (08055050) --------------------------------------------------------
#error "8055056: positive sp value has been found (funcsize=0)"
//----- (080550CB) --------------------------------------------------------
#error "80550D1: positive sp value has been found (funcsize=0)"
//----- (0805514A) --------------------------------------------------------
#error "8055150: positive sp value has been found (funcsize=0)"
//----- (080551D4) --------------------------------------------------------
#error "80551DA: positive sp value has been found (funcsize=0)"
//----- (08055253) --------------------------------------------------------
#error "8055259: positive sp value has been found (funcsize=0)"
//----- (080552D6) --------------------------------------------------------
#error "80552DC: positive sp value has been found (funcsize=0)"
//----- (0805536D) --------------------------------------------------------
#error "8055373: positive sp value has been found (funcsize=0)"
//----- (080553ED) --------------------------------------------------------
#error "80553F3: positive sp value has been found (funcsize=0)"
//----- (08055473) --------------------------------------------------------
#error "8055479: positive sp value has been found (funcsize=0)"
//----- (080554F4) --------------------------------------------------------
#error "80554FA: positive sp value has been found (funcsize=0)"
//----- (08055571) --------------------------------------------------------
#error "8055577: positive sp value has been found (funcsize=0)"
//----- (080555F6) --------------------------------------------------------
#error "80555FC: positive sp value has been found (funcsize=0)"
//----- (08055620) --------------------------------------------------------
int (**sub_8055620())()
{
int (**result)(); // eax
int v1; // esi
int v2; // edi
init_proc();
result = off_805AEC4;
v1 = &off_805AEC8 - off_805AEC4;
if ( v1 )
{
v2 = 0;
do
result = (int (**)())off_805AEC4[v2++]();
while ( v1 != v2 );
}
return result;
}
// 805AEC4: using guessed type int (*off_805AEC4[2])();
// 805AEC8: using guessed type int (*off_805AEC8)();
//----- (08055684) --------------------------------------------------------
void term_proc()
{
;
}
#error "There were 22 decompilation failure(s) on 165 function(s)"
|
senseobservationsystems/sense-android-library
|
sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrBioHarness.java
|
<gh_stars>1-10
/**************************************************************************************************
* Copyright (C) 2010 Sense Observation Systems, Rotterdam, the Netherlands. All rights reserved. *
*************************************************************************************************/
package nl.sense_os.service.external_sensors;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
import nl.sense_os.service.R;
import nl.sense_os.service.constants.SenseDataTypes;
import nl.sense_os.service.constants.SensePrefs;
import nl.sense_os.service.constants.SensePrefs.Main.External;
import nl.sense_os.service.constants.SensorData.DataPoint;
import nl.sense_os.service.constants.SensorData.SensorNames;
import nl.sense_os.service.provider.SNTP;
import nl.sense_os.service.shared.SensorDataPoint;
import nl.sense_os.service.subscription.BaseDataProducer;
import org.json.JSONObject;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
/**
* Represents the Zephyr BioHarness sensor. When started, the phone tries to connect to the device
* via Bluetooth and requests sensor data.
*
* @author <NAME> <<EMAIL>>
*/
public class ZephyrBioHarness extends BaseDataProducer {
/*
* Scan thread
*/
private class BioHarnessConnectThread implements Runnable {
private BroadcastReceiver btReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (!bioHarnessEnabled) {
return;
}
String action = intent.getAction();
if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
BluetoothAdapter.STATE_OFF);
if (state == BluetoothAdapter.STATE_ON) {
stop();
connectHandler
.post(bioHarnessConnectThread = new BioHarnessConnectThread());
return;
}
}
}
};
public BioHarnessConnectThread() {
// send address
try {
btAdapter = BluetoothAdapter.getDefaultAdapter();
} catch (Exception e) {
Log.e(TAG, "Exception preparing Bluetooth scan thread:", e);
}
}
@Override
public void run() {
if (bioHarnessEnabled) {
streamEnabled = false;
if (btAdapter.isEnabled()) {
// check if there is a paired device with the name BioHarness
Set<BluetoothDevice> pairedDevices = btAdapter.getBondedDevices();
// If there are paired devices
boolean connected = false;
if (pairedDevices.size() > 0) {
// Loop through paired devices
for (BluetoothDevice device : pairedDevices) {
// Add the name and address to an array adapter to show in a ListView
if (device.getName().startsWith("BH ZBH")
&& device.getAddress().startsWith("00:07:80")) {
// Log.v(TAG, "Connecting to BioHarness:" + device.getName());
// Get a BluetoothSocket to connect with the given BluetoothDevice
try {
btSocket = device.createRfcommSocketToServiceRecord(serial_uid);
btSocket.connect();
final String deviceType = device.getName();
final String deviceUuid = device.getAddress();
// check sensor IDs
new Thread(){public void run(){
new ZephyrBioHarnessRegistrator(context).verifySensorIds(
deviceType,deviceUuid);
}}.start();
processZBHMessage = new ProcessZephyrBioHarnessMessage(
device.getName(), device.getAddress());
updateHandler.post(updateThread = new UpdateThread());
connected = true;
} catch (Exception e) {
Log.e(TAG,
"Error connecting to BioHarness device: "
+ e.getMessage());
}
}
}
}
if (!connected) {
// Log.v(TAG, "No Paired BioHarness device found. Sleeping for 10 seconds");
connectHandler.postDelayed(
bioHarnessConnectThread = new BioHarnessConnectThread(), 10000);
}
} else if (btAdapter.getState() == BluetoothAdapter.STATE_TURNING_ON) {
// listen for the adapter state to change to STATE_ON
context.registerReceiver(btReceiver, new IntentFilter(
BluetoothAdapter.ACTION_STATE_CHANGED));
} else {
// ask user for permission to start bluetooth
// Log.v(TAG, "Asking user to start bluetooth");
Intent startBt = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startBt.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startBt);
// listen for the adapter state to change to STATE_ON
context.registerReceiver(btReceiver, new IntentFilter(
BluetoothAdapter.ACTION_STATE_CHANGED));
}
} else {
stop();
}
}
public void stop() {
try {
// Log.v(TAG, "Stopping the BioHarness service");
updateHandler.removeCallbacks(updateThread);
btSocket.close();
context.unregisterReceiver(btReceiver);
} catch (Exception e) {
Log.e(TAG, "Error in stopping bioHarness service" + e.getMessage());
}
}
}
/*
* Process message class
*/
private class ProcessZephyrBioHarnessMessage {
private String deviceType;
private String deviceUuid;
private SharedPreferences prefs = null;
public ProcessZephyrBioHarnessMessage(String deviceType, String deviceUuid) {
this.deviceType = deviceType;
this.deviceUuid = deviceUuid;
prefs = context.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE);
}
public boolean processMessage(byte[] buffer) throws Exception {
// received general data
if (buffer[0] == 0x02 && buffer[1] == 0x20 && buffer[2] == 53) {
// check that payload is not completely empty
boolean hasPayload = false;
for (int i = 12; i < 58; i++) {
if (buffer[i] != 0) {
hasPayload = true;
break;
}
}
if (false == hasPayload) {
Log.w(TAG, "No sensor data payload received");
// return true because the message type was correct, only the data is wrong
return true;
}
// send acceleration data in m/s^2
if (prefs.getBoolean(External.ZephyrBioHarness.ACC, true)) {
float g = 9.80665f;
JSONObject json = new JSONObject();
Short xmin = (short) (buffer[32] | buffer[33] << 8);
Short xmax = (short) (buffer[34] | buffer[35] << 8);
float x = (xmin.floatValue() + xmax.floatValue()) / 200.0f * g;
Short ymin = (short) (buffer[36] | buffer[37] << 8);
Short ymax = (short) (buffer[38] | buffer[39] << 8);
float y = (ymin.floatValue() + ymax.floatValue()) / 200.0f * g;
Short zmin = (short) (buffer[40] | buffer[41] << 8);
Short zmax = (short) (buffer[42] | buffer[43] << 8);
float z = (zmin.floatValue() + zmax.floatValue()) / 200.0f * g;
// Log.v(TAG, "x:" + x + " y:" + y + " z:" + z);
json.put("x-axis", x);
json.put("y-axis", y);
json.put("z-axis", z);
sendDataPoint(SensorNames.ACCELEROMETER, "BioHarness " + deviceType,
json.toString(), SenseDataTypes.JSON);
}
// send heart rate
if (prefs.getBoolean(External.ZephyrBioHarness.HEART_RATE, true)) {
Short heartRate = (short) (buffer[12] | buffer[13] << 8);
// if(heartRate < (short)0)
// heartRate = (short)(heartRate+(short)255);
// Log.v(TAG, "Heart rate:" + heartRate);
sendDataPoint(SensorNames.HEART_RATE, "BioHarness " + deviceType,
heartRate.intValue(), SenseDataTypes.INT);
}
// send respiration rate
if (prefs.getBoolean(External.ZephyrBioHarness.RESP, true)) {
Short respirationRate = (short) (buffer[14] | buffer[15] << 8);
if (respirationRate < 0) {
respirationRate = (short) (respirationRate + (short) 255);
}
float respirationRateF = (respirationRate.floatValue() / 10.0f);
// Log.v(TAG, "Respiration rate:" + respirationRateF);
sendDataPoint(SensorNames.RESPIRATION, "BioHarness " + deviceType,
respirationRateF, SenseDataTypes.FLOAT);
}
// send skin temperature
if (prefs.getBoolean(External.ZephyrBioHarness.TEMP, true)) {
Short skinTemperature = (short) (buffer[16] | buffer[17] << 8);
if (skinTemperature < 0) {
skinTemperature = (short) (skinTemperature + (short) 255);
}
float skinTemperatureF = (skinTemperature.floatValue() / 10.0f);
// Log.v(TAG, "Skin temperature:" + skinTemperatureF);
sendDataPoint(SensorNames.TEMPERATURE, "BioHarness " + deviceType,
skinTemperatureF, SenseDataTypes.FLOAT);
}
// send battery level
if (prefs.getBoolean(External.ZephyrBioHarness.BATTERY, true)) {
int batteryLevel = buffer[54];
// Log.v(TAG, "Battery level:" + batteryLevel);
sendDataPoint(SensorNames.BATTERY_LEVEL, "BioHarness " + deviceType,
batteryLevel, SenseDataTypes.INT);
}
// send worn status
if (prefs.getBoolean(External.ZephyrBioHarness.WORN_STATUS, true)) {
boolean wornStatusB = (buffer[55] & 0x10000000) == 0x10000000;
// Log.v(TAG, "Worn status:" + wornStatusB);
sendDataPoint(SensorNames.WORN_STATUS, "BioHarness " + deviceType, wornStatusB,
SenseDataTypes.BOOL);
}
return true;
} else {
return false;
}
}
private void sendDataPoint(String sensorName, String description, Object value, String dataType)
{
try
{
SensorDataPoint dataPoint = new SensorDataPoint(0);
if (dataType.equals(SenseDataTypes.BOOL)) {
dataPoint = new SensorDataPoint((Boolean) value);
} else if (dataType.equals(SenseDataTypes.FLOAT)) {
dataPoint = new SensorDataPoint((Float) value);
} else if (dataType.equals(SenseDataTypes.INT)) {
dataPoint = new SensorDataPoint((Integer) value);
} else if (dataType.equals(SenseDataTypes.JSON)) {
dataPoint = new SensorDataPoint(new JSONObject((String)value));
} else if (dataType.equals(SenseDataTypes.STRING)) {
dataPoint = new SensorDataPoint((String) value);
} else {
dataPoint = null;
}
if(dataPoint != null)
{
notifySubscribers();
dataPoint.sensorName = sensorName;
dataPoint.sensorDescription = description;
dataPoint.timeStamp = SNTP.getInstance().getTime();
sendToSubscribers(dataPoint);
}
}catch(Exception e)
{
Log.e(TAG, "Error sending data point to subscribers of the ZephyrBioHarness");
}
Intent intent = new Intent(context.getString(R.string.action_sense_new_data));
intent.putExtra(DataPoint.SENSOR_NAME, sensorName);
intent.putExtra(DataPoint.SENSOR_DESCRIPTION, description);
intent.putExtra(DataPoint.DATA_TYPE, dataType);
intent.putExtra(DataPoint.DEVICE_UUID, deviceUuid);
if (dataType.equals(SenseDataTypes.BOOL)) {
intent.putExtra(DataPoint.VALUE, (Boolean) value);
} else if (dataType.equals(SenseDataTypes.FLOAT)) {
intent.putExtra(DataPoint.VALUE, (Float) value);
} else if (dataType.equals(SenseDataTypes.INT)) {
intent.putExtra(DataPoint.VALUE, (Integer) value);
} else if (dataType.equals(SenseDataTypes.JSON)) {
intent.putExtra(DataPoint.VALUE, (String) value);
} else if (dataType.equals(SenseDataTypes.STRING)) {
intent.putExtra(DataPoint.VALUE, (String) value);
} else {
Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'");
}
intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime());
intent.setPackage(context.getPackageName());
context.startService(intent);
}
}
/*
* Update thread
*/
private class UpdateThread extends Thread {
private InputStream mmInStream;
private OutputStream mmOutStream;
public UpdateThread() {
if (mmInStream == null || mmOutStream == null) {
InputStream tmpIn = null;
OutputStream tmpOut = null;
// Get the input and output streams, using temp objects because member streams are
// final
try {
tmpIn = btSocket.getInputStream();
tmpOut = btSocket.getOutputStream();
} catch (Exception e) {
Log.e(TAG, "Error in update thread constructor:" + e.getMessage());
}
mmInStream = tmpIn;
mmOutStream = tmpOut;
}
}
/* Call this from the main Activity to shutdown the connection */
public void cancel() {
try {
Log.i(TAG, "Stopping the BioHarness service");
setEnableGeneralData(false);
btSocket.close();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
@Override
public void run() {
// Keep listening to the InputStream until an exception occurs
boolean readMessage = false;
if (bioHarnessEnabled) {
try {
if (!streamEnabled) {
streamEnabled = setEnableGeneralData(true);
updateHandler.post(updateThread = new UpdateThread());
return;
}
// check connection
if (!sendConnectionAlive()) {
connectHandler.postDelayed(
bioHarnessConnectThread = new BioHarnessConnectThread(), 1000);
return;
}
if (SNTP.getInstance().getTime() > lastSampleTime + updateInterval) {
while (!readMessage) {
lastSampleTime = SNTP.getInstance().getTime();
// Read from the InputStream
byte[] buffer = new byte[80];
int bytes; // bytes returned from read()
// check connection
if (!sendConnectionAlive()) {
connectHandler.postDelayed(
bioHarnessConnectThread = new BioHarnessConnectThread(),
1000);
return;
}
bytes = mmInStream.read(buffer);
if (bytes > 0) {
readMessage = processZBHMessage.processMessage(buffer);
}
buffer = null;
}
}
// update every second
updateHandler.postDelayed(updateThread = new UpdateThread(), 1000);
} catch (Exception e) {
Log.e(TAG, "Error in receiving BioHarness data:" + e.getMessage());
e.printStackTrace();
// re-connect
connectHandler.postDelayed(
bioHarnessConnectThread = new BioHarnessConnectThread(), 1000);
}
} else {
cancel();
}
}
public boolean sendConnectionAlive() {
try {
byte[] writeBuffer = new byte[128];
writeBuffer[0] = 0x02; // STC
writeBuffer[1] = 0x23; // MSG_ID // alive
writeBuffer[2] = 0; // DLC
writeBuffer[3] = 0; // Payload
writeBuffer[4] = 0; // CRC
writeBuffer[5] = 0x03; // ETX
return write(writeBuffer);
} catch (Exception e) {
Log.e(TAG, "Error in setEnableGeneralData:" + e.getMessage());
return false;
}
}
public boolean setEnableGeneralData(boolean enable) {
try {
if (enable) {
// Log.v(TAG, "Enabling general data...");
} else {
// Log.v(TAG, "Disabling general data...");
}
byte[] buffer = new byte[128];
byte[] writeBuffer = new byte[128];
byte[] data = new byte[1];
if (enable) {
data[0] = (byte) 1;
} else {
data[0] = (byte) 0;
}
writeBuffer[0] = 0x02; // STC
writeBuffer[1] = 0x14; // MSG_ID // general packet enable
writeBuffer[2] = 1; // DLC
writeBuffer[3] = data[0];
writeBuffer[4] = CRC8.checksum2(data); // CRC
writeBuffer[5] = 0x03; // ETX
write(writeBuffer);
int nrBytes = mmInStream.read(buffer);
// Log.v(TAG,
// "Enable received:" + Integer.toString(buffer[0] & 0xFF, 16) + ","
// + Integer.toString(buffer[1] & 0xFF, 16) + ","
// + Integer.toString(buffer[2] & 0xFF, 16));
if (nrBytes > 0 && buffer[1] == 0x14 && buffer[4] == 0x06) // ACK
{
if (enable) {
// Log.v(TAG, "General data enabled");
} else {
// Log.v(TAG, "General data disabled");
}
return true;
} else {
return false;
}
} catch (Exception e) {
Log.e(TAG, "Error in setEnableGeneralData:" + e.getMessage());
return false;
}
}
/* Call this from the main Activity to send data to the remote device */
public boolean write(byte[] bytes) {
try {
mmOutStream.write(bytes);
} catch (Exception e) {
Log.e(TAG, "Error in write:" + e.getMessage());
return false;
}
return true;
}
}
private static final String TAG = "Zephyr BioHarness";
private BluetoothAdapter btAdapter;
private final Context context;
private boolean bioHarnessEnabled = false;
private UUID serial_uid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
private final Handler connectHandler = new Handler(Looper.getMainLooper());
private Handler updateHandler = new Handler(Looper.getMainLooper());
private int updateInterval = 0;
private UpdateThread updateThread = null;
private long lastSampleTime = 0;
private BioHarnessConnectThread bioHarnessConnectThread = null;
private boolean streamEnabled = false;
private BluetoothSocket btSocket = null;
private ProcessZephyrBioHarnessMessage processZBHMessage = null;
public ZephyrBioHarness(Context context) {
this.context = context;
}
public int getUpdateInterval() {
return updateInterval;
}
public void setUpdateInterval(int scanInterval) {
updateInterval = scanInterval;
}
public void startBioHarness(int interval) {
updateInterval = interval;
bioHarnessEnabled = true;
Thread t = new Thread() {
@Override
public void run() {
connectHandler.post(bioHarnessConnectThread = new BioHarnessConnectThread());
}
};
connectHandler.post(t);
}
public void stopBioHarness() {
bioHarnessEnabled = false;
try {
if (bioHarnessConnectThread != null) {
bioHarnessConnectThread.stop();
connectHandler.removeCallbacks(bioHarnessConnectThread);
}
} catch (Exception e) {
Log.e(TAG, "Exception in stopping Bluetooth scan thread:", e);
}
}
}
|
scaug10/NETESP
|
src/main/java/com/g10/ssm/service/LoginService.java
|
<gh_stars>0
package com.g10.ssm.service;
import java.util.List;
import com.g10.ssm.po.User;
public interface LoginService {
/**
* 新增注册用户,并为用户赋予一个权限
*/
public int saveUser(User user)throws Exception;
/**
* 查询登录名是否已经存在
*/
public boolean isUserIdExist(String userName)throws Exception;
/**
* 验证用户登录密码是否与数据库一致
*/
public int checkUserPassword(String userName,String password)throws Exception;
/**
* 找回密码之发送验证码
*/
public int sendVerificationCode(String userName,String email)throws Exception;
/**
* 找回密码之发送用户原密码
*/
public int sendOriginPassword(String userName,String verificationCode)throws Exception;
/**
* 修改密码
*/
public int changePassword(String userName,String password)throws Exception;
/**
* 查询用户列表
*/
public List<User> searchUserList()throws Exception;
}
|
aehparta/gauge
|
hardware/probe-test-stm32/utils/timebase.h
|
#pragma once
#include <common.h>
/** Millisecond delay */
void delay_ms(uint32_t ms);
/** Second delay */
void delay_s(uint32_t s);
/** Schedule a periodic task (like a cron job). Returns success. */
bool register_periodic_task(void (*callback) (void), uint32_t interval_ms);
/** Schedule a future one-off task. Returns success. */
bool schedule_task(void (*callback)(void), uint32_t delay_ms);
|
lzpawell/pouch
|
apis/types/network_disconnect.go
|
<reponame>lzpawell/pouch
// Code generated by go-swagger; DO NOT EDIT.
package types
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// NetworkDisconnect Parameters of network disconnect
// swagger:model NetworkDisconnect
type NetworkDisconnect struct {
// The ID or name of the container to disconnect from the network.
Container string `json:"Container,omitempty"`
// Force the container to disconnect from the network.
Force bool `json:"Force,omitempty"`
}
/* polymorph NetworkDisconnect Container false */
/* polymorph NetworkDisconnect Force false */
// Validate validates this network disconnect
func (m *NetworkDisconnect) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// MarshalBinary interface implementation
func (m *NetworkDisconnect) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *NetworkDisconnect) UnmarshalBinary(b []byte) error {
var res NetworkDisconnect
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
|
DazEB2/SimplePyScripts
|
selenium__examples/pub_fsa_gov_ru__rds__declaration.py
|
<reponame>DazEB2/SimplePyScripts<filename>selenium__examples/pub_fsa_gov_ru__rds__declaration.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install selenium
from selenium import webdriver
driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver.get('https://pub.fsa.gov.ru/rds/declaration')
content = driver.find_element_by_css_selector('input[_ngcontent-c27]')
content.send_keys('<KEY>U Д-TR.РА01.А.44855/19')
|
zhaogaolong/study_go
|
day13/example/beego_example/controller/controller.go
|
<reponame>zhaogaolong/study_go<filename>day13/example/beego_example/controller/controller.go
package controller
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
)
type IndexController struct {
beego.Controller
}
func (p *IndexController) Index() {
logs.Debug("index get ....")
// json result
data := make(map[string]interface{})
data["code"] = 200
data["message"] = "success"
p.Data["json"] = &data
p.ServeJSON(true)
}
|
NightScap3/CoseClient
|
src/net/minecraft/util/Vec4b.java
|
<gh_stars>1-10
package net.minecraft.util;
public class Vec4b
{
private byte field_176117_a;
private byte field_176115_b;
private byte field_176116_c;
private byte field_176114_d;
private static final String __OBFID = "CL_00001964";
public Vec4b(byte p_i45555_1_, byte p_i45555_2_, byte p_i45555_3_, byte p_i45555_4_)
{
this.field_176117_a = p_i45555_1_;
this.field_176115_b = p_i45555_2_;
this.field_176116_c = p_i45555_3_;
this.field_176114_d = p_i45555_4_;
}
public Vec4b(Vec4b p_i45556_1_)
{
this.field_176117_a = p_i45556_1_.field_176117_a;
this.field_176115_b = p_i45556_1_.field_176115_b;
this.field_176116_c = p_i45556_1_.field_176116_c;
this.field_176114_d = p_i45556_1_.field_176114_d;
}
public byte func_176110_a()
{
return this.field_176117_a;
}
public byte func_176112_b()
{
return this.field_176115_b;
}
public byte func_176113_c()
{
return this.field_176116_c;
}
public byte func_176111_d()
{
return this.field_176114_d;
}
public boolean equals(Object p_equals_1_)
{
if (this == p_equals_1_)
{
return true;
}
else if (!(p_equals_1_ instanceof Vec4b))
{
return false;
}
else
{
Vec4b var2 = (Vec4b)p_equals_1_;
return this.field_176117_a != var2.field_176117_a ? false : (this.field_176114_d != var2.field_176114_d ? false : (this.field_176115_b != var2.field_176115_b ? false : this.field_176116_c == var2.field_176116_c));
}
}
public int hashCode()
{
byte var1 = this.field_176117_a;
int var2 = 31 * var1 + this.field_176115_b;
var2 = 31 * var2 + this.field_176116_c;
var2 = 31 * var2 + this.field_176114_d;
return var2;
}
}
|
binary-star-near/near-wallet
|
packages/frontend/src/utils/getWalletURL.js
|
<reponame>binary-star-near/near-wallet
import { IS_MAINNET, SHOW_PRERELEASE_WARNING } from '../config';
export default (https = true) => {
let networkName = '';
if (SHOW_PRERELEASE_WARNING) {
networkName = 'staging.';
} else if (!IS_MAINNET) {
networkName = 'testnet.';
}
return `${https ? 'https://' : ''}wallet.${networkName}near.org`;
};
|
zjtest2002/ehousechina
|
TSD/ESS/Apollo/apollo-example-01/src/test/java/com/eju/ess/test/MyTest.java
|
<filename>TSD/ESS/Apollo/apollo-example-01/src/test/java/com/eju/ess/test/MyTest.java<gh_stars>10-100
package com.eju.ess.test;
public class MyTest {
@Test
public void test(){
}
}
|
alicance/MyScse-Client
|
androidclass/src/main/java/com/same/androidclass/presenter/CourseRemindPresenter.java
|
package com.same.androidclass.presenter;
import android.content.Context;
import com.same.androidclass.view.view.CourseRemindView;
/**
* 提醒Presenter
* Created by alic on 16-5-19.
*/
public class CourseRemindPresenter {
private Context context;
private CourseRemindView courseRemindView;
public CourseRemindPresenter(Context context, CourseRemindView courseRemindView) {
this.context = context;
this.courseRemindView = courseRemindView;
}
public void doRemindOn(){
courseRemindView.remindOn();
}
public void doRemindOff(){
courseRemindView.remindOff();
}
}
|
teixeirab/cs2500--Object-Oriented-Design--NU--2015
|
HW-6/src/ReplacementPolicy.java
|
/**
* A replacement policy for managing a cache. This class keeps track of
* items in a cache, and when the client requires an item, it notifies the
* cache via the {@code require} method. The policy then tells the client
* what item to evict, if any.
*
* <p>Items are compared using {@link Object#equals(Object)}.
*
* @param <K> keys for cached items
*/
public interface ReplacementPolicy<K> {
/**
* Informs the policy manager that a particular item is required and must be
* brought into the cache if not already there. Returns the evicted item if
* eviction is required to make room, or {@code null} otherwise.
*
* <p>Must run in <em>O</em>({@code capacity()}) time.
*
* @param item the required item (non-null)
* @return the evicted item or {@code null}
*/
public abstract K require(K item);
/**
* Returns the capacity of the cache.
*
* @return the capacity
*/
public abstract int capacity();
/**
* Returns the number of items currently in the cache. Note that
* it should always be the case that {@code size() ≤ capacity()}.
*
* @return number of items currently cached
*/
public abstract int size();
}
|
execomrt/newton-dynamics
|
newton-3.14/applications/modelEditor/standardPlugins/dPluginCommons/dPluginRender.h
|
<reponame>execomrt/newton-dynamics<filename>newton-3.14/applications/modelEditor/standardPlugins/dPluginCommons/dPluginRender.h
/////////////////////////////////////////////////////////////////////////////
// Name: dSceneNodeInfo.h
// Purpose:
// Author: <NAME>
// Modified by:
// Created: 22/05/2010 08:02:08
// RCS-ID:
// Copyright: Copyright (c) <2010> <Newton Game Dynamics>
// License:
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely
/////////////////////////////////////////////////////////////////////////////
#ifndef _D_PLUGIN_RENDER_H_
#define _D_PLUGIN_RENDER_H_
#include "dPluginUtils.h"
class dPluginRender: public dSceneRender
{
public:
dPluginRender(void);
virtual ~dPluginRender(void);
virtual bool Init();
virtual int GetViewPortWidth() const;
virtual int GetViewPortHeight() const;
virtual dMatrix GetProjectionMatrix () const;
virtual dMatrix GetModelViewMatrix() const;
virtual void SetModelViewMatrix(const dMatrix& modelview);
virtual void SetProjectionMatrix (const dMatrix& projection);
virtual void SetOrtographicProjection (int width, int height, dFloat minPlane, dFloat maxPlane);
virtual void SetPerspectiveProjection (int width, int height, dFloat fov, dFloat frontPlane, dFloat backPlane);
virtual void Print (int displayListFont, dFloat x, dFloat y, const char* const fmt, ... );
virtual void LoadMatrix(const dMatrix& matrix);
virtual void PushMatrix(const dMatrix& matrix);
virtual void PopMatrix();
virtual void BeginRender();
virtual void EndRender();
virtual int CreateDisplayList(int range = 1);
virtual void DestroyDisplayList(int lists, int range = 1);
virtual void BeginDisplayList(int displayList);
virtual void EndDisplayList();
virtual void DrawDisplayList(int displayList);
virtual int GetCachedWireframeDisplayList(NewtonMesh* const mesh);
virtual int GetCachedFlatShadedDisplayList(NewtonMesh* const mesh);
virtual void InvalidateCachedDisplayList(const NewtonMesh* const mesh);
// material interface
virtual void EnableZbuffer();
virtual void DisableZbuffer();
virtual void EnableBackFace();
virtual void DisableBackFace();
virtual void EnableBlend();
virtual void DisableBlend();
virtual void EnableLighting();
virtual void DisableLighting();
virtual void EnableTexture();
virtual void DisableTexture();
virtual void EnableZBias(dFloat val);
virtual void DisableZBias();
virtual const dVector& GetColor() const;
virtual void SetColor(const dVector& color);
virtual void SetMaterialDiffuse(const dVector& color);
virtual void SetMaterialAmbient(const dVector& color);
virtual void SetMaterialSpecular(const dVector& color);
virtual void SetMaterialShininess(dFloat normalizedPower);
// primitive drawing functions
virtual void BeginLine();
virtual void BeginTriangle();
virtual void SubmitNormal(const dVector& normal);
virtual void SubmitVertex(const dVector& posit);
virtual void End();
private:
void CleanupDisplayListCache(dTree<int, const NewtonMesh*>& cache);
dTree<int, const NewtonMesh*> m_wireFrameDisplayList;
dTree<int, const NewtonMesh*> m_flatShadedDisplayList;
dVector m_color;
};
#endif
|
zhangkn/iOS14Header
|
System/Library/PrivateFrameworks/AppStoreKit.framework/AppStoreKit.UpdatesPresenter.h
|
<filename>System/Library/PrivateFrameworks/AppStoreKit.framework/AppStoreKit.UpdatesPresenter.h
/*
* This header is generated by classdump-dyld 1.0
* on Monday, September 28, 2020 at 5:58:22 PM Mountain Standard Time
* Operating System: Version 14.0 (Build 18A373)
* Image Source: /System/Library/PrivateFrameworks/AppStoreKit.framework/AppStoreKit
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>.
*/
@interface AppStoreKit.UpdatesPresenter : _UKNOWN_SUPERCLASS_ {
view;
updateStore;
automaticUpdates;
appStateController;
isAppleSiliconSupportEnabled;
hasLoaded;
canUpdateBadgeCounts;
isUpdateAllEnabled;
pendingUpdates;
recentUpdates;
haveDoneInitialUpdatesFetch;
sections;
expandedUpdates;
appStateControllerReady;
organizationQueue;
transitionQueue;
currentTransitionContext;
numberFormatter;
includeUpdateAllInPendingUpdates;
externalPendingUpdatesSectionIndex;
externalRecentlyUpdatedSectionIndex;
}
-(void)updateStoreDidChange;
@end
|
A-suozhang/aw_nas
|
aw_nas/plugin.py
|
# pylint: disable=invalid-name
import os
import re
import sys
import imp
import inspect
from collections import defaultdict
from aw_nas.utils.exception import PluginException
from aw_nas.utils.common_utils import get_awnas_dir
from aw_nas.utils import logger as _logger
LOGGER = _logger.getChild("plugin")
plugins = []
plugin_modules = defaultdict(list)
import_errors = {}
norm_pattern = re.compile(r"[/|.]")
class AwnasPlugin(object):
NAME = None
dataset_list = []
controller_list = []
evaluator_list = []
weights_manager_list = []
objective_list = []
trainer_list = []
@classmethod
def validate(cls):
if not cls.NAME:
raise PluginException("Your plugin needs a name.")
def is_valid_plugin(plugin_obj, existing_plugins):
if inspect.isclass(plugin_obj) and issubclass(plugin_obj, AwnasPlugin) and \
plugin_obj is not AwnasPlugin:
plugin_obj.validate()
return plugin_obj not in existing_plugins
return False
def make_module(name, objects):
#pylint: disable=protected-access
LOGGER.debug('Creating module %s', name)
name = name.lower()
module = imp.new_module(name)
module._PLUGIN_NAME = name.split('.')[-1]
module._objects = objects
module.__dict__.update((o.__name__, o) for o in objects)
return module
def _reload_plugins():
del plugins[:]
plugin_modules.clear()
plugin_dir = get_awnas_dir("AWNAS_PLUGIN_DIR", "plugins")
LOGGER.info("Check plugins under %s", plugin_dir)
# load plugins under directory (code from airflow)
for root, _, files in os.walk(plugin_dir, followlinks=True):
for f in sorted(files):
try:
filepath = os.path.join(root, f)
if not os.path.isfile(filepath):
continue
mod_name, file_ext = os.path.splitext(
os.path.split(filepath)[-1])
if file_ext != ".py" or mod_name.startswith("test_"):
continue
LOGGER.debug("Importing plugin module %s", filepath)
# normalize root path as namespace
namespace = "_".join([re.sub(norm_pattern, "__", root), mod_name])
m = imp.load_source(namespace, filepath)
for obj in list(m.__dict__.values()):
if is_valid_plugin(obj, plugins):
plugins.append(obj)
export_plugin(obj)
except Exception as e: #pylint: disable=broad-except
LOGGER.exception(e)
LOGGER.error("Failed to import plugin %s: %s", filepath, e)
import_errors[filepath] = str(e)
LOGGER.info("Loaded plugins: %s", ", ".join([p.NAME for p in plugins]))
def export_plugin(plugin):
# for easy access: pop the components of each plugins under corresponding `
# `aw_nas.<component name>.<plugin name>` module.
# you can also diretly using RegistryMeta to access all components
for compo_name in ["dataset", "controller",
"evaluator", "weights_manager", "objective", "trainer"]:
base_mod = sys.modules["aw_nas." + compo_name]
exported_compos = getattr(plugin, compo_name + "_list")
if exported_compos:
mod = make_module("aw_nas.{}.{}".format(compo_name, plugin.NAME), exported_compos)
plugin_modules[compo_name].append(mod)
sys.modules[mod.__name__] = mod
setattr(base_mod, mod._PLUGIN_NAME, mod) #pylint: disable=protected-access
return plugin_modules
|
milanqiu/mimas
|
mimas-jdk-ext/src/main/java/net/milanqiu/mimas/collect/ArrayUtils.java
|
<reponame>milanqiu/mimas<gh_stars>0
package net.milanqiu.mimas.collect;
import java.util.Arrays;
/**
* Utilities related to array.
* <p>
* Creation Date: 2014-07-25
* @author <NAME>
*/
public class ArrayUtils {
/**
* Utility class is forbidden to be instantiated.
*/
private ArrayUtils() {}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(char[] array, char value) {
for (char element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(byte[] array, byte value) {
for (byte element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(short[] array, short value) {
for (short element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(int[] array, int value) {
for (int element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(long[] array, long value) {
for (long element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(float[] array, float value) {
for (float element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* @param array the array to be tested
* @param value the value to be tested
* @return {@code true} if the specified array contains the specified value
*/
public static boolean contains(double[] array, double value) {
for (double element : array) {
if (element == value)
return true;
}
return false;
}
/**
* Returns whether the specified array contains the specified value.
* More formally, returns {@code true} if and only if the specified array contains at least one element such that
* <code>(value == null ? element == null : value.equals(element))</code>.
* @param array the array to be tested
* @param value the value to be tested
* @param <T> the class of the objects in the array
* @return {@code true} if the specified array contains the specified value
*/
public static <T> boolean contains(T[] array, Object value) {
for (T element : array) {
if (value == null ? element == null : value.equals(element))
return true;
}
return false;
}
/**
* Creates and returns a character array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static char[] duplicate(char value, int count) {
char[] result = new char[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns a byte array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static byte[] duplicate(byte value, int count) {
byte[] result = new byte[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns a short array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static short[] duplicate(short value, int count) {
short[] result = new short[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns an integer array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static int[] duplicate(int value, int count) {
int[] result = new int[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns a long array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static long[] duplicate(long value, int count) {
long[] result = new long[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns a float array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static float[] duplicate(float value, int count) {
float[] result = new float[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns a double array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static double[] duplicate(double value, int count) {
double[] result = new double[count];
Arrays.fill(result, value);
return result;
}
/**
* Creates and returns an object array with the specified length and all elements equal to the specified value.
* @param value the value to be duplicated, which will be assigned to every element of result array
* @param count the count of duplication, which is the length of result array
* @return the result array
*/
public static Object[] duplicate(Object value, int count) {
Object[] result = new Object[count];
Arrays.fill(result, value);
return result;
}
/**
* Returns whether the specified array is null or empty.
* @param array the array to be tested
* @param <T> the class of the objects in the array
* @return {@code true} if the specified array is null or empty
*/
public static <T> boolean isNullOrEmpty(T[] array) {
return array == null || array.length == 0;
}
}
|
maelvls/ocamlyices2
|
ext/yices/src/parser_utils/lexer.c
|
/*
* The Yices SMT Solver. Copyright 2014 SRI International.
*
* This program may only be used subject to the noncommercial end user
* license agreement which is downloadable along with this program.
*/
/*
* Generic lexer operations.
*
* The same data structure is used for both SMTLIB and the Yices language.
* To support nested (include "file"), lexers can be organized into a stack
* (implemented as a list of lexer_t objects).
*/
#include <assert.h>
#include "parser_utils/lexer.h"
#include "utils/memalloc.h"
/*
* Allocate and initialize buffer
* set default values for token, tk_pos etc.
*/
static void init_lexer(lexer_t *lex) {
lex->token = -1;
lex->tk_pos = 0;
lex->tk_line = 0;
lex->tk_column = 0;
lex->next = NULL;
lex->buffer = (string_buffer_t *) safe_malloc(sizeof(string_buffer_t));
init_string_buffer(lex->buffer, 128);
}
/*
* Initialize a lexer for the given filename
*
* Return -1 if the file can't be opened, 0 otherwise.
* (lex cannot be used if the result is -1)
*
* If result = 0,
* - string buffer is allocated,
* - the reader is initialized
* - token is set to -1
*/
int32_t init_file_lexer(lexer_t *lex, const char *filename) {
int32_t code;
code = init_file_reader(&lex->reader, filename);
if (code >= 0) {
init_lexer(lex);
}
return code;
}
/*
* Same thing, starting from an already open stream f
*/
void init_stream_lexer(lexer_t *lex, FILE *f, const char *name) {
init_stream_reader(&lex->reader, f, name);
init_lexer(lex);
}
#if 0
/*
* HACK/EXPERIMENT: use UTF-8 encoded input
*/
int32_t init_wide_file_lexer(lexer_t *lex, const char *filename) {
int32_t code;
code = init_wide_file_reader(&lex->reader, filename);
if (code >= 0) {
init_lexer(lex);
}
return code;
}
void init_wide_stream_lexer(lexer_t *lex, FILE *f, const char *name) {
init_wide_stream_reader(&lex->reader, f, name);
init_lexer(lex);
}
#endif
/*
* Initialize lexer for a string data
*/
void init_string_lexer(lexer_t *lex, const char *data, const char *name) {
init_string_reader(&lex->reader, data, name);
init_lexer(lex);
}
/*
* Change the input string for lex to data
*/
void reset_string_lexer(lexer_t *lex, const char *data) {
reset_string_reader(&lex->reader, data);
// reset token and location
lex->token = -1;
lex->tk_pos = 0;
lex->tk_line = 0;
lex->tk_column = 0;
string_buffer_reset(lex->buffer);
}
/*
* Nested lexer: get buffer from parent
* the reader is initialized for filename.
* TODO: report an error if there's a circular nesting
* (i.e., same file is already open in an enclosing lexer)
*/
int32_t init_nested_lexer(lexer_t *lex, const char *filename, lexer_t *parent) {
int32_t code;
lex->token = -1;
lex->tk_pos = 0;
lex->tk_line = 0;
lex->tk_column = 0;
code = init_file_reader(&lex->reader, filename);
if (code < 0) {
lex->buffer = NULL;
lex->next = NULL;
return code;
}
string_buffer_reset(parent->buffer);
lex->buffer = parent->buffer;
lex->next = parent;
return code;
}
/*
* Nested lexer using a string data
*/
void init_nested_string_lexer(lexer_t *lex, const char *data, const char *name, lexer_t *parent) {
lex->token = -1;
lex->tk_pos = 0;
lex->tk_line = 0;
lex->tk_column = 0;
init_string_reader(&lex->reader, data, name);
lex->buffer = parent->buffer;
lex->next = parent;
}
/*
* Close lexer. If lex has no parent, delete the allocated
* string buffer.
*/
int close_lexer(lexer_t *lex) {
int code;
code = close_reader(&lex->reader);
if (lex->next == NULL) {
if (lex->buffer != NULL) {
delete_string_buffer(lex->buffer);
safe_free(lex->buffer);
}
}
return code;
}
/*
* Variant: close lex but not the file/stream attached if any.
* - this allows us to attach a lexer to stdin, then close it
* without closing stdin.
* - if lex->next is NULL (toplevel lexer), delete the internal buffer
*/
void close_lexer_only(lexer_t *lex) {
if (lex->next == NULL) {
if (lex->buffer != NULL) {
delete_string_buffer(lex->buffer);
safe_free(lex->buffer);
}
}
}
/*
* Flush: read until the end of the line or EOF
*/
void flush_lexer(lexer_t *lex) {
int c;
c = reader_current_char(&lex->reader);
while (c != '\n' && c != EOF) {
c = reader_next_char(&lex->reader);
}
lex->token = -1;
string_buffer_reset(lex->buffer);
}
|
joseagrc/docker-gitlab
|
files/gitlab-cookbooks/package/resources/env_dir.rb
|
<reponame>joseagrc/docker-gitlab<filename>files/gitlab-cookbooks/package/resources/env_dir.rb
#
# Copyright:: Copyright (c) 2016 GitLab Inc
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
resource_name :env_dir
provides :env_dir
actions :create
default_action :create
property :variables, Hash, default: {}
action :create do
# Cleaning up non-existent variables
if ::File.directory?(new_resource.name)
existing_files = Dir.entries(new_resource.name).select { |f| ::File.file?(::File.join(new_resource.name, f)) }
deleted_env_vars = existing_files - new_resource.variables.keys - %w(. ..)
deleted_env_vars.each do |deleted_var|
file ::File.join(new_resource.name, deleted_var) do
sensitive true
action :delete
end
end
end
directory new_resource.name do
recursive true
end
new_resource.variables.each do |key, value|
file ::File.join(new_resource.name, key) do
sensitive true
content value.to_s
end
end
end
|
monkeesuit/school
|
Network Security/ARP/arp suite/py/arp_request.py
|
import arp_source as arp
def send(requestedIP):
# Sends an ARP Request to the requestedIP
# requestedIP = The IP Address You Wish to ARP (Resolve MAC Address)
sender = arp.arpclient('eth0') # Create an instance of arpclient found in arp_source.py
sender.request(requestedIP) # Call the request function of arpclient
|
hsiangawang/whois
|
whois-rpsl/src/main/java/net/ripe/db/whois/common/rpsl/attrs/OrgType.java
|
<reponame>hsiangawang/whois
package net.ripe.db.whois.common.rpsl.attrs;
import com.google.common.collect.Maps;
import net.ripe.db.whois.common.domain.CIString;
import javax.annotation.Nullable;
import java.util.Map;
import static net.ripe.db.whois.common.domain.CIString.ciString;
public enum OrgType {
IANA("for Internet Assigned Numbers Authority"),
RIR("for Regional Internet Registries"),
NIR("for National Internet Registries (there are no NIRs in the RIPE NCC service region)"),
LIR("for Local Internet Registries"),
WHITEPAGES("for special links to industry people"),
DIRECT_ASSIGNMENT("for direct contract with RIPE NCC"),
OTHER("for all other organisations.");
private static final Map<CIString, OrgType> ORG_TYPE_MAP;
private final String info;
private final CIString name;
private OrgType(final String info) {
this.info = info;
this.name = CIString.ciString(this.name());
}
public String getInfo() {
return info;
}
static {
ORG_TYPE_MAP = Maps.newHashMap();
for (final OrgType orgType : OrgType.values()) {
ORG_TYPE_MAP.put(ciString(orgType.name()), orgType);
}
}
public CIString getName() {
return name;
}
@Nullable
public static OrgType getFor(final String value) {
return getFor(ciString(value));
}
@Nullable
public static OrgType getFor(final CIString value) {
return ORG_TYPE_MAP.get(value);
}
}
|
wilebeast/FireFox-OS
|
B2G/gecko/toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const source = "about:mozilla";
let mWindow, wrapMenuItem, syntaxMenuItem;
// Check the default values are set.
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
SpecialPowers.clearUserPref("view_source.tab_size");
SpecialPowers.clearUserPref("view_source.wrap_long_lines");
SpecialPowers.clearUserPref("view_source.syntax_highlight");
});
openViewSourceWindow(source, function(aWindow) {
mWindow = aWindow;
wrapMenuItem = aWindow.document.getElementById('menu_wrapLongLines');
syntaxMenuItem = aWindow.document.getElementById('menu_highlightSyntax');
// Strip checked="false" attributes, since we're not interested in them.
if (wrapMenuItem.getAttribute("checked") == "false")
wrapMenuItem.removeAttribute("checked");
if (syntaxMenuItem.getAttribute("checked") == "false")
syntaxMenuItem.removeAttribute("checked");
is(wrapMenuItem.hasAttribute("checked"), false, "Wrap menu item not checked by default");
is(syntaxMenuItem.hasAttribute("checked"), true, "Syntax menu item checked by default");
checkStyle(aWindow, "-moz-tab-size", 4);
checkStyle(aWindow, "white-space", "pre");
test1();
});
}
// Check that the Wrap Long Lines menu item works.
function test1() {
simulateClick(wrapMenuItem);
is(wrapMenuItem.hasAttribute("checked"), true, "Wrap menu item checked");
is(SpecialPowers.getBoolPref("view_source.wrap_long_lines"), true, "Wrap pref set");
checkStyle(mWindow, "white-space", "pre-wrap");
test2();
}
function test2() {
simulateClick(wrapMenuItem);
is(wrapMenuItem.hasAttribute("checked"), false, "Wrap menu item unchecked");
is(SpecialPowers.getBoolPref("view_source.wrap_long_lines"), false, "Wrap pref set");
checkStyle(mWindow, "white-space", "pre");
test3();
}
// Check that the Syntax Highlighting menu item works.
function test3() {
mWindow.gBrowser.addEventListener("pageshow", function test3Handler() {
mWindow.gBrowser.removeEventListener("pageshow", test3Handler, false);
is(syntaxMenuItem.hasAttribute("checked"), false, "Syntax menu item unchecked");
is(SpecialPowers.getBoolPref("view_source.syntax_highlight"), false, "Syntax highlighting pref set");
checkHighlight(mWindow, false);
test4();
}, false);
simulateClick(syntaxMenuItem);
}
function test4() {
mWindow.gBrowser.addEventListener("pageshow", function test4Handler() {
mWindow.gBrowser.removeEventListener("pageshow", test4Handler, false);
is(syntaxMenuItem.hasAttribute("checked"), true, "Syntax menu item checked");
is(SpecialPowers.getBoolPref("view_source.syntax_highlight"), true, "Syntax highlighting pref set");
checkHighlight(mWindow, true);
closeViewSourceWindow(mWindow, test5);
}, false);
simulateClick(syntaxMenuItem);
}
// Open a new view-source window to check prefs are obeyed.
function test5() {
SpecialPowers.setIntPref("view_source.tab_size", 2);
SpecialPowers.setBoolPref("view_source.wrap_long_lines", true);
SpecialPowers.setBoolPref("view_source.syntax_highlight", false);
executeSoon(function() {
openViewSourceWindow(source, function(aWindow) {
wrapMenuItem = aWindow.document.getElementById('menu_wrapLongLines');
syntaxMenuItem = aWindow.document.getElementById('menu_highlightSyntax');
// Strip checked="false" attributes, since we're not interested in them.
if (wrapMenuItem.getAttribute("checked") == "false")
wrapMenuItem.removeAttribute("checked");
if (syntaxMenuItem.getAttribute("checked") == "false")
syntaxMenuItem.removeAttribute("checked");
is(wrapMenuItem.hasAttribute("checked"), true, "Wrap menu item checked");
is(syntaxMenuItem.hasAttribute("checked"), false, "Syntax menu item unchecked");
checkStyle(aWindow, "-moz-tab-size", 2);
checkStyle(aWindow, "white-space", "pre-wrap");
checkHighlight(aWindow, false);
closeViewSourceWindow(aWindow, finish);
});
});
}
// Simulate a menu item click, including toggling the checked state.
// This saves us from opening the menu and trying to click on the item,
// which doesn't work on Mac OS X.
function simulateClick(aMenuItem) {
if (aMenuItem.hasAttribute("checked"))
aMenuItem.removeAttribute("checked");
else
aMenuItem.setAttribute("checked", "true");
aMenuItem.click();
}
function checkStyle(aWindow, aStyleProperty, aExpectedValue) {
let gBrowser = aWindow.gBrowser;
let computedStyle = gBrowser.contentWindow.getComputedStyle(gBrowser.contentDocument.body, null);
is(computedStyle.getPropertyValue(aStyleProperty), aExpectedValue, "Correct value of " + aStyleProperty);
}
function checkHighlight(aWindow, aExpected) {
let spans = aWindow.gBrowser.contentDocument.getElementsByTagName("span");
is(Array.some(spans, function(aSpan) {
return aSpan.className != "";
}), aExpected, "Syntax highlighting " + (aExpected ? "on" : "off"));
}
|
fermi-lat/TkrRecon
|
src/PatRec/LinkAndTree/TkrLinkForest.h
|
/*
This class defines the forest part of the "link and tree" pattern
recognition algorithm.
<NAME> Dec 1, 2000
*/
#ifndef __TKRLINKFOREST_H
#define __TKRLINKFOREST_H
#include <list>
//#include <vector>
#include "src/PatRec/LinkAndTree/TkrLinkTree.h"
typedef std::list<TkrLinkTree> treeList;
typedef std::list<TkrLinkTree>::iterator treeListPtr;
//typedef std::vector<TkrLinkTree> treeList;
//typedef std::vector<TkrLinkTree>::iterator treeListPtr;
class TkrLinkForest
{
treeList linkTreeList;
void deleteTrees(treeListPtr pTree);
void deleteNodes(LayerLinkNode* pCurNode);
public:
TkrLinkForest();
TkrLinkForest(TkrClusterLinkList* pLinksList);
~TkrLinkForest();
//How many trees in our forest
int getNumTrees() {return linkTreeList.size();}
//Return the start of the list of trees
treeListPtr getListStart() {return linkTreeList.begin();}
treeListPtr getListEnd() {return linkTreeList.end();}
treeList* getTreePtr() {return &linkTreeList;}
//This will be useful for sorting a list of trees
// friend bool operator()(const SiLinkTree &lhs, const SiLinkTree &rhs);
friend bool operator<(TkrLinkTree& lhs, TkrLinkTree& rhs);
// friend bool operator>(const SiLinkTree* lhs, const SiLinkTree* rhs);
// friend bool operator==(SiLinkTree& lhs, SiLinkTree& rhs);
};
#endif
|
mangochain2020/mangowallet-ios
|
MgpWallet/MGPToken/账户钱包/LHWalletManager/Model/TokenModel.h
|
//
// TokenModel.h
// realmDemo
//
// Created by mac on 2020/9/24.
// Copyright © 2020 mac. All rights reserved.
//
#import "RLMObject.h"
NS_ASSUME_NONNULL_BEGIN
@interface TokenModel : RLMObject
@property NSString *ID;
@property NSString *identifier;
@property NSString *name;
@property NSString *iconUrl;
@property NSString *contractAddress;
@property int decimals;
@property NSString *symbol;
@property double price;
@property double balance;
@property int tokenCoinType;
@end
RLM_ARRAY_TYPE(TokenModel)
NS_ASSUME_NONNULL_END
|
zhouqiangWang/forbes-code
|
src/main/java/WordBreak.java
|
<filename>src/main/java/WordBreak.java
import java.util.*;
public class WordBreak {
public List<String> wordBreak(String s, List<String> wordDict) {
Set<String> set = new HashSet<>();
int len = 0;
for (String word : wordDict) {
set.add(word);
len = Math.max(len, word.length());
}
List<String> res = new ArrayList<>();
dfs(s, set, res, "", len);
return res;
}
void dfs(String s, Set<String> wordDict, List<String> res, String cur, int len) {
if (s.isEmpty()) {
res.add(cur);
return;
}
int size = Math.min(len, s.length());
for (int i = 1; i <= size; i++) {
String pre = s.substring(0, i);
if (wordDict.contains(pre)) {
String newString = pre;
if (!cur.isEmpty()) {
newString = cur + " " + pre;
}
dfs(s.substring(i), wordDict, res, newString, len);
}
}
}
public static void main(String[] args) {
WordBreak ins = new WordBreak();
String s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
String[] dic = {"a","aa","aaa","aaaa","aaaaa","aaaaaa","aaaaaaa","aaaaaaaa","aaaaaaaaa","aaaaaaaaaa"};
ins.wordBreak(s, Arrays.asList(dic));
}
}
|
moldovanpaul75/city-building-education
|
iteration3/iteration2_client/src/main/java/View/BugReportWindow.java
|
<reponame>moldovanpaul75/city-building-education
package View;
import Controller.BugReportListener;
import javax.swing.*;
import java.awt.*;
public class BugReportWindow extends JFrame{
private MainFrame parentFrame;
private JTextField bugNameTextField;
private JTextField bugTypeTextField;
private JTextField clientEmailTextField;
private JTextArea bugDescriptionTextArea;
public BugReportWindow(MainFrame mainFrame){
this.parentFrame = mainFrame;
this.setTitle("BugReport");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setMinimumSize(new Dimension(500, 500));
JPanel jPanel = new JPanel();
jPanel.setLayout(new SpringLayout());
JButton reportButton = new JButton("Submit bug");
JLabel bugName = new JLabel("Bug name:");
JLabel bugType = new JLabel("Bug type:");
JLabel bugDesc = new JLabel("Bug description:");
JLabel clientEmail = new JLabel("Client email:");
this.bugNameTextField = new JTextField(10);
this.bugTypeTextField = new JTextField(10);
this.clientEmailTextField = new JTextField(10);
this.bugDescriptionTextArea = new JTextArea(5, 10);
JScrollPane bugDescScrollPane = new JScrollPane(bugDescriptionTextArea);
jPanel.add(bugName);
bugName.setLabelFor(bugNameTextField);
jPanel.add(bugNameTextField);
jPanel.add(bugType);
bugType.setLabelFor(bugTypeTextField);
jPanel.add(bugTypeTextField);
jPanel.add(bugDesc);
bugDesc.setLabelFor(bugDescScrollPane);
jPanel.add(bugDescScrollPane);
jPanel.add(clientEmail);
clientEmail.setLabelFor(clientEmailTextField);
jPanel.add(clientEmailTextField);
reportButton.addActionListener(new BugReportListener(this));
jPanel.add(reportButton);
SpringUtilities.makeCompactGrid(jPanel, 4, 2, 6, 6, 6, 6);
this.setContentPane(jPanel);
this.pack();
this.setVisible(true);
}
public MainFrame getParentFrame(){
return this.parentFrame;
}
public String getBugName(){
return this.bugNameTextField.getText();
}
public String getBugType(){
return this.bugTypeTextField.getText();
}
public String getBugDescription(){
return this.bugDescriptionTextArea.getText();
}
public String getClientEmail(){
return this.clientEmailTextField.getText();
}
}
|
glaand/outline
|
app/embeds/GoogleSlides.test.js
|
<filename>app/embeds/GoogleSlides.test.js
/* eslint-disable flowtype/require-valid-file-annotation */
import GoogleSlides from "./GoogleSlides";
describe("GoogleSlides", () => {
const match = GoogleSlides.ENABLED[0];
test("to be enabled on share link", () => {
expect(
"https://docs.google.com/presentation/d/e/2PACX-1vTdddHPoZ5M_47wmSHCoigRIt2cj_Pd-kgtaNQY6H0Jzn0_CVGbxC1GcK5IoNzU615lzguexFwxasAW/pub?start=false&loop=false&delayms=3000".match(
match
)
).toBeTruthy();
expect(
"https://docs.google.com/presentation/d/e/2PACX-1vTdddHPoZ5M_47wmSHCoigRIt2cj_Pd-kgtaNQY6H0Jzn0_CVGbxC1GcK5IoNzU615lzguexFwxasAW/pub".match(
match
)
).toBeTruthy();
expect(
"https://docs.google.com/presentation/d/e/2PACX-1vTdddHPoZ5M_47wmSHCoigR/edit".match(
match
)
).toBeTruthy();
});
test("to not be enabled elsewhere", () => {
expect("https://docs.google.com/presentation".match(match)).toBe(null);
expect("https://docs.google.com".match(match)).toBe(null);
expect("https://www.google.com".match(match)).toBe(null);
});
});
|
DanSylvest/wanderer-server
|
js/api/eve/map/routes/_dir.js
|
<gh_stars>0
module.exports = {
addHub : require("./addHub"),
removeHub : require("./removeHub"),
list : require("./list"),
hubs : require("./hubs"),
};
|
Yalir/Awl
|
include/Awl/boost/preprocessor/list/filter.hpp
|
<filename>include/Awl/boost/preprocessor/list/filter.hpp
# /* Copyright (C) 2001
# * <NAME>
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by <NAME> (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_LIST_FILTER_HPP
# define BOOST_PREPROCESSOR_LIST_FILTER_HPP
#
# include <Awl/boost/preprocessor/config/config.hpp>
# include <Awl/boost/preprocessor/control/if.hpp>
# include <Awl/boost/preprocessor/list/fold_right.hpp>
# include <Awl/boost/preprocessor/tuple/elem.hpp>
# include <Awl/boost/preprocessor/tuple/rem.hpp>
#
# /* BOOST_PP_LIST_FILTER */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LIST_FILTER(pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
# else
# define BOOST_PP_LIST_FILTER(pred, data, list) BOOST_PP_LIST_FILTER_I(pred, data, list)
# define BOOST_PP_LIST_FILTER_I(pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
# endif
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LIST_FILTER_O(d, pdr, elem) BOOST_PP_LIST_FILTER_O_D(d, BOOST_PP_TUPLE_ELEM(3, 0, pdr), BOOST_PP_TUPLE_ELEM(3, 1, pdr), BOOST_PP_TUPLE_ELEM(3, 2, pdr), elem)
# else
# define BOOST_PP_LIST_FILTER_O(d, pdr, elem) BOOST_PP_LIST_FILTER_O_I(d, BOOST_PP_TUPLE_REM_3 pdr, elem)
# define BOOST_PP_LIST_FILTER_O_I(d, im, elem) BOOST_PP_LIST_FILTER_O_D(d, im, elem)
# endif
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
# define BOOST_PP_LIST_FILTER_O_D(d, pred, data, res, elem) (pred, data, BOOST_PP_IF(pred(d, data, elem), (elem, res), res))
# else
# define BOOST_PP_LIST_FILTER_O_D(d, pred, data, res, elem) (pred, data, BOOST_PP_IF(pred##(d, data, elem), (elem, res), res))
# endif
#
# /* BOOST_PP_LIST_FILTER_D */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LIST_FILTER_D(d, pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
# else
# define BOOST_PP_LIST_FILTER_D(d, pred, data, list) BOOST_PP_LIST_FILTER_D_I(d, pred, data, list)
# define BOOST_PP_LIST_FILTER_D_I(d, pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
# endif
#
# endif
|
gandhinish/omniparser
|
extensions/omniv21/transform/decl_test.go
|
<filename>extensions/omniv21/transform/decl_test.go
package transform
import (
"encoding/json"
"fmt"
"reflect"
"testing"
"github.com/bradleyjkemp/cupaloy"
"github.com/jf-tech/go-corelib/jsons"
"github.com/jf-tech/go-corelib/strs"
"github.com/stretchr/testify/assert"
)
func TestMarshalDecl(t *testing.T) {
var decls []Decl
err := json.Unmarshal([]byte(`[
{
"const": "123",
"type": "int"
},
{
"external": "abc",
"no_trim": true,
"keep_empty_or_null": true,
"type": "string"
},
{
"xpath": "xyz",
"no_trim": true,
"keep_empty_or_null": true
},
{
"xpath_dynamic": { "const": "true", "type": "boolean" },
"template": "t"
},
{
"xpath": "abc",
"object": {
"field1": { "external": "123" }
}
},
{
"array": [
{ "const": "123", "type": "float" }
]
},
{
"custom_func": {
"name": "upper",
"args": [
{ "const": " abc ", "no_trim": true }
],
"ignore_error": true
}
}
]`), &decls)
assert.NoError(t, err)
cupaloy.SnapshotT(t, jsons.BPM(decls))
}
func TestMarshalDeclWithParentAndChildren(t *testing.T) {
var decl Decl
err := json.Unmarshal([]byte(`{
"xpath": "abc",
"object": {
"field1": { "external": "123" }
}
}`), &decl)
assert.NoError(t, err)
decl.fqdn = "root"
decl.kind = kindObject
decl.children = []*Decl{decl.Object["field1"]}
childDecl := decl.Object["field1"]
childDecl.fqdn = "root.field1"
childDecl.kind = kindExternal
childDecl.parent = &decl
cupaloy.SnapshotT(t, jsons.BPM(decl))
}
func TestResolveKind(t *testing.T) {
for _, test := range []struct {
name string
decl *Decl
expectedKind kind
}{
{
name: "const",
decl: &Decl{Const: strs.StrPtr("test")},
expectedKind: kindConst,
},
{
name: "external",
decl: &Decl{External: strs.StrPtr("test")},
expectedKind: kindExternal,
},
{
name: "custom func",
decl: &Decl{CustomFunc: &CustomFuncDecl{Name: "test"}},
expectedKind: kindCustomFunc,
},
{
name: "object with empty map",
decl: &Decl{XPath: strs.StrPtr("test"), Object: map[string]*Decl{}},
expectedKind: kindObject,
},
{
name: "object with non-empty map",
decl: &Decl{
XPathDynamic: &Decl{},
Object: map[string]*Decl{"a": {Const: strs.StrPtr("test")}},
},
expectedKind: kindObject,
},
{
name: "array",
decl: &Decl{
Array: []*Decl{{Const: strs.StrPtr("test")}},
},
expectedKind: kindArray,
},
{
name: "template",
decl: &Decl{XPath: strs.StrPtr("test"), Template: strs.StrPtr("test")},
expectedKind: kindTemplate,
},
{
name: "field with xpath",
decl: &Decl{XPath: strs.StrPtr("test")},
expectedKind: kindField,
},
{
name: "field with xpath_dynamic",
decl: &Decl{XPathDynamic: &Decl{}},
expectedKind: kindField,
},
} {
t.Run(test.name, func(t *testing.T) {
test.decl.resolveKind()
assert.Equal(t, test.expectedKind, test.decl.kind)
})
}
}
func TestIsXPathSet(t *testing.T) {
assert.True(t, (&Decl{XPath: strs.StrPtr("A/B/C")}).isXPathSet())
assert.True(t, (&Decl{XPathDynamic: &Decl{}}).isXPathSet())
assert.False(t, (&Decl{}).isXPathSet())
}
func verifyDeclDeepCopy(t *testing.T, d1, d2 *Decl) {
if d1 == nil && d2 == nil {
return
}
verifyPtrsInDeepCopy := func(p1, p2 interface{}) {
// both are nil, that's fine.
if reflect.ValueOf(p1).IsNil() && reflect.ValueOf(p2).IsNil() {
return
}
// both are not nil, then make sure they point to different memory addresses.
if !reflect.ValueOf(p1).IsNil() && !reflect.ValueOf(p2).IsNil() {
assert.True(t, fmt.Sprintf("%p", p1) != fmt.Sprintf("%p", p2))
return
}
// If one is nil the other isn't, something wrong with the deep copy
assert.FailNow(t, "p1 (%p) != p2 (%p)", p1, p2)
}
verifyPtrsInDeepCopy(d1, d2)
// content is the same
d1json := jsons.BPM(d1)
d2json := jsons.BPM(d2)
assert.Equal(t, d1json, d2json)
// Just doing verifyPtrsInDeepCopy on d1/d2 isn't enough, because it's possible
// that d1 and d2 are two different copies of a Decl, but inside, corresponding ptrs
// from d1/d2 are pointing to some same memory address. We need to this manually for
// all ptr elements, recursively.
verifyPtrsInDeepCopy(d1.Const, d2.Const)
verifyPtrsInDeepCopy(d1.External, d2.External)
verifyPtrsInDeepCopy(d1.XPath, d2.XPath)
verifyDeclDeepCopy(t, d1.XPathDynamic, d2.XPathDynamic)
verifyPtrsInDeepCopy(d1.CustomFunc, d2.CustomFunc)
if d1.CustomFunc != nil {
for i := range d1.CustomFunc.Args {
verifyDeclDeepCopy(t, d1.CustomFunc.Args[i], d2.CustomFunc.Args[i])
}
}
verifyPtrsInDeepCopy(d1.CustomParse, d2.CustomParse)
verifyPtrsInDeepCopy(d1.Template, d2.Template)
verifyPtrsInDeepCopy(d1.Object, d2.Object)
for name := range d1.Object {
verifyDeclDeepCopy(t, d1.Object[name], d2.Object[name])
}
verifyPtrsInDeepCopy(d1.Array, d2.Array)
for i := range d1.Array {
verifyDeclDeepCopy(t, d1.Array[i], d2.Array[i])
}
verifyPtrsInDeepCopy(d1.ResultType, d2.ResultType)
}
func TestDeclDeepCopy(t *testing.T) {
declJson := `{ "xpath": "value0", "object": {
"field1": { "const": "value1", "type": "boolean" },
"field2": { "external": "value2" },
"field3": { "xpath": "value3" },
"field4": { "xpath_dynamic": { "const": "value4" } },
"field5": { "custom_func": {
"name": "func5",
"args": [
{ "const": "arg51" },
{ "external": "arg52" },
{ "xpath": "arg53" },
{ "xpath_dynamic": { "const": "arg54" } },
{ "custom_func": { "name": "arg55", "args": [] } },
{ "template": "arg56" }
]
}},
"field6": { "template": "value6", "type": "int" },
"field7": { "xpath_dynamic": { "const": "value7" }, "object": {
"field71": { "const": "value71" },
"field72": { "keep_empty_or_null": true, "object": {
"field721": { "const": "value721", "type": "float" }
}}
}},
"field8": { "array": [
{ "const": "field81", "type": "string", "no_trim": true },
{ "template": "field82" },
{ "object": {
"field831": { "const": "value831" }
}}
]},
"field9": { "xpath": "value9", "custom_parse": "cp9" }
}}`
var src Decl
assert.NoError(t, json.Unmarshal([]byte(declJson), &src))
dst := src.deepCopy()
verifyDeclDeepCopy(t, &src, dst)
}
|
mertguner/XChange
|
xchange-kucoin/src/main/java/org/knowm/xchange/kucoin/service/KucoinTradeService.java
|
package org.knowm.xchange.kucoin.service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.Order;
import org.knowm.xchange.dto.trade.LimitOrder;
import org.knowm.xchange.dto.trade.MarketOrder;
import org.knowm.xchange.dto.trade.OpenOrders;
import org.knowm.xchange.dto.trade.UserTrades;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.exceptions.NotAvailableFromExchangeException;
import org.knowm.xchange.kucoin.dto.KucoinAdapters;
import org.knowm.xchange.kucoin.dto.KucoinResponse;
import org.knowm.xchange.kucoin.dto.trading.KucoinDealtOrdersInfo;
import org.knowm.xchange.kucoin.dto.trading.KucoinOrderDetail;
import org.knowm.xchange.kucoin.dto.trading.KucoinOrderQueryParams;
import org.knowm.xchange.service.trade.TradeService;
import org.knowm.xchange.service.trade.params.CancelOrderByCurrencyPair;
import org.knowm.xchange.service.trade.params.CancelOrderByIdParams;
import org.knowm.xchange.service.trade.params.CancelOrderByOrderTypeParams;
import org.knowm.xchange.service.trade.params.CancelOrderParams;
import org.knowm.xchange.service.trade.params.TradeHistoryParamCurrencyPair;
import org.knowm.xchange.service.trade.params.TradeHistoryParamPaging;
import org.knowm.xchange.service.trade.params.TradeHistoryParams;
import org.knowm.xchange.service.trade.params.TradeHistoryParamsTimeSpan;
import org.knowm.xchange.service.trade.params.orders.DefaultOpenOrdersParamCurrencyPair;
import org.knowm.xchange.service.trade.params.orders.OpenOrdersParamCurrencyPair;
import org.knowm.xchange.service.trade.params.orders.OpenOrdersParams;
import org.knowm.xchange.service.trade.params.orders.OrderQueryParams;
public class KucoinTradeService extends KucoinTradeServiceRaw implements TradeService {
public KucoinTradeService(Exchange exchange) {
super(exchange);
}
@Override
public OpenOrders getOpenOrders() throws IOException {
throw new ExchangeException("You need to provide the currency pair to get open orders.");
}
@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException {
if (!(params instanceof OpenOrdersParamCurrencyPair)) {
throw new ExchangeException("You need to provide the currency pair to get open orders.");
}
CurrencyPair currencyPair = ((OpenOrdersParamCurrencyPair) params).getCurrencyPair();
return KucoinAdapters.adaptActiveOrders(
currencyPair,
getKucoinOpenOrders(currencyPair, null)
.getData()); // order type null returns both bid and ask
}
@Override
public String placeMarketOrder(MarketOrder marketOrder) throws IOException {
throw new NotAvailableFromExchangeException();
}
@Override
public String placeLimitOrder(LimitOrder limitOrder) throws IOException {
return placeKucoinLimitOrder(limitOrder).getData().getOrderOid();
}
@Override
public boolean cancelOrder(String orderId) throws IOException {
throw new ExchangeException(
"You need to provide the currency pair, the order id and the order type to cancel an order.");
}
@Override
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
if (!(orderParams instanceof CancelOrderByCurrencyPair)
&& !(orderParams instanceof CancelOrderByIdParams)
&& !(orderParams instanceof CancelOrderByOrderTypeParams)) {
throw new ExchangeException(
"You need to provide the currency pair, the order id and the order type to cancel an order.");
}
return cancelKucoinOrder(
((CancelOrderByCurrencyPair) orderParams).getCurrencyPair(),
((CancelOrderByIdParams) orderParams).getOrderId(),
((CancelOrderByOrderTypeParams) orderParams).getOrderType())
.isSuccess();
}
@Override
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {
if (!(params instanceof TradeHistoryParamPaging)) {
throw new ExchangeException(
"You need to provide paging information to get the trade history.");
}
TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params;
CurrencyPair pair = null;
Date startTime = null;
Date endTime = null;
if (params instanceof TradeHistoryParamCurrencyPair) {
if (pagingParams.getPageLength() > 20) {
throw new ExchangeException("Page length > 20 not allowed with a currency pair.");
}
pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair();
} else {
if (pagingParams.getPageLength() > 100) {
throw new ExchangeException("Page length > 100 not allowed with a currency pair.");
}
}
if (params instanceof TradeHistoryParamsTimeSpan) {
startTime = ((TradeHistoryParamsTimeSpan) params).getStartTime();
endTime = ((TradeHistoryParamsTimeSpan) params).getEndTime();
}
// Kucoin has 1-based paging
KucoinResponse<KucoinDealtOrdersInfo> response =
getKucoinTradeHistory(
pair,
null,
pagingParams.getPageLength(),
pagingParams.getPageNumber() + 1,
startTime,
endTime);
return KucoinAdapters.adaptUserTrades(response.getData().getDealtOrders());
}
@Override
public TradeHistoryParams createTradeHistoryParams() {
return new KucoinTradeHistoryParams();
}
@Override
public OpenOrdersParams createOpenOrdersParams() {
return new DefaultOpenOrdersParamCurrencyPair();
}
@Override
public Collection<Order> getOrder(OrderQueryParams... orderQueryParams) throws IOException {
if (orderQueryParams == null) {
return new ArrayList<>();
}
Collection<Order> orders = new ArrayList<>();
for (OrderQueryParams param : orderQueryParams) {
if (!(param instanceof KucoinOrderQueryParams)) {
throw new ExchangeException(
"Parameters must be an instance of OrderQueryParamCurrencyPair");
}
KucoinResponse<KucoinOrderDetail> response =
getOrderDetails(
((KucoinOrderQueryParams) param).getCurrencyPair(),
((KucoinOrderQueryParams) param).getOrderType(),
((KucoinOrderQueryParams) param).getLimit(),
((KucoinOrderQueryParams) param).getPage(),
param.getOrderId());
if (response != null) orders.add(KucoinAdapters.adaptOrder(response.getData()));
}
return orders;
}
}
|
satanin/matematicus
|
app/models/question_comment.rb
|
class QuestionComment < ActiveRecord::Base
belongs_to :user
belongs_to :question
validates :user_id, presence: true
validates :body, presence: true
validates :question_id, presence: true
end
|
FilippoAleotti/Dwarf-Tensorflow
|
general/network.py
|
'''
Base network
Author: <NAME>
Mail: <EMAIL>
'''
from abc import ABCMeta, abstractmethod
import tensorflow as tf
class GeneralNetwork(object, metaclass=ABCMeta):
def __init__(self, params, inputs):
''' Prepare the network and create the graph'''
self.params = params
self.inputs = inputs
self.model_name = self.params['experiment']['network_name']
self.training= self.params['experiment']['mode'] == 'training'
self.setup_network()
def setup_network(self):
''' Build the model, the losses and the summaries '''
with tf.variable_scope(self.model_name):
self.build_model()
self.build_outputs()
if self.training is True:
self.build_losses()
self.build_summaries()
@abstractmethod
def build_model(self):
''' Network specification'''
pass
@abstractmethod
def build_outputs(self):
''' Output generated by the network. '''
pass
@abstractmethod
def build_losses(self):
''' Losses used by the network.
Remeber to increment self.total_loss
'''
pass
def build_summaries(self):
''' Summaries'''
tf.summary.scalar('total_loss', self.total_loss)
|
luobotao/higouOMS
|
app/repositories/Order/ChinaAddressRepository.java
|
package repositories.Order;
import java.util.List;
import javax.inject.Named;
import javax.inject.Singleton;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import models.kjt.ChinaAddress;
/**
* Provides CRUD functionality for accessing people. Spring Data auto-magically
* takes care of many standard operations here.
*/
@Named
@Singleton
public interface ChinaAddressRepository extends JpaRepository<ChinaAddress, Integer>,JpaSpecificationExecutor<ChinaAddress> {
@Query(value="SELECT * FROM chinaAddress WHERE ?1 LIKE CONCAT(NAME,'%') ORDER BY tier,id ASC LIMIT 100",nativeQuery=true)
List<ChinaAddress> getErpAddressWithProvince(String province);
}
|
rpiaggio/ocs
|
bundle/edu.gemini.spdb.reports.collection/src/test/java/edu/gemini/dbTools/ephemeris/TestSupport.scala
|
<reponame>rpiaggio/ocs<filename>bundle/edu.gemini.spdb.reports.collection/src/test/java/edu/gemini/dbTools/ephemeris/TestSupport.scala<gh_stars>10-100
package edu.gemini.dbTools.ephemeris
import edu.gemini.pot.sp.{ISPObsComponent, ISPObservation, ProgramTestSupport, SPComponentType, ISPFactory, ISPProgram, ProgramGen}
import edu.gemini.shared.util.immutable.ScalaConverters._
import edu.gemini.spModel.core.{Ephemeris, SiderealTarget, NonSiderealTarget, HorizonsDesignation}
import edu.gemini.spModel.gemini.obscomp.SPProgram
import edu.gemini.spModel.obs.{ObservationStatus, ObsPhase2Status, SPObservation}
import edu.gemini.spModel.obsrecord.ObsExecStatus
import edu.gemini.spModel.target.env.TargetEnvironment
import edu.gemini.spModel.target.obsComp.TargetObsComp
import edu.gemini.spModel.util.SPTreeUtil
import edu.gemini.util.security.principal.StaffPrincipal
import org.scalacheck.Gen
import org.scalacheck.Arbitrary._
import java.security.Principal
import scala.collection.JavaConverters._
import scala.util.Random
trait TestSupport extends ProgramTestSupport {
val User = java.util.Collections.singleton[Principal](StaffPrincipal.Gemini)
import ProgramGen._
val nonSids = List(
(HorizonsDesignation.Comet("C/1973 E1"), "Kohoutek" ),
(HorizonsDesignation.AsteroidNewStyle("1971 UC1"), "1896 Beer"),
(HorizonsDesignation.AsteroidOldStyle(4), "Vesta"),
(HorizonsDesignation.MajorBody(606), "Titan")
)
val genNonSiderealTarget: Gen[NonSiderealTarget] =
Gen.oneOf(nonSids).map { case (hid, name) =>
NonSiderealTarget(name, Ephemeris.empty, Some(hid), List.empty, None, None)
}
def findOrCreateTargetComp(f: ISPFactory, o: ISPObservation): ISPObsComponent =
Option(SPTreeUtil.findTargetEnvNode(o)).getOrElse {
val tc = f.createObsComponent(o.getProgram, SPComponentType.TELESCOPE_TARGETENV, null)
o.addObsComponent(tc)
tc
}
def editProgram(ef: SPProgram => Unit): ProgEdit = { (_: ISPFactory, p: ISPProgram) =>
val dob = p.getDataObject.asInstanceOf[SPProgram]
ef(dob)
p.setDataObject(dob)
}
val setInactive: ProgEdit =
editProgram(_.setActive(SPProgram.Active.NO))
val setCompleted: ProgEdit =
editProgram(_.setCompleted(true))
val setLibrary: ProgEdit =
editProgram(_.setLibrary(true))
val genInactiveProgram: Gen[ProgEdit] =
Gen.oneOf(setInactive, setCompleted, setLibrary)
val genSiderealEdit: Gen[ProgEdit] =
for {
f <- maybePickObservation
} yield { (_: ISPFactory, p: ISPProgram) =>
f(p).foreach { obs =>
val tc = SPTreeUtil.findTargetEnvNode(obs)
val toc = tc.getDataObject.asInstanceOf[TargetObsComp]
// TODO:ASTERISM: handle multi-target asterisms
toc.getAsterism.allSpTargets.head.setTarget(SiderealTarget.empty)
tc.setDataObject(toc)
}
}
val genInactiveObsStatus: Gen[ProgEdit] =
for {
f <- maybePickObservation
s <- Gen.oneOf(ObservationStatus.OBSERVED, ObservationStatus.INACTIVE)
} yield { (_: ISPFactory, p: ISPProgram) =>
f(p).foreach { obs =>
val dob = obs.getDataObject.asInstanceOf[SPObservation]
s match {
case ObservationStatus.OBSERVED =>
dob.setPhase2Status(ObsPhase2Status.PHASE_2_COMPLETE)
dob.setExecStatusOverride(Option(ObsExecStatus.OBSERVED).asGeminiOpt)
case _ =>
dob.setPhase2Status(s.phase2())
dob.setExecStatusOverride(Option(ObsExecStatus.PENDING).asGeminiOpt)
}
obs.setDataObject(dob)
}
}
val genTargetEnv: Gen[TargetEnvironment] = {
val r = new Random
arbitrary[TargetEnvironment].map { te =>
te.getTargets.asScala.foreach { t =>
// set half the targets on average to non-sidereal
if (r.nextInt(2) == 0) {
t.setTarget(genNonSiderealTarget.sample.get)
}
}
te
}
}
val genTestProg: Gen[ISPFactory => ISPProgram] =
genProg.map { pCons => (fact: ISPFactory) => {
val p = pCons(fact)
p.getAllObservations.asScala.foreach { obs =>
val tc = findOrCreateTargetComp(fact, obs)
val toc = tc.getDataObject.asInstanceOf[TargetObsComp]
toc.setTargetEnvironment(genTargetEnv.sample.get)
tc.setDataObject(toc)
val dob = obs.getDataObject.asInstanceOf[SPObservation]
dob.setPhase2Status(ObsPhase2Status.PHASE_2_COMPLETE)
dob.setExecStatusOverride(Gen.oneOf(ObsExecStatus.PENDING, ObsExecStatus.ONGOING).sample.asGeminiOpt)
obs.setDataObject(dob)
}
p
}
}
}
|
FlyingBird95/openapi_generator
|
tests/unit/builder/test_process.py
|
import pytest
from openapi_builder import DocumentationOptions
from openapi_builder.documentation import Documentation
from openapi_builder.exceptions import MissingConfigContext, MissingConverter
from openapi_builder.specification import Schema
@pytest.mark.parametrize(
"documentation_options__strict_mode",
[DocumentationOptions.StrictMode.FAIL_ON_ERROR],
)
def test_strict_mode_error(open_api_documentation):
builder = open_api_documentation.builder
with pytest.raises(MissingConverter):
with builder.config_manager.use_documentation_context(Documentation()):
open_api_documentation.builder.schema_manager.process(None, name="abc")
@pytest.mark.parametrize(
"documentation_options__strict_mode",
[DocumentationOptions.StrictMode.SHOW_WARNINGS],
)
def test_strict_mode_warning(open_api_documentation):
builder = open_api_documentation.builder
with builder.config_manager.use_documentation_context(Documentation()):
result = open_api_documentation.builder.schema_manager.process(None, name="abc")
assert isinstance(result, Schema)
assert result.example == "<unknown>"
@pytest.mark.parametrize("documentation_options__strict_mode", [None])
def test_unknown_strict_mode(open_api_documentation):
builder = open_api_documentation.builder
with pytest.raises(ValueError):
with builder.config_manager.use_documentation_context(Documentation()):
open_api_documentation.builder.schema_manager.process(None, name="abc")
def test_unknown_documentation(open_api_documentation):
builder = open_api_documentation.builder
with pytest.raises(TypeError):
with builder.config_manager.use_documentation_context(None):
open_api_documentation.builder.process()
def test_missing_context(open_api_documentation):
with pytest.raises(MissingConfigContext):
open_api_documentation.builder.config_manager.ensure_valid_config()
|
laichunjing/design
|
[2]. Ojbect-Oriented design pattern Demo/[2]. Factory Method Pattern Demo/FMPDemo/Factory/IPhoneFactory.h
|
<gh_stars>100-1000
//
// IPhoneFactory.h
// FMPDemo
//
// Created by <NAME> on 2018/10/3.
// Copyright © 2018年 Sunshijie. All rights reserved.
//
#import "PhoneFactory.h"
@interface IPhoneFactory : PhoneFactory
@end
|
pantheon/pantheon
|
core/src/test/scala/pantheon/PantheonDruidSpec.scala
|
<reponame>pantheon/pantheon
package pantheon
import java.net.URI
import java.sql.ResultSet
import org.scalatest.{MustMatchers, WordSpec}
import pantheon.schema._
import util.{Logging, RowSetUtil}
import pantheon.planner.ASTBuilders._
import cats.syntax.either._
import pantheon.schema.parser.SchemaParser
import pantheon.util.Tap
class PantheonDruidSpec extends WordSpec with MustMatchers {
implicit val ctx = Logging.newContext
class Result(statement: Statement) {
def plan: String = statement.backendLogicalPlan.toString
def value(limit: Int = 100): String = RowSetUtil.toString(statement.execute(), limit)
}
val ds =
DruidSource("druidy", new URI("http://localhost:3000"), new URI("http://localhost:3001"), false, false, false)
"Pantheon" when {
def test(schema: String, query: PantheonQuery)(block: Result => Unit): Unit =
Pantheon.withConnection(new InMemoryCatalog(Map("_test_" -> schema), List(ds)), "_test_") { connection =>
val statement = connection.createStatement(query).tap(_.mustBe('right))
block(new Result(statement))
}
"querying druid" should {
"complex query" ignore {
val query =
AggregateQuery(rows = List("Page.page"), filter = Some(ref("Page.page") === lit("Plastic_pollution")))
val schema =
"""schema Wiki (dataSource = "druidy") {
| measure edits
|
| dimension Page(table = "wikipedia") {
| attribute page
| }
|}
|""".stripMargin
test(schema, query) { result =>
println(result.plan)
result.plan mustBe
"""LogicalAggregate(group=[{0}])
| LogicalProject(Page.page=[$16])
| LogicalFilter(condition=[=($16, 'Plastic_pollution')])
| DruidQuery(table=[[druidy, wikipedia]], intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]])
|""".stripMargin
result.value(5) mustBe """Page.page=Plastic_pollution"""
}
}
}
}
}
|
fxiao/gitlab
|
ee/app/helpers/ee/dashboard_helper.rb
|
# frozen_string_literal: true
module EE
module DashboardHelper
extend ::Gitlab::Utils::Override
def controller_action_to_child_dashboards(controller = controller_name, action = action_name)
case "#{controller}##{action}"
when 'projects#index', 'root#index', 'projects#starred', 'projects#trending'
%w(projects)
when 'dashboard#activity'
%w(starred_project_activity project_activity)
when 'groups#index'
%w(groups)
when 'todos#index'
%w(todos)
when 'dashboard#issues'
%w(issues)
when 'dashboard#merge_requests'
%w(merge_requests)
else
[]
end
end
def user_default_dashboard?(user)
controller_action_to_child_dashboards.any? {|dashboard| dashboard == user.dashboard }
end
def has_start_trial?
!current_user.has_current_license? && current_user.admin?
end
def analytics_nav_url
if can?(current_user, :read_instance_statistics)
instance_statistics_root_path
else
'errors/not_found'
end
end
private
override :get_dashboard_nav_links
def get_dashboard_nav_links
super.tap do |links|
if can?(current_user, :read_operations_dashboard)
links << :environments
links << :operations
end
if security_dashboard_available?
links << :security
end
end
end
def security_dashboard_available?
security_dashboard = InstanceSecurityDashboard.new(current_user)
::Feature.enabled?(:instance_security_dashboard, default_enabled: true) &&
security_dashboard.feature_available?(:security_dashboard) &&
can?(current_user, :read_instance_security_dashboard, security_dashboard)
end
end
end
|
enozcan/hazelcast-cpp-client
|
hazelcast/test/src/cpp-controller/remote_controller_constants.h
|
<reponame>enozcan/hazelcast-cpp-client
/**
* Autogenerated by Thrift Compiler (0.13.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef remote_controller_CONSTANTS_H
#define remote_controller_CONSTANTS_H
#include "remote_controller_types.h"
namespace hazelcast { namespace client { namespace test { namespace remote {
class remote_controllerConstants {
public:
remote_controllerConstants();
};
extern const remote_controllerConstants g_remote_controller_constants;
}}}} // namespace
#endif
|
smith750/kc
|
coeus-impl/src/main/java/org/kuali/coeus/common/committee/impl/meeting/CommScheduleActItemBase.java
|
/*
* Copyright 2005-2014 The Kuali Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.osedu.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.coeus.common.committee.impl.meeting;
import org.kuali.coeus.common.committee.impl.bo.CommitteeScheduleBase;
import org.kuali.coeus.sys.framework.model.KcPersistableBusinessObjectBase;
/**
*
* This class is for schedule meeting other action.
*/
public abstract class CommScheduleActItemBase extends KcPersistableBusinessObjectBase {
private static final long serialVersionUID = 5688256868516863628L;
private Long commScheduleActItemsId;
private Long scheduleIdFk;
private Integer actionItemNumber;
private String scheduleActItemTypeCode;
private String itemDescription;
private CommitteeScheduleBase committeeSchedule;
private ScheduleActItemType scheduleActItemType;
public CommScheduleActItemBase() {
}
public Long getCommScheduleActItemsId() {
return commScheduleActItemsId;
}
public void setCommScheduleActItemsId(Long commScheduleActItemsId) {
this.commScheduleActItemsId = commScheduleActItemsId;
}
public Integer getActionItemNumber() {
return actionItemNumber;
}
public void setActionItemNumber(Integer actionItemNumber) {
this.actionItemNumber = actionItemNumber;
}
public String getScheduleActItemTypeCode() {
return scheduleActItemTypeCode;
}
public void setScheduleActItemTypeCode(String scheduleActItemTypeCode) {
this.scheduleActItemTypeCode = scheduleActItemTypeCode;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public ScheduleActItemType getScheduleActItemType() {
return scheduleActItemType;
}
public void setScheduleActItemType(ScheduleActItemType scheduleActItemType) {
this.scheduleActItemType = scheduleActItemType;
}
public CommitteeScheduleBase getCommitteeSchedule() {
return committeeSchedule;
}
public void setCommitteeSchedule(CommitteeScheduleBase committeeSchedule) {
this.committeeSchedule = committeeSchedule;
}
public Long getScheduleIdFk() {
return scheduleIdFk;
}
public void setScheduleIdFk(Long scheduleIdFk) {
this.scheduleIdFk = scheduleIdFk;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
CommScheduleActItemBase other = (CommScheduleActItemBase) obj;
if (commScheduleActItemsId == null) {
if (other.commScheduleActItemsId != null) {
return false;
}
} else if (!commScheduleActItemsId.equals(other.commScheduleActItemsId)) {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((commScheduleActItemsId == null) ? 0 : commScheduleActItemsId.hashCode());
return result;
}
}
|
ShawnZhong/SplitFS
|
rsync/lib/sysacls.h
|
/*
* Unix SMB/Netbios implementation.
* Version 2.2.x
* Portable SMB ACL interface
* Copyright (C) <NAME> 2000
* Copyright (C) 2007-2008 <NAME>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* with this program; if not, visit the http://fsf.org website.
*/
#ifdef SUPPORT_ACLS
#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif
#ifdef HAVE_ACL_LIBACL_H
#include <acl/libacl.h>
#endif
#define SMB_MALLOC(cnt) new_array(char, cnt)
#define SMB_MALLOC_P(obj) new_array(obj, 1)
#define SMB_MALLOC_ARRAY(obj, cnt) new_array(obj, cnt)
#define SMB_REALLOC(mem, cnt) realloc_array(mem, char, cnt)
#define slprintf snprintf
#if defined HAVE_POSIX_ACLS /*-----------------------------------------------*/
/* This is an identity mapping (just remove the SMB_). */
#define SMB_ACL_TAG_T acl_tag_t
#define SMB_ACL_TYPE_T acl_type_t
/* Types of ACLs. */
#define SMB_ACL_USER ACL_USER
#define SMB_ACL_USER_OBJ ACL_USER_OBJ
#define SMB_ACL_GROUP ACL_GROUP
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
#define SMB_ACL_OTHER ACL_OTHER
#define SMB_ACL_MASK ACL_MASK
#define SMB_ACL_T acl_t
#define SMB_ACL_ENTRY_T acl_entry_t
#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#elif defined HAVE_TRU64_ACLS /*---------------------------------------------*/
/* This is for DEC/Compaq Tru64 UNIX */
#define SMB_ACL_TAG_T acl_tag_t
#define SMB_ACL_TYPE_T acl_type_t
/* Types of ACLs. */
#define SMB_ACL_USER ACL_USER
#define SMB_ACL_USER_OBJ ACL_USER_OBJ
#define SMB_ACL_GROUP ACL_GROUP
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
#define SMB_ACL_OTHER ACL_OTHER
#define SMB_ACL_MASK ACL_MASK
#define SMB_ACL_T acl_t
#define SMB_ACL_ENTRY_T acl_entry_t
#define SMB_ACL_FIRST_ENTRY 0
#define SMB_ACL_NEXT_ENTRY 1
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#elif defined HAVE_UNIXWARE_ACLS || defined HAVE_SOLARIS_ACLS /*-------------*/
/* Donated by <NAME> <<EMAIL>> for UnixWare / OpenUNIX.
* Modified by <NAME> <<EMAIL>> for Solaris. */
/* SVR4.2 ES/MP ACLs */
typedef int SMB_ACL_TAG_T;
typedef int SMB_ACL_TYPE_T;
/* Types of ACLs. */
#define SMB_ACL_USER USER
#define SMB_ACL_USER_OBJ USER_OBJ
#define SMB_ACL_GROUP GROUP
#define SMB_ACL_GROUP_OBJ GROUP_OBJ
#define SMB_ACL_OTHER OTHER_OBJ
#define SMB_ACL_MASK CLASS_OBJ
typedef struct SMB_ACL_T {
int size;
int count;
int next;
struct acl acl[1];
} *SMB_ACL_T;
typedef struct acl *SMB_ACL_ENTRY_T;
#define SMB_ACL_FIRST_ENTRY 0
#define SMB_ACL_NEXT_ENTRY 1
#define SMB_ACL_TYPE_ACCESS 0
#define SMB_ACL_TYPE_DEFAULT 1
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#ifdef __CYGWIN__
#define SMB_ACL_LOSES_SPECIAL_MODE_BITS
#endif
#elif defined HAVE_HPUX_ACLS /*----------------------------------------------*/
/* Based on the Solaris & UnixWare code. */
#undef GROUP
#include <sys/aclv.h>
/* SVR4.2 ES/MP ACLs */
typedef int SMB_ACL_TAG_T;
typedef int SMB_ACL_TYPE_T;
/* Types of ACLs. */
#define SMB_ACL_USER USER
#define SMB_ACL_USER_OBJ USER_OBJ
#define SMB_ACL_GROUP GROUP
#define SMB_ACL_GROUP_OBJ GROUP_OBJ
#define SMB_ACL_OTHER OTHER_OBJ
#define SMB_ACL_MASK CLASS_OBJ
typedef struct SMB_ACL_T {
int size;
int count;
int next;
struct acl acl[1];
} *SMB_ACL_T;
typedef struct acl *SMB_ACL_ENTRY_T;
#define SMB_ACL_FIRST_ENTRY 0
#define SMB_ACL_NEXT_ENTRY 1
#define SMB_ACL_TYPE_ACCESS 0
#define SMB_ACL_TYPE_DEFAULT 1
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#elif defined HAVE_IRIX_ACLS /*----------------------------------------------*/
/* IRIX ACLs */
#define SMB_ACL_TAG_T acl_tag_t
#define SMB_ACL_TYPE_T acl_type_t
/* Types of ACLs. */
#define SMB_ACL_USER ACL_USER
#define SMB_ACL_USER_OBJ ACL_USER_OBJ
#define SMB_ACL_GROUP ACL_GROUP
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
#define SMB_ACL_OTHER ACL_OTHER_OBJ
#define SMB_ACL_MASK ACL_MASK
typedef struct SMB_ACL_T {
int next;
BOOL freeaclp;
struct acl *aclp;
} *SMB_ACL_T;
#define SMB_ACL_ENTRY_T acl_entry_t
#define SMB_ACL_FIRST_ENTRY 0
#define SMB_ACL_NEXT_ENTRY 1
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#elif defined HAVE_AIX_ACLS /*-----------------------------------------------*/
/* Donated by <NAME>, <EMAIL>.ibm.com, for IBM */
#include "/usr/include/acl.h"
struct acl_entry_link{
struct acl_entry_link *prevp;
struct new_acl_entry *entryp;
struct acl_entry_link *nextp;
int count;
};
struct new_acl_entry{
unsigned short ace_len;
unsigned short ace_type;
unsigned int ace_access;
struct ace_id ace_id[1];
};
#define SMB_ACL_ENTRY_T struct new_acl_entry*
#define SMB_ACL_T struct acl_entry_link*
#define SMB_ACL_TAG_T unsigned short
#define SMB_ACL_TYPE_T int
/* Types of ACLs. */
#define SMB_ACL_USER ACEID_USER
#define SMB_ACL_USER_OBJ 3
#define SMB_ACL_GROUP ACEID_GROUP
#define SMB_ACL_GROUP_OBJ 4
#define SMB_ACL_OTHER 5
#define SMB_ACL_MASK 6
#define SMB_ACL_FIRST_ENTRY 1
#define SMB_ACL_NEXT_ENTRY 2
#define SMB_ACL_TYPE_ACCESS 0
#define SMB_ACL_TYPE_DEFAULT 1
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1)
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1)
#define SMB_ACL_NEED_SORT
#elif defined(HAVE_OSX_ACLS) /*----------------------------------------------*/
/* Special handling for OS X ACLs */
#define SMB_ACL_TAG_T acl_tag_t
#define SMB_ACL_TYPE_T acl_type_t
#define SMB_ACL_T acl_t
#define SMB_ACL_ENTRY_T acl_entry_t
#define SMB_ACL_USER 1
#define SMB_ACL_GROUP 2
#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_EXTENDED
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
#define SMB_ACL_VALID_NAME_BITS ((1<<25)-1)
#define SMB_ACL_VALID_OBJ_BITS 0
/*#undef SMB_ACL_NEED_SORT*/
#else /*---------------------------------------------------------------------*/
/* Unknown platform. */
#error Cannot handle ACLs on this platform!
#endif
int sys_acl_get_entry(SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *bits_p, id_t *u_g_id_p);
SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
SMB_ACL_T sys_acl_init(int count);
int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
int sys_acl_set_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype, uint32 bits, id_t u_g_id);
int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits);
int sys_acl_valid(SMB_ACL_T theacl);
int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd(int fd, SMB_ACL_T theacl);
int sys_acl_delete_def_file(const char *name);
int sys_acl_free_acl(SMB_ACL_T the_acl);
int no_acl_syscall_error(int err);
#endif /* SUPPORT_ACLS */
|
yesihao/pwa-products
|
src/layout-mgt/containers/Coupons.js
|
import { connect } from 'react-redux'
import { compose } from 'redux'
import { createSelector, createStructuredSelector } from 'reselect'
import { Initable } from 'reax'
import Coupons from '../components/Coupons'
import actions from '../actions/coupons'
const { load, reset, ...rest } = actions
const filteredCoupons = createSelector(
x => x.get('coupons'),
x => x.get('filters'),
(coupons, filters) => {
let { keyword, expire } = filters.toJS()
let filteredCoupons = coupons.filter(m =>
m.get('name').toLowerCase().indexOf(keyword) !== -1 &&
(!expire || (m.get('expire') ? 'expired' : 'unexpired') === expire)
)
return filteredCoupons
}
)
const selector = createStructuredSelector({
name: x => x.getIn(['filters', 'name']),
expire: x => x.getIn(['filters', 'expire']),
page: x => x.get('page'),
pageSize: x => x.get('pageSize'),
results: createSelector(
filteredCoupons,
x => x.get('page'),
x => x.get('pageSize'),
(filteredCoupons, page, pageSize) => {
return filteredCoupons.slice((page - 1) * pageSize, page * pageSize).toJS()
}
),
total: createSelector(
filteredCoupons,
filteredCoupons => filteredCoupons.size,
),
})
export default compose(
Initable({
loadFn: load,
loadingFn: (state) => state.getIn(['layoutMgt', 'coupons', 'loading']),
unloadFn: reset,
}),
connect(
(state) => {
const coupons = state.getIn(['layoutMgt', 'coupons'])
return selector(coupons)
},
rest,
),
)(Coupons)
|
nb-e/OpenRootSim
|
OpenSimRoot/src/import/xmlReader/SimulaReaders.cpp
|
/*
Copyright © 2016, The Pennsylvania State University
All rights reserved.
Copyright © 2016 Forschungszentrum Jülich GmbH
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted under the GNU General Public License v3 and provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in license.txt but can also be found at http://www.gnu.org/licenses/gpl-3.0.en.html
NOTE: The GPL.v3 license requires that all derivative work is distributed under the same license. That means that if you use this source code in any other program, you can only distribute that program with the full source code included and licensed under a GPL license.
*/
#include "SimulaReaders.hpp"
std::istream &operator>>(std::istream &is, SimulaBase* obj){
//skip comments
skipComments(is);
//nothing to read
//call to read any children
readTags(is, obj, "/SimulaBase");
//return
return is;
}
std::istream &operator>>(std::istream &is, SimulaPoint* obj){
//skip comments
skipComments(is);
//clear fail bit
is.clear();
//read data
MovingCoordinate co;
std::vector<double> pair;
READTAG(is,pair)
//check if there were 3 or 6 numbers and store vector
switch (pair.size()) {
case 0:
co.state.x=0;
co.state.y=0;
co.state.z=0;
obj->setInitialValue(co);
break;
case 3:
co.state.x=pair[0];
co.state.y=pair[1];
co.state.z=pair[2];
obj->setInitialValue(co);
break;
default:
Time t;
unsigned int i;
for(i=0;i<pair.size(); i+=7){
t=pair[i];
co.state.x=pair[i+1];
co.state.y=pair[i+2];
co.state.z=pair[i+3];
co.rate.x=pair[i+4];
co.rate.y=pair[i+5];
co.rate.z=pair[i+6];
obj->table[t]=co;
obj->t_solid_=t;
}
i=pair.size()-i;
if(i>0) msg::error(">>SimulaPoint: Expected 3 values, or multiple of 7."+filePosition(is));
break;
}
//check for errors
if(!is){
is.clear();
msg::error(">>SimulaPoint*: failed to read data"+filePosition(is));
}
//clear trailing white space
is>>std::ws;
//call to read any children
readTags(is, obj, "/SimulaPoint");
//return
return is;
}
std::istream &operator>>(std::istream &is, SimulaVariable* obj){
//skip comments
skipComments(is);
//clear fail bit
is.clear();
//read data
std::vector<double> pair;
READTAG(is,pair)
//read initial state and possibly rate
StateRate sr;
switch (pair.size()) {
case 1:
obj->setInitialValue(pair[0]);
break;
case 2:
obj->setInitialValue(pair[0]);
obj->setInitialRate(pair[1]);
break;
default:
Time t;
unsigned int i(0);
for(i=0;i<pair.size(); i+=3){
t=pair[i];
sr.state=pair[i+1];
sr.rate=pair[i+2];
obj->table[t]=sr;
obj->t_solid_=t;
}
if(i>pair.size()) msg::error(">>SimulaVariable: Expected 1 OR 2 values, or multiple of 3."+filePosition(is));
break;
}
//check for errors
if(!is){
is.clear();
msg::error(">>SimulaVariable*: failed to read initial state."+filePosition(is));
}
//clear trailing white space
is>>std::ws;
//call to read any children
readTags(is, obj, "/SimulaVariable");
//return
return is;
}
std::istream &operator>>(std::istream &is, SimulaGrid* obj) {
//skip comments
skipComments(is);
//clear fail bit
is.clear();
//read value //expect data in 2 colums
std::vector<double> xy;
is >> xy;
//check for errors
if (!is) {
is.clear();
msg::error(">>SimulaGrid*: failed to read data." + filePosition(is));
}
//even set of numbers?
if (double(xy.size()) / 4 != int(xy.size() / 4))
msg::error(">>SimulaGrid: list of numbers is not a multiple of 4."
+ filePosition(is));
//set values in table object
for (std::size_t i = 0; i < xy.size(); i += 4)
obj->set(Coordinate(xy[i],xy[i+1],xy[i+2]), xy[i + 3]);
//clear trailing white space
is >> std::ws;
//call to read any children
readTags(is, obj, "/SimulaGrid");
//return
return is;
}
std::istream &operator>>(std::istream &is, SimulaLink* obj){
//skip comments
skipComments(is);
//nothing to read
//call to read any children
readTags(is, obj, "/SimulaLink");
//return
return is;
}
|
one-kind/carbon-vue
|
src/mixins/theme.js
|
import Vue from 'vue'
export default Vue.extend({
name: 'theme',
props: {
theme: {
type: String,
default: null,
validate: value => {
const result = ['white', 'g10', 'g90', 'g100'].includes(value)
if(!result) {
console.warn(`theme must be one of: white, g10, g90, g100`);
}
return result
}
}
}
})
|
FatConan/formic-acid
|
src/main/java/de/themonstrouscavalca/formicacid/extractors/impl/collection/LocalDateTimeListExtractor.java
|
<gh_stars>0
package de.themonstrouscavalca.formicacid.extractors.impl.collection;
import com.fasterxml.jackson.databind.JsonNode;
import de.themonstrouscavalca.formicacid.extractors.defn.IExtract;
import de.themonstrouscavalca.formicacid.extractors.impl.AbstractExtractor;
import de.themonstrouscavalca.formicacid.extractors.impl.basic.LocalDateTimeExtractor;
import de.themonstrouscavalca.formicacid.helpers.ParsableValue;
import java.time.LocalDateTime;
import java.util.List;
public class LocalDateTimeListExtractor extends AbstractExtractor<List<LocalDateTime>> implements IExtract<List<LocalDateTime>>{
private final GenericListExtractor<LocalDateTime> genericListExtractor;
public LocalDateTimeListExtractor(){
this.genericListExtractor = new GenericListExtractor<>(new LocalDateTimeExtractor());
}
public LocalDateTimeListExtractor(boolean secondsAccuracy){
this.genericListExtractor = new GenericListExtractor<>(new LocalDateTimeExtractor(secondsAccuracy));
}
@Override
public ParsableValue<List<LocalDateTime>> extractValueFromJson(JsonNode node){
return genericListExtractor.extractValueFromJson(node);
}
}
|
papillonads/papillonads
|
packages/components/src/primer/Icon/__tests__/Icon.int.test.js
|
import { regular, allIcons } from './Icon.int.story'
describe('<Icon />', () => {
describe('Render', () => {
test('must match regular()', () => {
expect(global.renderToJSON(regular({}))).toMatchSnapshot()
})
test('must match allIcons()', () => {
expect(global.renderToJSON(allIcons())).toMatchSnapshot()
})
})
})
|
lenloe1/v2.7
|
protocol/zigbee/documentation/120-3026-000_API_PC_Host/group__apputil.js
|
var group__apputil =
[
[ "Forming and Joining Networks", "group__networks.html", "group__networks" ],
[ "Command Interpreter 2", "group__commands2.html", "group__commands2" ],
[ "ZigBee Device Object (ZDO) Information", "group__util__zdo.html", "group__util__zdo" ],
[ "Message Fragmentation", "group__fragment.html", "group__fragment" ],
[ "Network Manager", "group__network__manager.html", "group__network__manager" ],
[ "Serial Communication", "group__serial__comm.html", "group__serial__comm" ],
[ "ASH Application Utility", "group__ash__util.html", null ]
];
|
korkdaork/FinalPhantasy
|
models/user.js
|
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
var bcrypt = require('bcrypt-nodejs');
// const jwt = require('jsonwebtoken');
const userSchema = new Schema({
// The email cannot be null, and must be a proper email before creation
email: {
type: String
},
// The password cannot be null
password: {
type: String
},
firstName: {
type: String
},
lastName: {
type: String
}
// tokens: [{
// token: {
// type: String,
// required: true
// }
// }]
});
// userSchema.pre('save', async function (next) {
// // Hash the password before saving the user model
// const user = this
// if (user.isModified('password')) {
// user.password = await bcrypt.hash(user.password, 3)
// }
// next()
// })
// // userSchema.methods.generateAuthToken = async function () {
// // // Generate an auth token for the user
// // const user = this
// // const token = jwt.sign({ _id: user._id }, process.env.JWT_KEY)
// // user.tokens = user.tokens.concat({ token })
// // await user.save()
// // return token
// // }
// userSchema.statics.findByCredentials = async (email, password) => {
// // Search for a user by email and password.
// const user = await User.findOne({ email })
// if (!user) {
// throw new Error({ error: 'Invalid login credentials' })
// }
// const isPasswordMatch = await bcrypt.compare(password, user.password)
// if (!isPasswordMatch) {
// throw new Error({ error: 'Invalid login credentials' })
// }
// return user
// // }
userSchema.pre('save', function (next) {
var user = this;
if (this.isModified('password') || this.isNew) {
bcrypt.genSalt(10, function (err, salt) {
if (err) {
return next(err);
}
bcrypt.hash(user.password, salt, null, function (err, hash) {
if (err) {
return next(err);
}
user.password = hash;
next();
});
});
} else {
return next();
}
});
userSchema.methods.comparePassword = function (passw, cb) {
bcrypt.compare(passw, this.password, function (err, isMatch) {
if (err) {
return cb(err);
}
cb(null, isMatch);
});
};
const User = mongoose.model("User", userSchema);
module.exports = User;
|
fox-one/compound
|
store/transaction/transaction.go
|
<filename>store/transaction/transaction.go<gh_stars>1-10
package transaction
import (
"compound/core"
"context"
"time"
"github.com/fox-one/pkg/store/db"
"github.com/jinzhu/gorm"
)
type transactionStore struct {
db *db.DB
}
// New new transaction store
func New(db *db.DB) core.TransactionStore {
return &transactionStore{
db: db,
}
}
func init() {
db.RegisterMigrate(func(db *db.DB) error {
tx := db.Update().Model(core.Transaction{})
if err := tx.AutoMigrate(core.Transaction{}).Error; err != nil {
return err
}
return nil
})
}
func (s *transactionStore) Create(ctx context.Context, transaction *core.Transaction) error {
return s.db.Update().Where("trace_id=?", transaction.TraceID).FirstOrCreate(transaction).Error
}
func (s *transactionStore) FindByTraceID(ctx context.Context, traceID string) (*core.Transaction, error) {
var transaction core.Transaction
if err := s.db.View().Where("trace_id=?", traceID).First(&transaction).Error; err != nil {
if gorm.IsRecordNotFoundError(err) {
return &core.Transaction{}, nil
}
return nil, err
}
return &transaction, nil
}
func (s *transactionStore) Update(ctx context.Context, transaction *core.Transaction) error {
return s.db.Update().Model(core.Transaction{}).Where("trace_id=?", transaction.TraceID).Updates(transaction).Error
}
func (s *transactionStore) List(ctx context.Context, offset time.Time, limit int) ([]*core.Transaction, error) {
var transactions []*core.Transaction
if limit <= 0 {
limit = 500
}
if err := s.db.View().Where("created_at >=?", offset).Order("created_at ASC").Limit(limit).Find(&transactions).Error; err != nil {
return nil, err
}
return transactions, nil
}
|
mullikine/tchannel-go
|
thrift/thrift-gen/include.go
|
<gh_stars>100-1000
// Copyright (c) 2015 Uber Technologies, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package main
import "github.com/samuel/go-thrift/parser"
// Include represents a single include statement in the Thrift file.
type Include struct {
key string
file string
pkg string
}
// Import returns the go import to use for this package.
func (i *Include) Import() string {
// TODO(prashant): Rename imports so they don't clash with standard imports.
// This is not high priority since Apache thrift clashes already with "bytes" and "fmt".
// which are the same imports we would clash with.
return *packagePrefix + i.Package()
}
// Package returns the package selector for this package.
func (i *Include) Package() string {
return i.pkg
}
func createIncludes(parsed *parser.Thrift, all map[string]parseState) map[string]*Include {
includes := make(map[string]*Include)
for k, v := range parsed.Includes {
included := all[v]
includes[k] = &Include{
key: k,
file: v,
pkg: included.namespace,
}
}
return includes
}
|
rongkaixia/order-server
|
src/api/ApiPath.js
|
module.exports = {
ORDER_INFO: '/api/order/order_info',
ORDER: '/api/order/order',
PAY: '/api/order/pay',
NOTIFY: '/api/order/notify',
DELIVER: '/api/order/deliver',
DELIVER_CONFIRM: '/api/order/deliver_confirm',
REFUND: '/api/order/refund',
REFUND_CONFIRM: '/api/order/refund_confirm',
CANCEL: '/api/order/cancel',
SIGNUP: '/api/signup',
LOGIN: '/api/login',
LOGOUT: '/api/logout',
AUTH: '/api/auth',
USER_INFO: '/api/user/user_info',
USER_ADDRESS: '/api/user/user_address',
USER_ORDER: '/api/user/user_order',
USER_CART: '/api/user/user_cart',
CATEGORY_INFO: '/api/product/category_info',
PRODUCT_INFO: '/api/product/product_info',
ITEM_INFO: '/api/product/item_info',
PRICING: '/api/product/pricing'
};
|
jinxuchen/virtool
|
client/src/js/samples/components/Samples.js
|
<filename>client/src/js/samples/components/Samples.js
import React from "react";
import { Switch, Route } from "react-router-dom";
import FileManager from "../../files/components/Manager";
import UniqueNames from "../../administration/components/UniqueNames";
import SampleRights from "../../administration/components/SampleRights";
import SampleDetail from "./Detail";
import SamplesList from "./List";
export const SampleFileManager = () => <FileManager fileType="reads" />;
export const SampleSettings = () => (
<div className="settings-container">
<h3 className="view-header">
<strong>Sample Settings</strong>
</h3>
<UniqueNames />
<SampleRights />
</div>
);
export const Samples = () => (
<div className="container">
<Switch>
<Route path="/samples" component={SamplesList} exact />
<Route path="/samples/files" component={SampleFileManager} exact />
<Route path="/samples/settings" component={SampleSettings} />
<Route path="/samples/:sampleId" component={SampleDetail} />
</Switch>
</div>
);
export default Samples;
|
synchu/schemA
|
src/components/ModelItem/ModelItem.js
|
/* flow */
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {
Tab,
Switch,
Tabs,
FontIcon,
Card,
CardMedia,
CardTitle,
CardText,
CardActions,
IconButton,
Input
} from 'react-toolbox'
import classes from './ModelItem.scss'
import MediaQuery from 'react-responsive'
import TableView from './TableView'
import DownloadLink from '../DownloadLink'
import {DESCRIPTION} from 'utils/constants'
import {transformData} from './TransformData'
import {updateField} from '../../utils/updateDb'
import {getFile} from '../../utils/utils'
/**
* Generates form field name for the edit component.
* @param {String} itemDataVersion
* @param {String} fieldName
*/
const makeField = (itemDataVersion, fieldName) => (itemDataVersion + '_' + fieldName)
/**
* Generates state stored variable for the changed form field value.
* @param {String} itemDataVersion - indicates version for the particular amp.
* @returns indicator of whether the currently loaded version is changed
*/
const mc = (itemDataVersion) => (itemDataVersion + '_changed')
/**
* Check whether param passed is image file, by inspecting its extension
* @param {string} media name of the media file
* @returns true if the file extension matches media type file
*/
const isImageByExt = (media:string):boolean => (media ? media.toLowerCase().match(/jpg|png|jpeg|bmp|gif/) : false)
/**
* Get each tab icon. Depending on the app settings it can be either font icon or text
* @param {any} iconName name of the icon to return
* @param {any} typesAsPictures return either icon or string indicator of the file type
* @returns {string} icon to display
*/
export const getTabIcon = (iconName:string, typesAsPictures:boolean):string => {
let tabIcon =
typesAsPictures
? iconName
: (() => {
switch (iconName) {
case 'developer_board': return 'SCH'
case 'collections': return 'LO'
case 'photo': return 'PH'
case 'attachment': return 'OTH'
default:
return
}
})(iconName)
return tabIcon
}
/**
* ModelItem class displays an amplifier item version information from the database. React-toolbox Card component is used
* to display the data.
*/
export class ModelItem extends Component {
static propTypes = {
cardsAsList: PropTypes.bool,
isAdmin: PropTypes.bool,
isAuthenticated: PropTypes.bool,
loadItem: PropTypes.func,
typesAsPictures: PropTypes.bool
}
constructor (props) {
super(props)
this.handleClick = this
.handleClick
.bind(this)
}
state = {}
componentDidMount = () => {
const {itemObjects} = this.state
if (!itemObjects[0]) {
return
}
itemObjects.map(a => a.photos.map(i => {
getFile(i.photo, i.uploadname, 'inline', this.customSetState, i.updateId)
}))
}
handleClick = (e) => {
// console.log(e.target.id)
}
handleFixedTabChange = (index, version) => {
this.setState({
...this.state,
[version]: index
})
}
handleTabListSwitch = (value, version) => {
this.setState({
...this.state,
['switch' + version]: value
})
}
makeDownloadLink = (linkData) => {
const {
href,
icon,
text,
// activeLinkClass,
uploadname/*,
...other*/
} = linkData
// console.log('href:', href, 'uploadname:', uploadname)
return (
<DownloadLink key={href + uploadname} icon={icon} text={text} existingFile={href} uploadname={uploadname} />
)
/* return (
<Link to={getFile(href, uploadname, 'attachment')} activeClassName={activeLinkClass} target='_blank' {...other}>
<span><FontIcon className={classes.actionIcons} value={icon} /> {text}</span>
</Link>
)*/
}
getMedia = (itemData) => {
let media = ''
if (itemData) {
media = itemData.photos.length > 0
? (itemData.photos[0].uploadname ? this.state[itemData.photos[0].updateId] : itemData.photos[0].photo)
: itemData.layouts.length > 0
? (itemData.layouts.filter(i => isImageByExt(i.layout))[0] ? itemData.layouts.filter(i => isImageByExt(i.layout))[0].layout : '')
: itemData.others.length > 0
? itemData.others[0].other
: ''
}
if (isImageByExt(media)) {
return (<img
src={media}
title={itemData.photos[0]
? itemData.photos[0].photoName
: itemData.version}
alt={itemData.photos[0]
? itemData.photos[0].photoName
: itemData.version} />)
} else if (media !== '') {
return (this.makeDownloadLink({href: media,
text: media, icon: 'file_download',
activeLinkClass: classes.activeRoute}))
} else {
return (
<strong
style={{
padding: '1rem',
marginBottom: 'auto'
}}
>
<strong>No photos or layouts to display yet. Please, contact us, if you would
like to contribute.
</strong>
</strong>
)
}
}
renderPhotos = (photo) => {
// console.log('renderPhotos:', photo.updateId)
return (this.makeDownloadLink({
key: photo.id,
href: photo.photo,
icon: (<img src={photo.uploadname ? this.state[photo.updateId] : photo.photo} alt={photo.photoName} height='48' width='48' />),
text: photo.photoName + ' by ' + photo.photoContributor,
uploadname: photo.uploadname,
activeLinkClass: classes.activeRoute,
type: 'photo',
style: {
marginRight: 'auto',
padding: '3px'
}
}))
}
renderLayouts = (layout) => {
// console.log('renderLayout:', layout.updateId)
return (this.makeDownloadLink({
key: layout.id,
href: layout.layout,
icon: 'file_download',
text: layout.layoutName + ' by ' + layout.layoutContributor,
uploadname: layout.uploadname,
activeLinkClass: classes.activeRoute
}))
}
renderSchematics = (schematic) => {
// console.log('renderSchematics', schematic.updateId)
return (this.makeDownloadLink({
key: schematic.id,
href: schematic.schematic,
icon: 'file_download',
uploadname: schematic.uploadname,
text: schematic.schematicName + ' by ' + schematic.schematicContributor,
activeLinkClass: classes.activeRoute
}))
}
renderOthers = (other) => {
// console.log('renderOther:', other.updateId)
return (this.makeDownloadLink({
key: other.id,
href: other.other,
icon: 'file_download',
uploadname: other.uploadname,
text: other.otherName + ' by ' + other.otherContributor,
activeLinkClass: classes.activeRoute
}))
}
openPhotoLibrary = (itemData) => {}
/**
* makeTabLabel - generates labels for the card tabs, <br /> used to force IE render
* tab label on a new line on larger screen devices
*
*
* @memberof ModelItem
* @returns label of the item card tab
*/
makeTabLabel = (text, stats, icon) => {
return (
<span>
<MediaQuery minDeviceWidth={769}>
<span className={classes.tab} title={text}><FontIcon value={icon} /><br />{text}
<i>({stats})
</i>
</span>
</MediaQuery>
<MediaQuery maxDeviceWidth={768}>
<span className={classes.tab} title={text}><FontIcon value={icon} /><br />
<i>({stats})
</i>
</span>
</MediaQuery>
</span>
)
}
renderTabbedView = (itemData) => {
const {typesAsPictures} = this.props
// console.log('tabbedViewIndex:', this.state[itemData.version])
return (
<Tabs
index={this.state[itemData.version]}
fixed
onChange={(e) => this.handleFixedTabChange(e, itemData.version)}
className={classes.tabs}>
<Tab
label={this.makeTabLabel('Schematics', itemData.schematics.length, getTabIcon('developer_board', typesAsPictures))}>
<div className={classes.actionItems}>
{(this.state[itemData.version] === undefined || this.state[itemData.version] === 0) && itemData
.schematics
.map((s) => this.renderSchematics(s))}
</div>
</Tab>
<Tab
label={this.makeTabLabel('Layouts', itemData.layouts.length, getTabIcon('collections', typesAsPictures))}>
<div className={classes.actionItems}>
{this.state[itemData.version] === 1 && itemData
.layouts
.map((l) => this.renderLayouts(l))}
</div>
</Tab>
<Tab label={this.makeTabLabel('Photos', itemData.photos.length, getTabIcon('photo', typesAsPictures))}>
<div className={classes.actionItems}>
{this.state[itemData.version] === 2 && itemData
.photos
.map((p) => this.renderPhotos(p))}
</div>
</Tab>
<Tab label={this.makeTabLabel('Other', itemData.others.length, getTabIcon('attachment', typesAsPictures))}>
<div className={classes.actionItems}>
{this.state[itemData.version] === 3 && itemData
.others
.map((o) => this.renderOthers(o))}
</div>
</Tab>
</Tabs>
)
}
handleEditChange = (field) => (value) => {
this.setState({
...this.state,
[field]: value.length > 1 || value !== ' ' ? value : ' ',
[mc(field.split('_')[0])]: value.length > 0
})
}
handleErrors = (response) => {
if (!response.ok) {
throw Error(response.statusText)
}
return response
}
saveChanges = (field, itemData) => {
if (!(this.state[mc(itemData.version)]) || (this.state[field].length === 0)) {
// nothing happened - exit
return
}
if (updateField(field, this.state[field], itemData, undefined, () => {
if (this.state[field]) {
this.setState({
...this.state,
saving: false,
[field]: undefined,
[mc(itemData.version)]: false
})
this.props.loadItem(true)
}
})) {
// console.log('will call loadItem now!')
} else {
this.setState({
...this.state,
saving: false,
error: true
})
}
}
handleEditBlur = (field, itemData) => {
if (!(this.state[mc(itemData.version)]) || (this.state[field].length === 0)) {
// nothing happened - exit
return
}
this.setState({
...this.state,
saving: true,
error: false
})
if (updateField(field, this.state[field], itemData)) {
// console.log(field)
// console.log(itemData)
if (this.state[field]) {
this.setState({
...this.state,
saving: false,
[field]: undefined,
[mc(itemData.version)]: false
})
}
this.props.loadItem(true)
} else {
this.setState({
...this.state,
saving: false,
error: true
})
}
}
renderEditComponent = (itemData, field) => {
let fieldLocal = makeField(itemData.version, field)
let content = itemData.description
return (
<span
style={{
display: 'inline-block',
width: '100%',
minWidth: '200px'
}}>
<Input
label=''
multiline
value={this.state[fieldLocal]}
onChange={this.handleEditChange(fieldLocal)}
// onBlur={() => this.handleEditBlur(fieldLocal, itemData)}
hint={content}
style={{
fontSize: '1.5rem'
}} />
</span>
)
}
handleEditClick = (value, content) => (e) => {
const {isAuthenticated, isAdmin} = this.props
if (!isAuthenticated || !isAdmin) {
console.warn('card edit not authotized')
return
}
this.setState({
...this.state,
[value]: content === ''
? ' '
: content
})
}
renderEditButton = (field, content) => {
const {isAuthenticated, isAdmin} = this.props
if (!isAuthenticated || !isAdmin) {
return
}
return (<IconButton
icon='mode_edit'
title='Edit'
className={classes.actionButtons}
onClick={this.handleEditClick(field, content)} />)
}
handleCancelClick = (value) => (e) => {
// console.log('handle cancel click')
this.setState({
...this.state,
[value]: undefined,
[mc(value.split('_')[0])]: false
})
}
renderCancelButton = (field) => {
return (<IconButton
icon='cancel'
title='Cancel edit'
className={classes.actionButtons}
onClick={this.handleCancelClick(field)}
/>)
}
handleSaveClick = (field, itemData) => (e) => {
this.saveChanges(field, itemData)
}
renderSaveButton = (field, itemData) => {
return (<IconButton
icon='save'
title='Save'
className={classes.actionButtons}
onClick={this.handleSaveClick(field, itemData)} />)
}
renderTitleField = (itemData, field) => {
return (
<span
className={classes.flexDisplay}
style={{
paddingRight: '5px'
}}>
{!this.state[makeField(itemData.version, field)] && itemData[field]}
{!this.state[makeField(itemData.version, field)] && this.renderEditButton(makeField(itemData.version, field), itemData[field])}
{this.state[makeField(itemData.version, field)] && this.renderEditComponent(itemData, field)}
{this.state[mc(itemData.version)] && this.renderSaveButton(makeField(itemData.version, field), itemData)}
{this.state[makeField(itemData.version, field)] && this.renderCancelButton(makeField(itemData.version, field))}
</span>
)
}
renderModelsCard = (itemData) => {
let arr = [itemData]
// console.log('renderModelsCard call')
return (
<Card
key={itemData.version}
raised
className={classes.itemCard}
id={itemData.version}
style={!this.state[mc(itemData.version)]
? {}
: {
backgroundColor: 'lavender'
}}>
<CardTitle
title={this.renderTitleField(itemData, 'version')}
subtitle={this.renderTitleField(itemData, 'model')} />
<MediaQuery minDeviceWidth={768}>
<CardMedia aspectRatio='wide'>
{this.getMedia(itemData)}
</CardMedia>
</MediaQuery>
<CardText>
<div className={classes.flexDisplay}>
{this.state[makeField(itemData.version, 'description')] && this.renderEditComponent(itemData, 'description')}
{this.state[mc(itemData.version)] && this.renderSaveButton(makeField(itemData.version, 'description'), itemData)}
{this.state[makeField(itemData.version, 'description')] && this.renderCancelButton(makeField(itemData.version, 'description'))}
{!this.state[makeField(itemData.version, 'description')] && <span>{itemData.description && itemData.description.length > 1
? itemData.description
: 'No description yet'} {this.renderEditButton(makeField(itemData.version, 'description'), itemData.description)}
</span>
}
</div>
</CardText>
<CardActions className={classes.itemCardActions}>
<Switch
theme={classes}
checked={this.state['switch' + itemData.version]}
label='Tab/list view'
onChange={(e) => this.handleTabListSwitch(e, itemData.version)} /> {this.state['switch' + itemData.version]
? <TableView itemData={arr} tabIcon={getTabIcon} {...this.props} />
: this.renderTabbedView(itemData)}
</CardActions>
</Card>
)
}
extractDescriptions = (item) => {
if (item.length <= 0) {
return
}
let descriptions = []
item.filter((i) => i.type === DESCRIPTION).map((j) => descriptions.push(j))
return descriptions
}
componentWillMount = () => {
this.setState({
itemObjects: transformData(this.props.items)
})
}
customSetState = (value, stateObject) => {
// console.log('customSetState:', stateObject, value.target.result)
this.setState({...this.state, [stateObject]: value.target.result})
}
render () {
const {cardsAsList} = this.props
const {itemObjects} = this.state
return (
<div>
{!cardsAsList && itemObjects.map(this.renderModelsCard)}
{cardsAsList && <TableView itemData={itemObjects} tabIcon={getTabIcon} {...this.props} />
}
</div>
)
}
}
export default ModelItem
|
michaelbeaumont/goformation
|
cloudformation/aws-emr-instancefleetconfig_ebsblockdeviceconfig.go
|
package cloudformation
import (
"encoding/json"
)
// AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig AWS CloudFormation Resource (AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html
type AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig struct {
// VolumeSpecification AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html#cfn-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig-volumespecification
VolumeSpecification *AWSEMRInstanceFleetConfig_VolumeSpecification `json:"VolumeSpecification,omitempty"`
// VolumesPerInstance AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig.html#cfn-elasticmapreduce-instancefleetconfig-ebsblockdeviceconfig-volumesperinstance
VolumesPerInstance *Value `json:"VolumesPerInstance,omitempty"`
}
// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) AWSCloudFormationType() string {
return "AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig"
}
func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) MarshalJSON() ([]byte, error) {
return json.Marshal(*r)
}
|
jadedevin13/collect
|
collect-core/src/main/java/org/openforis/collect/model/ApplicationInfo.java
|
package org.openforis.collect.model;
/**
*
* @author <NAME>
*
*/
public class ApplicationInfo {
private String version;
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}
|
wangcy6/weekly_read
|
code_reading/oceanbase-master/src/rootserver/ob_in_zone_server_tracer.cpp
|
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#if 0
#define USING_LOG_PREFIX RS
#include "ob_in_zone_server_tracer.h"
#include "ob_in_zone_master.h"
#include "ob_zone_master_storage_util.h"
#include "share/ob_define.h"
#include "lib/container/ob_array_iterator.h"
#include "share/ob_srv_rpc_proxy.h"
#include "share/config/ob_server_config.h"
namespace oceanbase
{
using namespace common;
using namespace share;
using namespace obrpc;
using namespace blocksstable;
namespace rootserver
{
// ================= ObInZoneServerStatus ================
int ObInZoneServerStatus::assign(
const ObInZoneServerStatus &that)
{
int ret = OB_SUCCESS;
server_ = that.server_;
last_hb_time_ = that.last_hb_time_;
in_zone_hb_status_ = that.in_zone_hb_status_;
return ret;
}
// ================ ObInZoneServerTracer ===============
int ObInZoneServerTracer::init(
common::ObServerConfig *config,
obrpc::ObSrvRpcProxy *rpc_proxy,
ObInZoneMaster *in_zone_master,
const common::ObAddr &self_addr)
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(inited_)) {
ret = OB_INIT_TWICE;
LOG_WARN("init twice", K(ret));
} else if (OB_UNLIKELY(nullptr == config
|| nullptr == rpc_proxy
|| nullptr == in_zone_master
|| !self_addr.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), KP(config), KP(rpc_proxy),
KP(in_zone_master), K(self_addr));
} else {
config_ = config;
rpc_proxy_ = rpc_proxy;
in_zone_master_ = in_zone_master;
self_addr_ = self_addr;
inited_ = true;
}
return ret;
}
int ObInZoneServerTracer::reload()
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("in zone server tracer not init", K(ret));
} else if (OB_UNLIKELY(nullptr == config_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("config_ ptr is null", K(ret), KP(config_));
} else {
loaded_ = false;
common::ObArray<ObServerWorkingDir> server_dir_array;
if (OB_FAIL(ObZoneMasterStorageUtil::get_all_server_working_dirs(
server_dir_array))) {
LOG_WARN("fail to get all server working dirs", K(ret));
} else {
SpinWLockGuard guard(maintenance_lock_);
for (int64_t i = 0; OB_SUCC(ret) && i < server_dir_array.count(); ++i) {
const ObServerWorkingDir &server_dir = server_dir_array.at(i);
if (OB_UNLIKELY(!server_dir.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(server_dir));
} else if (ObServerWorkingDir::DirStatus::NORMAL == server_dir.status_) {
bool is_exist = false;
if (OB_FAIL(inner_check_server_exist(server_dir.svr_addr_, is_exist))) {
LOG_WARN("fail to inner check server exist", K(ret),
"server", server_dir.svr_addr_);
} else if (is_exist) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("server already exist in zone server tracer", K(ret),
"server", server_dir.svr_addr_);
} else {
const int64_t now = ObTimeUtility::current_time();
const int64_t last_hb_time = server_dir.lease_end_ts_;
const bool is_pmt_f = (now - last_hb_time >= config_->server_permanent_offline_time
? true
: false);
ObInZoneServerStatus server_status;
server_status.server_ = server_dir.svr_addr_;
server_status.last_hb_time_ = last_hb_time;
server_status.in_zone_hb_status_ = (is_pmt_f
? IN_ZONE_HEARTBEAT_PERMANENT_OFFLINE
: IN_ZONE_HEARTBEAT_ACTIVE);
if (OB_FAIL(server_status_array_.push_back(server_status))) {
LOG_WARN("fail to push back server", K(ret));
}
}
} else if (ObServerWorkingDir::DirStatus::RECOVERING == server_dir.status_) {
bool is_exist = false;
if (OB_FAIL(inner_check_server_exist(server_dir.svr_addr_, is_exist))) {
LOG_WARN("fail to inner check server exist", K(ret),
"server", server_dir.svr_addr_);
} else if (is_exist) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("server already exist in zone server tracer", K(ret),
"server", server_dir.svr_addr_);
} else {
ObInZoneServerStatus server_status;
server_status.server_ = server_dir.svr_addr_;
server_status.last_hb_time_ = 0;
server_status.in_zone_hb_status_ = IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER;
if (OB_FAIL(server_status_array_.push_back(server_status))) {
LOG_WARN("fail to push back", K(ret));
}
}
} else if (ObServerWorkingDir::DirStatus::RECOVERED == server_dir.status_) {
// TODO: remove recovered server working dir on ofs
} else if (ObServerWorkingDir::DirStatus::TEMPORARY == server_dir.status_) {
if (OB_FAIL(ObZoneMasterStorageUtil::clear_tmp_server_working_dir(server_dir))) {
LOG_WARN("fail to clear tmp server working dir", K(ret));
}
} else {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected server dir status", K(ret), K(server_dir));
}
}
}
if (OB_SUCC(ret)) {
loaded_ = true;
}
}
return ret;
}
int ObInZoneServerTracer::get_servers_takenover_by_in_zone_master(
common::ObIArray<common::ObAddr> &servers_takenover_by_in_zone_master) const
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer canceled", K(ret));
} else {
servers_takenover_by_in_zone_master.reset();
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0; OB_SUCC(ret) && i < server_status_array_.count(); ++i) {
const ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinRLockGuard inner_guard(server_status.lock_);
if (IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER != server_status.in_zone_hb_status_) {
// bypass
} else if (OB_FAIL(servers_takenover_by_in_zone_master.push_back(
server_status.get_server()))) {
LOG_WARN("fail to push back", K(ret));
}
}
}
return ret;
}
int ObInZoneServerTracer::get_active_servers(
common::ObIArray<common::ObAddr> &active_servers) const
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer canceled", K(ret));
} else {
active_servers.reset();
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0; OB_SUCC(ret) && i < server_status_array_.count(); ++i) {
const ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinRLockGuard inner_guard(server_status.lock_);
if (IN_ZONE_HEARTBEAT_ACTIVE != server_status.in_zone_hb_status_) {
// bypass
} else if (OB_FAIL(active_servers.push_back(server_status.get_server()))) {
LOG_WARN("fail to push back", K(ret));
}
}
}
return ret;
}
int ObInZoneServerTracer::check_server_active(
const common::ObAddr &server,
bool &is_active) const
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer canceled", K(ret));
} else {
bool find = false;
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0;
OB_SUCC(ret) && !find && i < server_status_array_.count();
++i) {
const ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinRLockGuard inner_guard(server_status.lock_);
if (server != server_status.get_server()) {
// bypass
} else if (IN_ZONE_HEARTBEAT_ACTIVE != server_status.in_zone_hb_status_) {
is_active = false;
find = true;
} else {
is_active = true;
find = true;
}
}
if (OB_SUCC(ret) && !find) {
// when server not exist, treat it as inactive
is_active = false;
}
}
return ret;
}
int ObInZoneServerTracer::check_server_beyond_permanent_offline(
const common::ObAddr &server,
bool &beyond_permanent_offline) const
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer canceled", K(ret));
} else {
bool find = false;
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0;
OB_SUCC(ret) && !find && i < server_status_array_.count();
++i) {
const ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinRLockGuard inner_guard(server_status.lock_);
if (server != server_status.get_server()) {
// bypass
} else if (IN_ZONE_HEARTBEAT_PERMANENT_OFFLINE == server_status.in_zone_hb_status_
|| IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER == server_status.in_zone_hb_status_) {
beyond_permanent_offline = true;
find = true;
} else {
beyond_permanent_offline = false;
find = true;
}
}
if (OB_SUCC(ret) && !find) {
beyond_permanent_offline = true;
}
}
return ret;
}
int ObInZoneServerTracer::inner_check_server_exist(
const common::ObAddr &server,
bool &exist)
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server not in service", K(ret));
} else {
exist = false;
for (int64_t i = 0;
OB_SUCC(ret) && !exist && i < server_status_array_.count();
++i) {
const ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinRLockGuard inner_guard(server_status.lock_);
if (server != server_status.get_server()) {
// bypass
} else {
exist = true;
}
}
}
return ret;
}
int ObInZoneServerTracer::check_server_exist(
const common::ObAddr &server,
bool &exist)
{
int ret = OB_SUCCESS;
SpinRLockGuard guard(maintenance_lock_);
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer not in service", K(ret));
} else if (OB_FAIL(inner_check_server_exist(server, exist))) {
LOG_WARN("fail to inner check server exist", K(ret), K(server));
}
return ret;
}
int ObInZoneServerTracer::check_servers()
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer not in service", K(ret));
} else if (OB_UNLIKELY(nullptr == config_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("config ptr is null", K(ret));
} else {
const int64_t now = common::ObTimeUtility::current_time();
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0; OB_SUCC(ret) && i < server_status_array_.count(); ++i) {
ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinWLockGuard item_guard(server_status.lock_);
const int64_t last_hb_time = server_status.last_hb_time_;
InZoneHeartBeatStatus in_zone_hb_status = server_status.in_zone_hb_status_;
if (now - last_hb_time >= config_->lease_time) {
in_zone_hb_status = IN_ZONE_HEARTBEAT_LEASE_EXPIRED;
}
if (now - last_hb_time >= config_->server_permanent_offline_time) {
in_zone_hb_status = IN_ZONE_HEARTBEAT_PERMANENT_OFFLINE;
}
if (in_zone_hb_status != server_status.in_zone_hb_status_) {
if (IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER == server_status.in_zone_hb_status_) {
// already taken over by in zone master, ignore it
} else {
LOG_INFO("server hb status change", "server", server_status.server_,
"from_hb_status", server_status.in_zone_hb_status_,
"to_hb_status", in_zone_hb_status);
server_status.in_zone_hb_status_ = in_zone_hb_status;
}
} else if (in_zone_hb_status == IN_ZONE_HEARTBEAT_PERMANENT_OFFLINE) {
if (now - last_hb_time > ObLeaseRequest::RS_TAKENOVER_OBS_INTERVAL + config_->lease_time) {
LOG_INFO("server malfunction, in zone master start to take over it",
"server", server_status.server_, K(now));
if (OB_FAIL(in_zone_master_->on_server_takenover_by_in_zone_master(
server_status.server_))) {
LOG_WARN("fail to commit server takenover by in zone master task", K(ret));
} else {
LOG_INFO("succeed to commit server takenover by in zone master task", K(ret));
}
}
}
}
}
return ret;
}
int ObInZoneServerTracer::modify_permanent_offline_server_dir(
const common::ObAddr &server)
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer not in service", K(ret));
} else if (OB_UNLIKELY(!server.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(server));
} else {
ObServerWorkingDir svr_working_dir;
svr_working_dir.svr_addr_ = server;
svr_working_dir.status_ = ObServerWorkingDir::DirStatus::RECOVERING;
if (OB_FAIL(ObZoneMasterStorageUtil::try_recovering_server_working_dir(svr_working_dir))) {
LOG_WARN("fail to try recovering server working dir", K(ret));
}
}
return ret;
}
int ObInZoneServerTracer::takeover_permanent_offline_server(
const common::ObAddr &server)
{
int ret = OB_SUCCESS;
bool exist = false;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer not in service", K(ret));
} else if (OB_UNLIKELY(!server.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(server));
} else if (OB_FAIL(check_server_exist(server, exist))) {
LOG_WARN("fail to check server exist", K(ret));
} else if (!exist) {
ret = OB_STATE_NOT_MATCH;
LOG_WARN("server not exist", K(ret), K(server));
} else {
SpinRLockGuard guard(maintenance_lock_);
for (int64_t i = 0; OB_SUCC(ret) && i < server_status_array_.count(); ++i) {
ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinWLockGuard inner_guard(server_status.lock_);
if (server_status.server_ != server) {
// bypass, not this server
} else if (IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER == server_status.in_zone_hb_status_) {
// bypass, maybe already process by previos task
} else if (IN_ZONE_HEARTBEAT_PERMANENT_OFFLINE != server_status.in_zone_hb_status_) {
ret = OB_STATE_NOT_MATCH;
LOG_WARN("may by modified by others", K(ret), K(server));
} else if (OB_FAIL(modify_permanent_offline_server_dir(server))) {
LOG_WARN("fail to do modify permanent offline server dir", K(ret));
} else {
server_status.in_zone_hb_status_ = IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER;
}
}
}
return ret;
}
int ObInZoneServerTracer::inner_import_in_zone_server(
const ObInZoneHbRequest &in_zone_hb_request,
ObInZoneHbResponse &in_zone_hb_response)
{
int ret = OB_SUCCESS;
bool exist = false;
ObServerWorkingDir server_dir;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server tracer not in service", K(ret));
} else if (OB_UNLIKELY(!in_zone_hb_request.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(in_zone_hb_request));
} else if (OB_UNLIKELY(nullptr == config_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("config_ ptr is null", K(ret));
} else if (OB_FAIL(inner_check_server_exist(
in_zone_hb_request.server_, exist))) {
LOG_WARN("fail to inner check server exist", K(ret),
"server", in_zone_hb_request.server_);
} else if (exist) {
ret = OB_STATE_NOT_MATCH;
LOG_WARN("server already exist", K(ret));
} else if (OB_FAIL(ObZoneMasterStorageUtil::create_server_working_dir(
in_zone_hb_request.server_, 0/*start lease ts*/, 0/*end lease ts*/, server_dir))) {
LOG_WARN("fail to create server working dir", K(ret));
} else {
const int64_t now = common::ObTimeUtility::current_time();
ObInZoneServerStatus server_status;
server_status.server_ = in_zone_hb_request.server_;
server_status.last_hb_time_ = now;
server_status.in_zone_hb_status_ = IN_ZONE_HEARTBEAT_ACTIVE;
if (OB_FAIL(server_status_array_.push_back(server_status))) {
LOG_WARN("fail to push back", K(ret));
} else if (OB_FAIL(inner_receive_in_zone_heartbeat(
in_zone_hb_request, in_zone_hb_response))) {
LOG_WARN("fail to inner receive in zone heartbeat", K(ret));
}
}
return ret;
}
int ObInZoneServerTracer::inner_receive_in_zone_heartbeat(
const ObInZoneHbRequest &in_zone_hb_request,
ObInZoneHbResponse &in_zone_hb_response)
{
int ret = OB_SUCCESS;
bool exist = false;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("in zone server not in service", K(ret));
} else if (OB_FAIL(inner_check_server_exist(
in_zone_hb_request.server_, exist))) {
LOG_WARN("fail to inner check server exist", K(ret),
"server", in_zone_hb_request.server_);
} else if (!exist) {
ret = OB_STATE_NOT_MATCH;
LOG_WARN("server");
} else if (OB_UNLIKELY(nullptr == config_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("config ptr is null", K(ret));
} else {
const common::ObAddr &server = in_zone_hb_request.server_;
for (int64_t i = 0;
OB_SUCC(ret) && i < server_status_array_.count();
++i) {
ObInZoneServerStatus &server_status = server_status_array_.at(i);
SpinWLockGuard inner_guard(server_status.lock_);
const int64_t now = ObTimeUtility::current_time();
if (server != server_status.server_) {
// bypass
} else if (IN_ZONE_HEARTBEAT_TAKENOVER_BY_MASTER
== server_status.in_zone_hb_status_) {
// do not serve the heartbeat for the server which is taken over by in zone master,
// set to hb_expire_time to 0
in_zone_hb_response.in_zone_hb_expire_time_ = 0;
} else {
server_status.last_hb_time_ = now;
server_status.in_zone_hb_status_ = IN_ZONE_HEARTBEAT_ACTIVE;
in_zone_hb_response.in_zone_hb_expire_time_ = now + config_->lease_time;
}
}
}
return ret;
}
int ObInZoneServerTracer::receive_in_zone_heartbeat(
const ObInZoneHbRequest &in_zone_hb_request,
ObInZoneHbResponse &in_zone_hb_response)
{
int ret = OB_SUCCESS;
const common::ObAddr &server = in_zone_hb_request.server_;
if (OB_UNLIKELY(!inited_ || !loaded_)) {
ret = OB_CANCELED;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!server.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(in_zone_hb_request));
} else {
bool exist = false;
{
SpinRLockGuard guard(maintenance_lock_);
if (OB_FAIL(inner_check_server_exist(server, exist))) {
LOG_WARN("fail to inner check server exist", K(ret), K(server));
}
}
if (OB_SUCC(ret)) {
if (exist) {
SpinRLockGuard guard(maintenance_lock_);
if (OB_FAIL(inner_receive_in_zone_heartbeat(
in_zone_hb_request, in_zone_hb_response))) {
LOG_WARN("fail to inner receive in zone heartbeat",
K(ret), K(in_zone_hb_request));
}
} else {
SpinWLockGuard guard(maintenance_lock_);
if (OB_FAIL(inner_import_in_zone_server(
in_zone_hb_request, in_zone_hb_response))) {
LOG_WARN("fail to inner import in zone server",
K(ret), K(in_zone_hb_request));
}
}
}
}
return ret;
}
// ============================ InZoneHeartBeatChecker =============================
int ObInZoneHeartbeatChecker::init(
ObInZoneServerTracer &in_zone_server_tracer)
{
int ret = OB_SUCCESS;
static const int64_t heartbeat_checker_thread_cnt = 1;
if (OB_UNLIKELY(inited_)) {
ret = OB_INIT_TWICE;
LOG_WARN("heart beat checker has already been inited", K(ret));
} else if (OB_FAIL(create(heartbeat_checker_thread_cnt, "InZoneHbChecker"))) {
LOG_WARN("create heartbeat checker thread failed",
K(ret), K(heartbeat_checker_thread_cnt));
} else {
in_zone_server_tracer_ = &in_zone_server_tracer;
inited_ = true;
}
return ret;
}
void ObInZoneHeartbeatChecker::run3()
{
if (!inited_) {
int tmp_ret = OB_NOT_INIT;
LOG_WARN("In zone heart beat checker has not inited", "ret", tmp_ret);
} else {
LOG_INFO("In zone heartbeat checker start");
while (!stop_) {
LOG_TRACE("begin check in zone server heartbeat");
int tmp_ret = in_zone_server_tracer_->check_servers();
if (OB_SUCCESS != tmp_ret) {
LOG_WARN("server managers check servers failed", "ret", tmp_ret);
}
for (int64_t i = 0; !stop_ && i < CHECK_INTERVAL_TIMES; ++i) {
usleep(CHECK_INTERVAL_US);
}
}
LOG_INFO("in zone heartbeat checker stop");
}
}
}//end namespace rootserver
}//end namespace oceanbase
#endif
|
grahambates/loopback-component-jsonapi
|
lib/update.js
|
<filename>lib/update.js
'use strict'
var utils = require('./utils')
module.exports = function (app, options) {
var remotes = app.remotes()
remotes.after('**', function (ctx, next) {
if (utils.shouldNotApplyJsonApi(ctx, options)) {
return next()
}
if (ctx.method.name === 'updateAttributes') {
// remote links object from resource response
delete ctx.result.links
}
next()
})
}
|
decilio4g/delicias-do-tchelo
|
node_modules/@styled-icons/material-rounded/LockOpen/LockOpen.js
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var styled_icon_1 = require("@styled-icons/styled-icon");
exports.LockOpen = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
"xmlns": "http://www.w3.org/2000/svg",
};
return (React.createElement(styled_icon_1.StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 24 24" }, props, { ref: ref }),
React.createElement("path", { fill: "none", d: "M0 0h24v24H0V0z", key: "k0" }),
React.createElement("path", { d: "M12 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6-5h-1V6c0-2.76-2.24-5-5-5-2.28 0-4.27 1.54-4.84 3.75-.14.54.18 1.08.72 1.22a1 1 0 001.22-.72A2.996 2.996 0 0112 3c1.65 0 3 1.35 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 11c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-8c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v8z", key: "k1" })));
});
exports.LockOpen.displayName = 'LockOpen';
exports.LockOpenDimensions = { height: 24, width: 24 };
|
officialrafsan/CppDroid
|
tutorials/learncpp.com#1.0#1/operator_overloading/shallow_vs._deep_copying/source8.cpp
|
// Copy constructor
MyString::MyString(const MyString& cSource)
{
// because m_nLength is not a pointer, we can shallow copy it
m_nLength = cSource.m_nLength;
// m_pchString is a pointer, so we need to deep copy it if it is non-null
if (cSource.m_pchString)
{
// allocate memory for our copy
m_pchString = new char[m_nLength];
// Copy the string into our newly allocated memory
strncpy(m_pchString, cSource.m_pchString, m_nLength);
}
else
m_pchString = 0;
}
|
Cassiobsk8/TestMod3
|
src/main/java/choonster/testmod3/capability/hiddenblockrevealer/CapabilityHiddenBlockRevealer.java
|
<reponame>Cassiobsk8/TestMod3
package choonster.testmod3.capability.hiddenblockrevealer;
import choonster.testmod3.TestMod3;
import choonster.testmod3.api.capability.hiddenblockrevealer.IHiddenBlockRevealer;
import choonster.testmod3.capability.CapabilityContainerListenerManager;
import choonster.testmod3.item.IItemPropertyGetterFix;
import choonster.testmod3.util.CapabilityUtils;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import javax.annotation.Nullable;
import java.util.Optional;
import static choonster.testmod3.util.InjectionUtil.Null;
/**
* Items with this capability reveal hidden blocks.
*
* @author Choonster
*/
public final class CapabilityHiddenBlockRevealer {
/**
* The {@link Capability} instance.
*/
@CapabilityInject(IHiddenBlockRevealer.class)
public static final Capability<IHiddenBlockRevealer> HIDDEN_BLOCK_REVEALER_CAPABILITY = Null();
/**
* The default {@link EnumFacing} to use for this capability.
*/
public static final EnumFacing DEFAULT_FACING = null;
/**
* The ID of this capability.
*/
private static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "hidden_block_revealer");
public static void register() {
CapabilityManager.INSTANCE.register(IHiddenBlockRevealer.class, new Capability.IStorage<IHiddenBlockRevealer>() {
@Override
public NBTBase writeNBT(final Capability<IHiddenBlockRevealer> capability, final IHiddenBlockRevealer instance, final EnumFacing side) {
final NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setBoolean("RevealHiddenBlocks", instance.revealHiddenBlocks());
return tagCompound;
}
@Override
public void readNBT(final Capability<IHiddenBlockRevealer> capability, final IHiddenBlockRevealer instance, final EnumFacing side, final NBTBase nbt) {
final NBTTagCompound tagCompound = (NBTTagCompound) nbt;
instance.setRevealHiddenBlocks(tagCompound.getBoolean("RevealHiddenBlocks"));
}
}, HiddenBlockRevealer::new
);
CapabilityContainerListenerManager.registerListenerFactory(ContainerListenerHiddenBlockRevealer::new);
}
/**
* Get the {@link IHiddenBlockRevealer} for the {@link ItemStack}, if any.
*
* @param stack The ItemStack
* @return The IHiddenBlockRevealer for the {@link ItemStack}, if any
*/
@Nullable
public static IHiddenBlockRevealer getHiddenBlockRevealer(final ItemStack stack) {
return CapabilityUtils.getCapability(stack, HIDDEN_BLOCK_REVEALER_CAPABILITY, DEFAULT_FACING);
}
/**
* Toggle the reveal state of the player's held {@link IHiddenBlockRevealer}.
*
* @param stack The ItemStack
* @return The new reveal state, or empty if there is no IHiddenBlockRevealer
*/
public static Optional<Boolean> toggleRevealHiddenBlocks(final ItemStack stack) {
final IHiddenBlockRevealer hiddenBlockRevealer = getHiddenBlockRevealer(stack);
if (hiddenBlockRevealer != null) {
final boolean revealHiddenBlocks = !hiddenBlockRevealer.revealHiddenBlocks();
hiddenBlockRevealer.setRevealHiddenBlocks(revealHiddenBlocks);
return Optional.of(revealHiddenBlocks);
}
return Optional.empty();
}
/**
* {@link IItemPropertyGetter} to get whether hidden blocks are being revealed.
*/
public static class RevealHiddenBlocksGetter {
/**
* The ID of this getter.
*/
private static final ResourceLocation ID = new ResourceLocation(TestMod3.MODID, "reveal_hidden_blocks");
/**
* The getter.
*/
private static final IItemPropertyGetter GETTER = IItemPropertyGetterFix.create((stack, worldIn, entityIn) -> {
final IHiddenBlockRevealer hiddenBlockRevealer = CapabilityHiddenBlockRevealer.getHiddenBlockRevealer(stack);
return hiddenBlockRevealer != null && hiddenBlockRevealer.revealHiddenBlocks() ? 1 : 0;
});
/**
* Add this getter to an {@link Item}.
*
* @param item The item
*/
public static void addToItem(final Item item) {
item.addPropertyOverride(ID, GETTER);
}
}
}
|
OpenBoxProject/ml-temp
|
src/main/java/org/moonlightcontroller/registry/RegisteredBoxApplication.java
|
package org.moonlightcontroller.registry;
import org.moonlightcontroller.bal.BoxApplication;
public class RegisteredBoxApplication {
private String name;
private String jarName;
private BoxApplication application;
public RegisteredBoxApplication(String jarName, BoxApplication application) {
this.name = application.getName();
this.jarName = jarName;
this.application = application;
}
public String getName() {
return name;
}
public String getJarName() {
return jarName;
}
public BoxApplication getApplication() {
return application;
}
}
|
zuwome/kongxia
|
kongxia/Views/User/order/detail/ZZTimelineCell.h
|
//
// ZZTimelineCell.h
// zuwome
//
// Created by wlsy on 16/1/21.
// Copyright © 2016年 zz. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ZZMessage;
@interface ZZTimelineCell : UITableViewCell
@property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) UIImageView *cycleImgView;
@property (nonatomic, strong) UIView *cycleView;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *infoLabel;
@property (nonatomic, strong) ZZMessage *message;
- (void)setMessage:(ZZMessage *)message indexPath:(NSIndexPath *)indexPath count:(NSInteger)count;
@end
|
nguyenducdat99/Nextrend
|
packages/gatsby-woocommerce-theme/src/components/blog-detail/MainContent/index.js
|
import React from "react";
import CommentIcon from "../../icons/CommentIcon";
import "./styles.scss";
function MainContent({ post, width }) {
return (
<div className='content-blog editor-styles-wrapper'>
<div className='blog-detail-header-title'>
<h1 className='blog-title'>{post.title}</h1>
<div className='post d-flex align-items-center justify-content-center'>
<div className='post-info-container'>
<span className='author post-info'>by {post.author.node.name}</span>
<span className='date post-info'>{post.date}</span>
<div className='comment d-flex align-items-center post-info'>
<span className='icon icon-comment'>
<CommentIcon color='#999999' />
</span>
<span className='total-comment'>0 comment</span>
</div>
</div>
</div>
</div>
{width > 575 && <hr />}
<p
dangerouslySetInnerHTML={{
__html: post.content,
}}
className='portfolio-content'
/>
</div>
);
}
export default MainContent;
|
sug0/Charm
|
src/main/java/svenhjol/charm/tweaks/module/RemovePotionGlint.java
|
<filename>src/main/java/svenhjol/charm/tweaks/module/RemovePotionGlint.java
package svenhjol.charm.tweaks.module;
import svenhjol.charm.Charm;
import svenhjol.charm.base.CharmCategories;
import svenhjol.meson.MesonModule;
import svenhjol.meson.iface.Module;
@Module(mod = Charm.MOD_ID, category = CharmCategories.TWEAKS,
description = "Removes the potion enchantment glint so you can see what the potion color is.")
public class RemovePotionGlint extends MesonModule {
}
|
Javorov1103/SoftUni-Course
|
Software Technologies/0. TeamworkBlog/scripts/VeiwFunctions.js
|
<filename>Software Technologies/0. TeamworkBlog/scripts/VeiwFunctions.js
function showVeiw() {
$("#veiwLogin").hide();
$("#veiwRegister").hide();
$("#veiwNewPost").hide();
clearInputs ()
}
function clearInputs () {
$('#confirmPassword').val('');
$('#registerPass').val('');
$('#fullName').val('');
$('#registerUser').val('');
$('#loginUser').val('');
$('#loginPass').val('');
$('#title').val('')
}
function showHideMenuLinks() {
$('#linkHome').show();
if (sessionStorage.getItem('authToken')== null){
$("#linkLogin").show();
$("#linkRegister").show();
$("#linkNewPost").hide();
$("#linkLogout").hide();
}
else{
$("#linkLogin").hide();
$("#linkRegister").hide();
if(sessionStorage.getItem('username') == 'admin') {
$("#linkNewPost").show();
} else {
$("#linkNewPost").hide();
}
$("#linkLogout").show();
}
if(sessionStorage.getItem('username') == 'admin') {
$(".button-edit-post").show();
}
}
$(function (){
showHideMenuLinks();
showVeiw()
$("#linkHome").click(function(){$("#veiwHome").show();
$("#veiwRegister").hide();
$("#veiwNewPost").hide();
$("#veiwLogin").hide();
clearInputs ()
});
$("#linkLogin").click(function(){$("#veiwLogin").show();
$("#veiwHome").hide();
$("#veiwRegister").hide();
$("#veiwNewPost").hide();
clearInputs ()
});
$("#linkRegister").click(function(){$("#veiwRegister").show();
$("#veiwHome").hide();
$("#veiwLogin").hide();
$("#veiwNewPost").hide();
clearInputs ()
});
$("#linkNewPost").click(function(){$("#veiwNewPost").show();
$("#veiwHome").hide();
clearInputs ()
});
$("#linkLogout").click(function(){$("#veiwHome").show();
$("#veiwNewPost").hide();
sessionStorage.clear();
showHideMenuLinks();
showErrorBox("LOGOUT");
clearInputs ()
});
$("#linkLogin2").click(function(){$("#veiwLogin").show();
$("#veiwHome").hide();
$("#veiwRegister").hide();
$("#veiwNewPost").hide();
clearInputs ()
});
$("#linkRegister2").click(function(){$("#veiwRegister").show();
$("#veiwHome").hide();
$("#veiwLogin").hide();
$("#veiwNewPost").hide();
clearInputs ()
});
})
|
FabrizioKruisland/seriesGuide
|
SeriesGuide/build/generated/source/apt/amazon/debug/com/battlelancer/seriesguide/loaders/ShowCreditsLoader_MembersInjector.java
|
<filename>SeriesGuide/build/generated/source/apt/amazon/debug/com/battlelancer/seriesguide/loaders/ShowCreditsLoader_MembersInjector.java<gh_stars>1-10
// Generated by dagger.internal.codegen.ComponentProcessor (https://google.github.io/dagger).
package com.battlelancer.seriesguide.loaders;
import com.uwetrottmann.tmdb2.services.FindService;
import com.uwetrottmann.tmdb2.services.TvService;
import dagger.MembersInjector;
import dagger.internal.DoubleCheck;
import javax.inject.Provider;
public final class ShowCreditsLoader_MembersInjector implements MembersInjector<ShowCreditsLoader> {
private final Provider<FindService> findServiceProvider;
private final Provider<TvService> tvServiceProvider;
public ShowCreditsLoader_MembersInjector(
Provider<FindService> findServiceProvider, Provider<TvService> tvServiceProvider) {
assert findServiceProvider != null;
this.findServiceProvider = findServiceProvider;
assert tvServiceProvider != null;
this.tvServiceProvider = tvServiceProvider;
}
public static MembersInjector<ShowCreditsLoader> create(
Provider<FindService> findServiceProvider, Provider<TvService> tvServiceProvider) {
return new ShowCreditsLoader_MembersInjector(findServiceProvider, tvServiceProvider);
}
@Override
public void injectMembers(ShowCreditsLoader instance) {
if (instance == null) {
throw new NullPointerException("Cannot inject members into a null reference");
}
instance.findService = DoubleCheck.lazy(findServiceProvider);
instance.tvService = DoubleCheck.lazy(tvServiceProvider);
}
public static void injectFindService(
ShowCreditsLoader instance, Provider<FindService> findServiceProvider) {
instance.findService = DoubleCheck.lazy(findServiceProvider);
}
public static void injectTvService(
ShowCreditsLoader instance, Provider<TvService> tvServiceProvider) {
instance.tvService = DoubleCheck.lazy(tvServiceProvider);
}
}
|
mirecmrozek/verejne.digital
|
client/src/dataProviders/dataProvidersUtils.js
|
// @flow
import {receiveData} from '../actions/sharedActions'
import type {Dispatch, Path} from '../types/reduxTypes'
// helper to be used with data-provider
export const dispatchReceivedData = (
path: Path,
mappingFn: (Array<Object> | Object) => Object,
...mappingFnArgs: Array<any>
) => (ref: string, data: Array<Object> | Object, dispatch: Dispatch) => {
dispatch(receiveData(path, data, ref, mappingFn, ...mappingFnArgs))
}
|
plucena/loja1
|
src/main/java/net/mybluemix/dao/FornecedorDAO.java
|
package net.mybluemix.dao;
import java.util.List;
import javax.persistence.EntityTransaction;
import javax.persistence.TypedQuery;
import javax.ws.rs.GET;
import net.mybluemix.entity.Fornecedor;
import net.mybluemix.entity.MateriaPrima;
public class FornecedorDAO extends BaseDAO{
public FornecedorDAO() {
super(Fornecedor.class);
// TODO Auto-generated constructor stub
}
public List<Fornecedor> findAll(){
return this.createQuery("Select a From Fornecedor a", Fornecedor.class);
}
public Fornecedor find(String cnpj) {
TypedQuery<Fornecedor> query = manager.createQuery(
"SELECT c FROM Fornecedor c WHERE c.cnpj = :cnpj", Fornecedor.class);
return query.setParameter("cnpj", cnpj).getSingleResult();
}
public void update(Fornecedor f, String key) throws Exception {
EntityTransaction tx = manager.getTransaction();
tx.begin();
Fornecedor fbd = manager.find(Fornecedor.class, key);
fbd.update(f);
tx.commit();
}
}
|
sharekey/react-native-navigation
|
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewVisibilityListenerAdapter.java
|
<gh_stars>1000+
package com.reactnativenavigation.viewcontrollers.viewcontroller;
import android.view.View;
public class ViewVisibilityListenerAdapter implements ViewController.ViewVisibilityListener {
@Override
public boolean onViewAppeared(View view) {
return false;
}
@Override
public boolean onViewDisappear(View view) {
return false;
}
}
|
TomMD/AIPlatform
|
src/main/java/io/bugsbunny/dashboard/endpoint/Dashboard.java
|
<gh_stars>0
package io.bugsbunny.dashboard.endpoint;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import io.bugsbunny.dashboard.service.ModelTrafficService;
import io.bugsbunny.data.history.service.PayloadReplayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.Map;
@Path("dashboard")
public class Dashboard {
private static Logger logger = LoggerFactory.getLogger(Dashboard.class);
@Inject
private ModelTrafficService modelTrafficService;
@Path("modelTraffic")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response modelTraffic()
{
Map<String, List<JsonObject>> modelTraffic = this.modelTrafficService.getModelTraffic("us", "bugsbunny");
return Response.ok(modelTraffic.toString()).build();
}
}
|
passeride/TopdownFunTown
|
src/com/bluebook/util/GameObject.java
|
package com.bluebook.util;
import com.bluebook.engine.GameEngine;
import com.bluebook.graphics.Sprite;
import com.bluebook.physics.Collider;
import com.bluebook.renderer.CanvasRenderer;
import com.bluebook.renderer.GraphicsRenderer;
import com.bluebook.renderer.RenderLayer;
import javafx.scene.canvas.GraphicsContext;
/**
* {@link GameObject} is the abstract class to be used for everything that should be renderer
*/
public abstract class GameObject {
protected Vec2 position;
protected Vec2 direction;
protected Vec2 size;
protected boolean allwaysOnScreen = false;
protected Transform transform;
protected Sprite sprite;
boolean isAlive = true;
protected Collider collider;
/**
* Constructor for GameObject given position rotation and sprite
*/
public GameObject(Vec2 position, Vec2 direction, Sprite sprite) {
this.position = position;
this.direction = direction;
this.sprite = sprite;
transform = new Transform();
transform.setLocalPosition(position);
transform.setLocalRotation(direction);
transform.setLocalScale(new Vec2(1, 1));
if (sprite != null) {
this.sprite.setOrigin(transform);
}
if (sprite != null) {
this.size = new Vec2(sprite.getSquareWidth(), sprite.getSquareHeight());
}
CanvasRenderer.getInstance().addGameObject(this);
GameEngine.getInstance().addGameObject(this);
}
/**
* Used to draw GameObject on canvas
*/
public void draw(GraphicsContext gc) {
if (sprite != null) {
sprite.draw(gc, transform.getGlobalPosition(), transform.getGlobalRotation());
}
}
public void draw(GraphicsRenderer gr) {
if (sprite != null) {
sprite.draw(gr);
}
}
public boolean isOnScreen() {
if (allwaysOnScreen) {
return true;
}
Vec2 screen = GameSettings.getScreen();
Vec2 position = transform.getGlobalPosition();
return (position.getX() < screen.getX() + 128 && position.getX() > -128
&& position.getY() < screen.getY() + 128 && position.getY() > -128);
}
/**
* Used for objects that need to get the update tick, they can override this function
*/
public void update(double delta) {
}
/**
* Will move this vector relative to it's own (1,0) will move it one in x axis
*/
public void translate(Vec2 moveVector) {
transform.translate(moveVector);
}
/**
* Will change direction to point at given position
*/
public void lookAt(Vec2 lookPosition) {
transform.setLocalRotation(Vec2.Vector2FromAngleInDegrees(
Vec2.getAngleBetweenInDegrees(transform.getLocalPosition(), lookPosition) + 90));
}
/**
* Used to destroy gameobject, important to call this
*/
public void destroy() {
if (collider != null) {
collider.destroy();
}
CanvasRenderer.getInstance().removeGameObject(this);
GameEngine.getInstance().removeGameObject(this);
isAlive = false;
}
/**
* Will change the renderlayer of the object t
*
* @param layer {@link com.bluebook.renderer.RenderLayer.RenderLayerName} to be used
*/
public void setRenderLayer(RenderLayer.RenderLayerName layer) {
CanvasRenderer.getInstance().moveGameObjectToLayer(this, layer);
}
public boolean isAlive() {
return isAlive;
}
public void setAlive(boolean alive) {
isAlive = alive;
}
public Vec2 getPosition() {
return transform.getLocalPosition();
}
public void setPosition(Vec2 position) {
transform.setLocalPosition(position);
}
public Vec2 getDirection() {
return transform.getLocalRotation();
}
public void setDirection(Vec2 direction) {
transform.setLocalRotation(direction.getNormalizedVector());
}
public Sprite getSprite() {
return sprite;
}
public void setSprite(Sprite sprite) {
this.sprite = sprite;
this.sprite.setOrigin(transform);
this.size = new Vec2(sprite.getSquareWidth(), sprite.getSquareHeight());
}
public Vec2 getScale() {
return transform.getLocalScale();
}
public Vec2 getScaledSize() {
return transform.getLocalScale();
}
/**
* Will return a value from 0 -> 1.0 that is the relative X position on the screen
*/
public double getProcentageXPosition() {
return transform.getGlobalPosition().getX() / GameSettings.getInt("game_resolution_X");
}
public void setSize(Vec2 scale) {
transform.setLocalScale(scale);
}
public Collider getCollider() {
return this.collider;
}
public void setCollider(Collider collider) {
this.collider = collider;
collider.attachToGameObject(this);
}
public Transform getTransform() {
return transform;
}
public void setTransform(Transform transform) {
this.transform = transform;
}
}
|
ValaaLabs/valaa-stack
|
src/valaa-core/schema/Data.js
|
<reponame>ValaaLabs/valaa-stack<filename>src/valaa-core/schema/Data.js
// @flow
import { GraphQLInterfaceType, GraphQLID, GraphQLNonNull, GraphQLString } from "graphql/type";
import generatedField from "~/valaa-core/tools/graphql/generatedField";
import contentHashResolver from "~/valaa-core/tools/graphql/contentHashResolver";
import { dataTypeResolver } from "~/valaa-core/tools/graphql/typeResolver";
import dataFieldValue from "~/valaa-core/tools/denormalized/dataFieldValue";
const INTERFACE_DESCRIPTION = "data";
// TODO(iridian): Implement Data referentiality by Decree that Data objects with Resource
// references must always have an id. See below for more.
export function dataInterface (objectDescription: string = INTERFACE_DESCRIPTION) {
return {
name: "Data",
description: `A transient, stateless, content-hash-identified ${objectDescription} object.
With no first class identity and state it cannot be mutated or destroyed. Any changes require
creation of new Data objects and mutation of Resource's that contain them.`,
fields: () => ({
...generatedField("id", new GraphQLNonNull(GraphQLID),
`Content-hashed uuid v5 identifier of this ${objectDescription}`,
contentHashResolver,
),
...generatedField("typeName", new GraphQLNonNull(GraphQLString),
`Type name this ${objectDescription}`,
source => dataFieldValue(source, "typeName")
),
...generatedField("contentHash", new GraphQLNonNull(GraphQLID),
`Alias for 'id' which can be used to differentiate a Data and Resource`,
contentHashResolver,
),
/* TODO(iridian): Implement data reference fields.
* This way we could have three paired shadowField list couplings:
* Data.referredDatas <-> Data.referringDatas
* Data.referredResources <-> Resource.referringDatas
* Resource.referredDatas <-> Data.referringResources
* shadowField couplings are
* 1. derivative: not considered part of the Data identity proper and not factored in in the
* Data id generation. This allows them to change.
* 2. contextual: not globally comprehensive in time or space. They are not guaranteed to
* list absolutely every possible coupling, only those which are known in
* context. This context is defined by interactions with the local front-end
* Prophet.
* This allows shadow-lists to change locally in given Prophet when references known to that
* Prophet are being created and destroyed.
* The referredResources is transitive by referredDatas: if Data A has a referred Data B, and
* B has a referred Resource R, then A also will have referred Resource R. This allows the
* full Data graph be mapped out with a single kuery without recursion.
* For example, take the following MODIFIED:
* modified({ id, typeName: "MyResource", { sets: {
* myResourceData: { myDataSubData: { subDataTargetResource: myResourceId } } }
* } });
* Two Data are specified as expanded objects, inner one containing subDataTargetResource and
* outer one containing myDataSubData. But because recursively both contain a Resource
* reference in myResourceId, both of these would be consolidated and given an id.
* Also, _both_ consolidated Data objects would contain myResourceId in their
* Data.referredResources and thus conversely myResourceId:Resource.referringDatas will
* contain both Data id's. Thus a simple kuery:
* vMyResource.get(
* VALK.to("referringDatas")
* .select({ "id": "id", "referringResources": "referringResources",
* referringDatas": ["referringDatas", "id"] })
* );
* Will nicely return all referring Data objects and their local structure as O(n*d) op.
* n is the number of incoming references and d the average (over n) depth of nested Data's.
* For most practical purposes this is O(n) (O(nlogn) if d ~ O(logn)).
...shadowField("referredDatas", new GraphQLList(Data),
`TODO(iridian): Write description`, {
shadow: true,
transitiveThrough: "referredDatas",
coupling: toMany({ coupledField: "referringDatas" }),
}
),
...shadowField("referringDatas", new GraphQLList(Data),
`TODO(iridian): Write description`, {
shadow: true,
transitiveThrough: "referringDatas",
coupling: toMany({ coupledField: "referredDatas" }),
}
),
...shadowField("referredResources", new GraphQLList(Data),
`TODO(iridian): Write description`, {
shadow: true,
type: new GraphQLList(Resource),
coupling: toMany({ coupledField: "referringDatas" }),
}
),
...shadowField("referringResources", new GraphQLList(Data),
`TODO(iridian): Write description`, {
shadow: true,
type: new GraphQLList(Resource),
coupling: toMany({ coupledField: "referredDatas" }),
}
),
*/
}),
resolveType: dataTypeResolver,
};
}
export default new GraphQLInterfaceType(dataInterface());
|
ERPShuen/ICQ1
|
gui/previewer/Previewer.cpp
|
#include "stdafx.h"
#include "Previewer.h"
#include "../main_window/MainWindow.h"
#include "../utils/InterConnector.h"
#include "../../corelib/enumerations.h"
#include "../../gui.shared/implayer.h"
#include "../utils/utils.h"
namespace
{
std::unique_ptr<QWidget> PreviewWidget_;
std::unique_ptr<QWidget> g_multimediaViewer;
}
const char* mplayer_exe = "mplayer.exe";
namespace Previewer
{
void ShowMedia(const core::file_sharing_content_type /*_contentType*/, const QString& _path)
{
if (platform::is_windows())
{
// const auto exePath = QCoreApplication::applicationFilePath();
//
// const auto forder = QFileInfo(exePath).path();
//
// const int scale = Utils::scale_value(100);
//
// const int screenNumber = Utils::InterConnector::instance().getMainWindow()->getScreen();
//
// const QString command = "\"" + forder + "/" + QString(mplayer_exe) + "\"" + QString(" /media \"") + _path + "\"" + " /scale " + QString::number(scale) + " /screen_number " + QString::number(screenNumber);
//
// QProcess::startDetached(command);
}
else
{
QUrl url = QUrl::fromLocalFile(_path);
if (!url.isLocalFile() || !platform::is_apple())
url = QUrl(QDir::fromNativeSeparators(_path));
QDesktopServices::openUrl(url);
}
}
void CloseMedia()
{
g_multimediaViewer.reset();
}
}
namespace
{
}
|
doitmovin/chromiumos-platform2
|
cromo/dummy_modem_handler.h
|
<gh_stars>1-10
// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CROMO_DUMMY_MODEM_HANDLER_H_
#define CROMO_DUMMY_MODEM_HANDLER_H_
#include <vector>
#include <base/macros.h>
#include <dbus-c++/types.h>
#include "cromo/modem_handler.h"
class CromoServer;
class DummyModemHandler : public ModemHandler {
public:
explicit DummyModemHandler(CromoServer& server); // NOLINT - refs.
virtual std::vector<DBus::Path> EnumerateDevices(
DBus::Error& error); // NOLINT - refs.
protected:
virtual bool Initialize();
private:
DISALLOW_COPY_AND_ASSIGN(DummyModemHandler);
};
#endif // CROMO_DUMMY_MODEM_HANDLER_H_
|
ascii33/platform2
|
libhwsec-foundation/status/status_chain_or.h
|
<reponame>ascii33/platform2<gh_stars>0
// Copyright 2022 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBHWSEC_FOUNDATION_STATUS_STATUS_CHAIN_OR_H_
#define LIBHWSEC_FOUNDATION_STATUS_STATUS_CHAIN_OR_H_
#include <memory>
#include <utility>
#include <variant>
#include "libhwsec-foundation/status/status_chain.h"
// Convenience class to represent value or non-ok status.
namespace hwsec_foundation {
namespace status {
template <typename _Vt, typename _Et>
class [[nodiscard]] StatusChainOr {
public:
using value_type = _Vt;
using status_type = StatusChain<_Et>;
using container_type = std::variant<value_type, status_type>;
// We don't want default constructor.
StatusChainOr() = delete;
// We don't want copy constructor.
StatusChainOr(const StatusChainOr&) = delete;
// Accept the move constructor.
StatusChainOr(StatusChainOr&& status_or)
: value_(std::move(status_or.value_)) {}
// Implicit conversion to StatusChainOr to allow transparent "return"s.
template <
typename _Ut,
typename = std::enable_if_t<std::is_constructible_v<value_type, _Ut>>>
StatusChainOr(_Ut&& v) // NOLINT(runtime/explicit)
: value_(container_type{std::in_place_type<value_type>,
std::forward<_Ut>(v)}) {}
// Constructs the inner value in-place using the provided args, using the
// `value_type(args...)` constructor.
template <
typename... Args,
typename = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
StatusChainOr(std::in_place_t, Args&&... args) // NOLINT(runtime/explicit)
: value_(container_type{std::in_place_type<value_type>,
std::forward<Args>(args)...}) {}
// Constructs the inner value in-place using the provided args, using the
// `value_type(args...)` constructor.
template <typename _Ut,
typename... Args,
typename = std::enable_if_t<
std::is_constructible_v<value_type,
std::initializer_list<_Ut>,
Args...>>>
StatusChainOr(std::in_place_t,
std::initializer_list<_Ut> ilist,
Args&&... args) // NOLINT(runtime/explicit)
: value_(container_type{std::in_place_type<value_type>, ilist,
std::forward<Args>(args)...}) {}
// Converting move constructor from a compatible stackable error type. It is
// fine, since our internal stack representation is of a base |Base| type
// anyway. SFINAE checks that the supplied pointer type is compatible with
// this object's head type. Since manually specializing the operator could
// lead to breaking invariant of the head object being castable to class
// template type |_Et|, we use |ExplicitArgumentBarrier| idiom to make |_Ut|
// auto-deducible only.
template <int&... ExplicitArgumentBarrier,
typename _Ut,
typename = std::enable_if_t<
std::is_convertible_v<_Ut*,
typename StatusChain<_Et>::pointer>>>
StatusChainOr(StatusChain<_Ut>&& other) // NOLINT(runtime/explicit)
: value_(
container_type{std::in_place_type<status_type>, std::move(other)}) {
CHECK(!std::get<status_type>(value_).ok())
<< " StatusChainOr cannot hold an OK status";
}
// We don't want copy operator.
StatusChainOr& operator=(const StatusChainOr&) = delete;
StatusChainOr& operator=(StatusChainOr&& status_or) noexcept {
value_ = std::move(status_or.value_);
return *this;
}
value_type* operator->() noexcept {
CHECK(ok()) << " Arrow operator on a non-OK StatusChainOr is not allowed";
return std::get_if<value_type>(&value_);
}
constexpr const value_type& operator*() const& {
CHECK(ok()) << " Dereferencing a non-OK StatusChainOr is not allowed";
return *std::get_if<value_type>(&value_);
}
value_type& operator*() & {
CHECK(ok()) << " Dereferencing a non-OK StatusChainOr is not allowed";
return *std::get_if<value_type>(&value_);
}
value_type&& operator*() && {
CHECK(ok()) << " Dereferencing a non-OK StatusChainOr is not allowed";
return std::move(*std::get_if<value_type>(&value_));
}
constexpr const value_type& value() const& noexcept {
CHECK(ok()) << " Get the value of a non-OK StatusChainOr is not allowed";
return *std::get_if<value_type>(&value_);
}
value_type& value() & noexcept {
CHECK(ok()) << " Get the value of a non-OK StatusChainOr is not allowed";
return *std::get_if<value_type>(&value_);
}
value_type&& value() && noexcept {
CHECK(ok()) << " Get the value of a non-OK StatusChainOr is not allowed";
return std::move(*std::get_if<value_type>(&value_));
}
bool ok() const noexcept {
return std::holds_alternative<value_type>(value_);
}
constexpr const status_type& status() const& noexcept {
if (ok()) {
return ConstRefOkStatus<_Et>();
}
return *std::get_if<status_type>(&value_);
}
status_type status() && noexcept {
if (ok()) {
return OkStatus<_Et>();
}
return std::move(*std::get_if<status_type>(&value_));
}
private:
container_type value_;
};
} // namespace status
} // namespace hwsec_foundation
#endif // LIBHWSEC_FOUNDATION_STATUS_STATUS_CHAIN_OR_H_
|
artlebedev/idea-parser3
|
main/src/ru/artlebedev/idea/plugins/parser/lang/psi/impl/ParserMethodImpl.java
|
<filename>main/src/ru/artlebedev/idea/plugins/parser/lang/psi/impl/ParserMethodImpl.java
package ru.artlebedev.idea.plugins.parser.lang.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import ru.artlebedev.idea.plugins.parser.ParserIcons;
import ru.artlebedev.idea.plugins.parser.indexer.ParserFileIndex;
import ru.artlebedev.idea.plugins.parser.lang.ParserLoader;
import ru.artlebedev.idea.plugins.parser.lang.lexer.ParserTokenTypes;
import ru.artlebedev.idea.plugins.parser.lang.psi.ParserElementVisitor;
import ru.artlebedev.idea.plugins.parser.lang.psi.ParserFile;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserClass;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserDoc;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserDocConstructorInfo;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserDocDynamicInfo;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserDocParameterInfo;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserDocResultInfo;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserMethod;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserObject;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserParameterList;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserPassedParameter;
import ru.artlebedev.idea.plugins.parser.lang.psi.api.ParserStaticClass;
import ru.artlebedev.idea.plugins.parser.lang.psi.resolve.ParserResolveUtil;
import ru.artlebedev.idea.plugins.parser.lang.stdlib.ParserStandardClasses;
import ru.artlebedev.idea.plugins.parser.util.ParserChangeUtil;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* idea-parser3: the most advanced parser3 ide.
* <p/>
* Copyright 2020 <a href="mailto:<EMAIL>"><NAME></a>
* Copyright 2011 <a href="mailto:<EMAIL>"><NAME></a>
* Copyright 2006 <a href="mailto:<EMAIL>"><NAME></a>
* Copyright 2006-2020 ArtLebedev Studio
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class ParserMethodImpl extends ParserElementImpl implements ParserMethod {
private ParserObject resultObject;
private int hasResult;
private ParserLoader parserLoader;
public ParserMethodImpl(ASTNode astNode) {
super(astNode);
parserLoader = ServiceManager.getService(ParserLoader.class);
}
public boolean isConstructor() {
if(parserLoader.getConstructorNames().contains(getName())) {
return true;
} else {
ParserDoc doc = PsiTreeUtil.getPrevSiblingOfType(this, ParserDoc.class);
while (doc != null) {
ParserDocConstructorInfo info = PsiTreeUtil.getChildOfType(doc, ParserDocConstructorInfo.class);
if (info != null) {
ParserMethod method = PsiTreeUtil.getNextSiblingOfType(doc, ParserMethod.class);
return method.getName().equals(getName());
}
doc = PsiTreeUtil.getPrevSiblingOfType(doc, ParserDoc.class);
}
}
return false;
}
public boolean isDynamic() {
if(parserLoader.getConstructorNames().contains(getName())) {
return true;
} else {
ParserDoc doc = PsiTreeUtil.getPrevSiblingOfType(this, ParserDoc.class);
while (doc != null) {
ParserDocDynamicInfo info = PsiTreeUtil.getChildOfType(doc, ParserDocDynamicInfo.class);
if (info != null) {
ParserMethod method = PsiTreeUtil.getNextSiblingOfType(doc, ParserMethod.class);
return method.getName().equals(getName());
}
doc = PsiTreeUtil.getPrevSiblingOfType(doc, ParserDoc.class);
}
}
return false;
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof ParserElementVisitor) {
((ParserElementVisitor) visitor).visitParserMethod(this);
} else {
visitor.visitElement(this);
}
}
public int getTextOffset() {
final ASTNode name = findNameNode();
return name != null ? name.getStartOffset() : super.getTextOffset();
}
public String getName() {
ASTNode nameNode = findNameNode();
if (nameNode != null)
return nameNode.getText();
return null;
}
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
ASTNode identifier = ParserChangeUtil.createNameIdentifier(getProject(), name);
ASTNode nameNode = findNameNode();
if (nameNode != null)
getNode().replaceChild(nameNode, identifier);
return this;
}
public ASTNode findNameNode() {
return getNode().findChildByType(ParserTokenTypes.IDENTIFIER);
}
public String toString() {
return "ParserMethod";
}
public Icon getIcon(int flags) {
if(isConstructor()) {
return ParserIcons.PARSER_CLASS_INITIALIZER_ICON;
} else {
if((getParent() != null) && (getParent() instanceof ParserStaticClass)) {
return ParserIcons.PARSER_STATIC_METHOD_ICON;
} else {
return ParserIcons.PARSER_METHOD_ICON;
}
}
}
public ParserParameterList getParameterList() {
return PsiTreeUtil.getChildOfAnyType(this, ParserParameterList.class);
}
private ParserObject getResultObject() {
/*
* fix wrong result of type string
* -- jay
*
* Fixed it by commenting out hasResult != NO_RESULT.
* Will find the reason it wasn't work (probably psi tree cache?)
* -- dwr
*/
if (resultObject == null /*&& hasResult != NO_RESULT*/) {
List<ParserObject> parserObjects = ParserResolveUtil.collectObjectDeclarationsInElement(this);
List<ParserObject> resultObjects = new ArrayList<ParserObject>();
for (ParserObject object : parserObjects) {
if ("result".equals(object.getName())) {
resultObjects.add(object);
}
}
hasResult = NO_RESULT;
if (resultObjects.size() == 1) {
resultObject = resultObjects.get(0);
hasResult = ONE_RESULT;
} else {
hasResult = MANY_RESULTS;
resultObject = null;
}
}
return resultObject;
}
public ParserPassedParameter getReturnValue() {
ParserObject resultObject = getResultObject();
if (resultObject != null) {
return resultObject.getValue();
}
return null;
}
public ParserClass getReturnValueType() {
ParserDoc doc = PsiTreeUtil.getPrevSiblingOfType(this, ParserDoc.class);
while (doc != null) {
ParserDocResultInfo info = PsiTreeUtil.getChildOfType(doc, ParserDocResultInfo.class);
if (info != null) {
ParserMethod method = PsiTreeUtil.getNextSiblingOfType(doc, ParserMethod.class);
if(method != null) {
if(method.getName() != null) {
if(method.getName().equals(getName())) {
Collection<ParserFile> parserFiles = getProject().getService(ParserFileIndex.class).getLoadedClasses().values();
Collection<ParserClass> parserClasses = ParserResolveUtil.getClassesFromFiles(parserFiles);
for(ParserClass parserClass : parserClasses) {
if(parserClass != null) {
if(info.getName().equals(parserClass.getName())) {
return parserClass;
}
}
}
}
}
}
}
doc = PsiTreeUtil.getPrevSiblingOfType(doc, ParserDoc.class);
}
ParserObject resultObject = getResultObject();
/*
* Constructor always returns object,
* so we don't need any return type for it
* in autocompletition
* -- dwr
*/
if(isConstructor()) {
return null;
}
if (hasResult == NO_RESULT) {
return ParserStandardClasses.STRING;
}
if (resultObject != null) {
return resultObject.getType();
}
/*
* XXX suppose that all parser methods
* are returning string if they are
* not belongs to constructors,
* which should return object itself
* (which is already fixed)
* -- dwr
*/
// return null
return ParserStandardClasses.STRING;
}
public String getParserDoc() {
ASTNode treePrev = getNode().getTreePrev();
if (treePrev != null && treePrev.getElementType() == ParserTokenTypes.NEW_LINE) {
treePrev = treePrev.getTreePrev();
}
if (treePrev == null)
return null;
if (treePrev.getElementType() == ParserTokenTypes.SHARP_COMMENT) {
List<String> buf = new ArrayList<String>();
while (treePrev != null && treePrev.getElementType() == ParserTokenTypes.SHARP_COMMENT) {
buf.add(treePrev.getText().replaceFirst("^#+", "") + "<br>");
treePrev = treePrev.getTreePrev();
if (treePrev != null && treePrev.getElementType() == ParserTokenTypes.NEW_LINE) {
treePrev = treePrev.getTreePrev();
}
}
StringBuffer buffer = new StringBuffer();
for (int i = 1; i < buf.size() + 1; i++) {
String s = buf.get(buf.size() - i);
buffer.append(s);
}
return buffer.toString();
}
return treePrev.getText();
}
public ParserDocParameterInfo[] getParameterInfo() {
List<ParserDocParameterInfo> result = new ArrayList<ParserDocParameterInfo>();
ParserDoc doc = PsiTreeUtil.getPrevSiblingOfType(this, ParserDoc.class);
while (doc != null) {
ParserDocParameterInfo info = PsiTreeUtil.getChildOfType(doc, ParserDocParameterInfo.class);
if (info != null) {
result.add(info);
}
doc = PsiTreeUtil.getPrevSiblingOfType(doc, ParserDoc.class);
}
return result.toArray(new ParserDocParameterInfo[result.size()]);
}
}
|
mapway/mapway-maven
|
mapway-web-frame/src/main/java/cn/ennwifi/webframe/service/module/SimpleTableReq.java
|
/**
*
*/
package cn.ennwifi.webframe.service.module;
import java.util.HashMap;
import java.util.Map;
/**
* The type Simple table req.
*
* @author ShaoRuolin
*/
public class SimpleTableReq {
private Map<String, String> queryMap = new HashMap<String, String>();// 条件查询
/**
* Gets query map.
*
* @return the query map
*/
public Map<String, String> getQueryMap() {
return queryMap;
}
/**
* Sets query map.
*
* @param queryMap the query map
*/
public void setQueryMap(Map<String, String> queryMap) {
this.queryMap = queryMap;
}
}
|
xiaohaijin/RHIC-STAR
|
StRoot/Stl3RawReaderMaker/Stl3CounterMaker.h
|
//
// $Id: Stl3CounterMaker.h,v 1.5 2014/08/06 11:44:00 jeromel Exp $
//
// $Log: Stl3CounterMaker.h,v $
// Revision 1.5 2014/08/06 11:44:00 jeromel
// Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
//
// Revision 1.4 2003/09/10 19:47:55 perev
// ansi corrs
//
// Revision 1.3 2002/03/07 22:03:41 struck
// major update: using new NotifyMe() to get input filename, allows to run on
// more than one input file in a chain, two output tables separated into two files
// and put into dedicated dir StarDb/RunLog_l3
//
// Revision 1.2 2002/02/20 22:09:49 struck
// added some debugging info
//
// Revision 1.1 2002/02/13 22:36:31 struck
// major code clean-up for Stl3RawReaderMaker, first version of Stl3CounterMaker
//
//
#ifndef STAR_Stl3CounterMaker
#define STAR_Stl3CounterMaker
//////////////////////////////////////////////////////////////////////////
// //
// Stl3CounterMaker //
// //
// calculates trigger counters //
// - nProcessed //
// - nAccepted //
// - nBuild //
// for each l3 algorithm switched on for the given run //
// and the global counters //
// - nProcessed //
// - nReconstructed //
// and writes this to the database on a daq-file basis //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef StMaker_H
#include "StMaker.h"
#endif
#include "StDAQMaker/StDAQReader.h"
#include "TString.h"
// global upper limits
// correct numbers should come from the database
#define MaxNumberOfGl3Nodes 10
#define MaxNumberOfAlgorithms 20
#define IntParameterSize 5
#define FloatParameterSize 5
// some foreward declaration since includes don't work
// in these cases
class St_l3GlobalCounter;
class St_l3AlgorithmCount;
// ol' fashioned structs for counter bookkeeping
struct AlgorithmCounter {
int algId;
int nProcessed;
int nAccept;
int nBuild;
};
struct GlobalCounter {
int nProcessed;
int nReconstructed;
};
class Stl3CounterMaker : public StMaker {
private:
// General stuff
TDataSet* DAQReaderSet; //!
StL3Reader* ml3reader; //!
TString mDaqFileName; //!
TString* mDbTableFileName; //!
int mDaqFileSequenceNumber; //!
int mRunNumber; //!
// Database
TDataSet* mDbSet; //!
St_l3GlobalCounter* mGlobalCounterTable; //!
St_l3AlgorithmCount* mAlgorithmCounterTable; //!
// switches
bool mL3On;
bool mStoreDbTables;
// counter
GlobalCounter mGlobalCounter[MaxNumberOfGl3Nodes];
AlgorithmCounter mAlgorithmCounter[MaxNumberOfGl3Nodes][MaxNumberOfAlgorithms];
int mNumberOfGl3Nodes;
int mNumberOfAlgorithms;
int mEventCounter;
public:
Stl3CounterMaker(const char *name="l3Counter");
virtual ~Stl3CounterMaker();
virtual Int_t Init();
virtual Int_t Make();
virtual void NotifyMe(const char *about, const void *info);
virtual Int_t GetCounters();
virtual Int_t WriteTable();
virtual Int_t InitTable();
virtual Int_t Finish();
virtual const char *GetCVS() const
{static const char cvs[]="Tag $Name: SL18c $ $Id: Stl3CounterMaker.h,v 1.5 2014/08/06 11:44:00 jeromel Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
ClassDef(Stl3CounterMaker,0) //StAF chain virtual base class for Makers
};
#endif
|
vsukhin/testkube
|
cmd/kubectl-testkube/commands/version.go
|
<reponame>vsukhin/testkube
package commands
import (
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/scripts"
"github.com/kubeshop/testkube/pkg/ui"
"github.com/spf13/cobra"
)
func NewVersionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Shows version and build info",
Long: `Shows version and build info`,
Run: func(cmd *cobra.Command, args []string) {
client, _ := scripts.GetClient(cmd)
info, err := client.GetServerInfo()
if err != nil {
info.Version = info.Version + " " + err.Error()
}
ui.Logo()
ui.Info("Client Version", Version)
ui.Info("Server Version", info.Version)
ui.Info("Commit", Commit)
ui.Info("Built by", BuiltBy)
ui.Info("Build date", Date)
},
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// version validation
// if client version is less than server version show warning
client, _ := scripts.GetClient(cmd)
err := ValidateVersions(client)
if err != nil {
ui.Warn(err.Error())
}
},
}
}
|
touchstonejs/touchstonejs
|
site/pages/Home.js
|
var React = require('react');
var Home = React.createClass({
render () {
return (
<div>
<div className="intro-wrapper">
<div className="ts-container container">
<div className="intro">
<div className="demo">
<div className="demo-viewport">
<iframe src="//touchstonejs.github.io/touchstonejs-starter" width="375" height="667" frameBorder="0" />
</div>
</div>
<div className="intro-content">
<img src="/images/touchstone-logo.svg" className="touchstone-logo" />
<h1>TouchstoneJS</h1>
<h4>React.js powered UI framework for<br/>developing beautiful hybrid mobile apps.</h4>
<p>Docs, examples and getting started guide coming soon.<br />Get notified when we launch</p>
<div className="subscribe-form">
<form action="//touchstonejs.us1.list-manage.com/subscribe/post?u=92d124e53e280584bf5005518&id=e59f569ed3" method="post" noValidate>
<div className="InputGroup">
<div className="InputGroup_section InputGroup_section--grow">
<input type="email" name="EMAIL" placeholder="Email address" className="FormInput" />
</div>
<div className="InputGroup_section">
<button className="Button Button--default" type="submit">Notify me</button>
</div>
</div>
</form>
</div>
<div className="social-links">
<a href="https://touchstonejs.github.io/touchstonejs-starter" className="visible-xs visible-sm" target="_blank">
<img src="/images/iphone.svg" />
<span className="social-link-text">View demo</span>
</a>
<br />
<a href="https://twitter.com/touchstonejs" target="_blank">
<img src="/images/twitter-logo.svg" />
<span className="social-link-text">Follow @touchstonejs</span>
</a>
<br />
<a href="https://github.com/touchstonejs/touchstonejs" target="_blank">
<img src="/images/github-logo.svg" />
<span className="social-link-text">Star on GitHub</span>
</a>
</div>
<p className="current-version">Current version 0.4.0 · Free and open source (MIT)</p>
</div>
</div>
</div>
</div>
<div className="page-body">
<div className="ts-container container">
<div className="article">
<h2>Touchstone is made with…</h2>
<ul className="made-with">
<li>
<a href="http://facebook.github.io/react" target="_blank">
<img src="/images/reactjs.png" alt="ReactJS" title="ReactJS" />
<h5>ReactJS</h5>
<p>A JavaScript library for building user interfaces</p>
</a>
</li>
<li>
<a href="https://cordova.apache.org/" target="_blank">
<img src="/images/cordova.png" alt="Cordova" title="Cordova" />
<h5>Cordova</h5>
<p>Platform for building native mobile apps</p>
</a>
</li>
<li>
<a href="http://www.w3.org/html/" target="_blank">
<img src="/images/html5.png" alt="HTML" title="HTML" />
<h5>HTML5</h5>
<p>The markup language of the internet</p>
</a>
</li>
<li>
<a href="http://www.w3.org/Style/CSS/Overview.en.html" target="_blank">
<img src="/images/css3.png" alt="CSS3" title="CSS3" />
<h5>CSS3</h5>
<p>The presentation language of the internet</p>
</a>
</li>
</ul>
</div>
<div className="article">
<div className="row"><div className="col-sm-10 col-md-offset-1">
<h2 className="mt-0 text-center">Getting Started</h2>
<pre className="code-example__pre">
<code>
{`
$ git clone https://github.com/touchstonejs/touchstonejs-starter.git
$ npm install
$ npm start
`}
</code>
</pre>
<p className="text-center text-sm text-dimmed mt-3">documentation and guide coming soon</p>
</div></div>
</div>
<div className="article">
<h2>Examples & references</h2>
<ul className="examples-references">
<li>
<img src="/images/ei8ht.png" alt="EI8HT Wallet" title="EI8HT Wallet" className="app-logo" />
<h5>Ei8ht Bitcoin Wallet</h5>
<p>The best way to safely send and receive Bitcoin</p>
<div className="app-links">
<a className="Button Button--hollow-primary Button--sm" href="https://itunes.apple.com/us/app/ei8ht/id975816422?mt=8" target="_blank">Download on the App Store</a>
</div>
<img src="/images/app-ei8ht.png" className="app-screenshot" />
</li>
<li>
<img src="/images/react-europe.png" alt="ReactEurope" title="ReactEurope" className="app-logo" />
<h5>React Europe</h5>
<p>Open source conference / attendance app</p>
<div className="app-links">
<a className="Button Button--hollow-primary Button--sm" href="http://thinkmill.com.au/react-europe" target="_blank">Get the App, API, Assets and Source</a>
</div>
<img src="/images/app-react-europe.png" className="app-screenshot" />
</li>
<li>
<img src="/images/touchstone-starter.png" alt="Touchstone Starter" title="Touchstone Starter" className="app-logo" />
<h5>Touchstone Starter</h5>
<p>A great place to start to know TouchstoneJS</p>
<div className="app-links">
<a className="Button Button--hollow-primary Button--sm" href="https://github.com/touchstonejs/touchstonejs-starter" target="_blank">Clone on GitHub</a>
</div>
<img src="/images/app-touchstone-starter.png" className="app-screenshot" />
</li>
</ul>
</div>
</div>
</div>
</div>
);
}
});
module.exports = Home;
|
LookThisCode/DeveloperBus
|
Season 2013/Brazil/Projects/Allow-master/Alow_Android/src/ngvl/android/imfine/ui/ViewMessageActivity.java
|
<reponame>LookThisCode/DeveloperBus<filename>Season 2013/Brazil/Projects/Allow-master/Alow_Android/src/ngvl/android/imfine/ui/ViewMessageActivity.java
package ngvl.android.imfine.ui;
import ngvl.android.imfine.R;
import ngvl.android.imfine.model.Message;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
public class ViewMessageActivity extends ActionBarActivity {
boolean mFromPush;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_message);
mFromPush = getIntent().getBooleanExtra("push", false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Message message = (Message)getIntent().getSerializableExtra("message");
ViewMessageFragment d = ViewMessageFragment.newInstance(message);
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, d)
.commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home){
finish();
}
return super.onOptionsItemSelected(item);
}
@Override
public void finish() {
super.finish();
if (mFromPush){
Intent it = new Intent(this, MainActivity.class);
it.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP |
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(it);
}
}
}
|
Rikkola/guvnor
|
guvnor-webapp/src/main/java/org/drools/guvnor/client/util/LazyStackPanelHeader.java
|
/*
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.guvnor.client.util;
import org.drools.guvnor.client.resources.Images;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
public class LazyStackPanelHeader extends AbstractLazyStackPanelHeader {
private static Images images = GWT.create( Images.class );
interface LazyStackPanelHeaderBinder
extends
UiBinder<Widget, LazyStackPanelHeader> {
}
private static LazyStackPanelHeaderBinder uiBinder = GWT.create( LazyStackPanelHeaderBinder.class );
@UiField
Image icon;
@UiField
Label titleLabel;
private ClickHandler expandClickHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
onTitleClicked();
}
};
public LazyStackPanelHeader(String headerText) {
add( uiBinder.createAndBindUi( this ) );
titleLabel.setText( headerText );
icon.addClickHandler( expandClickHandler );
titleLabel.addClickHandler( expandClickHandler );
setIconImage();
addOpenHandler( new OpenHandler<AbstractLazyStackPanelHeader>() {
public void onOpen(OpenEvent<AbstractLazyStackPanelHeader> event) {
expanded = true;
setIconImage();
}
} );
addCloseHandler( new CloseHandler<AbstractLazyStackPanelHeader>() {
public void onClose(CloseEvent<AbstractLazyStackPanelHeader> event) {
expanded = false;
setIconImage();
}
} );
}
public void expand() {
if ( !expanded ) {
onTitleClicked();
}
}
public void collapse() {
if ( expanded ) {
onTitleClicked();
}
}
private void setIconImage() {
if ( expanded ) {
icon.setResource( images.collapse() );
} else {
icon.setResource( images.expand() );
}
}
private void onTitleClicked() {
if ( expanded ) {
CloseEvent.fire( this,
this );
} else {
OpenEvent.fire( this,
this );
}
}
}
|
ringtail/cloud-provider-alibaba-cloud
|
vendor/k8s.io/kubernetes/pkg/kubeapiserver/default_storage_factory_builder.go
|
<reponame>ringtail/cloud-provider-alibaba-cloud
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package kubeapiserver
import (
"fmt"
"strconv"
"strings"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
serverstorage "k8s.io/apiserver/pkg/server/storage"
"k8s.io/apiserver/pkg/storage/storagebackend"
utilflag "k8s.io/apiserver/pkg/util/flag"
"k8s.io/kubernetes/pkg/api/legacyscheme"
)
// specialDefaultResourcePrefixes are prefixes compiled into Kubernetes.
var specialDefaultResourcePrefixes = map[schema.GroupResource]string{
{Group: "", Resource: "replicationControllers"}: "controllers",
{Group: "", Resource: "replicationcontrollers"}: "controllers",
{Group: "", Resource: "endpoints"}: "services/endpoints",
{Group: "", Resource: "nodes"}: "minions",
{Group: "", Resource: "services"}: "services/specs",
{Group: "extensions", Resource: "ingresses"}: "ingress",
{Group: "extensions", Resource: "podsecuritypolicies"}: "podsecuritypolicy",
}
// NewStorageFactory builds the DefaultStorageFactory.
// Merges defaultResourceConfig with the user specified overrides and merges
// defaultAPIResourceConfig with the corresponding user specified overrides as well.
func NewStorageFactory(storageConfig storagebackend.Config, defaultMediaType string, serializer runtime.StorageSerializer,
defaultResourceEncoding *serverstorage.DefaultResourceEncodingConfig, storageEncodingOverrides map[string]schema.GroupVersion, resourceEncodingOverrides []schema.GroupVersionResource,
defaultAPIResourceConfig *serverstorage.ResourceConfig, resourceConfigOverrides utilflag.ConfigurationMap) (*serverstorage.DefaultStorageFactory, error) {
resourceEncodingConfig := mergeGroupEncodingConfigs(defaultResourceEncoding, storageEncodingOverrides)
resourceEncodingConfig = mergeResourceEncodingConfigs(resourceEncodingConfig, resourceEncodingOverrides)
apiResourceConfig, err := mergeAPIResourceConfigs(defaultAPIResourceConfig, resourceConfigOverrides)
if err != nil {
return nil, err
}
return serverstorage.NewDefaultStorageFactory(storageConfig, defaultMediaType, serializer, resourceEncodingConfig, apiResourceConfig, specialDefaultResourcePrefixes), nil
}
// Merges the given defaultResourceConfig with specifc GroupvVersionResource overrides.
func mergeResourceEncodingConfigs(defaultResourceEncoding *serverstorage.DefaultResourceEncodingConfig, resourceEncodingOverrides []schema.GroupVersionResource) *serverstorage.DefaultResourceEncodingConfig {
resourceEncodingConfig := defaultResourceEncoding
for _, gvr := range resourceEncodingOverrides {
resourceEncodingConfig.SetResourceEncoding(gvr.GroupResource(), gvr.GroupVersion(),
schema.GroupVersion{Group: gvr.Group, Version: runtime.APIVersionInternal})
}
return resourceEncodingConfig
}
// Merges the given defaultResourceConfig with specifc GroupVersion overrides.
func mergeGroupEncodingConfigs(defaultResourceEncoding *serverstorage.DefaultResourceEncodingConfig, storageEncodingOverrides map[string]schema.GroupVersion) *serverstorage.DefaultResourceEncodingConfig {
resourceEncodingConfig := defaultResourceEncoding
for group, storageEncodingVersion := range storageEncodingOverrides {
resourceEncodingConfig.SetVersionEncoding(group, storageEncodingVersion, schema.GroupVersion{Group: group, Version: runtime.APIVersionInternal})
}
return resourceEncodingConfig
}
// Merges the given defaultAPIResourceConfig with the given resourceConfigOverrides.
func mergeAPIResourceConfigs(defaultAPIResourceConfig *serverstorage.ResourceConfig, resourceConfigOverrides utilflag.ConfigurationMap) (*serverstorage.ResourceConfig, error) {
resourceConfig := defaultAPIResourceConfig
overrides := resourceConfigOverrides
// "api/all=false" allows users to selectively enable specific api versions.
allAPIFlagValue, ok := overrides["api/all"]
if ok {
if allAPIFlagValue == "false" {
// Disable all group versions.
resourceConfig.DisableVersions(legacyscheme.Registry.RegisteredGroupVersions()...)
} else if allAPIFlagValue == "true" {
resourceConfig.EnableVersions(legacyscheme.Registry.RegisteredGroupVersions()...)
}
}
// "api/legacy=false" allows users to disable legacy api versions.
disableLegacyAPIs := false
legacyAPIFlagValue, ok := overrides["api/legacy"]
if ok && legacyAPIFlagValue == "false" {
disableLegacyAPIs = true
}
_ = disableLegacyAPIs // hush the compiler while we don't have legacy APIs to disable.
// "<resourceSpecifier>={true|false} allows users to enable/disable API.
// This takes preference over api/all and api/legacy, if specified.
// Iterate through all group/version overrides specified in runtimeConfig.
for key := range overrides {
if key == "api/all" || key == "api/legacy" {
// Have already handled them above. Can skip them here.
continue
}
tokens := strings.Split(key, "/")
if len(tokens) != 2 {
continue
}
groupVersionString := tokens[0] + "/" + tokens[1]
// HACK: Hack for "v1" legacy group version.
// Remove when we stop supporting the legacy group version.
if groupVersionString == "api/v1" {
groupVersionString = "v1"
}
groupVersion, err := schema.ParseGroupVersion(groupVersionString)
if err != nil {
return nil, fmt.Errorf("invalid key %s", key)
}
// Verify that the groupVersion is legacyscheme.Registry.
if !legacyscheme.Registry.IsRegisteredVersion(groupVersion) {
return nil, fmt.Errorf("group version %s that has not been registered", groupVersion.String())
}
enabled, err := getRuntimeConfigValue(overrides, key, false)
if err != nil {
return nil, err
}
if enabled {
resourceConfig.EnableVersions(groupVersion)
} else {
resourceConfig.DisableVersions(groupVersion)
}
}
// Iterate through all group/version/resource overrides specified in runtimeConfig.
for key := range overrides {
tokens := strings.Split(key, "/")
if len(tokens) != 3 {
continue
}
groupVersionString := tokens[0] + "/" + tokens[1]
// HACK: Hack for "v1" legacy group version.
// Remove when we stop supporting the legacy group version.
if groupVersionString == "api/v1" {
groupVersionString = "v1"
}
groupVersion, err := schema.ParseGroupVersion(groupVersionString)
if err != nil {
return nil, fmt.Errorf("invalid key %s", key)
}
resource := tokens[2]
// Verify that the groupVersion is legacyscheme.Registry.
if !legacyscheme.Registry.IsRegisteredVersion(groupVersion) {
return nil, fmt.Errorf("group version %s that has not been registered", groupVersion.String())
}
if !resourceConfig.AnyResourcesForVersionEnabled(groupVersion) {
return nil, fmt.Errorf("%v is disabled, you cannot configure its resources individually", groupVersion)
}
enabled, err := getRuntimeConfigValue(overrides, key, false)
if err != nil {
return nil, err
}
if enabled {
resourceConfig.EnableResources(groupVersion.WithResource(resource))
} else {
resourceConfig.DisableResources(groupVersion.WithResource(resource))
}
}
return resourceConfig, nil
}
func getRuntimeConfigValue(overrides utilflag.ConfigurationMap, apiKey string, defaultValue bool) (bool, error) {
flagValue, ok := overrides[apiKey]
if ok {
if flagValue == "" {
return true, nil
}
boolValue, err := strconv.ParseBool(flagValue)
if err != nil {
return false, fmt.Errorf("invalid value of %s: %s, err: %v", apiKey, flagValue, err)
}
return boolValue, nil
}
return defaultValue, nil
}
|
antineutrino2/pyGeoPressure
|
test/velocity/test_interpolation.py
|
# -*- coding: utf-8 -*-
"""
Created on Aug. 31st 2018
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
import numpy as np
import pygeopressure as ppp
def test__interp_DW():
a = np.array([[2, 2, 2], [2, np.nan, 2], [2, 2, 2]])
ppp.interp_DW(a)
assert (a == np.array([[2, 2, 2], [2, 2, 2], [2, 2, 2]])).all()
def test__spline_1d():
twt = np.array([1000, 2000, 3000, 4000])
vel = np.array([1500, 1800, 2200, 2100])
assert (np.array(ppp.spline_1d(twt, vel, 500)[-1]) == \
np.array([1500.0, 1600.0, 1800.0, 2025.0, 2200.0, 2250.0])).all()
|
AndiLynn/terrier
|
src/include/storage/index/generic_key.h
|
<reponame>AndiLynn/terrier
#pragma once
#include <algorithm>
#include <cstring>
#include <functional>
#include <vector>
#include "common/hash_util.h"
#include "storage/index/index_metadata.h"
#include "storage/projected_row.h"
#include "storage/storage_defs.h"
namespace terrier::storage::index {
// This is the maximum number of bytes to pack into a single GenericKey template. This constraint is arbitrary and can
// be increased if 256-bytes is too small for future workloads.
#define GENERICKEY_MAX_SIZE 256
/**
* GenericKey is a slower key type than CompactIntsKey for use when the constraints of CompactIntsKey make it
* unsuitable. For example, GenericKey supports VARLEN and NULLable attributes.
* @tparam KeySize number of bytes for the key's internal buffer
*/
template <uint16_t KeySize>
class GenericKey {
public:
/**
* key size in bytes, exposed for hasher and comparators
*/
static constexpr size_t key_size_byte = KeySize;
static_assert(KeySize > 0 && KeySize <= GENERICKEY_MAX_SIZE); // size must be no greater than 256-bits
/**
* Set the GenericKey's data based on a ProjectedRow and associated index metadata
* @param from ProjectedRow to generate GenericKey representation of
* @param metadata index information, key_schema used to interpret PR data correctly
*/
void SetFromProjectedRow(const storage::ProjectedRow &from, const IndexMetadata &metadata) {
TERRIER_ASSERT(from.NumColumns() == metadata.GetKeySchema().size(),
"ProjectedRow should have the same number of columns at the original key schema.");
metadata_ = &metadata;
std::memset(key_data_, 0, key_size_byte);
if (metadata.MustInlineVarlen()) {
const auto &key_schema = metadata.GetKeySchema();
const auto &inlined_attr_sizes = metadata.GetInlinedAttributeSizes();
const ProjectedRowInitializer &generic_key_initializer = metadata.GetInlinedPRInitializer();
auto *const pr = GetProjectedRow();
generic_key_initializer.InitializeRow(pr);
for (uint16_t i = 0; i < key_schema.size(); i++) {
const auto offset = static_cast<uint16_t>(from.ColumnIds()[i]);
TERRIER_ASSERT(offset == static_cast<uint16_t>(pr->ColumnIds()[i]), "PRs must have the same comparison order!");
const byte *const from_attr = from.AccessWithNullCheck(offset);
if (from_attr == nullptr) {
pr->SetNull(offset);
} else {
const auto inlined_attr_size = inlined_attr_sizes[i];
if (inlined_attr_size <= 16) {
std::memcpy(pr->AccessForceNotNull(offset), from_attr, inlined_attr_sizes[i]);
} else {
// Convert the VarlenEntry to be inlined
const auto varlen = *reinterpret_cast<const VarlenEntry *const>(from_attr);
byte *const to_attr = pr->AccessForceNotNull(offset);
*reinterpret_cast<uint32_t *const>(to_attr) = varlen.Size();
std::memcpy(to_attr + sizeof(uint32_t), varlen.Content(), varlen.Size());
}
}
}
} else {
std::memcpy(GetProjectedRow(), &from, from.Size());
}
}
/**
* @return Aligned pointer to the key's internal ProjectedRow, exposed for hasher and comparators
*/
const ProjectedRow *GetProjectedRow() const {
const auto *pr = reinterpret_cast<const ProjectedRow *>(StorageUtil::AlignedPtr(sizeof(uint64_t), key_data_));
TERRIER_ASSERT(reinterpret_cast<uintptr_t>(pr) % sizeof(uint64_t) == 0,
"ProjectedRow must be aligned to 8 bytes for atomicity guarantees.");
TERRIER_ASSERT(reinterpret_cast<uintptr_t>(pr) + pr->Size() < reinterpret_cast<uintptr_t>(this) + key_size_byte,
"ProjectedRow will access out of bounds.");
return pr;
}
/**
* @return metadata of the index for this key, exposed for hasher and comparators
*/
const IndexMetadata &GetIndexMetadata() const {
TERRIER_ASSERT(metadata_ != nullptr, "This key has no metadata.");
return *metadata_;
}
/**
* Utility class to evaluate comparisons of embedded types within a ProjectedRow. This is not exposed somewhere like
* type/type_util.h becauase these do not enforce SQL comparison semantics (i.e. NULL comparisons evaluate to NULL).
* These comparisons are merely for ordering semantics. If it makes sense for this to be moved somewhere more general
* purpose in the future, feel free to do so, but for now the only use is in GenericKey and I don't want to encourage
* their misuse elsewhere in the system.
*/
struct TypeComparators {
TypeComparators() = delete;
/**
* @param lhs_attr first VarlenEntry to be compared
* @param rhs_attr second VarlenEntry to be compared
* @return std::memcmp semantics: < 0 means first is less than second, 0 means equal, > 0 means first is greater
* than second
*/
static int CompareVarlens(const byte *const lhs_attr, const byte *const rhs_attr) {
const uint32_t lhs_size = *reinterpret_cast<const uint32_t *const>(lhs_attr);
const uint32_t rhs_size = *reinterpret_cast<const uint32_t *const>(rhs_attr);
const auto smallest_size = std::min(lhs_size, rhs_size);
// get the pointers to the content
const byte *const lhs_content = lhs_attr + sizeof(uint32_t);
const byte *const rhs_content = rhs_attr + sizeof(uint32_t);
auto result = std::memcmp(lhs_content, rhs_content, smallest_size);
if (result == 0 && lhs_size != rhs_size) {
// strings compared as equal, but they have different lengths. Decide based on length
result = lhs_size - rhs_size;
}
return result;
}
#define COMPARE_FUNC(OP) \
switch (type_id) { \
case type::TypeId::BOOLEAN: \
case type::TypeId::TINYINT: \
return *reinterpret_cast<const int8_t *const>(lhs_attr) OP * reinterpret_cast<const int8_t *const>(rhs_attr); \
case type::TypeId::SMALLINT: \
return *reinterpret_cast<const int16_t *const>(lhs_attr) OP * reinterpret_cast<const int16_t *const>(rhs_attr); \
case type::TypeId::INTEGER: \
return *reinterpret_cast<const int32_t *const>(lhs_attr) OP * reinterpret_cast<const int32_t *const>(rhs_attr); \
case type::TypeId::DATE: \
return *reinterpret_cast<const uint32_t *const>(lhs_attr) OP * \
reinterpret_cast<const uint32_t *const>(rhs_attr); \
case type::TypeId::BIGINT: \
return *reinterpret_cast<const int64_t *const>(lhs_attr) OP * reinterpret_cast<const int64_t *const>(rhs_attr); \
case type::TypeId::DECIMAL: \
return *reinterpret_cast<const double *const>(lhs_attr) OP * reinterpret_cast<const double *const>(rhs_attr); \
case type::TypeId::TIMESTAMP: \
return *reinterpret_cast<const uint64_t *const>(lhs_attr) OP * \
reinterpret_cast<const uint64_t *const>(rhs_attr); \
case type::TypeId::VARCHAR: \
case type::TypeId::VARBINARY: { \
return CompareVarlens(lhs_attr, rhs_attr) OP 0; \
} \
default: \
throw std::runtime_error("Unknown TypeId in terrier::storage::index::GenericKey::TypeComparators."); \
}
/**
* @param type_id TypeId to interpret both pointers as
* @param lhs_attr first value to be compared
* @param rhs_attr second value to be compared
* @return true if first is less than second
*/
static bool CompareLessThan(const type::TypeId type_id, const byte *const lhs_attr, const byte *const rhs_attr) {
COMPARE_FUNC(<) // NOLINT
}
/**
* @param type_id TypeId to interpret both pointers as
* @param lhs_attr first value to be compared
* @param rhs_attr second value to be compared
* @return true if first is greater than second
*/
static bool CompareGreaterThan(const type::TypeId type_id, const byte *const lhs_attr, const byte *const rhs_attr) {
COMPARE_FUNC(>) // NOLINT
}
/**
* @param type_id TypeId to interpret both pointers as
* @param lhs_attr first value to be compared
* @param rhs_attr second value to be compared
* @return true if first is equal to second
*/
static bool CompareEquals(const type::TypeId type_id, const byte *const lhs_attr, const byte *const rhs_attr) {
COMPARE_FUNC(==)
}
};
private:
ProjectedRow *GetProjectedRow() {
auto *pr = reinterpret_cast<ProjectedRow *>(StorageUtil::AlignedPtr(sizeof(uint64_t), key_data_));
TERRIER_ASSERT(reinterpret_cast<uintptr_t>(pr) % sizeof(uint64_t) == 0,
"ProjectedRow must be aligned to 8 bytes for atomicity guarantees.");
TERRIER_ASSERT(reinterpret_cast<uintptr_t>(pr) + pr->Size() < reinterpret_cast<uintptr_t>(this) + key_size_byte,
"ProjectedRow will access out of bounds.");
return pr;
}
byte key_data_[key_size_byte];
const IndexMetadata *metadata_ = nullptr;
};
} // namespace terrier::storage::index
namespace std {
/**
* Implements std::hash for GenericKey. Allows the class to be used with STL containers and the BwTree index.
* @tparam KeySize number of bytes for the key's internal buffer
*/
template <uint16_t KeySize>
struct hash<terrier::storage::index::GenericKey<KeySize>> {
public:
/**
* @param key key to be hashed
* @return hash of the key's underlying data
*/
size_t operator()(terrier::storage::index::GenericKey<KeySize> const &key) const {
const auto &metadata = key.GetIndexMetadata();
const auto &key_schema = metadata.GetKeySchema();
const auto &inlined_attr_sizes = metadata.GetInlinedAttributeSizes();
uint64_t running_hash = terrier::common::HashUtil::Hash(metadata);
const auto *const pr = key.GetProjectedRow();
running_hash = terrier::common::HashUtil::CombineHashes(running_hash, terrier::common::HashUtil::Hash(pr->Size()));
running_hash =
terrier::common::HashUtil::CombineHashes(running_hash, terrier::common::HashUtil::Hash(pr->NumColumns()));
for (uint16_t i = 0; i < key_schema.size(); i++) {
const auto offset = static_cast<uint16_t>(pr->ColumnIds()[i]);
const byte *const attr = pr->AccessWithNullCheck(offset);
if (attr == nullptr) {
// attribute is NULL, just hash the nullptr to contribute something to the hash
running_hash = terrier::common::HashUtil::CombineHashes(running_hash, terrier::common::HashUtil::Hash(attr));
continue;
}
// just hash the attribute bytes for inlined attributes
running_hash = terrier::common::HashUtil::CombineHashes(
running_hash, terrier::common::HashUtil::HashBytes(attr, inlined_attr_sizes[i]));
}
return running_hash;
}
};
/**
* Implements std::equal_to for GenericKey. Allows the class to be used with STL containers and the BwTree index.
* @tparam KeySize number of bytes for the key's internal buffer
*/
template <uint16_t KeySize>
struct equal_to<terrier::storage::index::GenericKey<KeySize>> {
/**
* @param lhs first key to be compared
* @param rhs second key to be compared
* @return true if first key is equal to the second key
*/
bool operator()(const terrier::storage::index::GenericKey<KeySize> &lhs,
const terrier::storage::index::GenericKey<KeySize> &rhs) const {
const auto &key_schema = lhs.GetIndexMetadata().GetKeySchema();
for (uint16_t i = 0; i < key_schema.size(); i++) {
const auto *const lhs_pr = lhs.GetProjectedRow();
const auto *const rhs_pr = rhs.GetProjectedRow();
const auto offset = static_cast<uint16_t>(lhs_pr->ColumnIds()[i]);
TERRIER_ASSERT(lhs_pr->ColumnIds()[i] == rhs_pr->ColumnIds()[i], "Comparison orders should be the same.");
const byte *const lhs_attr = lhs_pr->AccessWithNullCheck(offset);
const byte *const rhs_attr = rhs_pr->AccessWithNullCheck(offset);
if (lhs_attr == nullptr) {
if (rhs_attr == nullptr) {
// attributes are both NULL (equal), continue
continue;
}
// lhs is NULL, rhs is non-NULL, return non-equal
return false;
}
if (rhs_attr == nullptr) {
// lhs is non-NULL, rhs is NULL, return non-equal
return false;
}
const terrier::type::TypeId type_id = key_schema[i].GetType();
if (!terrier::storage::index::GenericKey<KeySize>::TypeComparators::CompareEquals(type_id, lhs_attr, rhs_attr)) {
// one of the attrs didn't match, return non-equal
return false;
}
// attributes are equal, continue
}
// keys are equal
return true;
}
};
/**
* Implements std::less for GenericKey. Allows the class to be used with STL containers and the BwTree index.
* @tparam KeySize number of bytes for the key's internal buffer
*/
template <uint16_t KeySize>
struct less<terrier::storage::index::GenericKey<KeySize>> {
/**
* @param lhs first key to be compared
* @param rhs second key to be compared
* @return true if first key is less than the second key
*/
bool operator()(const terrier::storage::index::GenericKey<KeySize> &lhs,
const terrier::storage::index::GenericKey<KeySize> &rhs) const {
const auto &key_schema = lhs.GetIndexMetadata().GetKeySchema();
for (uint16_t i = 0; i < key_schema.size(); i++) {
const auto *const lhs_pr = lhs.GetProjectedRow();
const auto *const rhs_pr = rhs.GetProjectedRow();
const auto offset = static_cast<uint16_t>(lhs_pr->ColumnIds()[i]);
TERRIER_ASSERT(lhs_pr->ColumnIds()[i] == rhs_pr->ColumnIds()[i], "Comparison orders should be the same.");
const byte *const lhs_attr = lhs_pr->AccessWithNullCheck(offset);
const byte *const rhs_attr = rhs_pr->AccessWithNullCheck(offset);
if (lhs_attr == nullptr) {
if (rhs_attr == nullptr) {
// attributes are both NULL (equal), continue
continue;
}
// lhs is NULL, rhs is non-NULL, lhs is less than
return true;
}
if (rhs_attr == nullptr) {
// lhs is non-NULL, rhs is NULL, lhs is greater than
return false;
}
const terrier::type::TypeId type_id = key_schema[i].GetType();
if (terrier::storage::index::GenericKey<KeySize>::TypeComparators::CompareLessThan(type_id, lhs_attr, rhs_attr))
return true;
if (terrier::storage::index::GenericKey<KeySize>::TypeComparators::CompareGreaterThan(type_id, lhs_attr,
rhs_attr))
return false;
// attributes are equal, continue
}
// keys are equal
return false;
}
};
} // namespace std
|
myhong0/sk-bmx-sample
|
NodeJS/nodedbtutorial/websitetitle.js
|
var title = "Lauren's Lovely Landscapes";
var websiteTitle = {
setTitle : function(newTitle) {
title = newTitle;
},
getTitle : function() {
return title;
}
}
module.exports = websiteTitle;
|
jelhan/ember-composable-helpers
|
tests/integration/helpers/compute-test.js
|
<reponame>jelhan/ember-composable-helpers
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Helper | {{compute}}', function(hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function() {
this.actions = {};
this.send = (actionName, ...args) => this.actions[actionName].apply(this, args);
});
test("It calls an action and returns it's value", async function(assert) {
this.actions.square = (x) => x * x;
await render(hbs`{{compute (action "square") 4}}`);
assert.equal(find('*').textContent.trim(), '16', '4 squared is 16');
});
});
|
kant/tdar
|
web/src/main/java/org/tdar/struts/action/cart/CartBillingAccountController.java
|
<reponame>kant/tdar
package org.tdar.struts.action.cart;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.tdar.core.bean.billing.BillingAccount;
import org.tdar.core.bean.entity.TdarUser;
import org.tdar.core.service.billing.BillingAccountService;
import org.tdar.core.service.billing.InvoiceService;
import org.tdar.struts.action.AbstractCartController;
import org.tdar.struts_base.action.TdarActionSupport;
import org.tdar.struts_base.interceptor.annotation.PostOnly;
import org.tdar.struts_base.interceptor.annotation.WriteableSession;
import org.tdar.utils.PersistableUtils;
/**
* Created by JAMES on 6/14/2014.
*/
@Component
@Scope("prototype")
@Namespace("/cart")
@ParentPackage("secured")
@Results({
@Result(name = "redirect-payment", type = TdarActionSupport.TDAR_REDIRECT, location = "/cart/process-payment-request"),
})
public class CartBillingAccountController extends AbstractCartController {
private static final long serialVersionUID = 563992082346864102L;
// id of one of the account chosen from the dropdown list
private long id = -1L;
// account chosen from the dropdown list
private BillingAccount selectedAccount = null;
// Or a user can specify a new account name
private BillingAccount account = new BillingAccount();
private boolean acceptContributorAgreement = false;
@Autowired
private transient InvoiceService invoiceService;
@Autowired
private transient BillingAccountService accountService;
@Override
public void prepare() {
super.prepare();
if (!validateInvoice()) {
return;
}
TdarUser owner = getInvoice().getOwner();
if (owner == null) {
owner = getAuthenticatedUser();
getInvoice().setOwner(owner);
getLogger().debug("invoice had no owner, setting to authenticated user {}", owner);
}
selectedAccount = accountService.reconcileSelectedAccount(id, getInvoice(), getAccount(), getAccounts(), getAuthenticatedUser());
getLogger().debug("selected account: {}", selectedAccount);
getLogger().debug("owner:{}\t accounts:{}", getInvoice().getOwner(), getAccounts());
}
@Override
public void validate() {
if (selectedAccount == null && PersistableUtils.isNotNullOrTransient(id)) {
addActionError(getText("cartController.invalid_account"));
}
if (getInvoice() == null) {
addActionError(getText("cartController.missing_invoice"));
}
// rule: payment method required
if (getInvoice().getPaymentMethod() == null) {
addActionError(getText("cartController.valid_payment_method_is_required"));
}
if (!getAuthenticatedUser().isContributor() && !acceptContributorAgreement) {
addActionError(getText("cartController.please_accept_contributor_agreement"));
}
}
/**
* Assign invoice to (pre-existing or new) billing account.
*
* @return
*/
@Action(value = "process-billing-account-choice", results = {
@Result(name = INPUT, location = "review", type = TDAR_REDIRECT),
@Result(name = SUCCESS, location = "process-payment-request", type = TDAR_REDIRECT) })
@PostOnly
@WriteableSession
public String processBillingAccountChoice() {
if (!getInvoice().isModifiable()) {
addActionError(getText("cartController.cannot_modify_completed_invoice"));
return REDIRECT_START;
}
// if user came via unauthenticated page the owner/proxy may not be set. If either is null, we set both to the current user
if (getInvoice().getOwner() == null || getInvoice().getTransactedBy() == null) {
TdarUser user = getAuthenticatedUser();
getInvoice().setOwner(user);
getInvoice().setTransactedBy(user);
}
accountService.processBillingAccountChoice(selectedAccount, getInvoice(), getAuthenticatedUser());
invoiceService.updateInvoiceStatus(getInvoice());
return SUCCESS;
}
public BillingAccount getSelectedAccount() {
return selectedAccount;
}
public BillingAccount getAccount() {
return account;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public TdarUser getBlankPerson() {
return new TdarUser();
}
public boolean isAcceptContributorAgreement() {
return acceptContributorAgreement;
}
public void setAcceptContributorAgreement(boolean acceptContributorAgreement) {
this.acceptContributorAgreement = acceptContributorAgreement;
}
}
|
tomokinakamaru/protocool
|
src/main/java/com/github/tomokinakamaru/protocool/analysis/EncodeReferenceContexts.java
|
package com.github.tomokinakamaru.protocool.analysis;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.type.ArrayType;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.type.ReferenceType;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.type.WildcardType;
import com.github.tomokinakamaru.protocool.antlr.GrammarParser.ReferenceContext;
import com.github.tomokinakamaru.protocool.antlr.GrammarParser.WildcardContext;
import com.github.tomokinakamaru.protocool.context.ReferenceTypes;
import com.github.tomokinakamaru.protocool.utility.FileContextAnalysis;
import java.util.List;
import org.antlr.v4.runtime.tree.ParseTree;
public class EncodeReferenceContexts extends FileContextAnalysis {
@Override
public void initialize() {
set(new ReferenceTypes());
}
@Override
public void exitReference(ReferenceContext ctx) {
ReferenceType r = encode(ctx);
for (int i = 0; i < ctx.ARRAY().size(); i++) {
r = new ArrayType(r);
}
get(ReferenceTypes.class).put(ctx, r);
}
private ReferenceType encode(ReferenceContext ctx) {
ClassOrInterfaceType c = new ClassOrInterfaceType();
c.setName(ctx.qualifiedName().getText());
encode(ctx.children).ifNonEmpty(c::setTypeArguments);
return c;
}
private NodeList<Type> encode(List<ParseTree> lst) {
NodeList<Type> nodes = new NodeList<>();
for (ParseTree t : lst) {
if (t instanceof ReferenceContext) {
nodes.add(encodeArgument((ReferenceContext) t));
} else if (t instanceof WildcardContext) {
nodes.add(encodeArgument((WildcardContext) t));
}
}
return nodes;
}
private ReferenceType encodeArgument(ReferenceContext ctx) {
return get(ReferenceTypes.class).get(ctx);
}
private Type encodeArgument(WildcardContext ctx) {
WildcardType t = new WildcardType();
if (ctx.reference() != null) {
if (ctx.SUPER() == null) {
t.setExtendedType(encodeArgument(ctx.reference()));
} else {
t.setSuperType(encodeArgument(ctx.reference()));
}
}
return t;
}
}
|
binoue/cke
|
vendor/github.com/etcd-io/gofail/code/failpoint.go
|
<reponame>binoue/cke<gh_stars>100-1000
// Copyright 2016 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package code
import (
"fmt"
"io"
"strings"
)
type Failpoint struct {
goFailGo bool
name string
varType string
code []string
// whitespace for padding
ws string
}
// newFailpoint makes a new failpoint based on the a line containing a
// failpoint comment header.
func newFailpoint(l string) (*Failpoint, error) {
lt := strings.TrimSpace(l)
isGoFail, isGoFailGo := strings.HasPrefix(lt, pfxGofail), strings.HasPrefix(lt, pfxGofailGo)
if !isGoFail && !isGoFailGo {
// not a failpoint
return nil, nil
}
pfx := pfxGofail
if isGoFailGo {
pfx = pfxGofailGo
}
cmd := strings.SplitAfter(l, pfx)[1]
fields := strings.Fields(cmd)
if len(fields) != 3 || fields[0] != "var" {
return nil, fmt.Errorf("failpoint: malformed comment header %q", l)
}
return &Failpoint{goFailGo: isGoFailGo, name: fields[1], varType: fields[2], ws: strings.Split(l, "//")[0]}, nil
}
// flush writes the failpoint code to a buffer
func (fp *Failpoint) flush(dst io.Writer) error {
if len(fp.code) == 0 {
return fp.flushSingle(dst)
}
return fp.flushMulti(dst)
}
func (fp *Failpoint) hdr(varname string) string {
ev := errVarGoFail
if fp.goFailGo {
ev = errVarGoFailGo
}
hdr := fp.ws + "if v" + fp.name + fmt.Sprintf(", %s := ", ev) + fp.Runtime() + ".Acquire();" + fmt.Sprintf(" %s == nil { ", ev)
exec := "defer "
if fp.goFailGo {
exec = "go "
}
hdr = hdr + exec + fp.Runtime() + ".Release(); "
if fp.varType == "struct{}" {
// unused
varname = "_"
}
return hdr + varname + ", __fpTypeOK := v" + fp.name +
".(" + fp.varType + "); if !__fpTypeOK { goto __badType" + fp.name + "} "
}
func (fp *Failpoint) footer() string {
return "; __badType" + fp.name + ": " +
fp.Runtime() + ".BadType(v" + fp.name + ", \"" + fp.varType + "\"); };"
}
func (fp *Failpoint) flushSingle(dst io.Writer) error {
if _, err := io.WriteString(dst, fp.hdr("_")); err != nil {
return err
}
_, err := io.WriteString(dst, fp.footer()+"\n")
return err
}
func (fp *Failpoint) flushMulti(dst io.Writer) error {
hdr := fp.hdr(fp.name) + "\n"
if _, err := io.WriteString(dst, hdr); err != nil {
return err
}
for _, code := range fp.code[:len(fp.code)-1] {
if _, err := io.WriteString(dst, code+"\n"); err != nil {
return err
}
}
code := fp.code[len(fp.code)-1]
_, err := io.WriteString(dst, code+fp.footer()+"\n")
return err
}
func (fp *Failpoint) Name() string { return fp.name }
func (fp *Failpoint) Runtime() string { return "__fp_" + fp.name }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.